@anilkumarteach/editor-ak 0.1.0 → 0.1.2

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/README.md CHANGED
@@ -1,73 +1,114 @@
1
- # Welcome to your Lovable project
1
+ # @anilkumarteach/editor-ak
2
2
 
3
- ## Project info
3
+ A modern **Rich Text Editor for React**, built with **TypeScript** and **Vite**.
4
+ This package exposes a **single, clean component**: `<RichTextEditor />`.
4
5
 
5
- **URL**: https://lovable.dev/projects/REPLACE_WITH_PROJECT_ID
6
+ It is designed to be easy to install, simple to use, and production-ready.
6
7
 
7
- ## How can I edit this code?
8
+ ---
8
9
 
9
- There are several ways of editing your application.
10
+ ## 📌 What is this package?
10
11
 
11
- **Use Lovable**
12
+ `@anilkumarteach/editor-ak` provides a ready-to-use rich text editor that you can plug into any React app without configuring complex editor logic.
12
13
 
13
- Simply visit the [Lovable Project](https://lovable.dev/projects/REPLACE_WITH_PROJECT_ID) and start prompting.
14
+ You only import **one component** and start using it.
14
15
 
15
- Changes made via Lovable will be committed automatically to this repo.
16
+ ---
16
17
 
17
- **Use your preferred IDE**
18
+ ## Features (Step by Step)
18
19
 
19
- If you want to work locally using your own IDE, you can clone this repo and push changes. Pushed changes will also be reflected in Lovable.
20
+ ### 1️⃣ Rich Text Editing
21
+ - Write and edit formatted text
22
+ - Supports paragraphs and headings
23
+ - Clean HTML output
20
24
 
21
- The only requirement is having Node.js & npm installed - [install with nvm](https://github.com/nvm-sh/nvm#installing-and-updating)
25
+ ---
22
26
 
23
- Follow these steps:
27
+ ### 2️⃣ Formatting Toolbar
28
+ - Bold, italic, underline formatting
29
+ - Heading selection (H1–H6)
30
+ - Context-aware toolbar
24
31
 
25
- ```sh
26
- # Step 1: Clone the repository using the project's Git URL.
27
- git clone <YOUR_GIT_URL>
32
+ ---
28
33
 
29
- # Step 2: Navigate to the project directory.
30
- cd <YOUR_PROJECT_NAME>
34
+ ### 3️⃣ Links
35
+ - Add and edit links
36
+ - Link dialog with validation
37
+ - Safe URL handling
31
38
 
32
- # Step 3: Install the necessary dependencies.
33
- npm i
39
+ ---
34
40
 
35
- # Step 4: Start the development server with auto-reloading and an instant preview.
36
- npm run dev
37
- ```
41
+ ### 4️⃣ Images
42
+ - Image upload support
43
+ - Resizable images
44
+ - Image alignment controls
38
45
 
39
- **Edit a file directly in GitHub**
46
+ ---
40
47
 
41
- - Navigate to the desired file(s).
42
- - Click the "Edit" button (pencil icon) at the top right of the file view.
43
- - Make your changes and commit the changes.
48
+ ### 5️⃣ Tables
49
+ - Insert tables
50
+ - Add / remove rows and columns
51
+ - Table-specific controls
44
52
 
45
- **Use GitHub Codespaces**
53
+ ---
46
54
 
47
- - Navigate to the main page of your repository.
48
- - Click on the "Code" button (green button) near the top right.
49
- - Select the "Codespaces" tab.
50
- - Click on "New codespace" to launch a new Codespace environment.
51
- - Edit files directly within the Codespace and commit and push your changes once you're done.
55
+ ### 6️⃣ Autosave
56
+ - Automatically saves content
57
+ - Prevents data loss
58
+ - Runs internally (no setup required)
52
59
 
53
- ## What technologies are used for this project?
60
+ ---
54
61
 
55
- This project is built with:
62
+ ### 7️⃣ Undo / Redo History
63
+ - Editor version history
64
+ - Safe undo and redo actions
56
65
 
57
- - Vite
58
- - TypeScript
59
- - React
60
- - shadcn-ui
61
- - Tailwind CSS
66
+ ---
62
67
 
63
- ## How can I deploy this project?
68
+ ### 8️⃣ Markdown Shortcuts
69
+ - Faster writing using keyboard shortcuts
70
+ - Markdown-style formatting support
64
71
 
65
- Simply open [Lovable](https://lovable.dev/projects/REPLACE_WITH_PROJECT_ID) and click on Share -> Publish.
72
+ ---
66
73
 
67
- ## Can I connect a custom domain to my Lovable project?
74
+ ### 9️⃣ Responsive Design
75
+ - Works on desktop and mobile
76
+ - Touch-friendly UI
68
77
 
69
- Yes, you can!
78
+ ---
70
79
 
71
- To connect a domain, navigate to Project > Settings > Domains and click Connect Domain.
80
+ ### 🔒 Clean API Design
81
+ - Only **one public component**
82
+ - All complex logic is internal
83
+ - Easy to maintain and upgrade
72
84
 
73
- Read more here: [Setting up a custom domain](https://docs.lovable.dev/features/custom-domain#custom-domain)
85
+ ---
86
+
87
+ ## 📦 Installation
88
+
89
+ Install the package using npm:
90
+
91
+ ```bash
92
+ npm install @anilkumarteach/editor-ak
93
+
94
+ or with yarn:
95
+
96
+ yarn add @anilkumarteach/editor-ak
97
+
98
+
99
+ import "@anilkumarteach/editor-ak/dist/index.css";
100
+
101
+
102
+
103
+ import { RichTextEditor } from "@anilkumarteach/editor-ak";
104
+ import "@anilkumarteach/editor-ak/dist/index.css";
105
+
106
+ function App() {
107
+ return (
108
+ <div style={{ padding: "20px" }}>
109
+ <RichTextEditor />
110
+ </div>
111
+ );
112
+ }
113
+
114
+ export default App;
package/dist/index.cjs ADDED
@@ -0,0 +1,126 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react");var Te={exports:{}},ge={};var lt;function Ht(){if(lt)return ge;lt=1;var r=o,n=Symbol.for("react.element"),u=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,l=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,d={key:!0,ref:!0,__self:!0,__source:!0};function c(h,b,p){var x,y={},g=null,m=null;p!==void 0&&(g=""+p),b.key!==void 0&&(g=""+b.key),b.ref!==void 0&&(m=b.ref);for(x in b)s.call(b,x)&&!d.hasOwnProperty(x)&&(y[x]=b[x]);if(h&&h.defaultProps)for(x in b=h.defaultProps,b)y[x]===void 0&&(y[x]=b[x]);return{$$typeof:n,type:h,key:g,ref:m,props:y,_owner:l.current}}return ge.Fragment=u,ge.jsx=c,ge.jsxs=c,ge}var be={};var ct;function Bt(){return ct||(ct=1,process.env.NODE_ENV!=="production"&&(function(){var r=o,n=Symbol.for("react.element"),u=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),d=Symbol.for("react.profiler"),c=Symbol.for("react.provider"),h=Symbol.for("react.context"),b=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),x=Symbol.for("react.suspense_list"),y=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),m=Symbol.for("react.offscreen"),j=Symbol.iterator,N="@@iterator";function M(t){if(t===null||typeof t!="object")return null;var i=j&&t[j]||t[N];return typeof i=="function"?i:null}var R=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function I(t){{for(var i=arguments.length,f=new Array(i>1?i-1:0),k=1;k<i;k++)f[k-1]=arguments[k];X("error",t,f)}}function X(t,i,f){{var k=R.ReactDebugCurrentFrame,T=k.getStackAddendum();T!==""&&(i+="%s",f=f.concat([T]));var $=f.map(function(S){return String(S)});$.unshift("Warning: "+i),Function.prototype.apply.call(console[t],console,$)}}var E=!1,F=!1,D=!1,se=!1,ee=!1,ve;ve=Symbol.for("react.module.reference");function Ie(t){return!!(typeof t=="string"||typeof t=="function"||t===s||t===d||ee||t===l||t===p||t===x||se||t===m||E||F||D||typeof t=="object"&&t!==null&&(t.$$typeof===g||t.$$typeof===y||t.$$typeof===c||t.$$typeof===h||t.$$typeof===b||t.$$typeof===ve||t.getModuleId!==void 0))}function je(t,i,f){var k=t.displayName;if(k)return k;var T=i.displayName||i.name||"";return T!==""?f+"("+T+")":f}function H(t){return t.displayName||"Context"}function K(t){if(t==null)return null;if(typeof t.tag=="number"&&I("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case s:return"Fragment";case u:return"Portal";case d:return"Profiler";case l:return"StrictMode";case p:return"Suspense";case x:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case h:var i=t;return H(i)+".Consumer";case c:var f=t;return H(f._context)+".Provider";case b:return je(t,t.render,"ForwardRef");case y:var k=t.displayName||null;return k!==null?k:K(t.type)||"Memo";case g:{var T=t,$=T._payload,S=T._init;try{return K(S($))}catch{return null}}}return null}var J=Object.assign,Q=0,ke,ye,ue,we,Ce,Ne,B;function q(){}q.__reactDisabledLog=!0;function De(){{if(Q===0){ke=console.log,ye=console.info,ue=console.warn,we=console.error,Ce=console.group,Ne=console.groupCollapsed,B=console.groupEnd;var t={configurable:!0,enumerable:!0,value:q,writable:!0};Object.defineProperties(console,{info:t,log:t,warn:t,error:t,group:t,groupCollapsed:t,groupEnd:t})}Q++}}function Oe(){{if(Q--,Q===0){var t={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:J({},t,{value:ke}),info:J({},t,{value:ye}),warn:J({},t,{value:ue}),error:J({},t,{value:we}),group:J({},t,{value:Ce}),groupCollapsed:J({},t,{value:Ne}),groupEnd:J({},t,{value:B})})}Q<0&&I("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var fe=R.ReactCurrentDispatcher,me;function G(t,i,f){{if(me===void 0)try{throw Error()}catch(T){var k=T.stack.trim().match(/\n( *(at )?)/);me=k&&k[1]||""}return`
2
+ `+me+t}}var he=!1,Z;{var Pe=typeof WeakMap=="function"?WeakMap:Map;Z=new Pe}function oe(t,i){if(!t||he)return"";{var f=Z.get(t);if(f!==void 0)return f}var k;he=!0;var T=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var $;$=fe.current,fe.current=null,De();try{if(i){var S=function(){throw Error()};if(Object.defineProperty(S.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(S,[])}catch(U){k=U}Reflect.construct(t,[],S)}else{try{S.call()}catch(U){k=U}t.call(S.prototype)}}else{try{throw Error()}catch(U){k=U}t()}}catch(U){if(U&&k&&typeof U.stack=="string"){for(var C=U.stack.split(`
3
+ `),V=k.stack.split(`
4
+ `),O=C.length-1,P=V.length-1;O>=1&&P>=0&&C[O]!==V[P];)P--;for(;O>=1&&P>=0;O--,P--)if(C[O]!==V[P]){if(O!==1||P!==1)do if(O--,P--,P<0||C[O]!==V[P]){var Y=`
5
+ `+C[O].replace(" at new "," at ");return t.displayName&&Y.includes("<anonymous>")&&(Y=Y.replace("<anonymous>",t.displayName)),typeof t=="function"&&Z.set(t,Y),Y}while(O>=1&&P>=0);break}}}finally{he=!1,fe.current=$,Oe(),Error.prepareStackTrace=T}var de=t?t.displayName||t.name:"",re=de?G(de):"";return typeof t=="function"&&Z.set(t,re),re}function pe(t,i,f){return oe(t,!1)}function ae(t){var i=t.prototype;return!!(i&&i.isReactComponent)}function ie(t,i,f){if(t==null)return"";if(typeof t=="function")return oe(t,ae(t));if(typeof t=="string")return G(t);switch(t){case p:return G("Suspense");case x:return G("SuspenseList")}if(typeof t=="object")switch(t.$$typeof){case b:return pe(t.render);case y:return ie(t.type,i,f);case g:{var k=t,T=k._payload,$=k._init;try{return ie($(T),i,f)}catch{}}}return""}var te=Object.prototype.hasOwnProperty,Le={},Se=R.ReactDebugCurrentFrame;function le(t){if(t){var i=t._owner,f=ie(t.type,t._source,i?i.type:null);Se.setExtraStackFrame(f)}else Se.setExtraStackFrame(null)}function Ae(t,i,f,k,T){{var $=Function.call.bind(te);for(var S in t)if($(t,S)){var C=void 0;try{if(typeof t[S]!="function"){var V=Error((k||"React class")+": "+f+" type `"+S+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof t[S]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw V.name="Invariant Violation",V}C=t[S](i,S,k,f,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(O){C=O}C&&!(C instanceof Error)&&(le(T),I("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",k||"React class",f,S,typeof C),le(null)),C instanceof Error&&!(C.message in Le)&&(Le[C.message]=!0,le(T),I("Failed %s type: %s",f,C.message),le(null))}}}var He=Array.isArray;function xe(t){return He(t)}function Be(t){{var i=typeof Symbol=="function"&&Symbol.toStringTag,f=i&&t[Symbol.toStringTag]||t.constructor.name||"Object";return f}}function a(t){try{return w(t),!1}catch{return!0}}function w(t){return""+t}function L(t){if(a(t))return I("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Be(t)),w(t)}var v=R.ReactCurrentOwner,_={key:!0,ref:!0,__self:!0,__source:!0},W,z;function We(t){if(te.call(t,"ref")){var i=Object.getOwnPropertyDescriptor(t,"ref").get;if(i&&i.isReactWarning)return!1}return t.ref!==void 0}function Ve(t){if(te.call(t,"key")){var i=Object.getOwnPropertyDescriptor(t,"key").get;if(i&&i.isReactWarning)return!1}return t.key!==void 0}function Fe(t,i){typeof t.ref=="string"&&v.current}function Ue(t,i){{var f=function(){W||(W=!0,I("%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://reactjs.org/link/special-props)",i))};f.isReactWarning=!0,Object.defineProperty(t,"key",{get:f,configurable:!0})}}function Re(t,i){{var f=function(){z||(z=!0,I("%s: `ref` 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://reactjs.org/link/special-props)",i))};f.isReactWarning=!0,Object.defineProperty(t,"ref",{get:f,configurable:!0})}}var Ee=function(t,i,f,k,T,$,S){var C={$$typeof:n,type:t,key:i,ref:f,props:S,_owner:$};return C._store={},Object.defineProperty(C._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(C,"_self",{configurable:!1,enumerable:!1,writable:!1,value:k}),Object.defineProperty(C,"_source",{configurable:!1,enumerable:!1,writable:!1,value:T}),Object.freeze&&(Object.freeze(C.props),Object.freeze(C)),C};function Rt(t,i,f,k,T){{var $,S={},C=null,V=null;f!==void 0&&(L(f),C=""+f),Ve(i)&&(L(i.key),C=""+i.key),We(i)&&(V=i.ref,Fe(i,T));for($ in i)te.call(i,$)&&!_.hasOwnProperty($)&&(S[$]=i[$]);if(t&&t.defaultProps){var O=t.defaultProps;for($ in O)S[$]===void 0&&(S[$]=O[$])}if(C||V){var P=typeof t=="function"?t.displayName||t.name||"Unknown":t;C&&Ue(S,P),V&&Re(S,P)}return Ee(t,C,V,T,k,v.current,S)}}var qe=R.ReactCurrentOwner,tt=R.ReactDebugCurrentFrame;function ce(t){if(t){var i=t._owner,f=ie(t.type,t._source,i?i.type:null);tt.setExtraStackFrame(f)}else tt.setExtraStackFrame(null)}var ze;ze=!1;function Ye(t){return typeof t=="object"&&t!==null&&t.$$typeof===n}function rt(){{if(qe.current){var t=K(qe.current.type);if(t)return`
6
+
7
+ Check the render method of \``+t+"`."}return""}}function Et(t){return""}var nt={};function Tt(t){{var i=rt();if(!i){var f=typeof t=="string"?t:t.displayName||t.name;f&&(i=`
8
+
9
+ Check the top-level render call using <`+f+">.")}return i}}function st(t,i){{if(!t._store||t._store.validated||t.key!=null)return;t._store.validated=!0;var f=Tt(i);if(nt[f])return;nt[f]=!0;var k="";t&&t._owner&&t._owner!==qe.current&&(k=" It was passed a child from "+K(t._owner.type)+"."),ce(t),I('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',f,k),ce(null)}}function ot(t,i){{if(typeof t!="object")return;if(xe(t))for(var f=0;f<t.length;f++){var k=t[f];Ye(k)&&st(k,i)}else if(Ye(t))t._store&&(t._store.validated=!0);else if(t){var T=M(t);if(typeof T=="function"&&T!==t.entries)for(var $=T.call(t),S;!(S=$.next()).done;)Ye(S.value)&&st(S.value,i)}}}function _t(t){{var i=t.type;if(i==null||typeof i=="string")return;var f;if(typeof i=="function")f=i.propTypes;else if(typeof i=="object"&&(i.$$typeof===b||i.$$typeof===y))f=i.propTypes;else return;if(f){var k=K(i);Ae(f,t.props,"prop",k,t)}else if(i.PropTypes!==void 0&&!ze){ze=!0;var T=K(i);I("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",T||"Unknown")}typeof i.getDefaultProps=="function"&&!i.getDefaultProps.isReactClassApproved&&I("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Mt(t){{for(var i=Object.keys(t.props),f=0;f<i.length;f++){var k=i[f];if(k!=="children"&&k!=="key"){ce(t),I("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",k),ce(null);break}}t.ref!==null&&(ce(t),I("Invalid attribute `ref` supplied to `React.Fragment`."),ce(null))}}var at={};function it(t,i,f,k,T,$){{var S=Ie(t);if(!S){var C="";(t===void 0||typeof t=="object"&&t!==null&&Object.keys(t).length===0)&&(C+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var V=Et();V?C+=V:C+=rt();var O;t===null?O="null":xe(t)?O="array":t!==void 0&&t.$$typeof===n?(O="<"+(K(t.type)||"Unknown")+" />",C=" Did you accidentally export a JSX literal instead of a component?"):O=typeof t,I("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",O,C)}var P=Rt(t,i,f,T,$);if(P==null)return P;if(S){var Y=i.children;if(Y!==void 0)if(k)if(xe(Y)){for(var de=0;de<Y.length;de++)ot(Y[de],t);Object.freeze&&Object.freeze(Y)}else I("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 ot(Y,t)}if(te.call(i,"key")){var re=K(t),U=Object.keys(i).filter(function(At){return At!=="key"}),Je=U.length>0?"{key: someKey, "+U.join(": ..., ")+": ...}":"{key: someKey}";if(!at[re+Je]){var Pt=U.length>0?"{"+U.join(": ..., ")+": ...}":"{}";I(`A props object containing a "key" prop is being spread into JSX:
10
+ let props = %s;
11
+ <%s {...props} />
12
+ React keys must be passed directly to JSX without using spread:
13
+ let props = %s;
14
+ <%s key={someKey} {...props} />`,Je,re,Pt,re),at[re+Je]=!0}}return t===s?Mt(P):_t(P),P}}function $t(t,i,f){return it(t,i,f,!0)}function It(t,i,f){return it(t,i,f,!1)}var Dt=It,Ot=$t;be.Fragment=s,be.jsx=Dt,be.jsxs=Ot})()),be}var dt;function Wt(){return dt||(dt=1,process.env.NODE_ENV==="production"?Te.exports=Ht():Te.exports=Bt()),Te.exports}var e=Wt();const ht=({className:r="w-4 h-4"})=>e.jsxs("svg",{className:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M6 4h8a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z"}),e.jsx("path",{d:"M6 12h9a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z"})]}),pt=({className:r="w-4 h-4"})=>e.jsxs("svg",{className:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("line",{x1:"19",y1:"4",x2:"10",y2:"4"}),e.jsx("line",{x1:"14",y1:"20",x2:"5",y2:"20"}),e.jsx("line",{x1:"15",y1:"4",x2:"9",y2:"20"})]}),xt=({className:r="w-4 h-4"})=>e.jsxs("svg",{className:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M6 4v6a6 6 0 0 0 12 0V4"}),e.jsx("line",{x1:"4",y1:"20",x2:"20",y2:"20"})]}),gt=({className:r="w-4 h-4"})=>e.jsxs("svg",{className:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M16 4H9a3 3 0 0 0-2.83 4"}),e.jsx("path",{d:"M14 12a4 4 0 0 1 0 8H6"}),e.jsx("line",{x1:"4",y1:"12",x2:"20",y2:"12"})]}),bt=({className:r="w-4 h-4"})=>e.jsxs("svg",{className:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("line",{x1:"8",y1:"6",x2:"21",y2:"6"}),e.jsx("line",{x1:"8",y1:"12",x2:"21",y2:"12"}),e.jsx("line",{x1:"8",y1:"18",x2:"21",y2:"18"}),e.jsx("line",{x1:"3",y1:"6",x2:"3.01",y2:"6"}),e.jsx("line",{x1:"3",y1:"12",x2:"3.01",y2:"12"}),e.jsx("line",{x1:"3",y1:"18",x2:"3.01",y2:"18"})]}),vt=({className:r="w-4 h-4"})=>e.jsxs("svg",{className:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("line",{x1:"10",y1:"6",x2:"21",y2:"6"}),e.jsx("line",{x1:"10",y1:"12",x2:"21",y2:"12"}),e.jsx("line",{x1:"10",y1:"18",x2:"21",y2:"18"}),e.jsx("path",{d:"M4 6h1v4"}),e.jsx("path",{d:"M4 10h2"}),e.jsx("path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1"})]}),jt=({className:r="w-4 h-4"})=>e.jsxs("svg",{className:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("polyline",{points:"9 11 12 14 22 4"}),e.jsx("path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"})]}),kt=({className:r="w-4 h-4"})=>e.jsxs("svg",{className:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M3 21c3 0 7-1 7-8V5c0-1.25-.756-2.017-2-2H4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2 1 0 1 0 1 1v1c0 1-1 2-2 2s-1 .008-1 1.031V21z"}),e.jsx("path",{d:"M15 21c3 0 7-1 7-8V5c0-1.25-.757-2.017-2-2h-4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2h.75c0 2.25.25 4-2.75 4v4z"})]}),Me=({className:r="w-4 h-4"})=>e.jsxs("svg",{className:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("polyline",{points:"16 18 22 12 16 6"}),e.jsx("polyline",{points:"8 6 2 12 8 18"})]}),yt=({className:r="w-4 h-4"})=>e.jsx("svg",{className:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})}),$e=({className:r="w-4 h-4"})=>e.jsxs("svg",{className:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),e.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]}),Vt=({className:r="w-4 h-4"})=>e.jsxs("svg",{className:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M3 7v6h6"}),e.jsx("path",{d:"M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13"})]}),Ft=({className:r="w-4 h-4"})=>e.jsxs("svg",{className:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M21 7v6h-6"}),e.jsx("path",{d:"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7"})]}),wt=({className:r="w-4 h-4"})=>e.jsx("svg",{className:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"6 9 12 15 18 9"})}),Ut=({className:r="w-4 h-4"})=>e.jsx("svg",{className:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})}),Ct=({className:r="w-4 h-4"})=>e.jsxs("svg",{className:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("polyline",{points:"4 7 4 4 20 4 20 7"}),e.jsx("line",{x1:"9",y1:"20",x2:"15",y2:"20"}),e.jsx("line",{x1:"12",y1:"4",x2:"12",y2:"20"})]}),Nt=({className:r="w-4 h-4"})=>e.jsxs("svg",{className:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M4 12h8"}),e.jsx("path",{d:"M4 18V6"}),e.jsx("path",{d:"M12 18V6"}),e.jsx("path",{d:"m17 12 3-2v8"})]}),Lt=({className:r="w-4 h-4"})=>e.jsxs("svg",{className:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M4 12h8"}),e.jsx("path",{d:"M4 18V6"}),e.jsx("path",{d:"M12 18V6"}),e.jsx("path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1"})]}),St=({className:r="w-4 h-4"})=>e.jsxs("svg",{className:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M4 12h8"}),e.jsx("path",{d:"M4 18V6"}),e.jsx("path",{d:"M12 18V6"}),e.jsx("path",{d:"M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2"}),e.jsx("path",{d:"M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2"})]}),_e=({className:r="w-4 h-4"})=>e.jsxs("svg",{className:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),Qe=({className:r="w-4 h-4"})=>e.jsxs("svg",{className:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),e.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),e.jsx("polyline",{points:"21 15 16 10 5 21"})]}),Ze=({className:r="w-4 h-4"})=>e.jsxs("svg",{className:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),e.jsx("path",{d:"M3 9h18"}),e.jsx("path",{d:"M3 15h18"}),e.jsx("path",{d:"M9 3v18"}),e.jsx("path",{d:"M15 3v18"})]}),qt=({className:r="w-4 h-4"})=>e.jsxs("svg",{className:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),e.jsx("polyline",{points:"7 10 12 15 17 10"}),e.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]}),zt=({className:r="w-4 h-4"})=>e.jsxs("svg",{className:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),e.jsx("polyline",{points:"14 2 14 8 20 8"}),e.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),e.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),e.jsx("line",{x1:"10",y1:"9",x2:"8",y2:"9"})]}),ut=({className:r="w-4 h-4"})=>e.jsxs("svg",{className:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),e.jsx("polyline",{points:"17 8 12 3 7 8"}),e.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"15"})]}),Xe=({className:r="w-4 h-4"})=>e.jsxs("svg",{className:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("polyline",{points:"12 6 12 12 16 14"})]}),Yt=({className:r="w-4 h-4"})=>e.jsxs("svg",{className:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("polyline",{points:"3 6 5 6 21 6"}),e.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}),e.jsx("line",{x1:"10",y1:"11",x2:"10",y2:"17"}),e.jsx("line",{x1:"14",y1:"11",x2:"14",y2:"17"})]}),Jt=({className:r="w-4 h-4"})=>e.jsxs("svg",{className:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}),e.jsx("path",{d:"M3 3v5h5"})]}),Kt=({className:r="w-4 h-4"})=>e.jsxs("svg",{className:r,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"}),e.jsx("polyline",{points:"14 2 14 8 20 8"}),e.jsx("circle",{cx:"10",cy:"13",r:"2"}),e.jsx("path",{d:"m20 17-1.09-1.09a2 2 0 0 0-2.82 0L10 22"})]}),et=({content:r,children:n,position:u="bottom",shortcut:s})=>{const[l,d]=o.useState(!1),[c,h]=o.useState({x:0,y:0}),b=o.useRef(null),p=o.useRef(null),x=o.useRef(),y=()=>{x.current=window.setTimeout(()=>{d(!0)},400)},g=()=>{x.current&&clearTimeout(x.current),d(!1)};return o.useEffect(()=>{if(l&&b.current&&p.current){const m=b.current.getBoundingClientRect(),j=p.current.getBoundingClientRect();let N=0,M=0;switch(u){case"top":N=m.left+(m.width-j.width)/2,M=m.top-j.height-8;break;case"bottom":N=m.left+(m.width-j.width)/2,M=m.bottom+8;break;case"left":N=m.left-j.width-8,M=m.top+(m.height-j.height)/2;break;case"right":N=m.right+8,M=m.top+(m.height-j.height)/2;break}N=Math.max(8,Math.min(N,window.innerWidth-j.width-8)),M=Math.max(8,Math.min(M,window.innerHeight-j.height-8)),h({x:N,y:M})}},[l,u]),o.useEffect(()=>()=>{x.current&&clearTimeout(x.current)},[]),e.jsxs(e.Fragment,{children:[e.jsx("div",{ref:b,onMouseEnter:y,onMouseLeave:g,onFocus:y,onBlur:g,className:"inline-flex",children:n}),l&&e.jsxs("div",{ref:p,className:"fixed z-50 px-2.5 py-1.5 text-xs font-medium rounded-md shadow-lg animate-fade-in pointer-events-none bg-tooltip text-tooltip-foreground",style:{left:c.x,top:c.y},children:[e.jsx("span",{children:r}),s&&e.jsx("span",{className:"ml-2 opacity-70 font-mono",children:s})]})]})},A=({icon:r,tooltip:n,shortcut:u,isActive:s=!1,onClick:l,disabled:d=!1})=>{const c="p-2 rounded-md transition-all duration-150 flex items-center justify-center hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-1 disabled:opacity-40 disabled:cursor-not-allowed",h=s?"bg-accent text-accent-foreground":"";return e.jsx(et,{content:n,shortcut:u,children:e.jsx("button",{type:"button",onClick:l,disabled:d,className:`${c} ${h}`,"aria-pressed":s,children:r})})},Ke=[{name:"DM Sans",value:"dm-sans",className:"font-sans-editor"},{name:"Merriweather",value:"merriweather",className:"font-serif-editor"},{name:"Playfair Display",value:"playfair",className:"font-display-editor"},{name:"JetBrains Mono",value:"jetbrains",className:"font-mono-editor"},{name:"Arial",value:"arial",className:"font-arial"},{name:"Georgia",value:"georgia",className:"font-georgia"},{name:"Verdana",value:"verdana",className:"font-verdana"},{name:"Courier New",value:"courier",className:"font-courier"},{name:"Times New Roman",value:"times",className:"font-times"}],Gt=({currentFont:r,onFontChange:n})=>{const[u,s]=o.useState(!1),l=o.useRef(null),d=Ke.find(c=>c.value===r)||Ke[0];return o.useEffect(()=>{const c=h=>{l.current&&!l.current.contains(h.target)&&s(!1)};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[]),e.jsxs("div",{className:"relative",ref:l,children:[e.jsx(et,{content:"Font family",children:e.jsxs("button",{type:"button",onClick:()=>s(!u),className:`flex items-center gap-1.5 px-3 py-1.5 rounded-md transition-all duration-150 hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-1 text-sm font-medium min-w-[140px] justify-between ${u?"bg-secondary":""}`,children:[e.jsx("span",{className:d.className,children:d.name}),e.jsx(wt,{className:`w-4 h-4 transition-transform duration-200 ${u?"rotate-180":""}`})]})}),u&&e.jsx("div",{className:"absolute top-full left-0 mt-1 w-52 py-1 rounded-lg shadow-dropdown animate-scale-in z-50 bg-popover border border-border",children:Ke.map(c=>e.jsxs("button",{type:"button",onClick:()=>{n(c),s(!1)},className:`w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors hover:bg-accent ${c.value===r?"bg-accent":""}`,children:[e.jsx("span",{className:`flex-1 text-left ${c.className}`,children:c.name}),c.value===r&&e.jsx(Ut,{className:"w-4 h-4 text-primary"})]},c.value))})]})},Ge=[{name:"Paragraph",value:"p",icon:e.jsx(Ct,{className:"w-4 h-4"})},{name:"Heading 1",value:"h1",icon:e.jsx(Nt,{className:"w-4 h-4"})},{name:"Heading 2",value:"h2",icon:e.jsx(Lt,{className:"w-4 h-4"})},{name:"Heading 3",value:"h3",icon:e.jsx(St,{className:"w-4 h-4"})}],Xt=({currentHeading:r,onHeadingChange:n})=>{const[u,s]=o.useState(!1),l=o.useRef(null),d=Ge.find(c=>c.value===r)||Ge[0];return o.useEffect(()=>{const c=h=>{l.current&&!l.current.contains(h.target)&&s(!1)};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[]),e.jsxs("div",{className:"relative",ref:l,children:[e.jsx(et,{content:"Text style",children:e.jsxs("button",{type:"button",onClick:()=>s(!u),className:`flex items-center gap-1.5 px-3 py-1.5 rounded-md transition-all duration-150 hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-1 text-sm font-medium min-w-[120px] justify-between ${u?"bg-secondary":""}`,children:[e.jsxs("span",{className:"flex items-center gap-2",children:[d.icon,d.name]}),e.jsx(wt,{className:`w-4 h-4 transition-transform duration-200 ${u?"rotate-180":""}`})]})}),u&&e.jsx("div",{className:"absolute top-full left-0 mt-1 w-44 py-1 rounded-lg shadow-dropdown animate-scale-in z-50 bg-popover border border-border",children:Ge.map(c=>e.jsxs("button",{type:"button",onClick:()=>{n(c.value),s(!1)},className:`w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors hover:bg-accent ${c.value===r?"bg-accent":""}`,children:[c.icon,e.jsx("span",{className:`${c.value==="h1"?"text-lg font-bold":""} ${c.value==="h2"?"text-base font-semibold":""} ${c.value==="h3"?"text-sm font-semibold":""}`,children:c.name})]},c.value))})]})},Qt=({formatState:r,currentFont:n,onFormat:u,onFontChange:s,onHeadingChange:l,onUndo:d,onRedo:c,canUndo:h,canRedo:b,onInsertLink:p})=>e.jsxs("div",{className:"flex items-center gap-1 px-3 py-2 border-b rounded-t-lg flex-wrap bg-toolbar border-toolbar-border",children:[e.jsxs("div",{className:"flex items-center gap-0.5 mr-2",children:[e.jsx(A,{icon:e.jsx(Vt,{className:"w-4 h-4"}),tooltip:"Undo",shortcut:"⌘Z",onClick:d,disabled:!h}),e.jsx(A,{icon:e.jsx(Ft,{className:"w-4 h-4"}),tooltip:"Redo",shortcut:"⌘⇧Z",onClick:c,disabled:!b})]}),e.jsx("div",{className:"w-px h-6 bg-border mx-1"}),e.jsx(Gt,{currentFont:n,onFontChange:s}),e.jsx(Xt,{currentHeading:r.heading,onHeadingChange:l}),e.jsx("div",{className:"w-px h-6 bg-border mx-1"}),e.jsxs("div",{className:"flex items-center gap-0.5",children:[e.jsx(A,{icon:e.jsx(ht,{className:"w-4 h-4"}),tooltip:"Bold",shortcut:"⌘B",isActive:r.bold,onClick:()=>u("bold")}),e.jsx(A,{icon:e.jsx(pt,{className:"w-4 h-4"}),tooltip:"Italic",shortcut:"⌘I",isActive:r.italic,onClick:()=>u("italic")}),e.jsx(A,{icon:e.jsx(xt,{className:"w-4 h-4"}),tooltip:"Underline",shortcut:"⌘U",isActive:r.underline,onClick:()=>u("underline")}),e.jsx(A,{icon:e.jsx(gt,{className:"w-4 h-4"}),tooltip:"Strikethrough",shortcut:"⌘⇧S",isActive:r.strikethrough,onClick:()=>u("strikethrough")})]}),e.jsx("div",{className:"w-px h-6 bg-border mx-1"}),e.jsxs("div",{className:"flex items-center gap-0.5",children:[e.jsx(A,{icon:e.jsx(bt,{className:"w-4 h-4"}),tooltip:"Bullet list",shortcut:"⌘⇧8",isActive:r.unorderedList,onClick:()=>u("unorderedList")}),e.jsx(A,{icon:e.jsx(vt,{className:"w-4 h-4"}),tooltip:"Numbered list",shortcut:"⌘⇧7",isActive:r.orderedList,onClick:()=>u("orderedList")}),e.jsx(A,{icon:e.jsx(jt,{className:"w-4 h-4"}),tooltip:"Task list",shortcut:"⌘⇧9",isActive:r.taskList,onClick:()=>u("taskList")})]}),e.jsx("div",{className:"w-px h-6 bg-border mx-1"}),e.jsxs("div",{className:"flex items-center gap-0.5",children:[e.jsx(A,{icon:e.jsx(kt,{className:"w-4 h-4"}),tooltip:"Blockquote",shortcut:"⌘⇧B",isActive:r.blockquote,onClick:()=>u("blockquote")}),e.jsx(A,{icon:e.jsx(Me,{className:"w-4 h-4"}),tooltip:"Code block",shortcut:"⌘⇧C",isActive:r.code,onClick:()=>u("code")}),e.jsx(A,{icon:e.jsx(yt,{className:"w-4 h-4"}),tooltip:"Horizontal rule",onClick:()=>u("horizontalRule")})]}),e.jsx("div",{className:"w-px h-6 bg-border mx-1"}),e.jsx(A,{icon:e.jsx($e,{className:"w-4 h-4"}),tooltip:"Insert link",shortcut:"⌘K",onClick:p})]}),Zt=({formatState:r,onFormat:n,onInsertLink:u,editorRef:s})=>{const[l,d]=o.useState(!1),[c,h]=o.useState({x:0,y:0}),b=o.useRef(null);return o.useEffect(()=>{const p=()=>{const x=window.getSelection();if(!x||x.isCollapsed||!s.current){d(!1);return}const y=x.getRangeAt(0);if(!s.current.contains(y.commonAncestorContainer)){d(!1);return}if(!x.toString().trim()){d(!1);return}const m=y.getBoundingClientRect();let j=m.left+m.width/2,N=m.top-50;if(b.current){const M=b.current.offsetWidth||300;j=Math.max(M/2+8,Math.min(j,window.innerWidth-M/2-8))}N<10&&(N=m.bottom+10),h({x:j,y:N}),d(!0)};return document.addEventListener("selectionchange",p),()=>document.removeEventListener("selectionchange",p)},[s]),l?e.jsxs("div",{ref:b,className:"fixed z-50 flex items-center gap-0.5 px-2 py-1.5 rounded-lg shadow-floating animate-scale-in bg-popover border border-border",style:{left:c.x,top:c.y,transform:"translateX(-50%)"},onMouseDown:p=>p.preventDefault(),children:[e.jsx(A,{icon:e.jsx(ht,{className:"w-4 h-4"}),tooltip:"Bold",shortcut:"⌘B",isActive:r.bold,onClick:()=>n("bold")}),e.jsx(A,{icon:e.jsx(pt,{className:"w-4 h-4"}),tooltip:"Italic",shortcut:"⌘I",isActive:r.italic,onClick:()=>n("italic")}),e.jsx(A,{icon:e.jsx(xt,{className:"w-4 h-4"}),tooltip:"Underline",shortcut:"⌘U",isActive:r.underline,onClick:()=>n("underline")}),e.jsx(A,{icon:e.jsx(gt,{className:"w-4 h-4"}),tooltip:"Strikethrough",isActive:r.strikethrough,onClick:()=>n("strikethrough")}),e.jsx("div",{className:"w-px h-5 bg-border mx-1"}),e.jsx(A,{icon:e.jsx(Me,{className:"w-4 h-4"}),tooltip:"Inline code",isActive:r.code,onClick:()=>n("inlineCode")}),e.jsx(A,{icon:e.jsx($e,{className:"w-4 h-4"}),tooltip:"Insert link",shortcut:"⌘K",onClick:u})]}):null},er=({isOpen:r,onClose:n,onInsert:u,selectedText:s=""})=>{const[l,d]=o.useState(""),[c,h]=o.useState(s),b=o.useRef(null);o.useEffect(()=>{r&&(h(s),d(""),setTimeout(()=>{var x;return(x=b.current)==null?void 0:x.focus()},100))},[r,s]);const p=x=>{if(x.preventDefault(),l.trim()){let y=l.trim();!y.startsWith("http://")&&!y.startsWith("https://")&&(y="https://"+y),u(y,c||void 0),n()}};return r?e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm animate-fade-in",children:e.jsxs("div",{className:"w-full max-w-md p-6 rounded-xl shadow-floating animate-scale-in bg-card border border-border",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-foreground",children:[e.jsx($e,{className:"w-5 h-5"}),e.jsx("h2",{className:"text-lg font-semibold",children:"Insert Link"})]}),e.jsx("button",{type:"button",onClick:n,className:"p-1 rounded-md hover:bg-secondary transition-colors",children:e.jsx(_e,{className:"w-5 h-5"})})]}),e.jsxs("form",{onSubmit:p,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5 text-foreground",children:"URL"}),e.jsx("input",{ref:b,type:"text",value:l,onChange:x=>d(x.target.value),placeholder:"https://example.com",className:"w-full px-3 py-2 rounded-lg border transition-colors bg-background border-input focus:outline-none focus:ring-2 focus:ring-ring focus:border-transparent placeholder:text-muted-foreground"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5 text-foreground",children:"Text (optional)"}),e.jsx("input",{type:"text",value:c,onChange:x=>h(x.target.value),placeholder:"Link text",className:"w-full px-3 py-2 rounded-lg border transition-colors bg-background border-input focus:outline-none focus:ring-2 focus:ring-ring focus:border-transparent placeholder:text-muted-foreground"})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[e.jsx("button",{type:"button",onClick:n,className:"px-4 py-2 rounded-lg font-medium transition-colors bg-secondary text-secondary-foreground hover:bg-secondary/80",children:"Cancel"}),e.jsx("button",{type:"submit",disabled:!l.trim(),className:"px-4 py-2 rounded-lg font-medium transition-colors bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50 disabled:cursor-not-allowed",children:"Insert"})]})]})]})}):null},tr=[{id:"paragraph",label:"Text",description:"Plain text paragraph",icon:e.jsx(Ct,{className:"w-4 h-4"}),action:"paragraph",category:"Basic"},{id:"h1",label:"Heading 1",description:"Large section heading",icon:e.jsx(Nt,{className:"w-4 h-4"}),action:"h1",category:"Headings"},{id:"h2",label:"Heading 2",description:"Medium section heading",icon:e.jsx(Lt,{className:"w-4 h-4"}),action:"h2",category:"Headings"},{id:"h3",label:"Heading 3",description:"Small section heading",icon:e.jsx(St,{className:"w-4 h-4"}),action:"h3",category:"Headings"},{id:"bulletList",label:"Bullet List",description:"Create a bulleted list",icon:e.jsx(bt,{className:"w-4 h-4"}),action:"unorderedList",category:"Lists"},{id:"numberedList",label:"Numbered List",description:"Create a numbered list",icon:e.jsx(vt,{className:"w-4 h-4"}),action:"orderedList",category:"Lists"},{id:"taskList",label:"Task List",description:"Create a task checklist",icon:e.jsx(jt,{className:"w-4 h-4"}),action:"taskList",category:"Lists"},{id:"blockquote",label:"Quote",description:"Create a blockquote",icon:e.jsx(kt,{className:"w-4 h-4"}),action:"blockquote",category:"Blocks"},{id:"codeBlock",label:"Code Block",description:"Add a code snippet",icon:e.jsx(Me,{className:"w-4 h-4"}),action:"code",category:"Blocks"},{id:"divider",label:"Divider",description:"Visual separator line",icon:e.jsx(yt,{className:"w-4 h-4"}),action:"horizontalRule",category:"Blocks"},{id:"table",label:"Table",description:"Insert a table",icon:e.jsx(Ze,{className:"w-4 h-4"}),action:"table",category:"Advanced"},{id:"image",label:"Image",description:"Upload or embed image",icon:e.jsx(Qe,{className:"w-4 h-4"}),action:"image",category:"Advanced"}],rr=({isOpen:r,position:n,searchQuery:u,onSelect:s,onClose:l})=>{const[d,c]=o.useState(0),h=o.useRef(null),b=tr.filter(g=>g.label.toLowerCase().includes(u.toLowerCase())||g.description.toLowerCase().includes(u.toLowerCase())),p=b.reduce((g,m)=>(g[m.category]||(g[m.category]=[]),g[m.category].push(m),g),{});o.useEffect(()=>{c(0)},[u]),o.useEffect(()=>{const g=m=>{h.current&&!h.current.contains(m.target)&&l()};return r&&document.addEventListener("mousedown",g),()=>{document.removeEventListener("mousedown",g)}},[r,l]);const x=o.useCallback(g=>{if(r)switch(g.key){case"ArrowDown":g.preventDefault(),c(m=>(m+1)%b.length);break;case"ArrowUp":g.preventDefault(),c(m=>(m-1+b.length)%b.length);break;case"Enter":g.preventDefault(),b[d]&&s(b[d].action);break;case"Escape":g.preventDefault(),l();break}},[r,b,d,s,l]);if(o.useEffect(()=>(document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)),[x]),!r||b.length===0)return null;let y=0;return e.jsx("div",{ref:h,className:"fixed z-50 w-72 max-h-80 overflow-y-auto rounded-lg border shadow-lg animate-scale-in bg-popover border-border",style:{top:n.top,left:n.left},children:Object.entries(p).map(([g,m])=>e.jsxs("div",{children:[e.jsx("div",{className:"px-3 py-2 text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:g}),m.map(j=>{const N=y++;return e.jsxs("button",{className:`w-full flex items-center gap-3 px-3 py-2 text-left transition-colors ${N===d?"bg-accent text-accent-foreground":"hover:bg-muted"}`,onClick:()=>s(j.action),onMouseEnter:()=>c(N),children:[e.jsx("div",{className:"flex-shrink-0 w-8 h-8 flex items-center justify-center rounded-md bg-secondary text-secondary-foreground",children:j.icon}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm font-medium",children:j.label}),e.jsx("div",{className:"text-xs text-muted-foreground truncate",children:j.description})]})]},j.id)})]},g))})},nr=({isOpen:r,onClose:n,onInsert:u})=>{const[s,l]=o.useState("upload"),[d,c]=o.useState(""),[h,b]=o.useState(""),[p,x]=o.useState(!1),[y,g]=o.useState(null),m=o.useRef(null),j=o.useCallback(E=>{if(!E.type.startsWith("image/")){alert("Please select an image file");return}const F=new FileReader;F.onload=D=>{var ee;const se=(ee=D.target)==null?void 0:ee.result;g(se)},F.readAsDataURL(E)},[]),N=o.useCallback(E=>{E.preventDefault(),x(!1);const F=E.dataTransfer.files[0];F&&j(F)},[j]),M=o.useCallback(E=>{E.preventDefault(),x(!0)},[]),R=o.useCallback(E=>{E.preventDefault(),x(!1)},[]),I=()=>{const E=s==="upload"?y:d;E&&(u(E,h||void 0),X())},X=()=>{c(""),b(""),g(null),n()};return r?e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm animate-fade-in",onClick:n,children:e.jsxs("div",{className:"w-full max-w-md rounded-xl border shadow-xl overflow-hidden animate-scale-in bg-card border-border",onClick:E=>E.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border bg-muted/50",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Qe,{className:"w-5 h-5 text-muted-foreground"}),e.jsx("h3",{className:"font-semibold",children:"Insert Image"})]}),e.jsx("button",{onClick:n,className:"text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(_e,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"flex border-b border-border",children:[e.jsxs("button",{onClick:()=>l("upload"),className:`flex-1 px-4 py-2 text-sm font-medium transition-colors ${s==="upload"?"border-b-2 border-primary text-primary":"text-muted-foreground hover:text-foreground"}`,children:[e.jsx(ut,{className:"w-4 h-4 inline mr-2"}),"Upload"]}),e.jsxs("button",{onClick:()=>l("url"),className:`flex-1 px-4 py-2 text-sm font-medium transition-colors ${s==="url"?"border-b-2 border-primary text-primary":"text-muted-foreground hover:text-foreground"}`,children:[e.jsx($e,{className:"w-4 h-4 inline mr-2"}),"URL"]})]}),e.jsxs("div",{className:"p-4 space-y-4",children:[s==="upload"?e.jsxs("div",{onDrop:N,onDragOver:M,onDragLeave:R,onClick:()=>{var E;return(E=m.current)==null?void 0:E.click()},className:`border-2 border-dashed rounded-lg p-8 text-center cursor-pointer transition-colors ${p?"border-primary bg-primary/5":"border-border hover:border-muted-foreground"} ${y?"border-solid":""}`,children:[y?e.jsxs("div",{className:"relative",children:[e.jsx("img",{src:y,alt:"Preview",className:"max-h-48 mx-auto rounded-lg"}),e.jsx("button",{onClick:E=>{E.stopPropagation(),g(null)},className:"absolute top-2 right-2 p-1 rounded-full bg-destructive text-destructive-foreground",children:e.jsx(_e,{className:"w-4 h-4"})})]}):e.jsxs(e.Fragment,{children:[e.jsx(ut,{className:"w-10 h-10 mx-auto mb-2 text-muted-foreground"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Drag and drop an image, or click to select"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Supports: JPG, PNG, GIF, WebP"})]}),e.jsx("input",{ref:m,type:"file",accept:"image/*",className:"hidden",onChange:E=>{var D;const F=(D=E.target.files)==null?void 0:D[0];F&&j(F)}})]}):e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5",children:"Image URL"}),e.jsx("input",{type:"url",value:d,onChange:E=>c(E.target.value),placeholder:"https://example.com/image.jpg",className:"w-full px-3 py-2 rounded-lg border text-sm bg-background border-input focus:outline-none focus:ring-2 focus:ring-ring"}),d&&e.jsx("div",{className:"mt-3",children:e.jsx("img",{src:d,alt:"Preview",className:"max-h-32 mx-auto rounded-lg",onError:E=>{E.target.style.display="none"}})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5",children:"Alt Text (optional)"}),e.jsx("input",{type:"text",value:h,onChange:E=>b(E.target.value),placeholder:"Describe the image...",className:"w-full px-3 py-2 rounded-lg border text-sm bg-background border-input focus:outline-none focus:ring-2 focus:ring-ring"})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[e.jsx("button",{onClick:X,className:"px-4 py-2 rounded-lg text-sm font-medium transition-colors hover:bg-muted",children:"Cancel"}),e.jsx("button",{onClick:I,disabled:s==="upload"?!y:!d,className:"px-4 py-2 rounded-lg text-sm font-medium transition-colors bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50 disabled:cursor-not-allowed",children:"Insert Image"})]})]})]})}):null},sr=({isOpen:r,onClose:n,onInsert:u})=>{const[s,l]=o.useState(3),[d,c]=o.useState(3),[h,b]=o.useState({row:0,col:0}),p=()=>{u(s,d),n()};return r?e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm animate-fade-in",onClick:n,children:e.jsxs("div",{className:"w-full max-w-sm rounded-xl border shadow-xl overflow-hidden animate-scale-in bg-card border-border",onClick:x=>x.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border bg-muted/50",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ze,{className:"w-5 h-5 text-muted-foreground"}),e.jsx("h3",{className:"font-semibold",children:"Insert Table"})]}),e.jsx("button",{onClick:n,className:"text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(_e,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"p-4 space-y-4",children:[e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsx("div",{className:"grid gap-1 p-2 rounded-lg bg-muted/50",children:Array.from({length:6},(x,y)=>e.jsx("div",{className:"flex gap-1",children:Array.from({length:6},(g,m)=>e.jsx("button",{className:`w-6 h-6 rounded border-2 transition-all ${y<h.row&&m<h.col?"bg-primary border-primary":"border-border hover:border-muted-foreground"}`,onMouseEnter:()=>b({row:y+1,col:m+1}),onClick:()=>{l(y+1),c(m+1)}},m))},y))}),e.jsxs("p",{className:"text-sm text-muted-foreground mt-2",children:[h.row," × ",h.col]})]}),e.jsxs("div",{className:"flex items-center gap-4 justify-center",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Rows:"}),e.jsx("input",{type:"number",min:"1",max:"20",value:s,onChange:x=>l(Math.max(1,Math.min(20,parseInt(x.target.value)||1))),className:"w-16 px-2 py-1 rounded border text-sm text-center bg-background border-input focus:outline-none focus:ring-2 focus:ring-ring"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Columns:"}),e.jsx("input",{type:"number",min:"1",max:"10",value:d,onChange:x=>c(Math.max(1,Math.min(10,parseInt(x.target.value)||1))),className:"w-16 px-2 py-1 rounded border text-sm text-center bg-background border-input focus:outline-none focus:ring-2 focus:ring-ring"})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[e.jsx("button",{onClick:n,className:"px-4 py-2 rounded-lg text-sm font-medium transition-colors hover:bg-muted",children:"Cancel"}),e.jsx("button",{onClick:p,className:"px-4 py-2 rounded-lg text-sm font-medium transition-colors bg-primary text-primary-foreground hover:bg-primary/90",children:"Insert Table"})]})]})]})}):null},or=({isOpen:r,onClose:n,versions:u,onRestore:s,onDelete:l})=>{if(!r)return null;const d=c=>{const h=new Date(c),p=new Date().getTime()-h.getTime();return p<6e4?"Just now":p<36e5?`${Math.floor(p/6e4)} min ago`:p<864e5?`${Math.floor(p/36e5)} hours ago`:h.toLocaleDateString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})};return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm animate-fade-in",onClick:n,children:e.jsxs("div",{className:"w-full max-w-md max-h-[70vh] rounded-xl border shadow-xl overflow-hidden animate-scale-in bg-card border-border",onClick:c=>c.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border bg-muted/50",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Xe,{className:"w-5 h-5 text-muted-foreground"}),e.jsx("h3",{className:"font-semibold",children:"Version History"})]}),e.jsx("button",{onClick:n,className:"text-muted-foreground hover:text-foreground transition-colors text-lg",children:"✕"})]}),e.jsx("div",{className:"overflow-y-auto max-h-96",children:u.length===0?e.jsxs("div",{className:"px-4 py-8 text-center text-muted-foreground",children:[e.jsx(Xe,{className:"w-10 h-10 mx-auto mb-2 opacity-50"}),e.jsx("p",{children:"No versions saved yet"}),e.jsx("p",{className:"text-sm",children:"Changes are automatically saved"})]}):e.jsx("div",{className:"divide-y divide-border",children:[...u].reverse().map((c,h)=>e.jsxs("div",{className:"px-4 py-3 hover:bg-muted/50 transition-colors group",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-sm",children:h===0?"Current Version":c.title}),e.jsx("div",{className:"text-xs text-muted-foreground",children:d(c.timestamp)})]}),e.jsxs("div",{className:"flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[h!==0&&e.jsx("button",{onClick:()=>s(c.id),className:"p-1.5 rounded-md transition-colors hover:bg-primary/10 text-primary",title:"Restore this version",children:e.jsx(Jt,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>l(c.id),className:"p-1.5 rounded-md transition-colors hover:bg-destructive/10 text-destructive",title:"Delete this version",children:e.jsx(Yt,{className:"w-4 h-4"})})]})]}),e.jsxs("div",{className:"mt-1 text-xs text-muted-foreground line-clamp-2",children:[c.content.replace(/<[^>]*>/g,"").slice(0,100),"..."]})]},c.id))})})]})})},ar=({onExportHTML:r,onExportMarkdown:n,onExportPDF:u})=>{const[s,l]=o.useState(!1),d=o.useRef(null);o.useEffect(()=>{const h=b=>{d.current&&!d.current.contains(b.target)&&l(!1)};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[]);const c=[{label:"Export as HTML",icon:e.jsx(Me,{className:"w-4 h-4"}),action:r},{label:"Export as Markdown",icon:e.jsx(zt,{className:"w-4 h-4"}),action:n},{label:"Export as PDF",icon:e.jsx(Kt,{className:"w-4 h-4"}),action:u}];return e.jsxs("div",{ref:d,className:"relative",children:[e.jsxs("button",{onClick:()=>l(!s),className:`flex items-center gap-2 px-3 py-1.5 rounded-md text-sm font-medium transition-colors hover:bg-muted text-muted-foreground hover:text-foreground ${s?"bg-muted text-foreground":""}`,children:[e.jsx(qt,{className:"w-4 h-4"}),"Export"]}),s&&e.jsx("div",{className:"absolute top-full right-0 mt-1 w-48 rounded-lg border shadow-lg overflow-hidden z-50 animate-scale-in bg-popover border-border",children:c.map(h=>e.jsxs("button",{onClick:()=>{h.action(),l(!1)},className:"w-full flex items-center gap-3 px-3 py-2.5 text-sm transition-colors hover:bg-muted text-left",children:[e.jsx("span",{className:"text-muted-foreground",children:h.icon}),h.label]},h.label))})]})},ir=(r="")=>{const[n,u]=o.useState([{content:r}]),[s,l]=o.useState(0),d=o.useRef(0),c=o.useCallback((y,g)=>{const m=Date.now();m-d.current<500||(d.current=m,u(j=>{var M;const N=j.slice(0,s+1);return((M=N[N.length-1])==null?void 0:M.content)===y?j:(N.length>=100&&N.shift(),[...N,{content:y,cursorPosition:g}])}),l(j=>Math.min(j+1,99)))},[s]),h=o.useCallback(()=>s>0?(l(s-1),n[s-1]):null,[s,n]),b=o.useCallback(()=>s<n.length-1?(l(s+1),n[s+1]):null,[s,n]),p=s>0,x=s<n.length-1;return{saveToHistory:c,undo:h,redo:b,canUndo:p,canRedo:x}},lr=[{pattern:/^# (.+)$/,replacement:(r,n)=>`<h1>${n}</h1>`,format:"h1"},{pattern:/^## (.+)$/,replacement:(r,n)=>`<h2>${n}</h2>`,format:"h2"},{pattern:/^### (.+)$/,replacement:(r,n)=>`<h3>${n}</h3>`,format:"h3"},{pattern:/^- (.+)$/,replacement:(r,n)=>`<ul><li>${n}</li></ul>`,format:"unorderedList"},{pattern:/^\* (.+)$/,replacement:(r,n)=>`<ul><li>${n}</li></ul>`,format:"unorderedList"},{pattern:/^\d+\. (.+)$/,replacement:(r,n)=>`<ol><li>${n}</li></ol>`,format:"orderedList"},{pattern:/^- \[ \] (.+)$/,replacement:(r,n)=>`<div class="task-item"><span class="task-checkbox"></span><span class="task-text">${n}</span></div>`,format:"taskList"},{pattern:/^- \[x\] (.+)$/i,replacement:(r,n)=>`<div class="task-item"><span class="task-checkbox checked"></span><span class="task-text completed">${n}</span></div>`,format:"taskList"},{pattern:/^> (.+)$/,replacement:(r,n)=>`<blockquote>${n}</blockquote>`,format:"blockquote"},{pattern:/^```(.*)$/,replacement:()=>"<pre><code></code></pre>",format:"code"},{pattern:/^---$/,replacement:()=>"<hr>"},{pattern:/^\*\*\*$/,replacement:()=>"<hr>"}],cr=[{pattern:/\*\*(.+?)\*\*/,replacement:(r,n)=>`<strong>${n}</strong>`},{pattern:/__(.+?)__/,replacement:(r,n)=>`<strong>${n}</strong>`},{pattern:/\*(.+?)\*/,replacement:(r,n)=>`<em>${n}</em>`},{pattern:/_(.+?)_/,replacement:(r,n)=>`<em>${n}</em>`},{pattern:/~~(.+?)~~/,replacement:(r,n)=>`<s>${n}</s>`},{pattern:/`(.+?)`/,replacement:(r,n)=>`<code>${n}</code>`},{pattern:/\[(.+?)\]\((.+?)\)/,replacement:(r,n,u)=>`<a href="${u}">${n}</a>`}],dr=()=>{const r=o.useCallback(u=>{for(const{pattern:l,replacement:d,format:c}of lr)if(u.match(l))return{html:u.replace(l,d),format:c};let s=u;for(const{pattern:l,replacement:d}of cr)s=s.replace(l,d);return s!==u?{html:`<p>${s}</p>`}:{html:u}},[]),n=o.useCallback(u=>{var d,c,h,b;const s=[];if(!u)return s;let l=u;for(;l;){const p=(d=l.tagName)==null?void 0:d.toLowerCase();(p==="strong"||p==="b")&&s.push("bold"),(p==="em"||p==="i")&&s.push("italic"),p==="u"&&s.push("underline"),(p==="s"||p==="strike"||p==="del")&&s.push("strikethrough"),p==="code"&&((h=(c=l.parentElement)==null?void 0:c.tagName)==null?void 0:h.toLowerCase())!=="pre"&&s.push("inlineCode"),p==="pre"&&s.push("code"),p==="blockquote"&&s.push("blockquote"),p==="ul"&&s.push("unorderedList"),p==="ol"&&s.push("orderedList"),p==="h1"&&s.push("h1"),p==="h2"&&s.push("h2"),p==="h3"&&s.push("h3"),(b=l.classList)!=null&&b.contains("task-list")&&s.push("taskList"),l=l.parentElement}return[...new Set(s)]},[]);return{processMarkdown:r,detectActiveFormats:n}},ne="docuedit_documents",ur=5e3,ft=50,fr=(r="default")=>{const[n,u]=o.useState({currentDocumentId:r,versions:[],lastSaved:null,isSaving:!1}),s=o.useRef(""),l=o.useRef(null);o.useEffect(()=>{const g=localStorage.getItem(ne);if(g)try{const j=JSON.parse(g)[r]||[];u(N=>({...N,versions:j,lastSaved:j.length>0?j[j.length-1].timestamp:null}))}catch(m){console.error("Failed to load autosave data:",m)}},[r]);const d=o.useCallback((g,m=!1)=>{const j=localStorage.getItem(ne),N=j?JSON.parse(j):{},M=Date.now(),R=N[r]||[];if(m||R.length===0){const I={id:`v_${M}`,content:g,timestamp:M,title:`Version ${R.length+1}`};R.push(I),R.length>ft&&R.splice(0,R.length-ft)}else R.length>0&&(R[R.length-1]={...R[R.length-1],content:g,timestamp:M});N[r]=R,localStorage.setItem(ne,JSON.stringify(N)),u(I=>({...I,versions:R,lastSaved:M,isSaving:!1}))},[r]),c=o.useCallback((g,m=!1)=>{s.current=g,u(j=>({...j,isSaving:!0})),setTimeout(()=>{d(g,m)},100)},[d]),h=o.useCallback(()=>{s.current&&d(s.current,!0)},[d]),b=o.useCallback(g=>{const m=n.versions.find(j=>j.id===g);return(m==null?void 0:m.content)||null},[n.versions]),p=o.useCallback(()=>n.versions.length===0?null:n.versions[n.versions.length-1].content,[n.versions]),x=o.useCallback(g=>{const m=localStorage.getItem(ne),j=m?JSON.parse(m):{},M=(j[r]||[]).filter(R=>R.id!==g);j[r]=M,localStorage.setItem(ne,JSON.stringify(j)),u(R=>({...R,versions:M}))},[r]),y=o.useCallback(()=>{const g=localStorage.getItem(ne),m=g?JSON.parse(g):{};delete m[r],localStorage.setItem(ne,JSON.stringify(m)),u(j=>({...j,versions:[],lastSaved:null}))},[r]);return o.useEffect(()=>(l.current=setInterval(()=>{s.current&&d(s.current,!1)},ur),()=>{l.current&&clearInterval(l.current)}),[d]),{save:c,createVersionSnapshot:h,loadVersion:b,getLatestContent:p,deleteVersion:x,clearAllVersions:y,versions:n.versions,lastSaved:n.lastSaved,isSaving:n.isSaving}},mr=r=>{let n=r;n=n.replace(/<div class="task-list">([\s\S]*?)<\/div>/gi,(s,l)=>l),n=n.replace(/<div class="task-item">([\s\S]*?)<\/div>/gi,(s,l)=>{const d=l.includes("checked"),c=l.match(/<span class="task-text"[^>]*>([\s\S]*?)<\/span>/i),h=c?c[1].trim():"";return d?`- [x] ${h}
15
+ `:`- [ ] ${h}
16
+ `}),n=n.replace(/<span class="task-checkbox[^"]*"[^>]*><\/span>/gi,""),n=n.replace(/<span class="task-text"[^>]*>([\s\S]*?)<\/span>/gi,"$1"),n=n.replace(/<h1[^>]*>([\s\S]*?)<\/h1>/gi,`# $1
17
+
18
+ `),n=n.replace(/<h2[^>]*>([\s\S]*?)<\/h2>/gi,`## $1
19
+
20
+ `),n=n.replace(/<h3[^>]*>([\s\S]*?)<\/h3>/gi,`### $1
21
+
22
+ `),n=n.replace(/<h4[^>]*>([\s\S]*?)<\/h4>/gi,`#### $1
23
+
24
+ `),n=n.replace(/<h5[^>]*>([\s\S]*?)<\/h5>/gi,`##### $1
25
+
26
+ `),n=n.replace(/<h6[^>]*>([\s\S]*?)<\/h6>/gi,`###### $1
27
+
28
+ `),n=n.replace(/<strong[^>]*>([\s\S]*?)<\/strong>/gi,"**$1**"),n=n.replace(/<b[^>]*>([\s\S]*?)<\/b>/gi,"**$1**"),n=n.replace(/<em[^>]*>([\s\S]*?)<\/em>/gi,"*$1*"),n=n.replace(/<i[^>]*>([\s\S]*?)<\/i>/gi,"*$1*"),n=n.replace(/<u[^>]*>([\s\S]*?)<\/u>/gi,"<u>$1</u>"),n=n.replace(/<s[^>]*>([\s\S]*?)<\/s>/gi,"~~$1~~"),n=n.replace(/<strike[^>]*>([\s\S]*?)<\/strike>/gi,"~~$1~~"),n=n.replace(/<pre[^>]*><code[^>]*>([\s\S]*?)<\/code><\/pre>/gi,"```\n$1\n```\n\n"),n=n.replace(/<code[^>]*>([\s\S]*?)<\/code>/gi,"`$1`"),n=n.replace(/<a[^>]*href="([^"]*)"[^>]*>([\s\S]*?)<\/a>/gi,"[$2]($1)"),n=n.replace(/<img[^>]*src="([^"]*)"[^>]*alt="([^"]*)"[^>]*\/?>/gi,"![$2]($1)"),n=n.replace(/<img[^>]*src="([^"]*)"[^>]*\/?>/gi,"![]($1)"),n=n.replace(/<ul[^>]*>([\s\S]*?)<\/ul>/gi,(s,l)=>l.replace(/<li[^>]*>([\s\S]*?)<\/li>/gi,`- $1
29
+ `)+`
30
+ `),n=n.replace(/<ol[^>]*>([\s\S]*?)<\/ol>/gi,(s,l)=>{let d=0;return l.replace(/<li[^>]*>([\s\S]*?)<\/li>/gi,()=>(d++,`${d}. $1
31
+ `))+`
32
+ `}),n=n.replace(/<blockquote[^>]*>([\s\S]*?)<\/blockquote>/gi,(s,l)=>l.split(`
33
+ `).map(d=>`> ${d}`).join(`
34
+ `)+`
35
+
36
+ `),n=n.replace(/<hr[^>]*\/?>/gi,`
37
+ ---
38
+
39
+ `),n=n.replace(/<p[^>]*>([\s\S]*?)<\/p>/gi,`$1
40
+
41
+ `),n=n.replace(/<br[^>]*\/?>/gi,`
42
+ `),n=n.replace(/<div[^>]*>([\s\S]*?)<\/div>/gi,`$1
43
+ `),n=n.replace(/<[^>]+>/g,""),n=n.replace(/\n{3,}/g,`
44
+
45
+ `),n=n.trim();const u=document.createElement("textarea");return u.innerHTML=n,n=u.value,n},hr=(r,n="Document")=>{const u=window.open("","_blank");if(!u){alert("Please allow pop-ups to export PDF");return}u.document.write(`
46
+ <!DOCTYPE html>
47
+ <html>
48
+ <head>
49
+ <title>${n}</title>
50
+
51
+ <style>
52
+ body {
53
+ font-family: 'Georgia', serif;
54
+ max-width: 800px;
55
+ margin: 40px auto;
56
+ padding: 20px;
57
+ line-height: 1.6;
58
+ color: #333;
59
+ }
60
+ h1 { font-size: 2.5em; margin-bottom: 0.5em; }
61
+ h2 { font-size: 2em; margin-bottom: 0.4em; margin-top: 1.5em; }
62
+ h3 { font-size: 1.5em; margin-bottom: 0.3em; margin-top: 1.2em; }
63
+ p { margin-bottom: 1em; }
64
+ blockquote {
65
+ border-left: 3px solid #3b82f6;
66
+ padding-left: 1em;
67
+ margin: 1em 0;
68
+ color: #555;
69
+ font-style: italic;
70
+ }
71
+ pre {
72
+ background: #f5f5f5;
73
+ padding: 1em;
74
+ border-radius: 4px;
75
+ overflow-x: auto;
76
+ }
77
+ code {
78
+ background: #f5f5f5;
79
+ padding: 0.2em 0.4em;
80
+ border-radius: 3px;
81
+ font-family: 'Consolas', monospace;
82
+ }
83
+ pre code { background: transparent; padding: 0; }
84
+ ul, ol { margin: 1em 0; padding-left: 2em; }
85
+ li { margin-bottom: 0.5em; }
86
+ hr { border: none; border-top: 2px solid #eee; margin: 2em 0; }
87
+ img { max-width: 100%; height: auto; }
88
+ table { border-collapse: collapse; width: 100%; margin: 1em 0; }
89
+ th, td { border: 1px solid #ddd; padding: 8px; text-align: left; }
90
+ th { background: #f5f5f5; }
91
+ .task-list { list-style: none; padding-left: 0; }
92
+ .task-item { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
93
+ .task-checkbox { width: 16px; height: 16px; border: 2px solid #888; border-radius: 3px; display: inline-block; }
94
+ .task-checkbox.checked { background: #3b82f6; border-color: #3b82f6; }
95
+ </style>
96
+
97
+ </head>
98
+ <body>
99
+ ${r}
100
+ </body>
101
+ </html>
102
+ `),u.document.close(),setTimeout(()=>{u.print()},500)},mt=(r,n,u)=>{const s=new Blob([r],{type:u}),l=URL.createObjectURL(s),d=document.createElement("a");d.href=l,d.download=n,document.body.appendChild(d),d.click(),document.body.removeChild(d),URL.revokeObjectURL(l)},pr=()=>{const r=o.useCallback((s,l="document")=>{const d=`<!DOCTYPE html>
103
+ <html lang="en">
104
+ <head>
105
+ <meta charset="UTF-8">
106
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
107
+ <title>${l}</title>
108
+ <style>
109
+ body { font-family: Georgia, serif; max-width: 800px; margin: 40px auto; padding: 20px; line-height: 1.6; }
110
+ h1 { font-size: 2.5em; }
111
+ h2 { font-size: 2em; }
112
+ h3 { font-size: 1.5em; }
113
+ blockquote { border-left: 3px solid #3b82f6; padding-left: 1em; color: #555; font-style: italic; }
114
+ pre { background: #f5f5f5; padding: 1em; border-radius: 4px; }
115
+ code { background: #f5f5f5; padding: 0.2em 0.4em; border-radius: 3px; font-family: Consolas, monospace; }
116
+ pre code { background: transparent; }
117
+ img { max-width: 100%; }
118
+ table { border-collapse: collapse; width: 100%; }
119
+ th, td { border: 1px solid #ddd; padding: 8px; }
120
+ th { background: #f5f5f5; }
121
+ </style>
122
+ </head>
123
+ <body>
124
+ ${s}
125
+ </body>
126
+ </html>`;mt(d,`${l}.html`,"text/html")},[]),n=o.useCallback((s,l="document")=>{const d=mr(s);mt(d,`${l}.md`,"text/markdown")},[]),u=o.useCallback((s,l="Document")=>{hr(s,l)},[]);return{exportHTML:r,exportMarkdown:n,exportPDF:u}},xr={bold:!1,italic:!1,underline:!1,strikethrough:!1,orderedList:!1,unorderedList:!1,taskList:!1,blockquote:!1,code:!1,heading:"p"},gr=()=>{const r=o.useRef(null),[n,u]=o.useState(xr),[s,l]=o.useState("dm-sans"),[d,c]=o.useState(!1),[h,b]=o.useState(""),p=o.useRef(null),[x,y]=o.useState(!1),[g,m]=o.useState({top:0,left:0}),[j,N]=o.useState(""),[M,R]=o.useState(!1),[I,X]=o.useState(!1),[E,F]=o.useState(!1),{saveToHistory:D,undo:se,redo:ee,canUndo:ve,canRedo:Ie}=ir(),{detectActiveFormats:je}=dr(),{save:H,versions:K,lastSaved:J,loadVersion:Q,deleteVersion:ke,getLatestContent:ye,createVersionSnapshot:ue}=fr(),{exportHTML:we,exportMarkdown:Ce,exportPDF:Ne}=pr();o.useEffect(()=>{const a=ye();a&&r.current&&(r.current.innerHTML=a)},[]);const B=o.useCallback(()=>{const a=window.getSelection();if(!a||!a.rangeCount)return;const L=a.getRangeAt(0).commonAncestorContainer.parentElement,v=je(L);u({bold:v.includes("bold")||document.queryCommandState("bold"),italic:v.includes("italic")||document.queryCommandState("italic"),underline:v.includes("underline")||document.queryCommandState("underline"),strikethrough:v.includes("strikethrough")||document.queryCommandState("strikeThrough"),orderedList:v.includes("orderedList"),unorderedList:v.includes("unorderedList"),taskList:v.includes("taskList"),blockquote:v.includes("blockquote"),code:v.includes("code")||v.includes("inlineCode"),heading:v.find(_=>_.match(/^h[1-3]$/))||"p"})},[je]),q=o.useCallback(a=>{if(r.current){switch(r.current.focus(),a){case"bold":document.execCommand("bold",!1);break;case"italic":document.execCommand("italic",!1);break;case"underline":document.execCommand("underline",!1);break;case"strikethrough":document.execCommand("strikeThrough",!1);break;case"orderedList":document.execCommand("insertOrderedList",!1);break;case"unorderedList":document.execCommand("insertUnorderedList",!1);break;case"taskList":De();break;case"blockquote":Oe();break;case"code":fe();break;case"inlineCode":me("code");break;case"horizontalRule":document.execCommand("insertHorizontalRule",!1);break;case"paragraph":document.execCommand("formatBlock",!1,"p");break;case"h1":case"h2":case"h3":document.execCommand("formatBlock",!1,a);break;case"image":R(!0);return;case"table":X(!0);return}D(r.current.innerHTML),H(r.current.innerHTML),B()}},[D,B,H]),De=()=>{document.execCommand("insertHTML",!1,`<div class="task-list"><div class="task-item"><span class="task-checkbox" onclick="this.classList.toggle('checked'); this.nextElementSibling.classList.toggle('completed');"></span><span class="task-text" contenteditable="true">Task item</span></div></div>`)},Oe=()=>{var v;const a=window.getSelection();if(!a||!a.rangeCount)return;const L=(v=a.getRangeAt(0).commonAncestorContainer.parentElement)==null?void 0:v.closest("blockquote");if(L){const _=L.innerHTML;L.outerHTML=`<p>${_}</p>`}else{const _=a.toString()||"Quote text here...";document.execCommand("insertHTML",!1,`<blockquote>${_}</blockquote>`)}},fe=()=>{const a=window.getSelection();if(!a||!a.rangeCount)return;const w=a.toString()||"Code here...";document.execCommand("insertHTML",!1,`<pre><code>${w}</code></pre><p></p>`)},me=a=>{var W;const w=window.getSelection();if(!w||!w.rangeCount||w.isCollapsed)return;const L=w.getRangeAt(0),v=L.toString(),_=L.commonAncestorContainer.parentElement;if(((W=_==null?void 0:_.tagName)==null?void 0:W.toLowerCase())===a){const z=document.createTextNode(v);_.replaceWith(z)}else document.execCommand("insertHTML",!1,`<${a}>${v}</${a}>`)},G=o.useCallback((a,w)=>{if(!r.current)return;r.current.focus();const L=`<img src="${a}" alt="${w||""}" class="editor-image" style="max-width: 100%; border-radius: 8px;" /><p></p>`;document.execCommand("insertHTML",!1,L),D(r.current.innerHTML),H(r.current.innerHTML),R(!1)},[D,H]),he=o.useCallback((a,w)=>{if(!r.current)return;r.current.focus();let L='<table class="editor-table"><thead><tr>';for(let v=0;v<w;v++)L+="<th>Header</th>";L+="</tr></thead><tbody>";for(let v=0;v<a-1;v++){L+="<tr>";for(let _=0;_<w;_++)L+="<td>Cell</td>";L+="</tr>"}L+="</tbody></table><p></p>",document.execCommand("insertHTML",!1,L),D(r.current.innerHTML),H(r.current.innerHTML),X(!1)},[D,H]),Z=o.useCallback(a=>{r.current&&(r.current.focus(),document.execCommand("formatBlock",!1,a==="p"?"p":a),D(r.current.innerHTML),H(r.current.innerHTML),B())},[D,B,H]),Pe=o.useCallback(a=>{l(a.value)},[]),oe=o.useCallback(()=>{const a=se();a&&r.current&&(r.current.innerHTML=a.content,B())},[se,B]),pe=o.useCallback(()=>{const a=ee();a&&r.current&&(r.current.innerHTML=a.content,B())},[ee,B]),ae=o.useCallback(()=>{const a=window.getSelection();a&&a.rangeCount>0&&(p.current=a.getRangeAt(0).cloneRange(),b(a.toString())),c(!0)},[]),ie=o.useCallback((a,w)=>{if(!r.current)return;if(r.current.focus(),p.current){const v=window.getSelection();v==null||v.removeAllRanges(),v==null||v.addRange(p.current)}const L=w||h||a;document.execCommand("insertHTML",!1,`<a href="${a}" target="_blank" rel="noopener noreferrer">${L}</a>`),D(r.current.innerHTML),H(r.current.innerHTML),c(!1),b(""),p.current=null},[h,D,H]),te=o.useCallback(a=>{if(!r.current)return;const w=window.getSelection();if(w&&w.rangeCount>0){const v=w.getRangeAt(0).startContainer;if(v.nodeType===Node.TEXT_NODE&&v.textContent){const _=v.textContent.lastIndexOf("/");_>=0&&(v.textContent=v.textContent.substring(0,_))}}y(!1),N(""),q(a)},[q]),Le=o.useCallback(a=>{const L=navigator.platform.toUpperCase().indexOf("MAC")>=0?a.metaKey:a.ctrlKey;if(a.key==="Escape"&&x){y(!1);return}if(L)switch(a.key.toLowerCase()){case"b":a.preventDefault(),q("bold");break;case"i":a.preventDefault(),q("italic");break;case"u":a.preventDefault(),q("underline");break;case"k":a.preventDefault(),ae();break;case"s":a.preventDefault(),ue();break;case"z":a.preventDefault(),a.shiftKey?pe():oe();break}if(a.key===" "||a.key==="Enter"){const v=window.getSelection();if(!v||!v.rangeCount)return;const _=v.getRangeAt(0),W=_.startContainer.textContent||"",z=_.startOffset,We=W.substring(0,z),Ve=[{regex:/^# $/,format:"h1",heading:"h1"},{regex:/^## $/,format:"h2",heading:"h2"},{regex:/^### $/,format:"h3",heading:"h3"},{regex:/^- $/,format:"unorderedList"},{regex:/^\* $/,format:"unorderedList"},{regex:/^\d+\. $/,format:"orderedList"},{regex:/^> $/,format:"blockquote"},{regex:/^- \[ \] $/,format:"taskList"},{regex:/^```$/,format:"code"},{regex:/^---$/,format:"horizontalRule"}];for(const{regex:Fe,format:Ue,heading:Re}of Ve)if(Fe.test(We)){a.preventDefault();const Ee=_.startContainer;Ee.nodeType===Node.TEXT_NODE&&(Ee.textContent=""),Re?Z(Re):q(Ue);return}}},[q,Z,ae,oe,pe,x,ue]),Se=o.useCallback(()=>{if(!r.current)return;const a=window.getSelection();if(a&&a.rangeCount>0){const w=a.getRangeAt(0),L=w.startContainer.textContent||"",v=w.startOffset,W=L.substring(0,v).match(/\/([a-zA-Z]*)$/);if(W){const z=w.getBoundingClientRect();m({top:z.bottom+8,left:z.left}),N(W[1]),y(!0)}else y(!1)}D(r.current.innerHTML),H(r.current.innerHTML),B()},[D,B,H]),le=o.useCallback(a=>{const w=a.clipboardData.items;for(const L of w)if(L.type.startsWith("image/")){a.preventDefault();const v=L.getAsFile();if(v){const _=new FileReader;_.onload=W=>{var z;G((z=W.target)==null?void 0:z.result)},_.readAsDataURL(v)}return}},[G]),Ae=o.useCallback(a=>{const w=a.dataTransfer.files;for(const L of w)if(L.type.startsWith("image/")){a.preventDefault();const v=new FileReader;v.onload=_=>{var W;G((W=_.target)==null?void 0:W.result)},v.readAsDataURL(L);return}},[G]),He=o.useCallback(a=>{const w=Q(a);w&&r.current&&(r.current.innerHTML=w,D(w),H(w,!0),F(!1))},[Q,D,H]);o.useEffect(()=>{const a=()=>B();return document.addEventListener("selectionchange",a),()=>document.removeEventListener("selectionchange",a)},[B]);const xe=()=>({"dm-sans":"font-sans-editor",merriweather:"font-serif-editor",playfair:"font-display-editor",jetbrains:"font-mono-editor",arial:"font-arial",georgia:"font-georgia",verdana:"font-verdana",courier:"font-courier",times:"font-times"})[s]||"font-sans-editor",Be=()=>{if(!J)return"Not saved yet";const a=Date.now()-J;return a<6e4?"Just now":a<36e5?`${Math.floor(a/6e4)} min ago`:new Date(J).toLocaleTimeString()};return e.jsxs("div",{className:"w-full max-w-4xl mx-auto",children:[e.jsxs("div",{className:"rounded-xl border shadow-toolbar overflow-hidden bg-card border-editor-border",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border bg-muted/30",children:[e.jsx("div",{className:"flex items-center gap-4",children:e.jsxs("button",{onClick:()=>F(!0),className:"flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[e.jsx(Xe,{className:"w-4 h-4"}),e.jsxs("span",{children:["Saved ",Be()]})]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>R(!0),className:"flex items-center gap-2 px-3 py-1.5 rounded-md text-sm font-medium transition-colors hover:bg-muted text-muted-foreground hover:text-foreground",children:[e.jsx(Qe,{className:"w-4 h-4"}),"Image"]}),e.jsxs("button",{onClick:()=>X(!0),className:"flex items-center gap-2 px-3 py-1.5 rounded-md text-sm font-medium transition-colors hover:bg-muted text-muted-foreground hover:text-foreground",children:[e.jsx(Ze,{className:"w-4 h-4"}),"Table"]}),e.jsx(ar,{onExportHTML:()=>{var a;return we(((a=r.current)==null?void 0:a.innerHTML)||"","document")},onExportMarkdown:()=>{var a;return Ce(((a=r.current)==null?void 0:a.innerHTML)||"","document")},onExportPDF:()=>{var a;return Ne(((a=r.current)==null?void 0:a.innerHTML)||"","Document")}})]})]}),e.jsx(Qt,{formatState:n,currentFont:s,onFormat:q,onFontChange:Pe,onHeadingChange:Z,onUndo:oe,onRedo:pe,canUndo:ve,canRedo:Ie,onInsertLink:ae}),e.jsxs("div",{ref:r,className:`editor-content p-6 md:p-8 min-h-[500px] focus:outline-none ${xe()} bg-editor`,contentEditable:!0,onInput:Se,onKeyDown:Le,onPaste:le,onDrop:Ae,onDragOver:a=>a.preventDefault(),suppressContentEditableWarning:!0,"data-placeholder":"Start writing... Type '/' for commands, or use markdown shortcuts like # for headings",children:[e.jsx("h1",{children:"Welcome to DocuEdit"}),e.jsxs("p",{children:["A powerful rich text editor with ",e.jsx("strong",{children:"autosave"}),", ",e.jsx("em",{children:"version history"}),", and ",e.jsx("u",{children:"export"})," features."]}),e.jsx("h2",{children:"Quick Commands"}),e.jsxs("ul",{children:[e.jsxs("li",{children:["Type ",e.jsx("code",{children:"/"})," to open the slash command menu"]}),e.jsx("li",{children:"Drag & drop or paste images directly"}),e.jsxs("li",{children:["Press ",e.jsx("code",{children:"Ctrl/Cmd + S"})," to create a version snapshot"]})]}),e.jsx("h3",{children:"Export Options"}),e.jsx("p",{children:"Export your document as HTML, Markdown, or PDF using the export menu above."})]})]}),e.jsx(Zt,{formatState:{bold:n.bold,italic:n.italic,underline:n.underline,strikethrough:n.strikethrough,code:n.code},onFormat:q,onInsertLink:ae,editorRef:r}),e.jsx(rr,{isOpen:x,position:g,searchQuery:j,onSelect:te,onClose:()=>y(!1)}),e.jsx(er,{isOpen:d,onClose:()=>c(!1),onInsert:ie,selectedText:h}),e.jsx(nr,{isOpen:M,onClose:()=>R(!1),onInsert:G}),e.jsx(sr,{isOpen:I,onClose:()=>X(!1),onInsert:he}),e.jsx(or,{isOpen:E,onClose:()=>F(!1),versions:K,onRestore:He,onDelete:ke})]})};exports.RichTextEditor=gr;