@ryzeup/richtexteditor 1.0.29 â 1.0.31
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.es.js +1098 -889
- package/dist/index.js +5 -5
- package/dist/index.umd.js +4 -4
- package/dist/richtexteditor.css +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";var pt=Object.defineProperty,vt=Object.defineProperties;var Et=Object.getOwnPropertyDescriptors;var Te=Object.getOwnPropertySymbols;var yt=Object.prototype.hasOwnProperty,wt=Object.prototype.propertyIsEnumerable;var Ae=(a,i,u)=>i in a?pt(a,i,{enumerable:!0,configurable:!0,writable:!0,value:u}):a[i]=u,oe=(a,i)=>{for(var u in i||(i={}))yt.call(i,u)&&Ae(a,u,i[u]);if(Te)for(var u of Te(i))wt.call(i,u)&&Ae(a,u,i[u]);return a},le=(a,i)=>vt(a,Et(i));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react"),Ct=require("react-dom");function bt(a){const i=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(i,u,m.get?m:{enumerable:!0,get:()=>a[u]})}}return i.default=a,Object.freeze(i)}const Lt=bt(r);window.React=Lt;var Oe={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Ne=r.createContext&&r.createContext(Oe),Rt=["attr","size","title"];function St(a,i){if(a==null)return{};var u=xt(a,i),m,p;if(Object.getOwnPropertySymbols){var M=Object.getOwnPropertySymbols(a);for(p=0;p<M.length;p++)m=M[p],!(i.indexOf(m)>=0)&&Object.prototype.propertyIsEnumerable.call(a,m)&&(u[m]=a[m])}return u}function xt(a,i){if(a==null)return{};var u={};for(var m in a)if(Object.prototype.hasOwnProperty.call(a,m)){if(i.indexOf(m)>=0)continue;u[m]=a[m]}return u}function J(){return J=Object.assign?Object.assign.bind():function(a){for(var i=1;i<arguments.length;i++){var u=arguments[i];for(var m in u)Object.prototype.hasOwnProperty.call(u,m)&&(a[m]=u[m])}return a},J.apply(this,arguments)}function ke(a,i){var u=Object.keys(a);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(a);i&&(m=m.filter(function(p){return Object.getOwnPropertyDescriptor(a,p).enumerable})),u.push.apply(u,m)}return u}function G(a){for(var i=1;i<arguments.length;i++){var u=arguments[i]!=null?arguments[i]:{};i%2?ke(Object(u),!0).forEach(function(m){Mt(a,m,u[m])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(u)):ke(Object(u)).forEach(function(m){Object.defineProperty(a,m,Object.getOwnPropertyDescriptor(u,m))})}return a}function Mt(a,i,u){return i=Tt(i),i in a?Object.defineProperty(a,i,{value:u,enumerable:!0,configurable:!0,writable:!0}):a[i]=u,a}function Tt(a){var i=At(a,"string");return typeof i=="symbol"?i:i+""}function At(a,i){if(typeof a!="object"||!a)return a;var u=a[Symbol.toPrimitive];if(u!==void 0){var m=u.call(a,i);if(typeof m!="object")return m;throw new TypeError("@@toPrimitive must return a primitive value.")}return(i==="string"?String:Number)(a)}function He(a){return a&&a.map((i,u)=>r.createElement(i.tag,G({key:u},i.attr),He(i.child)))}function k(a){return i=>r.createElement(Nt,J({attr:G({},a.attr)},i),He(a.child))}function Nt(a){var i=u=>{var{attr:m,size:p,title:M}=a,L=St(a,Rt),T=p||u.size||"1em",E;return u.className&&(E=u.className),a.className&&(E=(E?E+" ":"")+a.className),r.createElement("svg",J({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},u.attr,m,L,{className:E,style:G(G({color:a.color||u.color},u.style),a.style),height:T,width:T,xmlns:"http://www.w3.org/2000/svg"}),M&&r.createElement("title",null,M),a.children)};return Ne!==void 0?r.createElement(Ne.Consumer,null,u=>i(u)):i(Oe)}function kt(a){return k({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 zt(a){return k({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 Dt(a){return k({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 Ot(a){return k({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 Ht(a){return k({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 jt(a){return k({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 _t(a){return k({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 Ft(a){return k({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 Pt(a){return k({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 It(a){return k({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 qt(a){return k({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 Bt(a){return k({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 Vt(a){return k({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 Ut(a){return k({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 $t(a){return k({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 Wt(a){return k({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 Zt(a){return k({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 Xt(a){return k({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 Kt=["đ","đ","đ","đ¤Ŗ","đ","đ","đ
","đ","đ","đ","đ","đ","đ","đĸ","đ","đĄ","đ¤","đ","đ","đĨ°","đ¤Š","đ¤","đ´","đ","đŦ","đ¤¤","đļâđĢī¸","đˇ","đ¤","đ¤","đ¤ ","đ","đģ","đ","đ¤","đļ","đą","đŧ","đ¸","đĻ","đˇ","đĩ","đ°","đ¯","đĻ","đŽ","đ","đ","â","đ","đĨ","đ§","âī¸","âĄ","âī¸","đ¸","đš","đ","đ","đŠ","đ","đ","đ","đ","đ","đ","đĨ","đĨ","đ","đ","đ","đ","đļ","đĩ","đ","âŊ","đ","đ¸","đ","đšī¸","đ","đ¤","đī¸","â","đ","đ","đ","đ","đ¤","đ¤","â","đ","đ¤","đ¤","âī¸","đ","đ","đ","đ","đ¤","đ¤","đ¤","đ","đ","đ","âī¸","đ
","đ¤˛","đ","đĢļ","đ"],je=({exec:a,saveSelection:i,handleFileChange:u,handleFontSizeChange:m,handleFontFamilyChange:p,insertEmoji:M,handleLink:L,removeFormatting:T,visibleActions:E,className:x,style:C})=>{var $,q;const R=r.useRef(null),P=r.useRef(null),N=r.useRef(null),[H,j]=r.useState(!1),[D,_]=r.useState({x:0,y:0});r.useEffect(()=>{const g=b=>{!b.target.closest(".rte-emoji-popup")&&!b.target.closest("button[title='Emoji']")&&j(!1)};return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[]);const z=g=>{var B;g.preventDefault();const b=g.currentTarget.dataset.command;if(b)switch(b){case"bold":case"italic":case"underline":case"insertUnorderedList":case"insertStaticUnorderedList":case"insertOrderedList":case"insertStaticOrderedList":case"removeFormat":a(b);break;case"insertImage":{(B=R.current)==null||B.click();break}default:console.warn("Unknown command:",b)}},V=g=>{a("foreColor",g.target.value)},U=g=>{a("backColor",g.target.value)},[S,F]=r.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});return r.useEffect(()=>{const g=()=>{F({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)},[]),r.createElement("div",{className:`rte-toolbar ${x||""}`,style:C},E.bold&&r.createElement("button",{"data-command":"bold",title:"Bold",onMouseDown:z,className:S.bold?"rte-active":""},r.createElement(jt,null)),E.italic&&r.createElement("button",{"data-command":"italic",title:"Italic",onMouseDown:z,className:S.italic?"rte-active":""},r.createElement(Ft,null)),E.underline&&r.createElement("button",{"data-command":"underline",title:"Underline",onMouseDown:z,className:S.underline?"rte-active":""},r.createElement(Bt,null)),E.unorderedList&&r.createElement("button",{"data-command":"insertUnorderedList",onMouseDown:z,title:"UnorderedList",className:S.unorderedList?"rte-active":""},r.createElement(Ut,null)),E.staticUnorderedList&&r.createElement("button",{"data-command":"insertStaticUnorderedList",onMouseDown:z,title:"StaticUnorderedList",className:S.unorderedList?"rte-active":""},r.createElement(It,null)),E.orderedList&&r.createElement("button",{"data-command":"insertOrderedList",title:"OrderedList",onMouseDown:z,className:S.orderedList?"rte-active":"",style:{fontSize:"medium"}},r.createElement(Vt,null)),E.staticOrderedList&&r.createElement("button",{"data-command":"insertStaticOrderedList",title:"StaticOrderedList",onMouseDown:z,className:S.orderedList?"rte-active":""},r.createElement(Ot,null)),E.link&&r.createElement("button",{"data-command":"createLink",title:"Link",onClick:L,className:S.link?"rte-active":""},r.createElement(Pt,null)),E.removeFormat&&r.createElement("button",{"data-command":"Remove format",title:"removeFormat",onMouseDown:g=>{g.preventDefault(),i(),T()},className:S.removeFormat?"rte-active":""},r.createElement(Xt,null)),E.image&&r.createElement("button",{"data-command":"insertImage",title:"Image",onMouseDown:z,className:S.image?"rte-active":""},r.createElement(Dt,null)),r.createElement("input",{type:"file",accept:"image/*",ref:R,style:{display:"none"},onChange:u}),E.emoji&&r.createElement("div",{style:{position:"relative"}},r.createElement("button",{title:"Emoji",onMouseDown:g=>{g.preventDefault(),i();const b=g.currentTarget.getBoundingClientRect();_({x:b.left,y:b.bottom+8}),j(B=>!B)},className:S.emoji?"rte-active":""},r.createElement(qt,null)),H&&Ct.createPortal(r.createElement("div",{className:"rte-emoji-popup",style:{top:D.y,left:D.x}},Kt.map((g,b)=>r.createElement("span",{key:b,style:{fontSize:"20px",cursor:"pointer",textAlign:"center"},onMouseDown:B=>{B.preventDefault(),M(g),j(!1)}},g))),document.body)),E.color&&r.createElement("div",{style:{position:"relative"}},r.createElement("button",{title:"Text Color",onMouseDown:g=>{var b;g.preventDefault(),i(),(b=P.current)==null||b.click()},style:{display:"flex",alignItems:"center",justifyContent:"center",color:(($=P.current)==null?void 0:$.value)||"#000",fontSize:"18px"},className:S.color?"rte-active":""},r.createElement(Zt,null)),r.createElement("input",{ref:P,type:"color",defaultValue:"#000000",onChange:g=>{var b;V(g),((b=g.target.parentElement)==null?void 0:b.querySelector("button")).style.color=g.target.value},style:{position:"absolute",opacity:0,width:0,height:0,pointerEvents:"none"}})),E.highlight&&r.createElement("div",{style:{position:"relative"}},r.createElement("button",{title:"Highlight",onMouseDown:g=>{var b;g.preventDefault(),i(),(b=N.current)==null||b.click()},style:{display:"flex",alignItems:"center",justifyContent:"center",color:((q=N.current)==null?void 0:q.value)||"#000",fontSize:"18px"},className:S.highlight?"rte-active":""},r.createElement(_t,null)),r.createElement("input",{ref:N,type:"color",onChange:g=>{var b;U(g),((b=g.target.parentElement)==null?void 0:b.querySelector("button")).style.color=g.target.value},defaultValue:"#000000",style:{position:"absolute",opacity:0,width:0,height:0,pointerEvents:"none"}})),E.align&&r.createElement(r.Fragment,null,r.createElement("button",{title:"Align Left",onMouseDown:g=>g.preventDefault(),onClick:()=>a("justifyLeft"),className:S.alignLeft?"rte-active":""},r.createElement(Ht,null)),r.createElement("button",{title:"Align Center",onMouseDown:g=>g.preventDefault(),onClick:()=>a("justifyCenter"),className:S.alignCenter?"rte-active":""},r.createElement(kt,null)),r.createElement("button",{title:"Align Right",onMouseDown:g=>g.preventDefault(),onClick:()=>a("justifyRight"),className:S.alignRight?"rte-active":""},r.createElement(zt,null))),E.table&&r.createElement("button",{title:"Insert Dynamic Table",onMouseDown:g=>g.preventDefault(),onClick:()=>a("insertTable"),className:S.table?"rte-active":"",style:{fontSize:"medium"}},r.createElement($t,null)),E.table&&r.createElement("button",{title:"Insert Static Table",onMouseDown:g=>g.preventDefault(),onClick:()=>a("insertStaticTable"),className:S.table?"rte-active":"",style:{fontSize:"medium"}},r.createElement(Wt,null)),E.fontFamily&&r.createElement("select",{className:"rte-dropdown",defaultValue:"",onMouseDown:()=>i(),onChange:p},r.createElement("option",{value:"",disabled:!0},"Font Family"),r.createElement("option",{value:"Arial"},"Arial"),r.createElement("option",{value:"Georgia"},"Georgia"),r.createElement("option",{value:"Times New Roman"},"Times New Roman"),r.createElement("option",{value:"Courier New"},"Courier New"),r.createElement("option",{value:"Verdana"},"Verdana")),E.fontSize&&r.createElement("select",{className:"rte-dropdown rte-fontsize-dropdown",defaultValue:"",onMouseDown:()=>i(),onChange:m},r.createElement("option",{value:"",disabled:!0},"Font Size"),Array.from({length:16},(g,b)=>10+b).map(g=>r.createElement("option",{key:g,value:g},g,"px"))))},Yt=({show:a,position:i,filtered:u,insertMention:m,onClose:p,query:M})=>{const L=r.useRef(null),[T,E]=r.useState(0);return r.useEffect(()=>{a&&E(0)},[a]),r.useEffect(()=>{const x=C=>{L.current&&!L.current.contains(C.target)&&p()};return a&&document.addEventListener("mousedown",x),()=>{document.removeEventListener("mousedown",x)}},[a,p]),r.useEffect(()=>{if(!a)return;const x=C=>{if(!(!a||u.length===0)&&(C.key==="ArrowDown"&&(C.preventDefault(),E(R=>Math.min(R+1,u.length-1))),C.key==="ArrowUp"&&(C.preventDefault(),E(R=>Math.max(R-1,0))),C.key==="Enter")){C.preventDefault();const R=u[T];R&&m(R)}};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[a,u,T]),r.useEffect(()=>{if(!L.current)return;const C=L.current.querySelectorAll("li")[T];C&&C.scrollIntoView({block:"nearest",behavior:"smooth"})},[T]),a?r.createElement("ul",{ref:L,className:"rte-popup",style:{top:i.y,left:i.x}},u.length>0?u.map(({name:x,value:C},R)=>{const P=x.toLowerCase(),N=M.toLowerCase(),H=P.indexOf(N);let j=x;if(H!==-1&&M.length>0){const D=H+M.length;j=x.substring(0,H)+`<span class="rte-highlight">${x.substring(H,D)}</span>`+x.substring(D)}return r.createElement("li",{key:C,onMouseDown:D=>{D.preventDefault(),m({name:x,value:C})},style:{padding:"6px 12px",cursor:"pointer",fontSize:"14px",background:R===T?"#dce8ff":"white"},dangerouslySetInnerHTML:{__html:j},onMouseEnter:()=>E(R)})}):r.createElement("li",{style:{padding:"6px 12px",color:"#999"}},"No matches")):null};function ze(a){return k({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 Q(a){return k({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 Qt=({visible:a,x:i,y:u,onAction:m,onClose:p})=>{if(!a)return null;const M={top:u,left:i};return r.createElement("div",{style:M,className:"rte-table-menu",onMouseLeave:p},r.createElement("button",{onClick:()=>m("insertRowAbove")},r.createElement(Q,null)," Insert row above"),r.createElement("button",{onClick:()=>m("insertRowBelow")},r.createElement(Q,null)," Insert row below"),r.createElement("button",{onClick:()=>m("insertColLeft")},r.createElement(Q,null)," Insert col left"),r.createElement("button",{onClick:()=>m("insertColRight")},r.createElement(Q,null)," Insert col right"),r.createElement("button",{onClick:()=>m("deleteRow")},r.createElement(ze,null)," Delete row"),r.createElement("button",{onClick:()=>m("deleteCol")},r.createElement(ze,null)," Delete column"))},_e=({html:a,className:i,style:u})=>{const m=L=>{const T=L.target;if(T.tagName==="A"){L.preventDefault();const E=T.href;E&&window.open(E,"_blank","noopener,noreferrer")}},p=L=>L==="rgb(0, 0, 0)"||L==="rgba(0, 0, 0, 1)"||L==="#000"||L==="#000000"||L==="black",M=L=>{const T=document.createElement("div");T.innerHTML=L;const E=document.createTreeWalker(T,NodeFilter.SHOW_TEXT,null),x=[];for(;E.nextNode();){const C=E.currentNode;C.nodeValue&&/{{\s*[\s\S]*?\s*}}/.test(C.nodeValue)&&x.push(C)}return x.forEach(C=>{var _;const R=C.nodeValue||"",P=C.parentElement;if(!P)return;let N=P,H=!1;for(;N;){if(N.tagName==="FONT"&&N.getAttribute("color")){H=!0;break}const z=(_=N.style)==null?void 0:_.color;if(z&&!p(z)){H=!0;break}const V=window.getComputedStyle(N);if(V.color&&!p(V.color)){H=!0;break}N=N.parentElement}const j=document.createDocumentFragment();let D=0;R.replace(/{{\s*([\s\S]*?)\s*}}/g,(z,V,U)=>{if(U>D&&j.appendChild(document.createTextNode(R.slice(D,U))),H)j.appendChild(document.createTextNode(z));else{const S=document.createElement("span");S.style.color="blue",S.textContent=z,j.appendChild(S)}return D=U+z.length,z}),D<R.length&&j.appendChild(document.createTextNode(R.slice(D))),P.replaceChild(j,C)}),T.innerHTML=T.innerHTML.replace(/{{#arrayData}}/g,"").replace(/{{\/arrayData}}/g,""),T.innerHTML};return r.createElement("div",{className:`rte-preview ${i||""}`,style:u,onClick:m,dangerouslySetInnerHTML:{__html:M(a)}})},Jt=({visible:a,linkData:i,onClose:u,onInsert:m})=>{const[p,M]=r.useState(""),[L,T]=r.useState(""),[E,x]=r.useState(""),[C,R]=r.useState("_self");if(r.useEffect(()=>{a?(M(i.url||""),T(i.text||""),x(i.title||""),R(i.target||"_self")):(M(""),T(""),x(""),R("_self"))},[a,i]),!a)return null;const P=()=>{m({url:p,text:L,title:E,target:C})};return r.createElement(r.Fragment,null,r.createElement("div",{className:"rte-link-modal-overlay",onClick:u}),r.createElement("div",{className:"rte-link-modal"},r.createElement("h4",{className:"rte-link-modal__title"},p?"Edit Link":"Insert Link"),r.createElement("input",{type:"text",className:"rte-link-modal__input",placeholder:"URL",value:p,onChange:N=>M(N.target.value)}),r.createElement("input",{type:"text",className:"rte-link-modal__input",placeholder:"Text to Display",value:L,onChange:N=>T(N.target.value)}),r.createElement("input",{type:"text",className:"rte-link-modal__input",placeholder:"Title",value:E,onChange:N=>x(N.target.value)}),r.createElement("select",{className:"rte-link-modal__select",value:C,onChange:N=>R(N.target.value)},r.createElement("option",{value:"_self"},"Same tab"),r.createElement("option",{value:"_blank"},"New tab")),r.createElement("div",{className:"rte-link-modal__actions"},r.createElement("button",{className:"rte-link-modal__btn",onClick:u},"Cancel"),r.createElement("button",{className:"rte-link-modal__btn rte-link-modal__btn--ok",onClick:P},"OK"))))};function De(a){const i=new Map;return a.forEach(u=>{i.set(u.name,u.value)}),Array.from(i.entries()).map(([u,m])=>({name:u,value:m}))}const Gt=({atSuggestions:a=[],showOutput:i=!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:p={},styles:M={},handleGetHtml:L=()=>{},onChange:T=()=>{},value:E,onMentionSelect:x=()=>{},handleAddAttributes:C=()=>{}})=>{var pe,ve,Ee,ye,we,Ce,be,Le,Re,Se,xe,Me;const R=r.useRef(null),[P,N]=r.useState(E!=null&&E.length?E:" "),[H,j]=r.useState(""),[D,_]=r.useState(!1),[z,V]=r.useState({x:0,y:0}),[U,S]=r.useState([]),F=r.useRef(null),$=r.useRef(null),[q,g]=r.useState({visible:!1,x:0,y:0}),[b,B]=r.useState(!1),Y=r.useRef(null),[Fe,ce]=r.useState({url:"",text:"",title:"",target:"_self"}),Pe={bold:!0,italic:!0,underline:!0,removeFormat:!0,unorderedList:(pe=m.unorderedList)!=null?pe:!0,orderedList:(ve=m.orderedList)!=null?ve:!0,staticUnorderedList:(Ee=m.staticUnorderedList)!=null?Ee:!0,staticOrderedList:(ye=m.staticOrderedList)!=null?ye:!0,align:!0,link:(we=m.link)!=null?we:!1,image:(Ce=m.image)!=null?Ce:!1,emoji:(be=m.emoji)!=null?be:!1,table:(Le=m.table)!=null?Le:!1,color:(Re=m.color)!=null?Re:!1,fontFamily:(Se=m.fontFamily)!=null?Se:!1,fontSize:(xe=m.fontSize)!=null?xe:!1,highlight:(Me=m.fontSize)!=null?Me:!1},[Ie,ee]=r.useState(""),[ie,te]=r.useState([]),I=()=>R.current,A=()=>{const e=qe(),t=/^<div[^>]*style=["'][^"']*font-size\s*:\s*\d+px[^"']*["'][^>]*>/.test(e.trim());let n=e;t||(n=`<div style="font-size:12px">${e}</div>`),n=n.replace(/<(ul|ol)([^>]*)>[\s\S]*?<\/\1>/g,(l,v,y)=>{if(/list-type=["']static["']/.test(y)||l.includes("data-hidden-array-start")||l.includes("data-hidden-array-end"))return l;const f=`<${v}${y}>`,s='<span data-hidden-array-start="true" style="display:none">{{#arrayData}}</span>',h='<span data-hidden-array-end="true" style="display:none">{{/arrayData}}</span>',w=`</${v}>`,O=l.replace(new RegExp(`^${f}`),"").replace(new RegExp(`${w}$`),"");return`${f}${s}${O}${h}${w}`}),j(n),L==null||L(n);const o=ct(e);T(o);const d=Ke(),c=De(d);JSON.stringify(c)!==JSON.stringify(ie)&&(te(c),x(c))},qe=()=>{const e=I();if(!e)return P;const t=e.cloneNode(!0);t.querySelectorAll("table div").forEach(o=>o.remove()),t.querySelectorAll("table").forEach(o=>{o.removeAttribute("data-has-resize-handle")}),t.querySelectorAll(".rte-cell-highlight").forEach(o=>o.classList.remove("rte-cell-highlight"));let n=t.innerHTML;return n=Be(n),n},Be=e=>{const t=document.createElement("div");return t.innerHTML=e,t.querySelectorAll("tbody").forEach(n=>{n.getAttribute("table-type")==="static"||(n.innerHTML=`{{#arrayData}}${n.innerHTML}{{/arrayData}}`)}),t.innerHTML},W=()=>{const e=window.getSelection();if(!e||e.rangeCount===0)return;const t=document.getElementById("rte-editor-body");if(!t)return;const n=e.getRangeAt(0);t.contains(n.startContainer)&&(F.current=n.cloneRange())},Z=()=>{const e=window.getSelection();!e||!F.current||(e.removeAllRanges(),e.addRange(F.current))},se=(e,t)=>{const n=window.getSelection();n&&n.rangeCount>0&&(F.current=n.getRangeAt(0)),Z(),document.execCommand(e,!1,t),A()};r.useEffect(()=>{const e=I();if(!e||!E)return;const t=Ve(E);e.innerHTML=t,A()},[]);const Ve=e=>e.replace(/(<table[\s\S]*?>[\s\S]*?<\/table>)/g,t=>t.replace(/{{#arrayData}}/g,"").replace(/{{\/arrayData}}/g,""));r.useEffect(()=>()=>{document.removeEventListener("mousemove",null),document.removeEventListener("mouseup",null)},[]),r.useEffect(()=>{C&&C(e=>{Xe(e)})},[]),r.useEffect(()=>{const e=I();if(!e)return;e.querySelectorAll("table").forEach(n=>{n.hasAttribute("data-has-resize-handle")||(ae(n),n.querySelectorAll("th, td").forEach(d=>X(d)))})},[]);const de=e=>{for(;e&&e.nodeName!=="LI";)e=e.parentNode;return e},ue=(e,t)=>{var f;const n=window.getSelection();if(!(n!=null&&n.rangeCount))return;const o=n.getRangeAt(0),d=de(o.startContainer);let c,l;const v=t==="insertStaticUnorderedList"||t==="insertStaticOrderedList";if(d){let s=d.querySelector(e);s||(s=document.createElement(e),s.style.margin="0",s.style.paddingLeft="20px",d.appendChild(s)),l=s,c=document.createElement("li"),c.textContent="â",l.appendChild(c)}else{document.execCommand(e==="ul"?"insertUnorderedList":"insertOrderedList");const s=I();if(l=s==null?void 0:s.querySelector(`${e}:last-child`),!l)return;v&&l.setAttribute("list-type","static"),c=l.querySelector("li:last-child")}const y=document.createRange();y.setStart(c,0),y.collapse(!0),n.removeAllRanges(),n.addRange(y),(f=I())==null||f.focus(),A()},ne=(e,t)=>{e==="insertOrderedList"||e==="insertStaticOrderedList"?ue("ol",e):e==="insertUnorderedList"||e==="insertStaticUnorderedList"?ue("ul",e):e.startsWith("justify")?st(e):se(e,t),e==="insertTable"&&fe(),e==="insertStaticTable"&&fe("insertStaticTable")},Ue=e=>{const t=document.createElement("span");t.textContent="â",e.insertNode(t),e.setStartAfter(t),e.collapse(!0);const n=t.getBoundingClientRect();t.remove(),V({x:n.left,y:n.bottom+window.scrollY}),S(a||[]),_(!0),$.current=e.cloneRange()},$e=()=>{const e=window.getSelection();if(!e||e.rangeCount===0)return null;const t=e.anchorNode;let n=e.anchorOffset;if(!t)return null;let o=t;for(o.nodeType!==Node.TEXT_NODE&&(o.childNodes&&o.childNodes[n]?o=o.childNodes[n]:o=t.previousSibling);o;){if(o.nodeType===Node.TEXT_NODE){const d=o.textContent||"",c=o===t?n:d.length,l=d.lastIndexOf("@",c-1);if(l!==-1){const v=document.createRange();return v.setStart(o,l),v.setEnd(o,c),v}}o=o.previousSibling}return null},We=e=>{var c;const t=window.getSelection();if(!t)return;const n=$e();n?(t.removeAllRanges(),t.addRange(n)):$.current&&(t.removeAllRanges(),t.addRange($.current));const o=document.createElement("span");o.textContent=`{{${e.name}}}`,o.style.display="inline",o.setAttribute("data-mention",e.value||e.name||"");try{const l=t.rangeCount?t.getRangeAt(0):null;if(l)l.deleteContents(),l.insertNode(o);else{const f=document.createRange(),s=I();f.selectNodeContents(s),f.collapse(!1),f.insertNode(o)}const v=document.createTextNode("â");o.after(v);const y=document.createRange();y.setStartAfter(v),y.collapse(!0),t.removeAllRanges(),t.addRange(y)}catch(l){console.error("insertMention error:",l)}let d=De([...ie,e]);te(d),x(d),_(!1),(c=I())==null||c.focus(),A()},Ze=e=>{const t=I();if(!t)return;let n=null;F.current&&t.contains(F.current.startContainer)?n=F.current.cloneRange():(n=document.createRange(),n.selectNodeContents(t),n.collapse(!1));const o=window.getSelection();if(!o)return;o.removeAllRanges(),o.addRange(n);const d=document.createElement("span");d.textContent=`{{${e.name}}}`,d.style.display="inline",d.setAttribute("data-mention",e.value||e.name),n.insertNode(d);const c=document.createTextNode(" ");d.after(c);const l=document.createRange();l.setStartAfter(c),l.collapse(!0),o.removeAllRanges(),o.addRange(l),F.current=l.cloneRange(),t.focus()},Xe=e=>{e.forEach(t=>Ze(t)),te(t=>{const n=[...t,...e],o=Array.from(new Map(n.map(d=>[d.name,d])).values());return x(o),o}),A()},Ke=()=>{const e=I();if(!e)return[];const t=e.querySelectorAll("span[data-mention]"),n=[];return t.forEach(o=>{const d=o.getAttribute("data-mention")||"",l=(o.textContent||"").match(/{{(.+?)}}/);l&&n.push({name:l[1],value:d})}),n},Ye=e=>{var n,o,d;const t=e.key.toLowerCase();if((e.ctrlKey||e.metaKey)&&["b","i","u"].includes(t)&&(e.preventDefault(),ne(t==="b"?"bold":t==="i"?"italic":t==="u"?"underline":"")),e.shiftKey&&e.key==="2"&&e.preventDefault(),e.key==="Enter"){const c=window.getSelection(),l=c!=null&&c.anchorNode?de(c.anchorNode):null;if(!l)return;if(((n=l.textContent)==null?void 0:n.replace(/\u200B/g,"").trim())===""){e.preventDefault();const y=l.parentElement,f=y==null?void 0:y.closest("li");if(f){y==null||y.removeChild(l);const s=document.createElement("p");s.innerHTML="<br />",(o=f.parentElement)==null||o.insertBefore(s,f.nextSibling);const h=document.createRange();h.setStart(s,0),h.collapse(!0),c==null||c.removeAllRanges(),c==null||c.addRange(h)}else{const s=l.closest("ul, ol");if(s){const h=document.createElement("p");h.innerHTML="<br />",(d=s.parentElement)==null||d.insertBefore(h,s.nextSibling),s.removeChild(l);const w=document.createRange();w.setStart(h,0),w.collapse(!0),c==null||c.removeAllRanges(),c==null||c.addRange(w)}}A()}}if(t==="backspace"||t==="delete"){const c=window.getSelection();if(!c||c.rangeCount===0)return;const l=c.getRangeAt(0);if(l.cloneContents().querySelector("table"))return;if(l.cloneContents().querySelectorAll(".rte-resize-handle").length>0){e.preventDefault(),e.stopPropagation();return}}},Qe=e=>{if(e.data==="@"){const n=window.getSelection();if(!(n!=null&&n.rangeCount))return;const o=n.anchorNode;if(re(o))return;setTimeout(()=>{Ue(n.getRangeAt(0)),ee(""),S(a),_(!0)},0);return}if(D){setTimeout(()=>me(),0);return}},re=e=>{if(!e)return!1;let t=e.nodeType===Node.ELEMENT_NODE?e:e.parentElement;for(;t;){if(t.tagName==="TH")return!0;t=t.parentElement}return!1},me=()=>{A();const e=window.getSelection();if(!e||!e.anchorNode)return;if(re(e.anchorNode)){_(!1);return}let t=e.anchorNode.textContent||"";t=t.replace(/\u00A0/g," ");const n=t.match(/@([^\n]*)$/);if(!n){_(!1);return}const o=n[1].trim().toLowerCase();ee(o);const d=a.filter(c=>c.name.toLowerCase().includes(o));d.length>0?(S(d),_(!0)):_(!1)},Je=e=>{var o;const t=(o=e.target.files)==null?void 0:o[0];if(!t)return;const n=new FileReader;n.onload=d=>{var w;const c=(w=d.target)==null?void 0:w.result;Z();const l=window.getSelection();let v=l&&l.rangeCount?l.getRangeAt(0):null;const y=document.createElement("img");y.src=c,y.alt=t.name||"image",y.className="rte-inserted-image",y.contentEditable="true";const f=I();if(!v||!f){f==null||f.appendChild(y);const O=document.createTextNode(" ");f==null||f.appendChild(O);const K=document.createRange();K.setStartAfter(O),K.collapse(!0),l==null||l.removeAllRanges(),l==null||l.addRange(K),f==null||f.focus(),A(),e.target.value="";return}v.deleteContents(),v.insertNode(y);const s=document.createTextNode(" ");y.after(s);const h=document.createRange();h.setStartAfter(s),h.collapse(!0),l.removeAllRanges(),l.addRange(h),f.focus(),A(),e.target.value=""},n.readAsDataURL(t)},Ge=e=>{var d;Z();const t=window.getSelection();if(!(t!=null&&t.rangeCount))return;const n=t.getRangeAt(0),o=document.createTextNode(e);n.insertNode(o),n.setStartAfter(o),n.collapse(!0),t.removeAllRanges(),t.addRange(n),(d=I())==null||d.focus(),A()},fe=e=>{var s;gt(),Z();const t=document.createElement("table");t.style.borderCollapse="collapse",t.style.width="100%",t.style.border="1px solid #ccc",t.style.margin="8px 0",t.style.position="relative",t.style.textAlign="center",p.table&&t.classList.add(p.table);const n=document.createElement("thead");p.thead&&n.classList.add(p.thead);const o=document.createElement("tbody");p.tbody&&o.classList.add(p.tbody),e==="insertStaticTable"&&o.setAttribute("table-type","static");const d=document.createElement("tr");p.tr&&d.classList.add(p.tr);const c=document.createElement("tr");p.tr&&c.classList.add(p.tr);for(let h=0;h<2;h++){const w=document.createElement("th");w.textContent="",w.style.border="1px solid #999",w.style.padding="4px",w.style.position="relative",w.style.backgroundColor="lightgray",w.style.height="20px",p.th&&w.classList.add(p.th);const O=document.createElement("td");O.textContent="",O.style.border="1px solid #999",O.style.padding="4px",O.style.position="relative",O.style.backgroundColor="#fff",O.style.height="20px",p.td&&O.classList.add(p.td),X(w),X(O),d.appendChild(w),c.appendChild(O)}n.appendChild(d),o.appendChild(c),t.appendChild(n),t.appendChild(o),ae(t);const l=window.getSelection();if(!(l!=null&&l.rangeCount))return;const v=l.getRangeAt(0);v.collapse(!1),v.insertNode(t);const y=document.createElement("p");y.innerHTML="<br/>",t.after(y);const f=document.createRange();f.setStart(y,0),f.collapse(!0),l.removeAllRanges(),l.addRange(f),(s=I())==null||s.focus(),A()},ae=e=>{if(e.dataset.hasResizeHandle==="true")return;const t=document.createElement("div");Object.assign(t.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"}),t.contentEditable="false",t.dataset.hasResizeHandle="true",t.classList.add("rte-resize-handle");let n=0,o=0,d=0,c=0;t.addEventListener("mousedown",l=>{l.preventDefault(),n=l.clientX,o=l.clientY;const v=e.getBoundingClientRect();d=v.width,c=v.height;const y=s=>{const h=Math.max(100,d+(s.clientX-n)),w=Math.max(20,c+(s.clientY-o));e.style.width=`${h}px`,e.style.height=`${w}px`,A()},f=()=>{document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",f),A()};document.addEventListener("mousemove",y),document.addEventListener("mouseup",f)}),e.appendChild(t)},X=e=>{const t=document.createElement("div"),n=document.createElement("div");Object.assign(t.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"}),t.contentEditable="false",t.classList.add("rte-resize-handle"),Object.assign(n.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"}),n.contentEditable="false",n.classList.add("rte-resize-handle"),et(e,t,n),e.appendChild(t),e.appendChild(n)},et=(e,t,n)=>{let o=0,d=0,c=0,l=0;t.addEventListener("mousedown",s=>{s.preventDefault(),o=s.clientX,c=e.offsetWidth,document.addEventListener("mousemove",v),document.addEventListener("mouseup",f)}),n.addEventListener("mousedown",s=>{s.preventDefault(),d=s.clientY,l=e.offsetHeight,document.addEventListener("mousemove",y),document.addEventListener("mouseup",f)});const v=s=>{const h=c+(s.clientX-o);e.style.width=`${Math.max(30,h)}px`,A()},y=s=>{const h=l+(s.clientY-d);e.style.height=`${Math.max(20,h)}px`,A()},f=()=>{document.removeEventListener("mousemove",v),document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",f),A()}},tt=e=>{const n=e.target.closest("td, th");n&&(e.preventDefault(),document.querySelectorAll(".rte-cell-highlight").forEach(o=>o.classList.remove("rte-cell-highlight")),n.classList.add("rte-cell-highlight"),g({visible:!0,x:e.clientX,y:e.clientY,cell:n}))},ge=()=>{document.querySelectorAll(".rte-cell-highlight").forEach(e=>e.classList.remove("rte-cell-highlight"))},nt=e=>{if(!q.cell)return;const t=q.cell.closest("table"),n=q.cell.cellIndex,o=q.cell.parentElement.rowIndex,d=c=>{const l=c.tagName.toLowerCase(),v=document.createElement(l);return v.textContent="",v.style.cssText=c.style.cssText,X(v),v};switch(e){case"insertRowAbove":{const c=t.rows[o],l=t.insertRow(o);Array.from(c.cells).forEach(v=>{l.appendChild(d(v))});break}case"insertRowBelow":{const c=t.rows[o],l=t.insertRow(o+1);Array.from(c.cells).forEach(v=>{l.appendChild(d(v))});break}case"insertColLeft":{Array.from(t.rows).forEach(c=>{const l=c.cells[n];c.insertBefore(d(l),l)});break}case"insertColRight":{Array.from(t.rows).forEach(c=>{const l=c.cells[n];c.insertBefore(d(l),l.nextSibling)});break}case"deleteRow":t.rows.length>1&&t.deleteRow(o);break;case"deleteCol":Array.from(t.rows).forEach(c=>{c.cells[n]&&c.deleteCell(n)});break}A(),g(le(oe({},q),{visible:!1})),ge()},rt=()=>{W(),Y.current=F.current,ce({url:"",text:"",title:"",target:"_self"}),B(!0)},at=e=>{const t=window.getSelection();if(!t||!Y.current)return;t.removeAllRanges(),t.addRange(Y.current);let n=e.url.trim();/^https?:\/\//i.test(n)||(n="https://"+n);const o=document.createElement("a");o.href=n,o.style.cursor="pointer",o.style.outline="none",o.textContent=e.text||n,o.title=e.title,o.target=e.target,o.contentEditable="true";const d=t.getRangeAt(0);d.deleteContents(),d.insertNode(o);const c=document.createTextNode(" ");o.after(c);const l=document.createRange();l.setStartAfter(c),l.collapse(!0),t.removeAllRanges(),t.addRange(l),B(!1),A()},ot=e=>{const t=e.target;if(t.tagName==="A"){const n=t;if(e.ctrlKey||e.metaKey){window.open(n.href,"_blank","noopener,noreferrer");return}e.preventDefault();const o=document.createRange();o.selectNode(n),Y.current=o,ce({url:n.href,text:n.textContent||n.href,title:n.title,target:n.target}),B(!0)}},lt=()=>{const e=I();if(!e)return;const t=window.getSelection();if((!t||t.rangeCount===0)&&F.current){const s=window.getSelection();s==null||s.removeAllRanges(),s==null||s.addRange(F.current)}const n=window.getSelection();if(!n||n.rangeCount===0)return;const o=n.getRangeAt(0);Z(),document.execCommand("removeFormat",!1);const d=o.cloneContents(),c=document.createElement("div");c.appendChild(d);const l=document.createTreeWalker(c,NodeFilter.SHOW_ELEMENT,null),v=[];for(;l.nextNode();){const s=l.currentNode,h=s.tagName.toUpperCase(),w=s.getAttribute&&s.getAttribute("data-mention")!==null;h!=="A"&&!w&&v.push(s)}for(let s=v.length-1;s>=0;s--){const h=v[s],w=h.parentNode;if(w){for(;h.firstChild;)w.insertBefore(h.firstChild,h);w.removeChild(h)}}c.querySelectorAll("[style]").forEach(s=>s.removeAttribute("style")),o.deleteContents();const y=document.createDocumentFragment();for(;c.firstChild;)y.appendChild(c.firstChild);o.insertNode(y);const f=document.createRange();f.setStartAfter(o.endContainer.nodeType===Node.TEXT_NODE?o.endContainer:o.startContainer),f.collapse(!0),n.removeAllRanges(),n.addRange(f),e.normalize(),A()},ct=e=>{var o;let t=e;t=t.replace(/{{#arrayData\d*}}/g,""),t=t.replace(/{{\/arrayData\d*}}/g,"");const n=document.createElement("div");return n.innerHTML=t,n.querySelectorAll("br").forEach(d=>{d.replaceWith(`
|
|
2
|
-
`)}),
|
|
3
|
-
`)}),
|
|
4
|
-
`)}),((
|
|
1
|
+
"use strict";var Ct=Object.defineProperty,Lt=Object.defineProperties;var St=Object.getOwnPropertyDescriptors;var De=Object.getOwnPropertySymbols;var xt=Object.prototype.hasOwnProperty,Rt=Object.prototype.propertyIsEnumerable;var Oe=(a,c,u)=>c in a?Ct(a,c,{enumerable:!0,configurable:!0,writable:!0,value:u}):a[c]=u,ee=(a,c)=>{for(var u in c||(c={}))xt.call(c,u)&&Oe(a,u,c[u]);if(De)for(var u of De(c))Rt.call(c,u)&&Oe(a,u,c[u]);return a},te=(a,c)=>Lt(a,St(c));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react"),Nt=require("react-dom");function Mt(a){const c=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(c,u,m.get?m:{enumerable:!0,get:()=>a[u]})}}return c.default=a,Object.freeze(c)}const Tt=Mt(n);window.React=Tt;var qe={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},He=n.createContext&&n.createContext(qe),At=["attr","size","title"];function kt(a,c){if(a==null)return{};var u=zt(a,c),m,v;if(Object.getOwnPropertySymbols){var L=Object.getOwnPropertySymbols(a);for(v=0;v<L.length;v++)m=L[v],!(c.indexOf(m)>=0)&&Object.prototype.propertyIsEnumerable.call(a,m)&&(u[m]=a[m])}return u}function zt(a,c){if(a==null)return{};var u={};for(var m in a)if(Object.prototype.hasOwnProperty.call(a,m)){if(c.indexOf(m)>=0)continue;u[m]=a[m]}return u}function le(){return le=Object.assign?Object.assign.bind():function(a){for(var c=1;c<arguments.length;c++){var u=arguments[c];for(var m in u)Object.prototype.hasOwnProperty.call(u,m)&&(a[m]=u[m])}return a},le.apply(this,arguments)}function Pe(a,c){var u=Object.keys(a);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(a);c&&(m=m.filter(function(v){return Object.getOwnPropertyDescriptor(a,v).enumerable})),u.push.apply(u,m)}return u}function oe(a){for(var c=1;c<arguments.length;c++){var u=arguments[c]!=null?arguments[c]:{};c%2?Pe(Object(u),!0).forEach(function(m){Dt(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 Dt(a,c,u){return c=Ot(c),c in a?Object.defineProperty(a,c,{value:u,enumerable:!0,configurable:!0,writable:!0}):a[c]=u,a}function Ot(a){var c=Ht(a,"string");return typeof c=="symbol"?c:c+""}function Ht(a,c){if(typeof a!="object"||!a)return a;var u=a[Symbol.toPrimitive];if(u!==void 0){var m=u.call(a,c);if(typeof m!="object")return m;throw new TypeError("@@toPrimitive must return a primitive value.")}return(c==="string"?String:Number)(a)}function Be(a){return a&&a.map((c,u)=>n.createElement(c.tag,oe({key:u},c.attr),Be(c.child)))}function k(a){return c=>n.createElement(Pt,le({attr:oe({},a.attr)},c),Be(a.child))}function Pt(a){var c=u=>{var{attr:m,size:v,title:L}=a,H=kt(a,At),z=v||u.size||"1em",w;return u.className&&(w=u.className),a.className&&(w=(w?w+" ":"")+a.className),n.createElement("svg",le({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},u.attr,m,H,{className:w,style:oe(oe({color:a.color||u.color},u.style),a.style),height:z,width:z,xmlns:"http://www.w3.org/2000/svg"}),L&&n.createElement("title",null,L),a.children)};return He!==void 0?n.createElement(He.Consumer,null,u=>c(u)):c(qe)}function jt(a){return k({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 _t(a){return k({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 Ft(a){return k({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 k({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 qt(a){return k({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 Bt(a){return k({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 Vt(a){return k({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 k({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 $t(a){return k({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 Wt(a){return k({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 Xt(a){return k({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 Zt(a){return k({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 Kt(a){return k({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 Yt(a){return k({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 Qt(a){return k({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 Gt(a){return k({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 Jt(a){return k({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 en(a){return k({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 tn=["đ","đ","đ","đ¤Ŗ","đ","đ","đ
","đ","đ","đ","đ","đ","đ","đĸ","đ","đĄ","đ¤","đ","đ","đĨ°","đ¤Š","đ¤","đ´","đ","đŦ","đ¤¤","đļâđĢī¸","đˇ","đ¤","đ¤","đ¤ ","đ","đģ","đ","đ¤","đļ","đą","đŧ","đ¸","đĻ","đˇ","đĩ","đ°","đ¯","đĻ","đŽ","đ","đ","â","đ","đĨ","đ§","âī¸","âĄ","âī¸","đ¸","đš","đ","đ","đŠ","đ","đ","đ","đ","đ","đ","đĨ","đĨ","đ","đ","đ","đ","đļ","đĩ","đ","âŊ","đ","đ¸","đ","đšī¸","đ","đ¤","đī¸","â","đ","đ","đ","đ","đ¤","đ¤","â","đ","đ¤","đ¤","âī¸","đ","đ","đ","đ","đ¤","đ¤","đ¤","đ","đ","đ","âī¸","đ
","đ¤˛","đ","đĢļ","đ"],Ve=({exec:a,saveSelection:c,handleFileChange:u,handleFontSizeChange:m,handleFontFamilyChange:v,insertEmoji:L,handleLink:H,removeFormatting:z,visibleActions:w,className:x,style:R})=>{var q,X;const N=n.useRef(null),V=n.useRef(null),b=n.useRef(null),[T,P]=n.useState(!1),[_,O]=n.useState({x:0,y:0});n.useEffect(()=>{const f=y=>{!y.target.closest(".rte-emoji-popup")&&!y.target.closest("button[title='Emoji']")&&P(!1)};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[]);const F=f=>{var $;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":{($=N.current)==null||$.click();break}default:console.warn("Unknown command:",y)}},W=f=>{a("foreColor",f.target.value)},U=f=>{a("backColor",f.target.value)},[S,D]=n.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}),I=n.useRef(null),j=n.useRef(null);return n.useEffect(()=>{const f=()=>{const y=window.getSelection();if(!y||!y.anchorNode)return;let $=y.anchorNode.nodeType===Node.ELEMENT_NODE?y.anchorNode:y.anchorNode.parentElement;if(!$)return;const Y=window.getComputedStyle($),ne=Y.fontFamily.replace(/['"]/g,"").split(",")[0],ie=parseInt(Y.fontSize,10);if(I.current){const Q=Array.from(I.current.options).some(re=>re.value===ne);I.current.value=Q?ne:""}j.current&&(j.current.value=String(ie))};return document.addEventListener("selectionchange",f),()=>document.removeEventListener("selectionchange",f)},[]),n.useEffect(()=>{const f=()=>{D({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)},[]),n.createElement("div",{className:`rte-toolbar ${x||""}`,style:R},w.bold&&n.createElement("button",{"data-command":"bold",title:"Bold",onMouseDown:F,className:S.bold?"rte-active":""},n.createElement(Bt,null)),w.italic&&n.createElement("button",{"data-command":"italic",title:"Italic",onMouseDown:F,className:S.italic?"rte-active":""},n.createElement(Ut,null)),w.underline&&n.createElement("button",{"data-command":"underline",title:"Underline",onMouseDown:F,className:S.underline?"rte-active":""},n.createElement(Zt,null)),w.unorderedList&&n.createElement("button",{"data-command":"insertUnorderedList",onMouseDown:F,title:"UnorderedList",className:S.unorderedList?"rte-active":""},n.createElement(Yt,null)),w.staticUnorderedList&&n.createElement("button",{"data-command":"insertStaticUnorderedList",onMouseDown:F,title:"StaticUnorderedList",className:S.unorderedList?"rte-active":""},n.createElement(Wt,null)),w.orderedList&&n.createElement("button",{"data-command":"insertOrderedList",title:"OrderedList",onMouseDown:F,className:S.orderedList?"rte-active":"",style:{fontSize:"medium"}},n.createElement(Kt,null)),w.staticOrderedList&&n.createElement("button",{"data-command":"insertStaticOrderedList",title:"StaticOrderedList",onMouseDown:F,className:S.orderedList?"rte-active":""},n.createElement(It,null)),w.link&&n.createElement("button",{"data-command":"createLink",title:"Link",onClick:H,className:S.link?"rte-active":""},n.createElement($t,null)),w.removeFormat&&n.createElement("button",{"data-command":"Remove format",title:"removeFormat",onMouseDown:f=>{f.preventDefault(),c(),z()},className:S.removeFormat?"rte-active":""},n.createElement(en,null)),w.image&&n.createElement("button",{"data-command":"insertImage",title:"Image",onMouseDown:F,className:S.image?"rte-active":""},n.createElement(Ft,null)),n.createElement("input",{type:"file",accept:"image/*",ref:N,style:{display:"none"},onChange:u}),w.emoji&&n.createElement("div",{style:{position:"relative"}},n.createElement("button",{title:"Emoji",onMouseDown:f=>{f.preventDefault(),c();const y=f.currentTarget.getBoundingClientRect();O({x:y.left,y:y.bottom+8}),P($=>!$)},className:S.emoji?"rte-active":""},n.createElement(Xt,null)),T&&Nt.createPortal(n.createElement("div",{className:"rte-emoji-popup",style:{top:_.y,left:_.x}},tn.map((f,y)=>n.createElement("span",{key:y,style:{fontSize:"20px",cursor:"pointer",textAlign:"center"},onMouseDown:$=>{$.preventDefault(),L(f),P(!1)}},f))),document.body)),w.color&&n.createElement("div",{style:{position:"relative"}},n.createElement("button",{title:"Text Color",onMouseDown:f=>{var y;f.preventDefault(),c(),(y=V.current)==null||y.click()},style:{display:"flex",alignItems:"center",justifyContent:"center",color:((q=V.current)==null?void 0:q.value)||"#000",fontSize:"18px"},className:S.color?"rte-active":""},n.createElement(Jt,null)),n.createElement("input",{ref:V,type:"color",defaultValue:"#000000",onChange:f=>{var y;W(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&&n.createElement("div",{style:{position:"relative"}},n.createElement("button",{title:"Highlight",onMouseDown:f=>{var y;f.preventDefault(),c(),(y=b.current)==null||y.click()},style:{display:"flex",alignItems:"center",justifyContent:"center",color:((X=b.current)==null?void 0:X.value)||"#000",fontSize:"18px"},className:S.highlight?"rte-active":""},n.createElement(Vt,null)),n.createElement("input",{ref:b,type:"color",onChange:f=>{var y;U(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&&n.createElement(n.Fragment,null,n.createElement("button",{title:"Align Left",onMouseDown:f=>f.preventDefault(),onClick:()=>a("justifyLeft"),className:S.alignLeft?"rte-active":""},n.createElement(qt,null)),n.createElement("button",{title:"Align Center",onMouseDown:f=>f.preventDefault(),onClick:()=>a("justifyCenter"),className:S.alignCenter?"rte-active":""},n.createElement(jt,null)),n.createElement("button",{title:"Align Right",onMouseDown:f=>f.preventDefault(),onClick:()=>a("justifyRight"),className:S.alignRight?"rte-active":""},n.createElement(_t,null))),w.table&&n.createElement("button",{title:"Insert Dynamic Table",onMouseDown:f=>f.preventDefault(),onClick:()=>a("insertTable"),className:S.table?"rte-active":"",style:{fontSize:"medium"}},n.createElement(Qt,null)),w.table&&n.createElement("button",{title:"Insert Static Table",onMouseDown:f=>f.preventDefault(),onClick:()=>a("insertStaticTable"),className:S.table?"rte-active":"",style:{fontSize:"medium"}},n.createElement(Gt,null)),w.fontFamily&&n.createElement("select",{ref:I,className:"rte-dropdown",defaultValue:"",onMouseDown:()=>c(),onChange:v},n.createElement("option",{value:"",disabled:!0},"Font Family"),n.createElement("option",{value:"Arial"},"Arial"),n.createElement("option",{value:"Georgia"},"Georgia"),n.createElement("option",{value:"Times New Roman"},"Times New Roman"),n.createElement("option",{value:"Courier New"},"Courier New"),n.createElement("option",{value:"Verdana"},"Verdana")),w.fontSize&&n.createElement("select",{ref:j,className:"rte-dropdown rte-fontsize-dropdown",defaultValue:"",onMouseDown:()=>c(),onChange:m},n.createElement("option",{value:"",disabled:!0},"Font Size"),Array.from({length:16},(f,y)=>10+y).map(f=>n.createElement("option",{key:f,value:f},f,"px"))))},nn=({show:a,position:c,filtered:u,insertMention:m,onClose:v,query:L})=>{const H=n.useRef(null),[z,w]=n.useState(0);return n.useEffect(()=>{a&&w(0)},[a]),n.useEffect(()=>{const x=R=>{H.current&&!H.current.contains(R.target)&&v()};return a&&document.addEventListener("mousedown",x),()=>{document.removeEventListener("mousedown",x)}},[a,v]),n.useEffect(()=>{if(!a)return;const x=R=>{if(!(!a||u.length===0)&&(R.key==="ArrowDown"&&(R.preventDefault(),w(N=>Math.min(N+1,u.length-1))),R.key==="ArrowUp"&&(R.preventDefault(),w(N=>Math.max(N-1,0))),R.key==="Enter")){R.preventDefault();const N=u[z];N&&m(N)}};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[a,u,z]),n.useEffect(()=>{if(!H.current)return;const R=H.current.querySelectorAll("li")[z];R&&R.scrollIntoView({block:"nearest",behavior:"smooth"})},[z]),a?n.createElement("ul",{ref:H,className:"rte-popup",style:{top:c.y,left:c.x}},u.length>0?u.map(({name:x,value:R},N)=>{const V=x.toLowerCase(),b=L.toLowerCase(),T=V.indexOf(b);let P=x;if(T!==-1&&L.length>0){const _=T+L.length;P=x.substring(0,T)+`<span class="rte-highlight">${x.substring(T,_)}</span>`+x.substring(_)}return n.createElement("li",{key:R,onMouseDown:_=>{_.preventDefault(),m({name:x,value:R})},style:{padding:"6px 12px",cursor:"pointer",fontSize:"14px",background:N===z?"#dce8ff":"white"},dangerouslySetInnerHTML:{__html:P},onMouseEnter:()=>w(N)})}):n.createElement("li",{style:{padding:"6px 12px",color:"#999"}},"No matches")):null};function je(a){return k({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 ae(a){return k({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 rn=({visible:a,x:c,y:u,onAction:m,onClose:v})=>{if(!a)return null;const L={top:u,left:c};return n.createElement("div",{style:L,className:"rte-table-menu",onMouseLeave:v},n.createElement("button",{onClick:()=>m("insertRowAbove")},n.createElement(ae,null)," Insert row above"),n.createElement("button",{onClick:()=>m("insertRowBelow")},n.createElement(ae,null)," Insert row below"),n.createElement("button",{onClick:()=>m("insertColLeft")},n.createElement(ae,null)," Insert col left"),n.createElement("button",{onClick:()=>m("insertColRight")},n.createElement(ae,null)," Insert col right"),n.createElement("button",{onClick:()=>m("deleteRow")},n.createElement(je,null)," Delete row"),n.createElement("button",{onClick:()=>m("deleteCol")},n.createElement(je,null)," Delete column"))};function _e(a){return k({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 Fe(a){return k({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 Ue=({html:a,className:c,style:u,attributes:m,setAttributes:v})=>{const[L,H]=n.useState("web"),z={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 T=b.target;if(T.tagName==="A"){b.preventDefault();const P=T.href;P&&window.open(P,"_blank","noopener,noreferrer")}},x=b=>b==="rgb(0, 0, 0)"||b==="rgba(0, 0, 0, 1)"||b==="#000"||b==="#000000"||b==="black",R=b=>{const T=document.createElement("div");T.innerHTML=b;const P=document.createTreeWalker(T,NodeFilter.SHOW_TEXT,null),_=[];for(;P.nextNode();){const O=P.currentNode;O.nodeValue&&/{{\s*[\s\S]*?\s*}}/.test(O.nodeValue)&&_.push(O)}return _.forEach(O=>{var j;const F=O.nodeValue||"",W=O.parentElement;if(!W)return;let U=W,S=!1;for(;U;){if(U.tagName==="FONT"&&U.getAttribute("color")){S=!0;break}const q=(j=U.style)==null?void 0:j.color;if(q&&!x(q)){S=!0;break}const X=window.getComputedStyle(U);if(X.color&&!x(X.color)){S=!0;break}U=U.parentElement}const D=document.createDocumentFragment();let I=0;F.replace(/{{\s*([\s\S]*?)\s*}}/g,(q,X,f)=>{if(f>I&&D.appendChild(document.createTextNode(F.slice(I,f))),S)D.appendChild(document.createTextNode(q));else{const y=document.createElement("span");y.style.color="blue",y.textContent=q,D.appendChild(y)}return I=f+q.length,q}),I<F.length&&D.appendChild(document.createTextNode(F.slice(I))),W.replaceChild(D,O)}),T.innerHTML=T.innerHTML.replace(/{{#arrayData}}/g,"").replace(/{{\/arrayData}}/g,""),T.innerHTML},N=()=>new Date().toLocaleDateString("en-US",{month:"short",day:"2-digit",year:"numeric"}),V=()=>new Date().toLocaleString("en-US",{month:"short",day:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit",hour12:!0});return n.createElement("div",{className:`rte-preview ${c||""}`,style:te(ee({},u),{position:"relative"}),onClick:w},n.createElement("div",{className:"rte-preview-device-picker"},n.createElement("select",{value:L,onChange:b=>H(b.target.value)},Object.entries(z).map(([b,T])=>n.createElement("option",{key:b,value:b},T.label)))),L==="web"&&n.createElement("div",{className:"rte-preview-web-wrapper"},n.createElement("div",{className:"rte-preview-card"},n.createElement("div",{className:"rte-preview-content",dangerouslySetInnerHTML:{__html:R(a)}}),n.createElement("div",{className:"rte-preview-meta"},"Data updated as on Dec 14, 2025"),n.createElement("div",{className:"rte-preview-footer"},n.createElement("div",{className:"rte-preview-actions"},n.createElement(Fe,{className:"rte-preview-like"}),n.createElement(_e,{className:"rte-preview-like"})),n.createElement("div",{className:"rte-preview-time"},"Dec 26, 2025 5:57 PM")))),L!=="web"&&n.createElement("div",{className:"rte-preview-mobile-overlay"},n.createElement("div",{className:"rte-preview-mobile-frame",style:{width:z[L].width,height:z[L].height}},n.createElement("div",{className:"rte-preview-mobile-header"},n.createElement("div",{className:"rte-preview-logo"},"A"),n.createElement("div",{className:"rte-preview-bell"},"đ",n.createElement("span",{className:"rte-preview-badge"},"99+"))),n.createElement("div",{className:"rte-preview-tabs-wrapper"},n.createElement("div",{className:"rte-preview-tabs"},n.createElement("div",{className:"rte-preview-tab rte-preview-tab-active"},"My Alerts"),n.createElement("div",{className:"rte-preview-tab"},"Reportees Alerts"))),n.createElement("div",{className:"rte-preview-mobile-body"},n.createElement("div",{className:"rte-preview-card"},n.createElement("div",{className:"rte-preview-content",dangerouslySetInnerHTML:{__html:R(a)}}),n.createElement("div",{className:"rte-preview-meta"},"Data updated as on ",N()),n.createElement("div",{className:"rte-preview-footer"},n.createElement("div",{className:"rte-preview-actions"},n.createElement(Fe,{className:"rte-preview-like"}),n.createElement(_e,{className:"rte-preview-like"})),n.createElement("div",{className:"rte-preview-time"},V())))))),n.createElement("div",null,n.createElement("h3",{style:{marginBottom:10}},"Enter Attribute Values"),n.createElement("div",{className:"rte-attr-list"},Object.keys(m).map(b=>n.createElement("div",{key:b,className:"rte-attr-row"},n.createElement("div",{className:"rte-attr-name"},`{{${b}}}`),n.createElement("span",null," : "),n.createElement("input",{className:"rte-attr-input",value:m[b]||"",onChange:T=>{const P=T.target.value;v(_=>te(ee({},_),{[b]:P}))},placeholder:"Enter value"}))))))},an=({visible:a,linkData:c,onClose:u,onInsert:m})=>{const[v,L]=n.useState(""),[H,z]=n.useState(""),[w,x]=n.useState(""),[R,N]=n.useState("_self");if(n.useEffect(()=>{a?(L(c.url||""),z(c.text||""),x(c.title||""),N(c.target||"_self")):(L(""),z(""),x(""),N("_self"))},[a,c]),!a)return null;const V=()=>{m({url:v,text:H,title:w,target:R})};return n.createElement(n.Fragment,null,n.createElement("div",{className:"rte-link-modal-overlay",onClick:u}),n.createElement("div",{className:"rte-link-modal"},n.createElement("h4",{className:"rte-link-modal__title"},v?"Edit Link":"Insert Link"),n.createElement("input",{type:"text",className:"rte-link-modal__input",placeholder:"URL",value:v,onChange:b=>L(b.target.value)}),n.createElement("input",{type:"text",className:"rte-link-modal__input",placeholder:"Text to Display",value:H,onChange:b=>z(b.target.value)}),n.createElement("input",{type:"text",className:"rte-link-modal__input",placeholder:"Title",value:w,onChange:b=>x(b.target.value)}),n.createElement("select",{className:"rte-link-modal__select",value:R,onChange:b=>N(b.target.value)},n.createElement("option",{value:"_self"},"Same tab"),n.createElement("option",{value:"_blank"},"New tab")),n.createElement("div",{className:"rte-link-modal__actions"},n.createElement("button",{className:"rte-link-modal__btn",onClick:u},"Cancel"),n.createElement("button",{className:"rte-link-modal__btn rte-link-modal__btn--ok",onClick:V},"OK"))))};function Ie(a){const c=new Map;return a.forEach(u=>{c.set(u.name,u.value)}),Array.from(c.entries()).map(([u,m])=>({name:u,value:m}))}const ln=({atSuggestions:a=[],showOutput:c=!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:H=()=>{},onChange:z=()=>{},value:w,onMentionSelect:x=()=>{},handleAddAttributes:R=()=>{}})=>{var be,Ce,Le,Se,xe,Re,Ne,Me,Te,Ae,ke,ze;const N=n.useRef(null),[V,b]=n.useState(w!=null&&w.length?w:" "),[T,P]=n.useState(""),[_,O]=n.useState(!1),[F,W]=n.useState({x:0,y:0}),[U,S]=n.useState([]),D=n.useRef(null),I=n.useRef(null),[j,q]=n.useState({visible:!1,x:0,y:0}),[X,f]=n.useState(!1),y=n.useRef(null),[$,Y]=n.useState({url:"",text:"",title:"",target:"_self"}),ne={bold:!0,italic:!0,underline:!0,removeFormat:!0,unorderedList:(be=m.unorderedList)!=null?be:!0,orderedList:(Ce=m.orderedList)!=null?Ce:!0,staticUnorderedList:(Le=m.staticUnorderedList)!=null?Le:!0,staticOrderedList:(Se=m.staticOrderedList)!=null?Se:!0,align:!0,link:(xe=m.link)!=null?xe:!1,image:(Re=m.image)!=null?Re:!1,emoji:(Ne=m.emoji)!=null?Ne:!1,table:(Me=m.table)!=null?Me:!1,color:(Te=m.color)!=null?Te:!1,fontFamily:(Ae=m.fontFamily)!=null?Ae:!1,fontSize:(ke=m.fontSize)!=null?ke:!1,highlight:(ze=m.fontSize)!=null?ze:!1},[ie,Q]=n.useState(""),[re,ce]=n.useState([]),[me,he]=n.useState({}),B=()=>N.current,M=()=>{const e=$e(),t=/^<div[^>]*style=["'][^"']*font-size\s*:\s*\d+px[^"']*["'][^>]*>/.test(e.trim());let r=e;t||(r=`<div style="font-size: 12px; color: #4f5055;">${e}</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}>`,d='<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}>`,A=i.replace(new RegExp(`^${h}`),"").replace(new RegExp(`${C}$`),"");return`${h}${d}${A}${g}${C}`}),P(r),H==null||H(r);const l=ut(e);z(l);const s=Je(),o=Ie(s);JSON.stringify(o)!==JSON.stringify(re)&&(ce(o),x(o),yt(o))},$e=()=>{const e=B();if(!e)return V;const t=e.cloneNode(!0);t.querySelectorAll("table div").forEach(l=>l.remove()),t.querySelectorAll("table").forEach(l=>{l.removeAttribute("data-has-resize-handle")}),t.querySelectorAll(".rte-cell-highlight").forEach(l=>l.classList.remove("rte-cell-highlight"));let r=t.innerHTML;return r=We(r),r},We=e=>{const t=document.createElement("div");return t.innerHTML=e,t.querySelectorAll("tbody").forEach(r=>{r.getAttribute("table-type")==="static"||(r.innerHTML=`{{#arrayData}}${r.innerHTML}{{/arrayData}}`)}),t.innerHTML},Z=()=>{const e=window.getSelection();if(!e||e.rangeCount===0)return;const t=document.getElementById("rte-editor-body");if(!t)return;const r=e.getRangeAt(0);t.contains(r.startContainer)&&(D.current=r.cloneRange())},K=()=>{const e=window.getSelection();!e||!D.current||(e.removeAllRanges(),e.addRange(D.current))},fe=(e,t)=>{const r=window.getSelection();r&&r.rangeCount>0&&(D.current=r.getRangeAt(0)),K(),document.execCommand(e,!1,t),M()};n.useEffect(()=>{const e=B();if(!e||!w)return;const t=Xe(w);e.innerHTML=t,M()},[]);const Xe=e=>e.replace(/(<table[\s\S]*?>[\s\S]*?<\/table>)/g,t=>t.replace(/{{#arrayData}}/g,"").replace(/{{\/arrayData}}/g,""));n.useEffect(()=>()=>{document.removeEventListener("mousemove",null),document.removeEventListener("mouseup",null)},[]),n.useEffect(()=>{R&&R(e=>{Ge(e)})},[]),n.useEffect(()=>{const e=B();if(!e)return;e.querySelectorAll("table").forEach(r=>{r.hasAttribute("data-has-resize-handle")||(ue(r),r.querySelectorAll("th, td").forEach(s=>G(s)))})},[]);const ge=e=>{for(;e&&e.nodeName!=="LI";)e=e.parentNode;return e},pe=(e,t)=>{var h;const r=window.getSelection();if(!(r!=null&&r.rangeCount))return;const l=r.getRangeAt(0),s=ge(l.startContainer);let o,i;const p=t==="insertStaticUnorderedList"||t==="insertStaticOrderedList";if(s){let d=s.querySelector(e);d||(d=document.createElement(e),d.style.margin="0",d.style.paddingLeft="20px",s.appendChild(d)),i=d,o=document.createElement("li"),o.textContent="â",i.appendChild(o)}else{document.execCommand(e==="ul"?"insertUnorderedList":"insertOrderedList");const d=B();if(i=d==null?void 0:d.querySelector(`${e}: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=B())==null||h.focus(),M()},se=(e,t)=>{e==="insertOrderedList"||e==="insertStaticOrderedList"?pe("ol",e):e==="insertUnorderedList"||e==="insertStaticUnorderedList"?pe("ul",e):e.startsWith("justify")?ht(e):fe(e,t),e==="insertTable"&&Ee(),e==="insertStaticTable"&&Ee("insertStaticTable")},Ze=e=>{const t=document.createElement("span");t.textContent="â",e.insertNode(t),e.setStartAfter(t),e.collapse(!0);const r=t.getBoundingClientRect();t.remove(),W({x:r.left,y:r.bottom+window.scrollY}),S(a||[]),O(!0),I.current=e.cloneRange()},Ke=()=>{const e=window.getSelection();if(!e||e.rangeCount===0)return null;const t=e.anchorNode;let r=e.anchorOffset;if(!t)return null;let l=t;for(l.nodeType!==Node.TEXT_NODE&&(l.childNodes&&l.childNodes[r]?l=l.childNodes[r]:l=t.previousSibling);l;){if(l.nodeType===Node.TEXT_NODE){const s=l.textContent||"",o=l===t?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},Ye=e=>{var o;const t=window.getSelection();if(!t)return;const r=Ke();r?(t.removeAllRanges(),t.addRange(r)):I.current&&(t.removeAllRanges(),t.addRange(I.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 i=t.rangeCount?t.getRangeAt(0):null;if(i)i.deleteContents(),i.insertNode(l);else{const h=document.createRange(),d=B();h.selectNodeContents(d),h.collapse(!1),h.insertNode(l)}const p=document.createTextNode("â");l.after(p);const E=document.createRange();E.setStartAfter(p),E.collapse(!0),t.removeAllRanges(),t.addRange(E)}catch(i){console.error("insertMention error:",i)}let s=Ie([...re,e]);ce(s),x(s),O(!1),(o=B())==null||o.focus(),M()},Qe=e=>{const t=B();if(!t)return;let r=null;D.current&&t.contains(D.current.startContainer)?r=D.current.cloneRange():(r=document.createRange(),r.selectNodeContents(t),r.collapse(!1));const l=window.getSelection();if(!l)return;l.removeAllRanges(),l.addRange(r);const s=document.createElement("span");s.textContent=`{{${e.name}}}`,s.style.display="inline",s.setAttribute("data-mention",e.value||e.name),s.title=`{{${e.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),D.current=i.cloneRange(),t.focus()},Ge=e=>{e.forEach(t=>Qe(t)),ce(t=>{const r=[...t,...e],l=Array.from(new Map(r.map(s=>[s.name,s])).values());return x(l),l}),M()},Je=()=>{const e=B();if(!e)return[];const t=e.querySelectorAll("span[data-mention]"),r=[];return t.forEach(l=>{const s=l.getAttribute("data-mention")||"",i=(l.textContent||"").match(/{{(.+?)}}/);i&&r.push({name:i[1],value:s})}),r},et=e=>{var r,l,s;const t=e.key.toLowerCase();if((e.ctrlKey||e.metaKey)&&["b","i","u"].includes(t)&&(e.preventDefault(),se(t==="b"?"bold":t==="i"?"italic":t==="u"?"underline":"")),e.shiftKey&&e.key==="2"&&e.preventDefault(),e.key==="Enter"){const o=window.getSelection(),i=o!=null&&o.anchorNode?ge(o.anchorNode):null;if(!i)return;if(((r=i.textContent)==null?void 0:r.replace(/\u200B/g,"").trim())===""){e.preventDefault();const E=i.parentElement,h=E==null?void 0:E.closest("li");if(h){E==null||E.removeChild(i);const d=document.createElement("p");d.innerHTML="<br />",(l=h.parentElement)==null||l.insertBefore(d,h.nextSibling);const g=document.createRange();g.setStart(d,0),g.collapse(!0),o==null||o.removeAllRanges(),o==null||o.addRange(g)}else{const d=i.closest("ul, ol");if(d){const g=document.createElement("p");g.innerHTML="<br />",(s=d.parentElement)==null||s.insertBefore(g,d.nextSibling),d.removeChild(i);const C=document.createRange();C.setStart(g,0),C.collapse(!0),o==null||o.removeAllRanges(),o==null||o.addRange(C)}}M()}}if(t==="backspace"||t==="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){e.preventDefault(),e.stopPropagation();return}}},tt=e=>{if(e.data==="@"){const r=window.getSelection();if(!(r!=null&&r.rangeCount))return;const l=r.anchorNode;if(de(l))return;setTimeout(()=>{Ze(r.getRangeAt(0)),Q(""),S(a),O(!0)},0);return}if(_){setTimeout(()=>ve(),0);return}},de=e=>{if(!e)return!1;let t=e.nodeType===Node.ELEMENT_NODE?e:e.parentElement;for(;t;){if(t.tagName==="TH")return!0;t=t.parentElement}return!1},ve=()=>{M();const e=window.getSelection();if(!e||!e.anchorNode)return;if(de(e.anchorNode)){O(!1);return}let t=e.anchorNode.textContent||"";t=t.replace(/\u00A0/g," ");const r=t.match(/@([^\n]*)$/);if(!r){O(!1);return}const l=r[1].trim().toLowerCase();Q(l);const s=a.filter(o=>o.name.toLowerCase().includes(l));s.length>0?(S(s),O(!0)):O(!1)},nt=e=>{var l;const t=(l=e.target.files)==null?void 0:l[0];if(!t)return;const r=new FileReader;r.onload=s=>{var C;const o=(C=s.target)==null?void 0:C.result;K();const i=window.getSelection();let p=i&&i.rangeCount?i.getRangeAt(0):null;const E=document.createElement("img");E.src=o,E.alt=t.name||"image",E.className="rte-inserted-image",E.contentEditable="true";const h=B();if(!p||!h){h==null||h.appendChild(E);const A=document.createTextNode(" ");h==null||h.appendChild(A);const J=document.createRange();J.setStartAfter(A),J.collapse(!0),i==null||i.removeAllRanges(),i==null||i.addRange(J),h==null||h.focus(),M(),e.target.value="";return}p.deleteContents(),p.insertNode(E);const d=document.createTextNode(" ");E.after(d);const g=document.createRange();g.setStartAfter(d),g.collapse(!0),i.removeAllRanges(),i.addRange(g),h.focus(),M(),e.target.value=""},r.readAsDataURL(t)},rt=e=>{var s;K();const t=window.getSelection();if(!(t!=null&&t.rangeCount))return;const r=t.getRangeAt(0),l=document.createTextNode(e);r.insertNode(l),r.setStartAfter(l),r.collapse(!0),t.removeAllRanges(),t.addRange(r),(s=B())==null||s.focus(),M()},Ee=e=>{var d;Et(),K();const t=document.createElement("table");t.style.borderCollapse="collapse",t.style.width="310px",t.style.border="1px solid #ccc",t.style.margin="8px 0",t.style.position="relative",t.style.textAlign="center",v.table&&t.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 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 A=document.createElement("td");A.textContent="",A.style.border="1px solid #999",A.style.padding="4px",A.style.position="relative",A.style.backgroundColor="#fff",A.style.minHeight="20px",A.style.height="20px",A.style.whiteSpace="normal",A.style.wordBreak="break-word",A.style.overflowWrap="anywhere",A.style.lineHeight="20px",A.style.minWidth="20px",v.td&&A.classList.add(v.td),G(C),G(A),s.appendChild(C),o.appendChild(A)}r.appendChild(s),l.appendChild(o),t.appendChild(r),t.appendChild(l),ue(t);const i=window.getSelection();if(!(i!=null&&i.rangeCount))return;const p=i.getRangeAt(0);p.collapse(!1),p.insertNode(t);const E=document.createElement("p");E.innerHTML="<br/>",t.after(E);const h=document.createRange();h.setStart(E,0),h.collapse(!0),i.removeAllRanges(),i.addRange(h),(d=B())==null||d.focus(),M()},ue=e=>{if(e.dataset.hasResizeHandle==="true")return;const t=document.createElement("div");Object.assign(t.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"}),t.contentEditable="false",t.dataset.hasResizeHandle="true",t.classList.add("rte-resize-handle");let r=0,l=0,s=0,o=0;t.addEventListener("mousedown",i=>{i.preventDefault(),r=i.clientX,l=i.clientY;const p=e.getBoundingClientRect();s=p.width,o=p.height;const E=d=>{const g=Math.max(100,s+(d.clientX-r)),C=Math.max(20,o+(d.clientY-l));e.style.width=`${g}px`,e.style.height=`${C}px`,M()},h=()=>{document.removeEventListener("mousemove",E),document.removeEventListener("mouseup",h),M()};document.addEventListener("mousemove",E),document.addEventListener("mouseup",h)}),e.appendChild(t)},G=e=>{const t=document.createElement("div"),r=document.createElement("div");Object.assign(t.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"}),t.contentEditable="false",t.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"),at(e,t,r),e.appendChild(t),e.appendChild(r)},at=(e,t,r)=>{let l=0,s=0,o=0,i=0;t.addEventListener("mousedown",d=>{d.preventDefault(),l=d.clientX,o=e.offsetWidth,document.addEventListener("mousemove",p),document.addEventListener("mouseup",h)}),r.addEventListener("mousedown",d=>{d.preventDefault(),s=d.clientY,i=e.offsetHeight,document.addEventListener("mousemove",E),document.addEventListener("mouseup",h)});const p=d=>{const g=o+(d.clientX-l);e.style.width=`${Math.max(30,g)}px`,M()},E=d=>{const g=i+(d.clientY-s);e.style.height=`${Math.max(20,g)}px`,M()},h=()=>{document.removeEventListener("mousemove",p),document.removeEventListener("mousemove",E),document.removeEventListener("mouseup",h),M()}},lt=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"),q({visible:!0,x:e.clientX,y:e.clientY,cell:r}))},we=()=>{document.querySelectorAll(".rte-cell-highlight").forEach(e=>e.classList.remove("rte-cell-highlight"))},ot=e=>{if(!j.cell)return;const t=j.cell.closest("table"),r=j.cell.cellIndex,l=j.cell.parentElement.rowIndex,s=o=>{const i=o.tagName.toLowerCase(),p=document.createElement(i);return p.textContent="",p.style.cssText=o.style.cssText,G(p),p};switch(e){case"insertRowAbove":{const o=t.rows[l],i=t.insertRow(l);Array.from(o.cells).forEach(p=>{i.appendChild(s(p))});break}case"insertRowBelow":{const o=t.rows[l],i=t.insertRow(l+1);Array.from(o.cells).forEach(p=>{i.appendChild(s(p))});break}case"insertColLeft":{Array.from(t.rows).forEach(o=>{const i=o.cells[r];o.insertBefore(s(i),i)});break}case"insertColRight":{Array.from(t.rows).forEach(o=>{const i=o.cells[r];o.insertBefore(s(i),i.nextSibling)});break}case"deleteRow":t.rows.length>1&&t.deleteRow(l);break;case"deleteCol":Array.from(t.rows).forEach(o=>{o.cells[r]&&o.deleteCell(r)});break}M(),q(te(ee({},j),{visible:!1})),we()},it=()=>{Z(),y.current=D.current,Y({url:"",text:"",title:"",target:"_self"}),f(!0)},ct=e=>{const t=window.getSelection();if(!t||!y.current)return;t.removeAllRanges(),t.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 s=t.getRangeAt(0);s.deleteContents(),s.insertNode(l);const o=document.createTextNode(" ");l.after(o);const i=document.createRange();i.setStartAfter(o),i.collapse(!0),t.removeAllRanges(),t.addRange(i),f(!1),M()},st=e=>{const t=e.target;if(t.tagName==="A"){const r=t;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,Y({url:r.href,text:r.textContent||r.href,title:r.title,target:r.target}),f(!0)}},dt=()=>{const e=B();if(!e)return;const t=window.getSelection();if((!t||t.rangeCount===0)&&D.current){const d=window.getSelection();d==null||d.removeAllRanges(),d==null||d.addRange(D.current)}const r=window.getSelection();if(!r||r.rangeCount===0)return;const l=r.getRangeAt(0);K(),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 d=i.currentNode,g=d.tagName.toUpperCase(),C=d.getAttribute&&d.getAttribute("data-mention")!==null;g!=="A"&&!C&&p.push(d)}for(let d=p.length-1;d>=0;d--){const g=p[d],C=g.parentNode;if(C){for(;g.firstChild;)C.insertBefore(g.firstChild,g);C.removeChild(g)}}o.querySelectorAll("[style]").forEach(d=>d.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),e.normalize(),M()},ut=e=>{var l;let t=e;t=t.replace(/{{#arrayData\d*}}/g,""),t=t.replace(/{{\/arrayData\d*}}/g,"");const r=document.createElement("div");return r.innerHTML=t,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",`
|
|
4
|
+
`)}),((l=r.textContent)==null?void 0:l.replace(/\n{3,}/g,`
|
|
5
5
|
|
|
6
|
-
`).trim())||""};function
|
|
6
|
+
`).trim())||""};function mt(){const e=window.getSelection();if(!e||e.rangeCount===0)return[];const t=e.getRangeAt(0);if(t.collapsed){let o=t.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=t.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),t.compareBoundaryPoints(Range.END_TO_START,i)<0&&t.compareBoundaryPoints(Range.START_TO_END,i)>0})}function ht(e){const t=mt();if(t.length===0){fe(e);return}let r="left";e==="justifyCenter"&&(r="center"),e==="justifyRight"&&(r="right"),t.forEach(l=>{l.style.textAlign=r}),M()}const ft=()=>{const e=window.getSelection();if(!e||!e.anchorNode)return!1;let t=e.anchorNode.nodeType===Node.ELEMENT_NODE?e.anchorNode:e.anchorNode.parentElement;for(;t;){if(t.tagName==="TABLE")return!0;t=t.parentElement}return!1},gt=e=>{if(ft()){e.preventDefault();const h=e.clipboardData.getData("text/plain");if(!h)return;const d=window.getSelection();if(!d||!d.rangeCount)return;const g=d.getRangeAt(0);g.deleteContents();const C=h.split(/\r?\n/);C.forEach((A,J)=>{g.insertNode(document.createTextNode(A)),J<C.length-1&&g.insertNode(document.createElement("br"))}),g.collapse(!1),d.removeAllRanges(),d.addRange(g),M();return}const t=e.clipboardData.getData("text/html")||"";if(!t)return;const r=document.createElement("div");if(r.innerHTML=t,r.querySelector("img")){e.preventDefault();return}e.preventDefault();const l=document.createElement("div");l.innerHTML=t;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(d=>{const g=d;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(d=>{const g=d;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=N.current;E&&(E.querySelectorAll("table").forEach(h=>{const d=h;d.hasAttribute("data-has-resize-handle")||(ue(d),d.querySelectorAll("th, td").forEach(g=>{const C=g;C.dataset.hasResizeHandles||G(C)}))}),M())},pt=e=>{K();const t=window.getSelection();if(!t||!t.rangeCount)return;const r=t.getRangeAt(0),l=document.createElement("span");l.style.fontSize=`${e}px`,l.appendChild(r.extractContents()),r.insertNode(l);const s=document.createRange();s.setStartAfter(l),s.collapse(!0),t.removeAllRanges(),t.addRange(s),M()},vt=()=>{const e=window.getSelection();if(!e||!e.anchorNode)return null;const t=e.anchorNode;if(de(t)||t.nodeType!==Node.TEXT_NODE)return null;const r=t.textContent||"",l=e.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(t,s),i.setEnd(t,l),{range:i,query:o}},ye=()=>{const e=vt();if(!e)return;const{range:t,query:r}=e,l=document.createElement("span");l.textContent="â",t.insertNode(l);const s=l.getBoundingClientRect();l.remove(),W({x:s.left,y:s.bottom+window.scrollY}),Q(r.toLowerCase());const o=a.filter(i=>i.name.toLowerCase().includes(r.toLowerCase()));S(o),O(!0),I.current=t.cloneRange()};function Et(){const e=N.current;if(!e)return;const t=window.getSelection();if(!t||t.rangeCount>0&&e.contains(t.anchorNode))return;const r=document.createRange();r.selectNodeContents(e),r.collapse(!1),t.removeAllRanges(),t.addRange(r),D.current=r.cloneRange()}const wt=e=>{const t=e.target;if(!t||!(t.textContent||"").match(/{{([\s\S]+?)}}/)||!N.current)return;let o=t.firstChild;if((!o||o.nodeType!==Node.TEXT_NODE)&&(o=t.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 d=document.createRange();d.setStart(o,p),d.setEnd(o,E+2),h.removeAllRanges(),h.addRange(d)},yt=e=>{he(t=>{const r={};return e.forEach(l=>{var s;r[l.name]=(s=t[l.name])!=null?s:""}),r})},bt=()=>{let e=T;return Object.entries(me).forEach(([t,r])=>{if(r.trim()){const l=new RegExp(`{{\\s*${t}\\s*}}`,"g");e=e.replace(l,r)}}),e};return n.createElement("div",{className:`rte-wrapper ${(v==null?void 0:v.wrapper)||""}`,style:L.wrapper},n.createElement("div",{style:{flex:1}},n.createElement(Ve,{exec:se,saveSelection:Z,handleFileChange:nt,handleFontSizeChange:e=>pt(e.target.value),handleFontFamilyChange:e=>se("fontName",e.target.value),insertEmoji:rt,handleLink:it,removeFormatting:dt,visibleActions:ne,className:v.toolbar,style:L.toolbar}),n.createElement("div",{ref:N,id:"rte-editor-body",className:`rte-editor ${(v==null?void 0:v.editor)||""}`,style:L.editor,contentEditable:!0,suppressContentEditableWarning:!0,onPaste:gt,onKeyUp:()=>{Z(),ye()},onMouseUp:Z,onInput:()=>{ve(),Z()},onKeyDown:et,onBeforeInput:tt,onContextMenu:lt,onClick:e=>{st(e),Z(),ye()},onDoubleClick:wt}),n.createElement(nn,{show:_,position:F,filtered:U,insertMention:Ye,onClose:()=>O(!1),query:ie}),c&&n.createElement("div",{className:`rte-output ${(v==null?void 0:v.output)||""}`,style:L.output},n.createElement("h4",null,"Output HTML:"),n.createElement("p",null,T)),n.createElement(rn,{visible:j.visible,x:j.x,y:j.y,onAction:ot,onClose:()=>{q(te(ee({},j),{visible:!1})),we()}}),n.createElement(an,{visible:X,linkData:$,onClose:()=>f(!1),onInsert:ct})),u?n.createElement(Ue,{className:v.preview,style:L.preview,html:bt(),attributes:me,setAttributes:he}):null)};exports.RichTextEditor=ln;exports.RtePreview=Ue;exports.RteToolbar=Ve;
|