@ryzeup/richtexteditor 1.0.2 â 1.0.4
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 +768 -740
- package/dist/index.js +22 -0
- package/dist/index.umd.js +4 -4
- package/dist/richtexteditor.css +1 -1
- package/package.json +1 -1
package/dist/index.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";var Ke=Object.defineProperty,Ge=Object.defineProperties;var Qe=Object.getOwnPropertyDescriptors;var Le=Object.getOwnPropertySymbols;var et=Object.prototype.hasOwnProperty,tt=Object.prototype.propertyIsEnumerable;var Me=(t,s,c)=>s in t?Ke(t,s,{enumerable:!0,configurable:!0,writable:!0,value:c}):t[s]=c,ve=(t,s)=>{for(var c in s||(s={}))et.call(s,c)&&Me(t,c,s[c]);if(Le)for(var c of Le(s))tt.call(s,c)&&Me(t,c,s[c]);return t},xe=(t,s)=>Ge(t,Qe(s));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const R=require("react");var ce={exports:{}},te={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react-jsx-runtime.production.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var Ae;function nt(){if(Ae)return te;Ae=1;var t=Symbol.for("react.transitional.element"),s=Symbol.for("react.fragment");function c(d,f,w){var T=null;if(w!==void 0&&(T=""+w),f.key!==void 0&&(T=""+f.key),"key"in f){w={};for(var C in f)C!=="key"&&(w[C]=f[C])}else w=f;return f=w.ref,{$$typeof:t,type:d,key:T,ref:f!==void 0?f:null,props:w}}return te.Fragment=s,te.jsx=c,te.jsxs=c,te}var ne={};/**
|
|
10
|
+
* @license React
|
|
11
|
+
* react-jsx-runtime.development.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var Oe;function rt(){return Oe||(Oe=1,process.env.NODE_ENV!=="production"&&(function(){function t(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===oe?null:n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case A:return"Fragment";case F:return"Profiler";case U:return"StrictMode";case E:return"Suspense";case X:return"SuspenseList";case me:return"Activity"}if(typeof n=="object")switch(typeof n.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),n.$$typeof){case B:return"Portal";case W:return n.displayName||"Context";case V:return(n._context.displayName||"Context")+".Consumer";case h:var v=n.render;return n=n.displayName,n||(n=v.displayName||v.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case re:return v=n.displayName||null,v!==null?v:t(n.type)||"Memo";case J:v=n._payload,n=n._init;try{return t(n(v))}catch(_){}}return null}function s(n){return""+n}function c(n){try{s(n);var v=!1}catch(Z){v=!0}if(v){v=console;var _=v.error,L=typeof Symbol=="function"&&Symbol.toStringTag&&n[Symbol.toStringTag]||n.constructor.name||"Object";return _.call(v,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",L),s(n)}}function d(n){if(n===A)return"<>";if(typeof n=="object"&&n!==null&&n.$$typeof===J)return"<...>";try{var v=t(n);return v?"<"+v+">":"<...>"}catch(_){return"<...>"}}function f(){var n=N.A;return n===null?null:n.getOwner()}function w(){return Error("react-stack-top-frame")}function T(n){if(O.call(n,"key")){var v=Object.getOwnPropertyDescriptor(n,"key").get;if(v&&v.isReactWarning)return!1}return n.key!==void 0}function C(n,v){function _(){le||(le=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",v))}_.isReactWarning=!0,Object.defineProperty(n,"key",{get:_,configurable:!0})}function b(){var n=t(this.type);return K[n]||(K[n]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),n=this.props.ref,n!==void 0?n:null}function I(n,v,_,L,Z,Q){var k=_.ref;return n={$$typeof:q,type:n,key:v,props:_,_owner:L},(k!==void 0?k:null)!==null?Object.defineProperty(n,"ref",{enumerable:!1,get:b}):Object.defineProperty(n,"ref",{enumerable:!1,value:null}),n._store={},Object.defineProperty(n._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(n,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(n,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:Z}),Object.defineProperty(n,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:Q}),Object.freeze&&(Object.freeze(n.props),Object.freeze(n)),n}function D(n,v,_,L,Z,Q){var k=v.children;if(k!==void 0)if(L)if(ae(k)){for(L=0;L<k.length;L++)M(k[L]);Object.freeze&&Object.freeze(k)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else M(k);if(O.call(v,"key")){k=t(n);var Y=Object.keys(v).filter(function(he){return he!=="key"});L=0<Y.length?"{key: someKey, "+Y.join(": ..., ")+": ...}":"{key: someKey}",G[k+L]||(Y=0<Y.length?"{"+Y.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
18
|
+
let props = %s;
|
|
19
|
+
<%s {...props} />
|
|
20
|
+
React keys must be passed directly to JSX without using spread:
|
|
21
|
+
let props = %s;
|
|
22
|
+
<%s key={someKey} {...props} />`,L,k,Y,k),G[k+L]=!0)}if(k=null,_!==void 0&&(c(_),k=""+_),T(v)&&(c(v.key),k=""+v.key),"key"in v){_={};for(var ee in v)ee!=="key"&&(_[ee]=v[ee])}else _=v;return k&&C(_,typeof n=="function"?n.displayName||n.name||"Unknown":n),I(n,k,_,f(),Z,Q)}function M(n){H(n)?n._store&&(n._store.validated=1):typeof n=="object"&&n!==null&&n.$$typeof===J&&(n._payload.status==="fulfilled"?H(n._payload.value)&&n._payload.value._store&&(n._payload.value._store.validated=1):n._store&&(n._store.validated=1))}function H(n){return typeof n=="object"&&n!==null&&n.$$typeof===q}var j=R,q=Symbol.for("react.transitional.element"),B=Symbol.for("react.portal"),A=Symbol.for("react.fragment"),U=Symbol.for("react.strict_mode"),F=Symbol.for("react.profiler"),V=Symbol.for("react.consumer"),W=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),E=Symbol.for("react.suspense"),X=Symbol.for("react.suspense_list"),re=Symbol.for("react.memo"),J=Symbol.for("react.lazy"),me=Symbol.for("react.activity"),oe=Symbol.for("react.client.reference"),N=j.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,O=Object.prototype.hasOwnProperty,ae=Array.isArray,$=console.createTask?console.createTask:function(){return null};j={react_stack_bottom_frame:function(n){return n()}};var le,K={},se=j.react_stack_bottom_frame.bind(j,w)(),ie=$(d(w)),G={};ne.Fragment=A,ne.jsx=function(n,v,_){var L=1e4>N.recentlyCreatedOwnerStacks++;return D(n,v,_,!1,L?Error("react-stack-top-frame"):se,L?$(d(n)):ie)},ne.jsxs=function(n,v,_){var L=1e4>N.recentlyCreatedOwnerStacks++;return D(n,v,_,!0,L?Error("react-stack-top-frame"):se,L?$(d(n)):ie)}})()),ne}var ze;function ot(){return ze||(ze=1,process.env.NODE_ENV==="production"?ce.exports=nt():ce.exports=rt()),ce.exports}var a=ot(),He={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Ne=R.createContext&&R.createContext(He),at=["attr","size","title"];function lt(t,s){if(t==null)return{};var c=st(t,s),d,f;if(Object.getOwnPropertySymbols){var w=Object.getOwnPropertySymbols(t);for(f=0;f<w.length;f++)d=w[f],!(s.indexOf(d)>=0)&&Object.prototype.propertyIsEnumerable.call(t,d)&&(c[d]=t[d])}return c}function st(t,s){if(t==null)return{};var c={};for(var d in t)if(Object.prototype.hasOwnProperty.call(t,d)){if(s.indexOf(d)>=0)continue;c[d]=t[d]}return c}function de(){return de=Object.assign?Object.assign.bind():function(t){for(var s=1;s<arguments.length;s++){var c=arguments[s];for(var d in c)Object.prototype.hasOwnProperty.call(c,d)&&(t[d]=c[d])}return t},de.apply(this,arguments)}function Pe(t,s){var c=Object.keys(t);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(t);s&&(d=d.filter(function(f){return Object.getOwnPropertyDescriptor(t,f).enumerable})),c.push.apply(c,d)}return c}function fe(t){for(var s=1;s<arguments.length;s++){var c=arguments[s]!=null?arguments[s]:{};s%2?Pe(Object(c),!0).forEach(function(d){it(t,d,c[d])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(c)):Pe(Object(c)).forEach(function(d){Object.defineProperty(t,d,Object.getOwnPropertyDescriptor(c,d))})}return t}function it(t,s,c){return s=ct(s),s in t?Object.defineProperty(t,s,{value:c,enumerable:!0,configurable:!0,writable:!0}):t[s]=c,t}function ct(t){var s=ut(t,"string");return typeof s=="symbol"?s:s+""}function ut(t,s){if(typeof t!="object"||!t)return t;var c=t[Symbol.toPrimitive];if(c!==void 0){var d=c.call(t,s);if(typeof d!="object")return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return(s==="string"?String:Number)(t)}function Fe(t){return t&&t.map((s,c)=>R.createElement(s.tag,fe({key:c},s.attr),Fe(s.child)))}function z(t){return s=>R.createElement(dt,de({attr:fe({},t.attr)},s),Fe(t.child))}function dt(t){var s=c=>{var{attr:d,size:f,title:w}=t,T=lt(t,at),C=f||c.size||"1em",b;return c.className&&(b=c.className),t.className&&(b=(b?b+" ":"")+t.className),R.createElement("svg",de({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},c.attr,d,T,{className:b,style:fe(fe({color:t.color||c.color},c.style),t.style),height:C,width:C,xmlns:"http://www.w3.org/2000/svg"}),w&&R.createElement("title",null,w),t.children)};return Ne!==void 0?R.createElement(Ne.Consumer,null,c=>s(c)):s(He)}function ft(t){return z({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:[]}]})(t)}function mt(t){return z({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:[]}]})(t)}function ht(t){return z({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:[]}]})(t)}function pt(t){return z({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:[]}]})(t)}function gt(t){return z({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:[]}]})(t)}function vt(t){return z({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:[]}]})(t)}function xt(t){return z({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:[]}]})(t)}function wt(t){return z({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:[]}]})(t)}function bt(t){return z({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:[]}]})(t)}function yt(t){return z({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:[]}]})(t)}function Rt(t){return z({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:[]}]})(t)}function Et(t){return z({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M464 32H48C21.49 32 0 53.49 0 80v352c0 26.51 21.49 48 48 48h416c26.51 0 48-21.49 48-48V80c0-26.51-21.49-48-48-48zM224 416H64v-96h160v96zm0-160H64v-96h160v96zm224 160H288v-96h160v96zm0-160H288v-96h160v96z"},child:[]}]})(t)}function Ct(t){return z({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:[]}]})(t)}function jt(t){return z({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:[]}]})(t)}function St(t){return z({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:[]}]})(t)}const _t=["đ","đ","đ","đ¤Ŗ","đ","đ","đ
","đ","đ","đ","đ","đ","đ","đĸ","đ","đĄ","đ¤","đ","đ","đĨ°","đ¤Š","đ¤","đ´","đ","đŦ","đ¤¤","đļâđĢī¸","đˇ","đ¤","đ¤","đ¤ ","đ","đģ","đ","đ¤","đļ","đą","đŧ","đ¸","đĻ","đˇ","đĩ","đ°","đ¯","đĻ","đŽ","đ","đ","â","đ","đĨ","đ§","âī¸","âĄ","âī¸","đ¸","đš","đ","đ","đŠ","đ","đ","đ","đ","đ","đ","đĨ","đĨ","đ","đ","đ","đ","đļ","đĩ","đ","âŊ","đ","đ¸","đ","đšī¸","đ","đ¤","đī¸","â","đ","đ","đ","đ","đ¤","đ¤","â","đ","đ¤","đ¤","âī¸","đ","đ","đ","đ","đ¤","đ¤","đ¤","đ","đ","đ","âī¸","đ
","đ¤˛","đ","đĢļ","đ"],Ie=({exec:t,saveSelection:s,handleFileChange:c,handleFontSizeChange:d,handleFontFamilyChange:f,insertEmoji:w,handleLink:T,removeFormatting:C,visibleActions:b,className:I,style:D})=>{var V,W;const M=R.useRef(null),H=R.useRef(null),j=R.useRef(null),[q,B]=R.useState(!1);R.useEffect(()=>{const h=E=>{!E.target.closest(".rte-emoji-popup")&&!E.target.closest("button[title='Emoji']")&&B(!1)};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[]);const A=h=>{var X;h.preventDefault();const E=h.currentTarget.dataset.command;if(E)switch(E){case"bold":case"italic":case"underline":case"insertUnorderedList":case"insertOrderedList":case"removeFormat":t(E);break;case"insertImage":{(X=M.current)==null||X.click();break}default:console.warn("Unknown command:",E)}},U=h=>{t("foreColor",h.target.value)},F=h=>{t("backColor",h.target.value)};return a.jsxs("div",{className:`rte-toolbar ${I||""}`,style:D,children:[b.bold&&a.jsx("button",{"data-command":"bold",title:"Bold",onMouseDown:A,children:a.jsx(vt,{})}),b.italic&&a.jsx("button",{"data-command":"italic",title:"Italic",onMouseDown:A,children:a.jsx(wt,{})}),b.underline&&a.jsx("button",{"data-command":"underline",title:"Underline",onMouseDown:A,children:a.jsx(Ct,{})}),b.unorderedList&&a.jsx("button",{"data-command":"insertUnorderedList",onMouseDown:A,title:"UnorderedList",children:a.jsx(yt,{})}),b.orderedList&&a.jsx("button",{"data-command":"insertOrderedList",title:"OrderedList",onMouseDown:A,children:a.jsx(pt,{})}),b.link&&a.jsx("button",{"data-command":"createLink",title:"Link",onClick:T,children:a.jsx(bt,{})}),b.removeFormat&&a.jsx("button",{"data-command":"Remove format",title:"removeFormat",onMouseDown:h=>{h.preventDefault(),s(),C()},children:a.jsx(St,{})}),b.image&&a.jsx("button",{"data-command":"insertImage",title:"Image",onMouseDown:A,children:a.jsx(ht,{})}),a.jsx("input",{type:"file",accept:"image/*",ref:M,style:{display:"none"},onChange:c}),b.emoji&&a.jsxs("div",{style:{position:"relative"},children:[a.jsx("button",{title:"Emoji",onMouseDown:h=>{h.preventDefault(),s(),B(E=>!E)},children:a.jsx(Rt,{})}),q&&a.jsx("div",{className:"rte-emoji-popup",children:_t.map(h=>a.jsx("span",{style:{fontSize:"20px",cursor:"pointer",textAlign:"center"},onMouseDown:E=>{E.preventDefault(),w(h),B(!1)},children:h},h))})]}),b.color&&a.jsxs("div",{style:{position:"relative"},children:[a.jsx("button",{title:"Text Color",onMouseDown:h=>{var E;h.preventDefault(),s(),(E=H.current)==null||E.click()},style:{display:"flex",alignItems:"center",justifyContent:"center",color:((V=H.current)==null?void 0:V.value)||"#000",fontSize:"18px"},children:a.jsx(jt,{})}),a.jsx("input",{ref:H,type:"color",defaultValue:"#000000",onChange:h=>{var E;U(h),((E=h.target.parentElement)==null?void 0:E.querySelector("button")).style.color=h.target.value},style:{position:"absolute",opacity:0,width:0,height:0,pointerEvents:"none"}})]}),b.highlight&&a.jsxs("div",{style:{position:"relative"},children:[a.jsx("button",{title:"Highlight",onMouseDown:h=>{var E;h.preventDefault(),s(),(E=j.current)==null||E.click()},style:{display:"flex",alignItems:"center",justifyContent:"center",color:((W=j.current)==null?void 0:W.value)||"#000",fontSize:"18px"},children:a.jsx(xt,{})}),a.jsx("input",{ref:j,type:"color",onChange:h=>{var E;F(h),((E=h.target.parentElement)==null?void 0:E.querySelector("button")).style.color=h.target.value},defaultValue:"#000000",style:{position:"absolute",opacity:0,width:0,height:0,pointerEvents:"none"}})]}),b.align&&a.jsxs(a.Fragment,{children:[a.jsx("button",{title:"Align Left",onMouseDown:h=>h.preventDefault(),onClick:()=>t("justifyLeft"),children:a.jsx(gt,{})}),a.jsx("button",{title:"Align Center",onMouseDown:h=>h.preventDefault(),onClick:()=>t("justifyCenter"),children:a.jsx(ft,{})}),a.jsx("button",{title:"Align Right",onMouseDown:h=>h.preventDefault(),onClick:()=>t("justifyRight"),children:a.jsx(mt,{})})]}),b.table&&a.jsx("button",{title:"Insert Table",onMouseDown:h=>h.preventDefault(),onClick:()=>t("insertTable"),children:a.jsx(Et,{})}),b.fontFamily&&a.jsxs("select",{className:"rte-dropdown",defaultValue:"",onMouseDown:()=>s(),onChange:f,children:[a.jsx("option",{value:"",disabled:!0,children:"Font Family"}),a.jsx("option",{value:"Arial",children:"Arial"}),a.jsx("option",{value:"Georgia",children:"Georgia"}),a.jsx("option",{value:"Times New Roman",children:"Times New Roman"}),a.jsx("option",{value:"Courier New",children:"Courier New"}),a.jsx("option",{value:"Verdana",children:"Verdana"})]}),b.fontSize&&a.jsxs("select",{className:"rte-dropdown",defaultValue:"",onMouseDown:()=>s(),onChange:d,children:[a.jsx("option",{value:"",disabled:!0,children:"Font Size"}),a.jsx("option",{value:"2",children:"Small "}),a.jsx("option",{value:"3",children:"Normal"}),a.jsx("option",{value:"4",children:"Medium"}),a.jsx("option",{value:"5",children:"Large"})]})]})},Tt=({show:t,position:s,filtered:c,insertMention:d,onClose:f,query:w})=>{const T=R.useRef(null);return R.useEffect(()=>{const C=b=>{T.current&&!T.current.contains(b.target)&&f()};return t&&document.addEventListener("mousedown",C),()=>{document.removeEventListener("mousedown",C)}},[t,f]),t?a.jsx("ul",{ref:T,className:"rte-popup",style:{top:s.y,left:s.x},children:c.length>0?c.map(({key:C,value:b})=>{const I=C.toLowerCase(),D=w.toLowerCase(),M=I.indexOf(D);let H=C;if(M!==-1&&w.length>0){const j=M+w.length;H=C.substring(0,M)+`<span class="rte-highlight">${C.substring(M,j)}</span>`+C.substring(j)}return a.jsx("li",{onMouseDown:j=>{j.preventDefault(),d({key:C,value:b})},style:{padding:"6px 12px",cursor:"pointer",fontSize:"14px"},dangerouslySetInnerHTML:{__html:H},onMouseEnter:j=>j.currentTarget.style.background="#f0f0f0",onMouseLeave:j=>j.currentTarget.style.background="#fff"},b)}):a.jsx("li",{style:{padding:"6px 12px",color:"#999"},children:"No matches"})}):null};function De(t){return z({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:[]}]}]}]})(t)}function ue(t){return z({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:[]}]}]}]})(t)}const kt=({visible:t,x:s,y:c,onAction:d,onClose:f})=>{if(!t)return null;const w={top:c,left:s};return a.jsxs("div",{style:w,className:"rte-table-menu",onMouseLeave:f,children:[a.jsxs("button",{onClick:()=>d("insertRowAbove"),children:[a.jsx(ue,{})," Insert row above"]}),a.jsxs("button",{onClick:()=>d("insertRowBelow"),children:[a.jsx(ue,{})," Insert row below"]}),a.jsxs("button",{onClick:()=>d("insertColLeft"),children:[a.jsx(ue,{})," Insert col left"]}),a.jsxs("button",{onClick:()=>d("insertColRight"),children:[a.jsx(ue,{})," Insert col right"]}),a.jsxs("button",{onClick:()=>d("deleteRow"),children:[a.jsx(De,{})," Delete row"]}),a.jsxs("button",{onClick:()=>d("deleteCol"),children:[a.jsx(De,{})," Delete column"]})]})},Be=({html:t,className:s,style:c})=>{const d=f=>{const w=f.target;if(w.tagName==="A"){f.preventDefault();const T=w.href;T&&window.open(T,"_blank","noopener,noreferrer")}};return a.jsx("div",{className:`rte-preview ${s||""}`,style:c,onClick:d,dangerouslySetInnerHTML:{__html:t}})},Lt=({visible:t,linkData:s,onClose:c,onInsert:d})=>{const[f,w]=R.useState(""),[T,C]=R.useState(""),[b,I]=R.useState(""),[D,M]=R.useState("_self");if(R.useEffect(()=>{t?(w(s.url||""),C(s.text||""),I(s.title||""),M(s.target||"_self")):(w(""),C(""),I(""),M("_self"))},[t,s]),!t)return null;const H=()=>{d({url:f,text:T,title:b,target:D})};return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"rte-link-modal-overlay",onClick:c}),a.jsxs("div",{className:"rte-link-modal",children:[a.jsx("h4",{className:"rte-link-modal__title",children:f?"Edit Link":"Insert Link"}),a.jsx("input",{type:"text",className:"rte-link-modal__input",placeholder:"URL",value:f,onChange:j=>w(j.target.value)}),a.jsx("input",{type:"text",className:"rte-link-modal__input",placeholder:"Text to Display",value:T,onChange:j=>C(j.target.value)}),a.jsx("input",{type:"text",className:"rte-link-modal__input",placeholder:"Title",value:b,onChange:j=>I(j.target.value)}),a.jsxs("select",{className:"rte-link-modal__select",value:D,onChange:j=>M(j.target.value),children:[a.jsx("option",{value:"_self",children:"Same tab"}),a.jsx("option",{value:"_blank",children:"New tab"})]}),a.jsxs("div",{className:"rte-link-modal__actions",children:[a.jsx("button",{className:"rte-link-modal__btn",onClick:c,children:"Cancel"}),a.jsx("button",{className:"rte-link-modal__btn rte-link-modal__btn--ok",onClick:H,children:"OK"})]})]})]})},Mt=({atSuggestions:t=[],showOutput:s=!1,showPreview:c=!1,toolbarConfig:d={link:!1,image:!1,emoji:!1,table:!1,color:!1,fontFamily:!1,fontSize:!1,highlight:!1},classNames:f={},styles:w={},handleGetHtml:T=()=>{}})=>{var ye,Re,Ee,Ce,je,Se,_e,Te;const C=R.useRef(null),[b,I]=R.useState("<p>Always bet on Prime!</p>"),[D,M]=R.useState(!1),[H,j]=R.useState({x:0,y:0}),[q,B]=R.useState([]),A=R.useRef(null),U=R.useRef(null),[F,V]=R.useState({visible:!1,x:0,y:0}),[W,h]=R.useState(!1),E=R.useRef(null),[X,re]=R.useState({url:"",text:"",title:"",target:"_self"}),J={bold:!0,italic:!0,underline:!0,removeFormat:!0,unorderedList:!0,orderedList:!0,align:!0,link:(ye=d.link)!=null?ye:!1,image:(Re=d.image)!=null?Re:!1,emoji:(Ee=d.emoji)!=null?Ee:!1,table:(Ce=d.table)!=null?Ce:!1,color:(je=d.color)!=null?je:!1,fontFamily:(Se=d.fontFamily)!=null?Se:!1,fontSize:(_e=d.fontSize)!=null?_e:!1,highlight:(Te=d.fontSize)!=null?Te:!1},[me,oe]=R.useState(""),N=()=>C.current,O=()=>{var r,o;I((o=(r=N())==null?void 0:r.innerHTML)!=null?o:"");const e=be();T==null||T(e)},ae=()=>{const e=window.getSelection();e!=null&&e.rangeCount&&(A.current=e.getRangeAt(0))},$=()=>{const e=window.getSelection();e&&A.current&&(e.removeAllRanges(),e.addRange(A.current))},le=(e,r)=>{const o=window.getSelection();o&&o.rangeCount>0&&(A.current=o.getRangeAt(0)),$(),document.execCommand(e,!1,r),O()};R.useEffect(()=>{const e=N();e&&!e.innerHTML&&(e.innerHTML=b),O()},[]),R.useEffect(()=>()=>{document.removeEventListener("mousemove",null),document.removeEventListener("mouseup",null)},[]);const K=e=>{for(;e&&e.nodeName!=="LI";)e=e.parentNode;return e},se=e=>{let r=0,o=e.parentElement;for(;o;)(o.tagName==="UL"||o.tagName==="OL")&&r++,o=o.parentElement;return r},ie=e=>{const r=e.querySelector("li"),o=r?se(r):1;if(e.querySelector("[data-hidden-array-start]"))return;const l=`{{#arrayData${o>1?o:""}}}`,p=`{{/arrayData${o>1?o:""}}}`,i=document.createElement("span");i.textContent=l,i.style.display="none",i.setAttribute("data-hidden-array-start","true"),e.insertBefore(i,e.firstChild);const u=document.createElement("span");u.textContent=p,u.style.display="none",u.setAttribute("data-hidden-array-end","true"),e.appendChild(u)},G=e=>{var x;const r=window.getSelection();if(!(r!=null&&r.rangeCount))return;const o=r.getRangeAt(0),l=K(o.startContainer);let p,i;if(l){let m=l.querySelector(e);m||(m=document.createElement(e),m.style.margin="0",m.style.paddingLeft="20px",l.appendChild(m)),i=m,p=document.createElement("li"),p.textContent="â",i.appendChild(p)}else{document.execCommand(e==="ul"?"insertUnorderedList":"insertOrderedList");const m=N();if(i=m==null?void 0:m.querySelector(`${e}:last-child`),!i)return;p=i.querySelector("li:last-child")}ie(i);const u=document.createRange();u.setStart(p,0),u.collapse(!0),r.removeAllRanges(),r.addRange(u),(x=N())==null||x.focus(),O()},n=(e,r)=>{e==="insertOrderedList"?G("ol"):e==="insertUnorderedList"?G("ul"):le(e,r),e==="insertTable"&&he()},v=e=>{const r=document.createElement("span");r.textContent="â",e.insertNode(r),e.setStartAfter(r),e.collapse(!0);const o=r.getBoundingClientRect();r.remove(),j({x:o.left,y:o.bottom+window.scrollY}),B(t||[]),M(!0),U.current=e.cloneRange()},_=()=>{const e=window.getSelection();if(!e||e.rangeCount===0)return null;const r=e.anchorNode;let o=e.anchorOffset;if(!r)return null;let l=r;for(l.nodeType!==Node.TEXT_NODE&&(l.childNodes&&l.childNodes[o]?l=l.childNodes[o]:l=r.previousSibling);l;){if(l.nodeType===Node.TEXT_NODE){const p=l.textContent||"",i=l===r?o:p.length,u=p.lastIndexOf("@",i-1);if(u!==-1){const x=document.createRange();return x.setStart(l,u),x.setEnd(l,i),x}}l=l.previousSibling}return null},L=e=>{var p;const r=window.getSelection();if(!r)return;const o=_();o?(r.removeAllRanges(),r.addRange(o)):U.current&&(r.removeAllRanges(),r.addRange(U.current));const l=document.createElement("span");l.textContent=`{{${e.key}}}`,l.style.color="#007bff",l.style.display="inline",l.contentEditable="false",l.setAttribute("data-mention",e.value||e.key||"");try{const i=r.rangeCount?r.getRangeAt(0):null;if(i)i.deleteContents(),i.insertNode(l);else{const m=document.createRange(),y=N();m.selectNodeContents(y),m.collapse(!1),m.insertNode(l)}const u=document.createTextNode(" ");l.after(u);const x=document.createRange();x.setStartAfter(u),x.collapse(!0),r.removeAllRanges(),r.addRange(x)}catch(i){console.error("insertMention error:",i)}M(!1),(p=N())==null||p.focus(),O()},Z=e=>{var o,l,p;const r=e.key.toLowerCase();if((e.ctrlKey||e.metaKey)&&["b","i","u"].includes(r)&&(e.preventDefault(),n(r==="b"?"bold":r==="i"?"italic":r==="u"?"underline":"")),e.shiftKey&&e.key==="2"&&e.preventDefault(),e.key==="Enter"){const i=window.getSelection(),u=i!=null&&i.anchorNode?K(i.anchorNode):null;if(!u)return;if(((o=u.textContent)==null?void 0:o.replace(/\u200B/g,"").trim())===""){e.preventDefault();const m=u.parentElement,y=m==null?void 0:m.closest("li");if(y){m==null||m.removeChild(u);const g=document.createElement("p");g.innerHTML="<br />",(l=y.parentElement)==null||l.insertBefore(g,y.nextSibling);const S=document.createRange();S.setStart(g,0),S.collapse(!0),i==null||i.removeAllRanges(),i==null||i.addRange(S)}else{const g=u.closest("ul, ol");if(g){const S=document.createElement("p");S.innerHTML="<br />",(p=g.parentElement)==null||p.insertBefore(S,g.nextSibling),g.removeChild(u);const P=document.createRange();P.setStart(S,0),P.collapse(!0),i==null||i.removeAllRanges(),i==null||i.addRange(P)}}O()}}},Q=e=>{if(e.data==="@"){const o=window.getSelection();if(!(o!=null&&o.rangeCount))return;setTimeout(()=>{v(o.getRangeAt(0)),oe(""),B(t),M(!0)},0);return}if(D){setTimeout(()=>k(),0);return}},k=()=>{if(O(),!D)return;const e=window.getSelection();if(!e||!e.anchorNode)return;const o=(e.anchorNode.textContent||"").match(/@([a-zA-Z0-9_]*)$/);if(!o){M(!1);return}const l=o[1].toLowerCase();oe(l);const p=t.filter(i=>i.key.toLowerCase().includes(l));B(p)},Y=e=>{var l;const r=(l=e.target.files)==null?void 0:l[0];if(!r)return;const o=new FileReader;o.onload=p=>{var P;const i=(P=p.target)==null?void 0:P.result;$();const u=window.getSelection();let x=u&&u.rangeCount?u.getRangeAt(0):null;const m=document.createElement("img");m.src=i,m.alt=r.name||"image",m.className="rte-inserted-image",m.contentEditable="true";const y=N();if(!x||!y){y==null||y.appendChild(m);const ke=document.createTextNode(" ");y==null||y.appendChild(ke);const ge=document.createRange();ge.setStartAfter(ke),ge.collapse(!0),u==null||u.removeAllRanges(),u==null||u.addRange(ge),y==null||y.focus(),O(),e.target.value="";return}x.deleteContents(),x.insertNode(m);const g=document.createTextNode(" ");m.after(g);const S=document.createRange();S.setStartAfter(g),S.collapse(!0),u.removeAllRanges(),u.addRange(S),y.focus(),O(),e.target.value=""},o.readAsDataURL(r)},ee=e=>{var p;$();const r=window.getSelection();if(!(r!=null&&r.rangeCount))return;const o=r.getRangeAt(0),l=document.createTextNode(e);o.insertNode(l),o.setStartAfter(l),o.collapse(!0),r.removeAllRanges(),r.addRange(o),(p=N())==null||p.focus(),O()},he=()=>{$();const e=document.createElement("table");e.style.borderCollapse="collapse",e.style.width="100%",e.style.border="1px solid #ccc",e.style.margin="8px 0",e.style.position="relative";const r=document.createElement("thead"),o=document.createElement("tbody"),l=document.createElement("tr"),p=document.createElement("tr");for(let x=0;x<2;x++){const m=document.createElement("th");m.textContent=`Header ${x+1}`,m.style.border="1px solid #999",m.style.padding="8px",m.style.position="relative";const y=document.createElement("td");y.textContent=`Row 1 Col ${x+1}`,y.style.border="1px solid #999",y.style.padding="8px",y.style.position="relative",pe(m),pe(y),l.appendChild(m),p.appendChild(y)}r.appendChild(l),o.appendChild(p),e.appendChild(r),e.appendChild(o),qe(e),$e(e);const i=window.getSelection();if(!(i!=null&&i.rangeCount))return;i.getRangeAt(0).insertNode(e),O()},$e=e=>{const r=document.createElement("div");Object.assign(r.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"});let o=0,l=0,p=0,i=0;r.addEventListener("mousedown",u=>{u.preventDefault(),o=u.clientX,l=u.clientY;const x=e.getBoundingClientRect();p=x.width,i=x.height;const m=g=>{const S=Math.max(100,p+(g.clientX-o)),P=Math.max(60,i+(g.clientY-l));e.style.width=`${S}px`,e.style.height=`${P}px`,O()},y=()=>{document.removeEventListener("mousemove",m),document.removeEventListener("mouseup",y),O()};document.addEventListener("mousemove",m),document.addEventListener("mouseup",y)}),e.appendChild(r)},pe=e=>{const r=document.createElement("div"),o=document.createElement("div");Object.assign(r.style,{position:"absolute",right:"0",top:"0",width:"6px",height:"100%",cursor:"col-resize",background:"rgba(0,0,0,0.15)",zIndex:"10"}),Object.assign(o.style,{position:"absolute",bottom:"0",left:"0",width:"100%",height:"6px",cursor:"row-resize",background:"rgba(0,0,0,0.15)",zIndex:"10"}),Ve(e,r,o),e.appendChild(r),e.appendChild(o)},Ve=(e,r,o)=>{let l=0,p=0,i=0,u=0;r.addEventListener("mousedown",g=>{g.preventDefault(),l=g.clientX,i=e.offsetWidth,document.addEventListener("mousemove",x),document.addEventListener("mouseup",y)}),o.addEventListener("mousedown",g=>{g.preventDefault(),p=g.clientY,u=e.offsetHeight,document.addEventListener("mousemove",m),document.addEventListener("mouseup",y)});const x=g=>{const S=i+(g.clientX-l);e.style.width=`${Math.max(30,S)}px`},m=g=>{const S=u+(g.clientY-p);e.style.height=`${Math.max(20,S)}px`},y=()=>{document.removeEventListener("mousemove",x),document.removeEventListener("mousemove",m),document.removeEventListener("mouseup",y)}},Ye=e=>{const o=e.target.closest("td, th");o&&(e.preventDefault(),document.querySelectorAll(".rte-cell-highlight").forEach(l=>l.classList.remove("rte-cell-highlight")),o.classList.add("rte-cell-highlight"),V({visible:!0,x:e.clientX,y:e.clientY,cell:o}))},we=()=>{document.querySelectorAll(".rte-cell-highlight").forEach(e=>e.classList.remove("rte-cell-highlight"))},Ue=e=>{if(!F.cell)return;const r=F.cell.closest("table"),o=F.cell.cellIndex,l=F.cell.parentElement.rowIndex,p=i=>{const u=i.tagName.toLowerCase(),x=document.createElement(u);return x.textContent=i.textContent||"",x.style.cssText=i.style.cssText,pe(x),x};switch(e){case"insertRowAbove":{const i=r.rows[l],u=r.insertRow(l);Array.from(i.cells).forEach(x=>{u.appendChild(p(x))});break}case"insertRowBelow":{const i=r.rows[l],u=r.insertRow(l+1);Array.from(i.cells).forEach(x=>{u.appendChild(p(x))});break}case"insertColLeft":{Array.from(r.rows).forEach(i=>{const u=i.cells[o];i.insertBefore(p(u),u)});break}case"insertColRight":{Array.from(r.rows).forEach(i=>{const u=i.cells[o];i.insertBefore(p(u),u.nextSibling)});break}case"deleteRow":r.rows.length>1&&r.deleteRow(l);break;case"deleteCol":Array.from(r.rows).forEach(i=>{i.cells[o]&&i.deleteCell(o)});break}O(),V(xe(ve({},F),{visible:!1})),we()},qe=e=>{const r=e.querySelector("tbody");if(!r||r.querySelector("[data-hidden-table-start]"))return;const o=document.createElement("span");o.textContent="{{#tableData}}",o.style.display="none",o.setAttribute("data-hidden-table-start","true"),r.insertBefore(o,r.firstChild);const l=document.createElement("span");l.textContent="{{/tableData}}",l.style.display="none",l.setAttribute("data-hidden-table-end","true"),r.appendChild(l)},be=()=>{const e=N();if(!e)return b;const r=e.cloneNode(!0);return r.querySelectorAll(".rte-cell-highlight").forEach(o=>{o.classList.remove("rte-cell-highlight")}),r.querySelectorAll("div").forEach(o=>{(o.style.cursor==="col-resize"||o.style.cursor==="row-resize"||o.style.cursor==="nwse-resize")&&o.remove()}),r.innerHTML},We=()=>{ae(),E.current=A.current,re({url:"",text:"",title:"",target:"_self"}),h(!0)},Xe=e=>{const r=window.getSelection();if(!r||!E.current)return;r.removeAllRanges(),r.addRange(E.current);let o=e.url.trim();/^https?:\/\//i.test(o)||(o="https://"+o);const l=document.createElement("a");l.href=o,l.style.cursor="pointer",l.style.outline="none",l.textContent=e.text||o,l.title=e.title,l.target=e.target,l.contentEditable="true";const p=r.getRangeAt(0);p.deleteContents(),p.insertNode(l);const i=document.createTextNode(" ");l.after(i);const u=document.createRange();u.setStartAfter(i),u.collapse(!0),r.removeAllRanges(),r.addRange(u),h(!1),O()},Ze=e=>{const r=e.target;if(r.tagName==="A"){const o=r;if(e.ctrlKey||e.metaKey){window.open(o.href,"_blank","noopener,noreferrer");return}e.preventDefault();const l=document.createRange();l.selectNode(o),E.current=l,re({url:o.href,text:o.textContent||o.href,title:o.title,target:o.target}),h(!0)}},Je=()=>{const e=N();if(!e)return;const r=window.getSelection();if((!r||r.rangeCount===0)&&A.current){const g=window.getSelection();g==null||g.removeAllRanges(),g==null||g.addRange(A.current)}const o=window.getSelection();if(!o||o.rangeCount===0)return;const l=o.getRangeAt(0);$(),document.execCommand("removeFormat",!1);const p=l.cloneContents(),i=document.createElement("div");i.appendChild(p);const u=document.createTreeWalker(i,NodeFilter.SHOW_ELEMENT,null),x=[];for(;u.nextNode();){const g=u.currentNode,S=g.tagName.toUpperCase(),P=g.getAttribute&&g.getAttribute("data-mention")!==null;S!=="A"&&!P&&x.push(g)}for(let g=x.length-1;g>=0;g--){const S=x[g],P=S.parentNode;if(P){for(;S.firstChild;)P.insertBefore(S.firstChild,S);P.removeChild(S)}}i.querySelectorAll("[style]").forEach(g=>g.removeAttribute("style")),l.deleteContents();const m=document.createDocumentFragment();for(;i.firstChild;)m.appendChild(i.firstChild);l.insertNode(m);const y=document.createRange();y.setStartAfter(l.endContainer.nodeType===Node.TEXT_NODE?l.endContainer:l.startContainer),y.collapse(!0),o.removeAllRanges(),o.addRange(y),e.normalize(),O()};return a.jsxs("div",{className:`rte-wrapper ${(f==null?void 0:f.wrapper)||""}`,style:w.wrapper,children:[a.jsxs("div",{style:{flex:1},children:[a.jsx(Ie,{exec:n,saveSelection:ae,handleFileChange:Y,handleFontSizeChange:e=>n("fontSize",e.target.value),handleFontFamilyChange:e=>n("fontName",e.target.value),insertEmoji:ee,handleLink:We,removeFormatting:Je,visibleActions:J,className:f.toolbar,style:w.toolbar}),a.jsx("div",{ref:C,className:`rte-editor ${(f==null?void 0:f.editor)||""}`,style:w.editor,contentEditable:!0,suppressContentEditableWarning:!0,onInput:k,onKeyDown:Z,onBeforeInput:Q,onContextMenu:Ye,onClick:Ze}),a.jsx(Tt,{show:D,position:H,filtered:q,insertMention:L,onClose:()=>M(!1),query:me}),s&&a.jsxs("div",{className:`rte-output ${(f==null?void 0:f.output)||""}`,style:w.output,children:[a.jsx("h4",{children:"Output HTML:"}),a.jsx("p",{children:b})]}),a.jsx(kt,{visible:F.visible,x:F.x,y:F.y,onAction:Ue,onClose:()=>{V(xe(ve({},F),{visible:!1})),we()}}),a.jsx(Lt,{visible:W,linkData:X,onClose:()=>h(!1),onInsert:Xe})]}),c?a.jsx(Be,{className:f.preview,style:w.preview,html:be()}):null]})};exports.RichTextEditor=Mt;exports.RtePreview=Be;exports.RteToolbar=Ie;
|
package/dist/index.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(A,f){typeof exports=="object"&&typeof module!="undefined"?f(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],f):(A=typeof globalThis!="undefined"?globalThis:A||self,f(A.RichTextEditor={},A.React))})(this,(function(A,f){"use strict";var _t=Object.defineProperty,kt=Object.defineProperties;var Lt=Object.getOwnPropertyDescriptors;var Be=Object.getOwnPropertySymbols;var Mt=Object.prototype.hasOwnProperty,At=Object.prototype.propertyIsEnumerable;var $e=(A,f,P)=>f in A?_t(A,f,{enumerable:!0,configurable:!0,writable:!0,value:P}):A[f]=P,xe=(A,f)=>{for(var P in f||(f={}))Mt.call(f,P)&&$e(A,P,f[P]);if(Be)for(var P of Be(f))At.call(f,P)&&$e(A,P,f[P]);return A},we=(A,f)=>kt(A,Lt(f));var P={exports:{}},G={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var
|
|
9
|
+
*/var be;function Ve(){if(be)return G;be=1;var t=Symbol.for("react.transitional.element"),i=Symbol.for("react.fragment");function d(u,m,b){var _=null;if(b!==void 0&&(_=""+b),m.key!==void 0&&(_=""+m.key),"key"in m){b={};for(var j in m)j!=="key"&&(b[j]=m[j])}else b=m;return m=b.ref,{$$typeof:t,type:u,key:_,ref:m!==void 0?m:null,props:b}}return G.Fragment=i,G.jsx=d,G.jsxs=d,G}var Q={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var
|
|
17
|
+
*/var ye;function Ye(){return ye||(ye=1,process.env.NODE_ENV!=="production"&&(function(){function t(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===ce?null:n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case O:return"Fragment";case B:return"Profiler";case W:return"StrictMode";case C:return"Suspense";case J:return"SuspenseList";case he:return"Activity"}if(typeof n=="object")switch(typeof n.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),n.$$typeof){case V:return"Portal";case Z:return n.displayName||"Context";case U:return(n._context.displayName||"Context")+".Consumer";case p:var x=n.render;return n=n.displayName,n||(n=x.displayName||x.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case ie:return x=n.displayName||null,x!==null?x:t(n.type)||"Memo";case ee:x=n._payload,n=n._init;try{return t(n(x))}catch(T){}}return null}function i(n){return""+n}function d(n){try{i(n);var x=!1}catch(K){x=!0}if(x){x=console;var T=x.error,L=typeof Symbol=="function"&&Symbol.toStringTag&&n[Symbol.toStringTag]||n.constructor.name||"Object";return T.call(x,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",L),i(n)}}function u(n){if(n===O)return"<>";if(typeof n=="object"&&n!==null&&n.$$typeof===ee)return"<...>";try{var x=t(n);return x?"<"+x+">":"<...>"}catch(T){return"<...>"}}function m(){var n=D.A;return n===null?null:n.getOwner()}function b(){return Error("react-stack-top-frame")}function _(n){if(z.call(n,"key")){var x=Object.getOwnPropertyDescriptor(n,"key").get;if(x&&x.isReactWarning)return!1}return n.key!==void 0}function j(n,x){function T(){de||(de=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",x))}T.isReactWarning=!0,Object.defineProperty(n,"key",{get:T,configurable:!0})}function y(){var n=t(this.type);return te[n]||(te[n]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),n=this.props.ref,n!==void 0?n:null}function $(n,x,T,L,K,re){var k=T.ref;return n={$$typeof:X,type:n,key:x,props:T,_owner:L},(k!==void 0?k:null)!==null?Object.defineProperty(n,"ref",{enumerable:!1,get:y}):Object.defineProperty(n,"ref",{enumerable:!1,value:null}),n._store={},Object.defineProperty(n._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(n,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(n,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:K}),Object.defineProperty(n,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:re}),Object.freeze&&(Object.freeze(n.props),Object.freeze(n)),n}function F(n,x,T,L,K,re){var k=x.children;if(k!==void 0)if(L)if(ue(k)){for(L=0;L<k.length;L++)M(k[L]);Object.freeze&&Object.freeze(k)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else M(k);if(z.call(x,"key")){k=t(n);var q=Object.keys(x).filter(function(pe){return pe!=="key"});L=0<q.length?"{key: someKey, "+q.join(": ..., ")+": ...}":"{key: someKey}",ne[k+L]||(q=0<q.length?"{"+q.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
18
18
|
let props = %s;
|
|
19
19
|
<%s {...props} />
|
|
20
20
|
React keys must be passed directly to JSX without using spread:
|
|
21
21
|
let props = %s;
|
|
22
|
-
<%s key={someKey} {...props} />`,T,S,Y,S),ee[S+T]=!0)}if(S=null,j!==void 0&&(u(j),S=""+j),L(p)&&(u(p.key),S=""+p.key),"key"in p){j={};for(var ne in p)ne!=="key"&&(j[ne]=p[ne])}else j=p;return S&&E(j,typeof n=="function"?n.displayName||n.name||"Unknown":n),F(n,S,j,h(),G,te)}function _(n){D(n)?n._store&&(n._store.validated=1):typeof n=="object"&&n!==null&&n.$$typeof===K&&(n._payload.status==="fulfilled"?D(n._payload.value)&&n._payload.value._store&&(n._payload.value._store.validated=1):n._store&&(n._store.validated=1))}function D(n){return typeof n=="object"&&n!==null&&n.$$typeof===q}var C=v,q=Symbol.for("react.transitional.element"),$=Symbol.for("react.portal"),k=Symbol.for("react.fragment"),U=Symbol.for("react.strict_mode"),H=Symbol.for("react.profiler"),m=Symbol.for("react.consumer"),O=Symbol.for("react.context"),W=Symbol.for("react.forward_ref"),X=Symbol.for("react.suspense"),me=Symbol.for("react.suspense_list"),se=Symbol.for("react.memo"),K=Symbol.for("react.lazy"),he=Symbol.for("react.activity"),ie=Symbol.for("react.client.reference"),z=C.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,N=Object.prototype.hasOwnProperty,ce=Array.isArray,V=console.createTask?console.createTask:function(){return null};C={react_stack_bottom_frame:function(n){return n()}};var ue,Q={},de=C.react_stack_bottom_frame.bind(C,x)(),fe=V(c(x)),ee={};J.Fragment=k,J.jsx=function(n,p,j){var T=1e4>z.recentlyCreatedOwnerStacks++;return P(n,p,j,!1,T?Error("react-stack-top-frame"):de,T?V(c(n)):fe)},J.jsxs=function(n,p,j){var T=1e4>z.recentlyCreatedOwnerStacks++;return P(n,p,j,!0,T?Error("react-stack-top-frame"):de,T?V(c(n)):fe)}})()),J}var we;function Ne(){return we||(we=1,process.env.NODE_ENV==="production"?re.exports=_e():re.exports=ke()),re.exports}var a=Ne(),be={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},ye=v.createContext&&v.createContext(be),Me=["attr","size","title"];function Ae(t,s){if(t==null)return{};var u=Oe(t,s),c,h;if(Object.getOwnPropertySymbols){var x=Object.getOwnPropertySymbols(t);for(h=0;h<x.length;h++)c=x[h],!(s.indexOf(c)>=0)&&Object.prototype.propertyIsEnumerable.call(t,c)&&(u[c]=t[c])}return u}function Oe(t,s){if(t==null)return{};var u={};for(var c in t)if(Object.prototype.hasOwnProperty.call(t,c)){if(s.indexOf(c)>=0)continue;u[c]=t[c]}return u}function oe(){return oe=Object.assign?Object.assign.bind():function(t){for(var s=1;s<arguments.length;s++){var u=arguments[s];for(var c in u)Object.prototype.hasOwnProperty.call(u,c)&&(t[c]=u[c])}return t},oe.apply(this,arguments)}function Ee(t,s){var u=Object.keys(t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(t);s&&(c=c.filter(function(h){return Object.getOwnPropertyDescriptor(t,h).enumerable})),u.push.apply(u,c)}return u}function ae(t){for(var s=1;s<arguments.length;s++){var u=arguments[s]!=null?arguments[s]:{};s%2?Ee(Object(u),!0).forEach(function(c){ze(t,c,u[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(u)):Ee(Object(u)).forEach(function(c){Object.defineProperty(t,c,Object.getOwnPropertyDescriptor(u,c))})}return t}function ze(t,s,u){return s=Pe(s),s in t?Object.defineProperty(t,s,{value:u,enumerable:!0,configurable:!0,writable:!0}):t[s]=u,t}function Pe(t){var s=De(t,"string");return typeof s=="symbol"?s:s+""}function De(t,s){if(typeof t!="object"||!t)return t;var u=t[Symbol.toPrimitive];if(u!==void 0){var c=u.call(t,s);if(typeof c!="object")return c;throw new TypeError("@@toPrimitive must return a primitive value.")}return(s==="string"?String:Number)(t)}function Ce(t){return t&&t.map((s,u)=>v.createElement(s.tag,ae({key:u},s.attr),Ce(s.child)))}function M(t){return s=>v.createElement(He,oe({attr:ae({},t.attr)},s),Ce(t.child))}function He(t){var s=u=>{var{attr:c,size:h,title:x}=t,L=Ae(t,Me),E=h||u.size||"1em",w;return u.className&&(w=u.className),t.className&&(w=(w?w+" ":"")+t.className),v.createElement("svg",oe({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},u.attr,c,L,{className:w,style:ae(ae({color:t.color||u.color},u.style),t.style),height:E,width:E,xmlns:"http://www.w3.org/2000/svg"}),x&&v.createElement("title",null,x),t.children)};return ye!==void 0?v.createElement(ye.Consumer,null,u=>s(u)):s(be)}function Fe(t){return M({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:[]}]})(t)}function Ie(t){return M({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:[]}]})(t)}function Be(t){return M({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:[]}]})(t)}function $e(t){return M({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:[]}]})(t)}function Ve(t){return M({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:[]}]})(t)}function Ye(t){return M({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:[]}]})(t)}function Ue(t){return M({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:[]}]})(t)}function qe(t){return M({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:[]}]})(t)}function We(t){return M({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:[]}]})(t)}function Xe(t){return M({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:[]}]})(t)}function Ge(t){return M({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:[]}]})(t)}function Ze(t){return M({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M464 32H48C21.49 32 0 53.49 0 80v352c0 26.51 21.49 48 48 48h416c26.51 0 48-21.49 48-48V80c0-26.51-21.49-48-48-48zM224 416H64v-96h160v96zm0-160H64v-96h160v96zm224 160H288v-96h160v96zm0-160H288v-96h160v96z"},child:[]}]})(t)}function Je(t){return M({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:[]}]})(t)}function Ke(t){return M({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:[]}]})(t)}function Qe(t){return M({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:[]}]})(t)}const et=["đ","đ","đ","đ¤Ŗ","đ","đ","đ
","đ","đ","đ","đ","đ","đ","đĸ","đ","đĄ","đ¤","đ","đ","đĨ°","đ¤Š","đ¤","đ´","đ","đŦ","đ¤¤","đļâđĢī¸","đˇ","đ¤","đ¤","đ¤ ","đ","đģ","đ","đ¤","đļ","đą","đŧ","đ¸","đĻ","đˇ","đĩ","đ°","đ¯","đĻ","đŽ","đ","đ","â","đ","đĨ","đ§","âī¸","âĄ","âī¸","đ¸","đš","đ","đ","đŠ","đ","đ","đ","đ","đ","đ","đĨ","đĨ","đ","đ","đ","đ","đļ","đĩ","đ","âŊ","đ","đ¸","đ","đšī¸","đ","đ¤","đī¸","â","đ","đ","đ","đ","đ¤","đ¤","â","đ","đ¤","đ¤","âī¸","đ","đ","đ","đ","đ¤","đ¤","đ¤","đ","đ","đ","âī¸","đ
","đ¤˛","đ","đĢļ","đ"],je=({exec:t,saveSelection:s,handleFileChange:u,handleFontSizeChange:c,handleFontFamilyChange:h,insertEmoji:x,handleLink:L,removeFormatting:E,visibleActions:w,className:F,style:P})=>{const _=v.useRef(null),D=v.useRef(null),C=v.useRef(null),[q,$]=v.useState(!1);v.useEffect(()=>{const m=O=>{!O.target.closest(".rte-emoji-popup")&&!O.target.closest("button[title='Emoji']")&&$(!1)};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[]);const k=m=>{m.preventDefault();const O=m.currentTarget.dataset.command;if(O)switch(O){case"bold":case"italic":case"underline":case"insertUnorderedList":case"insertOrderedList":case"removeFormat":t(O);break;case"insertImage":{_.current?.click();break}default:console.warn("Unknown command:",O)}},U=m=>{t("foreColor",m.target.value)},H=m=>{t("backColor",m.target.value)};return a.jsxs("div",{className:`rte-toolbar ${F||""}`,style:P,children:[w.bold&&a.jsx("button",{"data-command":"bold",title:"Bold",onMouseDown:k,children:a.jsx(Ye,{})}),w.italic&&a.jsx("button",{"data-command":"italic",title:"Italic",onMouseDown:k,children:a.jsx(qe,{})}),w.underline&&a.jsx("button",{"data-command":"underline",title:"Underline",onMouseDown:k,children:a.jsx(Je,{})}),w.unorderedList&&a.jsx("button",{"data-command":"insertUnorderedList",onMouseDown:k,title:"UnorderedList",children:a.jsx(Xe,{})}),w.orderedList&&a.jsx("button",{"data-command":"insertOrderedList",title:"OrderedList",onMouseDown:k,children:a.jsx($e,{})}),w.link&&a.jsx("button",{"data-command":"createLink",title:"Link",onClick:L,children:a.jsx(We,{})}),w.removeFormat&&a.jsx("button",{"data-command":"Remove format",title:"removeFormat",onMouseDown:m=>{m.preventDefault(),s(),E()},children:a.jsx(Qe,{})}),w.image&&a.jsx("button",{"data-command":"insertImage",title:"Image",onMouseDown:k,children:a.jsx(Be,{})}),a.jsx("input",{type:"file",accept:"image/*",ref:_,style:{display:"none"},onChange:u}),w.emoji&&a.jsxs("div",{style:{position:"relative"},children:[a.jsx("button",{title:"Emoji",onMouseDown:m=>{m.preventDefault(),s(),$(O=>!O)},children:a.jsx(Ge,{})}),q&&a.jsx("div",{className:"rte-emoji-popup",children:et.map(m=>a.jsx("span",{style:{fontSize:"20px",cursor:"pointer",textAlign:"center"},onMouseDown:O=>{O.preventDefault(),x(m),$(!1)},children:m},m))})]}),w.color&&a.jsxs("div",{style:{position:"relative"},children:[a.jsx("button",{title:"Text Color",onMouseDown:m=>{m.preventDefault(),s(),D.current?.click()},style:{display:"flex",alignItems:"center",justifyContent:"center",color:D.current?.value||"#000",fontSize:"18px"},children:a.jsx(Ke,{})}),a.jsx("input",{ref:D,type:"color",defaultValue:"#000000",onChange:m=>{U(m),(m.target.parentElement?.querySelector("button")).style.color=m.target.value},style:{position:"absolute",opacity:0,width:0,height:0,pointerEvents:"none"}})]}),w.highlight&&a.jsxs("div",{style:{position:"relative"},children:[a.jsx("button",{title:"Highlight",onMouseDown:m=>{m.preventDefault(),s(),C.current?.click()},style:{display:"flex",alignItems:"center",justifyContent:"center",color:C.current?.value||"#000",fontSize:"18px"},children:a.jsx(Ue,{})}),a.jsx("input",{ref:C,type:"color",onChange:m=>{H(m),(m.target.parentElement?.querySelector("button")).style.color=m.target.value},defaultValue:"#000000",style:{position:"absolute",opacity:0,width:0,height:0,pointerEvents:"none"}})]}),w.align&&a.jsxs(a.Fragment,{children:[a.jsx("button",{title:"Align Left",onMouseDown:m=>m.preventDefault(),onClick:()=>t("justifyLeft"),children:a.jsx(Ve,{})}),a.jsx("button",{title:"Align Center",onMouseDown:m=>m.preventDefault(),onClick:()=>t("justifyCenter"),children:a.jsx(Fe,{})}),a.jsx("button",{title:"Align Right",onMouseDown:m=>m.preventDefault(),onClick:()=>t("justifyRight"),children:a.jsx(Ie,{})})]}),w.table&&a.jsx("button",{title:"Insert Table",onMouseDown:m=>m.preventDefault(),onClick:()=>t("insertTable"),children:a.jsx(Ze,{})}),w.fontFamily&&a.jsxs("select",{className:"rte-dropdown",defaultValue:"",onMouseDown:()=>s(),onChange:h,children:[a.jsx("option",{value:"",disabled:!0,children:"Font Family"}),a.jsx("option",{value:"Arial",children:"Arial"}),a.jsx("option",{value:"Georgia",children:"Georgia"}),a.jsx("option",{value:"Times New Roman",children:"Times New Roman"}),a.jsx("option",{value:"Courier New",children:"Courier New"}),a.jsx("option",{value:"Verdana",children:"Verdana"})]}),w.fontSize&&a.jsxs("select",{className:"rte-dropdown",defaultValue:"",onMouseDown:()=>s(),onChange:c,children:[a.jsx("option",{value:"",disabled:!0,children:"Font Size"}),a.jsx("option",{value:"2",children:"Small "}),a.jsx("option",{value:"3",children:"Normal"}),a.jsx("option",{value:"4",children:"Medium"}),a.jsx("option",{value:"5",children:"Large"})]})]})},tt=({show:t,position:s,filtered:u,insertMention:c,onClose:h,query:x})=>{const L=v.useRef(null);return v.useEffect(()=>{const E=w=>{L.current&&!L.current.contains(w.target)&&h()};return t&&document.addEventListener("mousedown",E),()=>{document.removeEventListener("mousedown",E)}},[t,h]),t?a.jsx("ul",{ref:L,className:"rte-popup",style:{top:s.y,left:s.x},children:u.length>0?u.map(({key:E,value:w})=>{const F=E.toLowerCase(),P=x.toLowerCase(),_=F.indexOf(P);let D=E;if(_!==-1&&x.length>0){const C=_+x.length;D=E.substring(0,_)+`<span class="rte-highlight">${E.substring(_,C)}</span>`+E.substring(C)}return a.jsx("li",{onMouseDown:C=>{C.preventDefault(),c({key:E,value:w})},style:{padding:"6px 12px",cursor:"pointer",fontSize:"14px"},dangerouslySetInnerHTML:{__html:D},onMouseEnter:C=>C.currentTarget.style.background="#f0f0f0",onMouseLeave:C=>C.currentTarget.style.background="#fff"},w)}):a.jsx("li",{style:{padding:"6px 12px",color:"#999"},children:"No matches"})}):null};function Re(t){return M({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:[]}]}]}]})(t)}function le(t){return M({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:[]}]}]}]})(t)}const nt=({visible:t,x:s,y:u,onAction:c,onClose:h})=>{if(!t)return null;const x={top:u,left:s};return a.jsxs("div",{style:x,className:"rte-table-menu",onMouseLeave:h,children:[a.jsxs("button",{onClick:()=>c("insertRowAbove"),children:[a.jsx(le,{})," Insert row above"]}),a.jsxs("button",{onClick:()=>c("insertRowBelow"),children:[a.jsx(le,{})," Insert row below"]}),a.jsxs("button",{onClick:()=>c("insertColLeft"),children:[a.jsx(le,{})," Insert col left"]}),a.jsxs("button",{onClick:()=>c("insertColRight"),children:[a.jsx(le,{})," Insert col right"]}),a.jsxs("button",{onClick:()=>c("deleteRow"),children:[a.jsx(Re,{})," Delete row"]}),a.jsxs("button",{onClick:()=>c("deleteCol"),children:[a.jsx(Re,{})," Delete column"]})]})},Se=({html:t,className:s,style:u})=>{const c=h=>{const x=h.target;if(x.tagName==="A"){h.preventDefault();const L=x.href;L&&window.open(L,"_blank","noopener,noreferrer")}};return a.jsx("div",{className:`rte-preview ${s||""}`,style:u,onClick:c,dangerouslySetInnerHTML:{__html:t}})},rt=({visible:t,linkData:s,onClose:u,onInsert:c})=>{const[h,x]=v.useState(""),[L,E]=v.useState(""),[w,F]=v.useState(""),[P,_]=v.useState("_self");if(v.useEffect(()=>{t?(x(s.url||""),E(s.text||""),F(s.title||""),_(s.target||"_self")):(x(""),E(""),F(""),_("_self"))},[t,s]),!t)return null;const D=()=>{c({url:h,text:L,title:w,target:P})};return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"rte-link-modal-overlay",onClick:u}),a.jsxs("div",{className:"rte-link-modal",children:[a.jsx("h4",{className:"rte-link-modal__title",children:h?"Edit Link":"Insert Link"}),a.jsx("input",{type:"text",className:"rte-link-modal__input",placeholder:"URL",value:h,onChange:C=>x(C.target.value)}),a.jsx("input",{type:"text",className:"rte-link-modal__input",placeholder:"Text to Display",value:L,onChange:C=>E(C.target.value)}),a.jsx("input",{type:"text",className:"rte-link-modal__input",placeholder:"Title",value:w,onChange:C=>F(C.target.value)}),a.jsxs("select",{className:"rte-link-modal__select",value:P,onChange:C=>_(C.target.value),children:[a.jsx("option",{value:"_self",children:"Same tab"}),a.jsx("option",{value:"_blank",children:"New tab"})]}),a.jsxs("div",{className:"rte-link-modal__actions",children:[a.jsx("button",{className:"rte-link-modal__btn",onClick:u,children:"Cancel"}),a.jsx("button",{className:"rte-link-modal__btn rte-link-modal__btn--ok",onClick:D,children:"OK"})]})]})]})},ot=({atSuggestions:t=[],showOutput:s=!1,showPreview:u=!1,toolbarConfig:c={link:!1,image:!1,emoji:!1,table:!1,color:!1,fontFamily:!1,fontSize:!1,highlight:!1},classNames:h={},styles:x={},handleGetHtml:L=()=>{}})=>{const E=v.useRef(null),[w,F]=v.useState("<p>Always bet on Prime!</p>"),[P,_]=v.useState(!1),[D,C]=v.useState({x:0,y:0}),[q,$]=v.useState([]),k=v.useRef(null),U=v.useRef(null),[H,m]=v.useState({visible:!1,x:0,y:0}),[O,W]=v.useState(!1),X=v.useRef(null),[me,se]=v.useState({url:"",text:"",title:"",target:"_self"}),K={bold:!0,italic:!0,underline:!0,removeFormat:!0,unorderedList:!0,orderedList:!0,align:!0,link:c.link??!1,image:c.image??!1,emoji:c.emoji??!1,table:c.table??!1,color:c.color??!1,fontFamily:c.fontFamily??!1,fontSize:c.fontSize??!1,highlight:c.fontSize??!1},[he,ie]=v.useState(""),z=()=>E.current,N=()=>{F(z()?.innerHTML??"");const e=Te();L?.(e)},ce=()=>{const e=window.getSelection();e?.rangeCount&&(k.current=e.getRangeAt(0))},V=()=>{const e=window.getSelection();e&&k.current&&(e.removeAllRanges(),e.addRange(k.current))},ue=(e,o)=>{const r=window.getSelection();r&&r.rangeCount>0&&(k.current=r.getRangeAt(0)),V(),document.execCommand(e,!1,o),N()};v.useEffect(()=>{const e=z();e&&!e.innerHTML&&(e.innerHTML=w),N()},[]),v.useEffect(()=>()=>{document.removeEventListener("mousemove",null),document.removeEventListener("mouseup",null)},[]);const Q=e=>{for(;e&&e.nodeName!=="LI";)e=e.parentNode;return e},de=e=>{let o=0,r=e.parentElement;for(;r;)(r.tagName==="UL"||r.tagName==="OL")&&o++,r=r.parentElement;return o},fe=e=>{const o=e.querySelector("li"),r=o?de(o):1;if(e.querySelector("[data-hidden-array-start]"))return;const l=`{{#arrayData${r>1?r:""}}}`,g=`{{/arrayData${r>1?r:""}}}`,i=document.createElement("span");i.textContent=l,i.style.display="none",i.setAttribute("data-hidden-array-start","true"),e.insertBefore(i,e.firstChild);const f=document.createElement("span");f.textContent=g,f.style.display="none",f.setAttribute("data-hidden-array-end","true"),e.appendChild(f)},ee=e=>{const o=window.getSelection();if(!o?.rangeCount)return;const r=o.getRangeAt(0),l=Q(r.startContainer);let g,i;if(l){let d=l.querySelector(e);d||(d=document.createElement(e),d.style.margin="0",d.style.paddingLeft="20px",l.appendChild(d)),i=d,g=document.createElement("li"),g.textContent="â",i.appendChild(g)}else{if(document.execCommand(e==="ul"?"insertUnorderedList":"insertOrderedList"),i=z()?.querySelector(`${e}:last-child`),!i)return;g=i.querySelector("li:last-child")}fe(i);const f=document.createRange();f.setStart(g,0),f.collapse(!0),o.removeAllRanges(),o.addRange(f),z()?.focus(),N()},n=(e,o)=>{e==="insertOrderedList"?ee("ol"):e==="insertUnorderedList"?ee("ul"):ue(e,o),e==="insertTable"&&pe()},p=e=>{const o=document.createElement("span");o.textContent="â",e.insertNode(o),e.setStartAfter(o),e.collapse(!0);const r=o.getBoundingClientRect();o.remove(),C({x:r.left,y:r.bottom+window.scrollY}),$(t||[]),_(!0),U.current=e.cloneRange()},j=()=>{const e=window.getSelection();if(!e||e.rangeCount===0)return null;const o=e.anchorNode;let r=e.anchorOffset;if(!o)return null;let l=o;for(l.nodeType!==Node.TEXT_NODE&&(l.childNodes&&l.childNodes[r]?l=l.childNodes[r]:l=o.previousSibling);l;){if(l.nodeType===Node.TEXT_NODE){const g=l.textContent||"",i=l===o?r:g.length,f=g.lastIndexOf("@",i-1);if(f!==-1){const d=document.createRange();return d.setStart(l,f),d.setEnd(l,i),d}}l=l.previousSibling}return null},T=e=>{const o=window.getSelection();if(!o)return;const r=j();r?(o.removeAllRanges(),o.addRange(r)):U.current&&(o.removeAllRanges(),o.addRange(U.current));const l=document.createElement("span");l.textContent=`{{${e.key}}}`,l.style.color="#007bff",l.style.display="inline",l.contentEditable="false",l.setAttribute("data-mention",e.value||e.key||"");try{const g=o.rangeCount?o.getRangeAt(0):null;if(g)g.deleteContents(),g.insertNode(l);else{const d=document.createRange(),b=z();d.selectNodeContents(b),d.collapse(!1),d.insertNode(l)}const i=document.createTextNode(" ");l.after(i);const f=document.createRange();f.setStartAfter(i),f.collapse(!0),o.removeAllRanges(),o.addRange(f)}catch(g){console.error("insertMention error:",g)}_(!1),z()?.focus(),N()},G=e=>{const o=e.key.toLowerCase();if((e.ctrlKey||e.metaKey)&&["b","i","u"].includes(o)&&(e.preventDefault(),n(o==="b"?"bold":o==="i"?"italic":o==="u"?"underline":"")),e.shiftKey&&e.key==="2"&&e.preventDefault(),e.key==="Enter"){const r=window.getSelection(),l=r?.anchorNode?Q(r.anchorNode):null;if(!l)return;if(l.textContent?.replace(/\u200B/g,"").trim()===""){e.preventDefault();const i=l.parentElement,f=i?.closest("li");if(f){i?.removeChild(l);const d=document.createElement("p");d.innerHTML="<br />",f.parentElement?.insertBefore(d,f.nextSibling);const b=document.createRange();b.setStart(d,0),b.collapse(!0),r?.removeAllRanges(),r?.addRange(b)}else{const d=l.closest("ul, ol");if(d){const b=document.createElement("p");b.innerHTML="<br />",d.parentElement?.insertBefore(b,d.nextSibling),d.removeChild(l);const R=document.createRange();R.setStart(b,0),R.collapse(!0),r?.removeAllRanges(),r?.addRange(R)}}N()}}},te=e=>{if(e.data==="@"){const r=window.getSelection();if(!r?.rangeCount)return;setTimeout(()=>{p(r.getRangeAt(0)),ie(""),$(t),_(!0)},0);return}if(P){setTimeout(()=>S(),0);return}},S=()=>{if(N(),!P)return;const e=window.getSelection();if(!e||!e.anchorNode)return;const r=(e.anchorNode.textContent||"").match(/@([a-zA-Z0-9_]*)$/);if(!r){_(!1);return}const l=r[1].toLowerCase();ie(l);const g=t.filter(i=>i.key.toLowerCase().includes(l));$(g)},Y=e=>{const o=e.target.files?.[0];if(!o)return;const r=new FileReader;r.onload=l=>{const g=l.target?.result;V();const i=window.getSelection();let f=i&&i.rangeCount?i.getRangeAt(0):null;const d=document.createElement("img");d.src=g,d.alt=o.name||"image",d.className="rte-inserted-image",d.contentEditable="true";const b=z();if(!f||!b){b?.appendChild(d);const A=document.createTextNode(" ");b?.appendChild(A);const I=document.createRange();I.setStartAfter(A),I.collapse(!0),i?.removeAllRanges(),i?.addRange(I),b?.focus(),N(),e.target.value="";return}f.deleteContents(),f.insertNode(d);const R=document.createTextNode(" ");d.after(R);const y=document.createRange();y.setStartAfter(R),y.collapse(!0),i.removeAllRanges(),i.addRange(y),b.focus(),N(),e.target.value=""},r.readAsDataURL(o)},ne=e=>{V();const o=window.getSelection();if(!o?.rangeCount)return;const r=o.getRangeAt(0),l=document.createTextNode(e);r.insertNode(l),r.setStartAfter(l),r.collapse(!0),o.removeAllRanges(),o.addRange(r),z()?.focus(),N()},pe=()=>{V();const e=document.createElement("table");e.style.borderCollapse="collapse",e.style.width="100%",e.style.border="1px solid #ccc",e.style.margin="8px 0",e.style.position="relative";const o=document.createElement("thead"),r=document.createElement("tbody"),l=document.createElement("tr"),g=document.createElement("tr");for(let d=0;d<2;d++){const b=document.createElement("th");b.textContent=`Header ${d+1}`,b.style.border="1px solid #999",b.style.padding="8px",b.style.position="relative";const R=document.createElement("td");R.textContent=`Row 1 Col ${d+1}`,R.style.border="1px solid #999",R.style.padding="8px",R.style.position="relative",ge(b),ge(R),l.appendChild(b),g.appendChild(R)}o.appendChild(l),r.appendChild(g),e.appendChild(o),e.appendChild(r),ct(e),at(e);const i=window.getSelection();if(!i?.rangeCount)return;i.getRangeAt(0).insertNode(e),N()},at=e=>{const o=document.createElement("div");Object.assign(o.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"});let r=0,l=0,g=0,i=0;o.addEventListener("mousedown",f=>{f.preventDefault(),r=f.clientX,l=f.clientY;const d=e.getBoundingClientRect();g=d.width,i=d.height;const b=y=>{const A=Math.max(100,g+(y.clientX-r)),I=Math.max(60,i+(y.clientY-l));e.style.width=`${A}px`,e.style.height=`${I}px`,N()},R=()=>{document.removeEventListener("mousemove",b),document.removeEventListener("mouseup",R),N()};document.addEventListener("mousemove",b),document.addEventListener("mouseup",R)}),e.appendChild(o)},ge=e=>{const o=document.createElement("div"),r=document.createElement("div");Object.assign(o.style,{position:"absolute",right:"0",top:"0",width:"6px",height:"100%",cursor:"col-resize",background:"rgba(0,0,0,0.15)",zIndex:"10"}),Object.assign(r.style,{position:"absolute",bottom:"0",left:"0",width:"100%",height:"6px",cursor:"row-resize",background:"rgba(0,0,0,0.15)",zIndex:"10"}),lt(e,o,r),e.appendChild(o),e.appendChild(r)},lt=(e,o,r)=>{let l=0,g=0,i=0,f=0;o.addEventListener("mousedown",y=>{y.preventDefault(),l=y.clientX,i=e.offsetWidth,document.addEventListener("mousemove",d),document.addEventListener("mouseup",R)}),r.addEventListener("mousedown",y=>{y.preventDefault(),g=y.clientY,f=e.offsetHeight,document.addEventListener("mousemove",b),document.addEventListener("mouseup",R)});const d=y=>{const A=i+(y.clientX-l);e.style.width=`${Math.max(30,A)}px`},b=y=>{const A=f+(y.clientY-g);e.style.height=`${Math.max(20,A)}px`},R=()=>{document.removeEventListener("mousemove",d),document.removeEventListener("mousemove",b),document.removeEventListener("mouseup",R)}},st=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"),m({visible:!0,x:e.clientX,y:e.clientY,cell:r}))},Le=()=>{document.querySelectorAll(".rte-cell-highlight").forEach(e=>e.classList.remove("rte-cell-highlight"))},it=e=>{if(!H.cell)return;const o=H.cell.closest("table"),r=H.cell.cellIndex,l=H.cell.parentElement.rowIndex,g=i=>{const f=i.tagName.toLowerCase(),d=document.createElement(f);return d.textContent=i.textContent||"",d.style.cssText=i.style.cssText,ge(d),d};switch(e){case"insertRowAbove":{const i=o.rows[l],f=o.insertRow(l);Array.from(i.cells).forEach(d=>{f.appendChild(g(d))});break}case"insertRowBelow":{const i=o.rows[l],f=o.insertRow(l+1);Array.from(i.cells).forEach(d=>{f.appendChild(g(d))});break}case"insertColLeft":{Array.from(o.rows).forEach(i=>{const f=i.cells[r];i.insertBefore(g(f),f)});break}case"insertColRight":{Array.from(o.rows).forEach(i=>{const f=i.cells[r];i.insertBefore(g(f),f.nextSibling)});break}case"deleteRow":o.rows.length>1&&o.deleteRow(l);break;case"deleteCol":Array.from(o.rows).forEach(i=>{i.cells[r]&&i.deleteCell(r)});break}N(),m({...H,visible:!1}),Le()},ct=e=>{const o=e.querySelector("tbody");if(!o||o.querySelector("[data-hidden-table-start]"))return;const r=document.createElement("span");r.textContent="{{#tableData}}",r.style.display="none",r.setAttribute("data-hidden-table-start","true"),o.insertBefore(r,o.firstChild);const l=document.createElement("span");l.textContent="{{/tableData}}",l.style.display="none",l.setAttribute("data-hidden-table-end","true"),o.appendChild(l)},Te=()=>{const e=z();if(!e)return w;const o=e.cloneNode(!0);return o.querySelectorAll(".rte-cell-highlight").forEach(r=>{r.classList.remove("rte-cell-highlight")}),o.querySelectorAll("div").forEach(r=>{(r.style.cursor==="col-resize"||r.style.cursor==="row-resize"||r.style.cursor==="nwse-resize")&&r.remove()}),o.innerHTML},ut=()=>{ce(),X.current=k.current,se({url:"",text:"",title:"",target:"_self"}),W(!0)},dt=e=>{const o=window.getSelection();if(!o||!X.current)return;o.removeAllRanges(),o.addRange(X.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 g=o.getRangeAt(0);g.deleteContents(),g.insertNode(l);const i=document.createTextNode(" ");l.after(i);const f=document.createRange();f.setStartAfter(i),f.collapse(!0),o.removeAllRanges(),o.addRange(f),W(!1),N()},ft=e=>{const o=e.target;if(o.tagName==="A"){const r=o;if(e.ctrlKey||e.metaKey){window.open(r.href,"_blank","noopener,noreferrer");return}e.preventDefault();const l=document.createRange();l.selectNode(r),X.current=l,se({url:r.href,text:r.textContent||r.href,title:r.title,target:r.target}),W(!0)}},mt=()=>{const e=z();if(!e)return;const o=window.getSelection();if((!o||o.rangeCount===0)&&k.current){const y=window.getSelection();y?.removeAllRanges(),y?.addRange(k.current)}const r=window.getSelection();if(!r||r.rangeCount===0)return;const l=r.getRangeAt(0);V(),document.execCommand("removeFormat",!1);const g=l.cloneContents(),i=document.createElement("div");i.appendChild(g);const f=document.createTreeWalker(i,NodeFilter.SHOW_ELEMENT,null),d=[];for(;f.nextNode();){const y=f.currentNode,A=y.tagName.toUpperCase(),I=y.getAttribute&&y.getAttribute("data-mention")!==null;A!=="A"&&!I&&d.push(y)}for(let y=d.length-1;y>=0;y--){const A=d[y],I=A.parentNode;if(I){for(;A.firstChild;)I.insertBefore(A.firstChild,A);I.removeChild(A)}}i.querySelectorAll("[style]").forEach(y=>y.removeAttribute("style")),l.deleteContents();const b=document.createDocumentFragment();for(;i.firstChild;)b.appendChild(i.firstChild);l.insertNode(b);const R=document.createRange();R.setStartAfter(l.endContainer.nodeType===Node.TEXT_NODE?l.endContainer:l.startContainer),R.collapse(!0),r.removeAllRanges(),r.addRange(R),e.normalize(),N()};return a.jsxs("div",{className:`rte-wrapper ${h?.wrapper||""}`,style:x.wrapper,children:[a.jsxs("div",{style:{flex:1},children:[a.jsx(je,{exec:n,saveSelection:ce,handleFileChange:Y,handleFontSizeChange:e=>n("fontSize",e.target.value),handleFontFamilyChange:e=>n("fontName",e.target.value),insertEmoji:ne,handleLink:ut,removeFormatting:mt,visibleActions:K,className:h.toolbar,style:x.toolbar}),a.jsx("div",{ref:E,className:`rte-editor ${h?.editor||""}`,style:x.editor,contentEditable:!0,suppressContentEditableWarning:!0,onInput:S,onKeyDown:G,onBeforeInput:te,onContextMenu:st,onClick:ft}),a.jsx(tt,{show:P,position:D,filtered:q,insertMention:T,onClose:()=>_(!1),query:he}),s&&a.jsxs("div",{className:`rte-output ${h?.output||""}`,style:x.output,children:[a.jsx("h4",{children:"Output HTML:"}),a.jsx("p",{children:w})]}),a.jsx(nt,{visible:H.visible,x:H.x,y:H.y,onAction:it,onClose:()=>{m({...H,visible:!1}),Le()}}),a.jsx(rt,{visible:O,linkData:me,onClose:()=>W(!1),onInsert:dt})]}),u?a.jsx(Se,{className:h.preview,style:x.preview,html:Te()}):null]})};B.RichTextEditor=ot,B.RtePreview=Se,B.RteToolbar=je,Object.defineProperty(B,Symbol.toStringTag,{value:"Module"})}));
|
|
22
|
+
<%s key={someKey} {...props} />`,L,k,q,k),ne[k+L]=!0)}if(k=null,T!==void 0&&(d(T),k=""+T),_(x)&&(d(x.key),k=""+x.key),"key"in x){T={};for(var oe in x)oe!=="key"&&(T[oe]=x[oe])}else T=x;return k&&j(T,typeof n=="function"?n.displayName||n.name||"Unknown":n),$(n,k,T,m(),K,re)}function M(n){I(n)?n._store&&(n._store.validated=1):typeof n=="object"&&n!==null&&n.$$typeof===ee&&(n._payload.status==="fulfilled"?I(n._payload.value)&&n._payload.value._store&&(n._payload.value._store.validated=1):n._store&&(n._store.validated=1))}function I(n){return typeof n=="object"&&n!==null&&n.$$typeof===X}var R=f,X=Symbol.for("react.transitional.element"),V=Symbol.for("react.portal"),O=Symbol.for("react.fragment"),W=Symbol.for("react.strict_mode"),B=Symbol.for("react.profiler"),U=Symbol.for("react.consumer"),Z=Symbol.for("react.context"),p=Symbol.for("react.forward_ref"),C=Symbol.for("react.suspense"),J=Symbol.for("react.suspense_list"),ie=Symbol.for("react.memo"),ee=Symbol.for("react.lazy"),he=Symbol.for("react.activity"),ce=Symbol.for("react.client.reference"),D=R.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,z=Object.prototype.hasOwnProperty,ue=Array.isArray,Y=console.createTask?console.createTask:function(){return null};R={react_stack_bottom_frame:function(n){return n()}};var de,te={},fe=R.react_stack_bottom_frame.bind(R,b)(),me=Y(u(b)),ne={};Q.Fragment=O,Q.jsx=function(n,x,T){var L=1e4>D.recentlyCreatedOwnerStacks++;return F(n,x,T,!1,L?Error("react-stack-top-frame"):fe,L?Y(u(n)):me)},Q.jsxs=function(n,x,T){var L=1e4>D.recentlyCreatedOwnerStacks++;return F(n,x,T,!0,L?Error("react-stack-top-frame"):fe,L?Y(u(n)):me)}})()),Q}var Ee;function Ue(){return Ee||(Ee=1,process.env.NODE_ENV==="production"?P.exports=Ve():P.exports=Ye()),P.exports}var a=Ue(),Ce={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},je=f.createContext&&f.createContext(Ce),qe=["attr","size","title"];function We(t,i){if(t==null)return{};var d=Xe(t,i),u,m;if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(t);for(m=0;m<b.length;m++)u=b[m],!(i.indexOf(u)>=0)&&Object.prototype.propertyIsEnumerable.call(t,u)&&(d[u]=t[u])}return d}function Xe(t,i){if(t==null)return{};var d={};for(var u in t)if(Object.prototype.hasOwnProperty.call(t,u)){if(i.indexOf(u)>=0)continue;d[u]=t[u]}return d}function ae(){return ae=Object.assign?Object.assign.bind():function(t){for(var i=1;i<arguments.length;i++){var d=arguments[i];for(var u in d)Object.prototype.hasOwnProperty.call(d,u)&&(t[u]=d[u])}return t},ae.apply(this,arguments)}function Re(t,i){var d=Object.keys(t);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(t);i&&(u=u.filter(function(m){return Object.getOwnPropertyDescriptor(t,m).enumerable})),d.push.apply(d,u)}return d}function le(t){for(var i=1;i<arguments.length;i++){var d=arguments[i]!=null?arguments[i]:{};i%2?Re(Object(d),!0).forEach(function(u){Ze(t,u,d[u])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(d)):Re(Object(d)).forEach(function(u){Object.defineProperty(t,u,Object.getOwnPropertyDescriptor(d,u))})}return t}function Ze(t,i,d){return i=Je(i),i in t?Object.defineProperty(t,i,{value:d,enumerable:!0,configurable:!0,writable:!0}):t[i]=d,t}function Je(t){var i=Ke(t,"string");return typeof i=="symbol"?i:i+""}function Ke(t,i){if(typeof t!="object"||!t)return t;var d=t[Symbol.toPrimitive];if(d!==void 0){var u=d.call(t,i);if(typeof u!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return(i==="string"?String:Number)(t)}function Se(t){return t&&t.map((i,d)=>f.createElement(i.tag,le({key:d},i.attr),Se(i.child)))}function N(t){return i=>f.createElement(Ge,ae({attr:le({},t.attr)},i),Se(t.child))}function Ge(t){var i=d=>{var{attr:u,size:m,title:b}=t,_=We(t,qe),j=m||d.size||"1em",y;return d.className&&(y=d.className),t.className&&(y=(y?y+" ":"")+t.className),f.createElement("svg",ae({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},d.attr,u,_,{className:y,style:le(le({color:t.color||d.color},d.style),t.style),height:j,width:j,xmlns:"http://www.w3.org/2000/svg"}),b&&f.createElement("title",null,b),t.children)};return je!==void 0?f.createElement(je.Consumer,null,d=>i(d)):i(Ce)}function Qe(t){return N({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:[]}]})(t)}function et(t){return N({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:[]}]})(t)}function tt(t){return N({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:[]}]})(t)}function nt(t){return N({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:[]}]})(t)}function rt(t){return N({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:[]}]})(t)}function ot(t){return N({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:[]}]})(t)}function at(t){return N({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:[]}]})(t)}function lt(t){return N({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:[]}]})(t)}function st(t){return N({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:[]}]})(t)}function it(t){return N({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:[]}]})(t)}function ct(t){return N({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:[]}]})(t)}function ut(t){return N({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M464 32H48C21.49 32 0 53.49 0 80v352c0 26.51 21.49 48 48 48h416c26.51 0 48-21.49 48-48V80c0-26.51-21.49-48-48-48zM224 416H64v-96h160v96zm0-160H64v-96h160v96zm224 160H288v-96h160v96zm0-160H288v-96h160v96z"},child:[]}]})(t)}function dt(t){return N({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:[]}]})(t)}function ft(t){return N({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:[]}]})(t)}function mt(t){return N({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:[]}]})(t)}const ht=["đ","đ","đ","đ¤Ŗ","đ","đ","đ
","đ","đ","đ","đ","đ","đ","đĸ","đ","đĄ","đ¤","đ","đ","đĨ°","đ¤Š","đ¤","đ´","đ","đŦ","đ¤¤","đļâđĢī¸","đˇ","đ¤","đ¤","đ¤ ","đ","đģ","đ","đ¤","đļ","đą","đŧ","đ¸","đĻ","đˇ","đĩ","đ°","đ¯","đĻ","đŽ","đ","đ","â","đ","đĨ","đ§","âī¸","âĄ","âī¸","đ¸","đš","đ","đ","đŠ","đ","đ","đ","đ","đ","đ","đĨ","đĨ","đ","đ","đ","đ","đļ","đĩ","đ","âŊ","đ","đ¸","đ","đšī¸","đ","đ¤","đī¸","â","đ","đ","đ","đ","đ¤","đ¤","â","đ","đ¤","đ¤","âī¸","đ","đ","đ","đ","đ¤","đ¤","đ¤","đ","đ","đ","âī¸","đ
","đ¤˛","đ","đĢļ","đ"],Te=({exec:t,saveSelection:i,handleFileChange:d,handleFontSizeChange:u,handleFontFamilyChange:m,insertEmoji:b,handleLink:_,removeFormatting:j,visibleActions:y,className:$,style:F})=>{var U,Z;const M=f.useRef(null),I=f.useRef(null),R=f.useRef(null),[X,V]=f.useState(!1);f.useEffect(()=>{const p=C=>{!C.target.closest(".rte-emoji-popup")&&!C.target.closest("button[title='Emoji']")&&V(!1)};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[]);const O=p=>{var J;p.preventDefault();const C=p.currentTarget.dataset.command;if(C)switch(C){case"bold":case"italic":case"underline":case"insertUnorderedList":case"insertOrderedList":case"removeFormat":t(C);break;case"insertImage":{(J=M.current)==null||J.click();break}default:console.warn("Unknown command:",C)}},W=p=>{t("foreColor",p.target.value)},B=p=>{t("backColor",p.target.value)};return a.jsxs("div",{className:`rte-toolbar ${$||""}`,style:F,children:[y.bold&&a.jsx("button",{"data-command":"bold",title:"Bold",onMouseDown:O,children:a.jsx(ot,{})}),y.italic&&a.jsx("button",{"data-command":"italic",title:"Italic",onMouseDown:O,children:a.jsx(lt,{})}),y.underline&&a.jsx("button",{"data-command":"underline",title:"Underline",onMouseDown:O,children:a.jsx(dt,{})}),y.unorderedList&&a.jsx("button",{"data-command":"insertUnorderedList",onMouseDown:O,title:"UnorderedList",children:a.jsx(it,{})}),y.orderedList&&a.jsx("button",{"data-command":"insertOrderedList",title:"OrderedList",onMouseDown:O,children:a.jsx(nt,{})}),y.link&&a.jsx("button",{"data-command":"createLink",title:"Link",onClick:_,children:a.jsx(st,{})}),y.removeFormat&&a.jsx("button",{"data-command":"Remove format",title:"removeFormat",onMouseDown:p=>{p.preventDefault(),i(),j()},children:a.jsx(mt,{})}),y.image&&a.jsx("button",{"data-command":"insertImage",title:"Image",onMouseDown:O,children:a.jsx(tt,{})}),a.jsx("input",{type:"file",accept:"image/*",ref:M,style:{display:"none"},onChange:d}),y.emoji&&a.jsxs("div",{style:{position:"relative"},children:[a.jsx("button",{title:"Emoji",onMouseDown:p=>{p.preventDefault(),i(),V(C=>!C)},children:a.jsx(ct,{})}),X&&a.jsx("div",{className:"rte-emoji-popup",children:ht.map(p=>a.jsx("span",{style:{fontSize:"20px",cursor:"pointer",textAlign:"center"},onMouseDown:C=>{C.preventDefault(),b(p),V(!1)},children:p},p))})]}),y.color&&a.jsxs("div",{style:{position:"relative"},children:[a.jsx("button",{title:"Text Color",onMouseDown:p=>{var C;p.preventDefault(),i(),(C=I.current)==null||C.click()},style:{display:"flex",alignItems:"center",justifyContent:"center",color:((U=I.current)==null?void 0:U.value)||"#000",fontSize:"18px"},children:a.jsx(ft,{})}),a.jsx("input",{ref:I,type:"color",defaultValue:"#000000",onChange:p=>{var C;W(p),((C=p.target.parentElement)==null?void 0:C.querySelector("button")).style.color=p.target.value},style:{position:"absolute",opacity:0,width:0,height:0,pointerEvents:"none"}})]}),y.highlight&&a.jsxs("div",{style:{position:"relative"},children:[a.jsx("button",{title:"Highlight",onMouseDown:p=>{var C;p.preventDefault(),i(),(C=R.current)==null||C.click()},style:{display:"flex",alignItems:"center",justifyContent:"center",color:((Z=R.current)==null?void 0:Z.value)||"#000",fontSize:"18px"},children:a.jsx(at,{})}),a.jsx("input",{ref:R,type:"color",onChange:p=>{var C;B(p),((C=p.target.parentElement)==null?void 0:C.querySelector("button")).style.color=p.target.value},defaultValue:"#000000",style:{position:"absolute",opacity:0,width:0,height:0,pointerEvents:"none"}})]}),y.align&&a.jsxs(a.Fragment,{children:[a.jsx("button",{title:"Align Left",onMouseDown:p=>p.preventDefault(),onClick:()=>t("justifyLeft"),children:a.jsx(rt,{})}),a.jsx("button",{title:"Align Center",onMouseDown:p=>p.preventDefault(),onClick:()=>t("justifyCenter"),children:a.jsx(Qe,{})}),a.jsx("button",{title:"Align Right",onMouseDown:p=>p.preventDefault(),onClick:()=>t("justifyRight"),children:a.jsx(et,{})})]}),y.table&&a.jsx("button",{title:"Insert Table",onMouseDown:p=>p.preventDefault(),onClick:()=>t("insertTable"),children:a.jsx(ut,{})}),y.fontFamily&&a.jsxs("select",{className:"rte-dropdown",defaultValue:"",onMouseDown:()=>i(),onChange:m,children:[a.jsx("option",{value:"",disabled:!0,children:"Font Family"}),a.jsx("option",{value:"Arial",children:"Arial"}),a.jsx("option",{value:"Georgia",children:"Georgia"}),a.jsx("option",{value:"Times New Roman",children:"Times New Roman"}),a.jsx("option",{value:"Courier New",children:"Courier New"}),a.jsx("option",{value:"Verdana",children:"Verdana"})]}),y.fontSize&&a.jsxs("select",{className:"rte-dropdown",defaultValue:"",onMouseDown:()=>i(),onChange:u,children:[a.jsx("option",{value:"",disabled:!0,children:"Font Size"}),a.jsx("option",{value:"2",children:"Small "}),a.jsx("option",{value:"3",children:"Normal"}),a.jsx("option",{value:"4",children:"Medium"}),a.jsx("option",{value:"5",children:"Large"})]})]})},pt=({show:t,position:i,filtered:d,insertMention:u,onClose:m,query:b})=>{const _=f.useRef(null);return f.useEffect(()=>{const j=y=>{_.current&&!_.current.contains(y.target)&&m()};return t&&document.addEventListener("mousedown",j),()=>{document.removeEventListener("mousedown",j)}},[t,m]),t?a.jsx("ul",{ref:_,className:"rte-popup",style:{top:i.y,left:i.x},children:d.length>0?d.map(({key:j,value:y})=>{const $=j.toLowerCase(),F=b.toLowerCase(),M=$.indexOf(F);let I=j;if(M!==-1&&b.length>0){const R=M+b.length;I=j.substring(0,M)+`<span class="rte-highlight">${j.substring(M,R)}</span>`+j.substring(R)}return a.jsx("li",{onMouseDown:R=>{R.preventDefault(),u({key:j,value:y})},style:{padding:"6px 12px",cursor:"pointer",fontSize:"14px"},dangerouslySetInnerHTML:{__html:I},onMouseEnter:R=>R.currentTarget.style.background="#f0f0f0",onMouseLeave:R=>R.currentTarget.style.background="#fff"},y)}):a.jsx("li",{style:{padding:"6px 12px",color:"#999"},children:"No matches"})}):null};function _e(t){return N({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:[]}]}]}]})(t)}function se(t){return N({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:[]}]}]}]})(t)}const gt=({visible:t,x:i,y:d,onAction:u,onClose:m})=>{if(!t)return null;const b={top:d,left:i};return a.jsxs("div",{style:b,className:"rte-table-menu",onMouseLeave:m,children:[a.jsxs("button",{onClick:()=>u("insertRowAbove"),children:[a.jsx(se,{})," Insert row above"]}),a.jsxs("button",{onClick:()=>u("insertRowBelow"),children:[a.jsx(se,{})," Insert row below"]}),a.jsxs("button",{onClick:()=>u("insertColLeft"),children:[a.jsx(se,{})," Insert col left"]}),a.jsxs("button",{onClick:()=>u("insertColRight"),children:[a.jsx(se,{})," Insert col right"]}),a.jsxs("button",{onClick:()=>u("deleteRow"),children:[a.jsx(_e,{})," Delete row"]}),a.jsxs("button",{onClick:()=>u("deleteCol"),children:[a.jsx(_e,{})," Delete column"]})]})},ke=({html:t,className:i,style:d})=>{const u=m=>{const b=m.target;if(b.tagName==="A"){m.preventDefault();const _=b.href;_&&window.open(_,"_blank","noopener,noreferrer")}};return a.jsx("div",{className:`rte-preview ${i||""}`,style:d,onClick:u,dangerouslySetInnerHTML:{__html:t}})},vt=({visible:t,linkData:i,onClose:d,onInsert:u})=>{const[m,b]=f.useState(""),[_,j]=f.useState(""),[y,$]=f.useState(""),[F,M]=f.useState("_self");if(f.useEffect(()=>{t?(b(i.url||""),j(i.text||""),$(i.title||""),M(i.target||"_self")):(b(""),j(""),$(""),M("_self"))},[t,i]),!t)return null;const I=()=>{u({url:m,text:_,title:y,target:F})};return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"rte-link-modal-overlay",onClick:d}),a.jsxs("div",{className:"rte-link-modal",children:[a.jsx("h4",{className:"rte-link-modal__title",children:m?"Edit Link":"Insert Link"}),a.jsx("input",{type:"text",className:"rte-link-modal__input",placeholder:"URL",value:m,onChange:R=>b(R.target.value)}),a.jsx("input",{type:"text",className:"rte-link-modal__input",placeholder:"Text to Display",value:_,onChange:R=>j(R.target.value)}),a.jsx("input",{type:"text",className:"rte-link-modal__input",placeholder:"Title",value:y,onChange:R=>$(R.target.value)}),a.jsxs("select",{className:"rte-link-modal__select",value:F,onChange:R=>M(R.target.value),children:[a.jsx("option",{value:"_self",children:"Same tab"}),a.jsx("option",{value:"_blank",children:"New tab"})]}),a.jsxs("div",{className:"rte-link-modal__actions",children:[a.jsx("button",{className:"rte-link-modal__btn",onClick:d,children:"Cancel"}),a.jsx("button",{className:"rte-link-modal__btn rte-link-modal__btn--ok",onClick:I,children:"OK"})]})]})]})},xt=({atSuggestions:t=[],showOutput:i=!1,showPreview:d=!1,toolbarConfig:u={link:!1,image:!1,emoji:!1,table:!1,color:!1,fontFamily:!1,fontSize:!1,highlight:!1},classNames:m={},styles:b={},handleGetHtml:_=()=>{}})=>{var Ae,Oe,ze,Ne,Pe,De,He,Fe;const j=f.useRef(null),[y,$]=f.useState("<p>Always bet on Prime!</p>"),[F,M]=f.useState(!1),[I,R]=f.useState({x:0,y:0}),[X,V]=f.useState([]),O=f.useRef(null),W=f.useRef(null),[B,U]=f.useState({visible:!1,x:0,y:0}),[Z,p]=f.useState(!1),C=f.useRef(null),[J,ie]=f.useState({url:"",text:"",title:"",target:"_self"}),ee={bold:!0,italic:!0,underline:!0,removeFormat:!0,unorderedList:!0,orderedList:!0,align:!0,link:(Ae=u.link)!=null?Ae:!1,image:(Oe=u.image)!=null?Oe:!1,emoji:(ze=u.emoji)!=null?ze:!1,table:(Ne=u.table)!=null?Ne:!1,color:(Pe=u.color)!=null?Pe:!1,fontFamily:(De=u.fontFamily)!=null?De:!1,fontSize:(He=u.fontSize)!=null?He:!1,highlight:(Fe=u.fontSize)!=null?Fe:!1},[he,ce]=f.useState(""),D=()=>j.current,z=()=>{var r,o;$((o=(r=D())==null?void 0:r.innerHTML)!=null?o:"");const e=Me();_==null||_(e)},ue=()=>{const e=window.getSelection();e!=null&&e.rangeCount&&(O.current=e.getRangeAt(0))},Y=()=>{const e=window.getSelection();e&&O.current&&(e.removeAllRanges(),e.addRange(O.current))},de=(e,r)=>{const o=window.getSelection();o&&o.rangeCount>0&&(O.current=o.getRangeAt(0)),Y(),document.execCommand(e,!1,r),z()};f.useEffect(()=>{const e=D();e&&!e.innerHTML&&(e.innerHTML=y),z()},[]),f.useEffect(()=>()=>{document.removeEventListener("mousemove",null),document.removeEventListener("mouseup",null)},[]);const te=e=>{for(;e&&e.nodeName!=="LI";)e=e.parentNode;return e},fe=e=>{let r=0,o=e.parentElement;for(;o;)(o.tagName==="UL"||o.tagName==="OL")&&r++,o=o.parentElement;return r},me=e=>{const r=e.querySelector("li"),o=r?fe(r):1;if(e.querySelector("[data-hidden-array-start]"))return;const l=`{{#arrayData${o>1?o:""}}}`,g=`{{/arrayData${o>1?o:""}}}`,s=document.createElement("span");s.textContent=l,s.style.display="none",s.setAttribute("data-hidden-array-start","true"),e.insertBefore(s,e.firstChild);const c=document.createElement("span");c.textContent=g,c.style.display="none",c.setAttribute("data-hidden-array-end","true"),e.appendChild(c)},ne=e=>{var w;const r=window.getSelection();if(!(r!=null&&r.rangeCount))return;const o=r.getRangeAt(0),l=te(o.startContainer);let g,s;if(l){let h=l.querySelector(e);h||(h=document.createElement(e),h.style.margin="0",h.style.paddingLeft="20px",l.appendChild(h)),s=h,g=document.createElement("li"),g.textContent="â",s.appendChild(g)}else{document.execCommand(e==="ul"?"insertUnorderedList":"insertOrderedList");const h=D();if(s=h==null?void 0:h.querySelector(`${e}:last-child`),!s)return;g=s.querySelector("li:last-child")}me(s);const c=document.createRange();c.setStart(g,0),c.collapse(!0),r.removeAllRanges(),r.addRange(c),(w=D())==null||w.focus(),z()},n=(e,r)=>{e==="insertOrderedList"?ne("ol"):e==="insertUnorderedList"?ne("ul"):de(e,r),e==="insertTable"&&pe()},x=e=>{const r=document.createElement("span");r.textContent="â",e.insertNode(r),e.setStartAfter(r),e.collapse(!0);const o=r.getBoundingClientRect();r.remove(),R({x:o.left,y:o.bottom+window.scrollY}),V(t||[]),M(!0),W.current=e.cloneRange()},T=()=>{const e=window.getSelection();if(!e||e.rangeCount===0)return null;const r=e.anchorNode;let o=e.anchorOffset;if(!r)return null;let l=r;for(l.nodeType!==Node.TEXT_NODE&&(l.childNodes&&l.childNodes[o]?l=l.childNodes[o]:l=r.previousSibling);l;){if(l.nodeType===Node.TEXT_NODE){const g=l.textContent||"",s=l===r?o:g.length,c=g.lastIndexOf("@",s-1);if(c!==-1){const w=document.createRange();return w.setStart(l,c),w.setEnd(l,s),w}}l=l.previousSibling}return null},L=e=>{var g;const r=window.getSelection();if(!r)return;const o=T();o?(r.removeAllRanges(),r.addRange(o)):W.current&&(r.removeAllRanges(),r.addRange(W.current));const l=document.createElement("span");l.textContent=`{{${e.key}}}`,l.style.color="#007bff",l.style.display="inline",l.contentEditable="false",l.setAttribute("data-mention",e.value||e.key||"");try{const s=r.rangeCount?r.getRangeAt(0):null;if(s)s.deleteContents(),s.insertNode(l);else{const h=document.createRange(),E=D();h.selectNodeContents(E),h.collapse(!1),h.insertNode(l)}const c=document.createTextNode(" ");l.after(c);const w=document.createRange();w.setStartAfter(c),w.collapse(!0),r.removeAllRanges(),r.addRange(w)}catch(s){console.error("insertMention error:",s)}M(!1),(g=D())==null||g.focus(),z()},K=e=>{var o,l,g;const r=e.key.toLowerCase();if((e.ctrlKey||e.metaKey)&&["b","i","u"].includes(r)&&(e.preventDefault(),n(r==="b"?"bold":r==="i"?"italic":r==="u"?"underline":"")),e.shiftKey&&e.key==="2"&&e.preventDefault(),e.key==="Enter"){const s=window.getSelection(),c=s!=null&&s.anchorNode?te(s.anchorNode):null;if(!c)return;if(((o=c.textContent)==null?void 0:o.replace(/\u200B/g,"").trim())===""){e.preventDefault();const h=c.parentElement,E=h==null?void 0:h.closest("li");if(E){h==null||h.removeChild(c);const v=document.createElement("p");v.innerHTML="<br />",(l=E.parentElement)==null||l.insertBefore(v,E.nextSibling);const S=document.createRange();S.setStart(v,0),S.collapse(!0),s==null||s.removeAllRanges(),s==null||s.addRange(S)}else{const v=c.closest("ul, ol");if(v){const S=document.createElement("p");S.innerHTML="<br />",(g=v.parentElement)==null||g.insertBefore(S,v.nextSibling),v.removeChild(c);const H=document.createRange();H.setStart(S,0),H.collapse(!0),s==null||s.removeAllRanges(),s==null||s.addRange(H)}}z()}}},re=e=>{if(e.data==="@"){const o=window.getSelection();if(!(o!=null&&o.rangeCount))return;setTimeout(()=>{x(o.getRangeAt(0)),ce(""),V(t),M(!0)},0);return}if(F){setTimeout(()=>k(),0);return}},k=()=>{if(z(),!F)return;const e=window.getSelection();if(!e||!e.anchorNode)return;const o=(e.anchorNode.textContent||"").match(/@([a-zA-Z0-9_]*)$/);if(!o){M(!1);return}const l=o[1].toLowerCase();ce(l);const g=t.filter(s=>s.key.toLowerCase().includes(l));V(g)},q=e=>{var l;const r=(l=e.target.files)==null?void 0:l[0];if(!r)return;const o=new FileReader;o.onload=g=>{var H;const s=(H=g.target)==null?void 0:H.result;Y();const c=window.getSelection();let w=c&&c.rangeCount?c.getRangeAt(0):null;const h=document.createElement("img");h.src=s,h.alt=r.name||"image",h.className="rte-inserted-image",h.contentEditable="true";const E=D();if(!w||!E){E==null||E.appendChild(h);const Ie=document.createTextNode(" ");E==null||E.appendChild(Ie);const ve=document.createRange();ve.setStartAfter(Ie),ve.collapse(!0),c==null||c.removeAllRanges(),c==null||c.addRange(ve),E==null||E.focus(),z(),e.target.value="";return}w.deleteContents(),w.insertNode(h);const v=document.createTextNode(" ");h.after(v);const S=document.createRange();S.setStartAfter(v),S.collapse(!0),c.removeAllRanges(),c.addRange(S),E.focus(),z(),e.target.value=""},o.readAsDataURL(r)},oe=e=>{var g;Y();const r=window.getSelection();if(!(r!=null&&r.rangeCount))return;const o=r.getRangeAt(0),l=document.createTextNode(e);o.insertNode(l),o.setStartAfter(l),o.collapse(!0),r.removeAllRanges(),r.addRange(o),(g=D())==null||g.focus(),z()},pe=()=>{Y();const e=document.createElement("table");e.style.borderCollapse="collapse",e.style.width="100%",e.style.border="1px solid #ccc",e.style.margin="8px 0",e.style.position="relative";const r=document.createElement("thead"),o=document.createElement("tbody"),l=document.createElement("tr"),g=document.createElement("tr");for(let w=0;w<2;w++){const h=document.createElement("th");h.textContent=`Header ${w+1}`,h.style.border="1px solid #999",h.style.padding="8px",h.style.position="relative";const E=document.createElement("td");E.textContent=`Row 1 Col ${w+1}`,E.style.border="1px solid #999",E.style.padding="8px",E.style.position="relative",ge(h),ge(E),l.appendChild(h),g.appendChild(E)}r.appendChild(l),o.appendChild(g),e.appendChild(r),e.appendChild(o),Ct(e),wt(e);const s=window.getSelection();if(!(s!=null&&s.rangeCount))return;s.getRangeAt(0).insertNode(e),z()},wt=e=>{const r=document.createElement("div");Object.assign(r.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"});let o=0,l=0,g=0,s=0;r.addEventListener("mousedown",c=>{c.preventDefault(),o=c.clientX,l=c.clientY;const w=e.getBoundingClientRect();g=w.width,s=w.height;const h=v=>{const S=Math.max(100,g+(v.clientX-o)),H=Math.max(60,s+(v.clientY-l));e.style.width=`${S}px`,e.style.height=`${H}px`,z()},E=()=>{document.removeEventListener("mousemove",h),document.removeEventListener("mouseup",E),z()};document.addEventListener("mousemove",h),document.addEventListener("mouseup",E)}),e.appendChild(r)},ge=e=>{const r=document.createElement("div"),o=document.createElement("div");Object.assign(r.style,{position:"absolute",right:"0",top:"0",width:"6px",height:"100%",cursor:"col-resize",background:"rgba(0,0,0,0.15)",zIndex:"10"}),Object.assign(o.style,{position:"absolute",bottom:"0",left:"0",width:"100%",height:"6px",cursor:"row-resize",background:"rgba(0,0,0,0.15)",zIndex:"10"}),bt(e,r,o),e.appendChild(r),e.appendChild(o)},bt=(e,r,o)=>{let l=0,g=0,s=0,c=0;r.addEventListener("mousedown",v=>{v.preventDefault(),l=v.clientX,s=e.offsetWidth,document.addEventListener("mousemove",w),document.addEventListener("mouseup",E)}),o.addEventListener("mousedown",v=>{v.preventDefault(),g=v.clientY,c=e.offsetHeight,document.addEventListener("mousemove",h),document.addEventListener("mouseup",E)});const w=v=>{const S=s+(v.clientX-l);e.style.width=`${Math.max(30,S)}px`},h=v=>{const S=c+(v.clientY-g);e.style.height=`${Math.max(20,S)}px`},E=()=>{document.removeEventListener("mousemove",w),document.removeEventListener("mousemove",h),document.removeEventListener("mouseup",E)}},yt=e=>{const o=e.target.closest("td, th");o&&(e.preventDefault(),document.querySelectorAll(".rte-cell-highlight").forEach(l=>l.classList.remove("rte-cell-highlight")),o.classList.add("rte-cell-highlight"),U({visible:!0,x:e.clientX,y:e.clientY,cell:o}))},Le=()=>{document.querySelectorAll(".rte-cell-highlight").forEach(e=>e.classList.remove("rte-cell-highlight"))},Et=e=>{if(!B.cell)return;const r=B.cell.closest("table"),o=B.cell.cellIndex,l=B.cell.parentElement.rowIndex,g=s=>{const c=s.tagName.toLowerCase(),w=document.createElement(c);return w.textContent=s.textContent||"",w.style.cssText=s.style.cssText,ge(w),w};switch(e){case"insertRowAbove":{const s=r.rows[l],c=r.insertRow(l);Array.from(s.cells).forEach(w=>{c.appendChild(g(w))});break}case"insertRowBelow":{const s=r.rows[l],c=r.insertRow(l+1);Array.from(s.cells).forEach(w=>{c.appendChild(g(w))});break}case"insertColLeft":{Array.from(r.rows).forEach(s=>{const c=s.cells[o];s.insertBefore(g(c),c)});break}case"insertColRight":{Array.from(r.rows).forEach(s=>{const c=s.cells[o];s.insertBefore(g(c),c.nextSibling)});break}case"deleteRow":r.rows.length>1&&r.deleteRow(l);break;case"deleteCol":Array.from(r.rows).forEach(s=>{s.cells[o]&&s.deleteCell(o)});break}z(),U(we(xe({},B),{visible:!1})),Le()},Ct=e=>{const r=e.querySelector("tbody");if(!r||r.querySelector("[data-hidden-table-start]"))return;const o=document.createElement("span");o.textContent="{{#tableData}}",o.style.display="none",o.setAttribute("data-hidden-table-start","true"),r.insertBefore(o,r.firstChild);const l=document.createElement("span");l.textContent="{{/tableData}}",l.style.display="none",l.setAttribute("data-hidden-table-end","true"),r.appendChild(l)},Me=()=>{const e=D();if(!e)return y;const r=e.cloneNode(!0);return r.querySelectorAll(".rte-cell-highlight").forEach(o=>{o.classList.remove("rte-cell-highlight")}),r.querySelectorAll("div").forEach(o=>{(o.style.cursor==="col-resize"||o.style.cursor==="row-resize"||o.style.cursor==="nwse-resize")&&o.remove()}),r.innerHTML},jt=()=>{ue(),C.current=O.current,ie({url:"",text:"",title:"",target:"_self"}),p(!0)},Rt=e=>{const r=window.getSelection();if(!r||!C.current)return;r.removeAllRanges(),r.addRange(C.current);let o=e.url.trim();/^https?:\/\//i.test(o)||(o="https://"+o);const l=document.createElement("a");l.href=o,l.style.cursor="pointer",l.style.outline="none",l.textContent=e.text||o,l.title=e.title,l.target=e.target,l.contentEditable="true";const g=r.getRangeAt(0);g.deleteContents(),g.insertNode(l);const s=document.createTextNode(" ");l.after(s);const c=document.createRange();c.setStartAfter(s),c.collapse(!0),r.removeAllRanges(),r.addRange(c),p(!1),z()},St=e=>{const r=e.target;if(r.tagName==="A"){const o=r;if(e.ctrlKey||e.metaKey){window.open(o.href,"_blank","noopener,noreferrer");return}e.preventDefault();const l=document.createRange();l.selectNode(o),C.current=l,ie({url:o.href,text:o.textContent||o.href,title:o.title,target:o.target}),p(!0)}},Tt=()=>{const e=D();if(!e)return;const r=window.getSelection();if((!r||r.rangeCount===0)&&O.current){const v=window.getSelection();v==null||v.removeAllRanges(),v==null||v.addRange(O.current)}const o=window.getSelection();if(!o||o.rangeCount===0)return;const l=o.getRangeAt(0);Y(),document.execCommand("removeFormat",!1);const g=l.cloneContents(),s=document.createElement("div");s.appendChild(g);const c=document.createTreeWalker(s,NodeFilter.SHOW_ELEMENT,null),w=[];for(;c.nextNode();){const v=c.currentNode,S=v.tagName.toUpperCase(),H=v.getAttribute&&v.getAttribute("data-mention")!==null;S!=="A"&&!H&&w.push(v)}for(let v=w.length-1;v>=0;v--){const S=w[v],H=S.parentNode;if(H){for(;S.firstChild;)H.insertBefore(S.firstChild,S);H.removeChild(S)}}s.querySelectorAll("[style]").forEach(v=>v.removeAttribute("style")),l.deleteContents();const h=document.createDocumentFragment();for(;s.firstChild;)h.appendChild(s.firstChild);l.insertNode(h);const E=document.createRange();E.setStartAfter(l.endContainer.nodeType===Node.TEXT_NODE?l.endContainer:l.startContainer),E.collapse(!0),o.removeAllRanges(),o.addRange(E),e.normalize(),z()};return a.jsxs("div",{className:`rte-wrapper ${(m==null?void 0:m.wrapper)||""}`,style:b.wrapper,children:[a.jsxs("div",{style:{flex:1},children:[a.jsx(Te,{exec:n,saveSelection:ue,handleFileChange:q,handleFontSizeChange:e=>n("fontSize",e.target.value),handleFontFamilyChange:e=>n("fontName",e.target.value),insertEmoji:oe,handleLink:jt,removeFormatting:Tt,visibleActions:ee,className:m.toolbar,style:b.toolbar}),a.jsx("div",{ref:j,className:`rte-editor ${(m==null?void 0:m.editor)||""}`,style:b.editor,contentEditable:!0,suppressContentEditableWarning:!0,onInput:k,onKeyDown:K,onBeforeInput:re,onContextMenu:yt,onClick:St}),a.jsx(pt,{show:F,position:I,filtered:X,insertMention:L,onClose:()=>M(!1),query:he}),i&&a.jsxs("div",{className:`rte-output ${(m==null?void 0:m.output)||""}`,style:b.output,children:[a.jsx("h4",{children:"Output HTML:"}),a.jsx("p",{children:y})]}),a.jsx(gt,{visible:B.visible,x:B.x,y:B.y,onAction:Et,onClose:()=>{U(we(xe({},B),{visible:!1})),Le()}}),a.jsx(vt,{visible:Z,linkData:J,onClose:()=>p(!1),onInsert:Rt})]}),d?a.jsx(ke,{className:m.preview,style:b.preview,html:Me()}):null]})};A.RichTextEditor=xt,A.RtePreview=ke,A.RteToolbar=Te,Object.defineProperty(A,Symbol.toStringTag,{value:"Module"})}));
|
package/dist/richtexteditor.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
*{box-sizing:border-box;margin:0}.rte-wrapper{font-family:Inter,system-ui,sans-serif;display:flex;flex-grow:1;flex-direction:row;min-height:400px;min-width:400px;gap:12px;padding:12px;background:#fff;overflow:hidden}.rte-wrapper>div:first-child{display:flex;flex-direction:column;flex:2;min-width:0;min-height:0;gap:8px;overflow:hidden}.rte-toolbar{position:static!important;overflow:visible!important;flex-shrink:0;display:flex;flex-wrap:wrap;align-items:center;gap:10px;background:#fafafa;padding:8px;border:1px solid #eee;border-radius:6px;overflow-y:auto;max-height:140px
|
|
1
|
+
*{box-sizing:border-box;margin:0}.rte-wrapper{font-family:Inter,system-ui,sans-serif;display:flex;flex-grow:1;flex-direction:row;min-height:400px;min-width:400px;gap:12px;padding:12px;background:#fff;overflow:hidden}.rte-wrapper>div:first-child{display:flex;flex-direction:column;flex:2;min-width:0;min-height:0;gap:8px;overflow:hidden}.rte-toolbar{position:static!important;overflow:visible!important;flex-shrink:0;display:flex;flex-wrap:wrap;align-items:center;gap:10px;background:#fafafa;padding:8px;border:1px solid #eee;border-radius:6px;overflow-y:auto;max-height:140px;user-select:none}.rte-dropdown{padding:4px 8px;border-radius:4px;border:1px solid #ccc;font-size:12px;background:#fff;cursor:pointer}.rte-toolbar button{padding:6px;border:1px solid transparent;background:none;cursor:pointer}.rte-toolbar button:hover{color:#00f}.rte-toolbar button[title=Emoji]{color:#ff0;fill:#000;background:none;font-size:18px;display:inline-flex;align-items:center;justify-content:center;border:none}.rte-toolbar button[title=Emoji] svg{background-color:#000;border-radius:50%;display:block}.rte-toolbar button[title=removeFormat]{font-size:16px}.rte-toolbar *{user-select:none;pointer-events:auto}.rte-editor{flex:1 1 auto;min-height:0;padding:12px;outline:none;border:1px solid lightgray;border-radius:4px;background:#fff;overflow-y:auto}.rte-output{flex-shrink:0;height:20%;background:#f7f7f7;border:1px solid lightgray;border-radius:4px;padding:10px;overflow-y:auto;min-height:100px}.rte-output h4{margin-bottom:6px;font-size:14px}.rte-preview{flex:1;border:1px solid #ccc;border-radius:4px;background:#fff;padding:10px;overflow-y:auto;min-width:200px;min-height:200px}table{border-collapse:collapse;width:100%;border:1px solid #ccc}th,td{border:1px solid #ccc;background:#fff;padding:6px;min-width:60px;position:relative}th{background-color:#d3d3d3}th div,td div{border:none!important;background:transparent!important;padding:0;margin:0}.rte-cell-highlight{outline:2px solid #007bff;outline-offset:-2px;background-color:#007bff1a;z-index:2}.rte-popup{position:absolute;padding:4px 0;background-color:#fff;border:1px solid lightgray;border-radius:4px;box-shadow:0 2px 6px #0000001a;list-style:none;margin:0;z-index:1000;max-height:250px;overflow-y:auto;width:fit-content}.rte-emoji-popup{position:absolute;top:130%;left:25%;background:#fff;border:1px solid #ccc;border-radius:8px;padding:8px;width:260px;height:200px;overflow-y:auto;display:grid;grid-template-columns:repeat(6,1fr);gap:4px;z-index:10000;box-shadow:0 4px 8px #00000026}.rte-table-menu{position:absolute;display:flex;flex-direction:column;align-items:baseline;gap:4px;background:#fff;border:1px solid #ccc;box-shadow:0 2px 6px #00000026;z-index:999;padding:4px}.rte-table-menu button{display:flex;align-items:end;gap:4px;padding:6px;border:1px solid transparent;background:none;cursor:pointer}.rte-table-menu button:hover{color:#00f}.rte-link-modal-overlay{position:fixed;top:0;left:0;width:100vw;height:100vh;background:#0006;z-index:9999;backdrop-filter:blur(1px)}.rte-link-modal{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);background:#fff;border:1px solid #ccc;border-radius:6px;box-shadow:0 4px 8px #0003;padding:16px;width:320px;z-index:10000;animation:fadeIn .2s ease-in-out}.rte-link-modal__title{margin-bottom:8px;font-size:16px;font-weight:600;text-align:center}.rte-link-modal__input,.rte-link-modal__select{width:100%;padding:6px 8px;margin-bottom:8px;border:1px solid #ccc;border-radius:4px;font-size:14px}.rte-link-modal__input:focus,.rte-link-modal__select:focus{border-color:#007bff;outline:none}.rte-link-modal__actions{display:flex;justify-content:flex-end;gap:8px}.rte-link-modal__btn{padding:6px 12px;border:none;border-radius:4px;font-size:14px;cursor:pointer}.rte-link-modal__btn:hover{opacity:.9}.rte-link-modal__btn--ok{background:#007bff;color:#fff}@keyframes fadeIn{0%{opacity:0;transform:translate(-50%,-48%)}to{opacity:1;transform:translate(-50%,-50%)}}.rte-toolbar{border:1px solid #e0e0e0;transition:box-shadow .2s ease}.rte-toolbar button:hover{background:#eef3ff;border-radius:6px;color:#007bff;transform:translateY(-2px);transition:all .2s ease}.rte-editor{border:1px solid #ddd;border-radius:2px;background:#fcfcfc;padding:16px;line-height:1.6;font-size:15px;transition:all .2s ease}.rte-editor:focus{border-color:#007bff;background:#fff}.rte-output{border:1px solid #e5e8ec;font-family:monospace;font-size:13px;color:#333}.rte-preview{background:#fff;border:1px solid #e5e5e5;border-radius:10px;box-shadow:0 2px 6px #0000000d;padding:16px}.rte-emoji-popup{background:#fff;box-shadow:0 4px 12px #00000026;padding:10px;width:280px;grid-template-columns:repeat(7,1fr);gap:6px}.rte-emoji-popup span{font-size:22px;cursor:pointer;transition:transform .15s ease}.rte-emoji-popup span:hover{transform:scale(1.3)}.rte-inserted-image{max-width:100%;height:200px;width:fit-content;object-fit:cover;border-radius:6px;display:inline-block;vertical-align:middle;box-shadow:0 1px 4px #0000000f;transition:box-shadow .15s ease,transform .15s ease;cursor:pointer;position:relative}.rte-inserted-image:hover{box-shadow:0 4px 14px #0000001f;transform:translateY(-1px)}.rte-highlight{color:#007bff;font-weight:700;font-weight:600}
|