authorly-editor 0.1.4 → 0.1.5
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.cjs.js +172 -162
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +1369 -1334
- package/dist/index.esm.js.map +1 -1
- package/package.json +80 -80
package/dist/index.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var Mo=Object.defineProperty;var To=(e,t,n)=>t in e?Mo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Re=(e,t,n)=>To(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),h=require("react"),No=require("react-dom");function F(){return`cb-${Date.now().toString(36)}-${Math.random().toString(36).substring(2,9)}`}function _e(e){if(e===null||typeof e!="object")return e;if(Array.isArray(e))return e.map(n=>_e(n));const t={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=_e(e[n]));return t}function Gt(e,t){let n;return function(...o){clearTimeout(n),n=setTimeout(()=>e(...o),t)}}function Bo(e,t){let n=!1;return function(...o){n||(e(...o),n=!0,setTimeout(()=>n=!1,t))}}function $o(e){return e.hasAttribute("data-block-id")}function ye(e){if(!e)return null;let t=e;for(;t;){if(t instanceof HTMLElement&&t.hasAttribute("data-block-id"))return t;t=t.parentNode}return null}function Ho(e){return e.textContent||""}function Xt(e){return e.trim().split(/\s+/).filter(t=>t.length>0).length}function Zt(e,t=!0){return t?e.length:e.replace(/\s/g,"").length}function qo(){const e=window.getSelection();return e?e.isCollapsed:!0}function Jt(){const e=window.getSelection();return e&&e.rangeCount>0?e.getRangeAt(0):null}function Qt(e){const t=window.getSelection();t&&(t.removeAllRanges(),t.addRange(e))}function jo(){var e;return((e=Jt())==null?void 0:e.cloneRange())||null}function Ro(e){e&&Qt(e)}function Do(e){const t=document.createRange(),n=window.getSelection();t.selectNodeContents(e),t.collapse(!1),n&&(n.removeAllRanges(),n.addRange(t))}function Io(e){const t=document.createRange(),n=window.getSelection();t.selectNodeContents(e),t.collapse(!0),n&&(n.removeAllRanges(),n.addRange(t))}function zo(e){return(e.textContent||"").trim().length===0&&!e.querySelector("img, video, iframe")}function en(e){const t=document.createElement("div");return t.innerHTML=e,t.textContent||t.innerText||""}function tn(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Ye=new Map;function Po(e){const t=tn(en(e));if(!t)return"heading";const n=Ye.get(t)||0;return Ye.set(t,n+1),n===0?t:`${t}-${n}`}function Oo(){Ye.clear()}function Fo(e){const t=document.createElement("div");return t.textContent=e,t.innerHTML}function Uo(e){const t=document.createElement("template");return t.innerHTML=e.trim(),t.content}function Vo(e){return e.outerHTML}function Wo(e){const t=e.parentElement;return t?Array.from(t.children).indexOf(e):-1}function Pe(e,t){const n=t.parentElement;n&&n.insertBefore(e,t.nextSibling)}function nn(e,t){const n=t.parentElement;n&&n.insertBefore(e,t)}function _o(e,t){var c;const n=e.parentNode,o=e.nextSibling===t?e:e.nextSibling;(c=t.parentNode)==null||c.insertBefore(e,t),n==null||n.insertBefore(t,o)}function Yo(e,t){const n=t.toLowerCase().split("+"),o=n.pop(),c={ctrl:n.includes("ctrl")||n.includes("cmd"),shift:n.includes("shift"),alt:n.includes("alt")},r=e.ctrlKey||e.metaKey;return e.key.toLowerCase()===o&&r===c.ctrl&&e.shiftKey===c.shift&&e.altKey===c.alt}function Ko(e,t,n){const o=document.createElement(e);if(t)for(const[c,r]of Object.entries(t))o.setAttribute(c,r);if(n)for(const c of n)typeof c=="string"?o.appendChild(document.createTextNode(c)):o.appendChild(c);return o}function Go(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}function Xo(){return"ontouchstart"in window||navigator.maxTouchPoints>0}function Zo(e,t){return window.getComputedStyle(e).getPropertyValue(t)}function Jo(e){return requestAnimationFrame(e)}function Qo(e){cancelAnimationFrame(e)}const ec={get(e,t){try{const n=localStorage.getItem(e);return n?JSON.parse(n):t}catch{return t}},set(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch{}},remove(e){try{localStorage.removeItem(e)}catch{}}};class tc{constructor(){Re(this,"listeners",new Map)}on(t,n){return this.listeners.has(t)||this.listeners.set(t,new Set),this.listeners.get(t).add(n),()=>this.off(t,n)}off(t,n){var o;(o=this.listeners.get(t))==null||o.delete(n)}emit(t,n){var o;(o=this.listeners.get(t))==null||o.forEach(c=>c(n))}removeAllListeners(){this.listeners.clear()}}class on{constructor(){Re(this,"blocks",new Map);Re(this,"defaultBlock","paragraph")}register(t){this.blocks.set(t.name,t)}unregister(t){this.blocks.delete(t)}get(t){return this.blocks.get(t)}has(t){return this.blocks.has(t)}getAll(){return Array.from(this.blocks.values())}getNames(){return Array.from(this.blocks.keys())}setDefaultBlock(t){this.has(t)&&(this.defaultBlock=t)}getDefaultBlock(){return this.defaultBlock}createBlock(t,n){const o=this.get(t);if(!o)return console.warn(`Block type "${t}" is not registered`),null;const c={id:F(),type:t,...n},r=o.create(c);return r.setAttribute("data-block-id",c.id),r.setAttribute("data-block-type",t),r}getBlockType(t){return t.getAttribute("data-block-type")}getBlockData(t){const n=this.getBlockType(t);if(!n)return null;const o=this.get(n);return o?o.getData(t):null}updateBlock(t,n){const o=this.getBlockType(t);if(!o)return;const c=this.get(o);c&&c.update(t,n)}transformBlock(t,n){const o=this.getBlockType(t);if(!o||o===n)return t;const c=this.get(o),r=this.get(n);if(!c||!r)return null;const i=t.innerHTML,a=t.getAttribute("data-block-id")||F(),d=this.createBlock(n,{id:a});if(!d)return null;if(r.editable){const w=d.querySelector('[contenteditable="true"]')||d;w instanceof HTMLElement&&(w.innerHTML=i)}return d}}const de=new on,ct={name:"paragraph",tag:"p",editable:!0,allowedChildren:["text","inline"],className:"cb-paragraph",icon:"paragraph",label:"Paragraph",shortcut:"Ctrl+0",create(e){const t=document.createElement("p");return t.className="cb-paragraph",t.setAttribute("contenteditable","true"),t.setAttribute("data-block-id",(e==null?void 0:e.id)||F()),t.setAttribute("data-block-type","paragraph"),e!=null&&e.content&&(t.innerHTML=e.content),e!=null&&e.align&&(t.style.textAlign=e.align),e!=null&&e.className&&(t.className=`cb-paragraph ${e.className}`),e!=null&&e.content||t.setAttribute("data-placeholder","Type something..."),t},getData(e){return{id:e.getAttribute("data-block-id")||F(),type:"paragraph",content:e.innerHTML,align:e.style.textAlign,className:e.className}},update(e,t){t.content!==void 0&&(e.innerHTML=t.content),t.align&&(e.style.textAlign=t.align),t.className&&(e.className=`cb-paragraph ${t.className}`)}};function we(e){return{name:"heading",tag:`h${e}`,editable:!0,allowedChildren:["text","inline"],className:`cb-heading cb-h${e}`,icon:`heading${e}`,label:e===1?"Title":`Heading ${e}`,shortcut:`Ctrl+${e}`,create(t){const n=(t==null?void 0:t.level)||e,o=`h${n}`,c=document.createElement(o);return c.className=`cb-heading cb-h${n}`,c.setAttribute("contenteditable","true"),c.setAttribute("data-block-id",(t==null?void 0:t.id)||F()),c.setAttribute("data-block-type","heading"),c.setAttribute("data-heading-level",String(n)),t!=null&&t.content&&(c.innerHTML=t.content),t!=null&&t.align&&(c.style.textAlign=t.align),t!=null&&t.content||c.setAttribute("data-placeholder",n===1?"Title":`Heading ${n}`),c},getData(t){const n=t.getAttribute("data-heading-level");return{id:t.getAttribute("data-block-id")||F(),type:"heading",level:n?parseInt(n,10):e,content:t.innerHTML,align:t.style.textAlign}},update(t,n){n.content!==void 0&&(t.innerHTML=n.content),n.align&&(t.style.textAlign=n.align),n.level&&n.level!==e&&t.setAttribute("data-heading-level",String(n.level))}}}const rt=we(1),lt=we(2),it=we(3),cn=we(4),rn=we(5),ln=we(6);function nc(e,t){return we(e).create({...t,level:e,type:"heading"})}function Be(e,t){const n=document.createElement("li");if(n.className="cb-list-item",n.setAttribute("data-item-id",e.id),t==="checkList"){const o=document.createElement("div");o.className="cb-checklist-wrapper";const c=document.createElement("input");c.type="checkbox",c.className="cb-checkbox",c.checked=e.checked||!1,c.setAttribute("tabindex","-1");const r=document.createElement("span");r.className="cb-checklist-content",r.setAttribute("contenteditable","true"),r.innerHTML=e.content,o.appendChild(c),o.appendChild(r),n.appendChild(o),e.checked&&n.classList.add("cb-checked")}else n.setAttribute("contenteditable","true"),n.innerHTML=e.content;if(e.children&&e.children.length>0){const o=document.createElement(t==="numberedList"?"ol":"ul");o.className=`cb-nested-list cb-${t}`,e.children.forEach(c=>{o.appendChild(Be(c,t))}),n.appendChild(o)}return n}function an(e,t){const n=[];return e.querySelectorAll(":scope > li").forEach(o=>{const c={id:o.getAttribute("data-item-id")||F(),content:"",checked:!1,children:[]};if(t==="checkList"){const i=o.querySelector(".cb-checkbox"),a=o.querySelector(".cb-checklist-content");c.checked=(i==null?void 0:i.checked)||!1,c.content=(a==null?void 0:a.innerHTML)||""}else{const i=o.cloneNode(!0),a=i.querySelector("ul, ol");a&&a.remove(),c.content=i.innerHTML}const r=o.querySelector(":scope > ul, :scope > ol");r&&(c.children=an(r,t)),n.push(c)}),n}function at(e){const t=e==="numberedList"?"ol":"ul";return{name:e,tag:t,editable:!0,allowedChildren:["text","inline","block"],className:`cb-list cb-${e}`,icon:e==="bulletList"?"list":e==="numberedList"?"listOrdered":"checkList",label:e==="bulletList"?"Bullet List":e==="numberedList"?"Numbered List":"Checklist",shortcut:e==="bulletList"?"Ctrl+Shift+8":e==="numberedList"?"Ctrl+Shift+7":void 0,create(o){const c=document.createElement(t);if(c.className=`cb-list cb-${e}`,c.setAttribute("data-block-id",(o==null?void 0:o.id)||F()),c.setAttribute("data-block-type",e),o!=null&&o.items&&o.items.length>0)o.items.forEach(r=>{c.appendChild(Be(r,e))});else{const r={id:F(),content:"",checked:!1};c.appendChild(Be(r,e))}return c},getData(o){return{id:o.getAttribute("data-block-id")||F(),type:e,items:an(o,e)}},update(o,c){c.items&&(o.innerHTML="",c.items.forEach(r=>{o.appendChild(Be(r,e))}))}}}const st=at("bulletList"),dt=at("numberedList"),sn=at("checkList");function oc(e,t,n=""){const o=e.getAttribute("data-block-type"),c={id:F(),content:n,checked:!1},r=Be(c,o);if(t){const a=e.querySelector(`[data-item-id="${t}"]`);a&&a.parentElement===e?a.after(r):e.appendChild(r)}else e.appendChild(r);const i=o==="checkList"?r.querySelector(".cb-checklist-content"):r;return i instanceof HTMLElement&&i.focus(),c}function cc(e,t){const n=e.querySelector(`[data-item-id="${t}"]`);if(!n)return!1;if(e.querySelectorAll(":scope > li").length<=1){const c=n.querySelector(".cb-checklist-content")||n;return c instanceof HTMLElement&&(c.innerHTML=""),!1}return n.remove(),!0}function rc(e){const t=e.querySelector(".cb-checkbox");return t?(t.checked=!t.checked,e.classList.toggle("cb-checked",t.checked),t.checked):!1}function lc(e){const t=e.previousElementSibling;if(!t)return!1;const n=e.parentElement;if(!n)return!1;const o=n.getAttribute("data-block-type"),c=o==="numberedList"?"ol":"ul";let r=t.querySelector(`:scope > ${c}`);return r||(r=document.createElement(c),r.className=`cb-nested-list cb-${o}`,t.appendChild(r)),r.appendChild(e),!0}function ic(e){const t=e.parentElement;if(!t||!t.classList.contains("cb-nested-list"))return!1;const n=t.parentElement;if(!n)return!1;const o=n.parentElement;return o?(o.insertBefore(e,n.nextSibling),t.children.length===0&&t.remove(),!0):!1}const ut={name:"quote",tag:"blockquote",editable:!0,allowedChildren:["text","inline"],className:"cb-quote",icon:"quote",label:"Quote",shortcut:"Ctrl+Shift+.",create(e){const t=document.createElement("blockquote");t.className="cb-quote",t.setAttribute("data-block-id",(e==null?void 0:e.id)||F()),t.setAttribute("data-block-type","quote");const n=document.createElement("p");if(n.className="cb-quote-content",n.setAttribute("contenteditable","true"),e!=null&&e.content?n.innerHTML=e.content:n.setAttribute("data-placeholder","Type a quote..."),t.appendChild(n),e!=null&&e.citation){const o=document.createElement("cite");o.className="cb-quote-citation",o.setAttribute("contenteditable","true"),o.textContent=e.citation,t.appendChild(o)}return t},getData(e){const t=e.querySelector(".cb-quote-content"),n=e.querySelector(".cb-quote-citation");return{id:e.getAttribute("data-block-id")||F(),type:"quote",content:(t==null?void 0:t.innerHTML)||e.innerHTML,citation:(n==null?void 0:n.textContent)||void 0}},update(e,t){if(t.content!==void 0){const n=e.querySelector(".cb-quote-content");n&&(n.innerHTML=t.content)}if(t.citation!==void 0){let n=e.querySelector(".cb-quote-citation");t.citation?(n||(n=document.createElement("cite"),n.className="cb-quote-citation",n.setAttribute("contenteditable","true"),e.appendChild(n)),n.textContent=t.citation):n&&n.remove()}}};function ac(e,t){let n=e.querySelector(".cb-quote-citation");n||(n=document.createElement("cite"),n.className="cb-quote-citation",n.setAttribute("contenteditable","true"),e.appendChild(n)),n.textContent=t}function sc(e){const t=e.querySelector(".cb-quote-citation");t&&t.remove()}const dn=[{value:"plaintext",label:"Plain Text"},{value:"javascript",label:"JavaScript"},{value:"typescript",label:"TypeScript"},{value:"python",label:"Python"},{value:"java",label:"Java"},{value:"csharp",label:"C#"},{value:"cpp",label:"C++"},{value:"go",label:"Go"},{value:"rust",label:"Rust"},{value:"php",label:"PHP"},{value:"ruby",label:"Ruby"},{value:"swift",label:"Swift"},{value:"kotlin",label:"Kotlin"},{value:"html",label:"HTML"},{value:"css",label:"CSS"},{value:"scss",label:"SCSS"},{value:"json",label:"JSON"},{value:"yaml",label:"YAML"},{value:"xml",label:"XML"},{value:"markdown",label:"Markdown"},{value:"sql",label:"SQL"},{value:"bash",label:"Bash"},{value:"shell",label:"Shell"},{value:"dockerfile",label:"Dockerfile"}],pt={name:"code",tag:"pre",editable:!0,allowedChildren:["text"],className:"cb-code-block",icon:"code",label:"Code Block",shortcut:"Ctrl+Shift+C",create(e){const t=document.createElement("div");t.className="cb-code-wrapper",t.setAttribute("data-block-id",(e==null?void 0:e.id)||F()),t.setAttribute("data-block-type","code");const n=document.createElement("div");n.className="cb-code-toolbar";const o=document.createElement("select");o.className="cb-code-language",o.setAttribute("tabindex","-1"),dn.forEach(a=>{const d=document.createElement("option");d.value=a.value,d.textContent=a.label,(e==null?void 0:e.language)===a.value&&(d.selected=!0),o.appendChild(d)});const c=document.createElement("button");c.type="button",c.className="cb-code-copy",c.setAttribute("tabindex","-1"),c.innerHTML='<span class="cb-copy-text">Copy</span>',c.onclick=()=>{const a=t.querySelector("code");a&&(navigator.clipboard.writeText(a.textContent||""),c.innerHTML='<span class="cb-copy-text">Copied!</span>',setTimeout(()=>{c.innerHTML='<span class="cb-copy-text">Copy</span>'},2e3))},n.appendChild(o),n.appendChild(c);const r=document.createElement("pre");r.className="cb-code-block";const i=document.createElement("code");return i.className=`cb-code language-${(e==null?void 0:e.language)||"plaintext"}`,i.setAttribute("contenteditable","true"),i.setAttribute("spellcheck","false"),i.setAttribute("data-placeholder","Write your code here..."),e!=null&&e.content&&(i.textContent=e.content),o.onchange=()=>{i.className=`cb-code language-${o.value}`,t.setAttribute("data-language",o.value)},r.appendChild(i),t.appendChild(n),t.appendChild(r),e!=null&&e.language&&t.setAttribute("data-language",e.language),t},getData(e){const t=e.querySelector("code"),n=e.querySelector(".cb-code-language");return{id:e.getAttribute("data-block-id")||F(),type:"code",content:(t==null?void 0:t.textContent)||"",language:(n==null?void 0:n.value)||e.getAttribute("data-language")||"plaintext"}},update(e,t){if(t.content!==void 0){const n=e.querySelector("code");n&&(n.textContent=t.content)}if(t.language){const n=e.querySelector("code"),o=e.querySelector(".cb-code-language");n&&(n.className=`cb-code language-${t.language}`),o&&(o.value=t.language),e.setAttribute("data-language",t.language)}}};function dc(e,t){const n=e.querySelector("code"),o=e.querySelector(".cb-code-language");n&&(n.className=`cb-code language-${t}`),o&&(o.value=t),e.setAttribute("data-language",t)}function uc(e){const t=e.querySelector("code");return(t==null?void 0:t.textContent)||""}function un(e){["se","sw","ne","nw","e","w"].forEach(n=>{const o=document.createElement("div");o.className=`cb-image-resize-handle handle-${n}`,o.setAttribute("data-handle",n),e.appendChild(o)})}const ht={name:"image",tag:"figure",editable:!1,allowedChildren:[],className:"cb-image",icon:"image",label:"Image",create(e){const t=document.createElement("figure");t.className="cb-image",t.setAttribute("data-block-id",(e==null?void 0:e.id)||F()),t.setAttribute("data-block-type","image");const n=document.createElement("div");if(n.className="cb-image-container",e!=null&&e.src){const c=document.createElement("div");c.className="cb-image-resizable";const r=document.createElement("img");r.className="cb-image-element",r.src=e.src,r.alt=e.alt||"",e.width&&(r.style.width=typeof e.width=="number"?`${e.width}px`:e.width),e.height&&(r.style.height=typeof e.height=="number"?`${e.height}px`:e.height),c.appendChild(r),un(c),n.appendChild(c)}else{const c=document.createElement("div");c.className="cb-image-placeholder",c.innerHTML=`
|
|
1
|
+
"use strict";var To=Object.defineProperty;var No=(e,t,n)=>t in e?To(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Re=(e,t,n)=>No(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),p=require("react"),Bo=require("react-dom");function F(){return`cb-${Date.now().toString(36)}-${Math.random().toString(36).substring(2,9)}`}function _e(e){if(e===null||typeof e!="object")return e;if(Array.isArray(e))return e.map(n=>_e(n));const t={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=_e(e[n]));return t}function Gt(e,t){let n;return function(...o){clearTimeout(n),n=setTimeout(()=>e(...o),t)}}function Ho(e,t){let n=!1;return function(...o){n||(e(...o),n=!0,setTimeout(()=>n=!1,t))}}function qo(e){return e.hasAttribute("data-block-id")}function ye(e){if(!e)return null;let t=e;for(;t;){if(t instanceof HTMLElement&&t.hasAttribute("data-block-id"))return t;t=t.parentNode}return null}function $o(e){return e.textContent||""}function Xt(e){return e.trim().split(/\s+/).filter(t=>t.length>0).length}function Jt(e,t=!0){return t?e.length:e.replace(/\s/g,"").length}function jo(){const e=window.getSelection();return e?e.isCollapsed:!0}function Zt(){const e=window.getSelection();return e&&e.rangeCount>0?e.getRangeAt(0):null}function Qt(e){const t=window.getSelection();t&&(t.removeAllRanges(),t.addRange(e))}function Ro(){var e;return((e=Zt())==null?void 0:e.cloneRange())||null}function Do(e){e&&Qt(e)}function Io(e){const t=document.createRange(),n=window.getSelection();t.selectNodeContents(e),t.collapse(!1),n&&(n.removeAllRanges(),n.addRange(t))}function zo(e){const t=document.createRange(),n=window.getSelection();t.selectNodeContents(e),t.collapse(!0),n&&(n.removeAllRanges(),n.addRange(t))}function Po(e){return(e.textContent||"").trim().length===0&&!e.querySelector("img, video, iframe")}function en(e){const t=document.createElement("div");return t.innerHTML=e,t.textContent||t.innerText||""}function tn(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Ye=new Map;function Oo(e){const t=tn(en(e));if(!t)return"heading";const n=Ye.get(t)||0;return Ye.set(t,n+1),n===0?t:`${t}-${n}`}function Fo(){Ye.clear()}function Uo(e){const t=document.createElement("div");return t.textContent=e,t.innerHTML}function Vo(e){const t=document.createElement("template");return t.innerHTML=e.trim(),t.content}function Wo(e){return e.outerHTML}function _o(e){const t=e.parentElement;return t?Array.from(t.children).indexOf(e):-1}function Pe(e,t){const n=t.parentElement;n&&n.insertBefore(e,t.nextSibling)}function nn(e,t){const n=t.parentElement;n&&n.insertBefore(e,t)}function Yo(e,t){var c;const n=e.parentNode,o=e.nextSibling===t?e:e.nextSibling;(c=t.parentNode)==null||c.insertBefore(e,t),n==null||n.insertBefore(t,o)}function Ko(e,t){const n=t.toLowerCase().split("+"),o=n.pop(),c={ctrl:n.includes("ctrl")||n.includes("cmd"),shift:n.includes("shift"),alt:n.includes("alt")},r=e.ctrlKey||e.metaKey;return e.key.toLowerCase()===o&&r===c.ctrl&&e.shiftKey===c.shift&&e.altKey===c.alt}function Go(e,t,n){const o=document.createElement(e);if(t)for(const[c,r]of Object.entries(t))o.setAttribute(c,r);if(n)for(const c of n)typeof c=="string"?o.appendChild(document.createTextNode(c)):o.appendChild(c);return o}function Xo(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}function Jo(){return"ontouchstart"in window||navigator.maxTouchPoints>0}function Zo(e,t){return window.getComputedStyle(e).getPropertyValue(t)}function Qo(e){return requestAnimationFrame(e)}function ec(e){cancelAnimationFrame(e)}const tc={get(e,t){try{const n=localStorage.getItem(e);return n?JSON.parse(n):t}catch{return t}},set(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch{}},remove(e){try{localStorage.removeItem(e)}catch{}}};class nc{constructor(){Re(this,"listeners",new Map)}on(t,n){return this.listeners.has(t)||this.listeners.set(t,new Set),this.listeners.get(t).add(n),()=>this.off(t,n)}off(t,n){var o;(o=this.listeners.get(t))==null||o.delete(n)}emit(t,n){var o;(o=this.listeners.get(t))==null||o.forEach(c=>c(n))}removeAllListeners(){this.listeners.clear()}}class on{constructor(){Re(this,"blocks",new Map);Re(this,"defaultBlock","paragraph")}register(t){this.blocks.set(t.name,t)}unregister(t){this.blocks.delete(t)}get(t){return this.blocks.get(t)}has(t){return this.blocks.has(t)}getAll(){return Array.from(this.blocks.values())}getNames(){return Array.from(this.blocks.keys())}setDefaultBlock(t){this.has(t)&&(this.defaultBlock=t)}getDefaultBlock(){return this.defaultBlock}createBlock(t,n){const o=this.get(t);if(!o)return console.warn(`Block type "${t}" is not registered`),null;const c={id:F(),type:t,...n},r=o.create(c);return r.setAttribute("data-block-id",c.id),r.setAttribute("data-block-type",t),r}getBlockType(t){return t.getAttribute("data-block-type")}getBlockData(t){const n=this.getBlockType(t);if(!n)return null;const o=this.get(n);return o?o.getData(t):null}updateBlock(t,n){const o=this.getBlockType(t);if(!o)return;const c=this.get(o);c&&c.update(t,n)}transformBlock(t,n){const o=this.getBlockType(t);if(!o||o===n)return t;const c=this.get(o),r=this.get(n);if(!c||!r)return null;const i=t.innerHTML,a=t.getAttribute("data-block-id")||F(),u=this.createBlock(n,{id:a});if(!u)return null;if(r.editable){const w=u.querySelector('[contenteditable="true"]')||u;w instanceof HTMLElement&&(w.innerHTML=i)}return u}}const de=new on,ct={name:"paragraph",tag:"p",editable:!0,allowedChildren:["text","inline"],className:"cb-paragraph",icon:"paragraph",label:"Paragraph",shortcut:"Ctrl+0",create(e){const t=document.createElement("p");return t.className="cb-paragraph",t.setAttribute("contenteditable","true"),t.setAttribute("data-block-id",(e==null?void 0:e.id)||F()),t.setAttribute("data-block-type","paragraph"),e!=null&&e.content&&(t.innerHTML=e.content),e!=null&&e.align&&(t.style.textAlign=e.align),e!=null&&e.className&&(t.className=`cb-paragraph ${e.className}`),e!=null&&e.content||t.setAttribute("data-placeholder","Type something..."),t},getData(e){return{id:e.getAttribute("data-block-id")||F(),type:"paragraph",content:e.innerHTML,align:e.style.textAlign,className:e.className}},update(e,t){t.content!==void 0&&(e.innerHTML=t.content),t.align&&(e.style.textAlign=t.align),t.className&&(e.className=`cb-paragraph ${t.className}`)}};function we(e){return{name:"heading",tag:`h${e}`,editable:!0,allowedChildren:["text","inline"],className:`cb-heading cb-h${e}`,icon:`heading${e}`,label:e===1?"Title":`Heading ${e}`,shortcut:`Ctrl+${e}`,create(t){const n=(t==null?void 0:t.level)||e,o=`h${n}`,c=document.createElement(o);return c.className=`cb-heading cb-h${n}`,c.setAttribute("contenteditable","true"),c.setAttribute("data-block-id",(t==null?void 0:t.id)||F()),c.setAttribute("data-block-type","heading"),c.setAttribute("data-heading-level",String(n)),t!=null&&t.content&&(c.innerHTML=t.content),t!=null&&t.align&&(c.style.textAlign=t.align),t!=null&&t.content||c.setAttribute("data-placeholder",n===1?"Title":`Heading ${n}`),c},getData(t){const n=t.getAttribute("data-heading-level");return{id:t.getAttribute("data-block-id")||F(),type:"heading",level:n?parseInt(n,10):e,content:t.innerHTML,align:t.style.textAlign}},update(t,n){n.content!==void 0&&(t.innerHTML=n.content),n.align&&(t.style.textAlign=n.align),n.level&&n.level!==e&&t.setAttribute("data-heading-level",String(n.level))}}}const rt=we(1),lt=we(2),it=we(3),cn=we(4),rn=we(5),ln=we(6);function oc(e,t){return we(e).create({...t,level:e,type:"heading"})}function Be(e,t){const n=document.createElement("li");if(n.className="cb-list-item",n.setAttribute("data-item-id",e.id),t==="checkList"){const o=document.createElement("div");o.className="cb-checklist-wrapper";const c=document.createElement("input");c.type="checkbox",c.className="cb-checkbox",c.checked=e.checked||!1,c.setAttribute("tabindex","-1");const r=document.createElement("span");r.className="cb-checklist-content",r.setAttribute("contenteditable","true"),r.innerHTML=e.content,o.appendChild(c),o.appendChild(r),n.appendChild(o),e.checked&&n.classList.add("cb-checked")}else n.setAttribute("contenteditable","true"),n.innerHTML=e.content;if(e.children&&e.children.length>0){const o=document.createElement(t==="numberedList"?"ol":"ul");o.className=`cb-nested-list cb-${t}`,e.children.forEach(c=>{o.appendChild(Be(c,t))}),n.appendChild(o)}return n}function an(e,t){const n=[];return e.querySelectorAll(":scope > li").forEach(o=>{const c={id:o.getAttribute("data-item-id")||F(),content:"",checked:!1,children:[]};if(t==="checkList"){const i=o.querySelector(".cb-checkbox"),a=o.querySelector(".cb-checklist-content");c.checked=(i==null?void 0:i.checked)||!1,c.content=(a==null?void 0:a.innerHTML)||""}else{const i=o.cloneNode(!0),a=i.querySelector("ul, ol");a&&a.remove(),c.content=i.innerHTML}const r=o.querySelector(":scope > ul, :scope > ol");r&&(c.children=an(r,t)),n.push(c)}),n}function at(e){const t=e==="numberedList"?"ol":"ul";return{name:e,tag:t,editable:!0,allowedChildren:["text","inline","block"],className:`cb-list cb-${e}`,icon:e==="bulletList"?"list":e==="numberedList"?"listOrdered":"checkList",label:e==="bulletList"?"Bullet List":e==="numberedList"?"Numbered List":"Checklist",shortcut:e==="bulletList"?"Ctrl+Shift+8":e==="numberedList"?"Ctrl+Shift+7":void 0,create(o){const c=document.createElement(t);if(c.className=`cb-list cb-${e}`,c.setAttribute("data-block-id",(o==null?void 0:o.id)||F()),c.setAttribute("data-block-type",e),o!=null&&o.items&&o.items.length>0)o.items.forEach(r=>{c.appendChild(Be(r,e))});else{const r={id:F(),content:"",checked:!1};c.appendChild(Be(r,e))}return c},getData(o){return{id:o.getAttribute("data-block-id")||F(),type:e,items:an(o,e)}},update(o,c){c.items&&(o.innerHTML="",c.items.forEach(r=>{o.appendChild(Be(r,e))}))}}}const st=at("bulletList"),dt=at("numberedList"),sn=at("checkList");function cc(e,t,n=""){const o=e.getAttribute("data-block-type"),c={id:F(),content:n,checked:!1},r=Be(c,o);if(t){const a=e.querySelector(`[data-item-id="${t}"]`);a&&a.parentElement===e?a.after(r):e.appendChild(r)}else e.appendChild(r);const i=o==="checkList"?r.querySelector(".cb-checklist-content"):r;return i instanceof HTMLElement&&i.focus(),c}function rc(e,t){const n=e.querySelector(`[data-item-id="${t}"]`);if(!n)return!1;if(e.querySelectorAll(":scope > li").length<=1){const c=n.querySelector(".cb-checklist-content")||n;return c instanceof HTMLElement&&(c.innerHTML=""),!1}return n.remove(),!0}function lc(e){const t=e.querySelector(".cb-checkbox");return t?(t.checked=!t.checked,e.classList.toggle("cb-checked",t.checked),t.checked):!1}function ic(e){const t=e.previousElementSibling;if(!t)return!1;const n=e.parentElement;if(!n)return!1;const o=n.getAttribute("data-block-type"),c=o==="numberedList"?"ol":"ul";let r=t.querySelector(`:scope > ${c}`);return r||(r=document.createElement(c),r.className=`cb-nested-list cb-${o}`,t.appendChild(r)),r.appendChild(e),!0}function ac(e){const t=e.parentElement;if(!t||!t.classList.contains("cb-nested-list"))return!1;const n=t.parentElement;if(!n)return!1;const o=n.parentElement;return o?(o.insertBefore(e,n.nextSibling),t.children.length===0&&t.remove(),!0):!1}const ut={name:"quote",tag:"blockquote",editable:!0,allowedChildren:["text","inline"],className:"cb-quote",icon:"quote",label:"Quote",shortcut:"Ctrl+Shift+.",create(e){const t=document.createElement("blockquote");t.className="cb-quote",t.setAttribute("data-block-id",(e==null?void 0:e.id)||F()),t.setAttribute("data-block-type","quote");const n=document.createElement("p");if(n.className="cb-quote-content",n.setAttribute("contenteditable","true"),e!=null&&e.content?n.innerHTML=e.content:n.setAttribute("data-placeholder","Type a quote..."),t.appendChild(n),e!=null&&e.citation){const o=document.createElement("cite");o.className="cb-quote-citation",o.setAttribute("contenteditable","true"),o.textContent=e.citation,t.appendChild(o)}return t},getData(e){const t=e.querySelector(".cb-quote-content"),n=e.querySelector(".cb-quote-citation");return{id:e.getAttribute("data-block-id")||F(),type:"quote",content:(t==null?void 0:t.innerHTML)||e.innerHTML,citation:(n==null?void 0:n.textContent)||void 0}},update(e,t){if(t.content!==void 0){const n=e.querySelector(".cb-quote-content");n&&(n.innerHTML=t.content)}if(t.citation!==void 0){let n=e.querySelector(".cb-quote-citation");t.citation?(n||(n=document.createElement("cite"),n.className="cb-quote-citation",n.setAttribute("contenteditable","true"),e.appendChild(n)),n.textContent=t.citation):n&&n.remove()}}};function sc(e,t){let n=e.querySelector(".cb-quote-citation");n||(n=document.createElement("cite"),n.className="cb-quote-citation",n.setAttribute("contenteditable","true"),e.appendChild(n)),n.textContent=t}function dc(e){const t=e.querySelector(".cb-quote-citation");t&&t.remove()}const dn=[{value:"plaintext",label:"Plain Text"},{value:"javascript",label:"JavaScript"},{value:"typescript",label:"TypeScript"},{value:"python",label:"Python"},{value:"java",label:"Java"},{value:"csharp",label:"C#"},{value:"cpp",label:"C++"},{value:"go",label:"Go"},{value:"rust",label:"Rust"},{value:"php",label:"PHP"},{value:"ruby",label:"Ruby"},{value:"swift",label:"Swift"},{value:"kotlin",label:"Kotlin"},{value:"html",label:"HTML"},{value:"css",label:"CSS"},{value:"scss",label:"SCSS"},{value:"json",label:"JSON"},{value:"yaml",label:"YAML"},{value:"xml",label:"XML"},{value:"markdown",label:"Markdown"},{value:"sql",label:"SQL"},{value:"bash",label:"Bash"},{value:"shell",label:"Shell"},{value:"dockerfile",label:"Dockerfile"}],pt={name:"code",tag:"pre",editable:!0,allowedChildren:["text"],className:"cb-code-block",icon:"code",label:"Code Block",shortcut:"Ctrl+Shift+C",create(e){const t=document.createElement("div");t.className="cb-code-wrapper",t.setAttribute("data-block-id",(e==null?void 0:e.id)||F()),t.setAttribute("data-block-type","code");const n=document.createElement("div");n.className="cb-code-toolbar";const o=document.createElement("select");o.className="cb-code-language",o.setAttribute("tabindex","-1"),dn.forEach(a=>{const u=document.createElement("option");u.value=a.value,u.textContent=a.label,(e==null?void 0:e.language)===a.value&&(u.selected=!0),o.appendChild(u)});const c=document.createElement("button");c.type="button",c.className="cb-code-copy",c.setAttribute("tabindex","-1"),c.innerHTML='<span class="cb-copy-text">Copy</span>',c.onclick=()=>{const a=t.querySelector("code");a&&(navigator.clipboard.writeText(a.textContent||""),c.innerHTML='<span class="cb-copy-text">Copied!</span>',setTimeout(()=>{c.innerHTML='<span class="cb-copy-text">Copy</span>'},2e3))},n.appendChild(o),n.appendChild(c);const r=document.createElement("pre");r.className="cb-code-block";const i=document.createElement("code");return i.className=`cb-code language-${(e==null?void 0:e.language)||"plaintext"}`,i.setAttribute("contenteditable","true"),i.setAttribute("spellcheck","false"),i.setAttribute("data-placeholder","Write your code here..."),e!=null&&e.content&&(i.textContent=e.content),o.onchange=()=>{i.className=`cb-code language-${o.value}`,t.setAttribute("data-language",o.value)},r.appendChild(i),t.appendChild(n),t.appendChild(r),e!=null&&e.language&&t.setAttribute("data-language",e.language),t},getData(e){const t=e.querySelector("code"),n=e.querySelector(".cb-code-language");return{id:e.getAttribute("data-block-id")||F(),type:"code",content:(t==null?void 0:t.textContent)||"",language:(n==null?void 0:n.value)||e.getAttribute("data-language")||"plaintext"}},update(e,t){if(t.content!==void 0){const n=e.querySelector("code");n&&(n.textContent=t.content)}if(t.language){const n=e.querySelector("code"),o=e.querySelector(".cb-code-language");n&&(n.className=`cb-code language-${t.language}`),o&&(o.value=t.language),e.setAttribute("data-language",t.language)}}};function uc(e,t){const n=e.querySelector("code"),o=e.querySelector(".cb-code-language");n&&(n.className=`cb-code language-${t}`),o&&(o.value=t),e.setAttribute("data-language",t)}function pc(e){const t=e.querySelector("code");return(t==null?void 0:t.textContent)||""}function un(e){["se","sw","ne","nw","e","w"].forEach(n=>{const o=document.createElement("div");o.className=`cb-image-resize-handle handle-${n}`,o.setAttribute("data-handle",n),e.appendChild(o)})}const ht={name:"image",tag:"figure",editable:!1,allowedChildren:[],className:"cb-image",icon:"image",label:"Image",create(e){const t=document.createElement("figure");t.className="cb-image",t.setAttribute("data-block-id",(e==null?void 0:e.id)||F()),t.setAttribute("data-block-type","image");const n=document.createElement("div");if(n.className="cb-image-container",e!=null&&e.src){const c=document.createElement("div");c.className="cb-image-resizable";const r=document.createElement("img");r.className="cb-image-element",r.src=e.src,r.alt=e.alt||"",e.width&&(r.style.width=typeof e.width=="number"?`${e.width}px`:e.width),e.height&&(r.style.height=typeof e.height=="number"?`${e.height}px`:e.height),c.appendChild(r),un(c),n.appendChild(c)}else{const c=document.createElement("div");c.className="cb-image-placeholder",c.innerHTML=`
|
|
2
2
|
<div class="cb-image-placeholder-content">
|
|
3
3
|
<svg width="56" height="56" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
|
|
4
4
|
<rect x="3" y="3" width="18" height="18" rx="2" ry="2"/>
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
<path d="M18 22V8a2 2 0 0 0-2-2H2"/>
|
|
36
36
|
</svg>
|
|
37
37
|
</button>
|
|
38
|
-
`,t.appendChild(c)}const o=document.createElement("figcaption");return o.className="cb-image-caption",o.setAttribute("contenteditable","true"),o.setAttribute("data-placeholder","Add a caption..."),e!=null&&e.caption&&(o.textContent=e.caption),t.appendChild(o),e!=null&&e.align&&t.setAttribute("data-align",e.align),t},getData(e){const t=e.querySelector("img"),n=e.querySelector("figcaption");return{id:e.getAttribute("data-block-id")||F(),type:"image",src:(t==null?void 0:t.src)||"",alt:(t==null?void 0:t.alt)||"",caption:(n==null?void 0:n.textContent)||void 0,width:(t==null?void 0:t.style.width)||void 0,height:(t==null?void 0:t.style.height)||void 0,align:e.getAttribute("data-align")||void 0}},update(e,t){const n=e.querySelector("img"),o=e.querySelector("figcaption");n&&(t.src&&(n.src=t.src),t.alt!==void 0&&(n.alt=t.alt),t.width&&(n.style.width=typeof t.width=="number"?`${t.width}px`:t.width),t.height&&(n.style.height=typeof t.height=="number"?`${t.height}px`:t.height)),o&&t.caption!==void 0&&(o.textContent=t.caption),t.align&&e.setAttribute("data-align",t.align)}};function Ke(e,t,n=""){let o=e.querySelector("img");const c=e.querySelector(".cb-image-container");if(!o&&c){const r=c.querySelector(".cb-image-placeholder");r&&r.remove();const i=document.createElement("div");i.className="cb-image-resizable",o=document.createElement("img"),o.className="cb-image-element",i.appendChild(o),un(i),c.appendChild(i)}o&&(o.src=t,o.alt=n)}function pn(e,t){e.setAttribute("data-align",t)}function hn(e){return new Promise((t,n)=>{if(!e.type.startsWith("image/")){n(new Error("File is not an image"));return}const o=new FileReader;o.onload=()=>t(o.result),o.onerror=()=>n(o.error),o.readAsDataURL(e)})}function
|
|
38
|
+
`,t.appendChild(c)}const o=document.createElement("figcaption");return o.className="cb-image-caption",o.setAttribute("contenteditable","true"),o.setAttribute("data-placeholder","Add a caption..."),e!=null&&e.caption&&(o.textContent=e.caption),t.appendChild(o),e!=null&&e.align&&t.setAttribute("data-align",e.align),t},getData(e){const t=e.querySelector("img"),n=e.querySelector("figcaption");return{id:e.getAttribute("data-block-id")||F(),type:"image",src:(t==null?void 0:t.src)||"",alt:(t==null?void 0:t.alt)||"",caption:(n==null?void 0:n.textContent)||void 0,width:(t==null?void 0:t.style.width)||void 0,height:(t==null?void 0:t.style.height)||void 0,align:e.getAttribute("data-align")||void 0}},update(e,t){const n=e.querySelector("img"),o=e.querySelector("figcaption");n&&(t.src&&(n.src=t.src),t.alt!==void 0&&(n.alt=t.alt),t.width&&(n.style.width=typeof t.width=="number"?`${t.width}px`:t.width),t.height&&(n.style.height=typeof t.height=="number"?`${t.height}px`:t.height)),o&&t.caption!==void 0&&(o.textContent=t.caption),t.align&&e.setAttribute("data-align",t.align)}};function Ke(e,t,n=""){let o=e.querySelector("img");const c=e.querySelector(".cb-image-container");if(!o&&c){const r=c.querySelector(".cb-image-placeholder");r&&r.remove();const i=document.createElement("div");i.className="cb-image-resizable",o=document.createElement("img"),o.className="cb-image-element",i.appendChild(o),un(i),c.appendChild(i)}o&&(o.src=t,o.alt=n)}function pn(e,t){e.setAttribute("data-align",t)}function hn(e){return new Promise((t,n)=>{if(!e.type.startsWith("image/")){n(new Error("File is not an image"));return}const o=new FileReader;o.onload=()=>t(o.result),o.onerror=()=>n(o.error),o.readAsDataURL(e)})}function hc(e,t,n,o){return new Promise((c,r)=>{const i=new Image;i.crossOrigin="anonymous",i.onload=()=>{const a=document.createElement("canvas"),u=a.getContext("2d");if(!u){r(new Error("Could not get canvas context"));return}const w=i.naturalWidth/n,x=i.naturalHeight/o,m=t.x*w,N=t.y*x,L=t.width*w,C=t.height*x;a.width=L,a.height=C,u.drawImage(i,m,N,L,C,0,0,L,C),c(a.toDataURL("image/png"))},i.onerror=()=>r(new Error("Failed to load image")),i.src=e})}function bc(e,t,n){var oe,he,S,B,W;const o=document.createElement("div");o.className="cb-crop-modal",o.innerHTML=`
|
|
39
39
|
<div class="cb-crop-modal-backdrop"></div>
|
|
40
40
|
<div class="cb-crop-modal-content">
|
|
41
41
|
<div class="cb-crop-modal-header">
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
<button type="button" class="cb-crop-save-btn">Apply Crop</button>
|
|
77
77
|
</div>
|
|
78
78
|
</div>
|
|
79
|
-
`;let c={x:50,y:50,width:200,height:200},r=null,i=!1,a=!1,
|
|
79
|
+
`;let c={x:50,y:50,width:200,height:200},r=null,i=!1,a=!1,u=null,w=0,x=0,m={...c},N=0,L=0,C=!1;const A=o.querySelector(".cb-crop-image-wrapper"),H=o.querySelector(".cb-crop-image"),U=o.querySelector(".cb-crop-area"),D=30;H.onload=()=>{N=H.offsetWidth,L=H.offsetHeight,A.style.width=`${N}px`,A.style.height=`${L}px`;const v=N*.8,q=L*.8;c={x:(N-v)/2,y:(L-q)/2,width:v,height:q},ee()};const ee=()=>{U.style.left=`${c.x}px`,U.style.top=`${c.y}px`,U.style.width=`${c.width}px`,U.style.height=`${c.height}px`},T=v=>{let q=Math.max(0,v.x),R=Math.max(0,v.y),z=Math.max(D,v.width),_=Math.max(D,v.height);return q+z>N&&(z>N?(z=N,q=0):q=N-z),R+_>L&&(_>L?(_=L,R=0):R=L-_),{x:q,y:R,width:z,height:_}},le=v=>{v.target.classList.contains("cb-crop-handle")||(i=!0,w=v.clientX,x=v.clientY,m={...c},v.preventDefault())};U.addEventListener("mousedown",le);const te=v=>{const q=v.currentTarget;a=!0,u=q.dataset.handle||null,w=v.clientX,x=v.clientY,m={...c},v.preventDefault(),v.stopPropagation()};o.querySelectorAll(".cb-crop-handle").forEach(v=>{v.addEventListener("mousedown",te)});const ne=v=>{if(!i&&!a)return;const q=v.clientX-w,R=v.clientY-x;if(i)c=T({x:m.x+q,y:m.y+R,width:m.width,height:m.height}),ee();else if(a&&u){let z=m.x,_=m.y,Y=m.width,J=m.height;if(u.includes("e")&&(Y=m.width+q),u.includes("w")){const Z=m.width-D,P=Math.min(q,Z);z=m.x+P,Y=m.width-P,z<0&&(Y=Y+z,z=0)}if(u.includes("s")&&(J=m.height+R),u.includes("n")){const Z=m.height-D,P=Math.min(R,Z);_=m.y+P,J=m.height-P,_<0&&(J=J+_,_=0)}if(r!==null)if(u==="e"||u==="w")J=Y/r;else if(u==="n"||u==="s")Y=J*r;else{const Z=Y/r,P=J*r;Math.abs(Y-P)<Math.abs(J-Z)?Y=P:J=Z}Y=Math.max(D,Math.min(Y,N-z)),J=Math.max(D,Math.min(J,L-_)),r!==null&&(Y/J>r?Y=J*r:J=Y/r),c={x:z,y:_,width:Y,height:J},ee()}},ke=()=>{i=!1,a=!1,u=null},Ce=v=>{v.key==="Escape"&&(v.preventDefault(),ae())};document.addEventListener("mousemove",ne),document.addEventListener("mouseup",ke),document.addEventListener("keydown",Ce);const ie=()=>{document.removeEventListener("mousemove",ne),document.removeEventListener("mouseup",ke),document.removeEventListener("keydown",Ce)},ae=()=>{C||(C=!0,ie(),o.parentNode&&o.parentNode.removeChild(o))};return o.querySelectorAll(".cb-crop-aspect-btn").forEach(v=>{v.addEventListener("click",q=>{q.preventDefault(),q.stopPropagation(),o.querySelectorAll(".cb-crop-aspect-btn").forEach(z=>z.classList.remove("active")),v.classList.add("active");const R=v.dataset.aspect;if(R==="free")r=null;else if(R){const[z,_]=R.split(":").map(Number);r=z/_;const Y=c.x+c.width/2,J=c.y+c.height/2;let Z=c.width,P=Z/r;P>c.height&&(P=c.height,Z=P*r),Z>N&&(Z=N,P=Z/r),P>L&&(P=L,Z=P*r);let se=Y-Z/2,ge=J-P/2;se=Math.max(0,Math.min(se,N-Z)),ge=Math.max(0,Math.min(ge,L-P)),c={x:se,y:ge,width:Z,height:P},ee()}})}),(oe=o.querySelector(".cb-crop-modal-close"))==null||oe.addEventListener("click",v=>{v.preventDefault(),v.stopPropagation(),ae()}),(he=o.querySelector(".cb-crop-modal-backdrop"))==null||he.addEventListener("click",v=>{v.preventDefault(),v.stopPropagation(),ae()}),(S=o.querySelector(".cb-crop-cancel-btn"))==null||S.addEventListener("click",v=>{v.preventDefault(),v.stopPropagation(),ae()}),(B=o.querySelector(".cb-crop-save-btn"))==null||B.addEventListener("click",async v=>{if(v.preventDefault(),v.stopPropagation(),!C)try{const q=await hc(H.src,c,N,L);ae(),t(q)}catch(q){console.error("Failed to crop image:",q)}}),(W=o.querySelector(".cb-crop-modal-content"))==null||W.addEventListener("click",v=>{v.stopPropagation()}),o}const Ve={youtube:/(?:youtube\.com\/(?:watch\?v=|embed\/)|youtu\.be\/)([a-zA-Z0-9_-]{11})/,vimeo:/vimeo\.com\/(?:video\/)?(\d+)/,dailymotion:/dailymotion\.com\/(?:video|embed\/video)\/([a-zA-Z0-9]+)/},bn={name:"video",tag:"figure",editable:!1,allowedChildren:[],className:"cb-video",icon:"video",label:"Video",create(e){const t=document.createElement("figure");t.className="cb-video",t.setAttribute("data-block-id",(e==null?void 0:e.id)||F()),t.setAttribute("data-block-type","video");const n=document.createElement("div");if(n.className="cb-video-container",e!=null&&e.src){const c=Ie(e.src);if(c){const r=document.createElement("iframe");r.className="cb-video-iframe",r.src=c,r.setAttribute("frameborder","0"),r.setAttribute("allowfullscreen","true"),r.setAttribute("allow","accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"),e.width&&(r.style.width=typeof e.width=="number"?`${e.width}px`:e.width),e.height&&(r.style.height=typeof e.height=="number"?`${e.height}px`:e.height),n.appendChild(r)}else{const r=document.createElement("video");r.className="cb-video-element",r.src=e.src,r.controls=!0,e.poster&&(r.poster=e.poster),e.width&&(r.style.width=typeof e.width=="number"?`${e.width}px`:e.width),e.height&&(r.style.height=typeof e.height=="number"?`${e.height}px`:e.height),n.appendChild(r)}}else{const c=document.createElement("div");c.className="cb-video-placeholder",c.innerHTML=`
|
|
80
80
|
<div class="cb-video-placeholder-content">
|
|
81
81
|
<svg width="56" height="56" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
|
|
82
82
|
<path d="m22 8-6 4 6 4V8Z"/>
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
<span class="cb-video-placeholder-hint">Paste a URL below and press Enter</span>
|
|
87
87
|
<input type="text" class="cb-video-url-input" placeholder="https://youtube.com/watch?v=... or vimeo.com/..." />
|
|
88
88
|
</div>
|
|
89
|
-
`,n.appendChild(c)}t.appendChild(n);const o=document.createElement("figcaption");return o.className="cb-video-caption",o.setAttribute("contenteditable","true"),o.setAttribute("data-placeholder","Add a caption..."),e!=null&&e.caption&&(o.textContent=e.caption),t.appendChild(o),t},getData(e){const t=e.querySelector("iframe"),n=e.querySelector("video"),o=e.querySelector("figcaption");return{id:e.getAttribute("data-block-id")||F(),type:"video",src:(t==null?void 0:t.src)||(n==null?void 0:n.src)||"",poster:(n==null?void 0:n.poster)||void 0,caption:(o==null?void 0:o.textContent)||void 0,width:(t==null?void 0:t.style.width)||(n==null?void 0:n.style.width)||void 0,height:(t==null?void 0:t.style.height)||(n==null?void 0:n.style.height)||void 0}},update(e,t){if(t.src){const n=e.querySelector(".cb-video-container");if(n){n.innerHTML="";const o=Ie(t.src);if(o){const c=document.createElement("iframe");c.className="cb-video-iframe",c.src=o,c.setAttribute("frameborder","0"),c.setAttribute("allowfullscreen","true"),n.appendChild(c)}else{const c=document.createElement("video");c.className="cb-video-element",c.src=t.src,c.controls=!0,t.poster&&(c.poster=t.poster),n.appendChild(c)}}}if(t.caption!==void 0){const n=e.querySelector("figcaption");n&&(n.textContent=t.caption)}}};function Ie(e){const t=e.match(Ve.youtube);if(t)return`https://www.youtube.com/embed/${t[1]}`;const n=e.match(Ve.vimeo);if(n)return`https://player.vimeo.com/video/${n[1]}`;const o=e.match(Ve.dailymotion);return o?`https://www.dailymotion.com/embed/video/${o[1]}`:e.includes("youtube.com/embed/")||e.includes("player.vimeo.com/")||e.includes("dailymotion.com/embed/")?e:null}function gn(e,t){const n=e.querySelector(".cb-video-container");if(!n)return;n.innerHTML="";const o=Ie(t);if(o){const c=document.createElement("iframe");c.className="cb-video-iframe",c.src=o,c.setAttribute("frameborder","0"),c.setAttribute("allowfullscreen","true"),c.setAttribute("allow","accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"),n.appendChild(c)}else if(t){const c=document.createElement("video");c.className="cb-video-element",c.src=t,c.controls=!0,n.appendChild(c)}}const bt={name:"divider",tag:"hr",editable:!1,allowedChildren:[],className:"cb-divider",icon:"minus",label:"Divider",shortcut:"Ctrl+Shift+-",create(e){const t=document.createElement("div");t.className="cb-divider-wrapper",t.setAttribute("data-block-id",(e==null?void 0:e.id)||F()),t.setAttribute("data-block-type","divider"),t.setAttribute("contenteditable","false");const n=document.createElement("hr");return n.className="cb-divider",e!=null&&e.style&&(n.setAttribute("data-style",e.style),t.setAttribute("data-divider-style",e.style)),t.appendChild(n),t},getData(e){const t=e.querySelector("hr");return{id:e.getAttribute("data-block-id")||F(),type:"divider",style:(t==null?void 0:t.getAttribute("data-style"))||e.getAttribute("data-divider-style")||"solid"}},update(e,t){if(t.style){const n=e.querySelector("hr");n&&n.setAttribute("data-style",t.style),e.setAttribute("data-divider-style",t.style)}}};function
|
|
89
|
+
`,n.appendChild(c)}t.appendChild(n);const o=document.createElement("figcaption");return o.className="cb-video-caption",o.setAttribute("contenteditable","true"),o.setAttribute("data-placeholder","Add a caption..."),e!=null&&e.caption&&(o.textContent=e.caption),t.appendChild(o),t},getData(e){const t=e.querySelector("iframe"),n=e.querySelector("video"),o=e.querySelector("figcaption");return{id:e.getAttribute("data-block-id")||F(),type:"video",src:(t==null?void 0:t.src)||(n==null?void 0:n.src)||"",poster:(n==null?void 0:n.poster)||void 0,caption:(o==null?void 0:o.textContent)||void 0,width:(t==null?void 0:t.style.width)||(n==null?void 0:n.style.width)||void 0,height:(t==null?void 0:t.style.height)||(n==null?void 0:n.style.height)||void 0}},update(e,t){if(t.src){const n=e.querySelector(".cb-video-container");if(n){n.innerHTML="";const o=Ie(t.src);if(o){const c=document.createElement("iframe");c.className="cb-video-iframe",c.src=o,c.setAttribute("frameborder","0"),c.setAttribute("allowfullscreen","true"),n.appendChild(c)}else{const c=document.createElement("video");c.className="cb-video-element",c.src=t.src,c.controls=!0,t.poster&&(c.poster=t.poster),n.appendChild(c)}}}if(t.caption!==void 0){const n=e.querySelector("figcaption");n&&(n.textContent=t.caption)}}};function Ie(e){const t=e.match(Ve.youtube);if(t)return`https://www.youtube.com/embed/${t[1]}`;const n=e.match(Ve.vimeo);if(n)return`https://player.vimeo.com/video/${n[1]}`;const o=e.match(Ve.dailymotion);return o?`https://www.dailymotion.com/embed/video/${o[1]}`:e.includes("youtube.com/embed/")||e.includes("player.vimeo.com/")||e.includes("dailymotion.com/embed/")?e:null}function gn(e,t){const n=e.querySelector(".cb-video-container");if(!n)return;n.innerHTML="";const o=Ie(t);if(o){const c=document.createElement("iframe");c.className="cb-video-iframe",c.src=o,c.setAttribute("frameborder","0"),c.setAttribute("allowfullscreen","true"),c.setAttribute("allow","accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"),n.appendChild(c)}else if(t){const c=document.createElement("video");c.className="cb-video-element",c.src=t,c.controls=!0,n.appendChild(c)}}const bt={name:"divider",tag:"hr",editable:!1,allowedChildren:[],className:"cb-divider",icon:"minus",label:"Divider",shortcut:"Ctrl+Shift+-",create(e){const t=document.createElement("div");t.className="cb-divider-wrapper",t.setAttribute("data-block-id",(e==null?void 0:e.id)||F()),t.setAttribute("data-block-type","divider"),t.setAttribute("contenteditable","false");const n=document.createElement("hr");return n.className="cb-divider",e!=null&&e.style&&(n.setAttribute("data-style",e.style),t.setAttribute("data-divider-style",e.style)),t.appendChild(n),t},getData(e){const t=e.querySelector("hr");return{id:e.getAttribute("data-block-id")||F(),type:"divider",style:(t==null?void 0:t.getAttribute("data-style"))||e.getAttribute("data-divider-style")||"solid"}},update(e,t){if(t.style){const n=e.querySelector("hr");n&&n.setAttribute("data-style",t.style),e.setAttribute("data-divider-style",t.style)}}};function gc(e,t){const n=e.querySelector("hr");n&&n.setAttribute("data-style",t),e.setAttribute("data-divider-style",t)}const ve={info:'<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/></svg>',warning:'<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z"/><path d="M12 9v4"/><path d="M12 17h.01"/></svg>',error:'<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/><path d="m15 9-6 6"/><path d="m9 9 6 6"/></svg>',success:'<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/></svg>',note:'<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><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"/><polyline points="14 2 14 8 20 8"/><line x1="16" x2="8" y1="13" y2="13"/><line x1="16" x2="8" y1="17" y2="17"/><line x1="10" x2="8" y1="9" y2="9"/></svg>'},mn={name:"callout",tag:"aside",editable:!0,allowedChildren:["text","inline"],className:"cb-callout",icon:"alertCircle",label:"Callout",create(e){const t=(e==null?void 0:e.calloutType)||"info",n=document.createElement("aside");n.className=`cb-callout cb-callout-${t}`,n.setAttribute("data-block-id",(e==null?void 0:e.id)||F()),n.setAttribute("data-block-type","callout"),n.setAttribute("data-callout-type",t);const o=document.createElement("div");o.className="cb-callout-icon",o.innerHTML=ve[t],n.appendChild(o);const c=document.createElement("div");if(c.className="cb-callout-content",e!=null&&e.title){const a=document.createElement("div");a.className="cb-callout-title",a.setAttribute("contenteditable","true"),a.textContent=e.title,c.appendChild(a)}const r=document.createElement("div");r.className="cb-callout-body",r.setAttribute("contenteditable","true"),r.setAttribute("data-placeholder","Type callout content..."),e!=null&&e.content&&(r.innerHTML=e.content),c.appendChild(r),n.appendChild(c);const i=document.createElement("div");return i.className="cb-callout-type-selector",i.innerHTML=`
|
|
90
90
|
<button type="button" data-type="info" title="Info" class="${t==="info"?"active":""}">
|
|
91
91
|
${ve.info}
|
|
92
92
|
</button>
|
|
@@ -102,11 +102,11 @@
|
|
|
102
102
|
<button type="button" data-type="note" title="Note" class="${t==="note"?"active":""}">
|
|
103
103
|
${ve.note}
|
|
104
104
|
</button>
|
|
105
|
-
`,n.appendChild(i),n},getData(e){const t=e.querySelector(".cb-callout-title"),n=e.querySelector(".cb-callout-body");return{id:e.getAttribute("data-block-id")||F(),type:"callout",calloutType:e.getAttribute("data-callout-type")||"info",title:(t==null?void 0:t.textContent)||void 0,content:(n==null?void 0:n.innerHTML)||""}},update(e,t){if(t.calloutType&>(e,t.calloutType),t.title!==void 0){let n=e.querySelector(".cb-callout-title");if(t.title){if(!n){n=document.createElement("div"),n.className="cb-callout-title",n.setAttribute("contenteditable","true");const o=e.querySelector(".cb-callout-content"),c=e.querySelector(".cb-callout-body");o&&c&&o.insertBefore(n,c)}n.textContent=t.title}else n&&n.remove()}if(t.content!==void 0){const n=e.querySelector(".cb-callout-body");n&&(n.innerHTML=t.content)}}};function gt(e,t){e.className=`cb-callout cb-callout-${t}`,e.setAttribute("data-callout-type",t);const n=e.querySelector(".cb-callout-icon");n&&(n.innerHTML=ve[t]);const o=e.querySelector(".cb-callout-type-selector");o&&o.querySelectorAll("button").forEach(c=>{c.classList.toggle("active",c.getAttribute("data-type")===t)})}function
|
|
105
|
+
`,n.appendChild(i),n},getData(e){const t=e.querySelector(".cb-callout-title"),n=e.querySelector(".cb-callout-body");return{id:e.getAttribute("data-block-id")||F(),type:"callout",calloutType:e.getAttribute("data-callout-type")||"info",title:(t==null?void 0:t.textContent)||void 0,content:(n==null?void 0:n.innerHTML)||""}},update(e,t){if(t.calloutType&>(e,t.calloutType),t.title!==void 0){let n=e.querySelector(".cb-callout-title");if(t.title){if(!n){n=document.createElement("div"),n.className="cb-callout-title",n.setAttribute("contenteditable","true");const o=e.querySelector(".cb-callout-content"),c=e.querySelector(".cb-callout-body");o&&c&&o.insertBefore(n,c)}n.textContent=t.title}else n&&n.remove()}if(t.content!==void 0){const n=e.querySelector(".cb-callout-body");n&&(n.innerHTML=t.content)}}};function gt(e,t){e.className=`cb-callout cb-callout-${t}`,e.setAttribute("data-callout-type",t);const n=e.querySelector(".cb-callout-icon");n&&(n.innerHTML=ve[t]);const o=e.querySelector(".cb-callout-type-selector");o&&o.querySelectorAll("button").forEach(c=>{c.classList.toggle("active",c.getAttribute("data-type")===t)})}function mc(e,t){let n=e.querySelector(".cb-callout-title");if(!n){n=document.createElement("div"),n.className="cb-callout-title",n.setAttribute("contenteditable","true");const o=e.querySelector(".cb-callout-content"),c=e.querySelector(".cb-callout-body");o&&c&&o.insertBefore(n,c)}n.textContent=t}const fn={name:"accordion",tag:"details",editable:!0,allowedChildren:["text","inline","block"],className:"cb-accordion",icon:"chevronDown",label:"Accordion",create(e){const t=document.createElement("details");t.className="cb-accordion",t.setAttribute("data-block-id",(e==null?void 0:e.id)||F()),t.setAttribute("data-block-type","accordion"),e!=null&&e.open&&(t.open=!0);const n=document.createElement("summary");n.className="cb-accordion-title";const o=document.createElement("span");o.className="cb-accordion-title-text",o.setAttribute("contenteditable","true"),o.setAttribute("data-placeholder","Accordion title..."),e!=null&&e.title&&(o.textContent=e.title);const c=document.createElement("span");c.className="cb-accordion-chevron",c.innerHTML=`
|
|
106
106
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
107
107
|
<path d="m6 9 6 6 6-6"/>
|
|
108
108
|
</svg>
|
|
109
|
-
`,n.appendChild(o),n.appendChild(c),t.appendChild(n);const r=document.createElement("div");return r.className="cb-accordion-content",r.setAttribute("contenteditable","true"),r.setAttribute("data-placeholder","Accordion content..."),e!=null&&e.content&&(r.innerHTML=e.content),t.appendChild(r),t},getData(e){const t=e,n=e.querySelector(".cb-accordion-title-text"),o=e.querySelector(".cb-accordion-content");return{id:e.getAttribute("data-block-id")||F(),type:"accordion",title:(n==null?void 0:n.textContent)||"",content:(o==null?void 0:o.innerHTML)||"",open:t.open}},update(e,t){const n=e;if(t.title!==void 0){const o=e.querySelector(".cb-accordion-title-text");o&&(o.textContent=t.title)}if(t.content!==void 0){const o=e.querySelector(".cb-accordion-content");o&&(o.innerHTML=t.content)}t.open!==void 0&&(n.open=t.open)}};function
|
|
109
|
+
`,n.appendChild(o),n.appendChild(c),t.appendChild(n);const r=document.createElement("div");return r.className="cb-accordion-content",r.setAttribute("contenteditable","true"),r.setAttribute("data-placeholder","Accordion content..."),e!=null&&e.content&&(r.innerHTML=e.content),t.appendChild(r),t},getData(e){const t=e,n=e.querySelector(".cb-accordion-title-text"),o=e.querySelector(".cb-accordion-content");return{id:e.getAttribute("data-block-id")||F(),type:"accordion",title:(n==null?void 0:n.textContent)||"",content:(o==null?void 0:o.innerHTML)||"",open:t.open}},update(e,t){const n=e;if(t.title!==void 0){const o=e.querySelector(".cb-accordion-title-text");o&&(o.textContent=t.title)}if(t.content!==void 0){const o=e.querySelector(".cb-accordion-content");o&&(o.innerHTML=t.content)}t.open!==void 0&&(n.open=t.open)}};function fc(e){const t=e;return t.open=!t.open,t.open}function yc(e,t){const n=e;n.open=t}const yn={name:"table",tag:"table",editable:!0,allowedChildren:["text","inline"],className:"cb-table",icon:"table",label:"Table",create(e){const t=document.createElement("div");t.className="cb-table-wrapper",t.setAttribute("data-block-id",(e==null?void 0:e.id)||F()),t.setAttribute("data-block-type","table");const n=document.createElement("table");n.className="cb-table";const o=(e==null?void 0:e.rows)||[{cells:[{content:""},{content:""},{content:""}]},{cells:[{content:""},{content:""},{content:""}]},{cells:[{content:""},{content:""},{content:""}]}],c=(e==null?void 0:e.hasHeader)??!0;o.forEach((i,a)=>{const u=document.createElement("tr");u.className="cb-table-row",i.cells.forEach(w=>{const x=c&&a===0?"th":"td",m=document.createElement(x);m.className="cb-table-cell",m.setAttribute("contenteditable","true"),m.innerHTML=w.content||"",w.align&&(m.style.textAlign=w.align),w.colSpan&&w.colSpan>1&&(m.colSpan=w.colSpan),w.rowSpan&&w.rowSpan>1&&(m.rowSpan=w.rowSpan),u.appendChild(m)}),n.appendChild(u)}),t.appendChild(n);const r=document.createElement("div");return r.className="cb-table-controls",r.innerHTML=`
|
|
110
110
|
<button type="button" class="cb-table-btn" data-action="addRow" title="Add row">
|
|
111
111
|
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
112
112
|
<path d="M12 5v14"/><path d="M5 12h14"/>
|
|
@@ -131,7 +131,7 @@
|
|
|
131
131
|
</svg>
|
|
132
132
|
Column
|
|
133
133
|
</button>
|
|
134
|
-
`,t.appendChild(r),t},getData(e){const t=e.querySelector("table"),n=[];let o=!1;return t==null||t.querySelectorAll("tr").forEach((c,r)=>{const i=[];c.querySelectorAll("th, td").forEach(a=>{a.tagName==="TH"&&(o=!0),i.push({content:a.innerHTML,align:a.style.textAlign||void 0,colSpan:a.colSpan>1?a.colSpan:void 0,rowSpan:a.rowSpan>1?a.rowSpan:void 0})}),n.push({cells:i})}),{id:e.getAttribute("data-block-id")||F(),type:"table",rows:n,hasHeader:o}},update(e,t){if(t.rows){const n=e.querySelector("table");n&&(n.innerHTML="",t.rows.forEach((o,c)=>{const r=document.createElement("tr");r.className="cb-table-row",o.cells.forEach(i=>{const a=t.hasHeader&&c===0?"th":"td",
|
|
134
|
+
`,t.appendChild(r),t},getData(e){const t=e.querySelector("table"),n=[];let o=!1;return t==null||t.querySelectorAll("tr").forEach((c,r)=>{const i=[];c.querySelectorAll("th, td").forEach(a=>{a.tagName==="TH"&&(o=!0),i.push({content:a.innerHTML,align:a.style.textAlign||void 0,colSpan:a.colSpan>1?a.colSpan:void 0,rowSpan:a.rowSpan>1?a.rowSpan:void 0})}),n.push({cells:i})}),{id:e.getAttribute("data-block-id")||F(),type:"table",rows:n,hasHeader:o}},update(e,t){if(t.rows){const n=e.querySelector("table");n&&(n.innerHTML="",t.rows.forEach((o,c)=>{const r=document.createElement("tr");r.className="cb-table-row",o.cells.forEach(i=>{const a=t.hasHeader&&c===0?"th":"td",u=document.createElement(a);u.className="cb-table-cell",u.setAttribute("contenteditable","true"),u.innerHTML=i.content||"",i.align&&(u.style.textAlign=i.align),i.colSpan&&(u.colSpan=i.colSpan),i.rowSpan&&(u.rowSpan=i.rowSpan),r.appendChild(u)}),n.appendChild(r)}))}}};function Ge(e,t){var i;const n=e.querySelector("table");if(!n)return;const o=n.querySelectorAll("tr"),c=((i=o[0])==null?void 0:i.querySelectorAll("th, td").length)||3,r=document.createElement("tr");r.className="cb-table-row";for(let a=0;a<c;a++){const u=document.createElement("td");u.className="cb-table-cell",u.setAttribute("contenteditable","true"),r.appendChild(u)}t!==void 0&&o[t]?o[t].after(r):n.appendChild(r)}function kn(e,t){const n=e.querySelector("table");n&&n.querySelectorAll("tr").forEach((o,c)=>{var u;const r=o.querySelectorAll("th, td"),i=c===0&&((u=r[0])==null?void 0:u.tagName)==="TH",a=document.createElement(i?"th":"td");a.className="cb-table-cell",a.setAttribute("contenteditable","true"),t!==void 0&&r[t]?r[t].after(a):o.appendChild(a)})}function Xe(e,t){var c;const n=e.querySelector("table");if(!n)return!1;const o=n.querySelectorAll("tr");return o.length<=1?!1:((c=o[t])==null||c.remove(),!0)}function Je(e,t){var r;const n=e.querySelector("table");if(!n)return!1;const o=n.querySelectorAll("tr");return(((r=o[0])==null?void 0:r.querySelectorAll("th, td").length)||0)<=1?!1:(o.forEach(i=>{var u;(u=i.querySelectorAll("th, td")[t])==null||u.remove()}),!0)}function kc(e,t){e.style.textAlign=t}function Ze(e){const t=document.activeElement;return t&&e.contains(t)?t.closest("td, th"):null}function Qe(e){const t=e.parentElement;if(!t)return null;const n=t.closest("table");if(!n)return null;const c=Array.from(n.querySelectorAll("tr")).indexOf(t),i=Array.from(t.querySelectorAll("th, td")).indexOf(e);return{row:c,col:i}}const We=new Map;function vc(e){try{const t=new URL(e);return t.protocol==="http:"||t.protocol==="https:"}catch{return!1}}function mt(e){return!e.startsWith("http://")&&!e.startsWith("https://")?`https://${e}`:e}async function Wt(e){var t;if(We.has(e))return We.get(e)||null;try{const n=mt(e);if(!vc(n))return null;const o=new URL(n),c={url:n,siteName:o.hostname.replace("www.",""),title:((t=o.pathname.split("/").filter(Boolean).pop())==null?void 0:t.replace(/-/g," "))||o.hostname};return We.set(e,c),c}catch(n){return console.error("Failed to fetch link preview:",n),null}}function _t(e){try{return new URL(mt(e)).hostname.replace("www.","")}catch{return e}}function xc(e){try{return`https://www.google.com/s2/favicons?domain=${new URL(mt(e)).hostname}&sz=32`}catch{return""}}function Ne(e){const t=document.createElement("div");if(t.className="cb-link-preview",t.setAttribute("data-url",e.url||""),t.contentEditable="false",e.loading)t.innerHTML=`
|
|
135
135
|
<div class="cb-link-preview-loading">
|
|
136
136
|
<div class="cb-link-preview-spinner">
|
|
137
137
|
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
@@ -140,7 +140,7 @@
|
|
|
140
140
|
</div>
|
|
141
141
|
<span>Loading preview...</span>
|
|
142
142
|
</div>
|
|
143
|
-
`;else if(e.preview){const n=e.preview,o=_t(e.url||""),c=
|
|
143
|
+
`;else if(e.preview){const n=e.preview,o=_t(e.url||""),c=xc(e.url||"");t.innerHTML=`
|
|
144
144
|
<a href="${n.url}" target="_blank" rel="noopener noreferrer" class="cb-link-preview-card">
|
|
145
145
|
${n.image?`
|
|
146
146
|
<div class="cb-link-preview-image">
|
|
@@ -194,13 +194,13 @@
|
|
|
194
194
|
<span class="cb-link-preview-simple-domain">${_t(e.url||"")}</span>
|
|
195
195
|
</div>
|
|
196
196
|
</div>
|
|
197
|
-
`;return t}const vn={name:"linkPreview",tag:"div",editable:!1,allowedChildren:[],className:"cb-link-preview",label:"Link Preview",icon:"link",create:e=>{const t={id:(e==null?void 0:e.id)||F(),url:(e==null?void 0:e.url)||"",loading:!0},n=Ne(t);return t.url&&Wt(t.url).then(o=>{if(o){t.preview=o,t.loading=!1;const c=Ne(t);n.innerHTML=c.innerHTML}else{t.loading=!1;const c=Ne(t);n.innerHTML=c.innerHTML}}),n},getData:e=>({url:e.getAttribute("data-url")||""}),update:(e,t)=>{if(t.url){e.setAttribute("data-url",t.url);const n=Ne({...t,loading:!0});e.innerHTML=n.innerHTML,Wt(t.url).then(o=>{if(o){const c=Ne({...t,preview:o,loading:!1});e.innerHTML=c.innerHTML}})}}},ft=[ct,rt,lt,it,cn,rn,ln,st,dt,sn,ut,pt,ht,bn,bt,mn,fn,yn,vn],
|
|
197
|
+
`;return t}const vn={name:"linkPreview",tag:"div",editable:!1,allowedChildren:[],className:"cb-link-preview",label:"Link Preview",icon:"link",create:e=>{const t={id:(e==null?void 0:e.id)||F(),url:(e==null?void 0:e.url)||"",loading:!0},n=Ne(t);return t.url&&Wt(t.url).then(o=>{if(o){t.preview=o,t.loading=!1;const c=Ne(t);n.innerHTML=c.innerHTML}else{t.loading=!1;const c=Ne(t);n.innerHTML=c.innerHTML}}),n},getData:e=>({url:e.getAttribute("data-url")||""}),update:(e,t)=>{if(t.url){e.setAttribute("data-url",t.url);const n=Ne({...t,loading:!0});e.innerHTML=n.innerHTML,Wt(t.url).then(o=>{if(o){const c=Ne({...t,preview:o,loading:!1});e.innerHTML=c.innerHTML}})}}},ft=[ct,rt,lt,it,cn,rn,ln,st,dt,sn,ut,pt,ht,bn,bt,mn,fn,yn,vn],wc=[ct,rt,lt,it,st,dt,ut,pt,ht,bt],xn=new Map(ft.map(e=>[e.name,e]));function Cc(e){return xn.get(e)}const Sc=new Set(["p","h1","h2","h3","h4","h5","h6","ul","ol","li","blockquote","pre","code","hr","br","table","thead","tbody","tr","th","td","figure","figcaption","details","summary","strong","b","em","i","u","s","del","a","span","mark","sub","sup","img","video","audio","iframe"]),Ec={b:"strong",i:"em",strike:"s",del:"s",div:"p"},ze={"*":new Set(["class","id"]),a:new Set(["href","target","rel","title"]),img:new Set(["src","alt","title","width","height"]),video:new Set(["src","poster","controls","width","height"]),audio:new Set(["src","controls"]),iframe:new Set(["src","width","height","frameborder","allowfullscreen"]),td:new Set(["colspan","rowspan"]),th:new Set(["colspan","rowspan","scope"]),ol:new Set(["start","type"]),pre:new Set(["data-language"]),code:new Set(["data-language"]),span:new Set(["style"])},wn=new Set(["onclick","onmouseover","onmouseout","onmousedown","onmouseup","onkeydown","onkeyup","onkeypress","onload","onerror","onsubmit","onfocus","onblur","onchange","oninput","onscroll","onresize"]),Mc=new Set(["color","background-color","font-weight","font-style","text-decoration","text-align","vertical-align"]),Lc={allowIframes:!0,allowTables:!0,allowImages:!0,allowVideos:!0,additionalTags:[],stripStyles:!1,stripClasses:!1,keepClassPrefix:"cb-",maxDepth:10};function Cn(e,t={}){const n={...Lc,...t},o=document.createElement("div");return o.innerHTML=e,et(o,n,0),o.innerHTML}function et(e,t,n){if(n>(t.maxDepth||10)){e.textContent=e.textContent;return}const o=[],c=[];e.childNodes.forEach(r=>{if(r.nodeType===Node.TEXT_NODE)return;if(r.nodeType===Node.COMMENT_NODE){o.push(r);return}if(r.nodeType!==Node.ELEMENT_NODE){o.push(r);return}const i=r,a=i.tagName.toLowerCase(),u=Ec[a];if(u){const x=document.createElement(u);x.innerHTML=i.innerHTML,Nc(i,x),c.push({old:i,new:x}),et(x,t,n+1);return}const w=new Set([...Sc,...t.additionalTags||[]]);if(a==="iframe"&&!t.allowIframes){o.push(i);return}if(a==="table"&&!t.allowTables){const x=document.createTextNode(i.textContent||"");c.push({old:i,new:x});return}if(a==="img"&&!t.allowImages){o.push(i);return}if((a==="video"||a==="audio")&&!t.allowVideos){o.push(i);return}if(!w.has(a)){if(i.childNodes.length>0){const x=document.createDocumentFragment();for(;i.firstChild;)x.appendChild(i.firstChild);c.push({old:i,new:x})}else o.push(i);return}Ac(i,a,t),et(i,t,n+1)}),o.forEach(r=>{var i;return(i=r.parentNode)==null?void 0:i.removeChild(r)}),c.forEach(({old:r,new:i})=>{var a;(a=r.parentNode)==null||a.replaceChild(i,r)})}function Ac(e,t,n){const o=ze["*"]||new Set,c=ze[t]||new Set,r=new Set([...o,...c]);Array.from(e.attributes).forEach(a=>{const u=a.name.toLowerCase();if(wn.has(u)||u.startsWith("on")){e.removeAttribute(a.name);return}if(u.startsWith("data-")&&u!=="data-language"){e.removeAttribute(a.name);return}if(u==="class"){if(n.stripClasses)e.removeAttribute("class");else if(n.keepClassPrefix){const x=a.value.split(/\s+/).filter(m=>m.startsWith(n.keepClassPrefix)||m.startsWith("cb-"));x.length>0?e.className=x.join(" "):e.removeAttribute("class")}return}if(u==="style"){n.stripStyles?e.removeAttribute("style"):Tc(e);return}if(!r.has(u)){e.removeAttribute(a.name);return}if(u==="href"||u==="src"){const w=a.value.trim().toLowerCase();(w.startsWith("javascript:")||w.startsWith("vbscript:")||w.startsWith("data:text/html"))&&e.removeAttribute(a.name)}})}function Tc(e){e.style;const t=e.getAttribute("style")||"",n=[];t.split(";").forEach(o=>{const[c,r]=o.split(":").map(i=>i.trim());if(c&&r&&Mc.has(c.toLowerCase())){const i=r.toLowerCase();!i.includes("url(")&&!i.includes("expression(")&&!i.includes("javascript:")&&n.push(`${c}: ${r}`)}}),n.length>0?e.setAttribute("style",n.join("; ")):e.removeAttribute("style")}function Nc(e,t,n){const o=t.tagName.toLowerCase(),c=ze["*"]||new Set,r=ze[o]||new Set,i=new Set([...c,...r]);Array.from(e.attributes).forEach(a=>{const u=a.name.toLowerCase();i.has(u)&&!wn.has(u)&&t.setAttribute(a.name,a.value)})}function Sn(e,t={}){let n=e.getData("text/html");if(n)return n=Bc(n),Cn(n,t);const o=e.getData("text/plain");return o?En(o):""}function Bc(e){return e=e.replace(/<\/?o:[^>]*>/gi,""),e=e.replace(/<\/?w:[^>]*>/gi,""),e=e.replace(/<\/?m:[^>]*>/gi,""),e=e.replace(/<\/?st1:[^>]*>/gi,""),e=e.replace(/\s*xmlns:[a-z]+="[^"]*"/gi,""),e=e.replace(/mso-[^;:"']+:[^;:"']+;?/gi,""),e=e.replace(/class="?Mso[^">\s]*/gi,""),e=e.replace(/<span[^>]*>\s*<\/span>/gi,""),e=e.replace(/id="docs-internal-guid-[^"]*"/gi,""),e=e.replace(/\s{2,}/g," "),e}function En(e){return e?e.split(/\n\n+/).map(n=>{const o=n.trim().replace(/\n/g,"<br>").replace(/\t/g," ");return o?`<p>${o}</p>`:""}).filter(Boolean).join(""):""}function Hc(e){const t=document.createElement("div");t.innerHTML=e;const n=document.createDocumentFragment();let o=null;t.childNodes.forEach(r=>{var i;if(r.nodeType===Node.TEXT_NODE){const a=(i=r.textContent)==null?void 0:i.trim();a&&(o||(o=document.createElement("p")),o.appendChild(document.createTextNode(a)))}else r.nodeType===Node.ELEMENT_NODE&&(qc(r.tagName)?(o&&(n.appendChild(o),o=null),n.appendChild(r.cloneNode(!0))):(o||(o=document.createElement("p")),o.appendChild(r.cloneNode(!0))))}),o&&n.appendChild(o);const c=document.createElement("div");return c.appendChild(n),c.innerHTML}function qc(e){return new Set(["P","H1","H2","H3","H4","H5","H6","UL","OL","LI","BLOCKQUOTE","PRE","TABLE","HR","DIV","FIGURE","DETAILS"]).has(e.toUpperCase())}const Yt=50,Kt=10;function Mn(e){const{container:t,handleSelector:n="[data-drag-handle]"}=e;let o={isDragging:!1,draggedElement:null,placeholder:null,startY:0,currentY:0,scrollInterval:null};function c(){const L=document.createElement("div");return L.className="cb-drag-placeholder",L.style.cssText=`
|
|
198
198
|
height: 4px;
|
|
199
199
|
background: var(--cb-primary, #3b82f6);
|
|
200
200
|
border-radius: 2px;
|
|
201
201
|
margin: 4px 0;
|
|
202
202
|
transition: opacity 0.2s;
|
|
203
|
-
`,
|
|
203
|
+
`,L}function r(){return Array.from(t.querySelectorAll("[data-block-id]"))}function i(L){const C=r().filter(H=>H!==o.draggedElement);for(const H of C){const U=H.getBoundingClientRect(),D=U.top+U.height/2;if(L<D)return{element:H,position:"before"}}return{element:C[C.length-1]||null,position:"after"}}function a(L,C){var A,H;!o.placeholder||!L||(C==="before"?(A=L.parentNode)==null||A.insertBefore(o.placeholder,L):(H=L.parentNode)==null||H.insertBefore(o.placeholder,L.nextSibling))}function u(L){const C=t.getBoundingClientRect();o.scrollInterval&&(clearInterval(o.scrollInterval),o.scrollInterval=null),L<C.top+Yt?o.scrollInterval=window.setInterval(()=>{t.scrollTop-=Kt},16):L>C.bottom-Yt&&(o.scrollInterval=window.setInterval(()=>{t.scrollTop+=Kt},16))}function w(L){var D,ee;const A=L.target.closest(n);if(!A)return;const H=ye(A);if(!H)return;L.preventDefault();const U="touches"in L?L.touches[0].clientY:L.clientY;o={...o,isDragging:!0,draggedElement:H,placeholder:c(),startY:U,currentY:U},H.style.opacity="0.5",H.style.pointerEvents="none",(D=H.parentNode)==null||D.insertBefore(o.placeholder,H.nextSibling),document.addEventListener("mousemove",x),document.addEventListener("mouseup",m),document.addEventListener("touchmove",x,{passive:!1}),document.addEventListener("touchend",m),(ee=e.onDragStart)==null||ee.call(e,H)}function x(L){var U;if(!o.isDragging||!o.draggedElement)return;L.preventDefault();const C="touches"in L?L.touches[0].clientY:L.clientY;o.currentY=C,u(C);const{element:A,position:H}=i(C);a(A,H),(U=e.onDragMove)==null||U.call(e,o.draggedElement,A,H)}function m(L){var D,ee;if(!o.isDragging||!o.draggedElement){N();return}const{element:C,position:A}=i(o.currentY);C&&((D=o.placeholder)!=null&&D.parentNode)&&o.placeholder.parentNode.insertBefore(o.draggedElement,o.placeholder);const U=r().indexOf(o.draggedElement);o.draggedElement.style.opacity="",o.draggedElement.style.pointerEvents="",(ee=e.onDragEnd)==null||ee.call(e,o.draggedElement,U),N()}function N(){var L;(L=o.placeholder)==null||L.remove(),o.scrollInterval&&clearInterval(o.scrollInterval),document.removeEventListener("mousemove",x),document.removeEventListener("mouseup",m),document.removeEventListener("touchmove",x),document.removeEventListener("touchend",m),o={isDragging:!1,draggedElement:null,placeholder:null,startY:0,currentY:0,scrollInterval:null}}return t.addEventListener("mousedown",w),t.addEventListener("touchstart",w,{passive:!1}),()=>{t.removeEventListener("mousedown",w),t.removeEventListener("touchstart",w),N()}}function $c(){const e=document.createElement("button");return e.type="button",e.className="cb-drag-handle",e.setAttribute("data-drag-handle","true"),e.setAttribute("tabindex","-1"),e.setAttribute("aria-label","Drag to reorder"),e.innerHTML=`
|
|
204
204
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
205
205
|
<circle cx="5" cy="3" r="1.5"/>
|
|
206
206
|
<circle cx="11" cy="3" r="1.5"/>
|
|
@@ -209,362 +209,372 @@
|
|
|
209
209
|
<circle cx="5" cy="13" r="1.5"/>
|
|
210
210
|
<circle cx="11" cy="13" r="1.5"/>
|
|
211
211
|
</svg>
|
|
212
|
-
`,e}function
|
|
213
|
-
* @license lucide-react v0.
|
|
212
|
+
`,e}function jc(){return"draggable"in document.createElement("div")}function Ln(){const e=window.getSelection();if(!e||e.rangeCount===0)return{range:null,anchorNode:null,focusNode:null,anchorOffset:0,focusOffset:0,isCollapsed:!0,block:null};const t=e.getRangeAt(0),n=ye(t.commonAncestorContainer);return{range:t.cloneRange(),anchorNode:e.anchorNode,focusNode:e.focusNode,anchorOffset:e.anchorOffset,focusOffset:e.focusOffset,isCollapsed:e.isCollapsed,block:n}}function Rc(){return Ln()}function Dc(e){if(!e.range)return!1;try{const t=window.getSelection();if(t)return t.removeAllRanges(),t.addRange(e.range),!0}catch{}return!1}function Ic(){const e=window.getSelection();return(e==null?void 0:e.toString())||""}function zc(){const e=window.getSelection();if(!e||e.rangeCount===0)return"";const t=e.getRangeAt(0),n=document.createElement("div");return n.appendChild(t.cloneContents()),n.innerHTML}function Pc(e){const t=window.getSelection();if(!t||t.rangeCount===0)return!1;const n=t.getRangeAt(0);return e.contains(n.commonAncestorContainer)}function Oc(e){const t=window.getSelection();if(!t||t.rangeCount===0||t.isCollapsed)return!1;const n=t.getRangeAt(0),o=ye(n.startContainer),c=ye(n.endContainer);return o!==c}function Fc(e){const t=document.createRange();t.selectNodeContents(e);const n=window.getSelection();n&&(n.removeAllRanges(),n.addRange(t))}function Uc(){const e=window.getSelection();e&&!e.isCollapsed&&e.collapseToStart()}function Vc(){const e=window.getSelection();e&&!e.isCollapsed&&e.collapseToEnd()}function Wc(e,t){var r;const n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null);let o=0,c;for(;c=n.nextNode();){const i=((r=c.textContent)==null?void 0:r.length)||0;if(o+i>=t){const a=document.createRange();a.setStart(c,t-o),a.collapse(!0);const u=window.getSelection();if(u)return u.removeAllRanges(),u.addRange(a),!0}o+=i}return!1}function _c(e){const t=window.getSelection();if(!t||t.rangeCount===0)return 0;const n=t.getRangeAt(0),o=n.cloneRange();return o.selectNodeContents(e),o.setEnd(n.startContainer,n.startOffset),o.toString().length}function De(e){const t=window.getSelection();if(!t||t.rangeCount===0)return!1;const n=t.getRangeAt(0);if(!n.collapsed)return!1;const o=n.cloneRange();return o.selectNodeContents(e),o.setEnd(n.startContainer,n.startOffset),o.toString().length===0}function An(e){const t=window.getSelection();if(!t||t.rangeCount===0)return!1;const n=t.getRangeAt(0);if(!n.collapsed)return!1;const o=n.cloneRange();return o.selectNodeContents(e),o.setStart(n.endContainer,n.endOffset),o.toString().length===0}function be(e){const t=document.createRange(),n=window.getSelection(),c=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null).nextNode();c?t.setStart(c,0):t.setStart(e,0),t.collapse(!0),n&&(n.removeAllRanges(),n.addRange(t))}function xe(e){const t=document.createRange(),n=window.getSelection();t.selectNodeContents(e),t.collapse(!1),n&&(n.removeAllRanges(),n.addRange(t))}function Tn(e,t){const n=window.getSelection();if(!n||n.rangeCount===0||n.isCollapsed)return null;const o=n.getRangeAt(0),c=document.createElement(e);if(t)for(const[r,i]of Object.entries(t))c.setAttribute(r,i);try{return o.surroundContents(c),c}catch{const r=o.extractContents();return c.appendChild(r),o.insertNode(c),c}}function Nn(e){const t=e.parentNode;if(t){for(;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}}function Bn(e,t){const n=window.getSelection();if(!n||n.rangeCount===0)return[];const o=n.getRangeAt(0),c=[],r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:a=>a instanceof HTMLElement&&a.tagName.toLowerCase()===e.toLowerCase()?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});let i;for(;i=r.nextNode();)i instanceof HTMLElement&&o.intersectsNode(i)&&c.push(i);return c}/**
|
|
213
|
+
* @license lucide-react v0.460.0 - ISC
|
|
214
214
|
*
|
|
215
215
|
* This source code is licensed under the ISC license.
|
|
216
216
|
* See the LICENSE file in the root directory of this source tree.
|
|
217
|
-
*/
|
|
218
|
-
* @license lucide-react v0.
|
|
217
|
+
*/const Yc=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Hn=(...e)=>e.filter((t,n,o)=>!!t&&t.trim()!==""&&o.indexOf(t)===n).join(" ").trim();/**
|
|
218
|
+
* @license lucide-react v0.460.0 - ISC
|
|
219
219
|
*
|
|
220
220
|
* This source code is licensed under the ISC license.
|
|
221
221
|
* See the LICENSE file in the root directory of this source tree.
|
|
222
|
-
*/
|
|
223
|
-
* @license lucide-react v0.
|
|
222
|
+
*/var Kc={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
|
223
|
+
* @license lucide-react v0.460.0 - ISC
|
|
224
224
|
*
|
|
225
225
|
* This source code is licensed under the ISC license.
|
|
226
226
|
* See the LICENSE file in the root directory of this source tree.
|
|
227
|
-
*/const
|
|
228
|
-
* @license lucide-react v0.
|
|
227
|
+
*/const Gc=p.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:o,className:c="",children:r,iconNode:i,...a},u)=>p.createElement("svg",{ref:u,...Kc,width:t,height:t,stroke:e,strokeWidth:o?Number(n)*24/Number(t):n,className:Hn("lucide",c),...a},[...i.map(([w,x])=>p.createElement(w,x)),...Array.isArray(r)?r:[r]]));/**
|
|
228
|
+
* @license lucide-react v0.460.0 - ISC
|
|
229
229
|
*
|
|
230
230
|
* This source code is licensed under the ISC license.
|
|
231
231
|
* See the LICENSE file in the root directory of this source tree.
|
|
232
|
-
*/const
|
|
233
|
-
* @license lucide-react v0.
|
|
232
|
+
*/const M=(e,t)=>{const n=p.forwardRef(({className:o,...c},r)=>p.createElement(Gc,{ref:r,iconNode:t,className:Hn(`lucide-${Yc(e)}`,o),...c}));return n.displayName=`${e}`,n};/**
|
|
233
|
+
* @license lucide-react v0.460.0 - ISC
|
|
234
234
|
*
|
|
235
235
|
* This source code is licensed under the ISC license.
|
|
236
236
|
* See the LICENSE file in the root directory of this source tree.
|
|
237
|
-
*/const
|
|
238
|
-
* @license lucide-react v0.
|
|
237
|
+
*/const qn=M("AlignCenter",[["path",{d:"M17 12H7",key:"16if0g"}],["path",{d:"M19 18H5",key:"18s9l3"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]);/**
|
|
238
|
+
* @license lucide-react v0.460.0 - ISC
|
|
239
239
|
*
|
|
240
240
|
* This source code is licensed under the ISC license.
|
|
241
241
|
* See the LICENSE file in the root directory of this source tree.
|
|
242
|
-
*/const
|
|
243
|
-
* @license lucide-react v0.
|
|
242
|
+
*/const Xc=M("AlignJustify",[["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M3 18h18",key:"1h113x"}],["path",{d:"M3 6h18",key:"d0wm0j"}]]);/**
|
|
243
|
+
* @license lucide-react v0.460.0 - ISC
|
|
244
244
|
*
|
|
245
245
|
* This source code is licensed under the ISC license.
|
|
246
246
|
* See the LICENSE file in the root directory of this source tree.
|
|
247
|
-
*/const
|
|
248
|
-
* @license lucide-react v0.
|
|
247
|
+
*/const $n=M("AlignLeft",[["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 18H3",key:"1amg6g"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]);/**
|
|
248
|
+
* @license lucide-react v0.460.0 - ISC
|
|
249
249
|
*
|
|
250
250
|
* This source code is licensed under the ISC license.
|
|
251
251
|
* See the LICENSE file in the root directory of this source tree.
|
|
252
|
-
*/const
|
|
253
|
-
* @license lucide-react v0.
|
|
252
|
+
*/const jn=M("AlignRight",[["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M21 18H7",key:"1ygte8"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]);/**
|
|
253
|
+
* @license lucide-react v0.460.0 - ISC
|
|
254
254
|
*
|
|
255
255
|
* This source code is licensed under the ISC license.
|
|
256
256
|
* See the LICENSE file in the root directory of this source tree.
|
|
257
|
-
*/const
|
|
258
|
-
* @license lucide-react v0.
|
|
257
|
+
*/const Rn=M("Bold",[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]]);/**
|
|
258
|
+
* @license lucide-react v0.460.0 - ISC
|
|
259
259
|
*
|
|
260
260
|
* This source code is licensed under the ISC license.
|
|
261
261
|
* See the LICENSE file in the root directory of this source tree.
|
|
262
|
-
*/const
|
|
263
|
-
* @license lucide-react v0.
|
|
262
|
+
*/const Dn=M("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);/**
|
|
263
|
+
* @license lucide-react v0.460.0 - ISC
|
|
264
264
|
*
|
|
265
265
|
* This source code is licensed under the ISC license.
|
|
266
266
|
* See the LICENSE file in the root directory of this source tree.
|
|
267
|
-
*/const
|
|
268
|
-
* @license lucide-react v0.
|
|
267
|
+
*/const Jc=M("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
|
|
268
|
+
* @license lucide-react v0.460.0 - ISC
|
|
269
269
|
*
|
|
270
270
|
* This source code is licensed under the ISC license.
|
|
271
271
|
* See the LICENSE file in the root directory of this source tree.
|
|
272
|
-
*/const
|
|
273
|
-
* @license lucide-react v0.
|
|
272
|
+
*/const tt=M("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
|
|
273
|
+
* @license lucide-react v0.460.0 - ISC
|
|
274
274
|
*
|
|
275
275
|
* This source code is licensed under the ISC license.
|
|
276
276
|
* See the LICENSE file in the root directory of this source tree.
|
|
277
|
-
*/const Zc=
|
|
278
|
-
* @license lucide-react v0.
|
|
277
|
+
*/const Zc=M("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
|
|
278
|
+
* @license lucide-react v0.460.0 - ISC
|
|
279
279
|
*
|
|
280
280
|
* This source code is licensed under the ISC license.
|
|
281
281
|
* See the LICENSE file in the root directory of this source tree.
|
|
282
|
-
*/const
|
|
283
|
-
* @license lucide-react v0.
|
|
282
|
+
*/const yt=M("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
|
|
283
|
+
* @license lucide-react v0.460.0 - ISC
|
|
284
284
|
*
|
|
285
285
|
* This source code is licensed under the ISC license.
|
|
286
286
|
* See the LICENSE file in the root directory of this source tree.
|
|
287
|
-
*/const
|
|
288
|
-
* @license lucide-react v0.
|
|
287
|
+
*/const Qc=M("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
|
|
288
|
+
* @license lucide-react v0.460.0 - ISC
|
|
289
289
|
*
|
|
290
290
|
* This source code is licensed under the ISC license.
|
|
291
291
|
* See the LICENSE file in the root directory of this source tree.
|
|
292
|
-
*/const
|
|
293
|
-
* @license lucide-react v0.
|
|
292
|
+
*/const er=M("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/**
|
|
293
|
+
* @license lucide-react v0.460.0 - ISC
|
|
294
294
|
*
|
|
295
295
|
* This source code is licensed under the ISC license.
|
|
296
296
|
* See the LICENSE file in the root directory of this source tree.
|
|
297
|
-
*/const
|
|
298
|
-
* @license lucide-react v0.
|
|
297
|
+
*/const tr=M("ClipboardPaste",[["path",{d:"M15 2H9a1 1 0 0 0-1 1v2c0 .6.4 1 1 1h6c.6 0 1-.4 1-1V3c0-.6-.4-1-1-1Z",key:"1pp7kr"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2M16 4h2a2 2 0 0 1 2 2v2M11 14h10",key:"2ik1ml"}],["path",{d:"m17 10 4 4-4 4",key:"vp2hj1"}]]);/**
|
|
298
|
+
* @license lucide-react v0.460.0 - ISC
|
|
299
299
|
*
|
|
300
300
|
* This source code is licensed under the ISC license.
|
|
301
301
|
* See the LICENSE file in the root directory of this source tree.
|
|
302
|
-
*/const
|
|
303
|
-
* @license lucide-react v0.
|
|
302
|
+
*/const nr=M("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
|
|
303
|
+
* @license lucide-react v0.460.0 - ISC
|
|
304
304
|
*
|
|
305
305
|
* This source code is licensed under the ISC license.
|
|
306
306
|
* See the LICENSE file in the root directory of this source tree.
|
|
307
|
-
*/const
|
|
308
|
-
* @license lucide-react v0.
|
|
307
|
+
*/const kt=M("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/**
|
|
308
|
+
* @license lucide-react v0.460.0 - ISC
|
|
309
309
|
*
|
|
310
310
|
* This source code is licensed under the ISC license.
|
|
311
311
|
* See the LICENSE file in the root directory of this source tree.
|
|
312
|
-
*/const
|
|
313
|
-
* @license lucide-react v0.
|
|
312
|
+
*/const or=M("Columns2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]]);/**
|
|
313
|
+
* @license lucide-react v0.460.0 - ISC
|
|
314
314
|
*
|
|
315
315
|
* This source code is licensed under the ISC license.
|
|
316
316
|
* See the LICENSE file in the root directory of this source tree.
|
|
317
|
-
*/const In=
|
|
318
|
-
* @license lucide-react v0.
|
|
317
|
+
*/const In=M("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
|
|
318
|
+
* @license lucide-react v0.460.0 - ISC
|
|
319
319
|
*
|
|
320
320
|
* This source code is licensed under the ISC license.
|
|
321
321
|
* See the LICENSE file in the root directory of this source tree.
|
|
322
|
-
*/const zn=
|
|
323
|
-
* @license lucide-react v0.
|
|
322
|
+
*/const zn=M("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
|
|
323
|
+
* @license lucide-react v0.460.0 - ISC
|
|
324
324
|
*
|
|
325
325
|
* This source code is licensed under the ISC license.
|
|
326
326
|
* See the LICENSE file in the root directory of this source tree.
|
|
327
|
-
*/const
|
|
328
|
-
* @license lucide-react v0.
|
|
327
|
+
*/const Pn=M("Ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);/**
|
|
328
|
+
* @license lucide-react v0.460.0 - ISC
|
|
329
329
|
*
|
|
330
330
|
* This source code is licensed under the ISC license.
|
|
331
331
|
* See the LICENSE file in the root directory of this source tree.
|
|
332
|
-
*/const
|
|
333
|
-
* @license lucide-react v0.
|
|
332
|
+
*/const On=M("Eraser",[["path",{d:"m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21",key:"182aya"}],["path",{d:"M22 21H7",key:"t4ddhn"}],["path",{d:"m5 11 9 9",key:"1mo9qw"}]]);/**
|
|
333
|
+
* @license lucide-react v0.460.0 - ISC
|
|
334
334
|
*
|
|
335
335
|
* This source code is licensed under the ISC license.
|
|
336
336
|
* See the LICENSE file in the root directory of this source tree.
|
|
337
|
-
*/const
|
|
338
|
-
* @license lucide-react v0.
|
|
337
|
+
*/const cr=M("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/**
|
|
338
|
+
* @license lucide-react v0.460.0 - ISC
|
|
339
339
|
*
|
|
340
340
|
* This source code is licensed under the ISC license.
|
|
341
341
|
* See the LICENSE file in the root directory of this source tree.
|
|
342
|
-
*/const
|
|
343
|
-
* @license lucide-react v0.
|
|
342
|
+
*/const Fn=M("FileCode",[["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}]]);/**
|
|
343
|
+
* @license lucide-react v0.460.0 - ISC
|
|
344
344
|
*
|
|
345
345
|
* This source code is licensed under the ISC license.
|
|
346
346
|
* See the LICENSE file in the root directory of this source tree.
|
|
347
|
-
*/const
|
|
348
|
-
* @license lucide-react v0.
|
|
347
|
+
*/const Me=M("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
|
|
348
|
+
* @license lucide-react v0.460.0 - ISC
|
|
349
349
|
*
|
|
350
350
|
* This source code is licensed under the ISC license.
|
|
351
351
|
* See the LICENSE file in the root directory of this source tree.
|
|
352
|
-
*/const
|
|
353
|
-
* @license lucide-react v0.
|
|
352
|
+
*/const rr=M("File",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]);/**
|
|
353
|
+
* @license lucide-react v0.460.0 - ISC
|
|
354
354
|
*
|
|
355
355
|
* This source code is licensed under the ISC license.
|
|
356
356
|
* See the LICENSE file in the root directory of this source tree.
|
|
357
|
-
*/const
|
|
358
|
-
* @license lucide-react v0.
|
|
357
|
+
*/const Un=M("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);/**
|
|
358
|
+
* @license lucide-react v0.460.0 - ISC
|
|
359
359
|
*
|
|
360
360
|
* This source code is licensed under the ISC license.
|
|
361
361
|
* See the LICENSE file in the root directory of this source tree.
|
|
362
|
-
*/const
|
|
363
|
-
* @license lucide-react v0.
|
|
362
|
+
*/const vt=M("Heading1",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"m17 12 3-2v8",key:"1hhhft"}]]);/**
|
|
363
|
+
* @license lucide-react v0.460.0 - ISC
|
|
364
364
|
*
|
|
365
365
|
* This source code is licensed under the ISC license.
|
|
366
366
|
* See the LICENSE file in the root directory of this source tree.
|
|
367
|
-
*/const
|
|
368
|
-
* @license lucide-react v0.
|
|
367
|
+
*/const xt=M("Heading2",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]]);/**
|
|
368
|
+
* @license lucide-react v0.460.0 - ISC
|
|
369
369
|
*
|
|
370
370
|
* This source code is licensed under the ISC license.
|
|
371
371
|
* See the LICENSE file in the root directory of this source tree.
|
|
372
|
-
*/const
|
|
373
|
-
* @license lucide-react v0.
|
|
372
|
+
*/const wt=M("Heading3",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2",key:"68ncm8"}],["path",{d:"M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2",key:"1ejuhz"}]]);/**
|
|
373
|
+
* @license lucide-react v0.460.0 - ISC
|
|
374
374
|
*
|
|
375
375
|
* This source code is licensed under the ISC license.
|
|
376
376
|
* See the LICENSE file in the root directory of this source tree.
|
|
377
|
-
*/const lr=
|
|
378
|
-
* @license lucide-react v0.
|
|
377
|
+
*/const lr=M("Heading4",[["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17 10v3a1 1 0 0 0 1 1h3",key:"tj5zdr"}],["path",{d:"M21 10v8",key:"1kdml4"}],["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}]]);/**
|
|
378
|
+
* @license lucide-react v0.460.0 - ISC
|
|
379
379
|
*
|
|
380
380
|
* This source code is licensed under the ISC license.
|
|
381
381
|
* See the LICENSE file in the root directory of this source tree.
|
|
382
|
-
*/const
|
|
383
|
-
* @license lucide-react v0.
|
|
382
|
+
*/const ir=M("Heading5",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17 13v-3h4",key:"1nvgqp"}],["path",{d:"M17 17.7c.4.2.8.3 1.3.3 1.5 0 2.7-1.1 2.7-2.5S19.8 13 18.3 13H17",key:"2nebdn"}]]);/**
|
|
383
|
+
* @license lucide-react v0.460.0 - ISC
|
|
384
384
|
*
|
|
385
385
|
* This source code is licensed under the ISC license.
|
|
386
386
|
* See the LICENSE file in the root directory of this source tree.
|
|
387
|
-
*/const
|
|
388
|
-
* @license lucide-react v0.
|
|
387
|
+
*/const ar=M("Heading6",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["circle",{cx:"19",cy:"16",r:"2",key:"15mx69"}],["path",{d:"M20 10c-2 2-3 3.5-3 6",key:"f35dl0"}]]);/**
|
|
388
|
+
* @license lucide-react v0.460.0 - ISC
|
|
389
389
|
*
|
|
390
390
|
* This source code is licensed under the ISC license.
|
|
391
391
|
* See the LICENSE file in the root directory of this source tree.
|
|
392
|
-
*/const
|
|
393
|
-
* @license lucide-react v0.
|
|
392
|
+
*/const Vn=M("Highlighter",[["path",{d:"m9 11-6 6v3h9l3-3",key:"1a3l36"}],["path",{d:"m22 12-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4",key:"14a9rk"}]]);/**
|
|
393
|
+
* @license lucide-react v0.460.0 - ISC
|
|
394
394
|
*
|
|
395
395
|
* This source code is licensed under the ISC license.
|
|
396
396
|
* See the LICENSE file in the root directory of this source tree.
|
|
397
|
-
*/const
|
|
398
|
-
* @license lucide-react v0.
|
|
397
|
+
*/const Oe=M("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/**
|
|
398
|
+
* @license lucide-react v0.460.0 - ISC
|
|
399
399
|
*
|
|
400
400
|
* This source code is licensed under the ISC license.
|
|
401
401
|
* See the LICENSE file in the root directory of this source tree.
|
|
402
|
-
*/const
|
|
403
|
-
* @license lucide-react v0.
|
|
402
|
+
*/const sr=M("IndentDecrease",[["path",{d:"M21 12H11",key:"wd7e0v"}],["path",{d:"M21 18H11",key:"4wu86t"}],["path",{d:"M21 6H11",key:"6dy1d6"}],["path",{d:"m7 8-4 4 4 4",key:"o5hrat"}]]);/**
|
|
403
|
+
* @license lucide-react v0.460.0 - ISC
|
|
404
404
|
*
|
|
405
405
|
* This source code is licensed under the ISC license.
|
|
406
406
|
* See the LICENSE file in the root directory of this source tree.
|
|
407
|
-
*/const
|
|
408
|
-
* @license lucide-react v0.
|
|
407
|
+
*/const dr=M("IndentIncrease",[["path",{d:"M21 12H11",key:"wd7e0v"}],["path",{d:"M21 18H11",key:"4wu86t"}],["path",{d:"M21 6H11",key:"6dy1d6"}],["path",{d:"m3 8 4 4-4 4",key:"1a3j6y"}]]);/**
|
|
408
|
+
* @license lucide-react v0.460.0 - ISC
|
|
409
409
|
*
|
|
410
410
|
* This source code is licensed under the ISC license.
|
|
411
411
|
* See the LICENSE file in the root directory of this source tree.
|
|
412
|
-
*/const
|
|
413
|
-
* @license lucide-react v0.
|
|
412
|
+
*/const ur=M("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
|
|
413
|
+
* @license lucide-react v0.460.0 - ISC
|
|
414
414
|
*
|
|
415
415
|
* This source code is licensed under the ISC license.
|
|
416
416
|
* See the LICENSE file in the root directory of this source tree.
|
|
417
|
-
*/const
|
|
418
|
-
* @license lucide-react v0.
|
|
417
|
+
*/const Wn=M("Italic",[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]]);/**
|
|
418
|
+
* @license lucide-react v0.460.0 - ISC
|
|
419
419
|
*
|
|
420
420
|
* This source code is licensed under the ISC license.
|
|
421
421
|
* See the LICENSE file in the root directory of this source tree.
|
|
422
|
-
*/const
|
|
423
|
-
* @license lucide-react v0.
|
|
422
|
+
*/const pr=M("Link2Off",[["path",{d:"M9 17H7A5 5 0 0 1 7 7",key:"10o201"}],["path",{d:"M15 7h2a5 5 0 0 1 4 8",key:"1d3206"}],["line",{x1:"8",x2:"12",y1:"12",y2:"12",key:"rvw6j4"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/**
|
|
423
|
+
* @license lucide-react v0.460.0 - ISC
|
|
424
424
|
*
|
|
425
425
|
* This source code is licensed under the ISC license.
|
|
426
426
|
* See the LICENSE file in the root directory of this source tree.
|
|
427
|
-
*/const
|
|
428
|
-
* @license lucide-react v0.
|
|
427
|
+
*/const He=M("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);/**
|
|
428
|
+
* @license lucide-react v0.460.0 - ISC
|
|
429
429
|
*
|
|
430
430
|
* This source code is licensed under the ISC license.
|
|
431
431
|
* See the LICENSE file in the root directory of this source tree.
|
|
432
|
-
*/const
|
|
433
|
-
* @license lucide-react v0.
|
|
432
|
+
*/const Ct=M("ListOrdered",[["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]);/**
|
|
433
|
+
* @license lucide-react v0.460.0 - ISC
|
|
434
434
|
*
|
|
435
435
|
* This source code is licensed under the ISC license.
|
|
436
436
|
* See the LICENSE file in the root directory of this source tree.
|
|
437
|
-
*/const
|
|
438
|
-
* @license lucide-react v0.
|
|
437
|
+
*/const St=M("List",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]);/**
|
|
438
|
+
* @license lucide-react v0.460.0 - ISC
|
|
439
439
|
*
|
|
440
440
|
* This source code is licensed under the ISC license.
|
|
441
441
|
* See the LICENSE file in the root directory of this source tree.
|
|
442
|
-
*/const
|
|
443
|
-
* @license lucide-react v0.
|
|
442
|
+
*/const hr=M("Maximize2",[["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["polyline",{points:"9 21 3 21 3 15",key:"1avn1i"}],["line",{x1:"21",x2:"14",y1:"3",y2:"10",key:"ota7mn"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/**
|
|
443
|
+
* @license lucide-react v0.460.0 - ISC
|
|
444
444
|
*
|
|
445
445
|
* This source code is licensed under the ISC license.
|
|
446
446
|
* See the LICENSE file in the root directory of this source tree.
|
|
447
|
-
*/const
|
|
448
|
-
* @license lucide-react v0.
|
|
447
|
+
*/const Et=M("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);/**
|
|
448
|
+
* @license lucide-react v0.460.0 - ISC
|
|
449
449
|
*
|
|
450
450
|
* This source code is licensed under the ISC license.
|
|
451
451
|
* See the LICENSE file in the root directory of this source tree.
|
|
452
|
-
*/const
|
|
453
|
-
* @license lucide-react v0.
|
|
452
|
+
*/const br=M("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
|
|
453
|
+
* @license lucide-react v0.460.0 - ISC
|
|
454
454
|
*
|
|
455
455
|
* This source code is licensed under the ISC license.
|
|
456
456
|
* See the LICENSE file in the root directory of this source tree.
|
|
457
|
-
*/const
|
|
458
|
-
* @license lucide-react v0.
|
|
457
|
+
*/const _n=M("MoveDown",[["path",{d:"M8 18L12 22L16 18",key:"cskvfv"}],["path",{d:"M12 2V22",key:"r89rzk"}]]);/**
|
|
458
|
+
* @license lucide-react v0.460.0 - ISC
|
|
459
459
|
*
|
|
460
460
|
* This source code is licensed under the ISC license.
|
|
461
461
|
* See the LICENSE file in the root directory of this source tree.
|
|
462
|
-
*/const Yn=
|
|
463
|
-
* @license lucide-react v0.
|
|
462
|
+
*/const Yn=M("MoveUp",[["path",{d:"M8 6L12 2L16 6",key:"1yvkyx"}],["path",{d:"M12 2V22",key:"r89rzk"}]]);/**
|
|
463
|
+
* @license lucide-react v0.460.0 - ISC
|
|
464
464
|
*
|
|
465
465
|
* This source code is licensed under the ISC license.
|
|
466
466
|
* See the LICENSE file in the root directory of this source tree.
|
|
467
|
-
*/const
|
|
468
|
-
* @license lucide-react v0.
|
|
467
|
+
*/const Kn=M("Palette",[["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]]);/**
|
|
468
|
+
* @license lucide-react v0.460.0 - ISC
|
|
469
469
|
*
|
|
470
470
|
* This source code is licensed under the ISC license.
|
|
471
471
|
* See the LICENSE file in the root directory of this source tree.
|
|
472
|
-
*/const
|
|
473
|
-
* @license lucide-react v0.
|
|
472
|
+
*/const gr=M("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]);/**
|
|
473
|
+
* @license lucide-react v0.460.0 - ISC
|
|
474
474
|
*
|
|
475
475
|
* This source code is licensed under the ISC license.
|
|
476
476
|
* See the LICENSE file in the root directory of this source tree.
|
|
477
|
-
*/const
|
|
478
|
-
* @license lucide-react v0.
|
|
477
|
+
*/const Gn=M("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
|
|
478
|
+
* @license lucide-react v0.460.0 - ISC
|
|
479
479
|
*
|
|
480
480
|
* This source code is licensed under the ISC license.
|
|
481
481
|
* See the LICENSE file in the root directory of this source tree.
|
|
482
|
-
*/const
|
|
483
|
-
* @license lucide-react v0.
|
|
482
|
+
*/const Mt=M("Quote",[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]]);/**
|
|
483
|
+
* @license lucide-react v0.460.0 - ISC
|
|
484
484
|
*
|
|
485
485
|
* This source code is licensed under the ISC license.
|
|
486
486
|
* See the LICENSE file in the root directory of this source tree.
|
|
487
|
-
*/const
|
|
488
|
-
* @license lucide-react v0.
|
|
487
|
+
*/const Xn=M("Redo",[["path",{d:"M21 7v6h-6",key:"3ptur4"}],["path",{d:"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7",key:"1kgawr"}]]);/**
|
|
488
|
+
* @license lucide-react v0.460.0 - ISC
|
|
489
489
|
*
|
|
490
490
|
* This source code is licensed under the ISC license.
|
|
491
491
|
* See the LICENSE file in the root directory of this source tree.
|
|
492
|
-
*/const
|
|
493
|
-
* @license lucide-react v0.
|
|
492
|
+
*/const mr=M("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/**
|
|
493
|
+
* @license lucide-react v0.460.0 - ISC
|
|
494
494
|
*
|
|
495
495
|
* This source code is licensed under the ISC license.
|
|
496
496
|
* See the LICENSE file in the root directory of this source tree.
|
|
497
|
-
*/const
|
|
498
|
-
* @license lucide-react v0.
|
|
497
|
+
*/const fr=M("Rows2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 12h18",key:"1i2n21"}]]);/**
|
|
498
|
+
* @license lucide-react v0.460.0 - ISC
|
|
499
499
|
*
|
|
500
500
|
* This source code is licensed under the ISC license.
|
|
501
501
|
* See the LICENSE file in the root directory of this source tree.
|
|
502
|
-
*/const
|
|
503
|
-
* @license lucide-react v0.
|
|
502
|
+
*/const yr=M("Scissors",[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]]);/**
|
|
503
|
+
* @license lucide-react v0.460.0 - ISC
|
|
504
504
|
*
|
|
505
505
|
* This source code is licensed under the ISC license.
|
|
506
506
|
* See the LICENSE file in the root directory of this source tree.
|
|
507
|
-
*/const
|
|
508
|
-
* @license lucide-react v0.
|
|
507
|
+
*/const kr=M("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
|
|
508
|
+
* @license lucide-react v0.460.0 - ISC
|
|
509
509
|
*
|
|
510
510
|
* This source code is licensed under the ISC license.
|
|
511
511
|
* See the LICENSE file in the root directory of this source tree.
|
|
512
|
-
*/const
|
|
513
|
-
* @license lucide-react v0.
|
|
512
|
+
*/const vr=M("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
|
|
513
|
+
* @license lucide-react v0.460.0 - ISC
|
|
514
514
|
*
|
|
515
515
|
* This source code is licensed under the ISC license.
|
|
516
516
|
* See the LICENSE file in the root directory of this source tree.
|
|
517
|
-
*/const
|
|
518
|
-
* @license lucide-react v0.
|
|
517
|
+
*/const Lt=M("SquareCheckBig",[["path",{d:"M21 10.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.5",key:"1uzm8b"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
|
|
518
|
+
* @license lucide-react v0.460.0 - ISC
|
|
519
519
|
*
|
|
520
520
|
* This source code is licensed under the ISC license.
|
|
521
521
|
* See the LICENSE file in the root directory of this source tree.
|
|
522
|
-
*/const
|
|
523
|
-
* @license lucide-react v0.
|
|
522
|
+
*/const Jn=M("Strikethrough",[["path",{d:"M16 4H9a3 3 0 0 0-2.83 4",key:"43sutm"}],["path",{d:"M14 12a4 4 0 0 1 0 8H6",key:"nlfj13"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]]);/**
|
|
523
|
+
* @license lucide-react v0.460.0 - ISC
|
|
524
524
|
*
|
|
525
525
|
* This source code is licensed under the ISC license.
|
|
526
526
|
* See the LICENSE file in the root directory of this source tree.
|
|
527
|
-
*/const
|
|
528
|
-
* @license lucide-react v0.
|
|
527
|
+
*/const xr=M("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/**
|
|
528
|
+
* @license lucide-react v0.460.0 - ISC
|
|
529
529
|
*
|
|
530
530
|
* This source code is licensed under the ISC license.
|
|
531
531
|
* See the LICENSE file in the root directory of this source tree.
|
|
532
|
-
*/const
|
|
533
|
-
* @license lucide-react v0.
|
|
532
|
+
*/const At=M("Table",[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]]);/**
|
|
533
|
+
* @license lucide-react v0.460.0 - ISC
|
|
534
534
|
*
|
|
535
535
|
* This source code is licensed under the ISC license.
|
|
536
536
|
* See the LICENSE file in the root directory of this source tree.
|
|
537
|
-
*/const
|
|
538
|
-
* @license lucide-react v0.
|
|
537
|
+
*/const wr=M("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);/**
|
|
538
|
+
* @license lucide-react v0.460.0 - ISC
|
|
539
539
|
*
|
|
540
540
|
* This source code is licensed under the ISC license.
|
|
541
541
|
* See the LICENSE file in the root directory of this source tree.
|
|
542
|
-
*/const
|
|
543
|
-
* @license lucide-react v0.
|
|
542
|
+
*/const Tt=M("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
|
|
543
|
+
* @license lucide-react v0.460.0 - ISC
|
|
544
544
|
*
|
|
545
545
|
* This source code is licensed under the ISC license.
|
|
546
546
|
* See the LICENSE file in the root directory of this source tree.
|
|
547
|
-
*/const
|
|
548
|
-
* @license lucide-react v0.
|
|
547
|
+
*/const Cr=M("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
|
|
548
|
+
* @license lucide-react v0.460.0 - ISC
|
|
549
549
|
*
|
|
550
550
|
* This source code is licensed under the ISC license.
|
|
551
551
|
* See the LICENSE file in the root directory of this source tree.
|
|
552
|
-
*/const
|
|
553
|
-
* @license lucide-react v0.
|
|
552
|
+
*/const Fe=M("Type",[["polyline",{points:"4 7 4 4 20 4 20 7",key:"1nosan"}],["line",{x1:"9",x2:"15",y1:"20",y2:"20",key:"swin9y"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]]);/**
|
|
553
|
+
* @license lucide-react v0.460.0 - ISC
|
|
554
554
|
*
|
|
555
555
|
* This source code is licensed under the ISC license.
|
|
556
556
|
* See the LICENSE file in the root directory of this source tree.
|
|
557
|
-
*/const
|
|
558
|
-
* @license lucide-react v0.
|
|
557
|
+
*/const Zn=M("Underline",[["path",{d:"M6 4v6a6 6 0 0 0 12 0V4",key:"9kb039"}],["line",{x1:"4",x2:"20",y1:"20",y2:"20",key:"nun2al"}]]);/**
|
|
558
|
+
* @license lucide-react v0.460.0 - ISC
|
|
559
559
|
*
|
|
560
560
|
* This source code is licensed under the ISC license.
|
|
561
561
|
* See the LICENSE file in the root directory of this source tree.
|
|
562
|
-
*/const
|
|
563
|
-
* @license lucide-react v0.
|
|
562
|
+
*/const Qn=M("Undo",[["path",{d:"M3 7v6h6",key:"1v2h90"}],["path",{d:"M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13",key:"1r6uu6"}]]);/**
|
|
563
|
+
* @license lucide-react v0.460.0 - ISC
|
|
564
564
|
*
|
|
565
565
|
* This source code is licensed under the ISC license.
|
|
566
566
|
* See the LICENSE file in the root directory of this source tree.
|
|
567
|
-
*/const
|
|
567
|
+
*/const Sr=M("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/**
|
|
568
|
+
* @license lucide-react v0.460.0 - ISC
|
|
569
|
+
*
|
|
570
|
+
* This source code is licensed under the ISC license.
|
|
571
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
572
|
+
*/const Nt=M("Video",[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]]);/**
|
|
573
|
+
* @license lucide-react v0.460.0 - ISC
|
|
574
|
+
*
|
|
575
|
+
* This source code is licensed under the ISC license.
|
|
576
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
577
|
+
*/const Le=M("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),eo={bold:"strong",italic:"em",underline:"u",strikethrough:"s",code:"code",link:"a",textColor:"span",highlight:"mark"};function to(e,t){const n=window.getSelection();if(!n||n.rangeCount===0)return!1;let c=n.getRangeAt(0).commonAncestorContainer;const r=eo[e].toUpperCase();for(;c&&c!==t;){if(c instanceof HTMLElement&&c.tagName===r)return!0;c=c.parentNode}return!1}function no(e,t,n){const o=window.getSelection();if(!o||o.rangeCount===0)return;const c=eo[e],r=to(e,t);o.isCollapsed||(r?Bn(c,t).forEach(a=>Nn(a)):Tn(c,n))}function Bt(e){document.execCommand("bold",!1)}function Ht(e){document.execCommand("italic",!1)}function qt(e){document.execCommand("underline",!1)}function $t(e){document.execCommand("strikeThrough",!1)}function jt(e){no("code",e)}function Rt(e,t,n){var r;const o=window.getSelection();if(!o||!o.rangeCount)return;const c=o.getRangeAt(0);if(o.isCollapsed&&n){const i=document.createElement("a");i.href=t,i.textContent=n,i.className="cb-link",c.insertNode(i);const a=document.createRange();a.setStartAfter(i),a.collapse(!0),o.removeAllRanges(),o.addRange(a)}else if(!o.isCollapsed){let i=c.commonAncestorContainer;for(;i&&i!==e;){if(i instanceof HTMLAnchorElement){i.href=t;return}i=i.parentNode}const a=document.createElement("a");a.href=t,a.className="cb-link";try{const u=c.extractContents();a.appendChild(u),c.insertNode(a);const w=document.createRange();w.selectNodeContents(a),o.removeAllRanges(),o.addRange(w)}catch{document.execCommand("createLink",!1,t);const w=(r=c.commonAncestorContainer.parentElement)==null?void 0:r.closest("a");w&&(w.className="cb-link")}}}function Dt(e){const t=window.getSelection();if(!t||!t.rangeCount)return;const n=t.getRangeAt(0);let o=n.commonAncestorContainer;for(;o&&o!==e;){if(o instanceof HTMLAnchorElement){const c=o.parentNode;if(!c)return;const r=document.createDocumentFragment();for(;o.firstChild;)r.appendChild(o.firstChild);c.replaceChild(r,o),t.removeAllRanges(),t.addRange(n);return}o=o.parentNode}document.execCommand("unlink",!1)}function It(e,t){document.execCommand("foreColor",!1,t)}function zt(e,t){document.execCommand("hiliteColor",!1,t)}function fe(e,t){e.style.textAlign=t}function Pt(e){document.execCommand("removeFormat",!1)}function oo(e,t,n,o){const c=de.createBlock(t);if(!c)return null;o?n==="before"?nn(c,o):Pe(c,o):e.appendChild(c);const r=c.querySelector('[contenteditable="true"]')||(c.hasAttribute("contenteditable")?c:null);return r instanceof HTMLElement&&(r.focus(),be(r)),c}function co(e,t){const n=Array.from(t.querySelectorAll("[data-block-id]")),o=n.indexOf(e),c=n[o-1],r=n[o+1];e.remove();const i=r||c;if(i){const a=i.querySelector('[contenteditable="true"]')||(i.hasAttribute("contenteditable")?i:null);a instanceof HTMLElement&&(a.focus(),r?be(a):xe(a))}if(n.length<=1){const a=de.createBlock(de.getDefaultBlock());if(a)return t.appendChild(a),a}return i||null}function ro(e,t){const n=e.previousElementSibling;return n&&n instanceof HTMLElement?(t.insertBefore(e,n),!0):!1}function lo(e,t){const n=e.nextElementSibling;return n&&n instanceof HTMLElement?(t.insertBefore(n,e),!0):!1}function io(e){const t=e.cloneNode(!0),n=`cb-${Date.now().toString(36)}-${Math.random().toString(36).substring(2,9)}`;return t.setAttribute("data-block-id",n),Pe(t,e),t}function ao(e,t,n){var r;const o=de.transformBlock(e,t);if(!o)return null;(r=e.parentNode)==null||r.replaceChild(o,e);const c=o.querySelector('[contenteditable="true"]')||(o.hasAttribute("contenteditable")?o:null);return c instanceof HTMLElement&&c.focus(),o}function so(e,t){const n=e.innerHTML,o=t.querySelector('[contenteditable="true"]')||t;o instanceof HTMLElement&&(o.innerHTML+=n,xe(o)),e.remove()}function uo(e,t){const n=window.getSelection();if(!n||n.rangeCount===0)return null;const o=n.getRangeAt(0),c=document.createRange();c.setStart(o.endContainer,o.endOffset),c.setEndAfter(e.lastChild||e);const r=c.extractContents(),i=de.getBlockType(e)||"paragraph",a=de.createBlock(i);if(!a)return null;const u=a.querySelector('[contenteditable="true"]')||a;return u instanceof HTMLElement&&u.appendChild(r),Pe(a,e),u instanceof HTMLElement&&(u.focus(),be(u)),a}function po(e){const t=de.getBlockType(e);if(t!=="bulletList"&&t!=="numberedList")return!1;const n=parseInt(e.style.marginLeft||"0",10);return e.style.marginLeft=`${n+24}px`,!0}function ho(e){const t=de.getBlockType(e);if(t!=="bulletList"&&t!=="numberedList")return!1;const n=parseInt(e.style.marginLeft||"0",10);return n>0?(e.style.marginLeft=`${Math.max(0,n-24)}px`,!0):!1}function Er(e){return{bold:()=>Bt(e.container),italic:()=>Ht(e.container),underline:()=>qt(e.container),strikethrough:()=>$t(e.container),inlineCode:()=>jt(e.container),link:(t,n)=>Rt(e.container,t,n),unlink:()=>Dt(e.container),textColor:t=>It(e.container,t),highlight:t=>zt(e.container,t),clearFormat:()=>Pt(e.container),alignLeft:t=>fe(t,"left"),alignCenter:t=>fe(t,"center"),alignRight:t=>fe(t,"right"),alignJustify:t=>fe(t,"justify"),insertBlock:(t,n,o)=>oo(e.container,t,n,o),deleteBlock:t=>co(t,e.container),moveUp:t=>ro(t,e.container),moveDown:t=>lo(t,e.container),duplicate:t=>io(t),transform:(t,n)=>ao(t,n,e.container),merge:(t,n)=>so(t,n),split:t=>uo(t,e.container),indent:t=>po(t),outdent:t=>ho(t)}}const nt=({editor:e,className:t="",darkMode:n=!1})=>{const[o,c]=p.useState(null),[r,i]=p.useState({x:0,y:0}),[a,u]=p.useState(""),[w,x]=p.useState({bold:!1,italic:!1,underline:!1,strikethrough:!1}),[m,N]=p.useState(null),L=p.useRef(null),C=p.useRef(null),A=p.useRef(null),H=p.useRef(null),U=p.useRef(null),D=p.useRef(null);p.useEffect(()=>{const S=()=>{const B=window.getSelection();if(!B||!B.rangeCount)return;const W=B.getRangeAt(0),v=e==null?void 0:e.container;!v||!v.contains(W.commonAncestorContainer)||x({bold:document.queryCommandState("bold"),italic:document.queryCommandState("italic"),underline:document.queryCommandState("underline"),strikethrough:document.queryCommandState("strikeThrough")})};return document.addEventListener("selectionchange",S),()=>document.removeEventListener("selectionchange",S)},[e]);const ee=[{color:"#000000",label:"Black"},{color:"#374151",label:"Gray"},{color:"#dc2626",label:"Red"},{color:"#ea580c",label:"Orange"},{color:"#ca8a04",label:"Yellow"},{color:"#16a34a",label:"Green"},{color:"#0891b2",label:"Cyan"},{color:"#2563eb",label:"Blue"},{color:"#7c3aed",label:"Purple"},{color:"#db2777",label:"Pink"}],T=[{color:"#fef08a",label:"Yellow"},{color:"#bbf7d0",label:"Green"},{color:"#bfdbfe",label:"Blue"},{color:"#fecaca",label:"Red"},{color:"#e9d5ff",label:"Purple"},{color:"#fed7aa",label:"Orange"},{color:"#99f6e4",label:"Teal"},{color:"#fce7f3",label:"Pink"},{color:"#e5e7eb",label:"Gray"},{color:"transparent",label:"None"}];p.useEffect(()=>{const S=B=>{var W;C.current&&!C.current.contains(B.target)&&!((W=L.current)!=null&&W.contains(B.target))&&c(null),A.current&&!A.current.contains(B.target)&&N(null)};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[]),p.useEffect(()=>{if(!(e!=null&&e.container))return;const S=v=>{const q=v.target;D.current&&(window.clearTimeout(D.current),D.current=null);const R=q.closest("a.cb-link");R&&R.href&&(U.current&&window.clearTimeout(U.current),U.current=window.setTimeout(()=>{const z=R.getBoundingClientRect();N({url:R.href,element:R,position:{x:z.left+window.scrollX,y:z.bottom+window.scrollY+8}})},300))},B=v=>{var _;const q=v.target,R=v.relatedTarget;q.closest("a.cb-link")&&(U.current&&(window.clearTimeout(U.current),U.current=null),(_=R==null?void 0:R.closest)!=null&&_.call(R,".cb-link-preview")||(D.current=window.setTimeout(()=>{N(null)},200)))},W=()=>{N(null),D.current&&(window.clearTimeout(D.current),D.current=null)};return e.container.addEventListener("mouseover",S),e.container.addEventListener("mouseout",B),window.addEventListener("scroll",W,!0),()=>{e.container.removeEventListener("mouseover",S),e.container.removeEventListener("mouseout",B),window.removeEventListener("scroll",W,!0),U.current&&window.clearTimeout(U.current),D.current&&window.clearTimeout(D.current)}},[e]);const le=p.useCallback((S,B)=>{var z;if(o===S){c(null);return}const W=window.getSelection();W&&W.rangeCount>0&&(H.current=W.getRangeAt(0).cloneRange());const q=B.currentTarget.getBoundingClientRect(),R=(z=L.current)==null?void 0:z.getBoundingClientRect();i({x:q.left-((R==null?void 0:R.left)||0),y:q.bottom-((R==null?void 0:R.top)||0)+8}),c(S),u("")},[o]),te=p.useCallback(()=>{if(a&&(e!=null&&e.container)){if(H.current){const S=window.getSelection();S&&(S.removeAllRanges(),S.addRange(H.current))}Rt(e.container,a),c(null),u(""),H.current=null}},[a,e]),ne=p.useCallback(S=>{e!=null&&e.container&&(It(e.container,S),c(null))},[e]),ke=p.useCallback(S=>{e!=null&&e.container&&(S==="transparent"?document.execCommand("removeFormat",!1):zt(e.container,S),c(null))},[e]),Ce=p.useCallback(()=>{var S;if(m){const B=m.url;u(B);const W=window.getSelection();if(W){const R=document.createRange();R.selectNodeContents(m.element),W.removeAllRanges(),W.addRange(R),H.current=R.cloneRange()}N(null),c("link");const v=m.element.getBoundingClientRect(),q=(S=L.current)==null?void 0:S.getBoundingClientRect();i({x:v.left-((q==null?void 0:q.left)||0),y:v.bottom-((q==null?void 0:q.top)||0)+8})}},[m]);p.useCallback(()=>{m&&window.open(m.url,"_blank","noopener,noreferrer")},[m]);const ie=p.useCallback(()=>{if(m&&(e!=null&&e.container)){const S=window.getSelection();if(S){const B=document.createRange();B.selectNodeContents(m.element),S.removeAllRanges(),S.addRange(B)}Dt(e.container),N(null)}},[m,e]),ae=p.useCallback(S=>{if(!e)return;const B=e.getHTML();let W,v,q;S==="html"?(W=`<!DOCTYPE html>
|
|
568
578
|
<html>
|
|
569
579
|
<head>
|
|
570
580
|
<meta charset="UTF-8">
|
|
@@ -583,7 +593,7 @@
|
|
|
583
593
|
<body>
|
|
584
594
|
${B}
|
|
585
595
|
</body>
|
|
586
|
-
</html>`,v="document.html",H="text/html"):(W=JSON.stringify({content:B},null,2),v="document.json",H="application/json");const R=new Blob([W],{type:H}),z=URL.createObjectURL(R),_=document.createElement("a");_.href=z,_.download=v,_.click(),URL.revokeObjectURL(z)},[e]);if(!e)return null;const oe=(S,B)=>{var _;const W=document.activeElement,v=W==null?void 0:W.closest(".cb-block"),H=v==null?void 0:v.getAttribute("data-block-id"),R=v==null?void 0:v.getAttribute("data-block-type"),z=v==null?void 0:v.querySelector('[contenteditable="true"]');H&&R==="paragraph"&&z&&!((_=z.textContent)!=null&&_.trim())?e.transformBlock(v,S,B):e.insertBlock(S,B)},he=[{name:"history",buttons:[{icon:Jn,label:"Undo",action:()=>e.undo(),shortcut:"Ctrl+Z"},{icon:Gn,label:"Redo",action:()=>e.redo(),shortcut:"Ctrl+Y"}]},{name:"formatting",buttons:[{icon:jn,label:"Bold",action:()=>Bt(e.container),isActive:()=>w.bold,shortcut:"Ctrl+B"},{icon:Un,label:"Italic",action:()=>$t(e.container),isActive:()=>w.italic,shortcut:"Ctrl+I"},{icon:Zn,label:"Underline",action:()=>Ht(e.container),isActive:()=>w.underline,shortcut:"Ctrl+U"},{icon:Xn,label:"Strikethrough",action:()=>qt(e.container),isActive:()=>w.strikethrough},{icon:vt,label:"Inline Code",action:()=>jt(e.container)}]},{name:"richtext",buttons:[{icon:$e,label:"Insert Link",action:S=>le("link",S)},{icon:Fn,label:"Highlight",action:S=>le("highlight",S)},{icon:Yn,label:"Text Color",action:S=>le("textColor",S)}]},{name:"alignment",buttons:[{icon:Hn,label:"Align Left",action:()=>{const S=ye(document.activeElement);S&&fe(S,"left")}},{icon:$n,label:"Align Center",action:()=>{const S=ye(document.activeElement);S&&fe(S,"center")}},{icon:qn,label:"Align Right",action:()=>{const S=ye(document.activeElement);S&&fe(S,"right")}}]},{name:"headings",buttons:[{icon:xt,label:"Heading 1",action:()=>oe("heading",{level:1}),shortcut:"Ctrl+1"},{icon:wt,label:"Heading 2",action:()=>oe("heading",{level:2}),shortcut:"Ctrl+2"},{icon:Ct,label:"Heading 3",action:()=>oe("heading",{level:3}),shortcut:"Ctrl+3"}]},{name:"blocks",buttons:[{icon:Et,label:"Bullet List",action:()=>oe("bulletList")},{icon:St,label:"Numbered List",action:()=>oe("numberedList")},{icon:kt,label:"Checklist",action:()=>oe("checkList")},{icon:At,label:"Quote",action:()=>oe("quote")},{icon:Pn,label:"Code Block",action:()=>oe("code")}]},{name:"media",buttons:[{icon:Oe,label:"Image",action:()=>e.insertBlock("image")},{icon:Nt,label:"Video",action:()=>e.insertBlock("video")},{icon:Mt,label:"Table",action:()=>e.insertBlock("table")},{icon:yt,label:"Callout",action:()=>oe("callout")},{icon:Lt,label:"Divider",action:()=>e.insertBlock("divider")}]},{name:"utils",buttons:[{icon:zn,label:"Clear Formatting",action:()=>Pt(e.container)},{icon:In,label:"Export HTML",action:()=>ae("html")}]}];return l.jsxs("div",{ref:A,className:`cb-toolbar ${t} ${n?"cb-toolbar-dark":""}`,role:"toolbar","aria-label":"Editor formatting options",onMouseDown:S=>{S.target.closest(".cb-popover")||S.preventDefault()},children:[he.map(S=>l.jsx("div",{className:"cb-toolbar-group",role:"group",children:S.buttons.map(B=>{var W,v;return l.jsx("button",{type:"button",className:`cb-toolbar-btn ${(W=B.isActive)!=null&&W.call(B)?"cb-toolbar-btn-active":""}`,onClick:B.action,title:`${B.label}${B.shortcut?` (${B.shortcut})`:""}`,"aria-label":B.label,"aria-pressed":(v=B.isActive)==null?void 0:v.call(B),children:l.jsx(B.icon,{size:18})},B.label)})},S.name)),o&&l.jsxs("div",{ref:C,className:"cb-popover",style:{position:"absolute",left:r.x,top:r.y,zIndex:1e3},children:[o==="link"&&l.jsxs("div",{className:"cb-popover-content cb-link-popover",children:[l.jsxs("div",{className:"cb-popover-header",children:[l.jsx("span",{children:"Insert Link"}),l.jsx("button",{type:"button",className:"cb-popover-close",onClick:()=>c(null),children:l.jsx(Ae,{size:14})})]}),l.jsxs("div",{className:"cb-popover-body",children:[l.jsx("input",{type:"url",value:a,onChange:S=>d(S.target.value),placeholder:"https://example.com",className:"cb-popover-input",autoFocus:!0,onKeyDown:S=>{S.key==="Enter"&&te(),S.key==="Escape"&&c(null)}}),l.jsx("button",{type:"button",className:"cb-popover-btn-primary",onClick:te,disabled:!a,children:"Insert Link"})]})]}),o==="highlight"&&l.jsxs("div",{className:"cb-popover-content cb-color-popover",children:[l.jsxs("div",{className:"cb-popover-header",children:[l.jsx("span",{children:"Highlight Color"}),l.jsx("button",{type:"button",className:"cb-popover-close",onClick:()=>c(null),children:l.jsx(Ae,{size:14})})]}),l.jsx("div",{className:"cb-color-grid",children:N.map(({color:S,label:B})=>l.jsx("button",{type:"button",className:"cb-color-swatch",style:{backgroundColor:S==="transparent"?"#fff":S,border:S==="transparent"?"2px dashed #ccc":void 0},onClick:()=>ke(S),title:B,children:S==="transparent"&&l.jsx(Ae,{size:12})},S))})]}),o==="textColor"&&l.jsxs("div",{className:"cb-popover-content cb-color-popover",children:[l.jsxs("div",{className:"cb-popover-header",children:[l.jsx("span",{children:"Text Color"}),l.jsx("button",{type:"button",className:"cb-popover-close",onClick:()=>c(null),children:l.jsx(Ae,{size:14})})]}),l.jsx("div",{className:"cb-color-grid",children:ee.map(({color:S,label:B})=>l.jsx("button",{type:"button",className:"cb-color-swatch",style:{backgroundColor:S},onClick:()=>ne(S),title:B},S))})]})]}),m&&typeof document<"u"&&No.createPortal(l.jsx("div",{ref:M,className:"cb-link-preview",style:{position:"absolute",left:m.position.x,top:m.position.y,zIndex:1e4},onMouseEnter:()=>{D.current&&(window.clearTimeout(D.current),D.current=null)},onMouseLeave:()=>{D.current=window.setTimeout(()=>{T(null)},200)},children:l.jsxs("div",{className:"cb-link-preview-content",children:[l.jsx("a",{href:m.url,target:"_blank",rel:"noopener noreferrer",className:"cb-link-preview-url",title:m.url,children:m.url}),l.jsx("div",{className:"cb-link-preview-divider"}),l.jsxs("div",{className:"cb-link-preview-actions",children:[l.jsx("button",{type:"button",className:"cb-link-preview-btn",onClick:Ce,title:"Edit link",children:l.jsx(hr,{size:16})}),l.jsx("button",{type:"button",className:"cb-link-preview-btn cb-link-preview-btn-danger",onClick:ie,title:"Remove link",children:l.jsx(Tt,{size:16})})]})]})}),document.body)]})},Sr=[{type:"paragraph",label:"Paragraph",description:"Plain text paragraph",icon:Fe,keywords:["text","paragraph","p"]},{type:"heading",label:"Heading 1",description:"Large section heading",icon:xt,keywords:["h1","heading","title","header"],data:{level:1}},{type:"heading",label:"Heading 2",description:"Medium section heading",icon:wt,keywords:["h2","heading","subtitle"],data:{level:2}},{type:"heading",label:"Heading 3",description:"Small section heading",icon:Ct,keywords:["h3","heading"],data:{level:3}},{type:"bulletList",label:"Bullet List",description:"Create a bulleted list",icon:Et,keywords:["bullet","list","ul","unordered"]},{type:"numberedList",label:"Numbered List",description:"Create a numbered list",icon:St,keywords:["number","list","ol","ordered"]},{type:"checkList",label:"Checklist",description:"Track tasks with checkboxes",icon:kt,keywords:["check","todo","task","checkbox"]},{type:"quote",label:"Quote",description:"Capture a quote",icon:At,keywords:["quote","blockquote","citation"]},{type:"code",label:"Code Block",description:"Display code with syntax highlighting",icon:vt,keywords:["code","pre","syntax","programming"]},{type:"image",label:"Image",description:"Upload or embed an image",icon:Oe,keywords:["image","picture","photo","img"]},{type:"video",label:"Video",description:"Embed a video from YouTube, Vimeo, etc.",icon:Nt,keywords:["video","youtube","vimeo","embed"]},{type:"divider",label:"Divider",description:"Visual separator between sections",icon:Lt,keywords:["divider","hr","line","separator"]},{type:"callout",label:"Callout",description:"Highlight important information",icon:yt,keywords:["callout","alert","info","warning","note"]},{type:"accordion",label:"Accordion",description:"Collapsible content section",icon:tt,keywords:["accordion","collapse","toggle","details"]},{type:"table",label:"Table",description:"Add a table",icon:Mt,keywords:["table","grid","rows","columns"]},{type:"linkPreview",label:"Link Preview",description:"Rich preview card for URLs",icon:$e,keywords:["link","url","preview","embed","opengraph"]}],ho=({editor:e,position:t,onSelect:n,onClose:o})=>{const[c,r]=h.useState(""),[i,a]=h.useState(0),d=h.useRef(null),w=h.useRef(null),x=h.useRef(new Map),m=Sr.filter(C=>{if(!c)return!0;const M=c.toLowerCase();return C.label.toLowerCase().includes(M)||C.description.toLowerCase().includes(M)||C.keywords.some($=>$.includes(M))});h.useEffect(()=>{a(0)},[c]),h.useEffect(()=>{const C=x.current.get(i);C&&C.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})},[i]),h.useEffect(()=>{var C;(C=w.current)==null||C.focus()},[]),h.useEffect(()=>{const C=M=>{d.current&&!d.current.contains(M.target)&&o()};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[o]);const T=h.useCallback(C=>{switch(C.key){case"ArrowDown":C.preventDefault(),a(M=>M<m.length-1?M+1:0);break;case"ArrowUp":C.preventDefault(),a(M=>M>0?M-1:m.length-1);break;case"Enter":if(C.preventDefault(),m[i]){const M=m[i];n(M.type,M.data)}break;case"Escape":C.preventDefault(),o();break}},[m,i,n,o]),A={position:"fixed",left:Math.min(t.x,window.innerWidth-320),top:Math.min(t.y,window.innerHeight-400),zIndex:1e3};return l.jsxs("div",{ref:d,className:"cb-block-menu",style:A,role:"listbox","aria-label":"Insert block",children:[l.jsx("div",{className:"cb-block-menu-search",children:l.jsx("input",{ref:w,type:"text",value:c,onChange:C=>r(C.target.value),onKeyDown:T,placeholder:"Search blocks...",className:"cb-block-menu-input","aria-label":"Search blocks"})}),l.jsx("div",{className:"cb-block-menu-list",children:m.length===0?l.jsx("div",{className:"cb-block-menu-empty",children:"No matching blocks"}):m.map((C,M)=>l.jsxs("button",{ref:$=>{$?x.current.set(M,$):x.current.delete(M)},type:"button",className:`cb-block-menu-item ${M===i?"cb-block-menu-item-selected":""}`,onClick:()=>n(C.type,C.data),onMouseEnter:()=>a(M),role:"option","aria-selected":M===i,children:[l.jsx("div",{className:"cb-block-menu-item-icon",children:l.jsx(C.icon,{size:20})}),l.jsxs("div",{className:"cb-block-menu-item-content",children:[l.jsx("span",{className:"cb-block-menu-item-label",children:C.label}),l.jsx("span",{className:"cb-block-menu-item-description",children:C.description})]})]},`${C.type}-${C.label}`))}),l.jsxs("div",{className:"cb-block-menu-footer",children:[l.jsx("span",{children:"↑↓ Navigate"}),l.jsx("span",{children:"↵ Select"}),l.jsx("span",{children:"Esc Close"})]})]})};function bo(e){return e===0?0:e/200}function Er(e){if(e===0)return"0 min read";if(e<1)return"< 1 min read";const t=Math.ceil(e);if(t===1)return"1 min read";if(t<60)return`${t} min read`;const n=Math.floor(t/60),o=t%60;return o===0?n===1?"1 hour read":`${n} hours read`:`${n}h ${o}m read`}function Lr(e){const n=new Date().getTime()-e.getTime(),o=Math.floor(n/1e3),c=Math.floor(o/60),r=Math.floor(c/60),i=Math.floor(r/24);if(o<10)return"Just now";if(o<60)return`${o}s ago`;if(c<60)return`${c}m ago`;if(r<24)return`${r}h ago`;if(i===1)return"Yesterday";if(i<7)return`${i} days ago`;const a={month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"};return e.toLocaleDateString("en-US",a)}const go=({wordCount:e,charCount:t,readingTime:n,lastSaved:o,className:c="",darkMode:r=!1})=>l.jsxs("div",{className:`cb-status-bar ${c} ${r?"cb-dark":""}`,role:"status","aria-label":"Editor statistics",children:[l.jsxs("div",{className:"cb-status-item",title:"Word count",children:[l.jsx(Fe,{size:14,className:"cb-status-icon"}),l.jsxs("span",{className:"cb-status-label",children:[e.toLocaleString()," ",e===1?"word":"words"]})]}),l.jsxs("div",{className:"cb-status-item",title:"Character count",children:[l.jsx(Le,{size:14,className:"cb-status-icon"}),l.jsxs("span",{className:"cb-status-label",children:[t.toLocaleString()," ",t===1?"char":"chars"]})]}),l.jsxs("div",{className:"cb-status-item",title:"Estimated reading time",children:[l.jsx(er,{size:14,className:"cb-status-icon"}),l.jsx("span",{className:"cb-status-label",children:Er(n)})]}),o&&l.jsxs("div",{className:"cb-status-item",title:`Saved on ${o.toLocaleString()}`,children:[l.jsx(Rn,{size:14,className:"cb-status-icon"}),l.jsxs("span",{className:"cb-status-label",children:["Saved ",Lr(o)]})]})]}),Ar=(e,t)=>{const{initialContent:n="",blocks:o,placeholder:c='Type "/" for commands...',readOnly:r=!1,classPrefix:i="cb",className:a="",style:d,showToolbar:w=!0,toolbarPosition:x="top",darkMode:m=!1,autoFocus:T=!1,spellCheck:A=!0,onChange:C,onSave:M,onFocus:$,onBlur:U,onReady:D}=e,ee=h.useRef(null),N=h.useRef(null),le=h.useRef(!1),te=h.useRef([]),ne=h.useRef([]),[ke,Ce]=h.useState(!1),[ie,ae]=h.useState(null),[oe,he]=h.useState(!1),[S,B]=h.useState({x:0,y:0}),[W,v]=h.useState(null),[H,R]=h.useState(0),[z,_]=h.useState({blocks:[],activeBlock:null,selection:null,undoStack:[],redoStack:[],wordCount:0,charCount:0,isDirty:!1});h.useEffect(()=>{ft.forEach(s=>{de.register(s)})},[]),h.useEffect(()=>{Ce(!0)},[]),h.useEffect(()=>{const s=()=>{var u;const p=window.getSelection();p&&((u=N.current)!=null&&u.contains(p.anchorNode))&&R(b=>b+1)};return document.addEventListener("selectionchange",s),()=>document.removeEventListener("selectionchange",s)},[]);const Y=h.useCallback((s,p)=>{const u=(p==null?void 0:p.id)||F(),b=document.createElement("div");b.className="cb-block",b.setAttribute("data-block-id",u),b.setAttribute("data-block-type",s);const y=document.createElement("div");y.className="cb-block-controls",y.innerHTML=`
|
|
596
|
+
</html>`,v="document.html",q="text/html"):(W=JSON.stringify({content:B},null,2),v="document.json",q="application/json");const R=new Blob([W],{type:q}),z=URL.createObjectURL(R),_=document.createElement("a");_.href=z,_.download=v,_.click(),URL.revokeObjectURL(z)},[e]);if(!e)return null;const oe=(S,B)=>{var _;const W=document.activeElement,v=W==null?void 0:W.closest(".cb-block"),q=v==null?void 0:v.getAttribute("data-block-id"),R=v==null?void 0:v.getAttribute("data-block-type"),z=v==null?void 0:v.querySelector('[contenteditable="true"]');q&&R==="paragraph"&&z&&!((_=z.textContent)!=null&&_.trim())?e.transformBlock(v,S,B):e.insertBlock(S,B)},he=[{name:"history",buttons:[{icon:Qn,label:"Undo",action:()=>e.undo(),shortcut:"Ctrl+Z"},{icon:Xn,label:"Redo",action:()=>e.redo(),shortcut:"Ctrl+Y"}]},{name:"formatting",buttons:[{icon:Rn,label:"Bold",action:()=>Bt(e.container),isActive:()=>w.bold,shortcut:"Ctrl+B"},{icon:Wn,label:"Italic",action:()=>Ht(e.container),isActive:()=>w.italic,shortcut:"Ctrl+I"},{icon:Zn,label:"Underline",action:()=>qt(e.container),isActive:()=>w.underline,shortcut:"Ctrl+U"},{icon:Jn,label:"Strikethrough",action:()=>$t(e.container),isActive:()=>w.strikethrough},{icon:kt,label:"Inline Code",action:()=>jt(e.container)}]},{name:"richtext",buttons:[{icon:He,label:"Insert Link",action:S=>le("link",S)},{icon:Vn,label:"Highlight",action:S=>le("highlight",S)},{icon:Kn,label:"Text Color",action:S=>le("textColor",S)}]},{name:"alignment",buttons:[{icon:$n,label:"Align Left",action:()=>{const S=ye(document.activeElement);S&&fe(S,"left")}},{icon:qn,label:"Align Center",action:()=>{const S=ye(document.activeElement);S&&fe(S,"center")}},{icon:jn,label:"Align Right",action:()=>{const S=ye(document.activeElement);S&&fe(S,"right")}}]},{name:"headings",buttons:[{icon:vt,label:"Heading 1",action:()=>oe("heading",{level:1}),shortcut:"Ctrl+1"},{icon:xt,label:"Heading 2",action:()=>oe("heading",{level:2}),shortcut:"Ctrl+2"},{icon:wt,label:"Heading 3",action:()=>oe("heading",{level:3}),shortcut:"Ctrl+3"}]},{name:"blocks",buttons:[{icon:St,label:"Bullet List",action:()=>oe("bulletList")},{icon:Ct,label:"Numbered List",action:()=>oe("numberedList")},{icon:Lt,label:"Checklist",action:()=>oe("checkList")},{icon:Mt,label:"Quote",action:()=>oe("quote")},{icon:Fn,label:"Code Block",action:()=>oe("code")}]},{name:"media",buttons:[{icon:Oe,label:"Image",action:()=>e.insertBlock("image")},{icon:Nt,label:"Video",action:()=>e.insertBlock("video")},{icon:At,label:"Table",action:()=>e.insertBlock("table")},{icon:yt,label:"Callout",action:()=>oe("callout")},{icon:Et,label:"Divider",action:()=>e.insertBlock("divider")}]},{name:"utils",buttons:[{icon:On,label:"Clear Formatting",action:()=>Pt(e.container)},{icon:zn,label:"Export HTML",action:()=>ae("html")}]}];return l.jsxs("div",{ref:L,className:`cb-toolbar ${t} ${n?"cb-toolbar-dark":""}`,role:"toolbar","aria-label":"Editor formatting options",onMouseDown:S=>{S.target.closest(".cb-popover")||S.preventDefault()},children:[he.map(S=>l.jsx("div",{className:"cb-toolbar-group",role:"group",children:S.buttons.map(B=>{var W,v;return l.jsx("button",{type:"button",className:`cb-toolbar-btn ${(W=B.isActive)!=null&&W.call(B)?"cb-toolbar-btn-active":""}`,onClick:B.action,title:`${B.label}${B.shortcut?` (${B.shortcut})`:""}`,"aria-label":B.label,"aria-pressed":(v=B.isActive)==null?void 0:v.call(B),children:l.jsx(B.icon,{size:18})},B.label)})},S.name)),o&&l.jsxs("div",{ref:C,className:"cb-popover",style:{position:"absolute",left:r.x,top:r.y,zIndex:1e3},children:[o==="link"&&l.jsxs("div",{className:"cb-popover-content cb-link-popover",children:[l.jsxs("div",{className:"cb-popover-header",children:[l.jsx("span",{children:"Insert Link"}),l.jsx("button",{type:"button",className:"cb-popover-close",onClick:()=>c(null),children:l.jsx(Le,{size:14})})]}),l.jsxs("div",{className:"cb-popover-body",children:[l.jsx("input",{type:"url",value:a,onChange:S=>u(S.target.value),placeholder:"https://example.com",className:"cb-popover-input",autoFocus:!0,onKeyDown:S=>{S.key==="Enter"&&te(),S.key==="Escape"&&c(null)}}),l.jsx("button",{type:"button",className:"cb-popover-btn-primary",onClick:te,disabled:!a,children:"Insert Link"})]})]}),o==="highlight"&&l.jsxs("div",{className:"cb-popover-content cb-color-popover",children:[l.jsxs("div",{className:"cb-popover-header",children:[l.jsx("span",{children:"Highlight Color"}),l.jsx("button",{type:"button",className:"cb-popover-close",onClick:()=>c(null),children:l.jsx(Le,{size:14})})]}),l.jsx("div",{className:"cb-color-grid",children:T.map(({color:S,label:B})=>l.jsx("button",{type:"button",className:"cb-color-swatch",style:{backgroundColor:S==="transparent"?"#fff":S,border:S==="transparent"?"2px dashed #ccc":void 0},onClick:()=>ke(S),title:B,children:S==="transparent"&&l.jsx(Le,{size:12})},S))})]}),o==="textColor"&&l.jsxs("div",{className:"cb-popover-content cb-color-popover",children:[l.jsxs("div",{className:"cb-popover-header",children:[l.jsx("span",{children:"Text Color"}),l.jsx("button",{type:"button",className:"cb-popover-close",onClick:()=>c(null),children:l.jsx(Le,{size:14})})]}),l.jsx("div",{className:"cb-color-grid",children:ee.map(({color:S,label:B})=>l.jsx("button",{type:"button",className:"cb-color-swatch",style:{backgroundColor:S},onClick:()=>ne(S),title:B},S))})]})]}),m&&typeof document<"u"&&Bo.createPortal(l.jsx("div",{ref:A,className:"cb-link-preview",style:{position:"absolute",left:m.position.x,top:m.position.y,zIndex:1e4},onMouseEnter:()=>{D.current&&(window.clearTimeout(D.current),D.current=null)},onMouseLeave:()=>{D.current=window.setTimeout(()=>{N(null)},200)},children:l.jsxs("div",{className:"cb-link-preview-content",children:[l.jsx("a",{href:m.url,target:"_blank",rel:"noopener noreferrer",className:"cb-link-preview-url",title:m.url,children:m.url}),l.jsx("div",{className:"cb-link-preview-divider"}),l.jsxs("div",{className:"cb-link-preview-actions",children:[l.jsx("button",{type:"button",className:"cb-link-preview-btn",onClick:Ce,title:"Edit link",children:l.jsx(gr,{size:16})}),l.jsx("button",{type:"button",className:"cb-link-preview-btn cb-link-preview-btn-danger",onClick:ie,title:"Remove link",children:l.jsx(Tt,{size:16})})]})]})}),document.body)]})},Mr=[{type:"paragraph",label:"Paragraph",description:"Plain text paragraph",icon:Fe,keywords:["text","paragraph","p"]},{type:"heading",label:"Heading 1",description:"Large section heading",icon:vt,keywords:["h1","heading","title","header"],data:{level:1}},{type:"heading",label:"Heading 2",description:"Medium section heading",icon:xt,keywords:["h2","heading","subtitle"],data:{level:2}},{type:"heading",label:"Heading 3",description:"Small section heading",icon:wt,keywords:["h3","heading"],data:{level:3}},{type:"bulletList",label:"Bullet List",description:"Create a bulleted list",icon:St,keywords:["bullet","list","ul","unordered"]},{type:"numberedList",label:"Numbered List",description:"Create a numbered list",icon:Ct,keywords:["number","list","ol","ordered"]},{type:"checkList",label:"Checklist",description:"Track tasks with checkboxes",icon:Lt,keywords:["check","todo","task","checkbox"]},{type:"quote",label:"Quote",description:"Capture a quote",icon:Mt,keywords:["quote","blockquote","citation"]},{type:"code",label:"Code Block",description:"Display code with syntax highlighting",icon:kt,keywords:["code","pre","syntax","programming"]},{type:"image",label:"Image",description:"Upload or embed an image",icon:Oe,keywords:["image","picture","photo","img"]},{type:"video",label:"Video",description:"Embed a video from YouTube, Vimeo, etc.",icon:Nt,keywords:["video","youtube","vimeo","embed"]},{type:"divider",label:"Divider",description:"Visual separator between sections",icon:Et,keywords:["divider","hr","line","separator"]},{type:"callout",label:"Callout",description:"Highlight important information",icon:yt,keywords:["callout","alert","info","warning","note"]},{type:"accordion",label:"Accordion",description:"Collapsible content section",icon:tt,keywords:["accordion","collapse","toggle","details"]},{type:"table",label:"Table",description:"Add a table",icon:At,keywords:["table","grid","rows","columns"]},{type:"linkPreview",label:"Link Preview",description:"Rich preview card for URLs",icon:He,keywords:["link","url","preview","embed","opengraph"]}],bo=({editor:e,position:t,onSelect:n,onClose:o})=>{const[c,r]=p.useState(""),[i,a]=p.useState(0),u=p.useRef(null),w=p.useRef(null),x=p.useRef(new Map),m=Mr.filter(C=>{if(!c)return!0;const A=c.toLowerCase();return C.label.toLowerCase().includes(A)||C.description.toLowerCase().includes(A)||C.keywords.some(H=>H.includes(A))});p.useEffect(()=>{a(0)},[c]),p.useEffect(()=>{const C=x.current.get(i);C&&C.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})},[i]),p.useEffect(()=>{var C;(C=w.current)==null||C.focus()},[]),p.useEffect(()=>{const C=A=>{u.current&&!u.current.contains(A.target)&&o()};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[o]);const N=p.useCallback(C=>{switch(C.key){case"ArrowDown":C.preventDefault(),a(A=>A<m.length-1?A+1:0);break;case"ArrowUp":C.preventDefault(),a(A=>A>0?A-1:m.length-1);break;case"Enter":if(C.preventDefault(),m[i]){const A=m[i];n(A.type,A.data)}break;case"Escape":C.preventDefault(),o();break}},[m,i,n,o]),L={position:"fixed",left:Math.min(t.x,window.innerWidth-320),top:Math.min(t.y,window.innerHeight-400),zIndex:1e3};return l.jsxs("div",{ref:u,className:"cb-block-menu",style:L,role:"listbox","aria-label":"Insert block",children:[l.jsx("div",{className:"cb-block-menu-search",children:l.jsx("input",{ref:w,type:"text",value:c,onChange:C=>r(C.target.value),onKeyDown:N,placeholder:"Search blocks...",className:"cb-block-menu-input","aria-label":"Search blocks"})}),l.jsx("div",{className:"cb-block-menu-list",children:m.length===0?l.jsx("div",{className:"cb-block-menu-empty",children:"No matching blocks"}):m.map((C,A)=>l.jsxs("button",{ref:H=>{H?x.current.set(A,H):x.current.delete(A)},type:"button",className:`cb-block-menu-item ${A===i?"cb-block-menu-item-selected":""}`,onClick:()=>n(C.type,C.data),onMouseEnter:()=>a(A),role:"option","aria-selected":A===i,children:[l.jsx("div",{className:"cb-block-menu-item-icon",children:l.jsx(C.icon,{size:20})}),l.jsxs("div",{className:"cb-block-menu-item-content",children:[l.jsx("span",{className:"cb-block-menu-item-label",children:C.label}),l.jsx("span",{className:"cb-block-menu-item-description",children:C.description})]})]},`${C.type}-${C.label}`))}),l.jsxs("div",{className:"cb-block-menu-footer",children:[l.jsx("span",{children:"↑↓ Navigate"}),l.jsx("span",{children:"↵ Select"}),l.jsx("span",{children:"Esc Close"})]})]})};function go(e){return e===0?0:e/200}function Lr(e){if(e===0)return"0 min read";if(e<1)return"< 1 min read";const t=Math.ceil(e);if(t===1)return"1 min read";if(t<60)return`${t} min read`;const n=Math.floor(t/60),o=t%60;return o===0?n===1?"1 hour read":`${n} hours read`:`${n}h ${o}m read`}function Ar(e){const n=new Date().getTime()-e.getTime(),o=Math.floor(n/1e3),c=Math.floor(o/60),r=Math.floor(c/60),i=Math.floor(r/24);if(o<10)return"Just now";if(o<60)return`${o}s ago`;if(c<60)return`${c}m ago`;if(r<24)return`${r}h ago`;if(i===1)return"Yesterday";if(i<7)return`${i} days ago`;const a={month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"};return e.toLocaleDateString("en-US",a)}const mo=({wordCount:e,charCount:t,readingTime:n,lastSaved:o,className:c="",darkMode:r=!1})=>l.jsxs("div",{className:`cb-status-bar ${c} ${r?"cb-dark":""}`,role:"status","aria-label":"Editor statistics",children:[l.jsxs("div",{className:"cb-status-item",title:"Word count",children:[l.jsx(Fe,{size:14,className:"cb-status-icon"}),l.jsxs("span",{className:"cb-status-label",children:[e.toLocaleString()," ",e===1?"word":"words"]})]}),l.jsxs("div",{className:"cb-status-item",title:"Character count",children:[l.jsx(Me,{size:14,className:"cb-status-icon"}),l.jsxs("span",{className:"cb-status-label",children:[t.toLocaleString()," ",t===1?"char":"chars"]})]}),l.jsxs("div",{className:"cb-status-item",title:"Estimated reading time",children:[l.jsx(nr,{size:14,className:"cb-status-icon"}),l.jsx("span",{className:"cb-status-label",children:Lr(n)})]}),o&&l.jsxs("div",{className:"cb-status-item",title:`Saved on ${o.toLocaleString()}`,children:[l.jsx(Dn,{size:14,className:"cb-status-icon"}),l.jsxs("span",{className:"cb-status-label",children:["Saved ",Ar(o)]})]})]}),Tr=(e,t)=>{const{initialContent:n="",blocks:o,placeholder:c='Type "/" for commands...',readOnly:r=!1,classPrefix:i="cb",className:a="",style:u,showToolbar:w=!0,toolbarPosition:x="top",darkMode:m=!1,autoFocus:N=!1,spellCheck:L=!0,onChange:C,onSave:A,onFocus:H,onBlur:U,onReady:D}=e,ee=p.useRef(null),T=p.useRef(null),le=p.useRef(!1),te=p.useRef([]),ne=p.useRef([]),[ke,Ce]=p.useState(!1),[ie,ae]=p.useState(null),[oe,he]=p.useState(!1),[S,B]=p.useState({x:0,y:0}),[W,v]=p.useState(null),[q,R]=p.useState(0),[z,_]=p.useState({blocks:[],activeBlock:null,selection:null,undoStack:[],redoStack:[],wordCount:0,charCount:0,isDirty:!1});p.useEffect(()=>{ft.forEach(s=>{de.register(s)})},[]),p.useEffect(()=>{Ce(!0)},[]),p.useEffect(()=>{const s=()=>{var d;const h=window.getSelection();h&&((d=T.current)!=null&&d.contains(h.anchorNode))&&R(b=>b+1)};return document.addEventListener("selectionchange",s),()=>document.removeEventListener("selectionchange",s)},[]);const Y=p.useCallback((s,h)=>{const d=(h==null?void 0:h.id)||F(),b=document.createElement("div");b.className="cb-block",b.setAttribute("data-block-id",d),b.setAttribute("data-block-type",s);const y=document.createElement("div");y.className="cb-block-controls",y.innerHTML=`
|
|
587
597
|
<button type="button" class="cb-block-btn cb-block-add" data-action="add" title="Add block below">
|
|
588
598
|
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
589
599
|
<path d="M12 5v14M5 12h14"/>
|
|
@@ -612,11 +622,11 @@ ${B}
|
|
|
612
622
|
<path d="M3 6h18M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"/>
|
|
613
623
|
</svg>
|
|
614
624
|
</button>
|
|
615
|
-
`;const f=document.createElement("div");f.className="cb-block-content";const g=de.createBlock(s,{...
|
|
625
|
+
`;const f=document.createElement("div");f.className="cb-block-content";const g=de.createBlock(s,{...h,id:d});return g&&(g.removeAttribute("data-block-id"),g.removeAttribute("data-block-type"),f.appendChild(g)),b.appendChild(y),b.appendChild(f),b.appendChild(k),b},[]);p.useEffect(()=>{if(!(!T.current||le.current)){if(le.current=!0,T.current.innerHTML="",n&&n.trim()){const s=document.createElement("div");s.innerHTML=n,Array.from(s.children).forEach(h=>{var d;if(h instanceof HTMLElement){const b=J(h),y=Z(h,b),k=Y(b,y);(d=T.current)==null||d.appendChild(k)}})}if(T.current.children.length===0){const s=Y("paragraph");T.current.appendChild(s)}ce(),!r&&T.current&&Mn({container:T.current,handleSelector:"[data-drag-handle]",onDragEnd:()=>{ce(),$()}})}},[r]),p.useEffect(()=>{N&&T.current&&setTimeout(()=>{var h;const s=(h=T.current)==null?void 0:h.querySelector('[contenteditable="true"]');s instanceof HTMLElement&&s.focus()},100)},[N]);const J=s=>{const h=s.tagName.toLowerCase(),d=s.className||"";switch(h){case"h1":return"heading";case"h2":return"heading";case"h3":return"heading";case"h4":return"heading";case"h5":return"heading";case"h6":return"heading";case"ul":return d.includes("checklist")||s.querySelector('input[type="checkbox"]')?"checkList":"bulletList";case"ol":return"numberedList";case"blockquote":return"quote";case"pre":return"code";case"figure":return s.querySelector("img")?"image":s.querySelector("video, iframe")?"video":"paragraph";case"hr":return"divider";case"table":return"table";case"aside":return"callout";case"details":return"accordion";case"div":return d.includes("code")?"code":d.includes("callout")?"callout":d.includes("divider")?"divider":d.includes("table")?"table":d.includes("link-preview")?"linkPreview":"paragraph";default:return"paragraph"}},Z=(s,h)=>{var b,y,k,f;const d={type:h};switch(h){case"heading":const g=parseInt(s.tagName.charAt(1))||2;d.level=g,d.content=s.innerHTML;break;case"paragraph":d.content=s.innerHTML;break;case"bulletList":case"numberedList":case"checkList":const E=[];s.querySelectorAll(":scope > li").forEach(Q=>{var X;E.push({id:F(),content:Q.innerHTML,checked:(X=Q.querySelector('input[type="checkbox"]'))==null?void 0:X.hasAttribute("checked")})}),d.items=E;break;case"quote":d.content=s.innerHTML;break;case"code":const O=s.querySelector("code")||s;d.content=O.textContent||"",d.language=s.getAttribute("data-language")||"plaintext";break;case"image":const j=s.querySelector("img");d.src=(j==null?void 0:j.src)||"",d.alt=(j==null?void 0:j.alt)||"",d.caption=((b=s.querySelector("figcaption"))==null?void 0:b.textContent)||"";break;case"divider":d.style="solid";break;case"callout":d.calloutType=s.getAttribute("data-callout-type")||"info",d.content=((y=s.querySelector(".cb-callout-body"))==null?void 0:y.innerHTML)||s.innerHTML;break;case"accordion":d.title=((k=s.querySelector("summary"))==null?void 0:k.textContent)||"",d.content=((f=s.querySelector(".cb-accordion-content"))==null?void 0:f.innerHTML)||"",d.open=s.open;break;case"table":const K=[];s.querySelectorAll("tr").forEach(Q=>{const X=[];Q.querySelectorAll("th, td").forEach(G=>{X.push({content:G.innerHTML})}),K.push({cells:X})}),d.rows=K;break;case"linkPreview":d.url=s.getAttribute("data-url")||"";break}return d},P=p.useCallback(()=>{if(!T.current)return"";let s="";return T.current.querySelectorAll(".cb-block").forEach(h=>{const d=h.getAttribute("data-block-type"),b=h.querySelector(".cb-block-content");if(!b)return;const y=b.firstElementChild;if(!y)return;const k=y.cloneNode(!0);switch(k.removeAttribute("data-placeholder"),k.removeAttribute("contenteditable"),k.querySelectorAll("[data-placeholder]").forEach(f=>f.removeAttribute("data-placeholder")),k.querySelectorAll("[contenteditable]").forEach(f=>f.removeAttribute("contenteditable")),k.querySelectorAll(".cb-code-toolbar, .cb-image-controls, .cb-table-controls, .cb-callout-type-selector").forEach(f=>f.remove()),d){case"code":const f=k.querySelector("code"),g=k.querySelector("pre");if(f&&g){const E=k.getAttribute("data-language")||"plaintext";s+=`<pre data-language="${E}"><code>${f.textContent}</code></pre>
|
|
616
626
|
`}else s+=k.outerHTML+`
|
|
617
627
|
`;break;case"divider":s+=`<hr>
|
|
618
628
|
`;break;default:s+=k.outerHTML+`
|
|
619
|
-
`}}),s.trim()},[]),se=
|
|
629
|
+
`}}),s.trim()},[]),se=p.useCallback((s,h=!1)=>{if(!T.current)return;T.current.innerHTML="";const d=document.createElement("div");if(d.innerHTML=s,Array.from(d.children).forEach(b=>{var y;if(b instanceof HTMLElement){const k=J(b),f=Z(b,k),g=Y(k,f);(y=T.current)==null||y.appendChild(g)}}),T.current.children.length===0){const b=Y("paragraph");T.current.appendChild(b)}h&&setTimeout(()=>{var y;const b=(y=T.current)==null?void 0:y.querySelector('[contenteditable="true"]');b instanceof HTMLElement&&b.focus()},0)},[Y]),ge=p.useCallback(()=>{var s;return((s=T.current)==null?void 0:s.textContent)||""},[]),qe=p.useCallback(()=>{var h;const s=(h=T.current)==null?void 0:h.querySelector('[contenteditable="true"]');s instanceof HTMLElement&&s.focus()},[]),$e=p.useCallback(()=>{document.activeElement instanceof HTMLElement&&document.activeElement.blur()},[]),ce=p.useCallback(()=>{if(!T.current)return;const s=T.current.textContent||"";_(h=>({...h,wordCount:Xt(s),charCount:Jt(s)}))},[]),$=p.useCallback(Gt(()=>{C&&C(P())},300),[C,P]),I=p.useCallback(()=>{const s=P();te.current=[...te.current.slice(-49),s],ne.current=[],_(h=>({...h,undoStack:te.current,redoStack:[],isDirty:!0}))},[P]),je=p.useCallback(()=>{if(te.current.length===0)return;const s=P(),h=te.current[te.current.length-1];te.current=te.current.slice(0,-1),ne.current=[...ne.current,s],_(d=>({...d,undoStack:te.current,redoStack:ne.current})),se(h,!0)},[P,se]),Ae=p.useCallback(()=>{if(ne.current.length===0)return;const s=P(),h=ne.current[ne.current.length-1];ne.current=ne.current.slice(0,-1),te.current=[...te.current,s],_(d=>({...d,redoStack:ne.current,undoStack:te.current})),se(h,!0)},[P,se]),pe=p.useCallback((s,h,d)=>{if(!T.current)return null;I();const b=Y(s,d);if(h){const y=T.current.querySelector(`[data-block-id="${h}"]`);y?y.after(b):T.current.appendChild(b)}else T.current.appendChild(b);return setTimeout(()=>{const k=b.querySelector('.cb-code[contenteditable="true"]')||b.querySelector('[contenteditable="true"]');k instanceof HTMLElement&&(k.focus(),be(k))},50),ce(),$(),b},[Y,I,ce,$]),Se=p.useCallback(s=>{var f;if(!T.current)return;const h=T.current.querySelectorAll(".cb-block");if(h.length<=1){const g=(f=h[0])==null?void 0:f.querySelector('[contenteditable="true"]');g instanceof HTMLElement&&(g.innerHTML="",g.focus());return}I();const d=T.current.querySelector(`[data-block-id="${s}"]`);if(!d)return;const b=d.previousElementSibling,y=d.nextElementSibling;d.remove();const k=y||b;if(k){const g=k.querySelector('[contenteditable="true"]');g instanceof HTMLElement&&(g.focus(),y||xe(g))}ce(),$()},[I,ce,$]),Te=p.useCallback((s,h)=>{if(!T.current)return;const d=T.current.querySelector(`[data-block-id="${s}"]`);d&&(I(),h==="up"&&d.previousElementSibling?d.previousElementSibling.before(d):h==="down"&&d.nextElementSibling&&d.nextElementSibling.after(d),ce(),$())},[I,ce,$]),me=p.useCallback((s,h,d)=>{if(!T.current)return;const b=T.current.querySelector(`[data-block-id="${s}"]`);if(!b||b.getAttribute("data-block-type")===h&&!d)return;I();const k=b.querySelector('[contenteditable="true"]'),g={content:(k==null?void 0:k.innerHTML)||"",...d},E=Y(h,g);b.replaceWith(E),setTimeout(()=>{const j=E.querySelector('.cb-code[contenteditable="true"]')||E.querySelector('[contenteditable="true"]');j instanceof HTMLElement&&(j.focus(),be(j))},50),ce(),$()},[Y,I,ce,$]),Ot=p.useRef(z);Ot.current=z;const Ue=p.useRef(ie);Ue.current=ie;const ue=p.useMemo(()=>!ke||!ee.current||!T.current?null:{container:T.current,config:e,get state(){return Ot.current},getHTML:P,setHTML:se,getText:ge,insertBlock:(s,h)=>pe(s,Ue.current||void 0,h),deleteBlock:s=>{const h=s.getAttribute("data-block-id");h&&Se(h)},moveBlock:(s,h)=>{const d=s.getAttribute("data-block-id");d&&Te(d,h)},transformBlock:(s,h,d)=>{const b=s.getAttribute("data-block-id");return b&&me(b,h,d),s},toggleFormat:s=>{switch(s){case"bold":document.execCommand("bold");break;case"italic":document.execCommand("italic");break;case"underline":document.execCommand("underline");break;case"strikethrough":document.execCommand("strikeThrough");break}$()},isFormatActive:s=>{switch(s){case"bold":return document.queryCommandState("bold");case"italic":return document.queryCommandState("italic");case"underline":return document.queryCommandState("underline");case"strikethrough":return document.queryCommandState("strikeThrough");default:return!1}},selectionVersion:q,undo:je,redo:Ae,focus:qe,blur:$e,destroy:()=>{},registerBlock:s=>de.register(s),registerCommand:()=>{},executeCommand:()=>{}},[ke,q,e,P,se,ge,pe,Se,Te,me,je,Ae,qe,$e,$]);p.useImperativeHandle(t,()=>({getHTML:P,setHTML:se,getText:ge,focus:qe,blur:$e,insertBlock:(s,h)=>pe(s,Ue.current||void 0,h),getEditor:()=>ue}),[P,se,ge,qe,$e,pe,ue]),p.useEffect(()=>{D&&ue&&D(ue)},[D,ue]);const Ft=p.useCallback(async s=>{var y;const h=s.target,d=(y=h.files)==null?void 0:y[0];if(!d)return;const b=h.closest("figure.cb-image");if(b){I();try{const k=await hn(d);Ke(b,k,d.name);let f=b.querySelector(".cb-image-controls");if(!f){f=document.createElement("div"),f.className="cb-image-controls",f.innerHTML=`
|
|
620
630
|
<button type="button" class="cb-image-align" data-align="left" title="Align left">
|
|
621
631
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
622
632
|
<line x1="17" x2="3" y1="10" y2="10"/><line x1="21" x2="3" y1="6" y2="6"/><line x1="21" x2="3" y1="14" y2="14"/><line x1="17" x2="3" y1="18" y2="18"/>
|
|
@@ -638,7 +648,7 @@ ${B}
|
|
|
638
648
|
<path d="M6 2v14a2 2 0 0 0 2 2h14"/><path d="M18 22V8a2 2 0 0 0-2-2H2"/>
|
|
639
649
|
</svg>
|
|
640
650
|
</button>
|
|
641
|
-
`;const g=b.querySelector("figcaption");g?b.insertBefore(f,g):b.appendChild(f)}
|
|
651
|
+
`;const g=b.querySelector("figcaption");g?b.insertBefore(f,g):b.appendChild(f)}$()}catch(k){console.error("Failed to load image:",k)}}},[I,$]);p.useEffect(()=>{if(!T.current)return;const s=b=>{Ft(b)},h=b=>{const y=b.target.closest("[data-align]");if(!y)return;const k=y.getAttribute("data-align"),f=y.closest("figure.cb-image");f&&k&&(I(),pn(f,k),$())},d=T.current;d.addEventListener("change",b=>{b.target.matches(".cb-image-input")&&s(b)}),d.addEventListener("click",b=>{const y=b.target;if(y.closest(".cb-image-align")&&h(b),y.closest(".cb-image-crop")){if(b.preventDefault(),b.stopPropagation(),document.querySelector(".cb-crop-modal"))return;const k=y.closest("figure.cb-image"),f=k==null?void 0:k.querySelector("img");if(k&&f&&f.src){const g=bc(f.src,E=>{I(),f.src=E,$()});document.body.appendChild(g)}}if(y.classList.contains("cb-checkbox")){const k=y,f=k.closest(".cb-list-item");f&&(I(),f.classList.toggle("cb-checked",k.checked),$())}}),d.addEventListener("keydown",b=>{const y=b.target;if(y.classList.contains("cb-video-url-input")&&b.key==="Enter"){b.preventDefault();const f=y.value.trim();if(f){const g=y.closest("figure.cb-video");g&&(I(),gn(g,f),$())}}if(y.classList.contains("cb-image-url-input")&&b.key==="Enter"){b.preventDefault();const f=y.value.trim();if(f){const g=y.closest("figure.cb-image");if(g){I(),Ke(g,f);let E=g.querySelector(".cb-image-controls");if(!E){E=document.createElement("div"),E.className="cb-image-controls",E.innerHTML=`
|
|
642
652
|
<button type="button" class="cb-image-align" data-align="left" title="Align left">
|
|
643
653
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
644
654
|
<line x1="17" x2="3" y1="10" y2="10"/><line x1="21" x2="3" y1="6" y2="6"/><line x1="21" x2="3" y1="14" y2="14"/><line x1="17" x2="3" y1="18" y2="18"/>
|
|
@@ -660,7 +670,7 @@ ${B}
|
|
|
660
670
|
<path d="M6 2v14a2 2 0 0 0 2 2h14"/><path d="M18 22V8a2 2 0 0 0-2-2H2"/>
|
|
661
671
|
</svg>
|
|
662
672
|
</button>
|
|
663
|
-
`;const O=g.querySelector("figcaption");O?g.insertBefore(E,O):g.appendChild(E)}
|
|
673
|
+
`;const O=g.querySelector("figcaption");O?g.insertBefore(E,O):g.appendChild(E)}$()}}}}),d.addEventListener("click",b=>{const y=b.target.closest(".cb-callout-type-selector button[data-type]");if(y){b.preventDefault(),b.stopPropagation();const k=y.getAttribute("data-type"),f=y.closest(".cb-callout");f&&k&&(I(),gt(f,k),$())}})},[Ft,I,$]),p.useEffect(()=>{if(!T.current||r)return;const s=T.current;let h=!1,d=0,b=0,y=null,k=null,f=null;const g=j=>{const K=j.target.closest(".cb-image-resize-handle");K&&(j.preventDefault(),j.stopPropagation(),k=K.closest(".cb-image-resizable"),y=k==null?void 0:k.querySelector("img"),f=K.getAttribute("data-handle"),!(!y||!k)&&(h=!0,d=j.clientX,b=y.offsetWidth,k.classList.add("resizing"),document.body.style.cursor=K.style.cursor||"se-resize",document.body.style.userSelect="none",I()))},E=j=>{if(!h||!y||!f)return;j.preventDefault();const K=j.clientX-d;let Q;f==="w"||f==="sw"||f==="nw"?Q=b-K:Q=b+K;const X=s.offsetWidth-100;Q=Math.max(50,Math.min(Q,X)),y.style.width=`${Q}px`,y.style.height="auto"},O=()=>{h&&(h=!1,k&&k.classList.remove("resizing"),document.body.style.cursor="",document.body.style.userSelect="",y=null,k=null,f=null,$())};return s.addEventListener("mousedown",g),document.addEventListener("mousemove",E),document.addEventListener("mouseup",O),()=>{s.removeEventListener("mousedown",g),document.removeEventListener("mousemove",E),document.removeEventListener("mouseup",O)}},[r,I,$]);const ko=p.useCallback(s=>{const d=s.target.closest("[data-action]");if(!d)return;const b=d.getAttribute("data-action"),y=d.closest(".cb-block"),k=y==null?void 0:y.getAttribute("data-block-id");if(!(!k&&!(b!=null&&b.startsWith("add"))&&!(b!=null&&b.startsWith("delete"))))switch(s.preventDefault(),s.stopPropagation(),b){case"add":if(k){I();const f=Y("paragraph");y.after(f);const g=f.querySelector('[contenteditable="true"]');g&&g.focus();const E=f.getAttribute("data-block-id");E&&(ae(E),setTimeout(()=>{const O=f.getBoundingClientRect();B({x:O.left,y:O.bottom+8}),he(!0)},50)),ce(),$()}break;case"delete":k&&Se(k);break;case"moveup":k&&Te(k,"up");break;case"movedown":k&&Te(k,"down");break;case"addRow":{const f=d.closest(".cb-table-wrapper");f&&(I(),Ge(f),$());break}case"addCol":{const f=d.closest(".cb-table-wrapper");f&&(I(),kn(f),$());break}case"deleteRow":{const f=d.closest(".cb-table-wrapper");if(f){const g=Ze(f);if(g){const E=Qe(g);E&&(I(),Xe(f,E.row),$())}else{const E=f.querySelector("table"),O=E==null?void 0:E.querySelectorAll("tr");O&&O.length>1&&(I(),Xe(f,O.length-1),$())}}break}case"deleteCol":{const f=d.closest(".cb-table-wrapper");if(f){const g=Ze(f);if(g){const E=Qe(g);E&&(I(),Je(f,E.col),$())}else{const E=f.querySelector("table"),O=E==null?void 0:E.querySelector("tr"),j=O==null?void 0:O.querySelectorAll("th, td");j&&j.length>1&&(I(),Je(f,j.length-1),$())}}break}}},[Se,Te,I,$]),vo=p.useCallback(s=>{var k,f;if(r||oe)return;const h=s.target,d=h.closest(".cb-block"),b=d==null?void 0:d.getAttribute("data-block-id"),y=d==null?void 0:d.getAttribute("data-block-type");if(s.ctrlKey||s.metaKey)switch(s.key.toLowerCase()){case"b":s.preventDefault(),document.execCommand("bold"),$();return;case"i":s.preventDefault(),document.execCommand("italic"),$();return;case"u":s.preventDefault(),document.execCommand("underline"),$();return;case"s":s.preventDefault(),A&&A(P());return;case"z":s.preventDefault(),s.shiftKey?Ae():je();return;case"y":s.preventDefault(),Ae();return;case"1":case"2":case"3":if(b){s.preventDefault(),I();const g=parseInt(s.key),E=h.innerHTML,O=d;O.setAttribute("data-block-type","heading");const j=O.querySelector(".cb-block-content");if(j){j.innerHTML=`<h${g} class="cb-heading cb-h${g}" contenteditable="true">${E}</h${g}>`;const K=j.querySelector("[contenteditable]");K&&(K.focus(),xe(K))}$()}return}if(s.key==="Tab"&&y==="code"){s.preventDefault();const g=window.getSelection(),E=g==null?void 0:g.getRangeAt(0);if(E){const j=document.createTextNode(" ");E.insertNode(j),E.setStartAfter(j),E.setEndAfter(j),g==null||g.removeAllRanges(),g==null||g.addRange(E),$()}return}if(s.key==="Tab"&&y==="table"){s.preventDefault();const g=h.closest("td, th");if(!g)return;const E=g.parentElement,O=E.closest("table");if(!E||!O)return;const j=Array.from(E.querySelectorAll("th, td")),K=j.indexOf(g),Q=Array.from(O.querySelectorAll("tr")),X=Q.indexOf(E);let G=null;if(s.shiftKey){if(K>0)G=j[K-1];else if(X>0){const V=Q[X-1].querySelectorAll("th, td");G=V[V.length-1]}}else if(K<j.length-1)G=j[K+1];else if(X<Q.length-1)G=Q[X+1].querySelectorAll("th, td")[0];else{const re=h.closest(".cb-table-wrapper");if(re){I(),Ge(re);const V=O.querySelector("tr:last-child"),Ee=V==null?void 0:V.querySelectorAll("td");G=Ee==null?void 0:Ee[0],$()}}if(G){G.focus();const re=document.createRange();re.selectNodeContents(G);const V=window.getSelection();V==null||V.removeAllRanges(),V==null||V.addRange(re)}return}if(s.key==="Enter"&&!s.shiftKey){if(y==="code")return;if(y==="bulletList"||y==="numberedList"||y==="checkList"){const g=h.closest("li");if(!g)return;const E=y==="checkList"?g.querySelector(".cb-checklist-content"):g;if((((k=E==null?void 0:E.textContent)==null?void 0:k.trim())||"")===""){s.preventDefault(),I();const G=g.closest("ul, ol");if((f=g.parentElement)==null?void 0:f.classList.contains("cb-nested-list")){const V=g.parentElement,Ee=V.parentElement,Ut=Ee.parentElement;if(Ut){Ut.insertBefore(g,Ee.nextSibling),V.children.length===0&&V.remove();const Vt=y==="checkList"?g.querySelector(".cb-checklist-content"):g;Vt&&Vt.focus()}}else{const V=G==null?void 0:G.querySelectorAll(":scope > li");V&&V.length===1?b&&me(b,"paragraph"):(g.remove(),pe("paragraph",b||void 0))}$();return}s.preventDefault(),I();const j=window.getSelection(),K=j==null?void 0:j.getRangeAt(0);let Q="";if(K&&E){const G=document.createRange();G.setStart(K.endContainer,K.endOffset),G.setEndAfter(E.lastChild||E);const re=G.extractContents(),V=document.createElement("div");V.appendChild(re),Q=V.innerHTML}const X=document.createElement("li");if(X.className="cb-list-item",X.setAttribute("data-item-id",F()),y==="checkList"){const G=document.createElement("div");G.className="cb-checklist-wrapper";const re=document.createElement("input");re.type="checkbox",re.className="cb-checkbox",re.setAttribute("tabindex","-1");const V=document.createElement("span");V.className="cb-checklist-content",V.setAttribute("contenteditable","true"),V.innerHTML=Q,G.appendChild(re),G.appendChild(V),X.appendChild(G),g.after(X),V.focus(),be(V)}else X.setAttribute("contenteditable","true"),X.innerHTML=Q,g.after(X),X.focus(),be(X);$();return}s.preventDefault(),I(),pe("paragraph",b||void 0);return}if(s.key==="Backspace"&&De(h)){if(y&&y!=="paragraph"&&y!=="divider"){s.preventDefault(),b&&me(b,"paragraph");return}const g=d==null?void 0:d.previousElementSibling;if(g&&g.classList.contains("cb-block")){const E=g.getAttribute("data-block-type");if(E!=="divider"&&E!=="image"&&E!=="video"){s.preventDefault(),I();const O=g.querySelector('[contenteditable="true"]'),j=h.innerHTML;O&&j&&(O.innerHTML+=j),O&&(xe(O),O.focus()),b&&Se(b)}}return}if(s.key==="/"&&De(h)&&h.textContent===""){s.preventDefault();const g=d.getBoundingClientRect();B({x:g.left,y:g.bottom+8}),he(!0),b&&ae(b);return}if(s.key==="ArrowUp"&&De(h)){const g=d==null?void 0:d.previousElementSibling;if(g&&g.classList.contains("cb-block")){s.preventDefault();const E=g.querySelector('[contenteditable="true"]');E&&(E.focus(),xe(E))}return}if(s.key==="ArrowDown"&&An(h)){const g=d==null?void 0:d.nextElementSibling;if(g&&g.classList.contains("cb-block")){s.preventDefault();const E=g.querySelector('[contenteditable="true"]');E&&(E.focus(),be(E))}return}},[r,I,pe,Se,me,je,Ae,A,P,$]),xo=p.useCallback(()=>{ce(),$()},[ce,$]),wo=p.useCallback(s=>{if(r)return;s.preventDefault(),I();const h=Sn(s.clipboardData);document.execCommand("insertHTML",!1,h),ce(),$()},[r,I,ce,$]),Co=p.useCallback(s=>{const h=s.target.closest(".cb-block"),d=h==null?void 0:h.getAttribute("data-block-id");ae(d),H&&H()},[H]),So=p.useCallback(s=>{var h;(h=ee.current)!=null&&h.contains(s.relatedTarget)||(ae(null),U&&U())},[U]),Eo=p.useCallback((s,h)=>{var d,b;if(he(!1),ie){const y=(d=T.current)==null?void 0:d.querySelector(`[data-block-id="${ie}"]`),k=y==null?void 0:y.querySelector('[contenteditable="true"]');k&&((b=k.textContent)==null?void 0:b.trim())===""?s==="heading"&&(h!=null&&h.level)?me(ie,s,h):me(ie,s):pe(s,ie,h)}else pe(s,void 0,h)},[ie,me,pe]),Mo=p.useCallback(s=>{const h=s.target.closest(".cb-block"),d=h==null?void 0:h.getAttribute("data-block-id");v(d)},[]),Lo=p.useCallback(()=>{v(null)},[]),Ao=[`${i}-editor`,m?`${i}-dark`:`${i}-light`,r?`${i}-readonly`:"",a].filter(Boolean).join(" ");return l.jsxs("div",{ref:ee,className:Ao,style:u,"data-editor-root":!0,children:[w&&x==="top"&&ue&&l.jsx(nt,{editor:ue,darkMode:m}),l.jsx("div",{ref:T,className:`${i}-content`,onClick:ko,onKeyDown:vo,onInput:xo,onPaste:wo,onFocus:Co,onBlur:So,onMouseOver:Mo,onMouseOut:Lo,"data-placeholder":c,spellCheck:L,role:"textbox","aria-multiline":"true","aria-label":"Content editor"}),w&&x==="bottom"&&ue&&l.jsx(nt,{editor:ue,darkMode:m}),oe&&ue&&l.jsx(bo,{editor:ue,position:S,onSelect:Eo,onClose:()=>he(!1)}),l.jsx(mo,{wordCount:z.wordCount,charCount:z.charCount,readingTime:go(z.wordCount),darkMode:m})]})},Nr=p.forwardRef(Tr);function Br(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Hr(e,t){if(!e)return"";const o=new DOMParser().parseFromString(e,"text/html");return t.enableHeadingIds&&o.querySelectorAll("h1, h2, h3, h4, h5, h6").forEach((r,i)=>{r.id||(r.id=`heading-${i}`)}),t.enableCodeCopy&&o.querySelectorAll("pre").forEach((r,i)=>{var x;if((x=r.parentElement)!=null&&x.classList.contains("cbr-code-wrapper"))return;const a=r.querySelector("code"),u=(a==null?void 0:a.textContent)||r.textContent||"",w=o.createElement("div");w.className="cbr-code-wrapper",w.innerHTML=`
|
|
664
674
|
<div class="cbr-code-toolbar">
|
|
665
675
|
<span class="cbr-code-lang">Code</span>
|
|
666
676
|
<button class="cbr-code-copy" data-code-index="${i}" onclick="
|
|
@@ -669,8 +679,8 @@ ${B}
|
|
|
669
679
|
setTimeout(() => this.textContent = 'Copy', 2000);
|
|
670
680
|
">Copy</button>
|
|
671
681
|
</div>
|
|
672
|
-
<pre class="cbr-code-block"><code>${
|
|
673
|
-
`,r.replaceWith(w)}),t.enableChecklistStyles&&o.querySelectorAll("li").forEach(r=>{const i=r.querySelector('input[type="checkbox"]');i&&i.checked&&r.classList.add("cbr-checked-item")}),o.querySelectorAll(".cb-image-controls, .cb-image-placeholder, .cb-video-placeholder, .cb-callout-type-selector, .cb-image-resize-handle").forEach(c=>c.remove()),o.body.innerHTML}function
|
|
682
|
+
<pre class="cbr-code-block"><code>${Br(u)}</code></pre>
|
|
683
|
+
`,r.replaceWith(w)}),t.enableChecklistStyles&&o.querySelectorAll("li").forEach(r=>{const i=r.querySelector('input[type="checkbox"]');i&&i.checked&&r.classList.add("cbr-checked-item")}),o.querySelectorAll(".cb-image-controls, .cb-image-placeholder, .cb-video-placeholder, .cb-callout-type-selector, .cb-image-resize-handle").forEach(c=>c.remove()),o.body.innerHTML}function qr(e,t){const n=t,o=e?{bgSecondary:"#111827",bgTertiary:"#374151",text:"#f9fafb",textSecondary:"#d1d5db",textMuted:"#9ca3af",border:"#374151",borderLight:"#4b5563",primary:"#3b82f6",link:"#60a5fa",code:"#f472b6",codeBg:"rgba(255, 255, 255, 0.1)",quoteBg:"rgba(59, 130, 246, 0.1)",calloutInfo:"rgba(59, 130, 246, 0.1)",calloutInfoBorder:"rgba(59, 130, 246, 0.3)",calloutSuccess:"rgba(16, 185, 129, 0.1)",calloutSuccessBorder:"rgba(16, 185, 129, 0.3)",calloutWarning:"rgba(245, 158, 11, 0.1)",calloutWarningBorder:"rgba(245, 158, 11, 0.3)",calloutError:"rgba(239, 68, 68, 0.1)",calloutErrorBorder:"rgba(239, 68, 68, 0.3)",tableBg:"#374151"}:{bgSecondary:"#f9fafb",bgTertiary:"#f3f4f6",text:"#111827",textSecondary:"#4b5563",textMuted:"#6b7280",border:"#e5e7eb",borderLight:"#d1d5db",primary:"#3b82f6",link:"#2563eb",code:"#d63384",codeBg:"#f3f4f6",quoteBg:"#eff6ff",calloutInfo:"#eff6ff",calloutInfoBorder:"#bfdbfe",calloutSuccess:"#f0fdf4",calloutSuccessBorder:"#bbf7d0",calloutWarning:"#fffbeb",calloutWarningBorder:"#fde68a",calloutError:"#fef2f2",calloutErrorBorder:"#fecaca",tableBg:"#f9fafb"};return`
|
|
674
684
|
.${n} {
|
|
675
685
|
font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
|
676
686
|
line-height: 1.7;
|
|
@@ -874,7 +884,7 @@ ${B}
|
|
|
874
884
|
.${n} [style*="text-align: right"], .${n} [data-align="right"] { text-align: right; }
|
|
875
885
|
.${n} [style*="text-align: left"], .${n} [data-align="left"] { text-align: left; }
|
|
876
886
|
.${n} [style*="text-align: justify"], .${n} [data-align="justify"] { text-align: justify; }
|
|
877
|
-
`}const $r=({html:e,darkMode:t=!1,className:n="",style:o,enableCodeCopy:c=!0,enableChecklistStyles:r=!0,enableHeadingIds:i=!0,classPrefix:a="cbr-content"})=>{const
|
|
887
|
+
`}const $r=({html:e,darkMode:t=!1,className:n="",style:o,enableCodeCopy:c=!0,enableChecklistStyles:r=!0,enableHeadingIds:i=!0,classPrefix:a="cbr-content"})=>{const u=p.useMemo(()=>Hr(e,{enableCodeCopy:c,enableChecklistStyles:r,enableHeadingIds:i}),[e,c,r,i]),w=p.useMemo(()=>qr(t,a),[t,a]);return e?l.jsxs("div",{className:`${a} ${n}`.trim(),style:o,children:[l.jsx("style",{children:w}),l.jsx("div",{dangerouslySetInnerHTML:{__html:u}})]}):l.jsxs("div",{className:`${a} ${n}`.trim(),style:o,children:[l.jsx("style",{children:w}),l.jsx("p",{style:{color:t?"#64748b":"#9ca3af"},children:"No content to display"})]})};function fo(e,t,n){if(!e)return[];const c=new DOMParser().parseFromString(e,"text/html"),r=[];for(let w=t;w<=n;w++)r.push(`h${w}`);const i=c.querySelectorAll(r.join(", ")),a=[],u=[];return i.forEach((w,x)=>{var A;const m=parseInt(w.tagName.charAt(1)),N=((A=w.textContent)==null?void 0:A.trim())||"";if(!N)return;const C={id:w.id||`heading-${x}`,text:N,level:m,children:[]};for(;u.length>0&&u[u.length-1].level>=m;)u.pop();u.length===0?a.push(C):u[u.length-1].item.children.push(C),u.push({level:m,item:C})}),a}function jr(e){const t=e?{bgHover:"#334155",text:"#94a3b8",textHover:"#f1f5f9",border:"#334155",title:"#64748b"}:{bgHover:"#f1f5f9",text:"#64748b",textHover:"#0f172a",border:"#e2e8f0",title:"#94a3b8"};return`
|
|
878
888
|
.cbtoc {
|
|
879
889
|
font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
|
880
890
|
}
|
|
@@ -956,5 +966,5 @@ ${B}
|
|
|
956
966
|
.cbtoc-content-expanded {
|
|
957
967
|
max-height: 2000px;
|
|
958
968
|
}
|
|
959
|
-
`}const ot=({items:e,depth:t,onNavigate:n})=>e.length===0?null:l.jsx("ul",{className:`cbtoc-list ${t>0?"cbtoc-list-nested":""}`,children:e.map(o=>l.jsxs("li",{className:"cbtoc-item",children:[l.jsx("button",{className:`cbtoc-link cbtoc-link-h${o.level}`,onClick:()=>n(o.id,o),title:o.text,children:o.text}),o.children.length>0&&l.jsx(ot,{items:o.children,depth:t+1,onNavigate:n})]},o.id))}),qr=({html:e,darkMode:t=!1,className:n="",style:o,title:c="Table of Contents",minLevel:r=1,maxLevel:i=6,onNavigate:a,smoothScroll:d=!0,targetContainer:w=null,collapsible:x=!1,defaultCollapsed:m=!1})=>{const[T,A]=h.useState(m),C=h.useMemo(()=>mo(e,r,i),[e,r,i]),M=h.useMemo(()=>Hr(t),[t]),$=h.useCallback((D,ee)=>{if(a){a(D,ee);return}let N=null;if(w){const le=typeof w=="string"?document.querySelector(w):w;N=le==null?void 0:le.querySelector(`#${D}`)}else N=document.getElementById(D);N&&N.scrollIntoView({behavior:d?"smooth":"auto",block:"start"})},[a,d,w]),U=h.useCallback(()=>{A(D=>!D)},[]);return C.length===0?l.jsxs("nav",{className:`cbtoc ${n}`.trim(),style:o,children:[l.jsx("style",{children:M}),c&&l.jsx("h3",{className:"cbtoc-title",children:c}),l.jsx("p",{className:"cbtoc-empty",children:"No headings found"})]}):x?l.jsxs("nav",{className:`cbtoc ${n}`.trim(),style:o,children:[l.jsx("style",{children:M}),l.jsxs("button",{className:"cbtoc-toggle",onClick:U,children:[l.jsx("span",{className:"cbtoc-title",style:{margin:0},children:c}),l.jsx("svg",{className:`cbtoc-toggle-icon ${T?"cbtoc-toggle-icon-collapsed":""}`,width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:l.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),l.jsx("div",{className:`cbtoc-content ${T?"cbtoc-content-collapsed":"cbtoc-content-expanded"}`,children:l.jsx("div",{style:{padding:"0.5rem"},children:l.jsx(ot,{items:C,depth:0,onNavigate:$})})})]}):l.jsxs("nav",{className:`cbtoc ${n}`.trim(),style:o,children:[l.jsx("style",{children:M}),c&&l.jsx("h3",{className:"cbtoc-title",children:c}),l.jsx(ot,{items:C,depth:0,onNavigate:$})]})},jr=({children:e,blockId:t,blockType:n,isActive:o=!1,onAddBlock:c,onDeleteBlock:r,onDuplicateBlock:i,onMoveUp:a,onMoveDown:d,onDragStart:w,className:x=""})=>{const[m,T]=h.useState(!1),A=h.useCallback(M=>{M.preventDefault(),M.stopPropagation(),T(!m)},[m]),C=h.useCallback(M=>$=>{$.preventDefault(),$.stopPropagation(),T(!1),M&&M()},[]);return l.jsxs("div",{className:`cb-block-wrapper ${o?"cb-block-wrapper-active":""} ${x}`,"data-block-wrapper":t,children:[l.jsxs("div",{className:"cb-block-controls cb-block-controls-left",children:[l.jsx("button",{type:"button",className:"cb-block-btn cb-block-add",onClick:C(()=>c==null?void 0:c("before")),title:"Add block above",tabIndex:-1,children:l.jsx(Kn,{size:14})}),l.jsx("button",{type:"button",className:"cb-block-btn cb-block-drag","data-drag-handle":!0,draggable:!0,onDragStart:w,title:"Drag to reorder",tabIndex:-1,children:l.jsx(On,{size:14})})]}),l.jsx("div",{className:"cb-block-content",children:e}),l.jsx("div",{className:"cb-block-controls cb-block-controls-right",children:l.jsxs("div",{className:"cb-block-menu-container",children:[l.jsx("button",{type:"button",className:"cb-block-btn cb-block-more",onClick:A,title:"More options",tabIndex:-1,children:l.jsx(Vn,{size:14})}),m&&l.jsxs("div",{className:"cb-block-dropdown",children:[l.jsxs("button",{type:"button",className:"cb-block-dropdown-item",onClick:C(i),children:[l.jsx(Dn,{size:14}),l.jsx("span",{children:"Duplicate"})]}),l.jsxs("button",{type:"button",className:"cb-block-dropdown-item",onClick:C(a),children:[l.jsx(_n,{size:14}),l.jsx("span",{children:"Move up"})]}),l.jsxs("button",{type:"button",className:"cb-block-dropdown-item",onClick:C(d),children:[l.jsx(Wn,{size:14}),l.jsx("span",{children:"Move down"})]}),l.jsx("div",{className:"cb-block-dropdown-divider"}),l.jsxs("button",{type:"button",className:"cb-block-dropdown-item cb-block-dropdown-item-danger",onClick:C(r),children:[l.jsx(Tt,{size:14}),l.jsx("span",{children:"Delete"})]})]})]})})]})},Rr=({metadata:e={},onChange:t,className:n=""})=>{const[o,c]=h.useState(e),[r,i]=h.useState("");h.useEffect(()=>{c(e)},[e]);const a=h.useCallback((x,m)=>{const T={...o,[x]:m};c(T),t&&t(T)},[o,t]),d=h.useCallback(x=>{if(x.key==="Enter"&&r.trim()){x.preventDefault();const m=o.tags||[],T=r.trim().toLowerCase();if(!m.includes(T)){const A={...o,tags:[...m,T]};c(A),t&&t(A)}i("")}},[o,r,t]),w=h.useCallback(x=>{const m={...o,tags:(o.tags||[]).filter(T=>T!==x)};c(m),t&&t(m)},[o,t]);return l.jsxs("div",{className:`cb-metadata-panel ${n}`,children:[l.jsxs("div",{className:"cb-metadata-header",children:[l.jsx(Le,{size:20}),l.jsx("h3",{children:"Post Metadata"})]}),l.jsxs("div",{className:"cb-metadata-content",children:[l.jsxs("div",{className:"cb-metadata-field",children:[l.jsxs("label",{htmlFor:"meta-title",className:"cb-metadata-label",children:[l.jsx(Le,{size:16}),l.jsx("span",{children:"Title"})]}),l.jsx("input",{id:"meta-title",type:"text",className:"cb-metadata-input",placeholder:"Enter post title...",value:o.title||"",onChange:x=>a("title",x.target.value)}),l.jsxs("span",{className:"cb-metadata-hint",children:[(o.title||"").length,"/60 characters"]})]}),l.jsxs("div",{className:"cb-metadata-field",children:[l.jsxs("label",{htmlFor:"meta-description",className:"cb-metadata-label",children:[l.jsx(Le,{size:16}),l.jsx("span",{children:"Description"})]}),l.jsx("textarea",{id:"meta-description",className:"cb-metadata-textarea",placeholder:"Brief description for SEO and social media...",rows:3,value:o.description||"",onChange:x=>a("description",x.target.value)}),l.jsxs("span",{className:"cb-metadata-hint",children:[(o.description||"").length,"/160 characters"]})]}),l.jsxs("div",{className:"cb-metadata-field",children:[l.jsxs("label",{htmlFor:"meta-slug",className:"cb-metadata-label",children:[l.jsx($e,{size:16}),l.jsx("span",{children:"URL Slug"})]}),l.jsx("input",{id:"meta-slug",type:"text",className:"cb-metadata-input",placeholder:"url-friendly-slug",value:o.slug||"",onChange:x=>a("slug",x.target.value)}),l.jsx("span",{className:"cb-metadata-hint",children:"Used in the post URL"})]}),l.jsxs("div",{className:"cb-metadata-field",children:[l.jsxs("label",{htmlFor:"meta-tags",className:"cb-metadata-label",children:[l.jsx(vr,{size:16}),l.jsx("span",{children:"Tags"})]}),o.tags&&o.tags.length>0&&l.jsx("div",{className:"cb-metadata-tags",children:o.tags.map(x=>l.jsxs("span",{className:"cb-metadata-tag",children:[x,l.jsx("button",{type:"button",onClick:()=>w(x),className:"cb-metadata-tag-remove","aria-label":`Remove ${x}`,children:l.jsx(Ae,{size:14})})]},x))}),l.jsx("input",{id:"meta-tags",type:"text",className:"cb-metadata-input",placeholder:"Type a tag and press Enter...",value:r,onChange:x=>i(x.target.value),onKeyDown:d})]}),l.jsxs("div",{className:"cb-metadata-field",children:[l.jsxs("label",{htmlFor:"meta-cover",className:"cb-metadata-label",children:[l.jsx(Oe,{size:16}),l.jsx("span",{children:"Cover Image URL"})]}),l.jsx("input",{id:"meta-cover",type:"url",className:"cb-metadata-input",placeholder:"https://example.com/image.jpg",value:o.coverImage||"",onChange:x=>a("coverImage",x.target.value)}),o.coverImage&&l.jsx("div",{className:"cb-metadata-preview",children:l.jsx("img",{src:o.coverImage,alt:"Cover preview",onError:x=>{x.target.style.display="none"}})})]}),l.jsxs("div",{className:"cb-metadata-field",children:[l.jsxs("label",{htmlFor:"meta-author",className:"cb-metadata-label",children:[l.jsx(Le,{size:16}),l.jsx("span",{children:"Author"})]}),l.jsx("input",{id:"meta-author",type:"text",className:"cb-metadata-input",placeholder:"Author name",value:o.author||"",onChange:x=>a("author",x.target.value)})]}),l.jsxs("div",{className:"cb-metadata-field",children:[l.jsxs("label",{htmlFor:"meta-date",className:"cb-metadata-label",children:[l.jsx(Rn,{size:16}),l.jsx("span",{children:"Publish Date"})]}),l.jsx("input",{id:"meta-date",type:"datetime-local",className:"cb-metadata-input",value:o.publishDate||"",onChange:x=>a("publishDate",x.target.value)})]}),l.jsxs("div",{className:"cb-metadata-field",children:[l.jsxs("label",{htmlFor:"meta-canonical",className:"cb-metadata-label",children:[l.jsx($e,{size:16}),l.jsx("span",{children:"Canonical URL"})]}),l.jsx("input",{id:"meta-canonical",type:"url",className:"cb-metadata-input",placeholder:"https://example.com/original-post",value:o.canonicalUrl||"",onChange:x=>a("canonicalUrl",x.target.value)}),l.jsx("span",{className:"cb-metadata-hint",children:"For cross-posted or syndicated content"})]})]})]})},fo={paragraph:Fe,heading1:xt,heading2:wt,heading3:Ct,heading4:cr,heading5:rr,heading6:lr,list:Et,listOrdered:St,checkList:kt,quote:At,code:vt,image:Oe,video:Nt,divider:Lt,callout:yt,accordion:tt,table:Mt,bold:jn,italic:Un,underline:Zn,strikethrough:Xn,link:$e,unlink:sr,highlight:Fn,textColor:Yn,alignLeft:Hn,alignCenter:$n,alignRight:qn,alignJustify:Gc,undo:Jn,redo:Gn,copy:Dn,cut:mr,paste:Qc,delete:Tt,plus:Kn,drag:On,more:Vn,chevronUp:Jc,chevronDown:tt,moveUp:_n,moveDown:Wn,maximize:dr,close:Ae,check:Zc,search:fr,settings:yr,sun:kr,moon:ur,document:Le,codeFile:Pn,download:In,upload:xr,externalLink:nr,info:ar,warning:Kc,error:wr,success:Xc,file:or,indent:ir,outdent:pr,clear:br,columns:tr,rows:gr,eraser:zn};function Dr(e){return fo[e]||Fe}exports.BlockMenu=ho;exports.BlockRegistry=on;exports.BlockWrapper=jr;exports.ContentBlocksEditor=Mr;exports.ContentBlocksRenderer=$r;exports.EventEmitter=tc;exports.LANGUAGES=dn;exports.MetadataPanel=Rr;exports.StatusBar=go;exports.TableOfContents=qr;exports.Toolbar=nt;exports.accordionBlock=fn;exports.addCalloutTitle=gc;exports.addCitation=ac;exports.addListItem=oc;exports.addTableColumn=kn;exports.addTableRow=Ge;exports.allBlocks=ft;exports.blockMap=xn;exports.blockRegistry=de;exports.bulletListBlock=st;exports.calculateReadingTime=bo;exports.calloutBlock=mn;exports.cancelFrame=Qo;exports.checkListBlock=sn;exports.clearFormatting=Pt;exports.codeBlock=pt;exports.collapseToEnd=Uc;exports.collapseToStart=Fc;exports.convertPlainTextToHtml=En;exports.countCharacters=Zt;exports.countWords=Xt;exports.createCommandExecutor=Cr;exports.createDragHandle=Hc;exports.createElement=Ko;exports.createHeading=nc;exports.createImageFromFile=hn;exports.debounce=Gt;exports.deepClone=_e;exports.defaultBlocks=xc;exports.deleteBlock=oo;exports.deleteTableColumn=Ze;exports.deleteTableRow=Xe;exports.dividerBlock=bt;exports.duplicateBlock=lo;exports.escapeHtml=Fo;exports.findElementsInSelection=Bn;exports.generateHeadingId=Po;exports.generateId=F;exports.getBlockDefinition=wc;exports.getBlockFromChild=ye;exports.getCellPosition=Qe;exports.getCode=uc;exports.getComputedStyleValue=Zo;exports.getCursorOffset=Wc;exports.getElementIndex=Wo;exports.getEmbedUrl=Ie;exports.getFocusedCell=Je;exports.getIcon=Dr;exports.getSelectedHtml=Ic;exports.getSelectedText=Dc;exports.getSelectionRange=Jt;exports.getSelectionState=An;exports.getTextContent=Ho;exports.heading1Block=rt;exports.heading2Block=lt;exports.heading3Block=it;exports.heading4Block=cn;exports.heading5Block=rn;exports.heading6Block=ln;exports.iconMap=fo;exports.imageBlock=ht;exports.indentBlock=uo;exports.indentListItem=lc;exports.initDragDrop=Ln;exports.insertAfter=Pe;exports.insertBefore=nn;exports.insertBlock=no;exports.insertLink=Rt;exports.isBlockElement=$o;exports.isCursorAtEnd=Mn;exports.isCursorAtStart=De;exports.isDragDropSupported=qc;exports.isElementEmpty=zo;exports.isFormatActive=eo;exports.isMobile=Go;exports.isMultiBlockSelection=Pc;exports.isSelectionCollapsed=qo;exports.isSelectionInElement=zc;exports.isTouchDevice=Xo;exports.linkPreviewBlock=vn;exports.matchesKeyCombo=Yo;exports.mergeBlocks=ao;exports.moveBlockDown=ro;exports.moveBlockUp=co;exports.moveCursorToEnd=xe;exports.moveCursorToStart=be;exports.nextFrame=Jo;exports.normalizeHtml=Bc;exports.numberedListBlock=dt;exports.outdentBlock=po;exports.outdentListItem=ic;exports.paragraphBlock=ct;exports.parseHeadings=mo;exports.parseHtml=Uo;exports.placeCursorAtEnd=Do;exports.placeCursorAtStart=Io;exports.quoteBlock=ut;exports.removeCitation=sc;exports.removeLink=Dt;exports.removeListItem=cc;exports.resetHeadingIds=Oo;exports.restoreSelection=Ro;exports.restoreSelectionState=Rc;exports.sanitizeHtml=Cn;exports.sanitizePaste=Sn;exports.saveSelection=jo;exports.saveSelectionState=jc;exports.selectAllInElement=Oc;exports.serializeElement=Vo;exports.setAccordionOpen=fc;exports.setAlignment=fe;exports.setCalloutType=gt;exports.setCellAlignment=yc;exports.setCursorPosition=Vc;exports.setDividerStyle=bc;exports.setHighlightColor=zt;exports.setImageAlign=pn;exports.setImageSrc=Ke;exports.setLanguage=dc;exports.setSelectionRange=Qt;exports.setTextColor=It;exports.setVideoSrc=gn;exports.slugify=tn;exports.splitBlock=so;exports.storage=ec;exports.stripHtml=en;exports.swapElements=_o;exports.tableBlock=yn;exports.throttle=Bo;exports.toggleAccordion=mc;exports.toggleBold=Bt;exports.toggleChecklistItem=rc;exports.toggleFormat=to;exports.toggleInlineCode=jt;exports.toggleItalic=$t;exports.toggleStrikethrough=qt;exports.toggleUnderline=Ht;exports.transformBlock=io;exports.unwrapElement=Nn;exports.videoBlock=bn;exports.wrapSelection=Tn;
|
|
969
|
+
`}const ot=({items:e,depth:t,onNavigate:n})=>e.length===0?null:l.jsx("ul",{className:`cbtoc-list ${t>0?"cbtoc-list-nested":""}`,children:e.map(o=>l.jsxs("li",{className:"cbtoc-item",children:[l.jsx("button",{className:`cbtoc-link cbtoc-link-h${o.level}`,onClick:()=>n(o.id,o),title:o.text,children:o.text}),o.children.length>0&&l.jsx(ot,{items:o.children,depth:t+1,onNavigate:n})]},o.id))}),Rr=({html:e,darkMode:t=!1,className:n="",style:o,title:c="Table of Contents",minLevel:r=1,maxLevel:i=6,onNavigate:a,smoothScroll:u=!0,targetContainer:w=null,collapsible:x=!1,defaultCollapsed:m=!1})=>{const[N,L]=p.useState(m),C=p.useMemo(()=>fo(e,r,i),[e,r,i]),A=p.useMemo(()=>jr(t),[t]),H=p.useCallback((D,ee)=>{if(a){a(D,ee);return}let T=null;if(w){const le=typeof w=="string"?document.querySelector(w):w;T=le==null?void 0:le.querySelector(`#${D}`)}else T=document.getElementById(D);T&&T.scrollIntoView({behavior:u?"smooth":"auto",block:"start"})},[a,u,w]),U=p.useCallback(()=>{L(D=>!D)},[]);return C.length===0?l.jsxs("nav",{className:`cbtoc ${n}`.trim(),style:o,children:[l.jsx("style",{children:A}),c&&l.jsx("h3",{className:"cbtoc-title",children:c}),l.jsx("p",{className:"cbtoc-empty",children:"No headings found"})]}):x?l.jsxs("nav",{className:`cbtoc ${n}`.trim(),style:o,children:[l.jsx("style",{children:A}),l.jsxs("button",{className:"cbtoc-toggle",onClick:U,children:[l.jsx("span",{className:"cbtoc-title",style:{margin:0},children:c}),l.jsx("svg",{className:`cbtoc-toggle-icon ${N?"cbtoc-toggle-icon-collapsed":""}`,width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:l.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),l.jsx("div",{className:`cbtoc-content ${N?"cbtoc-content-collapsed":"cbtoc-content-expanded"}`,children:l.jsx("div",{style:{padding:"0.5rem"},children:l.jsx(ot,{items:C,depth:0,onNavigate:H})})})]}):l.jsxs("nav",{className:`cbtoc ${n}`.trim(),style:o,children:[l.jsx("style",{children:A}),c&&l.jsx("h3",{className:"cbtoc-title",children:c}),l.jsx(ot,{items:C,depth:0,onNavigate:H})]})},Dr=({children:e,blockId:t,blockType:n,isActive:o=!1,onAddBlock:c,onDeleteBlock:r,onDuplicateBlock:i,onMoveUp:a,onMoveDown:u,onDragStart:w,className:x=""})=>{const[m,N]=p.useState(!1),L=p.useCallback(A=>{A.preventDefault(),A.stopPropagation(),N(!m)},[m]),C=p.useCallback(A=>H=>{H.preventDefault(),H.stopPropagation(),N(!1),A&&A()},[]);return l.jsxs("div",{className:`cb-block-wrapper ${o?"cb-block-wrapper-active":""} ${x}`,"data-block-wrapper":t,children:[l.jsxs("div",{className:"cb-block-controls cb-block-controls-left",children:[l.jsx("button",{type:"button",className:"cb-block-btn cb-block-add",onClick:C(()=>c==null?void 0:c("before")),title:"Add block above",tabIndex:-1,children:l.jsx(Gn,{size:14})}),l.jsx("button",{type:"button",className:"cb-block-btn cb-block-drag","data-drag-handle":!0,draggable:!0,onDragStart:w,title:"Drag to reorder",tabIndex:-1,children:l.jsx(Un,{size:14})})]}),l.jsx("div",{className:"cb-block-content",children:e}),l.jsx("div",{className:"cb-block-controls cb-block-controls-right",children:l.jsxs("div",{className:"cb-block-menu-container",children:[l.jsx("button",{type:"button",className:"cb-block-btn cb-block-more",onClick:L,title:"More options",tabIndex:-1,children:l.jsx(Pn,{size:14})}),m&&l.jsxs("div",{className:"cb-block-dropdown",children:[l.jsxs("button",{type:"button",className:"cb-block-dropdown-item",onClick:C(i),children:[l.jsx(In,{size:14}),l.jsx("span",{children:"Duplicate"})]}),l.jsxs("button",{type:"button",className:"cb-block-dropdown-item",onClick:C(a),children:[l.jsx(Yn,{size:14}),l.jsx("span",{children:"Move up"})]}),l.jsxs("button",{type:"button",className:"cb-block-dropdown-item",onClick:C(u),children:[l.jsx(_n,{size:14}),l.jsx("span",{children:"Move down"})]}),l.jsx("div",{className:"cb-block-dropdown-divider"}),l.jsxs("button",{type:"button",className:"cb-block-dropdown-item cb-block-dropdown-item-danger",onClick:C(r),children:[l.jsx(Tt,{size:14}),l.jsx("span",{children:"Delete"})]})]})]})})]})},Ir=({metadata:e={},onChange:t,className:n=""})=>{const[o,c]=p.useState(e),[r,i]=p.useState("");p.useEffect(()=>{c(e)},[e]);const a=p.useCallback((x,m)=>{const N={...o,[x]:m};c(N),t&&t(N)},[o,t]),u=p.useCallback(x=>{if(x.key==="Enter"&&r.trim()){x.preventDefault();const m=o.tags||[],N=r.trim().toLowerCase();if(!m.includes(N)){const L={...o,tags:[...m,N]};c(L),t&&t(L)}i("")}},[o,r,t]),w=p.useCallback(x=>{const m={...o,tags:(o.tags||[]).filter(N=>N!==x)};c(m),t&&t(m)},[o,t]);return l.jsxs("div",{className:`cb-metadata-panel ${n}`,children:[l.jsxs("div",{className:"cb-metadata-header",children:[l.jsx(Me,{size:20}),l.jsx("h3",{children:"Post Metadata"})]}),l.jsxs("div",{className:"cb-metadata-content",children:[l.jsxs("div",{className:"cb-metadata-field",children:[l.jsxs("label",{htmlFor:"meta-title",className:"cb-metadata-label",children:[l.jsx(Me,{size:16}),l.jsx("span",{children:"Title"})]}),l.jsx("input",{id:"meta-title",type:"text",className:"cb-metadata-input",placeholder:"Enter post title...",value:o.title||"",onChange:x=>a("title",x.target.value)}),l.jsxs("span",{className:"cb-metadata-hint",children:[(o.title||"").length,"/60 characters"]})]}),l.jsxs("div",{className:"cb-metadata-field",children:[l.jsxs("label",{htmlFor:"meta-description",className:"cb-metadata-label",children:[l.jsx(Me,{size:16}),l.jsx("span",{children:"Description"})]}),l.jsx("textarea",{id:"meta-description",className:"cb-metadata-textarea",placeholder:"Brief description for SEO and social media...",rows:3,value:o.description||"",onChange:x=>a("description",x.target.value)}),l.jsxs("span",{className:"cb-metadata-hint",children:[(o.description||"").length,"/160 characters"]})]}),l.jsxs("div",{className:"cb-metadata-field",children:[l.jsxs("label",{htmlFor:"meta-slug",className:"cb-metadata-label",children:[l.jsx(He,{size:16}),l.jsx("span",{children:"URL Slug"})]}),l.jsx("input",{id:"meta-slug",type:"text",className:"cb-metadata-input",placeholder:"url-friendly-slug",value:o.slug||"",onChange:x=>a("slug",x.target.value)}),l.jsx("span",{className:"cb-metadata-hint",children:"Used in the post URL"})]}),l.jsxs("div",{className:"cb-metadata-field",children:[l.jsxs("label",{htmlFor:"meta-tags",className:"cb-metadata-label",children:[l.jsx(wr,{size:16}),l.jsx("span",{children:"Tags"})]}),o.tags&&o.tags.length>0&&l.jsx("div",{className:"cb-metadata-tags",children:o.tags.map(x=>l.jsxs("span",{className:"cb-metadata-tag",children:[x,l.jsx("button",{type:"button",onClick:()=>w(x),className:"cb-metadata-tag-remove","aria-label":`Remove ${x}`,children:l.jsx(Le,{size:14})})]},x))}),l.jsx("input",{id:"meta-tags",type:"text",className:"cb-metadata-input",placeholder:"Type a tag and press Enter...",value:r,onChange:x=>i(x.target.value),onKeyDown:u})]}),l.jsxs("div",{className:"cb-metadata-field",children:[l.jsxs("label",{htmlFor:"meta-cover",className:"cb-metadata-label",children:[l.jsx(Oe,{size:16}),l.jsx("span",{children:"Cover Image URL"})]}),l.jsx("input",{id:"meta-cover",type:"url",className:"cb-metadata-input",placeholder:"https://example.com/image.jpg",value:o.coverImage||"",onChange:x=>a("coverImage",x.target.value)}),o.coverImage&&l.jsx("div",{className:"cb-metadata-preview",children:l.jsx("img",{src:o.coverImage,alt:"Cover preview",onError:x=>{x.target.style.display="none"}})})]}),l.jsxs("div",{className:"cb-metadata-field",children:[l.jsxs("label",{htmlFor:"meta-author",className:"cb-metadata-label",children:[l.jsx(Me,{size:16}),l.jsx("span",{children:"Author"})]}),l.jsx("input",{id:"meta-author",type:"text",className:"cb-metadata-input",placeholder:"Author name",value:o.author||"",onChange:x=>a("author",x.target.value)})]}),l.jsxs("div",{className:"cb-metadata-field",children:[l.jsxs("label",{htmlFor:"meta-date",className:"cb-metadata-label",children:[l.jsx(Dn,{size:16}),l.jsx("span",{children:"Publish Date"})]}),l.jsx("input",{id:"meta-date",type:"datetime-local",className:"cb-metadata-input",value:o.publishDate||"",onChange:x=>a("publishDate",x.target.value)})]}),l.jsxs("div",{className:"cb-metadata-field",children:[l.jsxs("label",{htmlFor:"meta-canonical",className:"cb-metadata-label",children:[l.jsx(He,{size:16}),l.jsx("span",{children:"Canonical URL"})]}),l.jsx("input",{id:"meta-canonical",type:"url",className:"cb-metadata-input",placeholder:"https://example.com/original-post",value:o.canonicalUrl||"",onChange:x=>a("canonicalUrl",x.target.value)}),l.jsx("span",{className:"cb-metadata-hint",children:"For cross-posted or syndicated content"})]})]})]})},yo={paragraph:Fe,heading1:vt,heading2:xt,heading3:wt,heading4:lr,heading5:ir,heading6:ar,list:St,listOrdered:Ct,checkList:Lt,quote:Mt,code:kt,image:Oe,video:Nt,divider:Et,callout:yt,accordion:tt,table:At,bold:Rn,italic:Wn,underline:Zn,strikethrough:Jn,link:He,unlink:pr,highlight:Vn,textColor:Kn,alignLeft:$n,alignCenter:qn,alignRight:jn,alignJustify:Xc,undo:Qn,redo:Xn,copy:In,cut:yr,paste:tr,delete:Tt,plus:Gn,drag:Un,more:Pn,chevronUp:Zc,chevronDown:tt,moveUp:Yn,moveDown:_n,maximize:hr,close:Le,check:Jc,search:kr,settings:vr,sun:xr,moon:br,document:Me,codeFile:Fn,download:zn,upload:Sr,externalLink:cr,info:ur,warning:Cr,error:er,success:Qc,file:rr,indent:dr,outdent:sr,clear:mr,columns:or,rows:fr,eraser:On};function zr(e){return yo[e]||Fe}exports.BlockMenu=bo;exports.BlockRegistry=on;exports.BlockWrapper=Dr;exports.ContentBlocksEditor=Nr;exports.ContentBlocksRenderer=$r;exports.EventEmitter=nc;exports.LANGUAGES=dn;exports.MetadataPanel=Ir;exports.StatusBar=mo;exports.TableOfContents=Rr;exports.Toolbar=nt;exports.accordionBlock=fn;exports.addCalloutTitle=mc;exports.addCitation=sc;exports.addListItem=cc;exports.addTableColumn=kn;exports.addTableRow=Ge;exports.allBlocks=ft;exports.blockMap=xn;exports.blockRegistry=de;exports.bulletListBlock=st;exports.calculateReadingTime=go;exports.calloutBlock=mn;exports.cancelFrame=ec;exports.checkListBlock=sn;exports.clearFormatting=Pt;exports.codeBlock=pt;exports.collapseToEnd=Vc;exports.collapseToStart=Uc;exports.convertPlainTextToHtml=En;exports.countCharacters=Jt;exports.countWords=Xt;exports.createCommandExecutor=Er;exports.createDragHandle=$c;exports.createElement=Go;exports.createHeading=oc;exports.createImageFromFile=hn;exports.debounce=Gt;exports.deepClone=_e;exports.defaultBlocks=wc;exports.deleteBlock=co;exports.deleteTableColumn=Je;exports.deleteTableRow=Xe;exports.dividerBlock=bt;exports.duplicateBlock=io;exports.escapeHtml=Uo;exports.findElementsInSelection=Bn;exports.generateHeadingId=Oo;exports.generateId=F;exports.getBlockDefinition=Cc;exports.getBlockFromChild=ye;exports.getCellPosition=Qe;exports.getCode=pc;exports.getComputedStyleValue=Zo;exports.getCursorOffset=_c;exports.getElementIndex=_o;exports.getEmbedUrl=Ie;exports.getFocusedCell=Ze;exports.getIcon=zr;exports.getSelectedHtml=zc;exports.getSelectedText=Ic;exports.getSelectionRange=Zt;exports.getSelectionState=Ln;exports.getTextContent=$o;exports.heading1Block=rt;exports.heading2Block=lt;exports.heading3Block=it;exports.heading4Block=cn;exports.heading5Block=rn;exports.heading6Block=ln;exports.iconMap=yo;exports.imageBlock=ht;exports.indentBlock=po;exports.indentListItem=ic;exports.initDragDrop=Mn;exports.insertAfter=Pe;exports.insertBefore=nn;exports.insertBlock=oo;exports.insertLink=Rt;exports.isBlockElement=qo;exports.isCursorAtEnd=An;exports.isCursorAtStart=De;exports.isDragDropSupported=jc;exports.isElementEmpty=Po;exports.isFormatActive=to;exports.isMobile=Xo;exports.isMultiBlockSelection=Oc;exports.isSelectionCollapsed=jo;exports.isSelectionInElement=Pc;exports.isTouchDevice=Jo;exports.linkPreviewBlock=vn;exports.matchesKeyCombo=Ko;exports.mergeBlocks=so;exports.moveBlockDown=lo;exports.moveBlockUp=ro;exports.moveCursorToEnd=xe;exports.moveCursorToStart=be;exports.nextFrame=Qo;exports.normalizeHtml=Hc;exports.numberedListBlock=dt;exports.outdentBlock=ho;exports.outdentListItem=ac;exports.paragraphBlock=ct;exports.parseHeadings=fo;exports.parseHtml=Vo;exports.placeCursorAtEnd=Io;exports.placeCursorAtStart=zo;exports.quoteBlock=ut;exports.removeCitation=dc;exports.removeLink=Dt;exports.removeListItem=rc;exports.resetHeadingIds=Fo;exports.restoreSelection=Do;exports.restoreSelectionState=Dc;exports.sanitizeHtml=Cn;exports.sanitizePaste=Sn;exports.saveSelection=Ro;exports.saveSelectionState=Rc;exports.selectAllInElement=Fc;exports.serializeElement=Wo;exports.setAccordionOpen=yc;exports.setAlignment=fe;exports.setCalloutType=gt;exports.setCellAlignment=kc;exports.setCursorPosition=Wc;exports.setDividerStyle=gc;exports.setHighlightColor=zt;exports.setImageAlign=pn;exports.setImageSrc=Ke;exports.setLanguage=uc;exports.setSelectionRange=Qt;exports.setTextColor=It;exports.setVideoSrc=gn;exports.slugify=tn;exports.splitBlock=uo;exports.storage=tc;exports.stripHtml=en;exports.swapElements=Yo;exports.tableBlock=yn;exports.throttle=Ho;exports.toggleAccordion=fc;exports.toggleBold=Bt;exports.toggleChecklistItem=lc;exports.toggleFormat=no;exports.toggleInlineCode=jt;exports.toggleItalic=Ht;exports.toggleStrikethrough=$t;exports.toggleUnderline=qt;exports.transformBlock=ao;exports.unwrapElement=Nn;exports.videoBlock=bn;exports.wrapSelection=Tn;
|
|
960
970
|
//# sourceMappingURL=index.cjs.js.map
|