@ryzeup/richtexteditor 1.0.31 → 1.0.33

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.umd.js CHANGED
@@ -1,6 +1,6 @@
1
- (function(D,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],e):(D=typeof globalThis!="undefined"?globalThis:D||self,e(D.RichTextEditor={},D.React,D.ReactDOM))})(this,(function(D,e,$){"use strict";var nn=Object.defineProperty,rn=Object.defineProperties;var an=Object.getOwnPropertyDescriptors;var We=Object.getOwnPropertySymbols;var ln=Object.prototype.hasOwnProperty,on=Object.prototype.propertyIsEnumerable;var Xe=(D,e,$)=>e in D?nn(D,e,{enumerable:!0,configurable:!0,writable:!0,value:$}):D[e]=$,ne=(D,e)=>{for(var $ in e||(e={}))ln.call(e,$)&&Xe(D,$,e[$]);if(We)for(var $ of We(e))on.call(e,$)&&Xe(D,$,e[$]);return D},re=(D,e)=>rn(D,an(e));function Ze(a){const d=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const u in a)if(u!=="default"){const m=Object.getOwnPropertyDescriptor(a,u);Object.defineProperty(d,u,m.get?m:{enumerable:!0,get:()=>a[u]})}}return d.default=a,Object.freeze(d)}const Ke=Ze(e);window.React=Ke;var fe={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},ge=e.createContext&&e.createContext(fe),Ye=["attr","size","title"];function Qe(a,d){if(a==null)return{};var u=Re(a,d),m,v;if(Object.getOwnPropertySymbols){var L=Object.getOwnPropertySymbols(a);for(v=0;v<L.length;v++)m=L[v],!(d.indexOf(m)>=0)&&Object.prototype.propertyIsEnumerable.call(a,m)&&(u[m]=a[m])}return u}function Re(a,d){if(a==null)return{};var u={};for(var m in a)if(Object.prototype.hasOwnProperty.call(a,m)){if(d.indexOf(m)>=0)continue;u[m]=a[m]}return u}function ae(){return ae=Object.assign?Object.assign.bind():function(a){for(var d=1;d<arguments.length;d++){var u=arguments[d];for(var m in u)Object.prototype.hasOwnProperty.call(u,m)&&(a[m]=u[m])}return a},ae.apply(this,arguments)}function pe(a,d){var u=Object.keys(a);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(a);d&&(m=m.filter(function(v){return Object.getOwnPropertyDescriptor(a,v).enumerable})),u.push.apply(u,m)}return u}function le(a){for(var d=1;d<arguments.length;d++){var u=arguments[d]!=null?arguments[d]:{};d%2?pe(Object(u),!0).forEach(function(m){Ge(a,m,u[m])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(u)):pe(Object(u)).forEach(function(m){Object.defineProperty(a,m,Object.getOwnPropertyDescriptor(u,m))})}return a}function Ge(a,d,u){return d=Je(d),d in a?Object.defineProperty(a,d,{value:u,enumerable:!0,configurable:!0,writable:!0}):a[d]=u,a}function Je(a){var d=et(a,"string");return typeof d=="symbol"?d:d+""}function et(a,d){if(typeof a!="object"||!a)return a;var u=a[Symbol.toPrimitive];if(u!==void 0){var m=u.call(a,d);if(typeof m!="object")return m;throw new TypeError("@@toPrimitive must return a primitive value.")}return(d==="string"?String:Number)(a)}function ve(a){return a&&a.map((d,u)=>e.createElement(d.tag,le({key:u},d.attr),ve(d.child)))}function A(a){return d=>e.createElement(tt,ae({attr:le({},a.attr)},d),ve(a.child))}function tt(a){var d=u=>{var{attr:m,size:v,title:L}=a,j=Qe(a,Ye),O=v||u.size||"1em",w;return u.className&&(w=u.className),a.className&&(w=(w?w+" ":"")+a.className),e.createElement("svg",ae({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},u.attr,m,j,{className:w,style:le(le({color:a.color||u.color},u.style),a.style),height:O,width:O,xmlns:"http://www.w3.org/2000/svg"}),L&&e.createElement("title",null,L),a.children)};return ge!==void 0?e.createElement(ge.Consumer,null,u=>d(u)):d(fe)}function nt(a){return A({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M352 64c0-17.7-14.3-32-32-32L128 32c-17.7 0-32 14.3-32 32s14.3 32 32 32l192 0c17.7 0 32-14.3 32-32zm96 128c0-17.7-14.3-32-32-32L32 160c-17.7 0-32 14.3-32 32s14.3 32 32 32l384 0c17.7 0 32-14.3 32-32zM0 448c0 17.7 14.3 32 32 32l384 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L32 416c-17.7 0-32 14.3-32 32zM352 320c0-17.7-14.3-32-32-32l-192 0c-17.7 0-32 14.3-32 32s14.3 32 32 32l192 0c17.7 0 32-14.3 32-32z"},child:[]}]})(a)}function rt(a){return A({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M448 64c0 17.7-14.3 32-32 32L192 96c-17.7 0-32-14.3-32-32s14.3-32 32-32l224 0c17.7 0 32 14.3 32 32zm0 256c0 17.7-14.3 32-32 32l-224 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l224 0c17.7 0 32 14.3 32 32zM0 192c0-17.7 14.3-32 32-32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 224c-17.7 0-32-14.3-32-32zM448 448c0 17.7-14.3 32-32 32L32 480c-17.7 0-32-14.3-32-32s14.3-32 32-32l384 0c17.7 0 32 14.3 32 32z"},child:[]}]})(a)}function at(a){return A({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M0 96C0 60.7 28.7 32 64 32l384 0c35.3 0 64 28.7 64 64l0 320c0 35.3-28.7 64-64 64L64 480c-35.3 0-64-28.7-64-64L0 96zM323.8 202.5c-4.5-6.6-11.9-10.5-19.8-10.5s-15.4 3.9-19.8 10.5l-87 127.6L170.7 297c-4.6-5.7-11.5-9-18.7-9s-14.2 3.3-18.7 9l-64 80c-5.8 7.2-6.9 17.1-2.9 25.4s12.4 13.6 21.6 13.6l96 0 32 0 208 0c8.9 0 17.1-4.9 21.2-12.8s3.6-17.4-1.4-24.7l-120-176zM112 192a48 48 0 1 0 0-96 48 48 0 1 0 0 96z"},child:[]}]})(a)}function lt(a){return A({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M24 56c0-13.3 10.7-24 24-24l32 0c13.3 0 24 10.7 24 24l0 120 16 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-80 0c-13.3 0-24-10.7-24-24s10.7-24 24-24l16 0 0-96-8 0C34.7 80 24 69.3 24 56zM86.7 341.2c-6.5-7.4-18.3-6.9-24 1.2L51.5 357.9c-7.7 10.8-22.7 13.3-33.5 5.6s-13.3-22.7-5.6-33.5l11.1-15.6c23.7-33.2 72.3-35.6 99.2-4.9c21.3 24.4 20.8 60.9-1.1 84.7L86.8 432l33.2 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-88 0c-9.5 0-18.2-5.6-22-14.4s-2.1-18.9 4.3-25.9l72-78c5.3-5.8 5.4-14.6 .3-20.5zM224 64l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zm0 160l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zm0 160l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32z"},child:[]}]})(a)}function ot(a){return A({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M12.83 352h262.34A12.82 12.82 0 0 0 288 339.17v-38.34A12.82 12.82 0 0 0 275.17 288H12.83A12.82 12.82 0 0 0 0 300.83v38.34A12.82 12.82 0 0 0 12.83 352zm0-256h262.34A12.82 12.82 0 0 0 288 83.17V44.83A12.82 12.82 0 0 0 275.17 32H12.83A12.82 12.82 0 0 0 0 44.83v38.34A12.82 12.82 0 0 0 12.83 96zM432 160H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0 256H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16z"},child:[]}]})(a)}function it(a){return A({attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M333.49 238a122 122 0 0 0 27-65.21C367.87 96.49 308 32 233.42 32H34a16 16 0 0 0-16 16v48a16 16 0 0 0 16 16h31.87v288H34a16 16 0 0 0-16 16v48a16 16 0 0 0 16 16h209.32c70.8 0 134.14-51.75 141-122.4 4.74-48.45-16.39-92.06-50.83-119.6zM145.66 112h87.76a48 48 0 0 1 0 96h-87.76zm87.76 288h-87.76V288h87.76a56 56 0 0 1 0 112z"},child:[]}]})(a)}function st(a){return A({attr:{viewBox:"0 0 544 512"},child:[{tag:"path",attr:{d:"M0 479.98L99.92 512l35.45-35.45-67.04-67.04L0 479.98zm124.61-240.01a36.592 36.592 0 0 0-10.79 38.1l13.05 42.83-50.93 50.94 96.23 96.23 50.86-50.86 42.74 13.08c13.73 4.2 28.65-.01 38.15-10.78l35.55-41.64-173.34-173.34-41.52 35.44zm403.31-160.7l-63.2-63.2c-20.49-20.49-53.38-21.52-75.12-2.35L190.55 183.68l169.77 169.78L530.27 154.4c19.18-21.74 18.15-54.63-2.35-75.13z"},child:[]}]})(a)}function ct(a){return A({attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M320 48v32a16 16 0 0 1-16 16h-62.76l-80 320H208a16 16 0 0 1 16 16v32a16 16 0 0 1-16 16H16a16 16 0 0 1-16-16v-32a16 16 0 0 1 16-16h62.76l80-320H112a16 16 0 0 1-16-16V48a16 16 0 0 1 16-16h192a16 16 0 0 1 16 16z"},child:[]}]})(a)}function dt(a){return A({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M326.612 185.391c59.747 59.809 58.927 155.698.36 214.59-.11.12-.24.25-.36.37l-67.2 67.2c-59.27 59.27-155.699 59.262-214.96 0-59.27-59.26-59.27-155.7 0-214.96l37.106-37.106c9.84-9.84 26.786-3.3 27.294 10.606.648 17.722 3.826 35.527 9.69 52.721 1.986 5.822.567 12.262-3.783 16.612l-13.087 13.087c-28.026 28.026-28.905 73.66-1.155 101.96 28.024 28.579 74.086 28.749 102.325.51l67.2-67.19c28.191-28.191 28.073-73.757 0-101.83-3.701-3.694-7.429-6.564-10.341-8.569a16.037 16.037 0 0 1-6.947-12.606c-.396-10.567 3.348-21.456 11.698-29.806l21.054-21.055c5.521-5.521 14.182-6.199 20.584-1.731a152.482 152.482 0 0 1 20.522 17.197zM467.547 44.449c-59.261-59.262-155.69-59.27-214.96 0l-67.2 67.2c-.12.12-.25.25-.36.37-58.566 58.892-59.387 154.781.36 214.59a152.454 152.454 0 0 0 20.521 17.196c6.402 4.468 15.064 3.789 20.584-1.731l21.054-21.055c8.35-8.35 12.094-19.239 11.698-29.806a16.037 16.037 0 0 0-6.947-12.606c-2.912-2.005-6.64-4.875-10.341-8.569-28.073-28.073-28.191-73.639 0-101.83l67.2-67.19c28.239-28.239 74.3-28.069 102.325.51 27.75 28.3 26.872 73.934-1.155 101.96l-13.087 13.087c-4.35 4.35-5.769 10.79-3.783 16.612 5.864 17.194 9.042 34.999 9.69 52.721.509 13.906 17.454 20.446 27.294 10.606l37.106-37.106c59.271-59.259 59.271-155.699.001-214.959z"},child:[]}]})(a)}function ut(a){return A({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M80 368H16a16 16 0 0 0-16 16v64a16 16 0 0 0 16 16h64a16 16 0 0 0 16-16v-64a16 16 0 0 0-16-16zm0-320H16A16 16 0 0 0 0 64v64a16 16 0 0 0 16 16h64a16 16 0 0 0 16-16V64a16 16 0 0 0-16-16zm0 160H16a16 16 0 0 0-16 16v64a16 16 0 0 0 16 16h64a16 16 0 0 0 16-16v-64a16 16 0 0 0-16-16zm416 176H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0-320H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16V80a16 16 0 0 0-16-16zm0 160H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16z"},child:[]}]})(a)}function mt(a){return A({attr:{viewBox:"0 0 496 512"},child:[{tag:"path",attr:{d:"M248 8C111 8 0 119 0 256s111 248 248 248 248-111 248-248S385 8 248 8zm80 168c17.7 0 32 14.3 32 32s-14.3 32-32 32-32-14.3-32-32 14.3-32 32-32zm-160 0c17.7 0 32 14.3 32 32s-14.3 32-32 32-32-14.3-32-32 14.3-32 32-32zm194.8 170.2C334.3 380.4 292.5 400 248 400s-86.3-19.6-114.8-53.8c-13.6-16.3 11-36.7 24.6-20.5 22.4 26.9 55.2 42.2 90.2 42.2s67.8-15.4 90.2-42.2c13.4-16.2 38.1 4.2 24.6 20.5z"},child:[]}]})(a)}function ht(a){return A({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M32 64h32v160c0 88.22 71.78 160 160 160s160-71.78 160-160V64h32a16 16 0 0 0 16-16V16a16 16 0 0 0-16-16H272a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h32v160a80 80 0 0 1-160 0V64h32a16 16 0 0 0 16-16V16a16 16 0 0 0-16-16H32a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16zm400 384H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16z"},child:[]}]})(a)}function ft(a){return A({attr:{viewBox:"0 0 256 256",fill:"currentColor"},child:[{tag:"path",attr:{d:"M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM56.84,75.58a8,8,0,0,1,3.58-10.74l16-8A8,8,0,0,1,88,64v48a8,8,0,0,1-16,0V76.94l-4.42,2.22A8,8,0,0,1,56.84,75.58ZM92,180a8,8,0,0,1,0,16H68a8,8,0,0,1-6.4-12.8l21.67-28.89A3.92,3.92,0,0,0,84,152a4,4,0,0,0-7.77-1.33,8,8,0,0,1-15.09-5.34,20,20,0,1,1,35,18.53L84,180Zm100,4H120a8,8,0,0,1,0-16h72a8,8,0,0,1,0,16Zm0-48H120a8,8,0,0,1,0-16h72a8,8,0,0,1,0,16Zm0-48H120a8,8,0,0,1,0-16h72a8,8,0,0,1,0,16Z"},child:[]}]})(a)}function gt(a){return A({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M2 18H9V20H2V18ZM2 11H11V13H2V11ZM2 4H22V6H2V4ZM20.674 13.0251L21.8301 12.634L22.8301 14.366L21.914 15.1711C21.9704 15.4386 22 15.7158 22 16C22 16.2842 21.9704 16.5614 21.914 16.8289L22.8301 17.634L21.8301 19.366L20.674 18.9749C20.2635 19.3441 19.7763 19.6295 19.2391 19.8044L19 21H17L16.7609 19.8044C16.2237 19.6295 15.7365 19.3441 15.326 18.9749L14.1699 19.366L13.1699 17.634L14.086 16.8289C14.0296 16.5614 14 16.2842 14 16C14 15.7158 14.0296 15.4386 14.086 15.1711L13.1699 14.366L14.1699 12.634L15.326 13.0251C15.7365 12.6559 16.2237 12.3705 16.7609 12.1956L17 11H19L19.2391 12.1956C19.7763 12.3705 20.2635 12.6559 20.674 13.0251ZM18 17C18.5523 17 19 16.5523 19 16C19 15.4477 18.5523 15 18 15C17.4477 15 17 15.4477 17 16C17 16.5523 17.4477 17 18 17Z"},child:[]}]})(a)}function pt(a){return A({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M12 21h-7a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v7"},child:[]},{tag:"path",attr:{d:"M3 10h18"},child:[]},{tag:"path",attr:{d:"M10 3v18"},child:[]},{tag:"path",attr:{d:"M19.001 19m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"},child:[]},{tag:"path",attr:{d:"M19.001 15.5v1.5"},child:[]},{tag:"path",attr:{d:"M19.001 21v1.5"},child:[]},{tag:"path",attr:{d:"M22.032 17.25l-1.299 .75"},child:[]},{tag:"path",attr:{d:"M17.27 20l-1.3 .75"},child:[]},{tag:"path",attr:{d:"M15.97 17.25l1.3 .75"},child:[]},{tag:"path",attr:{d:"M20.733 20l1.3 .75"},child:[]}]})(a)}function vt(a){return A({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14z"},child:[]},{tag:"path",attr:{d:"M3 10h18"},child:[]},{tag:"path",attr:{d:"M10 3v18"},child:[]}]})(a)}function Et(a){return A({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M2 20h20v4H2v-4zm3.49-3h2.42l1.27-3.58h5.65L16.09 17h2.42L13.25 3h-2.5L5.49 17zm4.42-5.61 2.03-5.79h.12l2.03 5.79H9.91z"},child:[]}]})(a)}function wt(a){return A({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"},child:[]},{tag:"path",attr:{d:"M20 8V5H6.39l3 3h1.83l-.55 1.28 2.09 2.1L14.21 8zM3.41 4.86 2 6.27l6.97 6.97L6.5 19h3l1.57-3.66L16.73 21l1.41-1.41z"},child:[]}]})(a)}const yt=["😀","😁","😂","đŸ¤Ŗ","😃","😄","😅","😉","😊","😍","😘","😜","😎","đŸ˜ĸ","😭","😡","🤔","🙄","😇","đŸĨ°","🤩","🤗","😴","😋","đŸ˜Ŧ","🤤","đŸ˜ļ‍đŸŒĢī¸","😷","🤕","🤑","🤠","😈","đŸ‘ģ","💀","🤖","đŸļ","🐱","đŸŧ","🐸","đŸĻ„","🐷","đŸĩ","🐰","đŸ¯","đŸĻ","🐮","🌞","🌙","⭐","🌈","đŸ”Ĩ","💧","â„ī¸","⚡","â˜€ī¸","🌸","🌹","🍎","🍕","🍩","🍔","🍟","🍇","🍉","🍓","🍒","đŸĨ­","đŸĨ‘","🎉","🎂","🎁","🎈","đŸŽļ","đŸŽĩ","🏆","âšŊ","🏀","🏸","🏏","đŸ•šī¸","👋","🤚","đŸ–ī¸","✋","🖖","👍","👎","👌","🤌","🤏","✊","👊","🤛","🤜","â˜ī¸","👆","👇","👈","👉","🤟","🤘","🤙","🙌","👏","🙏","âœī¸","💅","🤲","👏","đŸĢļ","👐"],Ee=({exec:a,saveSelection:d,handleFileChange:u,handleFontSizeChange:m,handleFontFamilyChange:v,insertEmoji:L,handleLink:j,removeFormatting:O,visibleActions:w,className:x,style:N})=>{var V,Y;const M=e.useRef(null),W=e.useRef(null),b=e.useRef(null),[k,_]=e.useState(!1),[I,P]=e.useState({x:0,y:0});e.useEffect(()=>{const f=y=>{!y.target.closest(".rte-emoji-popup")&&!y.target.closest("button[title='Emoji']")&&_(!1)};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[]);const q=f=>{var Z;f.preventDefault();const y=f.currentTarget.dataset.command;if(y)switch(y){case"bold":case"italic":case"underline":case"insertUnorderedList":case"insertStaticUnorderedList":case"insertOrderedList":case"insertStaticOrderedList":case"removeFormat":a(y);break;case"insertImage":{(Z=M.current)==null||Z.click();break}default:console.warn("Unknown command:",y)}},K=f=>{a("foreColor",f.target.value)},X=f=>{a("backColor",f.target.value)},[S,H]=e.useState({bold:!1,italic:!1,underline:!1,unorderedList:!1,orderedList:!1,alignLeft:!1,alignCenter:!1,alignRight:!1,removeFormat:!1,link:!1,image:!1,emoji:!1,table:!1,color:!1,highlight:!1}),B=e.useRef(null),F=e.useRef(null);return e.useEffect(()=>{const f=()=>{const y=window.getSelection();if(!y||!y.anchorNode)return;let Z=y.anchorNode.nodeType===Node.ELEMENT_NODE?y.anchorNode:y.anchorNode.parentElement;if(!Z)return;const G=window.getComputedStyle(Z),ie=G.fontFamily.replace(/['"]/g,"").split(",")[0],ce=parseInt(G.fontSize,10);if(B.current){const J=Array.from(B.current.options).some(se=>se.value===ie);B.current.value=J?ie:""}F.current&&(F.current.value=String(ce))};return document.addEventListener("selectionchange",f),()=>document.removeEventListener("selectionchange",f)},[]),e.useEffect(()=>{const f=()=>{H({bold:document.queryCommandState("bold"),italic:document.queryCommandState("italic"),underline:document.queryCommandState("underline"),unorderedList:document.queryCommandState("insertUnorderedList"),orderedList:document.queryCommandState("insertOrderedList"),alignLeft:document.queryCommandState("justifyLeft"),alignCenter:document.queryCommandState("justifyCenter"),alignRight:document.queryCommandState("justifyRight"),removeFormat:document.queryCommandState("removeFormat"),link:document.queryCommandState("createLink"),image:document.queryCommandState("insertImage"),emoji:document.queryCommandState("insertEmoji"),table:document.queryCommandState("insertTable"),color:document.queryCommandState("foreColor"),highlight:document.queryCommandState("backColor")})};return document.addEventListener("selectionchange",f),()=>document.removeEventListener("selectionchange",f)},[]),e.createElement("div",{className:`rte-toolbar ${x||""}`,style:N},w.bold&&e.createElement("button",{"data-command":"bold",title:"Bold",onMouseDown:q,className:S.bold?"rte-active":""},e.createElement(it,null)),w.italic&&e.createElement("button",{"data-command":"italic",title:"Italic",onMouseDown:q,className:S.italic?"rte-active":""},e.createElement(ct,null)),w.underline&&e.createElement("button",{"data-command":"underline",title:"Underline",onMouseDown:q,className:S.underline?"rte-active":""},e.createElement(ht,null)),w.unorderedList&&e.createElement("button",{"data-command":"insertUnorderedList",onMouseDown:q,title:"UnorderedList",className:S.unorderedList?"rte-active":""},e.createElement(gt,null)),w.staticUnorderedList&&e.createElement("button",{"data-command":"insertStaticUnorderedList",onMouseDown:q,title:"StaticUnorderedList",className:S.unorderedList?"rte-active":""},e.createElement(ut,null)),w.orderedList&&e.createElement("button",{"data-command":"insertOrderedList",title:"OrderedList",onMouseDown:q,className:S.orderedList?"rte-active":"",style:{fontSize:"medium"}},e.createElement(ft,null)),w.staticOrderedList&&e.createElement("button",{"data-command":"insertStaticOrderedList",title:"StaticOrderedList",onMouseDown:q,className:S.orderedList?"rte-active":""},e.createElement(lt,null)),w.link&&e.createElement("button",{"data-command":"createLink",title:"Link",onClick:j,className:S.link?"rte-active":""},e.createElement(dt,null)),w.removeFormat&&e.createElement("button",{"data-command":"Remove format",title:"removeFormat",onMouseDown:f=>{f.preventDefault(),d(),O()},className:S.removeFormat?"rte-active":""},e.createElement(wt,null)),w.image&&e.createElement("button",{"data-command":"insertImage",title:"Image",onMouseDown:q,className:S.image?"rte-active":""},e.createElement(at,null)),e.createElement("input",{type:"file",accept:"image/*",ref:M,style:{display:"none"},onChange:u}),w.emoji&&e.createElement("div",{style:{position:"relative"}},e.createElement("button",{title:"Emoji",onMouseDown:f=>{f.preventDefault(),d();const y=f.currentTarget.getBoundingClientRect();P({x:y.left,y:y.bottom+8}),_(Z=>!Z)},className:S.emoji?"rte-active":""},e.createElement(mt,null)),k&&$.createPortal(e.createElement("div",{className:"rte-emoji-popup",style:{top:I.y,left:I.x}},yt.map((f,y)=>e.createElement("span",{key:y,style:{fontSize:"20px",cursor:"pointer",textAlign:"center"},onMouseDown:Z=>{Z.preventDefault(),L(f),_(!1)}},f))),document.body)),w.color&&e.createElement("div",{style:{position:"relative"}},e.createElement("button",{title:"Text Color",onMouseDown:f=>{var y;f.preventDefault(),d(),(y=W.current)==null||y.click()},style:{display:"flex",alignItems:"center",justifyContent:"center",color:((V=W.current)==null?void 0:V.value)||"#000",fontSize:"18px"},className:S.color?"rte-active":""},e.createElement(Et,null)),e.createElement("input",{ref:W,type:"color",defaultValue:"#000000",onChange:f=>{var y;K(f),((y=f.target.parentElement)==null?void 0:y.querySelector("button")).style.color=f.target.value},style:{position:"absolute",opacity:0,width:0,height:0,pointerEvents:"none"}})),w.highlight&&e.createElement("div",{style:{position:"relative"}},e.createElement("button",{title:"Highlight",onMouseDown:f=>{var y;f.preventDefault(),d(),(y=b.current)==null||y.click()},style:{display:"flex",alignItems:"center",justifyContent:"center",color:((Y=b.current)==null?void 0:Y.value)||"#000",fontSize:"18px"},className:S.highlight?"rte-active":""},e.createElement(st,null)),e.createElement("input",{ref:b,type:"color",onChange:f=>{var y;X(f),((y=f.target.parentElement)==null?void 0:y.querySelector("button")).style.color=f.target.value},defaultValue:"#000000",style:{position:"absolute",opacity:0,width:0,height:0,pointerEvents:"none"}})),w.align&&e.createElement(e.Fragment,null,e.createElement("button",{title:"Align Left",onMouseDown:f=>f.preventDefault(),onClick:()=>a("justifyLeft"),className:S.alignLeft?"rte-active":""},e.createElement(ot,null)),e.createElement("button",{title:"Align Center",onMouseDown:f=>f.preventDefault(),onClick:()=>a("justifyCenter"),className:S.alignCenter?"rte-active":""},e.createElement(nt,null)),e.createElement("button",{title:"Align Right",onMouseDown:f=>f.preventDefault(),onClick:()=>a("justifyRight"),className:S.alignRight?"rte-active":""},e.createElement(rt,null))),w.table&&e.createElement("button",{title:"Insert Dynamic Table",onMouseDown:f=>f.preventDefault(),onClick:()=>a("insertTable"),className:S.table?"rte-active":"",style:{fontSize:"medium"}},e.createElement(pt,null)),w.table&&e.createElement("button",{title:"Insert Static Table",onMouseDown:f=>f.preventDefault(),onClick:()=>a("insertStaticTable"),className:S.table?"rte-active":"",style:{fontSize:"medium"}},e.createElement(vt,null)),w.fontFamily&&e.createElement("select",{ref:B,className:"rte-dropdown",defaultValue:"",onMouseDown:()=>d(),onChange:v},e.createElement("option",{value:"",disabled:!0},"Font Family"),e.createElement("option",{value:"Arial"},"Arial"),e.createElement("option",{value:"Georgia"},"Georgia"),e.createElement("option",{value:"Times New Roman"},"Times New Roman"),e.createElement("option",{value:"Courier New"},"Courier New"),e.createElement("option",{value:"Verdana"},"Verdana")),w.fontSize&&e.createElement("select",{ref:F,className:"rte-dropdown rte-fontsize-dropdown",defaultValue:"",onMouseDown:()=>d(),onChange:m},e.createElement("option",{value:"",disabled:!0},"Font Size"),Array.from({length:16},(f,y)=>10+y).map(f=>e.createElement("option",{key:f,value:f},f,"px"))))},bt=({show:a,position:d,filtered:u,insertMention:m,onClose:v,query:L})=>{const j=e.useRef(null),[O,w]=e.useState(0);return e.useEffect(()=>{a&&w(0)},[a]),e.useEffect(()=>{const x=N=>{j.current&&!j.current.contains(N.target)&&v()};return a&&document.addEventListener("mousedown",x),()=>{document.removeEventListener("mousedown",x)}},[a,v]),e.useEffect(()=>{if(!a)return;const x=N=>{if(!(!a||u.length===0)&&(N.key==="ArrowDown"&&(N.preventDefault(),w(M=>Math.min(M+1,u.length-1))),N.key==="ArrowUp"&&(N.preventDefault(),w(M=>Math.max(M-1,0))),N.key==="Enter")){N.preventDefault();const M=u[O];M&&m(M)}};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[a,u,O]),e.useEffect(()=>{if(!j.current)return;const N=j.current.querySelectorAll("li")[O];N&&N.scrollIntoView({block:"nearest",behavior:"smooth"})},[O]),a?e.createElement("ul",{ref:j,className:"rte-popup",style:{top:d.y,left:d.x}},u.length>0?u.map(({name:x,value:N},M)=>{const W=x.toLowerCase(),b=L.toLowerCase(),k=W.indexOf(b);let _=x;if(k!==-1&&L.length>0){const I=k+L.length;_=x.substring(0,k)+`<span class="rte-highlight">${x.substring(k,I)}</span>`+x.substring(I)}return e.createElement("li",{key:N,onMouseDown:I=>{I.preventDefault(),m({name:x,value:N})},style:{padding:"6px 12px",cursor:"pointer",fontSize:"14px",background:M===O?"#dce8ff":"white"},dangerouslySetInnerHTML:{__html:_},onMouseEnter:()=>w(M)})}):e.createElement("li",{style:{padding:"6px 12px",color:"#999"}},"No matches")):null};function we(a){return A({attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{id:"Circle_Minus"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{d:"M15,11.5h0a.5.5,0,0,1,0,1H9a.5.5,0,0,1,0-1Z"},child:[]},{tag:"path",attr:{d:"M12,21.934A9.933,9.933,0,1,1,21.932,12,9.945,9.945,0,0,1,12,21.934ZM12,3.068A8.933,8.933,0,1,0,20.932,12,8.944,8.944,0,0,0,12,3.068Z"},child:[]}]}]}]})(a)}function oe(a){return A({attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{id:"Circle_Plus"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{d:"M15,12.5H12.5V15a.5.5,0,0,1-1,0V12.5H9a.5.5,0,0,1,0-1h2.5V9a.5.5,0,0,1,1,0v2.5H15A.5.5,0,0,1,15,12.5Z"},child:[]},{tag:"path",attr:{d:"M12,21.932A9.934,9.934,0,1,1,21.932,12,9.944,9.944,0,0,1,12,21.932ZM12,3.065A8.934,8.934,0,1,0,20.932,12,8.944,8.944,0,0,0,12,3.065Z"},child:[]}]}]}]})(a)}const Ct=({visible:a,x:d,y:u,onAction:m,onClose:v})=>{if(!a)return null;const L={top:u,left:d};return e.createElement("div",{style:L,className:"rte-table-menu",onMouseLeave:v},e.createElement("button",{onClick:()=>m("insertRowAbove")},e.createElement(oe,null)," Insert row above"),e.createElement("button",{onClick:()=>m("insertRowBelow")},e.createElement(oe,null)," Insert row below"),e.createElement("button",{onClick:()=>m("insertColLeft")},e.createElement(oe,null)," Insert col left"),e.createElement("button",{onClick:()=>m("insertColRight")},e.createElement(oe,null)," Insert col right"),e.createElement("button",{onClick:()=>m("deleteRow")},e.createElement(we,null)," Delete row"),e.createElement("button",{onClick:()=>m("deleteCol")},e.createElement(we,null)," Delete column"))};function ye(a){return A({attr:{viewBox:"0 0 1024 1024"},child:[{tag:"path",attr:{d:"M885.9 490.3c3.6-12 5.4-24.4 5.4-37 0-28.3-9.3-55.5-26.1-77.7 3.6-12 5.4-24.4 5.4-37 0-28.3-9.3-55.5-26.1-77.7 3.6-12 5.4-24.4 5.4-37 0-51.6-30.7-98.1-78.3-118.4a66.1 66.1 0 0 0-26.5-5.4H144c-17.7 0-32 14.3-32 32v364c0 17.7 14.3 32 32 32h129.3l85.8 310.8C372.9 889 418.9 924 470.9 924c29.7 0 57.4-11.8 77.9-33.4 20.5-21.5 31-49.7 29.5-79.4l-6-122.9h239.9c12.1 0 23.9-3.2 34.3-9.3 40.4-23.5 65.5-66.1 65.5-111 0-28.3-9.3-55.5-26.1-77.7zM184 456V172h81v284h-81zm627.2 160.4H496.8l9.6 198.4c.6 11.9-4.7 23.1-14.6 30.5-6.1 4.5-13.6 6.8-21.1 6.7a44.28 44.28 0 0 1-42.2-32.3L329 459.2V172h415.4a56.85 56.85 0 0 1 33.6 51.8c0 9.7-2.3 18.9-6.9 27.3l-13.9 25.4 21.9 19a56.76 56.76 0 0 1 19.6 43c0 9.7-2.3 18.9-6.9 27.3l-13.9 25.4 21.9 19a56.76 56.76 0 0 1 19.6 43c0 9.7-2.3 18.9-6.9 27.3l-14 25.5 21.9 19a56.76 56.76 0 0 1 19.6 43c0 19.1-11 37.5-28.8 48.4z"},child:[]}]})(a)}function be(a){return A({attr:{viewBox:"0 0 1024 1024"},child:[{tag:"path",attr:{d:"M885.9 533.7c16.8-22.2 26.1-49.4 26.1-77.7 0-44.9-25.1-87.4-65.5-111.1a67.67 67.67 0 0 0-34.3-9.3H572.4l6-122.9c1.4-29.7-9.1-57.9-29.5-79.4A106.62 106.62 0 0 0 471 99.9c-52 0-98 35-111.8 85.1l-85.9 311H144c-17.7 0-32 14.3-32 32v364c0 17.7 14.3 32 32 32h601.3c9.2 0 18.2-1.8 26.5-5.4 47.6-20.3 78.3-66.8 78.3-118.4 0-12.6-1.8-25-5.4-37 16.8-22.2 26.1-49.4 26.1-77.7 0-12.6-1.8-25-5.4-37 16.8-22.2 26.1-49.4 26.1-77.7-.2-12.6-2-25.1-5.6-37.1zM184 852V568h81v284h-81zm636.4-353l-21.9 19 13.9 25.4a56.2 56.2 0 0 1 6.9 27.3c0 16.5-7.2 32.2-19.6 43l-21.9 19 13.9 25.4a56.2 56.2 0 0 1 6.9 27.3c0 16.5-7.2 32.2-19.6 43l-21.9 19 13.9 25.4a56.2 56.2 0 0 1 6.9 27.3c0 22.4-13.2 42.6-33.6 51.8H329V564.8l99.5-360.5a44.1 44.1 0 0 1 42.2-32.3c7.6 0 15.1 2.2 21.1 6.7 9.9 7.4 15.2 18.6 14.6 30.5l-9.6 198.4h314.4C829 418.5 840 436.9 840 456c0 16.5-7.2 32.1-19.6 43z"},child:[]}]})(a)}const Ce=({html:a,className:d,style:u,attributes:m,setAttributes:v})=>{const[L,j]=e.useState("web"),O={web:{label:"Web",width:"100%",height:"100%"},galaxyS23:{label:"Galaxy S23",width:360,height:780},iphoneSE:{label:"iPhone SE (3rd Gen)",width:375,height:667},iphoneX:{label:"iPhone X / XS",width:375,height:812},pixel7a:{label:"Pixel 7a",width:390,height:844},iphone12:{label:"iPhone 12 / 13 / 14",width:390,height:844},iphone14:{label:"iPhone 14 Pro",width:393,height:852},pixel7:{label:"Pixel 7",width:412,height:915},iphone11:{label:"iPhone 11",width:414,height:896},iphone14ProMax:{label:"iPhone 14 Pro Max",width:430,height:932},pixel8Pro:{label:"Pixel 8 Pro",width:448,height:998},galaxyS24Ultra:{label:"Galaxy S24 Ultra",width:480,height:1040}},w=b=>{const k=b.target;if(k.tagName==="A"){b.preventDefault();const _=k.href;_&&window.open(_,"_blank","noopener,noreferrer")}},x=b=>b==="rgb(0, 0, 0)"||b==="rgba(0, 0, 0, 1)"||b==="#000"||b==="#000000"||b==="black",N=b=>{const k=document.createElement("div");k.innerHTML=b;const _=document.createTreeWalker(k,NodeFilter.SHOW_TEXT,null),I=[];for(;_.nextNode();){const P=_.currentNode;P.nodeValue&&/{{\s*[\s\S]*?\s*}}/.test(P.nodeValue)&&I.push(P)}return I.forEach(P=>{var F;const q=P.nodeValue||"",K=P.parentElement;if(!K)return;let X=K,S=!1;for(;X;){if(X.tagName==="FONT"&&X.getAttribute("color")){S=!0;break}const V=(F=X.style)==null?void 0:F.color;if(V&&!x(V)){S=!0;break}const Y=window.getComputedStyle(X);if(Y.color&&!x(Y.color)){S=!0;break}X=X.parentElement}const H=document.createDocumentFragment();let B=0;q.replace(/{{\s*([\s\S]*?)\s*}}/g,(V,Y,f)=>{if(f>B&&H.appendChild(document.createTextNode(q.slice(B,f))),S)H.appendChild(document.createTextNode(V));else{const y=document.createElement("span");y.style.color="blue",y.textContent=V,H.appendChild(y)}return B=f+V.length,V}),B<q.length&&H.appendChild(document.createTextNode(q.slice(B))),K.replaceChild(H,P)}),k.innerHTML=k.innerHTML.replace(/{{#arrayData}}/g,"").replace(/{{\/arrayData}}/g,""),k.innerHTML},M=()=>new Date().toLocaleDateString("en-US",{month:"short",day:"2-digit",year:"numeric"}),W=()=>new Date().toLocaleString("en-US",{month:"short",day:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit",hour12:!0});return e.createElement("div",{className:`rte-preview ${d||""}`,style:re(ne({},u),{position:"relative"}),onClick:w},e.createElement("div",{className:"rte-preview-device-picker"},e.createElement("select",{value:L,onChange:b=>j(b.target.value)},Object.entries(O).map(([b,k])=>e.createElement("option",{key:b,value:b},k.label)))),L==="web"&&e.createElement("div",{className:"rte-preview-web-wrapper"},e.createElement("div",{className:"rte-preview-card"},e.createElement("div",{className:"rte-preview-content",dangerouslySetInnerHTML:{__html:N(a)}}),e.createElement("div",{className:"rte-preview-meta"},"Data updated as on Dec 14, 2025"),e.createElement("div",{className:"rte-preview-footer"},e.createElement("div",{className:"rte-preview-actions"},e.createElement(be,{className:"rte-preview-like"}),e.createElement(ye,{className:"rte-preview-like"})),e.createElement("div",{className:"rte-preview-time"},"Dec 26, 2025 5:57 PM")))),L!=="web"&&e.createElement("div",{className:"rte-preview-mobile-overlay"},e.createElement("div",{className:"rte-preview-mobile-frame",style:{width:O[L].width,height:O[L].height}},e.createElement("div",{className:"rte-preview-mobile-header"},e.createElement("div",{className:"rte-preview-logo"},"A"),e.createElement("div",{className:"rte-preview-bell"},"🔔",e.createElement("span",{className:"rte-preview-badge"},"99+"))),e.createElement("div",{className:"rte-preview-tabs-wrapper"},e.createElement("div",{className:"rte-preview-tabs"},e.createElement("div",{className:"rte-preview-tab rte-preview-tab-active"},"My Alerts"),e.createElement("div",{className:"rte-preview-tab"},"Reportees Alerts"))),e.createElement("div",{className:"rte-preview-mobile-body"},e.createElement("div",{className:"rte-preview-card"},e.createElement("div",{className:"rte-preview-content",dangerouslySetInnerHTML:{__html:N(a)}}),e.createElement("div",{className:"rte-preview-meta"},"Data updated as on ",M()),e.createElement("div",{className:"rte-preview-footer"},e.createElement("div",{className:"rte-preview-actions"},e.createElement(be,{className:"rte-preview-like"}),e.createElement(ye,{className:"rte-preview-like"})),e.createElement("div",{className:"rte-preview-time"},W())))))),e.createElement("div",null,e.createElement("h3",{style:{marginBottom:10}},"Enter Attribute Values"),e.createElement("div",{className:"rte-attr-list"},Object.keys(m).map(b=>e.createElement("div",{key:b,className:"rte-attr-row"},e.createElement("div",{className:"rte-attr-name"},`{{${b}}}`),e.createElement("span",null," : "),e.createElement("input",{className:"rte-attr-input",value:m[b]||"",onChange:k=>{const _=k.target.value;v(I=>re(ne({},I),{[b]:_}))},placeholder:"Enter value"}))))))},Lt=({visible:a,linkData:d,onClose:u,onInsert:m})=>{const[v,L]=e.useState(""),[j,O]=e.useState(""),[w,x]=e.useState(""),[N,M]=e.useState("_self");if(e.useEffect(()=>{a?(L(d.url||""),O(d.text||""),x(d.title||""),M(d.target||"_self")):(L(""),O(""),x(""),M("_self"))},[a,d]),!a)return null;const W=()=>{m({url:v,text:j,title:w,target:N})};return e.createElement(e.Fragment,null,e.createElement("div",{className:"rte-link-modal-overlay",onClick:u}),e.createElement("div",{className:"rte-link-modal"},e.createElement("h4",{className:"rte-link-modal__title"},v?"Edit Link":"Insert Link"),e.createElement("input",{type:"text",className:"rte-link-modal__input",placeholder:"URL",value:v,onChange:b=>L(b.target.value)}),e.createElement("input",{type:"text",className:"rte-link-modal__input",placeholder:"Text to Display",value:j,onChange:b=>O(b.target.value)}),e.createElement("input",{type:"text",className:"rte-link-modal__input",placeholder:"Title",value:w,onChange:b=>x(b.target.value)}),e.createElement("select",{className:"rte-link-modal__select",value:N,onChange:b=>M(b.target.value)},e.createElement("option",{value:"_self"},"Same tab"),e.createElement("option",{value:"_blank"},"New tab")),e.createElement("div",{className:"rte-link-modal__actions"},e.createElement("button",{className:"rte-link-modal__btn",onClick:u},"Cancel"),e.createElement("button",{className:"rte-link-modal__btn rte-link-modal__btn--ok",onClick:W},"OK"))))};function Le(a){const d=new Map;return a.forEach(u=>{d.set(u.name,u.value)}),Array.from(d.entries()).map(([u,m])=>({name:u,value:m}))}const St=({atSuggestions:a=[],showOutput:d=!1,showPreview:u=!1,toolbarConfig:m={link:!1,image:!1,emoji:!1,table:!1,color:!1,fontFamily:!1,fontSize:!1,highlight:!1,unorderedList:!1,orderedList:!1,staticUnorderedList:!1,staticOrderedList:!1},classNames:v={},styles:L={},handleGetHtml:j=()=>{},onChange:O=()=>{},value:w,onMentionSelect:x=()=>{},handleAddAttributes:N=()=>{}})=>{var Oe,He,Pe,je,_e,Fe,Ie,qe,Be,Ve,Ue,$e;const M=e.useRef(null),[W,b]=e.useState(w!=null&&w.length?w:" "),[k,_]=e.useState(""),[I,P]=e.useState(!1),[q,K]=e.useState({x:0,y:0}),[X,S]=e.useState([]),H=e.useRef(null),B=e.useRef(null),[F,V]=e.useState({visible:!1,x:0,y:0}),[Y,f]=e.useState(!1),y=e.useRef(null),[Z,G]=e.useState({url:"",text:"",title:"",target:"_self"}),ie={bold:!0,italic:!0,underline:!0,removeFormat:!0,unorderedList:(Oe=m.unorderedList)!=null?Oe:!0,orderedList:(He=m.orderedList)!=null?He:!0,staticUnorderedList:(Pe=m.staticUnorderedList)!=null?Pe:!0,staticOrderedList:(je=m.staticOrderedList)!=null?je:!0,align:!0,link:(_e=m.link)!=null?_e:!1,image:(Fe=m.image)!=null?Fe:!1,emoji:(Ie=m.emoji)!=null?Ie:!1,table:(qe=m.table)!=null?qe:!1,color:(Be=m.color)!=null?Be:!1,fontFamily:(Ve=m.fontFamily)!=null?Ve:!1,fontSize:(Ue=m.fontSize)!=null?Ue:!1,highlight:($e=m.fontSize)!=null?$e:!1},[ce,J]=e.useState(""),[se,de]=e.useState([]),[Se,xe]=e.useState({}),U=()=>M.current,T=()=>{const t=xt(),n=/^<div[^>]*style=["'][^"']*font-size\s*:\s*\d+px[^"']*["'][^>]*>/.test(t.trim());let r=t;n||(r=`<div style="font-size: 12px; color: #4f5055;">${t}</div>`),r=r.replace(/<(ul|ol)([^>]*)>[\s\S]*?<\/\1>/g,(i,p,E)=>{if(/list-type=["']static["']/.test(E)||i.includes("data-hidden-array-start")||i.includes("data-hidden-array-end"))return i;const h=`<${p}${E}>`,c='<span data-hidden-array-start="true" style="display:none">{{#arrayData}}</span>',g='<span data-hidden-array-end="true" style="display:none">{{/arrayData}}</span>',C=`</${p}>`,z=i.replace(new RegExp(`^${h}`),"").replace(new RegExp(`${C}$`),"");return`${h}${c}${z}${g}${C}`}),_(r),j==null||j(r);const l=Wt(t);O(l);const s=Ot(),o=Le(s);JSON.stringify(o)!==JSON.stringify(se)&&(de(o),x(o),en(o))},xt=()=>{const t=U();if(!t)return W;const n=t.cloneNode(!0);n.querySelectorAll("table div").forEach(l=>l.remove()),n.querySelectorAll("table").forEach(l=>{l.removeAttribute("data-has-resize-handle")}),n.querySelectorAll(".rte-cell-highlight").forEach(l=>l.classList.remove("rte-cell-highlight"));let r=n.innerHTML;return r=Nt(r),r},Nt=t=>{const n=document.createElement("div");return n.innerHTML=t,n.querySelectorAll("tbody").forEach(r=>{r.getAttribute("table-type")==="static"||(r.innerHTML=`{{#arrayData}}${r.innerHTML}{{/arrayData}}`)}),n.innerHTML},Q=()=>{const t=window.getSelection();if(!t||t.rangeCount===0)return;const n=document.getElementById("rte-editor-body");if(!n)return;const r=t.getRangeAt(0);n.contains(r.startContainer)&&(H.current=r.cloneRange())},R=()=>{const t=window.getSelection();!t||!H.current||(t.removeAllRanges(),t.addRange(H.current))},Ne=(t,n)=>{const r=window.getSelection();r&&r.rangeCount>0&&(H.current=r.getRangeAt(0)),R(),document.execCommand(t,!1,n),T()};e.useEffect(()=>{const t=U();if(!t||!w)return;const n=Mt(w);t.innerHTML=n,T()},[]);const Mt=t=>t.replace(/(<table[\s\S]*?>[\s\S]*?<\/table>)/g,n=>n.replace(/{{#arrayData}}/g,"").replace(/{{\/arrayData}}/g,""));e.useEffect(()=>()=>{document.removeEventListener("mousemove",null),document.removeEventListener("mouseup",null)},[]),e.useEffect(()=>{N&&N(t=>{Dt(t)})},[]),e.useEffect(()=>{const t=U();if(!t)return;t.querySelectorAll("table").forEach(r=>{r.hasAttribute("data-has-resize-handle")||(he(r),r.querySelectorAll("th, td").forEach(s=>ee(s)))})},[]);const Me=t=>{for(;t&&t.nodeName!=="LI";)t=t.parentNode;return t},Te=(t,n)=>{var h;const r=window.getSelection();if(!(r!=null&&r.rangeCount))return;const l=r.getRangeAt(0),s=Me(l.startContainer);let o,i;const p=n==="insertStaticUnorderedList"||n==="insertStaticOrderedList";if(s){let c=s.querySelector(t);c||(c=document.createElement(t),c.style.margin="0",c.style.paddingLeft="20px",s.appendChild(c)),i=c,o=document.createElement("li"),o.textContent="​",i.appendChild(o)}else{document.execCommand(t==="ul"?"insertUnorderedList":"insertOrderedList");const c=U();if(i=c==null?void 0:c.querySelector(`${t}:last-child`),!i)return;p&&i.setAttribute("list-type","static"),o=i.querySelector("li:last-child")}const E=document.createRange();E.setStart(o,0),E.collapse(!0),r.removeAllRanges(),r.addRange(E),(h=U())==null||h.focus(),T()},ue=(t,n)=>{t==="insertOrderedList"||t==="insertStaticOrderedList"?Te("ol",t):t==="insertUnorderedList"||t==="insertStaticUnorderedList"?Te("ul",t):t.startsWith("justify")?Zt(t):Ne(t,n),t==="insertTable"&&ke(),t==="insertStaticTable"&&ke("insertStaticTable")},Tt=t=>{const n=document.createElement("span");n.textContent="​",t.insertNode(n),t.setStartAfter(n),t.collapse(!0);const r=n.getBoundingClientRect();n.remove(),K({x:r.left,y:r.bottom+window.scrollY}),S(a||[]),P(!0),B.current=t.cloneRange()},At=()=>{const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.anchorNode;let r=t.anchorOffset;if(!n)return null;let l=n;for(l.nodeType!==Node.TEXT_NODE&&(l.childNodes&&l.childNodes[r]?l=l.childNodes[r]:l=n.previousSibling);l;){if(l.nodeType===Node.TEXT_NODE){const s=l.textContent||"",o=l===n?r:s.length,i=s.lastIndexOf("@",o-1);if(i!==-1){const p=document.createRange();return p.setStart(l,i),p.setEnd(l,o),p}}l=l.previousSibling}return null},kt=t=>{var o;const n=window.getSelection();if(!n)return;const r=At();r?(n.removeAllRanges(),n.addRange(r)):B.current&&(n.removeAllRanges(),n.addRange(B.current));const l=document.createElement("span");l.textContent=`{{${t.name}}}`,l.style.display="inline",l.setAttribute("data-mention",t.value||t.name||""),l.title=`{{${t.name}}}`;try{const i=n.rangeCount?n.getRangeAt(0):null;if(i)i.deleteContents(),i.insertNode(l);else{const h=document.createRange(),c=U();h.selectNodeContents(c),h.collapse(!1),h.insertNode(l)}const p=document.createTextNode("​");l.after(p);const E=document.createRange();E.setStartAfter(p),E.collapse(!0),n.removeAllRanges(),n.addRange(E)}catch(i){console.error("insertMention error:",i)}let s=Le([...se,t]);de(s),x(s),P(!1),(o=U())==null||o.focus(),T()},zt=t=>{const n=U();if(!n)return;let r=null;H.current&&n.contains(H.current.startContainer)?r=H.current.cloneRange():(r=document.createRange(),r.selectNodeContents(n),r.collapse(!1));const l=window.getSelection();if(!l)return;l.removeAllRanges(),l.addRange(r);const s=document.createElement("span");s.textContent=`{{${t.name}}}`,s.style.display="inline",s.setAttribute("data-mention",t.value||t.name),s.title=`{{${t.name}}}`,r.insertNode(s);const o=document.createTextNode(" ");s.after(o);const i=document.createRange();i.setStartAfter(o),i.collapse(!0),l.removeAllRanges(),l.addRange(i),H.current=i.cloneRange(),n.focus()},Dt=t=>{t.forEach(n=>zt(n)),de(n=>{const r=[...n,...t],l=Array.from(new Map(r.map(s=>[s.name,s])).values());return x(l),l}),T()},Ot=()=>{const t=U();if(!t)return[];const n=t.querySelectorAll("span[data-mention]"),r=[];return n.forEach(l=>{const s=l.getAttribute("data-mention")||"",i=(l.textContent||"").match(/{{(.+?)}}/);i&&r.push({name:i[1],value:s})}),r},Ht=t=>{var r,l,s;const n=t.key.toLowerCase();if((t.ctrlKey||t.metaKey)&&["b","i","u"].includes(n)&&(t.preventDefault(),ue(n==="b"?"bold":n==="i"?"italic":n==="u"?"underline":"")),t.shiftKey&&t.key==="2"&&t.preventDefault(),t.key==="Enter"){const o=window.getSelection(),i=o!=null&&o.anchorNode?Me(o.anchorNode):null;if(!i)return;if(((r=i.textContent)==null?void 0:r.replace(/\u200B/g,"").trim())===""){t.preventDefault();const E=i.parentElement,h=E==null?void 0:E.closest("li");if(h){E==null||E.removeChild(i);const c=document.createElement("p");c.innerHTML="<br />",(l=h.parentElement)==null||l.insertBefore(c,h.nextSibling);const g=document.createRange();g.setStart(c,0),g.collapse(!0),o==null||o.removeAllRanges(),o==null||o.addRange(g)}else{const c=i.closest("ul, ol");if(c){const g=document.createElement("p");g.innerHTML="<br />",(s=c.parentElement)==null||s.insertBefore(g,c.nextSibling),c.removeChild(i);const C=document.createRange();C.setStart(g,0),C.collapse(!0),o==null||o.removeAllRanges(),o==null||o.addRange(C)}}T()}}if(n==="backspace"||n==="delete"){const o=window.getSelection();if(!o||o.rangeCount===0)return;const i=o.getRangeAt(0);if(i.cloneContents().querySelector("table"))return;if(i.cloneContents().querySelectorAll(".rte-resize-handle").length>0){t.preventDefault(),t.stopPropagation();return}}},Pt=t=>{if(t.data==="@"){const r=window.getSelection();if(!(r!=null&&r.rangeCount))return;const l=r.anchorNode;if(me(l))return;setTimeout(()=>{Tt(r.getRangeAt(0)),J(""),S(a),P(!0)},0);return}if(I){setTimeout(()=>Ae(),0);return}},me=t=>{if(!t)return!1;let n=t.nodeType===Node.ELEMENT_NODE?t:t.parentElement;for(;n;){if(n.tagName==="TH")return!0;n=n.parentElement}return!1},Ae=()=>{T();const t=window.getSelection();if(!t||!t.anchorNode)return;if(me(t.anchorNode)){P(!1);return}let n=t.anchorNode.textContent||"";n=n.replace(/\u00A0/g," ");const r=n.match(/@([^\n]*)$/);if(!r){P(!1);return}const l=r[1].trim().toLowerCase();J(l);const s=a.filter(o=>o.name.toLowerCase().includes(l));s.length>0?(S(s),P(!0)):P(!1)},jt=t=>{var l;const n=(l=t.target.files)==null?void 0:l[0];if(!n)return;const r=new FileReader;r.onload=s=>{var C;const o=(C=s.target)==null?void 0:C.result;R();const i=window.getSelection();let p=i&&i.rangeCount?i.getRangeAt(0):null;const E=document.createElement("img");E.src=o,E.alt=n.name||"image",E.className="rte-inserted-image",E.contentEditable="true";const h=U();if(!p||!h){h==null||h.appendChild(E);const z=document.createTextNode(" ");h==null||h.appendChild(z);const te=document.createRange();te.setStartAfter(z),te.collapse(!0),i==null||i.removeAllRanges(),i==null||i.addRange(te),h==null||h.focus(),T(),t.target.value="";return}p.deleteContents(),p.insertNode(E);const c=document.createTextNode(" ");E.after(c);const g=document.createRange();g.setStartAfter(c),g.collapse(!0),i.removeAllRanges(),i.addRange(g),h.focus(),T(),t.target.value=""},r.readAsDataURL(n)},_t=t=>{var s;R();const n=window.getSelection();if(!(n!=null&&n.rangeCount))return;const r=n.getRangeAt(0),l=document.createTextNode(t);r.insertNode(l),r.setStartAfter(l),r.collapse(!0),n.removeAllRanges(),n.addRange(r),(s=U())==null||s.focus(),T()},ke=t=>{var c;Gt(),R();const n=document.createElement("table");n.style.borderCollapse="collapse",n.style.width="310px",n.style.border="1px solid #ccc",n.style.margin="8px 0",n.style.position="relative",n.style.textAlign="center",v.table&&n.classList.add(v.table);const r=document.createElement("thead");v.thead&&r.classList.add(v.thead);const l=document.createElement("tbody");v.tbody&&l.classList.add(v.tbody),t==="insertStaticTable"&&l.setAttribute("table-type","static");const s=document.createElement("tr");v.tr&&s.classList.add(v.tr);const o=document.createElement("tr");v.tr&&o.classList.add(v.tr);for(let g=0;g<2;g++){const C=document.createElement("th");C.textContent="",C.style.border="1px solid #999",C.style.padding="4px",C.style.position="relative",C.style.backgroundColor="lightgray",C.style.height="20px",v.th&&C.classList.add(v.th);const z=document.createElement("td");z.textContent="",z.style.border="1px solid #999",z.style.padding="4px",z.style.position="relative",z.style.backgroundColor="#fff",z.style.minHeight="20px",z.style.height="20px",z.style.whiteSpace="normal",z.style.wordBreak="break-word",z.style.overflowWrap="anywhere",z.style.lineHeight="20px",z.style.minWidth="20px",v.td&&z.classList.add(v.td),ee(C),ee(z),s.appendChild(C),o.appendChild(z)}r.appendChild(s),l.appendChild(o),n.appendChild(r),n.appendChild(l),he(n);const i=window.getSelection();if(!(i!=null&&i.rangeCount))return;const p=i.getRangeAt(0);p.collapse(!1),p.insertNode(n);const E=document.createElement("p");E.innerHTML="<br/>",n.after(E);const h=document.createRange();h.setStart(E,0),h.collapse(!0),i.removeAllRanges(),i.addRange(h),(c=U())==null||c.focus(),T()},he=t=>{if(t.dataset.hasResizeHandle==="true")return;const n=document.createElement("div");Object.assign(n.style,{position:"absolute",width:"14px",height:"14px",right:"0",bottom:"0",background:"rgba(0,0,0,0.25)",cursor:"nwse-resize",zIndex:"20",borderRadius:"2px"}),n.contentEditable="false",n.dataset.hasResizeHandle="true",n.classList.add("rte-resize-handle");let r=0,l=0,s=0,o=0;n.addEventListener("mousedown",i=>{i.preventDefault(),r=i.clientX,l=i.clientY;const p=t.getBoundingClientRect();s=p.width,o=p.height;const E=c=>{const g=Math.max(100,s+(c.clientX-r)),C=Math.max(20,o+(c.clientY-l));t.style.width=`${g}px`,t.style.height=`${C}px`,T()},h=()=>{document.removeEventListener("mousemove",E),document.removeEventListener("mouseup",h),T()};document.addEventListener("mousemove",E),document.addEventListener("mouseup",h)}),t.appendChild(n)},ee=t=>{const n=document.createElement("div"),r=document.createElement("div");Object.assign(n.style,{position:"absolute",right:"0",top:"0",width:"4px",height:"100%",cursor:"col-resize",background:"rgba(0,0,0,0.15)",zIndex:"10",MozUserSelect:"none",msUserSelect:"none",pointerEvents:"auto"}),n.contentEditable="false",n.classList.add("rte-resize-handle"),Object.assign(r.style,{position:"absolute",bottom:"0",left:"0",width:"100%",height:"4px",cursor:"row-resize",background:"rgba(0,0,0,0.15)",zIndex:"10",MozUserSelect:"none",msUserSelect:"none",pointerEvents:"auto"}),r.contentEditable="false",r.classList.add("rte-resize-handle"),Ft(t,n,r),t.appendChild(n),t.appendChild(r)},Ft=(t,n,r)=>{let l=0,s=0,o=0,i=0;n.addEventListener("mousedown",c=>{c.preventDefault(),l=c.clientX,o=t.offsetWidth,document.addEventListener("mousemove",p),document.addEventListener("mouseup",h)}),r.addEventListener("mousedown",c=>{c.preventDefault(),s=c.clientY,i=t.offsetHeight,document.addEventListener("mousemove",E),document.addEventListener("mouseup",h)});const p=c=>{const g=o+(c.clientX-l);t.style.width=`${Math.max(30,g)}px`,T()},E=c=>{const g=i+(c.clientY-s);t.style.height=`${Math.max(20,g)}px`,T()},h=()=>{document.removeEventListener("mousemove",p),document.removeEventListener("mousemove",E),document.removeEventListener("mouseup",h),T()}},It=t=>{const r=t.target.closest("td, th");r&&(t.preventDefault(),document.querySelectorAll(".rte-cell-highlight").forEach(l=>l.classList.remove("rte-cell-highlight")),r.classList.add("rte-cell-highlight"),V({visible:!0,x:t.clientX,y:t.clientY,cell:r}))},ze=()=>{document.querySelectorAll(".rte-cell-highlight").forEach(t=>t.classList.remove("rte-cell-highlight"))},qt=t=>{if(!F.cell)return;const n=F.cell.closest("table"),r=F.cell.cellIndex,l=F.cell.parentElement.rowIndex,s=o=>{const i=o.tagName.toLowerCase(),p=document.createElement(i);return p.textContent="",p.style.cssText=o.style.cssText,ee(p),p};switch(t){case"insertRowAbove":{const o=n.rows[l],i=n.insertRow(l);Array.from(o.cells).forEach(p=>{i.appendChild(s(p))});break}case"insertRowBelow":{const o=n.rows[l],i=n.insertRow(l+1);Array.from(o.cells).forEach(p=>{i.appendChild(s(p))});break}case"insertColLeft":{Array.from(n.rows).forEach(o=>{const i=o.cells[r];o.insertBefore(s(i),i)});break}case"insertColRight":{Array.from(n.rows).forEach(o=>{const i=o.cells[r];o.insertBefore(s(i),i.nextSibling)});break}case"deleteRow":n.rows.length>1&&n.deleteRow(l);break;case"deleteCol":Array.from(n.rows).forEach(o=>{o.cells[r]&&o.deleteCell(r)});break}T(),V(re(ne({},F),{visible:!1})),ze()},Bt=()=>{Q(),y.current=H.current,G({url:"",text:"",title:"",target:"_self"}),f(!0)},Vt=t=>{const n=window.getSelection();if(!n||!y.current)return;n.removeAllRanges(),n.addRange(y.current);let r=t.url.trim();/^https?:\/\//i.test(r)||(r="https://"+r);const l=document.createElement("a");l.href=r,l.style.cursor="pointer",l.style.outline="none",l.textContent=t.text||r,l.title=t.title,l.target=t.target,l.contentEditable="true";const s=n.getRangeAt(0);s.deleteContents(),s.insertNode(l);const o=document.createTextNode(" ");l.after(o);const i=document.createRange();i.setStartAfter(o),i.collapse(!0),n.removeAllRanges(),n.addRange(i),f(!1),T()},Ut=t=>{const n=t.target;if(n.tagName==="A"){const r=n;if(t.ctrlKey||t.metaKey){window.open(r.href,"_blank","noopener,noreferrer");return}t.preventDefault();const l=document.createRange();l.selectNode(r),y.current=l,G({url:r.href,text:r.textContent||r.href,title:r.title,target:r.target}),f(!0)}},$t=()=>{const t=U();if(!t)return;const n=window.getSelection();if((!n||n.rangeCount===0)&&H.current){const c=window.getSelection();c==null||c.removeAllRanges(),c==null||c.addRange(H.current)}const r=window.getSelection();if(!r||r.rangeCount===0)return;const l=r.getRangeAt(0);R(),document.execCommand("removeFormat",!1);const s=l.cloneContents(),o=document.createElement("div");o.appendChild(s);const i=document.createTreeWalker(o,NodeFilter.SHOW_ELEMENT,null),p=[];for(;i.nextNode();){const c=i.currentNode,g=c.tagName.toUpperCase(),C=c.getAttribute&&c.getAttribute("data-mention")!==null;g!=="A"&&!C&&p.push(c)}for(let c=p.length-1;c>=0;c--){const g=p[c],C=g.parentNode;if(C){for(;g.firstChild;)C.insertBefore(g.firstChild,g);C.removeChild(g)}}o.querySelectorAll("[style]").forEach(c=>c.removeAttribute("style")),l.deleteContents();const E=document.createDocumentFragment();for(;o.firstChild;)E.appendChild(o.firstChild);l.insertNode(E);const h=document.createRange();h.setStartAfter(l.endContainer.nodeType===Node.TEXT_NODE?l.endContainer:l.startContainer),h.collapse(!0),r.removeAllRanges(),r.addRange(h),t.normalize(),T()},Wt=t=>{var l;let n=t;n=n.replace(/{{#arrayData\d*}}/g,""),n=n.replace(/{{\/arrayData\d*}}/g,"");const r=document.createElement("div");return r.innerHTML=n,r.querySelectorAll("br").forEach(s=>{s.replaceWith(`
2
- `)}),r.querySelectorAll("p, div, tr").forEach(s=>{s.insertAdjacentText("afterend",`
3
- `)}),r.querySelectorAll("table").forEach(s=>{s.insertAdjacentText("afterend",`
1
+ (function(D,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],t):(D=typeof globalThis!="undefined"?globalThis:D||self,t(D.RichTextEditor={},D.React,D.ReactDOM))})(this,(function(D,t,$){"use strict";var an=Object.defineProperty,on=Object.defineProperties;var sn=Object.getOwnPropertyDescriptors;var Xe=Object.getOwnPropertySymbols;var cn=Object.prototype.hasOwnProperty,dn=Object.prototype.propertyIsEnumerable;var Ke=(D,t,$)=>t in D?an(D,t,{enumerable:!0,configurable:!0,writable:!0,value:$}):D[t]=$,ne=(D,t)=>{for(var $ in t||(t={}))cn.call(t,$)&&Ke(D,$,t[$]);if(Xe)for(var $ of Xe(t))dn.call(t,$)&&Ke(D,$,t[$]);return D},re=(D,t)=>on(D,sn(t));function Ye(a){const u=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const h in a)if(h!=="default"){const m=Object.getOwnPropertyDescriptor(a,h);Object.defineProperty(u,h,m.get?m:{enumerable:!0,get:()=>a[h]})}}return u.default=a,Object.freeze(u)}const Re=Ye(t);window.React=Re;var ge={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},pe=t.createContext&&t.createContext(ge),Qe=["attr","size","title"];function Ge(a,u){if(a==null)return{};var h=Je(a,u),m,v;if(Object.getOwnPropertySymbols){var S=Object.getOwnPropertySymbols(a);for(v=0;v<S.length;v++)m=S[v],!(u.indexOf(m)>=0)&&Object.prototype.propertyIsEnumerable.call(a,m)&&(h[m]=a[m])}return h}function Je(a,u){if(a==null)return{};var h={};for(var m in a)if(Object.prototype.hasOwnProperty.call(a,m)){if(u.indexOf(m)>=0)continue;h[m]=a[m]}return h}function le(){return le=Object.assign?Object.assign.bind():function(a){for(var u=1;u<arguments.length;u++){var h=arguments[u];for(var m in h)Object.prototype.hasOwnProperty.call(h,m)&&(a[m]=h[m])}return a},le.apply(this,arguments)}function ve(a,u){var h=Object.keys(a);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(a);u&&(m=m.filter(function(v){return Object.getOwnPropertyDescriptor(a,v).enumerable})),h.push.apply(h,m)}return h}function ae(a){for(var u=1;u<arguments.length;u++){var h=arguments[u]!=null?arguments[u]:{};u%2?ve(Object(h),!0).forEach(function(m){et(a,m,h[m])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(h)):ve(Object(h)).forEach(function(m){Object.defineProperty(a,m,Object.getOwnPropertyDescriptor(h,m))})}return a}function et(a,u,h){return u=tt(u),u in a?Object.defineProperty(a,u,{value:h,enumerable:!0,configurable:!0,writable:!0}):a[u]=h,a}function tt(a){var u=nt(a,"string");return typeof u=="symbol"?u:u+""}function nt(a,u){if(typeof a!="object"||!a)return a;var h=a[Symbol.toPrimitive];if(h!==void 0){var m=h.call(a,u);if(typeof m!="object")return m;throw new TypeError("@@toPrimitive must return a primitive value.")}return(u==="string"?String:Number)(a)}function Ee(a){return a&&a.map((u,h)=>t.createElement(u.tag,ae({key:h},u.attr),Ee(u.child)))}function A(a){return u=>t.createElement(rt,le({attr:ae({},a.attr)},u),Ee(a.child))}function rt(a){var u=h=>{var{attr:m,size:v,title:S}=a,_=Ge(a,Qe),H=v||h.size||"1em",E;return h.className&&(E=h.className),a.className&&(E=(E?E+" ":"")+a.className),t.createElement("svg",le({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},h.attr,m,_,{className:E,style:ae(ae({color:a.color||h.color},h.style),a.style),height:H,width:H,xmlns:"http://www.w3.org/2000/svg"}),S&&t.createElement("title",null,S),a.children)};return pe!==void 0?t.createElement(pe.Consumer,null,h=>u(h)):u(ge)}function lt(a){return A({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M352 64c0-17.7-14.3-32-32-32L128 32c-17.7 0-32 14.3-32 32s14.3 32 32 32l192 0c17.7 0 32-14.3 32-32zm96 128c0-17.7-14.3-32-32-32L32 160c-17.7 0-32 14.3-32 32s14.3 32 32 32l384 0c17.7 0 32-14.3 32-32zM0 448c0 17.7 14.3 32 32 32l384 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L32 416c-17.7 0-32 14.3-32 32zM352 320c0-17.7-14.3-32-32-32l-192 0c-17.7 0-32 14.3-32 32s14.3 32 32 32l192 0c17.7 0 32-14.3 32-32z"},child:[]}]})(a)}function at(a){return A({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M448 64c0 17.7-14.3 32-32 32L192 96c-17.7 0-32-14.3-32-32s14.3-32 32-32l224 0c17.7 0 32 14.3 32 32zm0 256c0 17.7-14.3 32-32 32l-224 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l224 0c17.7 0 32 14.3 32 32zM0 192c0-17.7 14.3-32 32-32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 224c-17.7 0-32-14.3-32-32zM448 448c0 17.7-14.3 32-32 32L32 480c-17.7 0-32-14.3-32-32s14.3-32 32-32l384 0c17.7 0 32 14.3 32 32z"},child:[]}]})(a)}function ot(a){return A({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M0 96C0 60.7 28.7 32 64 32l384 0c35.3 0 64 28.7 64 64l0 320c0 35.3-28.7 64-64 64L64 480c-35.3 0-64-28.7-64-64L0 96zM323.8 202.5c-4.5-6.6-11.9-10.5-19.8-10.5s-15.4 3.9-19.8 10.5l-87 127.6L170.7 297c-4.6-5.7-11.5-9-18.7-9s-14.2 3.3-18.7 9l-64 80c-5.8 7.2-6.9 17.1-2.9 25.4s12.4 13.6 21.6 13.6l96 0 32 0 208 0c8.9 0 17.1-4.9 21.2-12.8s3.6-17.4-1.4-24.7l-120-176zM112 192a48 48 0 1 0 0-96 48 48 0 1 0 0 96z"},child:[]}]})(a)}function it(a){return A({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M24 56c0-13.3 10.7-24 24-24l32 0c13.3 0 24 10.7 24 24l0 120 16 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-80 0c-13.3 0-24-10.7-24-24s10.7-24 24-24l16 0 0-96-8 0C34.7 80 24 69.3 24 56zM86.7 341.2c-6.5-7.4-18.3-6.9-24 1.2L51.5 357.9c-7.7 10.8-22.7 13.3-33.5 5.6s-13.3-22.7-5.6-33.5l11.1-15.6c23.7-33.2 72.3-35.6 99.2-4.9c21.3 24.4 20.8 60.9-1.1 84.7L86.8 432l33.2 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-88 0c-9.5 0-18.2-5.6-22-14.4s-2.1-18.9 4.3-25.9l72-78c5.3-5.8 5.4-14.6 .3-20.5zM224 64l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zm0 160l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zm0 160l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32z"},child:[]}]})(a)}function st(a){return A({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M12.83 352h262.34A12.82 12.82 0 0 0 288 339.17v-38.34A12.82 12.82 0 0 0 275.17 288H12.83A12.82 12.82 0 0 0 0 300.83v38.34A12.82 12.82 0 0 0 12.83 352zm0-256h262.34A12.82 12.82 0 0 0 288 83.17V44.83A12.82 12.82 0 0 0 275.17 32H12.83A12.82 12.82 0 0 0 0 44.83v38.34A12.82 12.82 0 0 0 12.83 96zM432 160H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0 256H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16z"},child:[]}]})(a)}function ct(a){return A({attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M333.49 238a122 122 0 0 0 27-65.21C367.87 96.49 308 32 233.42 32H34a16 16 0 0 0-16 16v48a16 16 0 0 0 16 16h31.87v288H34a16 16 0 0 0-16 16v48a16 16 0 0 0 16 16h209.32c70.8 0 134.14-51.75 141-122.4 4.74-48.45-16.39-92.06-50.83-119.6zM145.66 112h87.76a48 48 0 0 1 0 96h-87.76zm87.76 288h-87.76V288h87.76a56 56 0 0 1 0 112z"},child:[]}]})(a)}function dt(a){return A({attr:{viewBox:"0 0 544 512"},child:[{tag:"path",attr:{d:"M0 479.98L99.92 512l35.45-35.45-67.04-67.04L0 479.98zm124.61-240.01a36.592 36.592 0 0 0-10.79 38.1l13.05 42.83-50.93 50.94 96.23 96.23 50.86-50.86 42.74 13.08c13.73 4.2 28.65-.01 38.15-10.78l35.55-41.64-173.34-173.34-41.52 35.44zm403.31-160.7l-63.2-63.2c-20.49-20.49-53.38-21.52-75.12-2.35L190.55 183.68l169.77 169.78L530.27 154.4c19.18-21.74 18.15-54.63-2.35-75.13z"},child:[]}]})(a)}function ut(a){return A({attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M320 48v32a16 16 0 0 1-16 16h-62.76l-80 320H208a16 16 0 0 1 16 16v32a16 16 0 0 1-16 16H16a16 16 0 0 1-16-16v-32a16 16 0 0 1 16-16h62.76l80-320H112a16 16 0 0 1-16-16V48a16 16 0 0 1 16-16h192a16 16 0 0 1 16 16z"},child:[]}]})(a)}function mt(a){return A({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M326.612 185.391c59.747 59.809 58.927 155.698.36 214.59-.11.12-.24.25-.36.37l-67.2 67.2c-59.27 59.27-155.699 59.262-214.96 0-59.27-59.26-59.27-155.7 0-214.96l37.106-37.106c9.84-9.84 26.786-3.3 27.294 10.606.648 17.722 3.826 35.527 9.69 52.721 1.986 5.822.567 12.262-3.783 16.612l-13.087 13.087c-28.026 28.026-28.905 73.66-1.155 101.96 28.024 28.579 74.086 28.749 102.325.51l67.2-67.19c28.191-28.191 28.073-73.757 0-101.83-3.701-3.694-7.429-6.564-10.341-8.569a16.037 16.037 0 0 1-6.947-12.606c-.396-10.567 3.348-21.456 11.698-29.806l21.054-21.055c5.521-5.521 14.182-6.199 20.584-1.731a152.482 152.482 0 0 1 20.522 17.197zM467.547 44.449c-59.261-59.262-155.69-59.27-214.96 0l-67.2 67.2c-.12.12-.25.25-.36.37-58.566 58.892-59.387 154.781.36 214.59a152.454 152.454 0 0 0 20.521 17.196c6.402 4.468 15.064 3.789 20.584-1.731l21.054-21.055c8.35-8.35 12.094-19.239 11.698-29.806a16.037 16.037 0 0 0-6.947-12.606c-2.912-2.005-6.64-4.875-10.341-8.569-28.073-28.073-28.191-73.639 0-101.83l67.2-67.19c28.239-28.239 74.3-28.069 102.325.51 27.75 28.3 26.872 73.934-1.155 101.96l-13.087 13.087c-4.35 4.35-5.769 10.79-3.783 16.612 5.864 17.194 9.042 34.999 9.69 52.721.509 13.906 17.454 20.446 27.294 10.606l37.106-37.106c59.271-59.259 59.271-155.699.001-214.959z"},child:[]}]})(a)}function ht(a){return A({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M80 368H16a16 16 0 0 0-16 16v64a16 16 0 0 0 16 16h64a16 16 0 0 0 16-16v-64a16 16 0 0 0-16-16zm0-320H16A16 16 0 0 0 0 64v64a16 16 0 0 0 16 16h64a16 16 0 0 0 16-16V64a16 16 0 0 0-16-16zm0 160H16a16 16 0 0 0-16 16v64a16 16 0 0 0 16 16h64a16 16 0 0 0 16-16v-64a16 16 0 0 0-16-16zm416 176H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0-320H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16V80a16 16 0 0 0-16-16zm0 160H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16z"},child:[]}]})(a)}function ft(a){return A({attr:{viewBox:"0 0 496 512"},child:[{tag:"path",attr:{d:"M248 8C111 8 0 119 0 256s111 248 248 248 248-111 248-248S385 8 248 8zm80 168c17.7 0 32 14.3 32 32s-14.3 32-32 32-32-14.3-32-32 14.3-32 32-32zm-160 0c17.7 0 32 14.3 32 32s-14.3 32-32 32-32-14.3-32-32 14.3-32 32-32zm194.8 170.2C334.3 380.4 292.5 400 248 400s-86.3-19.6-114.8-53.8c-13.6-16.3 11-36.7 24.6-20.5 22.4 26.9 55.2 42.2 90.2 42.2s67.8-15.4 90.2-42.2c13.4-16.2 38.1 4.2 24.6 20.5z"},child:[]}]})(a)}function gt(a){return A({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M32 64h32v160c0 88.22 71.78 160 160 160s160-71.78 160-160V64h32a16 16 0 0 0 16-16V16a16 16 0 0 0-16-16H272a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h32v160a80 80 0 0 1-160 0V64h32a16 16 0 0 0 16-16V16a16 16 0 0 0-16-16H32a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16zm400 384H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16z"},child:[]}]})(a)}function pt(a){return A({attr:{viewBox:"0 0 256 256",fill:"currentColor"},child:[{tag:"path",attr:{d:"M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM56.84,75.58a8,8,0,0,1,3.58-10.74l16-8A8,8,0,0,1,88,64v48a8,8,0,0,1-16,0V76.94l-4.42,2.22A8,8,0,0,1,56.84,75.58ZM92,180a8,8,0,0,1,0,16H68a8,8,0,0,1-6.4-12.8l21.67-28.89A3.92,3.92,0,0,0,84,152a4,4,0,0,0-7.77-1.33,8,8,0,0,1-15.09-5.34,20,20,0,1,1,35,18.53L84,180Zm100,4H120a8,8,0,0,1,0-16h72a8,8,0,0,1,0,16Zm0-48H120a8,8,0,0,1,0-16h72a8,8,0,0,1,0,16Zm0-48H120a8,8,0,0,1,0-16h72a8,8,0,0,1,0,16Z"},child:[]}]})(a)}function vt(a){return A({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M2 18H9V20H2V18ZM2 11H11V13H2V11ZM2 4H22V6H2V4ZM20.674 13.0251L21.8301 12.634L22.8301 14.366L21.914 15.1711C21.9704 15.4386 22 15.7158 22 16C22 16.2842 21.9704 16.5614 21.914 16.8289L22.8301 17.634L21.8301 19.366L20.674 18.9749C20.2635 19.3441 19.7763 19.6295 19.2391 19.8044L19 21H17L16.7609 19.8044C16.2237 19.6295 15.7365 19.3441 15.326 18.9749L14.1699 19.366L13.1699 17.634L14.086 16.8289C14.0296 16.5614 14 16.2842 14 16C14 15.7158 14.0296 15.4386 14.086 15.1711L13.1699 14.366L14.1699 12.634L15.326 13.0251C15.7365 12.6559 16.2237 12.3705 16.7609 12.1956L17 11H19L19.2391 12.1956C19.7763 12.3705 20.2635 12.6559 20.674 13.0251ZM18 17C18.5523 17 19 16.5523 19 16C19 15.4477 18.5523 15 18 15C17.4477 15 17 15.4477 17 16C17 16.5523 17.4477 17 18 17Z"},child:[]}]})(a)}function Et(a){return A({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M12 21h-7a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v7"},child:[]},{tag:"path",attr:{d:"M3 10h18"},child:[]},{tag:"path",attr:{d:"M10 3v18"},child:[]},{tag:"path",attr:{d:"M19.001 19m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"},child:[]},{tag:"path",attr:{d:"M19.001 15.5v1.5"},child:[]},{tag:"path",attr:{d:"M19.001 21v1.5"},child:[]},{tag:"path",attr:{d:"M22.032 17.25l-1.299 .75"},child:[]},{tag:"path",attr:{d:"M17.27 20l-1.3 .75"},child:[]},{tag:"path",attr:{d:"M15.97 17.25l1.3 .75"},child:[]},{tag:"path",attr:{d:"M20.733 20l1.3 .75"},child:[]}]})(a)}function yt(a){return A({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14z"},child:[]},{tag:"path",attr:{d:"M3 10h18"},child:[]},{tag:"path",attr:{d:"M10 3v18"},child:[]}]})(a)}function wt(a){return A({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M2 20h20v4H2v-4zm3.49-3h2.42l1.27-3.58h5.65L16.09 17h2.42L13.25 3h-2.5L5.49 17zm4.42-5.61 2.03-5.79h.12l2.03 5.79H9.91z"},child:[]}]})(a)}function bt(a){return A({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"},child:[]},{tag:"path",attr:{d:"M20 8V5H6.39l3 3h1.83l-.55 1.28 2.09 2.1L14.21 8zM3.41 4.86 2 6.27l6.97 6.97L6.5 19h3l1.57-3.66L16.73 21l1.41-1.41z"},child:[]}]})(a)}const Ct=["😀","😁","😂","đŸ¤Ŗ","😃","😄","😅","😉","😊","😍","😘","😜","😎","đŸ˜ĸ","😭","😡","🤔","🙄","😇","đŸĨ°","🤩","🤗","😴","😋","đŸ˜Ŧ","🤤","đŸ˜ļ‍đŸŒĢī¸","😷","🤕","🤑","🤠","😈","đŸ‘ģ","💀","🤖","đŸļ","🐱","đŸŧ","🐸","đŸĻ„","🐷","đŸĩ","🐰","đŸ¯","đŸĻ","🐮","🌞","🌙","⭐","🌈","đŸ”Ĩ","💧","â„ī¸","⚡","â˜€ī¸","🌸","🌹","🍎","🍕","🍩","🍔","🍟","🍇","🍉","🍓","🍒","đŸĨ­","đŸĨ‘","🎉","🎂","🎁","🎈","đŸŽļ","đŸŽĩ","🏆","âšŊ","🏀","🏸","🏏","đŸ•šī¸","👋","🤚","đŸ–ī¸","✋","🖖","👍","👎","👌","🤌","🤏","✊","👊","🤛","🤜","â˜ī¸","👆","👇","👈","👉","🤟","🤘","🤙","🙌","👏","🙏","âœī¸","💅","🤲","👏","đŸĢļ","👐"],ye=({exec:a,saveSelection:u,handleFileChange:h,handleFontSizeChange:m,handleFontFamilyChange:v,insertEmoji:S,handleLink:_,removeFormatting:H,visibleActions:E,className:N,style:M})=>{var V,Y;const x=t.useRef(null),W=t.useRef(null),C=t.useRef(null),[k,F]=t.useState(!1),[I,P]=t.useState({x:0,y:0});t.useEffect(()=>{const g=y=>{!y.target.closest(".rte-emoji-popup")&&!y.target.closest("button[title='Emoji']")&&F(!1)};return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[]);const q=g=>{var X;g.preventDefault();const y=g.currentTarget.dataset.command;if(y)switch(y){case"bold":case"italic":case"underline":case"insertUnorderedList":case"insertStaticUnorderedList":case"insertOrderedList":case"insertStaticOrderedList":case"removeFormat":a(y);break;case"insertImage":{(X=x.current)==null||X.click();break}default:console.warn("Unknown command:",y)}},K=g=>{a("foreColor",g.target.value)},Z=g=>{a("backColor",g.target.value)},[L,O]=t.useState({bold:!1,italic:!1,underline:!1,unorderedList:!1,orderedList:!1,alignLeft:!1,alignCenter:!1,alignRight:!1,removeFormat:!1,link:!1,image:!1,emoji:!1,table:!1,color:!1,highlight:!1}),B=t.useRef(null),j=t.useRef(null);return t.useEffect(()=>{const g=()=>{const y=window.getSelection();if(!y||!y.anchorNode)return;let X=y.anchorNode.nodeType===Node.ELEMENT_NODE?y.anchorNode:y.anchorNode.parentElement;if(!X)return;const G=window.getComputedStyle(X),ie=G.fontFamily.replace(/['"]/g,"").split(",")[0],de=parseInt(G.fontSize,10);if(B.current){const J=Array.from(B.current.options).some(se=>se.value===ie);B.current.value=J?ie:""}j.current&&(j.current.value=String(de))};return document.addEventListener("selectionchange",g),()=>document.removeEventListener("selectionchange",g)},[]),t.useEffect(()=>{const g=()=>{O({bold:document.queryCommandState("bold"),italic:document.queryCommandState("italic"),underline:document.queryCommandState("underline"),unorderedList:document.queryCommandState("insertUnorderedList"),orderedList:document.queryCommandState("insertOrderedList"),alignLeft:document.queryCommandState("justifyLeft"),alignCenter:document.queryCommandState("justifyCenter"),alignRight:document.queryCommandState("justifyRight"),removeFormat:document.queryCommandState("removeFormat"),link:document.queryCommandState("createLink"),image:document.queryCommandState("insertImage"),emoji:document.queryCommandState("insertEmoji"),table:document.queryCommandState("insertTable"),color:document.queryCommandState("foreColor"),highlight:document.queryCommandState("backColor")})};return document.addEventListener("selectionchange",g),()=>document.removeEventListener("selectionchange",g)},[]),t.createElement("div",{className:`rte-toolbar ${N||""}`,style:M},E.bold&&t.createElement("button",{"data-command":"bold",title:"Bold",onMouseDown:q,className:L.bold?"rte-active":""},t.createElement(ct,null)),E.italic&&t.createElement("button",{"data-command":"italic",title:"Italic",onMouseDown:q,className:L.italic?"rte-active":""},t.createElement(ut,null)),E.underline&&t.createElement("button",{"data-command":"underline",title:"Underline",onMouseDown:q,className:L.underline?"rte-active":""},t.createElement(gt,null)),E.unorderedList&&t.createElement("button",{"data-command":"insertUnorderedList",onMouseDown:q,title:"UnorderedList",className:L.unorderedList?"rte-active":""},t.createElement(vt,null)),E.staticUnorderedList&&t.createElement("button",{"data-command":"insertStaticUnorderedList",onMouseDown:q,title:"StaticUnorderedList",className:L.unorderedList?"rte-active":""},t.createElement(ht,null)),E.orderedList&&t.createElement("button",{"data-command":"insertOrderedList",title:"OrderedList",onMouseDown:q,className:L.orderedList?"rte-active":"",style:{fontSize:"medium"}},t.createElement(pt,null)),E.staticOrderedList&&t.createElement("button",{"data-command":"insertStaticOrderedList",title:"StaticOrderedList",onMouseDown:q,className:L.orderedList?"rte-active":""},t.createElement(it,null)),E.link&&t.createElement("button",{"data-command":"createLink",title:"Link",onClick:_,className:L.link?"rte-active":""},t.createElement(mt,null)),E.removeFormat&&t.createElement("button",{"data-command":"Remove format",title:"removeFormat",onMouseDown:g=>{g.preventDefault(),u(),H()},className:L.removeFormat?"rte-active":""},t.createElement(bt,null)),E.image&&t.createElement("button",{"data-command":"insertImage",title:"Image",onMouseDown:q,className:L.image?"rte-active":""},t.createElement(ot,null)),t.createElement("input",{type:"file",accept:"image/*",ref:x,style:{display:"none"},onChange:h}),E.emoji&&t.createElement("div",{style:{position:"relative"}},t.createElement("button",{title:"Emoji",onMouseDown:g=>{g.preventDefault(),u();const y=g.currentTarget.getBoundingClientRect();P({x:y.left,y:y.bottom+8}),F(X=>!X)},className:L.emoji?"rte-active":""},t.createElement(ft,null)),k&&$.createPortal(t.createElement("div",{className:"rte-emoji-popup",style:{top:I.y,left:I.x}},Ct.map((g,y)=>t.createElement("span",{key:y,style:{fontSize:"20px",cursor:"pointer",textAlign:"center"},onMouseDown:X=>{X.preventDefault(),S(g),F(!1)}},g))),document.body)),E.color&&t.createElement("div",{style:{position:"relative"}},t.createElement("button",{title:"Text Color",onMouseDown:g=>{var y;g.preventDefault(),u(),(y=W.current)==null||y.click()},style:{display:"flex",alignItems:"center",justifyContent:"center",color:((V=W.current)==null?void 0:V.value)||"#000",fontSize:"18px"},className:L.color?"rte-active":""},t.createElement(wt,null)),t.createElement("input",{ref:W,type:"color",defaultValue:"#000000",onChange:g=>{var y;K(g),((y=g.target.parentElement)==null?void 0:y.querySelector("button")).style.color=g.target.value},style:{position:"absolute",opacity:0,width:0,height:0,pointerEvents:"none"}})),E.highlight&&t.createElement("div",{style:{position:"relative"}},t.createElement("button",{title:"Highlight",onMouseDown:g=>{var y;g.preventDefault(),u(),(y=C.current)==null||y.click()},style:{display:"flex",alignItems:"center",justifyContent:"center",color:((Y=C.current)==null?void 0:Y.value)||"#000",fontSize:"18px"},className:L.highlight?"rte-active":""},t.createElement(dt,null)),t.createElement("input",{ref:C,type:"color",onChange:g=>{var y;Z(g),((y=g.target.parentElement)==null?void 0:y.querySelector("button")).style.color=g.target.value},defaultValue:"#000000",style:{position:"absolute",opacity:0,width:0,height:0,pointerEvents:"none"}})),E.align&&t.createElement(t.Fragment,null,t.createElement("button",{title:"Align Left",onMouseDown:g=>g.preventDefault(),onClick:()=>a("justifyLeft"),className:L.alignLeft?"rte-active":""},t.createElement(st,null)),t.createElement("button",{title:"Align Center",onMouseDown:g=>g.preventDefault(),onClick:()=>a("justifyCenter"),className:L.alignCenter?"rte-active":""},t.createElement(lt,null)),t.createElement("button",{title:"Align Right",onMouseDown:g=>g.preventDefault(),onClick:()=>a("justifyRight"),className:L.alignRight?"rte-active":""},t.createElement(at,null))),E.table&&t.createElement("button",{title:"Insert Dynamic Table",onMouseDown:g=>g.preventDefault(),onClick:()=>a("insertTable"),className:L.table?"rte-active":"",style:{fontSize:"medium"}},t.createElement(Et,null)),E.table&&t.createElement("button",{title:"Insert Static Table",onMouseDown:g=>g.preventDefault(),onClick:()=>a("insertStaticTable"),className:L.table?"rte-active":"",style:{fontSize:"medium"}},t.createElement(yt,null)),E.fontFamily&&t.createElement("select",{ref:B,className:"rte-dropdown",defaultValue:"",onMouseDown:()=>u(),onChange:v},t.createElement("option",{value:"",disabled:!0},"Font Family"),t.createElement("option",{value:"Arial"},"Arial"),t.createElement("option",{value:"Georgia"},"Georgia"),t.createElement("option",{value:"Times New Roman"},"Times New Roman"),t.createElement("option",{value:"Courier New"},"Courier New"),t.createElement("option",{value:"Verdana"},"Verdana")),E.fontSize&&t.createElement("select",{ref:j,className:"rte-dropdown rte-fontsize-dropdown",defaultValue:"",onMouseDown:()=>u(),onChange:m},t.createElement("option",{value:"",disabled:!0},"Font Size"),Array.from({length:16},(g,y)=>10+y).map(g=>t.createElement("option",{key:g,value:g},g,"px"))))},St=({show:a,position:u,filtered:h,insertMention:m,onClose:v,query:S})=>{const _=t.useRef(null),[H,E]=t.useState(0);return t.useEffect(()=>{a&&E(0)},[a]),t.useEffect(()=>{const N=M=>{_.current&&!_.current.contains(M.target)&&v()};return a&&document.addEventListener("mousedown",N),()=>{document.removeEventListener("mousedown",N)}},[a,v]),t.useEffect(()=>{if(!a)return;const N=M=>{if(!(!a||h.length===0)&&(M.key==="ArrowDown"&&(M.preventDefault(),E(x=>Math.min(x+1,h.length-1))),M.key==="ArrowUp"&&(M.preventDefault(),E(x=>Math.max(x-1,0))),M.key==="Enter")){M.preventDefault();const x=h[H];x&&m(x)}};return window.addEventListener("keydown",N),()=>window.removeEventListener("keydown",N)},[a,h,H]),t.useEffect(()=>{if(!_.current)return;const M=_.current.querySelectorAll("li")[H];M&&M.scrollIntoView({block:"nearest",behavior:"smooth"})},[H]),a?t.createElement("ul",{ref:_,className:"rte-popup",style:{top:u.y,left:u.x}},h.length>0?h.map(({name:N,value:M},x)=>{const W=N.toLowerCase(),C=S.toLowerCase(),k=W.indexOf(C);let F=N;if(k!==-1&&S.length>0){const I=k+S.length;F=N.substring(0,k)+`<span class="rte-highlight">${N.substring(k,I)}</span>`+N.substring(I)}return t.createElement("li",{key:M,onMouseDown:I=>{I.preventDefault(),m({name:N,value:M})},style:{padding:"6px 12px",cursor:"pointer",fontSize:"14px",background:x===H?"#dce8ff":"white"},dangerouslySetInnerHTML:{__html:F},onMouseEnter:()=>E(x)})}):t.createElement("li",{style:{padding:"6px 12px",color:"#999"}},"No matches")):null};function ce(a){return A({attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{id:"Circle_Minus"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{d:"M15,11.5h0a.5.5,0,0,1,0,1H9a.5.5,0,0,1,0-1Z"},child:[]},{tag:"path",attr:{d:"M12,21.934A9.933,9.933,0,1,1,21.932,12,9.945,9.945,0,0,1,12,21.934ZM12,3.068A8.933,8.933,0,1,0,20.932,12,8.944,8.944,0,0,0,12,3.068Z"},child:[]}]}]}]})(a)}function oe(a){return A({attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{id:"Circle_Plus"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{d:"M15,12.5H12.5V15a.5.5,0,0,1-1,0V12.5H9a.5.5,0,0,1,0-1h2.5V9a.5.5,0,0,1,1,0v2.5H15A.5.5,0,0,1,15,12.5Z"},child:[]},{tag:"path",attr:{d:"M12,21.932A9.934,9.934,0,1,1,21.932,12,9.944,9.944,0,0,1,12,21.932ZM12,3.065A8.934,8.934,0,1,0,20.932,12,8.944,8.944,0,0,0,12,3.065Z"},child:[]}]}]}]})(a)}const Lt=({visible:a,x:u,y:h,onAction:m,onClose:v})=>{if(!a)return null;const S={top:h,left:u};return t.createElement("div",{style:S,className:"rte-table-menu",onMouseLeave:v},t.createElement("button",{onClick:()=>m("insertRowAbove")},t.createElement(oe,null)," Insert row above"),t.createElement("button",{onClick:()=>m("insertRowBelow")},t.createElement(oe,null)," Insert row below"),t.createElement("button",{onClick:()=>m("insertColLeft")},t.createElement(oe,null)," Insert col left"),t.createElement("button",{onClick:()=>m("insertColRight")},t.createElement(oe,null)," Insert col right"),t.createElement("button",{onClick:()=>m("deleteRow")},t.createElement(ce,null)," Delete row"),t.createElement("button",{onClick:()=>m("deleteCol")},t.createElement(ce,null)," Delete column"),t.createElement("button",{onClick:()=>m("deleteTable")},t.createElement(ce,null)," Delete table"))};function we(a){return A({attr:{viewBox:"0 0 1024 1024"},child:[{tag:"path",attr:{d:"M885.9 490.3c3.6-12 5.4-24.4 5.4-37 0-28.3-9.3-55.5-26.1-77.7 3.6-12 5.4-24.4 5.4-37 0-28.3-9.3-55.5-26.1-77.7 3.6-12 5.4-24.4 5.4-37 0-51.6-30.7-98.1-78.3-118.4a66.1 66.1 0 0 0-26.5-5.4H144c-17.7 0-32 14.3-32 32v364c0 17.7 14.3 32 32 32h129.3l85.8 310.8C372.9 889 418.9 924 470.9 924c29.7 0 57.4-11.8 77.9-33.4 20.5-21.5 31-49.7 29.5-79.4l-6-122.9h239.9c12.1 0 23.9-3.2 34.3-9.3 40.4-23.5 65.5-66.1 65.5-111 0-28.3-9.3-55.5-26.1-77.7zM184 456V172h81v284h-81zm627.2 160.4H496.8l9.6 198.4c.6 11.9-4.7 23.1-14.6 30.5-6.1 4.5-13.6 6.8-21.1 6.7a44.28 44.28 0 0 1-42.2-32.3L329 459.2V172h415.4a56.85 56.85 0 0 1 33.6 51.8c0 9.7-2.3 18.9-6.9 27.3l-13.9 25.4 21.9 19a56.76 56.76 0 0 1 19.6 43c0 9.7-2.3 18.9-6.9 27.3l-13.9 25.4 21.9 19a56.76 56.76 0 0 1 19.6 43c0 9.7-2.3 18.9-6.9 27.3l-14 25.5 21.9 19a56.76 56.76 0 0 1 19.6 43c0 19.1-11 37.5-28.8 48.4z"},child:[]}]})(a)}function be(a){return A({attr:{viewBox:"0 0 1024 1024"},child:[{tag:"path",attr:{d:"M885.9 533.7c16.8-22.2 26.1-49.4 26.1-77.7 0-44.9-25.1-87.4-65.5-111.1a67.67 67.67 0 0 0-34.3-9.3H572.4l6-122.9c1.4-29.7-9.1-57.9-29.5-79.4A106.62 106.62 0 0 0 471 99.9c-52 0-98 35-111.8 85.1l-85.9 311H144c-17.7 0-32 14.3-32 32v364c0 17.7 14.3 32 32 32h601.3c9.2 0 18.2-1.8 26.5-5.4 47.6-20.3 78.3-66.8 78.3-118.4 0-12.6-1.8-25-5.4-37 16.8-22.2 26.1-49.4 26.1-77.7 0-12.6-1.8-25-5.4-37 16.8-22.2 26.1-49.4 26.1-77.7-.2-12.6-2-25.1-5.6-37.1zM184 852V568h81v284h-81zm636.4-353l-21.9 19 13.9 25.4a56.2 56.2 0 0 1 6.9 27.3c0 16.5-7.2 32.2-19.6 43l-21.9 19 13.9 25.4a56.2 56.2 0 0 1 6.9 27.3c0 16.5-7.2 32.2-19.6 43l-21.9 19 13.9 25.4a56.2 56.2 0 0 1 6.9 27.3c0 22.4-13.2 42.6-33.6 51.8H329V564.8l99.5-360.5a44.1 44.1 0 0 1 42.2-32.3c7.6 0 15.1 2.2 21.1 6.7 9.9 7.4 15.2 18.6 14.6 30.5l-9.6 198.4h314.4C829 418.5 840 436.9 840 456c0 16.5-7.2 32.1-19.6 43z"},child:[]}]})(a)}const Ce=({html:a,className:u,style:h,attributes:m,setAttributes:v})=>{const[S,_]=t.useState("web"),H={web:{label:"Web",width:"100%",height:"100%"},galaxyS23:{label:"Galaxy S23",width:360,height:780},iphoneSE:{label:"iPhone SE (3rd Gen)",width:375,height:667},iphoneX:{label:"iPhone X / XS",width:375,height:812},pixel7a:{label:"Pixel 7a",width:390,height:844},iphone12:{label:"iPhone 12 / 13 / 14",width:390,height:844},iphone14:{label:"iPhone 14 Pro",width:393,height:852},pixel7:{label:"Pixel 7",width:412,height:915},iphone11:{label:"iPhone 11",width:414,height:896},iphone14ProMax:{label:"iPhone 14 Pro Max",width:430,height:932},pixel8Pro:{label:"Pixel 8 Pro",width:448,height:998},galaxyS24Ultra:{label:"Galaxy S24 Ultra",width:480,height:1040}},E=C=>{const k=C.target;if(k.tagName==="A"){C.preventDefault();const F=k.href;F&&window.open(F,"_blank","noopener,noreferrer")}},N=C=>C==="rgb(0, 0, 0)"||C==="rgba(0, 0, 0, 1)"||C==="#000"||C==="#000000"||C==="black",M=C=>{const k=document.createElement("div");k.innerHTML=C;const F=document.createTreeWalker(k,NodeFilter.SHOW_TEXT,null),I=[];for(;F.nextNode();){const P=F.currentNode;P.nodeValue&&/{{\s*[\s\S]*?\s*}}/.test(P.nodeValue)&&I.push(P)}return I.forEach(P=>{var j;const q=P.nodeValue||"",K=P.parentElement;if(!K)return;let Z=K,L=!1;for(;Z;){if(Z.tagName==="FONT"&&Z.getAttribute("color")){L=!0;break}const V=(j=Z.style)==null?void 0:j.color;if(V&&!N(V)){L=!0;break}const Y=window.getComputedStyle(Z);if(Y.color&&!N(Y.color)){L=!0;break}Z=Z.parentElement}const O=document.createDocumentFragment();let B=0;q.replace(/{{\s*([\s\S]*?)\s*}}/g,(V,Y,g)=>{if(g>B&&O.appendChild(document.createTextNode(q.slice(B,g))),L)O.appendChild(document.createTextNode(V));else{const y=document.createElement("span");y.style.color="blue",y.textContent=V,O.appendChild(y)}return B=g+V.length,V}),B<q.length&&O.appendChild(document.createTextNode(q.slice(B))),K.replaceChild(O,P)}),k.innerHTML=k.innerHTML.replace(/{{#arrayData}}/g,"").replace(/{{\/arrayData}}/g,""),k.innerHTML},x=()=>new Date().toLocaleDateString("en-US",{month:"short",day:"2-digit",year:"numeric"}),W=()=>new Date().toLocaleString("en-US",{month:"short",day:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit",hour12:!0});return t.createElement("div",{className:`rte-preview ${u||""}`,style:re(ne({},h),{position:"relative"}),onClick:E},t.createElement("div",{className:"rte-preview-device-picker"},t.createElement("select",{value:S,onChange:C=>_(C.target.value)},Object.entries(H).map(([C,k])=>t.createElement("option",{key:C,value:C},k.label)))),S==="web"&&t.createElement("div",{className:"rte-preview-web-wrapper"},t.createElement("div",{className:"rte-preview-card"},t.createElement("div",{className:"rte-preview-content",dangerouslySetInnerHTML:{__html:M(a)}}),t.createElement("div",{className:"rte-preview-meta"},"Data updated as on Dec 14, 2025"),t.createElement("div",{className:"rte-preview-footer"},t.createElement("div",{className:"rte-preview-actions"},t.createElement(be,{className:"rte-preview-like"}),t.createElement(we,{className:"rte-preview-like"})),t.createElement("div",{className:"rte-preview-time"},"Dec 26, 2025 5:57 PM")))),S!=="web"&&t.createElement("div",{className:"rte-preview-mobile-overlay"},t.createElement("div",{className:"rte-preview-mobile-frame",style:{width:H[S].width,height:H[S].height}},t.createElement("div",{className:"rte-preview-mobile-header"},t.createElement("div",{className:"rte-preview-logo"},"A"),t.createElement("div",{className:"rte-preview-bell"},"🔔",t.createElement("span",{className:"rte-preview-badge"},"99+"))),t.createElement("div",{className:"rte-preview-tabs-wrapper"},t.createElement("div",{className:"rte-preview-tabs"},t.createElement("div",{className:"rte-preview-tab rte-preview-tab-active"},"My Alerts"),t.createElement("div",{className:"rte-preview-tab"},"Reportees Alerts"))),t.createElement("div",{className:"rte-preview-mobile-body"},t.createElement("div",{className:"rte-preview-card"},t.createElement("div",{className:"rte-preview-content",dangerouslySetInnerHTML:{__html:M(a)}}),t.createElement("div",{className:"rte-preview-meta"},"Data updated as on ",x()),t.createElement("div",{className:"rte-preview-footer"},t.createElement("div",{className:"rte-preview-actions"},t.createElement(be,{className:"rte-preview-like"}),t.createElement(we,{className:"rte-preview-like"})),t.createElement("div",{className:"rte-preview-time"},W())))))),t.createElement("div",null,t.createElement("h3",{style:{marginBottom:10}},"Enter Attribute Values"),t.createElement("div",{className:"rte-attr-list"},Object.keys(m).map(C=>t.createElement("div",{key:C,className:"rte-attr-row"},t.createElement("div",{className:"rte-attr-name"},`{{${C}}}`),t.createElement("span",null," : "),t.createElement("input",{className:"rte-attr-input",value:m[C]||"",onChange:k=>{const F=k.target.value;v(I=>re(ne({},I),{[C]:F}))},placeholder:"Enter value"}))))))},xt=({visible:a,linkData:u,onClose:h,onInsert:m})=>{const[v,S]=t.useState(""),[_,H]=t.useState(""),[E,N]=t.useState(""),[M,x]=t.useState("_self");if(t.useEffect(()=>{a?(S(u.url||""),H(u.text||""),N(u.title||""),x(u.target||"_self")):(S(""),H(""),N(""),x("_self"))},[a,u]),!a)return null;const W=()=>{m({url:v,text:_,title:E,target:M})};return t.createElement(t.Fragment,null,t.createElement("div",{className:"rte-link-modal-overlay",onClick:h}),t.createElement("div",{className:"rte-link-modal"},t.createElement("h4",{className:"rte-link-modal__title"},v?"Edit Link":"Insert Link"),t.createElement("input",{type:"text",className:"rte-link-modal__input",placeholder:"URL",value:v,onChange:C=>S(C.target.value)}),t.createElement("input",{type:"text",className:"rte-link-modal__input",placeholder:"Text to Display",value:_,onChange:C=>H(C.target.value)}),t.createElement("input",{type:"text",className:"rte-link-modal__input",placeholder:"Title",value:E,onChange:C=>N(C.target.value)}),t.createElement("select",{className:"rte-link-modal__select",value:M,onChange:C=>x(C.target.value)},t.createElement("option",{value:"_self"},"Same tab"),t.createElement("option",{value:"_blank"},"New tab")),t.createElement("div",{className:"rte-link-modal__actions"},t.createElement("button",{className:"rte-link-modal__btn",onClick:h},"Cancel"),t.createElement("button",{className:"rte-link-modal__btn rte-link-modal__btn--ok",onClick:W},"OK"))))};function Se(a){const u=new Map;return a.forEach(h=>{u.set(h.name,h.value)}),Array.from(u.entries()).map(([h,m])=>({name:h,value:m}))}const Nt=({atSuggestions:a=[],showOutput:u=!1,showPreview:h=!1,toolbarConfig:m={link:!1,image:!1,emoji:!1,table:!1,color:!1,fontFamily:!1,fontSize:!1,highlight:!1,unorderedList:!1,orderedList:!1,staticUnorderedList:!1,staticOrderedList:!1},classNames:v={},styles:S={},handleGetHtml:_=()=>{},onChange:H=()=>{},value:E,onMentionSelect:N=()=>{},handleAddAttributes:M=()=>{}})=>{var Pe,_e,je,Fe,Ie,qe,Be,Ve,Ue,$e,We,Ze;const x=t.useRef(null),[W,C]=t.useState(E!=null&&E.length?E:" "),[k,F]=t.useState(""),[I,P]=t.useState(!1),[q,K]=t.useState({x:0,y:0}),[Z,L]=t.useState([]),O=t.useRef(null),B=t.useRef(null),[j,V]=t.useState({visible:!1,x:0,y:0}),[Y,g]=t.useState(!1),y=t.useRef(null),[X,G]=t.useState({url:"",text:"",title:"",target:"_self"}),ie={bold:!0,italic:!0,underline:!0,removeFormat:!0,unorderedList:(Pe=m.unorderedList)!=null?Pe:!0,orderedList:(_e=m.orderedList)!=null?_e:!0,staticUnorderedList:(je=m.staticUnorderedList)!=null?je:!0,staticOrderedList:(Fe=m.staticOrderedList)!=null?Fe:!0,align:!0,link:(Ie=m.link)!=null?Ie:!1,image:(qe=m.image)!=null?qe:!1,emoji:(Be=m.emoji)!=null?Be:!1,table:(Ve=m.table)!=null?Ve:!1,color:(Ue=m.color)!=null?Ue:!1,fontFamily:($e=m.fontFamily)!=null?$e:!1,fontSize:(We=m.fontSize)!=null?We:!1,highlight:(Ze=m.fontSize)!=null?Ze:!1},[de,J]=t.useState(""),[se,ue]=t.useState([]),[Le,xe]=t.useState({}),U=()=>x.current,T=()=>{const e=Mt(),n=/^<div[^>]*style=["'][^"']*font-size\s*:\s*\d+px[^"']*["'][^>]*>/.test(e.trim());let r=e;n||(r=`<div style="font-size: 12px;">${e}</div>`),r=r.replace(/<(ul|ol)([^>]*)>[\s\S]*?<\/\1>/g,(o,w,f)=>{if(/list-type=["']static["']/.test(f)||o.includes("data-hidden-array-start")||o.includes("data-hidden-array-end"))return o;const d=`<${w}${f}>`,s='<span data-hidden-array-start="true" style="display:none">{{#arrayData}}</span>',p='<span data-hidden-array-end="true" style="display:none">{{/arrayData}}</span>',b=`</${w}>`,z=o.replace(new RegExp(`^${d}`),"").replace(new RegExp(`${b}$`),"");return`${d}${s}${z}${p}${b}`}),F(r),_==null||_(r);const l=Xt(e);H(l);const c=Pt(),i=Se(c);JSON.stringify(i)!==JSON.stringify(se)&&(ue(i),N(i),tn(i))},Mt=()=>{const e=U();if(!e)return W;const n=e.cloneNode(!0);n.querySelectorAll("table div").forEach(l=>l.remove()),n.querySelectorAll("table").forEach(l=>{l.removeAttribute("data-has-resize-handle")}),n.querySelectorAll(".rte-table-selected , .rte-cell-highlight").forEach(l=>l.classList.remove(".rte-table-selected , .rte-cell-highlight"));let r=n.innerHTML;return r=Tt(r),r},Tt=e=>{const n=document.createElement("div");return n.innerHTML=e,n.querySelectorAll("tbody").forEach(r=>{r.getAttribute("table-type")==="static"||(r.innerHTML=`{{#arrayData}}${r.innerHTML}{{/arrayData}}`)}),n.innerHTML},R=()=>{const e=window.getSelection();if(!e||e.rangeCount===0)return;const n=document.getElementById("rte-editor-body");if(!n)return;const r=e.getRangeAt(0);n.contains(r.startContainer)&&(O.current=r.cloneRange())},Q=()=>{const e=window.getSelection();!e||!O.current||(e.removeAllRanges(),e.addRange(O.current))},Ne=(e,n)=>{const r=window.getSelection();r&&r.rangeCount>0&&(O.current=r.getRangeAt(0)),Q(),document.execCommand(e,!1,n),T()};t.useEffect(()=>{const e=U();if(!e||!E)return;const n=At(E);e.innerHTML=n,T()},[]);const At=e=>e.replace(/(<table[\s\S]*?>[\s\S]*?<\/table>)/g,n=>n.replace(/{{#arrayData}}/g,"").replace(/{{\/arrayData}}/g,""));t.useEffect(()=>()=>{document.removeEventListener("mousemove",null),document.removeEventListener("mouseup",null)},[]),t.useEffect(()=>{M&&M(e=>{Ot(e)})},[]),t.useEffect(()=>{const e=U();if(!e)return;e.querySelectorAll("table").forEach(r=>{r.hasAttribute("data-has-resize-handle")||(fe(r),r.querySelectorAll("th, td").forEach(c=>ee(c)))})},[]),t.useEffect(()=>{const e=()=>{requestAnimationFrame(()=>{ln()})};return document.addEventListener("selectionchange",e),()=>{document.removeEventListener("selectionchange",e)}},[]),t.useEffect(()=>{const e=x.current;if(!e)return;const n=()=>{e.querySelectorAll("table.rte-table-selected").forEach(l=>{l.dataset.__rteSelected="true",l.classList.remove("rte-table-selected")})},r=()=>{e.querySelectorAll("table[data-__rte-selected]").forEach(l=>{l.classList.add("rte-table-selected"),l.removeAttribute("data-__rte-selected")})};return e.addEventListener("copy",n),document.addEventListener("mouseup",r),()=>{e.removeEventListener("copy",n),document.removeEventListener("mouseup",r)}},[]);const Me=e=>{for(;e&&e.nodeName!=="LI";)e=e.parentNode;return e},Te=(e,n)=>{var d;const r=window.getSelection();if(!(r!=null&&r.rangeCount))return;const l=r.getRangeAt(0),c=Me(l.startContainer);let i,o;const w=n==="insertStaticUnorderedList"||n==="insertStaticOrderedList";if(c){let s=c.querySelector(e);s||(s=document.createElement(e),s.style.margin="0",s.style.paddingLeft="20px",c.appendChild(s)),o=s,i=document.createElement("li"),i.textContent="​",o.appendChild(i)}else{document.execCommand(e==="ul"?"insertUnorderedList":"insertOrderedList");const s=U();if(o=s==null?void 0:s.querySelector(`${e}:last-child`),!o)return;w&&o.setAttribute("list-type","static"),i=o.querySelector("li:last-child")}const f=document.createRange();f.setStart(i,0),f.collapse(!0),r.removeAllRanges(),r.addRange(f),(d=U())==null||d.focus(),T()},me=(e,n)=>{e==="insertOrderedList"||e==="insertStaticOrderedList"?Te("ol",e):e==="insertUnorderedList"||e==="insertStaticUnorderedList"?Te("ul",e):e.startsWith("justify")?Kt(e):Ne(e,n),e==="insertTable"&&ke(),e==="insertStaticTable"&&ke("insertStaticTable")},kt=e=>{const n=document.createElement("span");n.textContent="​",e.insertNode(n),e.setStartAfter(n),e.collapse(!0);const r=n.getBoundingClientRect();n.remove(),K({x:r.left,y:r.bottom+window.scrollY}),L(a||[]),P(!0),B.current=e.cloneRange()},zt=()=>{const e=window.getSelection();if(!e||e.rangeCount===0)return null;const n=e.anchorNode;let r=e.anchorOffset;if(!n)return null;let l=n;for(l.nodeType!==Node.TEXT_NODE&&(l.childNodes&&l.childNodes[r]?l=l.childNodes[r]:l=n.previousSibling);l;){if(l.nodeType===Node.TEXT_NODE){const c=l.textContent||"",i=l===n?r:c.length,o=c.lastIndexOf("@",i-1);if(o!==-1){const w=document.createRange();return w.setStart(l,o),w.setEnd(l,i),w}}l=l.previousSibling}return null},Dt=e=>{var i;const n=window.getSelection();if(!n)return;const r=zt();r?(n.removeAllRanges(),n.addRange(r)):B.current&&(n.removeAllRanges(),n.addRange(B.current));const l=document.createElement("span");l.textContent=`{{${e.name}}}`,l.style.display="inline",l.setAttribute("data-mention",e.value||e.name||""),l.title=`{{${e.name}}}`;try{const o=n.rangeCount?n.getRangeAt(0):null;if(o)o.deleteContents(),o.insertNode(l);else{const d=document.createRange(),s=U();d.selectNodeContents(s),d.collapse(!1),d.insertNode(l)}const w=document.createTextNode("​");l.after(w);const f=document.createRange();f.setStartAfter(w),f.collapse(!0),n.removeAllRanges(),n.addRange(f)}catch(o){console.error("insertMention error:",o)}let c=Se([...se,e]);ue(c),N(c),P(!1),(i=U())==null||i.focus(),T()},Ht=e=>{const n=U();if(!n)return;let r=null;O.current&&n.contains(O.current.startContainer)?r=O.current.cloneRange():(r=document.createRange(),r.selectNodeContents(n),r.collapse(!1));const l=window.getSelection();if(!l)return;l.removeAllRanges(),l.addRange(r);const c=document.createElement("span");c.textContent=`{{${e.name}}}`,c.style.display="inline",c.setAttribute("data-mention",e.value||e.name),c.title=`{{${e.name}}}`,r.insertNode(c);const i=document.createTextNode(" ");c.after(i);const o=document.createRange();o.setStartAfter(i),o.collapse(!0),l.removeAllRanges(),l.addRange(o),O.current=o.cloneRange(),n.focus()},Ot=e=>{e.forEach(n=>Ht(n)),ue(n=>{const r=[...n,...e],l=Array.from(new Map(r.map(c=>[c.name,c])).values());return N(l),l}),T()},Pt=()=>{const e=U();if(!e)return[];const n=e.querySelectorAll("span[data-mention]"),r=[];return n.forEach(l=>{const c=l.getAttribute("data-mention")||"",o=(l.textContent||"").match(/{{(.+?)}}/);o&&r.push({name:o[1],value:c})}),r},_t=e=>{var r,l,c;const n=e.key.toLowerCase();if((e.ctrlKey||e.metaKey)&&["b","i","u"].includes(n)&&(e.preventDefault(),me(n==="b"?"bold":n==="i"?"italic":n==="u"?"underline":"")),e.shiftKey&&e.key==="2"&&e.preventDefault(),e.key==="Enter"){const i=window.getSelection(),o=i!=null&&i.anchorNode?Me(i.anchorNode):null;if(!o)return;if(((r=o.textContent)==null?void 0:r.replace(/\u200B/g,"").trim())===""){e.preventDefault();const f=o.parentElement,d=f==null?void 0:f.closest("li");if(d){f==null||f.removeChild(o);const s=document.createElement("p");s.innerHTML="<br />",(l=d.parentElement)==null||l.insertBefore(s,d.nextSibling);const p=document.createRange();p.setStart(s,0),p.collapse(!0),i==null||i.removeAllRanges(),i==null||i.addRange(p)}else{const s=o.closest("ul, ol");if(s){const p=document.createElement("p");p.innerHTML="<br />",(c=s.parentElement)==null||c.insertBefore(p,s.nextSibling),s.removeChild(o);const b=document.createRange();b.setStart(p,0),b.collapse(!0),i==null||i.removeAllRanges(),i==null||i.addRange(b)}}T()}}if(n==="backspace"||n==="delete"){const i=window.getSelection();if(!i||i.rangeCount===0)return;const o=i.getRangeAt(0);if(o.cloneContents().querySelector("table"))return;if(o.cloneContents().querySelectorAll(".rte-resize-handle").length>0){e.preventDefault(),e.stopPropagation();return}}},jt=e=>{if(e.data==="@"){const r=window.getSelection();if(!(r!=null&&r.rangeCount))return;const l=r.anchorNode;if(he(l))return;setTimeout(()=>{kt(r.getRangeAt(0)),J(""),L(a),P(!0)},0);return}if(I){setTimeout(()=>Ae(),0);return}},he=e=>{if(!e)return!1;let n=e.nodeType===Node.ELEMENT_NODE?e:e.parentElement;for(;n;){if(n.tagName==="TH")return!0;n=n.parentElement}return!1},Ae=()=>{T();const e=window.getSelection();if(!e||!e.anchorNode)return;if(he(e.anchorNode)){P(!1);return}let n=e.anchorNode.textContent||"";n=n.replace(/\u00A0/g," ");const r=n.match(/@([^\n]*)$/);if(!r){P(!1);return}const l=r[1].trim().toLowerCase();J(l);const c=a.filter(i=>i.name.toLowerCase().includes(l));c.length>0?(L(c),P(!0)):P(!1)},Ft=e=>{var l;const n=(l=e.target.files)==null?void 0:l[0];if(!n)return;const r=new FileReader;r.onload=c=>{var b;const i=(b=c.target)==null?void 0:b.result;Q();const o=window.getSelection();let w=o&&o.rangeCount?o.getRangeAt(0):null;const f=document.createElement("img");f.src=i,f.alt=n.name||"image",f.className="rte-inserted-image",f.contentEditable="true";const d=U();if(!w||!d){d==null||d.appendChild(f);const z=document.createTextNode(" ");d==null||d.appendChild(z);const te=document.createRange();te.setStartAfter(z),te.collapse(!0),o==null||o.removeAllRanges(),o==null||o.addRange(te),d==null||d.focus(),T(),e.target.value="";return}w.deleteContents(),w.insertNode(f);const s=document.createTextNode(" ");f.after(s);const p=document.createRange();p.setStartAfter(s),p.collapse(!0),o.removeAllRanges(),o.addRange(p),d.focus(),T(),e.target.value=""},r.readAsDataURL(n)},It=e=>{var c;Q();const n=window.getSelection();if(!(n!=null&&n.rangeCount))return;const r=n.getRangeAt(0),l=document.createTextNode(e);r.insertNode(l),r.setStartAfter(l),r.collapse(!0),n.removeAllRanges(),n.addRange(r),(c=U())==null||c.focus(),T()},ke=e=>{var s;Jt(),Q();const n=document.createElement("table");n.style.borderCollapse="collapse",n.style.width="310px",n.style.border="1px solid #ccc",n.style.margin="8px 0",n.style.position="relative",n.style.textAlign="center",v.table&&n.classList.add(v.table);const r=document.createElement("thead");v.thead&&r.classList.add(v.thead);const l=document.createElement("tbody");v.tbody&&l.classList.add(v.tbody),e==="insertStaticTable"&&l.setAttribute("table-type","static");const c=document.createElement("tr");v.tr&&c.classList.add(v.tr);const i=document.createElement("tr");v.tr&&i.classList.add(v.tr);for(let p=0;p<2;p++){const b=document.createElement("th");b.textContent="",b.style.border="1px solid #999",b.style.padding="4px",b.style.position="relative",b.style.backgroundColor="lightgray",b.style.height="20px",b.style.whiteSpace="normal",b.style.wordBreak="break-word",b.style.overflowWrap="anywhere",b.style.lineHeight="20px",b.style.minWidth="20px",v.th&&b.classList.add(v.th);const z=document.createElement("td");z.textContent="",z.style.border="1px solid #999",z.style.padding="4px",z.style.position="relative",z.style.backgroundColor="#fff",z.style.minHeight="20px",z.style.height="20px",z.style.whiteSpace="normal",z.style.wordBreak="break-word",z.style.overflowWrap="anywhere",z.style.lineHeight="20px",z.style.minWidth="20px",v.td&&z.classList.add(v.td),ee(b),ee(z),c.appendChild(b),i.appendChild(z)}r.appendChild(c),l.appendChild(i),n.appendChild(r),n.appendChild(l),fe(n);const o=window.getSelection();if(!(o!=null&&o.rangeCount))return;const w=o.getRangeAt(0);w.collapse(!1),w.insertNode(n);const f=document.createElement("p");f.innerHTML="<br/>",n.after(f);const d=document.createRange();d.setStart(f,0),d.collapse(!0),o.removeAllRanges(),o.addRange(d),(s=U())==null||s.focus(),T()},fe=e=>{if(e.dataset.hasResizeHandle==="true")return;const n=document.createElement("div");Object.assign(n.style,{position:"absolute",width:"14px",height:"14px",right:"0",bottom:"0",background:"rgba(0,0,0,0.25)",cursor:"nwse-resize",zIndex:"20",borderRadius:"2px"}),n.contentEditable="false",n.dataset.hasResizeHandle="true",n.classList.add("rte-resize-handle"),n.addEventListener("mousedown",r=>{r.preventDefault(),r.clientX,r.clientY;const l=e.getBoundingClientRect();l.width,l.height;const c=o=>{const w=Math.max(100,o.clientX-l.left),f=Math.max(20,o.clientY-l.top);e.style.width=`${w}px`,e.style.height=`${f}px`,T()},i=()=>{document.removeEventListener("mousemove",c),document.removeEventListener("mouseup",i),T()};document.addEventListener("mousemove",c),document.addEventListener("mouseup",i)}),e.appendChild(n)},ee=e=>{const n=document.createElement("div"),r=document.createElement("div");Object.assign(n.style,{position:"absolute",right:"0",top:"0",width:"4px",height:"100%",cursor:"col-resize",background:"rgba(0,0,0,0.15)",zIndex:"10",MozUserSelect:"none",msUserSelect:"none",pointerEvents:"auto"}),n.contentEditable="false",n.classList.add("rte-resize-handle"),Object.assign(r.style,{position:"absolute",bottom:"0",left:"0",width:"100%",height:"4px",cursor:"row-resize",background:"rgba(0,0,0,0.15)",zIndex:"10",MozUserSelect:"none",msUserSelect:"none",pointerEvents:"auto"}),r.contentEditable="false",r.classList.add("rte-resize-handle"),qt(e,n,r),e.appendChild(n),e.appendChild(r)},qt=(e,n,r)=>{let l=0,c=0,i=0,o=0;n.addEventListener("mousedown",s=>{s.preventDefault(),l=s.clientX,i=e.offsetWidth,document.addEventListener("mousemove",w),document.addEventListener("mouseup",d)}),r.addEventListener("mousedown",s=>{s.preventDefault(),c=s.clientY,o=e.offsetHeight,document.addEventListener("mousemove",f),document.addEventListener("mouseup",d)});const w=s=>{const p=i+(s.clientX-l);e.style.width=`${Math.max(30,p)}px`,T()},f=s=>{const p=o+(s.clientY-c);e.style.height=`${Math.max(20,p)}px`,T()},d=()=>{document.removeEventListener("mousemove",w),document.removeEventListener("mousemove",f),document.removeEventListener("mouseup",d),T()}},Bt=e=>{const r=e.target.closest("td, th");r&&(e.preventDefault(),document.querySelectorAll(".rte-cell-highlight").forEach(l=>l.classList.remove("rte-cell-highlight")),r.classList.add("rte-cell-highlight"),V({visible:!0,x:e.clientX,y:e.clientY,cell:r}))},ze=()=>{document.querySelectorAll(".rte-cell-highlight").forEach(e=>e.classList.remove("rte-cell-highlight"))};function De(){const e=x.current;e&&e.querySelectorAll("table.rte-table-selected").forEach(n=>n.classList.remove("rte-table-selected"))}const Vt=e=>{var i,o,w;if(!j.cell)return;const n=j.cell.closest("table"),r=j.cell.cellIndex,l=j.cell.parentElement.rowIndex,c=f=>{const d=f.tagName.toLowerCase(),s=document.createElement(d);return s.textContent="",s.style.cssText=f.style.cssText,ee(s),s};switch(e){case"insertRowAbove":{const f=n.rows[l],d=n.insertRow(l);Array.from(f.cells).forEach(s=>{d.appendChild(c(s))});break}case"insertRowBelow":{const f=n.rows[l],d=n.insertRow(l+1);Array.from(f.cells).forEach(s=>{d.appendChild(c(s))});break}case"insertColLeft":{Array.from(n.rows).forEach(f=>{const d=f.cells[r];f.insertBefore(c(d),d)});break}case"insertColRight":{Array.from(n.rows).forEach(f=>{const d=f.cells[r];f.insertBefore(c(d),d.nextSibling)});break}case"deleteRow":n.rows.length>1&&n.deleteRow(l);break;case"deleteCol":Array.from(n.rows).forEach(f=>{f.cells[r]&&f.deleteCell(r)});break;case"deleteTable":{const f=(i=j.cell)==null?void 0:i.closest("table");if(!f)break;f.remove();const d=document.createElement("p");d.innerHTML="<br />",(w=(o=j.cell)==null?void 0:o.parentElement)==null||w.after(d);break}}requestAnimationFrame(()=>T()),V(re(ne({},j),{visible:!1})),ze(),De()},Ut=()=>{R(),y.current=O.current,G({url:"",text:"",title:"",target:"_self"}),g(!0)},$t=e=>{const n=window.getSelection();if(!n||!y.current)return;n.removeAllRanges(),n.addRange(y.current);let r=e.url.trim();/^https?:\/\//i.test(r)||(r="https://"+r);const l=document.createElement("a");l.href=r,l.style.cursor="pointer",l.style.outline="none",l.textContent=e.text||r,l.title=e.title,l.target=e.target,l.contentEditable="true";const c=n.getRangeAt(0);c.deleteContents(),c.insertNode(l);const i=document.createTextNode(" ");l.after(i);const o=document.createRange();o.setStartAfter(i),o.collapse(!0),n.removeAllRanges(),n.addRange(o),g(!1),T()},Wt=e=>{const n=e.target;if(n.tagName==="A"){const r=n;if(e.ctrlKey||e.metaKey){window.open(r.href,"_blank","noopener,noreferrer");return}e.preventDefault();const l=document.createRange();l.selectNode(r),y.current=l,G({url:r.href,text:r.textContent||r.href,title:r.title,target:r.target}),g(!0)}},Zt=()=>{const e=U();if(!e)return;const n=window.getSelection();if((!n||n.rangeCount===0)&&O.current){const s=window.getSelection();s==null||s.removeAllRanges(),s==null||s.addRange(O.current)}const r=window.getSelection();if(!r||r.rangeCount===0)return;const l=r.getRangeAt(0);Q(),document.execCommand("removeFormat",!1);const c=l.cloneContents(),i=document.createElement("div");i.appendChild(c);const o=document.createTreeWalker(i,NodeFilter.SHOW_ELEMENT,null),w=[];for(;o.nextNode();){const s=o.currentNode,p=s.tagName.toUpperCase(),b=s.getAttribute&&s.getAttribute("data-mention")!==null;p!=="A"&&!b&&w.push(s)}for(let s=w.length-1;s>=0;s--){const p=w[s],b=p.parentNode;if(b){for(;p.firstChild;)b.insertBefore(p.firstChild,p);b.removeChild(p)}}i.querySelectorAll("[style]").forEach(s=>s.removeAttribute("style")),l.deleteContents();const f=document.createDocumentFragment();for(;i.firstChild;)f.appendChild(i.firstChild);l.insertNode(f);const d=document.createRange();d.setStartAfter(l.endContainer.nodeType===Node.TEXT_NODE?l.endContainer:l.startContainer),d.collapse(!0),r.removeAllRanges(),r.addRange(d),e.normalize(),T()},Xt=e=>{var l;let n=e;n=n.replace(/{{#arrayData\d*}}/g,""),n=n.replace(/{{\/arrayData\d*}}/g,"");const r=document.createElement("div");return r.innerHTML=n,r.querySelectorAll("br").forEach(c=>{c.replaceWith(`
2
+ `)}),r.querySelectorAll("p, div, tr").forEach(c=>{c.insertAdjacentText("afterend",`
3
+ `)}),r.querySelectorAll("table").forEach(c=>{c.insertAdjacentText("afterend",`
4
4
  `)}),((l=r.textContent)==null?void 0:l.replace(/\n{3,}/g,`
5
5
 
6
- `).trim())||""};function Xt(){const t=window.getSelection();if(!t||t.rangeCount===0)return[];const n=t.getRangeAt(0);if(n.collapsed){let o=n.startContainer,i=o.nodeType===Node.ELEMENT_NODE?o:o.parentElement;const p=i==null?void 0:i.closest("td, th");return p?[p]:[]}const r=n.commonAncestorContainer,l=r.nodeType===Node.ELEMENT_NODE?r:r.parentElement;return Array.from(l.querySelectorAll("td, th")).filter(o=>{const i=document.createRange();return i.selectNodeContents(o),n.compareBoundaryPoints(Range.END_TO_START,i)<0&&n.compareBoundaryPoints(Range.START_TO_END,i)>0})}function Zt(t){const n=Xt();if(n.length===0){Ne(t);return}let r="left";t==="justifyCenter"&&(r="center"),t==="justifyRight"&&(r="right"),n.forEach(l=>{l.style.textAlign=r}),T()}const Kt=()=>{const t=window.getSelection();if(!t||!t.anchorNode)return!1;let n=t.anchorNode.nodeType===Node.ELEMENT_NODE?t.anchorNode:t.anchorNode.parentElement;for(;n;){if(n.tagName==="TABLE")return!0;n=n.parentElement}return!1},Yt=t=>{if(Kt()){t.preventDefault();const h=t.clipboardData.getData("text/plain");if(!h)return;const c=window.getSelection();if(!c||!c.rangeCount)return;const g=c.getRangeAt(0);g.deleteContents();const C=h.split(/\r?\n/);C.forEach((z,te)=>{g.insertNode(document.createTextNode(z)),te<C.length-1&&g.insertNode(document.createElement("br"))}),g.collapse(!1),c.removeAllRanges(),c.addRange(g),T();return}const n=t.clipboardData.getData("text/html")||"";if(!n)return;const r=document.createElement("div");if(r.innerHTML=n,r.querySelector("img")){t.preventDefault();return}t.preventDefault();const l=document.createElement("div");l.innerHTML=n;const s=h=>{h.hasAttribute("data-has-resize-handle")||(h.style.borderCollapse="collapse",h.style.width="100%",h.style.border="1px solid #ccc",h.style.margin="8px 0",h.style.position="relative",h.style.textAlign="center",h.querySelectorAll("th").forEach(c=>{const g=c;g.style.border="1px solid #999",g.style.padding="4px",g.style.position="relative",g.style.backgroundColor="lightgray",g.style.height="20px"}),h.querySelectorAll("td").forEach(c=>{const g=c;g.style.border="1px solid #999",g.style.padding="4px",g.style.position="relative",g.style.backgroundColor="#fff",g.style.height="20px"}))};l.querySelectorAll("table").forEach(h=>s(h));const o=window.getSelection();if(!o||!o.rangeCount)return;const i=o.getRangeAt(0);i.deleteContents();const p=document.createDocumentFragment();for(;l.firstChild;)p.appendChild(l.firstChild);i.insertNode(p),i.collapse(!1),o.removeAllRanges(),o.addRange(i);const E=M.current;E&&(E.querySelectorAll("table").forEach(h=>{const c=h;c.hasAttribute("data-has-resize-handle")||(he(c),c.querySelectorAll("th, td").forEach(g=>{const C=g;C.dataset.hasResizeHandles||ee(C)}))}),T())},Qt=t=>{R();const n=window.getSelection();if(!n||!n.rangeCount)return;const r=n.getRangeAt(0),l=document.createElement("span");l.style.fontSize=`${t}px`,l.appendChild(r.extractContents()),r.insertNode(l);const s=document.createRange();s.setStartAfter(l),s.collapse(!0),n.removeAllRanges(),n.addRange(s),T()},Rt=()=>{const t=window.getSelection();if(!t||!t.anchorNode)return null;const n=t.anchorNode;if(me(n)||n.nodeType!==Node.TEXT_NODE)return null;const r=n.textContent||"",l=t.anchorOffset,s=r.lastIndexOf("@",l-1);if(s===-1)return null;const o=r.substring(s+1,l);if(o.includes(" ")||o.includes(" "))return null;const i=document.createRange();return i.setStart(n,s),i.setEnd(n,l),{range:i,query:o}},De=()=>{const t=Rt();if(!t)return;const{range:n,query:r}=t,l=document.createElement("span");l.textContent="​",n.insertNode(l);const s=l.getBoundingClientRect();l.remove(),K({x:s.left,y:s.bottom+window.scrollY}),J(r.toLowerCase());const o=a.filter(i=>i.name.toLowerCase().includes(r.toLowerCase()));S(o),P(!0),B.current=n.cloneRange()};function Gt(){const t=M.current;if(!t)return;const n=window.getSelection();if(!n||n.rangeCount>0&&t.contains(n.anchorNode))return;const r=document.createRange();r.selectNodeContents(t),r.collapse(!1),n.removeAllRanges(),n.addRange(r),H.current=r.cloneRange()}const Jt=t=>{const n=t.target;if(!n||!(n.textContent||"").match(/{{([\s\S]+?)}}/)||!M.current)return;let o=n.firstChild;if((!o||o.nodeType!==Node.TEXT_NODE)&&(o=n.childNodes[0]),!o||o.nodeType!==Node.TEXT_NODE)return;const i=o.textContent||"",p=i.indexOf("{{"),E=i.indexOf("}}");if(p===-1||E===-1)return;const h=window.getSelection();if(!h)return;const c=document.createRange();c.setStart(o,p),c.setEnd(o,E+2),h.removeAllRanges(),h.addRange(c)},en=t=>{xe(n=>{const r={};return t.forEach(l=>{var s;r[l.name]=(s=n[l.name])!=null?s:""}),r})},tn=()=>{let t=k;return Object.entries(Se).forEach(([n,r])=>{if(r.trim()){const l=new RegExp(`{{\\s*${n}\\s*}}`,"g");t=t.replace(l,r)}}),t};return e.createElement("div",{className:`rte-wrapper ${(v==null?void 0:v.wrapper)||""}`,style:L.wrapper},e.createElement("div",{style:{flex:1}},e.createElement(Ee,{exec:ue,saveSelection:Q,handleFileChange:jt,handleFontSizeChange:t=>Qt(t.target.value),handleFontFamilyChange:t=>ue("fontName",t.target.value),insertEmoji:_t,handleLink:Bt,removeFormatting:$t,visibleActions:ie,className:v.toolbar,style:L.toolbar}),e.createElement("div",{ref:M,id:"rte-editor-body",className:`rte-editor ${(v==null?void 0:v.editor)||""}`,style:L.editor,contentEditable:!0,suppressContentEditableWarning:!0,onPaste:Yt,onKeyUp:()=>{Q(),De()},onMouseUp:Q,onInput:()=>{Ae(),Q()},onKeyDown:Ht,onBeforeInput:Pt,onContextMenu:It,onClick:t=>{Ut(t),Q(),De()},onDoubleClick:Jt}),e.createElement(bt,{show:I,position:q,filtered:X,insertMention:kt,onClose:()=>P(!1),query:ce}),d&&e.createElement("div",{className:`rte-output ${(v==null?void 0:v.output)||""}`,style:L.output},e.createElement("h4",null,"Output HTML:"),e.createElement("p",null,k)),e.createElement(Ct,{visible:F.visible,x:F.x,y:F.y,onAction:qt,onClose:()=>{V(re(ne({},F),{visible:!1})),ze()}}),e.createElement(Lt,{visible:Y,linkData:Z,onClose:()=>f(!1),onInsert:Vt})),u?e.createElement(Ce,{className:v.preview,style:L.preview,html:tn(),attributes:Se,setAttributes:xe}):null)};D.RichTextEditor=St,D.RtePreview=Ce,D.RteToolbar=Ee,Object.defineProperty(D,Symbol.toStringTag,{value:"Module"})}));
6
+ `).trim())||""};function He(){const e=window.getSelection();if(!e||e.rangeCount===0)return[];const n=e.getRangeAt(0);if(n.collapsed){let i=n.startContainer,o=i.nodeType===Node.ELEMENT_NODE?i:i.parentElement;const w=o==null?void 0:o.closest("td, th");return w?[w]:[]}const r=n.commonAncestorContainer,l=r.nodeType===Node.ELEMENT_NODE?r:r.parentElement;return Array.from(l.querySelectorAll("td, th")).filter(i=>{const o=document.createRange();return o.selectNodeContents(i),n.compareBoundaryPoints(Range.END_TO_START,o)<0&&n.compareBoundaryPoints(Range.START_TO_END,o)>0})}function Kt(e){const n=He();if(n.length===0){Ne(e);return}let r="left";e==="justifyCenter"&&(r="center"),e==="justifyRight"&&(r="right"),n.forEach(l=>{l.style.textAlign=r}),T()}const Yt=()=>{const e=window.getSelection();if(!e||!e.anchorNode)return!1;let n=e.anchorNode.nodeType===Node.ELEMENT_NODE?e.anchorNode:e.anchorNode.parentElement;for(;n;){if(n.tagName==="TABLE")return!0;n=n.parentElement}return!1},Rt=e=>{if(Yt()){e.preventDefault();const d=e.clipboardData.getData("text/plain");if(!d)return;const s=window.getSelection();if(!s||!s.rangeCount)return;const p=s.getRangeAt(0);p.deleteContents();const b=d.split(/\r?\n/);b.forEach((z,te)=>{p.insertNode(document.createTextNode(z)),te<b.length-1&&p.insertNode(document.createElement("br"))}),p.collapse(!1),s.removeAllRanges(),s.addRange(p),T();return}const n=e.clipboardData.getData("text/html")||"";if(!n)return;const r=document.createElement("div");if(r.innerHTML=n,r.querySelector("img")){e.preventDefault();return}e.preventDefault();const l=document.createElement("div");l.innerHTML=n;const c=d=>{d.hasAttribute("data-has-resize-handle")||(d.style.borderCollapse="collapse",d.style.width="100%",d.style.border="1px solid #ccc",d.style.margin="8px 0",d.style.position="relative",d.style.textAlign="center",d.querySelectorAll("th").forEach(s=>{const p=s;p.style.border="1px solid #999",p.style.padding="4px",p.style.position="relative",p.style.backgroundColor="lightgray",p.style.height="20px",p.style.whiteSpace="normal",p.style.wordBreak="break-word",p.style.overflowWrap="anywhere",p.style.lineHeight="20px",p.style.minWidth="20px"}),d.querySelectorAll("td").forEach(s=>{const p=s;p.style.border="1px solid #999",p.style.padding="4px",p.style.position="relative",p.style.backgroundColor="#fff",p.style.height="20px",p.style.minHeight="20px",p.style.whiteSpace="normal",p.style.wordBreak="break-word",p.style.overflowWrap="anywhere",p.style.lineHeight="20px",p.style.minWidth="20px"}))};l.querySelectorAll("table").forEach(d=>c(d));const i=window.getSelection();if(!i||!i.rangeCount)return;const o=i.getRangeAt(0);o.deleteContents();const w=document.createDocumentFragment();for(;l.firstChild;)w.appendChild(l.firstChild);o.insertNode(w),o.collapse(!1),i.removeAllRanges(),i.addRange(o);const f=x.current;f&&(f.querySelectorAll("table").forEach(d=>{const s=d;s.hasAttribute("data-has-resize-handle")||(fe(s),s.querySelectorAll("th, td").forEach(p=>{const b=p;b.dataset.hasResizeHandles||ee(b)}))}),T())},Qt=e=>{Q();const n=window.getSelection();if(!n||!n.rangeCount)return;const r=He();if(r.length>0){r.forEach(o=>{o.style.fontSize=`${e}px`,o.style.lineHeight="1.2"}),T();return}const l=n.getRangeAt(0);if(l.collapsed)return;const c=document.createElement("span");c.style.fontSize=`${e}px`,c.appendChild(l.extractContents()),l.insertNode(c);const i=document.createRange();i.setStartAfter(c),i.collapse(!0),n.removeAllRanges(),n.addRange(i),T()},Gt=()=>{const e=window.getSelection();if(!e||!e.anchorNode)return null;const n=e.anchorNode;if(he(n)||n.nodeType!==Node.TEXT_NODE)return null;const r=n.textContent||"",l=e.anchorOffset,c=r.lastIndexOf("@",l-1);if(c===-1)return null;const i=r.substring(c+1,l);if(i.includes(" ")||i.includes(" "))return null;const o=document.createRange();return o.setStart(n,c),o.setEnd(n,l),{range:o,query:i}},Oe=()=>{const e=Gt();if(!e)return;const{range:n,query:r}=e,l=document.createElement("span");l.textContent="​",n.insertNode(l);const c=l.getBoundingClientRect();l.remove(),K({x:c.left,y:c.bottom+window.scrollY}),J(r.toLowerCase());const i=a.filter(o=>o.name.toLowerCase().includes(r.toLowerCase()));L(i),P(!0),B.current=n.cloneRange()};function Jt(){const e=x.current;if(!e)return;const n=window.getSelection();if(!n||n.rangeCount>0&&e.contains(n.anchorNode))return;const r=document.createRange();r.selectNodeContents(e),r.collapse(!1),n.removeAllRanges(),n.addRange(r),O.current=r.cloneRange()}const en=e=>{const n=e.target;if(!n||!(n.textContent||"").match(/{{([\s\S]+?)}}/)||!x.current)return;let i=n.firstChild;if((!i||i.nodeType!==Node.TEXT_NODE)&&(i=n.childNodes[0]),!i||i.nodeType!==Node.TEXT_NODE)return;const o=i.textContent||"",w=o.indexOf("{{"),f=o.indexOf("}}");if(w===-1||f===-1)return;const d=window.getSelection();if(!d)return;const s=document.createRange();s.setStart(i,w),s.setEnd(i,f+2),d.removeAllRanges(),d.addRange(s)},tn=e=>{xe(n=>{const r={};return e.forEach(l=>{var c;r[l.name]=(c=n[l.name])!=null?c:""}),r})},nn=()=>{let e=k;return Object.entries(Le).forEach(([n,r])=>{if(r.trim()){const l=new RegExp(`{{\\s*${n}\\s*}}`,"g");e=e.replace(l,r)}}),e};function rn(e){const n=window.getSelection();if(!n||n.rangeCount===0)return!1;const r=n.getRangeAt(0),l=document.createRange();return l.selectNode(e),r.compareBoundaryPoints(Range.START_TO_START,l)<=0&&r.compareBoundaryPoints(Range.END_TO_END,l)>=0}function ln(){const e=x.current;if(!e)return;e.querySelectorAll("table").forEach(r=>{rn(r)?r.classList.add("rte-table-selected"):r.classList.remove("rte-table-selected")})}return t.createElement("div",{className:`rte-wrapper ${(v==null?void 0:v.wrapper)||""}`,style:S.wrapper},t.createElement("div",{style:{flex:1}},t.createElement(ye,{exec:me,saveSelection:R,handleFileChange:Ft,handleFontSizeChange:e=>Qt(e.target.value),handleFontFamilyChange:e=>me("fontName",e.target.value),insertEmoji:It,handleLink:Ut,removeFormatting:Zt,visibleActions:ie,className:v.toolbar,style:S.toolbar}),t.createElement("div",{ref:x,id:"rte-editor-body",className:`rte-editor ${(v==null?void 0:v.editor)||""}`,style:S.editor,contentEditable:!0,suppressContentEditableWarning:!0,onPaste:Rt,onKeyUp:()=>{R(),Oe()},onMouseUp:R,onInput:()=>{Ae(),R()},onKeyDown:_t,onBeforeInput:jt,onContextMenu:Bt,onClick:e=>{Wt(e),R(),Oe()},onDoubleClick:en}),t.createElement(St,{show:I,position:q,filtered:Z,insertMention:Dt,onClose:()=>P(!1),query:de}),u&&t.createElement("div",{className:`rte-output ${(v==null?void 0:v.output)||""}`,style:S.output},t.createElement("h4",null,"Output HTML:"),t.createElement("p",null,k)),t.createElement(Lt,{visible:j.visible,x:j.x,y:j.y,onAction:Vt,onClose:()=>{V(re(ne({},j),{visible:!1})),ze(),De()}}),t.createElement(xt,{visible:Y,linkData:X,onClose:()=>g(!1),onInsert:$t})),h?t.createElement(Ce,{className:v.preview,style:S.preview,html:nn(),attributes:Le,setAttributes:xe}):null)};D.RichTextEditor=Nt,D.RtePreview=Ce,D.RteToolbar=ye,Object.defineProperty(D,Symbol.toStringTag,{value:"Module"})}));
@@ -1 +1 @@
1
- *{box-sizing:border-box;margin:0}.rte-wrapper{font-family:Inter,system-ui,sans-serif;display:flex;flex-grow:1;flex-direction:row;min-height:400px;min-width:400px;gap:12px;padding:12px;background:#fff;overflow:hidden}.rte-wrapper>div:first-child{display:flex;flex-direction:column;flex:2;min-width:0;min-height:0;gap:8px;overflow:hidden}.rte-toolbar{position:static!important;overflow:visible!important;flex-shrink:0;display:flex;flex-wrap:wrap;align-items:center;gap:10px;background:#fafafa;padding:8px;border:1px solid #eee;border-radius:6px;overflow-y:auto;max-height:140px;user-select:none}.rte-dropdown{padding:4px 8px;border-radius:4px;border:1px solid #ccc;font-size:12px;background:#fff;cursor:pointer;width:110px}.rte-fontsize-dropdown{max-height:80px;overflow-y:scroll}.rte-toolbar button{padding:6px;border:1px solid transparent;background:none;cursor:pointer}.rte-toolbar button:hover{color:#00f}.rte-toolbar button[title=Emoji]{color:#ff0;fill:#000;background:none;font-size:18px;display:inline-flex;align-items:center;justify-content:center;border:none}.rte-toolbar button[title=Emoji] svg{background-color:#000;border-radius:50%;display:block}.rte-toolbar button[title=removeFormat]{font-size:16px}.rte-toolbar *{user-select:none;pointer-events:auto}.rte-editor{flex:1 1 auto;min-height:0;padding:12px;outline:none;border:1px solid lightgray;border-radius:4px;background:#fff;overflow-y:auto}.rte-output{flex-shrink:0;height:20%;background:#f7f7f7;border:1px solid lightgray;border-radius:4px;padding:10px;overflow-y:auto;min-height:100px}.rte-output h4{margin-bottom:6px;font-size:14px}.rte-preview{flex:1;border:1px solid #ccc;border-radius:4px;background:#fff;padding:10px;overflow-y:auto;min-width:200px;min-height:200px}.rte-editor table,.rte-preview table{border-collapse:collapse;width:100%}.rte-editor th,.rte-editor td,.rte-preview th,.rte-preview td{border:1px solid #ccc;background:#fff;padding:6px;min-width:60px;position:relative}.rte-editor th,.rte-preview th{background-color:#d3d3d3}.rte-th div,.rte-td div{border:none!important;background:transparent!important;padding:0;margin:0}.rte-cell-highlight{outline:2px solid #007bff;outline-offset:-2px;background-color:#007bff1a;z-index:2}.rte-popup{position:fixed;padding:4px 0;background-color:#fff;border:1px solid lightgray;border-radius:4px;box-shadow:0 2px 6px #0000001a;list-style:none;margin:0;z-index:1000;max-height:250px;overflow-y:auto;width:fit-content;scrollbar-width:thin}.rte-emoji-popup{position:fixed;top:130%;left:25%;background:#fff;border:1px solid #ccc;border-radius:8px;padding:8px;width:260px;height:200px;overflow-y:auto;display:grid;grid-template-columns:repeat(6,1fr);gap:4px;z-index:10000;box-shadow:0 4px 8px #00000026}.rte-table-menu{position:absolute;display:flex;flex-direction:column;align-items:baseline;gap:4px;background:#fff;border:1px solid #ccc;box-shadow:0 2px 6px #00000026;z-index:999;padding:4px}.rte-table-menu button{display:flex;align-items:end;gap:4px;padding:6px;border:1px solid transparent;background:none;cursor:pointer}.rte-table-menu button:hover{color:#00f}.rte-link-modal-overlay{position:fixed;top:0;left:0;width:100vw;height:100vh;background:#0006;z-index:9999;backdrop-filter:blur(1px)}.rte-link-modal{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);background:#fff;border:1px solid #ccc;border-radius:6px;box-shadow:0 4px 8px #0003;padding:16px;width:320px;z-index:10000;animation:fadeIn .2s ease-in-out}.rte-link-modal__title{margin-bottom:8px;font-size:16px;font-weight:600;text-align:center}.rte-link-modal__input,.rte-link-modal__select{width:100%;padding:6px 8px;margin-bottom:8px;border:1px solid #ccc;border-radius:4px;font-size:14px}.rte-link-modal__input:focus,.rte-link-modal__select:focus{border-color:#007bff;outline:none}.rte-link-modal__actions{display:flex;justify-content:flex-end;gap:8px}.rte-link-modal__btn{padding:6px 12px;border:none;border-radius:4px;font-size:14px;cursor:pointer}.rte-link-modal__btn:hover{opacity:.9}.rte-link-modal__btn--ok{background:#007bff;color:#fff}@keyframes fadeIn{0%{opacity:0;transform:translate(-50%,-48%)}to{opacity:1;transform:translate(-50%,-50%)}}.rte-toolbar{border:1px solid #e0e0e0;transition:box-shadow .2s ease}.rte-toolbar button:hover{background:#eef3ff;border-radius:6px;color:#007bff;transform:translateY(-2px);transition:all .2s ease}.rte-editor{border:1px solid #ddd;border-radius:2px;background:#fcfcfc;padding:16px;line-height:1.6;font-size:12px;transition:all .2s ease}.rte-editor:focus{border-color:#007bff;background:#fff}.rte-output{border:1px solid #e5e8ec;font-family:monospace;font-size:13px;color:#333}.rte-preview{background:#fff;border:1px solid #e5e5e5;border-radius:10px;box-shadow:0 2px 6px #0000000d;padding:16px}.rte-emoji-popup{background:#fff;box-shadow:0 4px 12px #00000026;padding:10px;width:280px;grid-template-columns:repeat(7,1fr);gap:6px}.rte-emoji-popup span{font-size:22px;cursor:pointer;transition:transform .15s ease}.rte-emoji-popup span:hover{transform:scale(1.3)}.rte-inserted-image{max-width:100%;height:200px;width:fit-content;object-fit:cover;border-radius:6px;display:inline-block;vertical-align:middle;box-shadow:0 1px 4px #0000000f;transition:box-shadow .15s ease,transform .15s ease;cursor:pointer;position:relative}.rte-inserted-image:hover{box-shadow:0 4px 14px #0000001f;transform:translateY(-1px)}.rte-highlight{color:#007bff;font-weight:700;font-weight:600}.rte-active{background:#dce8ff!important;border-radius:4px!important}.rte-resize-handle{user-select:none!important;-webkit-user-select:none!important;-moz-user-select:none!important;-ms-user-select:none!important;-webkit-user-drag:none!important;-webkit-touch-callout:none!important;pointer-events:auto}.rte-editor,.rte-editor *{-webkit-user-select:text}.rte-resize-handle,.rte-resize-handle *{-webkit-user-select:none!important;user-select:none!important}.rte-preview-like{font-size:30px;border:1px solid lightgrey;padding:2px 6px;background:#e0dede;border-radius:4px}.rte-preview-device-picker{position:absolute;top:2px;right:2px;z-index:20;background:#fff;border-radius:4px;padding:4px;box-shadow:0 2px 6px #00000026}.rte-preview-placeholder{color:#00f}.rte-preview-web-wrapper{padding:12px;overflow:auto;margin-top:25px;background:#f2f3f5;margin-bottom:20px}.rte-preview-card{background:#fff;border-radius:16px;padding:16px;box-shadow:0 2px 6px #00000014;display:flex;flex-direction:column;gap:10px}.rte-preview-content{font-size:14px;line-height:1.4;color:#2f2f2f;white-space:pre-wrap;overflow:auto;scrollbar-width:none}.rte-preview-meta{font-size:12px;color:#b0b7bd}.rte-preview-footer{display:flex;align-items:center;justify-content:space-between}.rte-preview-actions{display:flex;gap:16px;opacity:.6}.rte-preview-time{font-size:12px;color:#b0b7bd}.rte-preview-mobile-overlay{inset:0;display:flex;justify-content:space-around;align-items:flex-start;padding-top:16px;z-index:10;margin-bottom:20px}.rte-preview-mobile-frame{background:#fff;border-radius:24px;box-shadow:0 0 0 8px #111,0 10px 20px #00000040;overflow:hidden;display:flex;flex-direction:column}.rte-preview-mobile-header{height:50px;background:#1da1f2;display:flex;align-items:center;justify-content:space-between;padding:0 12px}.rte-preview-logo{width:36px;height:36px;border-radius:8px;background:#fff;display:flex;align-items:center;justify-content:center;font-size:10px;font-weight:700;color:#1da1f2}.rte-preview-bell{position:relative;font-size:18px;color:#fff}.rte-preview-badge{position:absolute;top:-4px;right:-6px;background:#ff3b30;color:#fff;font-size:9px;padding:2px 4px;border-radius:10px}.rte-preview-tabs-wrapper{padding:8px;background:#f2f3f5;display:flex;justify-content:center}.rte-preview-tabs{width:70%;border-radius:24px;display:flex;border:1px solid #1da1f2}.rte-preview-tab{flex:1;text-align:center;padding:6px 0;border-radius:20px;color:#1da1f2;font-size:12px;font-weight:600}.rte-preview-tab-active{background:#1da1f2;color:#fff}.rte-preview-mobile-body{padding:0 12px 12px;overflow:auto;flex:1;background:#f2f3f5}.rte-attr-modal-backdrop{position:fixed;inset:0;background:#00000073;display:flex;align-items:center;justify-content:center;z-index:9999}.rte-attr-modal{width:fit-content;max-width:90vw;background:#fff;border-radius:12px;padding:20px 22px;box-shadow:0 20px 60px #00000040;display:flex;flex-direction:column;gap:14px;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif}.rte-attr-modal h3{margin:0;font-size:18px;font-weight:600;color:#222}.rte-attr-list{display:flex;flex-direction:column;gap:10px;max-height:260px;overflow-y:auto;padding-right:4px}.rte-attr-row{display:grid;grid-template-columns:1fr .1fr 1.2fr;gap:10px;align-items:center}.rte-attr-name{font-size:13px;color:#555;background:#f3f4f6;padding:6px 8px;border-radius:6px;font-family:monospace}.rte-attr-input{height:30px;padding:6px 8px;border-radius:6px;border:1px solid #d1d5db;font-size:13px;outline:none}.rte-attr-input:focus{border-color:#1da1f2;box-shadow:0 0 0 2px #1da1f226}.rte-attr-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:6px}.rte-attr-actions button{padding:6px 14px;border-radius:8px;border:none;cursor:pointer;font-size:13px}.rte-attr-actions button:first-child{background:#e5e7eb;color:#333}.rte-attr-actions button:last-child{background:#1da1f2;color:#fff}.rte-attr-actions button:hover{opacity:.9}
1
+ *{box-sizing:border-box;margin:0}.rte-wrapper{font-family:Inter,system-ui,sans-serif;display:flex;flex-grow:1;flex-direction:row;min-height:400px;min-width:400px;gap:12px;padding:12px;background:#fff;overflow:hidden}.rte-wrapper>div:first-child{display:flex;flex-direction:column;flex:2;min-width:0;min-height:0;gap:8px;overflow:hidden}.rte-toolbar{position:static!important;overflow:visible!important;flex-shrink:0;display:flex;flex-wrap:wrap;align-items:center;gap:10px;background:#fafafa;padding:8px;border:1px solid #eee;border-radius:6px;overflow-y:auto;max-height:140px;user-select:none}.rte-dropdown{padding:4px 8px;border-radius:4px;border:1px solid #ccc;font-size:12px;background:#fff;cursor:pointer;width:110px}.rte-fontsize-dropdown{max-height:80px;overflow-y:scroll}.rte-toolbar button{padding:6px;border:1px solid transparent;background:none;cursor:pointer}.rte-toolbar button:hover{color:#00f}.rte-toolbar button[title=Emoji]{color:#ff0;fill:#000;background:none;font-size:18px;display:inline-flex;align-items:center;justify-content:center;border:none}.rte-toolbar button[title=Emoji] svg{background-color:#000;border-radius:50%;display:block}.rte-toolbar button[title=removeFormat]{font-size:16px}.rte-toolbar *{user-select:none;pointer-events:auto}.rte-editor{flex:1 1 auto;min-height:0;padding:12px;outline:none;border:1px solid lightgray;border-radius:4px;background:#fff;overflow-y:auto}.rte-output{flex-shrink:0;height:20%;background:#f7f7f7;border:1px solid lightgray;border-radius:4px;padding:10px;overflow-y:auto;min-height:100px}.rte-output h4{margin-bottom:6px;font-size:14px}.rte-preview{flex:1;border:1px solid #ccc;border-radius:4px;background:#fff;padding:10px;overflow-y:auto;min-width:200px;min-height:200px}.rte-editor table,.rte-preview table{border-collapse:collapse;width:100%}.rte-editor th,.rte-editor td,.rte-preview th,.rte-preview td{border:1px solid #ccc;background:#fff;padding:6px;min-width:60px;position:relative}.rte-editor th,.rte-preview th{background-color:#d3d3d3}.rte-th div,.rte-td div{border:none!important;background:transparent!important;padding:0;margin:0}.rte-cell-highlight{outline:2px solid #007bff;outline-offset:-2px;background-color:#007bff1a;z-index:2}.rte-popup{position:fixed;padding:4px 0;background-color:#fff;border:1px solid lightgray;border-radius:4px;box-shadow:0 2px 6px #0000001a;list-style:none;margin:0;z-index:1000;max-height:250px;overflow-y:auto;width:fit-content;scrollbar-width:thin}.rte-emoji-popup{position:fixed;top:130%;left:25%;background:#fff;border:1px solid #ccc;border-radius:8px;padding:8px;width:260px;height:200px;overflow-y:auto;display:grid;grid-template-columns:repeat(6,1fr);gap:4px;z-index:10000;box-shadow:0 4px 8px #00000026}.rte-table-menu{position:absolute;display:flex;flex-direction:column;align-items:baseline;gap:4px;background:#fff;border:1px solid #ccc;box-shadow:0 2px 6px #00000026;z-index:999;padding:4px}.rte-table-menu button{display:flex;align-items:end;gap:4px;padding:6px;border:1px solid transparent;background:none;cursor:pointer}.rte-table-menu button:hover{color:#00f}.rte-link-modal-overlay{position:fixed;top:0;left:0;width:100vw;height:100vh;background:#0006;z-index:9999;backdrop-filter:blur(1px)}.rte-link-modal{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);background:#fff;border:1px solid #ccc;border-radius:6px;box-shadow:0 4px 8px #0003;padding:16px;width:320px;z-index:10000;animation:fadeIn .2s ease-in-out}.rte-link-modal__title{margin-bottom:8px;font-size:16px;font-weight:600;text-align:center}.rte-link-modal__input,.rte-link-modal__select{width:100%;padding:6px 8px;margin-bottom:8px;border:1px solid #ccc;border-radius:4px;font-size:14px}.rte-link-modal__input:focus,.rte-link-modal__select:focus{border-color:#007bff;outline:none}.rte-link-modal__actions{display:flex;justify-content:flex-end;gap:8px}.rte-link-modal__btn{padding:6px 12px;border:none;border-radius:4px;font-size:14px;cursor:pointer}.rte-link-modal__btn:hover{opacity:.9}.rte-link-modal__btn--ok{background:#007bff;color:#fff}@keyframes fadeIn{0%{opacity:0;transform:translate(-50%,-48%)}to{opacity:1;transform:translate(-50%,-50%)}}.rte-toolbar{border:1px solid #e0e0e0;transition:box-shadow .2s ease}.rte-toolbar button:hover{background:#eef3ff;border-radius:6px;color:#007bff;transform:translateY(-2px);transition:all .2s ease}.rte-editor{border:1px solid #ddd;border-radius:2px;background:#fcfcfc;padding:16px;line-height:1.6;font-size:12px;transition:all .2s ease}.rte-editor:focus{border-color:#007bff;background:#fff}.rte-output{border:1px solid #e5e8ec;font-family:monospace;font-size:13px;color:#333}.rte-preview{background:#fff;border:1px solid #e5e5e5;border-radius:10px;box-shadow:0 2px 6px #0000000d;padding:16px}.rte-emoji-popup{background:#fff;box-shadow:0 4px 12px #00000026;padding:10px;width:280px;grid-template-columns:repeat(7,1fr);gap:6px}.rte-emoji-popup span{font-size:22px;cursor:pointer;transition:transform .15s ease}.rte-emoji-popup span:hover{transform:scale(1.3)}.rte-inserted-image{max-width:100%;height:200px;width:fit-content;object-fit:cover;border-radius:6px;display:inline-block;vertical-align:middle;box-shadow:0 1px 4px #0000000f;transition:box-shadow .15s ease,transform .15s ease;cursor:pointer;position:relative}.rte-inserted-image:hover{box-shadow:0 4px 14px #0000001f;transform:translateY(-1px)}.rte-highlight{color:#007bff;font-weight:700;font-weight:600}.rte-active{background:#dce8ff!important;border-radius:4px!important}.rte-resize-handle{user-select:none!important;-webkit-user-select:none!important;-moz-user-select:none!important;-ms-user-select:none!important;-webkit-user-drag:none!important;-webkit-touch-callout:none!important;pointer-events:auto}.rte-editor,.rte-editor *{-webkit-user-select:text}.rte-resize-handle,.rte-resize-handle *{-webkit-user-select:none!important;user-select:none!important}.rte-preview-like{font-size:30px;border:1px solid lightgrey;padding:2px 6px;background:#e0dede;border-radius:4px}.rte-preview-device-picker{position:absolute;top:2px;right:2px;z-index:20;background:#fff;border-radius:4px;padding:4px;box-shadow:0 2px 6px #00000026}.rte-preview-placeholder{color:#00f}.rte-preview-web-wrapper{padding:12px;overflow:auto;margin-top:25px;background:#f2f3f5;margin-bottom:20px}.rte-preview-card{background:#fff;border-radius:16px;padding:16px;box-shadow:0 2px 6px #00000014;display:flex;flex-direction:column;gap:10px}.rte-preview-content{font-size:14px;line-height:1.4;color:#2f2f2f;white-space:pre-wrap;overflow:auto;scrollbar-width:none}.rte-preview-meta{font-size:12px;color:#b0b7bd}.rte-preview-footer{display:flex;align-items:center;justify-content:space-between}.rte-preview-actions{display:flex;gap:16px;opacity:.6}.rte-preview-time{font-size:12px;color:#b0b7bd}.rte-preview-mobile-overlay{inset:0;display:flex;justify-content:space-around;align-items:flex-start;padding-top:16px;z-index:10;margin-bottom:20px}.rte-preview-mobile-frame{background:#fff;border-radius:24px;box-shadow:0 0 0 8px #111,0 10px 20px #00000040;overflow:hidden;display:flex;flex-direction:column}.rte-preview-mobile-header{height:50px;background:#1da1f2;display:flex;align-items:center;justify-content:space-between;padding:0 12px}.rte-preview-logo{width:36px;height:36px;border-radius:8px;background:#fff;display:flex;align-items:center;justify-content:center;font-size:10px;font-weight:700;color:#1da1f2}.rte-preview-bell{position:relative;font-size:18px;color:#fff}.rte-preview-badge{position:absolute;top:-4px;right:-6px;background:#ff3b30;color:#fff;font-size:9px;padding:2px 4px;border-radius:10px}.rte-preview-tabs-wrapper{padding:8px;background:#f2f3f5;display:flex;justify-content:center}.rte-preview-tabs{width:70%;border-radius:24px;display:flex;border:1px solid #1da1f2}.rte-preview-tab{flex:1;text-align:center;padding:6px 0;border-radius:20px;color:#1da1f2;font-size:12px;font-weight:600}.rte-preview-tab-active{background:#1da1f2;color:#fff}.rte-preview-mobile-body{padding:0 12px 12px;overflow:auto;flex:1;background:#f2f3f5}.rte-attr-modal-backdrop{position:fixed;inset:0;background:#00000073;display:flex;align-items:center;justify-content:center;z-index:9999}.rte-attr-modal{width:fit-content;max-width:90vw;background:#fff;border-radius:12px;padding:20px 22px;box-shadow:0 20px 60px #00000040;display:flex;flex-direction:column;gap:14px;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif}.rte-attr-modal h3{margin:0;font-size:18px;font-weight:600;color:#222}.rte-attr-list{display:flex;flex-direction:column;gap:10px;max-height:260px;overflow-y:auto;padding-right:4px}.rte-attr-row{display:grid;grid-template-columns:1fr .1fr 1.2fr;gap:10px;align-items:center}.rte-attr-name{font-size:13px;color:#555;background:#f3f4f6;padding:6px 8px;border-radius:6px;font-family:monospace}.rte-attr-input{height:30px;padding:6px 8px;border-radius:6px;border:1px solid #d1d5db;font-size:13px;outline:none}.rte-attr-input:focus{border-color:#1da1f2;box-shadow:0 0 0 2px #1da1f226}.rte-attr-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:6px}.rte-attr-actions button{padding:6px 14px;border-radius:8px;border:none;cursor:pointer;font-size:13px}.rte-attr-actions button:first-child{background:#e5e7eb;color:#333}.rte-attr-actions button:last-child{background:#1da1f2;color:#fff}.rte-attr-actions button:hover{opacity:.9}.rte-table-selected{outline:2px dashed red;outline-offset:4px;animation:rte-dash 1s linear infinite}@keyframes rte-dash{to{outline-offset:6px}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ryzeup/richtexteditor",
3
- "version": "1.0.31",
3
+ "version": "1.0.33",
4
4
  "description": "A React Rich Text Editor component",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",