ados-rcm 1.1.968 → 1.1.969

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.
Files changed (27) hide show
  1. package/dist/{Copy-CHZb9pWP.js → Copy-BhebPx90.js} +1 -1
  2. package/dist/{Copy-BCVEZRLg.cjs → Copy-C4RNMixS.cjs} +1 -1
  3. package/dist/{Divider-BY9G5N-i.cjs → Divider-Bniee8zH.cjs} +1 -1
  4. package/dist/{Divider-OCz1LT6Z.js → Divider-C-JHUBIM.js} +1 -1
  5. package/dist/{FullScreen-DOqKY7e8.js → FullScreen-C2waDOk9.js} +1 -1
  6. package/dist/{FullScreen-CKPoXZCC.cjs → FullScreen-CqDB4Jt8.cjs} +1 -1
  7. package/dist/{ImageResizer-CspCq7YN.cjs → ImageResizer-D32NbsR7.cjs} +1 -1
  8. package/dist/{ImageResizer-vkHfCFrj.js → ImageResizer-oXcvk2id.js} +1 -1
  9. package/dist/{TableClipboard-DrLKWkto.js → TableClipboard-C_CTdlQJ.js} +3 -3
  10. package/dist/{TableClipboard-Zy9DLhdG.cjs → TableClipboard-aCjKAuQy.cjs} +1 -1
  11. package/dist/{TableSelection-Do_fVe_h.js → TableSelection-CB7MmzmS.js} +3 -3
  12. package/dist/{TableSelection-Be0rx3Lb.cjs → TableSelection-CeFaK1vr.cjs} +1 -1
  13. package/dist/{TableUp-XSGc3D4Q.js → TableUp-Bqz-8ZNS.js} +3 -3
  14. package/dist/{TableUp-sc-1aXCk.cjs → TableUp-FYg2plo2.cjs} +1 -1
  15. package/dist/{TableUpLogical-DraICC-w.cjs → TableUpLogical-CMAk-fuC.cjs} +1 -1
  16. package/dist/{TableUpLogical-b63j81zc.js → TableUpLogical-Deo7zQ8T.js} +1 -1
  17. package/dist/{Video-DMdvJFHX.js → Video-B8tjesz-.js} +1 -1
  18. package/dist/{Video-vhWfOFFz.cjs → Video-CINCo-Nb.cjs} +1 -1
  19. package/dist/{index-DgoWwYvV.cjs → index-C5oVnw57.cjs} +1 -1
  20. package/dist/{index-CIZPix6V.cjs → index-CPRUEkbV.cjs} +2 -2
  21. package/dist/{index-BC9-nBBi.cjs → index-CxcG6cKq.cjs} +1 -1
  22. package/dist/{index-B9qg5reR.js → index-DDuJ7D9p.js} +394 -392
  23. package/dist/{index-Bx7hfQKG.js → index-P-FoVx5h.js} +1 -1
  24. package/dist/{index-DmPtSBKF.js → index-xCUqmBUD.js} +1 -1
  25. package/dist/index.cjs.js +1 -1
  26. package/dist/index.es.js +1 -1
  27. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  var x = Object.defineProperty;
2
2
  var p = (i, t, r) => t in i ? x(i, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : i[t] = r;
3
3
  var s = (i, t, r) => p(i, typeof t != "symbol" ? t + "" : t, r);
4
- import { D as u, Q as o } from "./index-B9qg5reR.js";
4
+ import { D as u, Q as o } from "./index-DDuJ7D9p.js";
5
5
  const T = {
6
6
  capture: !0
7
7
  }, m = /* @__PURE__ */ new Set(["P", "DIV", "LI", "BLOCKQUOTE", "PRE", "TR", "TD", "TH", "SECTION", "ARTICLE", "H1", "H2", "H3", "H4", "H5", "H6"]), E = /<(?:br|p|div|li|blockquote|pre|tr|td|th|section|article|h[1-6])\b|[\r\n\t]/i, h = /[\r\n\t]+/g, f = /\s{2,}/g;
@@ -1 +1 @@
1
- "use strict";var y=Object.defineProperty;var x=(i,t,r)=>t in i?y(i,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):i[t]=r;var d=(i,t,r)=>x(i,typeof t!="symbol"?t+"":t,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index-CIZPix6V.cjs"),u={capture:!0},p=new Set(["P","DIV","LI","BLOCKQUOTE","PRE","TR","TD","TH","SECTION","ARTICLE","H1","H2","H3","H4","H5","H6"]),m=/<(?:br|p|div|li|blockquote|pre|tr|td|th|section|article|h[1-6])\b|[\r\n\t]/i,T=/[\r\n\t]+/g,h=/\s{2,}/g;function E(i){return typeof i.insert=="string"?i.insert.length:1}class b{constructor(t,r={}){d(this,"clipboard");d(this,"quill");d(this,"cleanupFunctions",[]);this.clipboard=t.getModule("clipboard"),this.quill=t,r.isTitleMode&&this.setupTitleModePaste()}setupTitleModePaste(){const t=this.quill.root,r=e=>{if(e.preventDefault(),!e.clipboardData)return;const l=e.clipboardData.getData("text/html"),n=e.clipboardData.getData("text/plain"),a=this.quill.getSelection(!0);if(!a)return;if(l){const f=this.normalizeTitlePasteHtml(l),o=this.clipboard.convert({html:f});this.applyPasteDelta(a.index,a.length,o),this.scheduleSelection(a.index+this.getDeltaLength(o));return}const c=this.normalizeTitlePasteText(n);this.applyPasteText(a.index,a.length,c),this.scheduleSelection(a.index+c.length)};t.addEventListener("paste",r,u),this.cleanupFunctions.push(()=>{t.removeEventListener("paste",r,u)})}normalizeTitlePasteText(t){return t.replaceAll(T," ").replaceAll(h," ").trim()}normalizeTitlePasteHtml(t){var a,c;if(!m.test(t))return t;const r=document.createElement("div");r.innerHTML=t,this.flattenTitlePasteNode(r);const e=document.createTreeWalker(r,NodeFilter.SHOW_TEXT);let l=e.nextNode();for(;l;)l.textContent=((a=l.textContent)==null?void 0:a.replaceAll(h," "))??"",l=e.nextNode();const n=this.findLastTextNode(r);return n&&(n.textContent=((c=n.textContent)==null?void 0:c.replaceAll(/\s+$/g,""))??""),r.innerHTML}flattenTitlePasteNode(t){var e;const r=Array.from(t.childNodes);for(const l of r){if(l.nodeType===Node.TEXT_NODE){l.textContent=((e=l.textContent)==null?void 0:e.replaceAll(T," "))??"";continue}if(l instanceof HTMLElement){if(l.tagName==="BR"){l.replaceWith(document.createTextNode(" "));continue}this.flattenTitlePasteNode(l),p.has(l.tagName)&&l.nextSibling&&!this.endsWithWhitespace(l)&&l.appendChild(document.createTextNode(" "))}}}endsWithWhitespace(t){var r;return/\s$/.test(((r=this.findLastTextNode(t))==null?void 0:r.textContent)??"")}findLastTextNode(t){const r=Array.from(t.childNodes).reverse();for(const e of r){if(e.nodeType===Node.TEXT_NODE)return e;const l=this.findLastTextNode(e);if(l)return l}return null}getDeltaLength(t){var r;return((r=t.ops)==null?void 0:r.reduce((e,l)=>e+E(l),0))??0}applyPasteDelta(t,r,e){const l=new s.Delta().retain(t).delete(r).concat(e);this.quill.updateContents(l,s.Quill.sources.USER)}applyPasteText(t,r,e){const l=new s.Delta().retain(t).delete(r);e&&l.insert(e),this.quill.updateContents(l,s.Quill.sources.USER)}scheduleSelection(t){const r=()=>this.quill.setSelection(t,0,s.Quill.sources.SILENT);if(typeof queueMicrotask=="function"){queueMicrotask(r);return}setTimeout(r,0)}destroy(){this.cleanupFunctions.forEach(t=>t()),this.cleanupFunctions=[]}async copyContent(t){var r;try{const e=this.quill.getText(),l=this.quill.root.innerHTML;return this.copyToClipboard(e,l,t)}catch(e){return console.error("Error in copyContent:",e),(r=t==null?void 0:t.onError)==null||r.call(t),!1}}async copyToClipboard(t,r,e){var l,n;try{return await this.tryModernClipboardWithHtml(t,r,e)||await this.tryModernClipboardText(t,e)||r&&this.tryLegacyClipboardWithHtml(r,e)||this.tryLegacyClipboardText(t,e)?!0:((l=e==null?void 0:e.onError)==null||l.call(e),!1)}catch(a){return console.error("복사 중 오류 발생:",a),(n=e==null?void 0:e.onError)==null||n.call(e),!1}}async tryModernClipboardWithHtml(t,r,e){var l;if(!navigator.clipboard||!r||!globalThis.ClipboardItem||!globalThis.isSecureContext)return!1;try{return await navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([r],{type:"text/html"}),"text/plain":new Blob([t],{type:"text/plain"})})]),(l=e==null?void 0:e.onSuccess)==null||l.call(e),!0}catch{return!1}}async tryModernClipboardText(t,r){var e;if(!navigator.clipboard||!globalThis.isSecureContext)return!1;try{return await navigator.clipboard.writeText(t),(e=r==null?void 0:r.onSuccess)==null||e.call(r),!0}catch{return!1}}tryLegacyClipboardWithHtml(t,r){const e=document.createElement("div");e.innerHTML=t,e.style.cssText="position:fixed;left:-9999px;top:-9999px;opacity:0;",document.body.appendChild(e);try{const l=document.createRange();l.selectNodeContents(e);const n=globalThis.getSelection();return n?(n.removeAllRanges(),n.addRange(l),this.tryClipboardEventCopy({html:t,text:e.textContent??""},r)):!1}finally{e.remove()}}tryLegacyClipboardText(t,r){const e=document.createElement("textarea");e.value=t,e.style.cssText="position:fixed;left:-9999px;top:-9999px;opacity:0;",document.body.appendChild(e);try{return e.focus(),e.select(),this.tryClipboardEventCopy({text:t},r)}finally{e.remove()}}tryClipboardEventCopy(t,r){var n;let e=!1;const l=a=>{a.preventDefault(),a.clipboardData&&(a.clipboardData.setData("text/plain",t.text),t.html&&a.clipboardData.setData("text/html",t.html),e=!0)};document.addEventListener("copy",l);try{const a=new ClipboardEvent("copy",{clipboardData:new DataTransfer});if(document.dispatchEvent(a),e)return(n=r==null?void 0:r.onSuccess)==null||n.call(r),!0}catch{return!1}finally{document.removeEventListener("copy",l)}return!1}}exports.default=b;
1
+ "use strict";var y=Object.defineProperty;var x=(i,t,r)=>t in i?y(i,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):i[t]=r;var d=(i,t,r)=>x(i,typeof t!="symbol"?t+"":t,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index-CPRUEkbV.cjs"),u={capture:!0},p=new Set(["P","DIV","LI","BLOCKQUOTE","PRE","TR","TD","TH","SECTION","ARTICLE","H1","H2","H3","H4","H5","H6"]),m=/<(?:br|p|div|li|blockquote|pre|tr|td|th|section|article|h[1-6])\b|[\r\n\t]/i,T=/[\r\n\t]+/g,h=/\s{2,}/g;function E(i){return typeof i.insert=="string"?i.insert.length:1}class b{constructor(t,r={}){d(this,"clipboard");d(this,"quill");d(this,"cleanupFunctions",[]);this.clipboard=t.getModule("clipboard"),this.quill=t,r.isTitleMode&&this.setupTitleModePaste()}setupTitleModePaste(){const t=this.quill.root,r=e=>{if(e.preventDefault(),!e.clipboardData)return;const l=e.clipboardData.getData("text/html"),n=e.clipboardData.getData("text/plain"),a=this.quill.getSelection(!0);if(!a)return;if(l){const f=this.normalizeTitlePasteHtml(l),o=this.clipboard.convert({html:f});this.applyPasteDelta(a.index,a.length,o),this.scheduleSelection(a.index+this.getDeltaLength(o));return}const c=this.normalizeTitlePasteText(n);this.applyPasteText(a.index,a.length,c),this.scheduleSelection(a.index+c.length)};t.addEventListener("paste",r,u),this.cleanupFunctions.push(()=>{t.removeEventListener("paste",r,u)})}normalizeTitlePasteText(t){return t.replaceAll(T," ").replaceAll(h," ").trim()}normalizeTitlePasteHtml(t){var a,c;if(!m.test(t))return t;const r=document.createElement("div");r.innerHTML=t,this.flattenTitlePasteNode(r);const e=document.createTreeWalker(r,NodeFilter.SHOW_TEXT);let l=e.nextNode();for(;l;)l.textContent=((a=l.textContent)==null?void 0:a.replaceAll(h," "))??"",l=e.nextNode();const n=this.findLastTextNode(r);return n&&(n.textContent=((c=n.textContent)==null?void 0:c.replaceAll(/\s+$/g,""))??""),r.innerHTML}flattenTitlePasteNode(t){var e;const r=Array.from(t.childNodes);for(const l of r){if(l.nodeType===Node.TEXT_NODE){l.textContent=((e=l.textContent)==null?void 0:e.replaceAll(T," "))??"";continue}if(l instanceof HTMLElement){if(l.tagName==="BR"){l.replaceWith(document.createTextNode(" "));continue}this.flattenTitlePasteNode(l),p.has(l.tagName)&&l.nextSibling&&!this.endsWithWhitespace(l)&&l.appendChild(document.createTextNode(" "))}}}endsWithWhitespace(t){var r;return/\s$/.test(((r=this.findLastTextNode(t))==null?void 0:r.textContent)??"")}findLastTextNode(t){const r=Array.from(t.childNodes).reverse();for(const e of r){if(e.nodeType===Node.TEXT_NODE)return e;const l=this.findLastTextNode(e);if(l)return l}return null}getDeltaLength(t){var r;return((r=t.ops)==null?void 0:r.reduce((e,l)=>e+E(l),0))??0}applyPasteDelta(t,r,e){const l=new s.Delta().retain(t).delete(r).concat(e);this.quill.updateContents(l,s.Quill.sources.USER)}applyPasteText(t,r,e){const l=new s.Delta().retain(t).delete(r);e&&l.insert(e),this.quill.updateContents(l,s.Quill.sources.USER)}scheduleSelection(t){const r=()=>this.quill.setSelection(t,0,s.Quill.sources.SILENT);if(typeof queueMicrotask=="function"){queueMicrotask(r);return}setTimeout(r,0)}destroy(){this.cleanupFunctions.forEach(t=>t()),this.cleanupFunctions=[]}async copyContent(t){var r;try{const e=this.quill.getText(),l=this.quill.root.innerHTML;return this.copyToClipboard(e,l,t)}catch(e){return console.error("Error in copyContent:",e),(r=t==null?void 0:t.onError)==null||r.call(t),!1}}async copyToClipboard(t,r,e){var l,n;try{return await this.tryModernClipboardWithHtml(t,r,e)||await this.tryModernClipboardText(t,e)||r&&this.tryLegacyClipboardWithHtml(r,e)||this.tryLegacyClipboardText(t,e)?!0:((l=e==null?void 0:e.onError)==null||l.call(e),!1)}catch(a){return console.error("복사 중 오류 발생:",a),(n=e==null?void 0:e.onError)==null||n.call(e),!1}}async tryModernClipboardWithHtml(t,r,e){var l;if(!navigator.clipboard||!r||!globalThis.ClipboardItem||!globalThis.isSecureContext)return!1;try{return await navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([r],{type:"text/html"}),"text/plain":new Blob([t],{type:"text/plain"})})]),(l=e==null?void 0:e.onSuccess)==null||l.call(e),!0}catch{return!1}}async tryModernClipboardText(t,r){var e;if(!navigator.clipboard||!globalThis.isSecureContext)return!1;try{return await navigator.clipboard.writeText(t),(e=r==null?void 0:r.onSuccess)==null||e.call(r),!0}catch{return!1}}tryLegacyClipboardWithHtml(t,r){const e=document.createElement("div");e.innerHTML=t,e.style.cssText="position:fixed;left:-9999px;top:-9999px;opacity:0;",document.body.appendChild(e);try{const l=document.createRange();l.selectNodeContents(e);const n=globalThis.getSelection();return n?(n.removeAllRanges(),n.addRange(l),this.tryClipboardEventCopy({html:t,text:e.textContent??""},r)):!1}finally{e.remove()}}tryLegacyClipboardText(t,r){const e=document.createElement("textarea");e.value=t,e.style.cssText="position:fixed;left:-9999px;top:-9999px;opacity:0;",document.body.appendChild(e);try{return e.focus(),e.select(),this.tryClipboardEventCopy({text:t},r)}finally{e.remove()}}tryClipboardEventCopy(t,r){var n;let e=!1;const l=a=>{a.preventDefault(),a.clipboardData&&(a.clipboardData.setData("text/plain",t.text),t.html&&a.clipboardData.setData("text/html",t.html),e=!0)};document.addEventListener("copy",l);try{const a=new ClipboardEvent("copy",{clipboardData:new DataTransfer});if(document.dispatchEvent(a),e)return(n=r==null?void 0:r.onSuccess)==null||n.call(r),!0}catch{return!1}finally{document.removeEventListener("copy",l)}return!1}}exports.default=b;
@@ -1 +1 @@
1
- "use strict";var n=Object.defineProperty;var c=(e,t,o)=>t in e?n(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o;var i=(e,t,o)=>c(e,typeof t!="symbol"?t+"":t,o);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-CIZPix6V.cjs"),d=r.Quill.import("blots/block/embed"),a=r.Quill.import("ui/icons"),l="border: var(--AEditor_Addon_Primary_border); border-bottom: none; transition: border var(--Transition);";a.divider=r.ReactDOMServer.renderToString(r.jsxRuntimeExports.jsx(r.AIcon,{icon:"Minus",strokeWidth:2.5,width:"100%"}));class s extends d{static create(){const t=super.create(!0);return t.style.cssText=l,t}}i(s,"blotName","divider"),i(s,"tagName","hr");exports.default=s;
1
+ "use strict";var n=Object.defineProperty;var c=(e,t,o)=>t in e?n(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o;var i=(e,t,o)=>c(e,typeof t!="symbol"?t+"":t,o);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-CPRUEkbV.cjs"),d=r.Quill.import("blots/block/embed"),a=r.Quill.import("ui/icons"),l="border: var(--AEditor_Addon_Primary_border); border-bottom: none; transition: border var(--Transition);";a.divider=r.ReactDOMServer.renderToString(r.jsxRuntimeExports.jsx(r.AIcon,{icon:"Minus",strokeWidth:2.5,width:"100%"}));class s extends d{static create(){const t=super.create(!0);return t.style.cssText=l,t}}i(s,"blotName","divider"),i(s,"tagName","hr");exports.default=s;
@@ -1,7 +1,7 @@
1
1
  var n = Object.defineProperty;
2
2
  var a = (r, t, e) => t in r ? n(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
3
3
  var o = (r, t, e) => a(r, typeof t != "symbol" ? t + "" : t, e);
4
- import { Q as i, R as c, j as d, A as m } from "./index-B9qg5reR.js";
4
+ import { Q as i, R as c, j as d, A as m } from "./index-DDuJ7D9p.js";
5
5
  const b = i.import("blots/block/embed"), l = i.import("ui/icons"), u = "border: var(--AEditor_Addon_Primary_border); border-bottom: none; transition: border var(--Transition);";
6
6
  l.divider = c.renderToString(/* @__PURE__ */ d.jsx(m, { icon: "Minus", strokeWidth: 2.5, width: "100%" }));
7
7
  class s extends b {
@@ -1,7 +1,7 @@
1
1
  var l = Object.defineProperty;
2
2
  var r = (e, t, o) => t in e ? l(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o;
3
3
  var i = (e, t, o) => r(e, typeof t != "symbol" ? t + "" : t, o);
4
- import { a as u, d as c } from "./index-B9qg5reR.js";
4
+ import { a as u, d as c } from "./index-DDuJ7D9p.js";
5
5
  class h {
6
6
  constructor(t, o = {}) {
7
7
  i(this, "quill");
@@ -1 +1 @@
1
- "use strict";var r=Object.defineProperty;var u=(i,t,o)=>t in i?r(i,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):i[t]=o;var e=(i,t,o)=>u(i,typeof t!="symbol"?t+"":t,o);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index-CIZPix6V.cjs");class c{constructor(t,o={}){e(this,"quill");e(this,"options");e(this,"toolbarEl");e(this,"ownerDocument");e(this,"controller");e(this,"button",null);e(this,"buttonIcon",null);e(this,"unsubscribeController",null);e(this,"buttonClickHandler",t=>this.controller.toggleFullscreen(t));if(this.quill=t,this.options=o,this.ownerDocument=t.root instanceof HTMLElement?t.root.ownerDocument:document,this.controller=s.getOrCreateQuillFullscreenController(t),this.options.type==="Raw"){this.toolbarEl=null;return}const n=t.getModule("toolbar"),l=(n==null?void 0:n.container)??null;this.toolbarEl=l,this.createButton()}destroy(){var t,o;(t=this.unsubscribeController)==null||t.call(this),this.unsubscribeController=null,this.button&&(this.button.removeEventListener("click",this.buttonClickHandler),this.button.remove(),this.button=null),(o=this.toolbarEl)==null||o.classList.remove("ql-toolbar-has-right-action"),s.destroyQuillFullscreenController(this.quill)}createButton(){if(!this.options.maximize||!this.options.minimize)return;const t=this.ownerDocument.createElement("button"),o=this.ownerDocument.createElement("span");t.type="button",t.classList.add("ql-fullscreen"),o.classList.add("ql-fullscreen-icon"),t.append(o),t.addEventListener("click",this.buttonClickHandler),this.button=t,this.buttonIcon=o,this.unsubscribeController=this.controller.subscribe(n=>this.syncButtonState(n)),this.toolbarEl&&(t.classList.add("ql-right-action"),this.toolbarEl.classList.add("ql-toolbar-has-right-action"),this.toolbarEl.append(t))}syncButtonState(t){if(!this.button||!this.buttonIcon)return;this.button.classList.toggle("ql-active",t);const o=t?this.options.minimize??"":this.options.maximize??"",n=t?this.options.minimizeLabel??"":this.options.maximizeLabel??"";this.buttonIcon.innerHTML!==o&&(this.buttonIcon.innerHTML=o),this.button.title!==n&&(this.button.title=n),this.button.getAttribute("aria-label")!==n&&this.button.setAttribute("aria-label",n)}}exports.default=c;
1
+ "use strict";var r=Object.defineProperty;var u=(i,t,o)=>t in i?r(i,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):i[t]=o;var e=(i,t,o)=>u(i,typeof t!="symbol"?t+"":t,o);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index-CPRUEkbV.cjs");class c{constructor(t,o={}){e(this,"quill");e(this,"options");e(this,"toolbarEl");e(this,"ownerDocument");e(this,"controller");e(this,"button",null);e(this,"buttonIcon",null);e(this,"unsubscribeController",null);e(this,"buttonClickHandler",t=>this.controller.toggleFullscreen(t));if(this.quill=t,this.options=o,this.ownerDocument=t.root instanceof HTMLElement?t.root.ownerDocument:document,this.controller=s.getOrCreateQuillFullscreenController(t),this.options.type==="Raw"){this.toolbarEl=null;return}const n=t.getModule("toolbar"),l=(n==null?void 0:n.container)??null;this.toolbarEl=l,this.createButton()}destroy(){var t,o;(t=this.unsubscribeController)==null||t.call(this),this.unsubscribeController=null,this.button&&(this.button.removeEventListener("click",this.buttonClickHandler),this.button.remove(),this.button=null),(o=this.toolbarEl)==null||o.classList.remove("ql-toolbar-has-right-action"),s.destroyQuillFullscreenController(this.quill)}createButton(){if(!this.options.maximize||!this.options.minimize)return;const t=this.ownerDocument.createElement("button"),o=this.ownerDocument.createElement("span");t.type="button",t.classList.add("ql-fullscreen"),o.classList.add("ql-fullscreen-icon"),t.append(o),t.addEventListener("click",this.buttonClickHandler),this.button=t,this.buttonIcon=o,this.unsubscribeController=this.controller.subscribe(n=>this.syncButtonState(n)),this.toolbarEl&&(t.classList.add("ql-right-action"),this.toolbarEl.classList.add("ql-toolbar-has-right-action"),this.toolbarEl.append(t))}syncButtonState(t){if(!this.button||!this.buttonIcon)return;this.button.classList.toggle("ql-active",t);const o=t?this.options.minimize??"":this.options.maximize??"",n=t?this.options.minimizeLabel??"":this.options.maximizeLabel??"";this.buttonIcon.innerHTML!==o&&(this.buttonIcon.innerHTML=o),this.button.title!==n&&(this.button.title=n),this.button.getAttribute("aria-label")!==n&&this.button.setAttribute("aria-label",n)}}exports.default=c;
@@ -1 +1 @@
1
- "use strict";var P=Object.defineProperty;var w=(h,i,t)=>i in h?P(h,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):h[i]=t;var n=(h,i,t)=>w(h,typeof i!="symbol"?i+"":i,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./index-CIZPix6V.cjs"),g={OVERLAY:"ql-image-resizer-overlay",HANDLE:"ql-image-resizer-handle",DISPLAY:"ql-image-resizer-display",TOOLBAR:"ql-image-resizer-toolbar",TOOLBAR_BUTTON:"ql-image-resizer-toolbar-button"},d={BACKSPACE:8,DELETE:46,LEFT:37,UP:38,RIGHT:39,DOWN:40};function M(h){switch(h.key){case"Backspace":return d.BACKSPACE;case"Delete":return d.DELETE;case"ArrowLeft":return d.LEFT;case"ArrowUp":return d.UP;case"ArrowRight":return d.RIGHT;case"ArrowDown":return d.DOWN;default:return 0}}const q=["tl","tr","br","bl"],F=8;function N(h){var t;const i=new Uint32Array(h);if(typeof((t=globalThis.crypto)==null?void 0:t.getRandomValues)=="function")globalThis.crypto.getRandomValues(i);else{let e=Date.now();for(let s=0;s<h;s++)e=e*1103515245+12345&2147483647,i[s]=e}return Array.from(i,e=>e%62).join("")}const v=(h,i)=>{const t=h?"top":"bottom",e=i?"left":"right",s=h===i?"nwse-resize":"nesw-resize";return{[t]:"-5px",[e]:"-5px",cursor:s}},R={tl:v(!0,!0),tr:v(!0,!1),bl:v(!1,!0),br:v(!1,!1)},O=new Map,L=globalThis;function B(h){const i=O.get(h);if(i)return i;const t=u.ReactDOMServer.renderToString(u.jsxRuntimeExports.jsx(u.AIcon,{icon:h,size:"xs"}));return O.set(h,t),t}const k={modules:["DisplaySize","Toolbar","Resize","Keyboard"],embedTags:["VIDEO","IFRAME"],tools:["left","center","right","justify"],contentOptions:[{attribute:["width"],limit:{minWidth:100},blotName:"image"},{attribute:["width","height"],limit:{minWidth:200,ratio:.5625},blotName:"video"}]},z=u.Quill.import("formats/image");class E extends z{static get ATTRIBUTES(){return["alt","height","width","class","style","data-align"]}static formats(i){return this.ATTRIBUTES.reduce((t,e)=>(i.hasAttribute(e)&&(t[e]=i.getAttribute(e)??""),t),{})}format(i,t){this.constructor.ATTRIBUTES.includes(i)?t?this.domNode.setAttribute(i,t):this.domNode.removeAttribute(i):super.format(i,t)}}n(E,"blotName","image"),n(E,"tagName","img"),n(E,"scope",u.Scope.INLINE);function I(){L.__AEDITOR_IMAGE_BLOT_REGISTERED__||(u.Quill.register("formats/image",E,!0),L.__AEDITOR_IMAGE_BLOT_REGISTERED__=!0)}class y{constructor(i){n(this,"resizer");n(this,"quill");n(this,"overlay");n(this,"activeEle");n(this,"blot");n(this,"options");n(this,"requestUpdate");this.resizer=i,this.quill=i.quill,this.overlay=i.overlay,this.activeEle=i.activeEle,this.blot=i.blot,this.options=i.options,this.requestUpdate=()=>i.scheduleUpdate(!0)}onCreate(){}onDestroy(){}onUpdate(){}}class U extends y{constructor(){super(...arguments);n(this,"display")}onCreate(){var t;this.display=document.createElement("div"),this.display.className=u.S[g.DISPLAY],(t=this.overlay)==null||t.appendChild(this.display)}onUpdate(){if(!this.display||!this.activeEle)return;const[t,e]=[this.activeEle.offsetWidth,this.activeEle.offsetHeight];this.display.textContent=`${t} × ${e}`,this.positionDisplay(t,e)}positionDisplay(t,e){var p;if(!this.display)return;const s=this.display.getBoundingClientRect(),o=t>120&&e>30,l=((p=this.activeEle)==null?void 0:p.style.float)==="right";let r,a,c;o?(r="4px",a="4px",c="auto"):(a=`-${s.height+4}px`,l?(r="auto",c=`-${s.width+4}px`):(r=`-${s.width+4}px`,c="auto")),Object.assign(this.display.style,{right:r,bottom:a,left:c})}}class j extends y{constructor(){super(...arguments);n(this,"boxes",[]);n(this,"dragBox",null);n(this,"dragStartX",0);n(this,"dragStartY",0);n(this,"contentOption");n(this,"preDragSize",{width:0,height:0});n(this,"naturalSize",[0,0]);n(this,"handleDragProxy",null);n(this,"handleMouseupProxy",null);n(this,"dragAnimationFrame",null);n(this,"pendingDragEvent",null);n(this,"handleMousedown",t=>{t.button!==0||!this.blot||!this.activeEle||(t.preventDefault(),t.stopPropagation(),this.cancelDragFrame(),this.removeEventListeners(),this.dragBox=t.target,this.dragStartX=t.clientX,this.dragStartY=t.clientY,this.preDragSize={width:this.activeEle.offsetWidth,height:this.activeEle.offsetHeight},this.naturalSize=this.getNaturalSize(),this.setCursor(globalThis.getComputedStyle(this.dragBox).cursor),this.handleDragProxy=this.handleDrag,this.handleMouseupProxy=this.handleMouseup,document.addEventListener("mousemove",this.handleDragProxy,!0),document.addEventListener("mouseup",this.handleMouseupProxy,!0))});n(this,"handleMouseup",t=>{if(!this.activeEle||!this.blot||!this.contentOption)return;this.cancelDragFrame();const e=this.calcSize(t,this.contentOption.limit);Object.assign(this.activeEle,e),Object.assign(this.activeEle.style,{width:null,height:null}),this.setCursor(""),this.removeEventListeners()});n(this,"handleDrag",t=>{!this.activeEle||!this.blot||!this.contentOption||(t.preventDefault(),this.pendingDragEvent=t,this.dragAnimationFrame===null&&(this.dragAnimationFrame=requestAnimationFrame(()=>{this.dragAnimationFrame=null;const e=this.pendingDragEvent;this.pendingDragEvent=null,!(!e||!this.activeEle||!this.contentOption)&&(Object.assign(this.activeEle.style,this.calcSize(e,{...this.contentOption.limit,unit:!0})),this.requestUpdate())})))});n(this,"handleDoubleClick",t=>{if(!this.blot||!this.activeEle||!this.contentOption)return;t.stopPropagation();const[e,s]=this.naturalSize,o={};this.contentOption.attribute.includes("width")&&(o.width=e),this.contentOption.attribute.includes("height")&&(o.height=s);const l=this.applyConstraints(o,this.contentOption.limit);Object.assign(this.activeEle,l),this.requestUpdate()})}onCreate(){!this.blot||!this.options.contentOptions||(this.contentOption=this.options.contentOptions.find(t=>t.blotName===this.blot.statics.blotName),this.boxes=[],q.forEach(t=>this.addBox(t)))}onDestroy(){this.setCursor(""),this.cancelDragFrame(),this.removeEventListeners(),this.boxes.forEach(t=>{t.removeEventListener("mousedown",this.handleMousedown,!1),t.removeEventListener("dblclick",this.handleDoubleClick,!1)}),this.boxes=[]}addBox(t){var s;const e=document.createElement("div");e.className=`${u.S[g.HANDLE]} ${t}`,e.addEventListener("mousedown",this.handleMousedown,!1),e.addEventListener("dblclick",this.handleDoubleClick,!1),Object.assign(e.style,R[t]),(s=this.overlay)==null||s.appendChild(e),this.boxes.push(e)}removeEventListeners(){this.handleDragProxy&&(document.removeEventListener("mousemove",this.handleDragProxy,!0),this.handleDragProxy=null),this.handleMouseupProxy&&(document.removeEventListener("mouseup",this.handleMouseupProxy,!0),this.handleMouseupProxy=null)}calcSize(t,e={}){var a;if(!this.dragBox||!this.activeEle)return{};const s=t.clientX-this.dragStartX,o=t.clientY-this.dragStartY,l=this.dragBox===this.boxes[0]||this.dragBox===this.boxes[3]?-1:1,r={};return(a=this.contentOption)!=null&&a.attribute?this.contentOption.attribute.forEach(c=>r[c]=this.preDragSize[c]):r.width=this.preDragSize.width,r.width&&(r.width=Math.round(this.preDragSize.width+s*l)),r.height&&(r.height=Math.round(this.preDragSize.height+o*l)),this.applyConstraints(r,e)}constrainDimensionsWithRatio(t,e){const s=e.ratio;let o=this.applyLimit(t,e.minWidth,e.maxWidth),l=o*s;const r=this.applyLimit(l,e.minHeight,e.maxHeight);return r!==l&&(l=r,o=l/s),{rw:o,rh:l}}applyConstraints(t,e={}){const s=typeof t.width=="string"?Number.parseInt(t.width,10):t.width||0,o=typeof t.height=="string"?Number.parseInt(t.height,10):t.height||0;let l=s,r=o;e.ratio?{rw:l,rh:r}=this.constrainDimensionsWithRatio(l,e):(s&&(l=this.applyLimit(l,e.minWidth,e.maxWidth)),o&&(r=this.applyLimit(r,e.minHeight,e.maxHeight)));const a={};return t.width!==void 0&&(a.width=e.unit?`${l}px`:l),t.height!==void 0&&(a.height=e.unit?`${r}px`:r),a}applyLimit(t,e,s){let o=t;return e!==void 0&&(o=Math.max(e,o)),s!==void 0&&(o=Math.min(s,o)),o}getNaturalSize(){if(!this.activeEle)return[0,0];const t=this.activeEle.dataset.size;if(!t){const e=this.activeEle,s=[e.offsetWidth,e.offsetHeight];return e.dataset.size=s.join(","),s}return t.split(",").map(Number)}setCursor(t){[document.body,this.activeEle].forEach(e=>e&&(e.style.cursor=t))}cancelDragFrame(){this.dragAnimationFrame!==null&&(cancelAnimationFrame(this.dragAnimationFrame),this.dragAnimationFrame=null),this.pendingDragEvent=null}}const m=class m extends y{constructor(){super(...arguments);n(this,"keyboardProxy",t=>this.keyboardHandle(t))}static injectInit(t){var s;if(m.injectedQuills.has(t))return;const e=(s=t.keyboard)==null?void 0:s.bindings;e&&([m.keys.LEFT,m.keys.RIGHT].forEach(o=>(e[o]||[]).unshift(m.makeArrowHandler(o))),m.injectedQuills.add(t))}static makeArrowHandler(t){const e=t===m.keys.LEFT;return{key:t,shiftKey:!1,altKey:null,[e?"prefix":"suffix"]:/^$/,handler(s){const o=this.quill;if(!o.resizer)return!0;let l=s.index;const r=t===m.keys.RIGHT,[a]=o.getLine(l+(e?-1:0));if(!a)return!0;if(o.resizer.judgeShow(a))return!1;const c=o.getIndex(a);if(r&&c+a.length()-1===l)return!0;r&&(l+=s.length+1);const[p]=o.getLeaf(l);if(!p)return!0;const x=p.offset(p.parent),D=p.constructor&&"scope"in p.constructor&&p.constructor.scope===u.Scope.BLOCK_BLOT;if(e&&(D&&l===x||l===0||l===c))return!0;let S=p;if(e&&x===0){const[T]=o.getLeaf(l-1);T&&(S=T)}return!S||!o.resizer.judgeShow(S)}}}onCreate(){document.addEventListener("keydown",this.keyboardProxy,!0)}onDestroy(){document.removeEventListener("keydown",this.keyboardProxy,!0)}keyboardHandle(t){if(t.defaultPrevented||t.shiftKey||t.ctrlKey||t.altKey||!this.activeEle||!this.blot)return;const e=M(t);let s=this.blot.offset(this.quill.scroll),o=null,l=!1;e===d.BACKSPACE||e===d.DELETE?(this.handleDelete(),l=!0):e>=d.LEFT&&e<=d.DOWN&&([s,o]=this.handleArrowKeys(e,s),l=!0),l&&(t.stopPropagation(),t.preventDefault()),!(o&&this.resizer.judgeShow(o,o.domNode))&&(this.quill.setSelection(s),this.resizer.hide())}handleDelete(){if(!this.blot)return;const t=this.blot.length();this.blot.deleteAt(0,t),this.blot=void 0,this.activeEle=void 0,this.resizer.hide()}handleArrowKeys(t,e){let s=null;return t===d.RIGHT?e+=this.blot.length()||1:t===d.UP?(e=this.getOtherLineIndex(-1),s=this.quill.getLeaf(e)[0]):t===d.DOWN&&(e=this.getOtherLineIndex(1),s=this.quill.getLeaf(e)[0]),[e,s]}getOtherLineIndex(t){if(!this.blot)return 0;const e=this.blot.offset(this.quill.scroll),[s]=this.quill.getLine(e);if(!s)return e;const o=this.blot.offset(s)+1,l=t>0?s.next:s.prev;if(!l)return e;let r=l.length();return l.statics.blotName==="block"&&r--,l.offset(this.quill.scroll)+Math.min(r,o)}};n(m,"keys",d),n(m,"injectedQuills",new WeakSet);let b=m;const f=class f extends y{constructor(t){super(t);n(this,"toolbar");n(this,"blot");n(this,"tools",{});n(this,"toolbarClickProxy",t=>this.handleToolbarClick(t));this.blot=t.blot}createStyleTool(t,e){const s={left:{float:"left"},right:{float:"right"},center:{display:"block",margin:"0 auto",float:"none"},justify:{display:"block",float:"none",margin:"0",width:"100%"}};return{icon:t,apply:o=>{this.clearAlignmentStyles(o);const l=s[e];Object.assign(o.style,l),o.dataset.align=e},isApplied:o=>{const l=o.style;switch(e){case"center":return l.float==="none";case"justify":return l.display==="block"&&l.width==="100%";case"left":case"right":return l.float===e;default:return!1}}}}clearAlignmentStyles(t){const e=t.dataset.align;t.style.removeProperty("display"),t.style.removeProperty("float"),t.style.removeProperty("margin"),e==="justify"&&t.style.removeProperty("width"),delete t.dataset.align}onCreate(){var t;this.toolbar=document.createElement("div"),this.toolbar.className=u.S[g.TOOLBAR],this.toolbar.addEventListener("click",this.toolbarClickProxy),(t=this.overlay)==null||t.appendChild(this.toolbar),this.initializeTools(),this._addToolbarButtons()}onDestroy(){var t;(t=this.toolbar)==null||t.removeEventListener("click",this.toolbarClickProxy),this.toolbar=void 0}initializeTools(){Object.keys(f.Tools).forEach(t=>{const e=t;this.tools[e]=this.createStyleTool(f.Tools[e].icon,e)})}_addToolbarButtons(){!this.toolbar||!this.activeEle||this.options.tools.forEach(t=>{const e=this.tools[t];if(!e)return;const s=document.createElement("button");s.type="button",s.className=u.S[g.TOOLBAR_BUTTON],s.innerHTML=B(e.icon),s.dataset.tool=t,e.isApplied&&this.activeEle&&e.isApplied.call(this,this.activeEle)&&(s.style.backgroundColor="var(--AEditor_Addon_Secondary_color)"),this.toolbar.appendChild(s)})}handleToolbarClick(t){var r,a;if(!this.activeEle||!this.blot||!this.toolbar)return;const e=(r=t.target)==null?void 0:r.closest("button[data-tool]");if(!e||!this.toolbar.contains(e))return;const s=e.dataset.tool;if(!s)return;const o=this.tools[s];if(!o||(t.stopPropagation(),o.handler&&o.handler.call(this,t,e,this.activeEle)!==!0))return;const l=o.isApplied?o.isApplied.call(this,this.activeEle):!1;Array.from(this.toolbar.querySelectorAll("button")).forEach(c=>c.style.backgroundColor=""),l?this.clearAlignmentStyles(this.activeEle):(e.style.backgroundColor="var(--AEditor_Addon_Secondary_color)",(a=o.apply)==null||a.call(o,this.activeEle)),this.requestUpdate()}};n(f,"Tools",{left:{icon:"AlignLeft"},center:{icon:"AlignCenter"},right:{icon:"AlignRight"},justify:{icon:"AlignJustify"}});let A=f;class C{constructor(i,t={}){n(this,"isDestroyed",!1);n(this,"quill");n(this,"options");n(this,"moduleClasses");n(this,"modules",[]);n(this,"blot");n(this,"selectedBlots",[]);n(this,"embedClassName","");n(this,"activeEle");n(this,"overlay");n(this,"updateFromModule",!1);n(this,"hideProxy",null);n(this,"updateOverlayPositionProxy",null);n(this,"embedStyleElement",null);n(this,"updateAnimationFrame",null);n(this,"overlayScrollAnimationFrame",null);n(this,"pendingOverlayMarginTop",null);n(this,"scheduledFromModule",!1);n(this,"previousBodyUserSelect",null);n(this,"previousRootUserSelect",null);n(this,"handleClickProxy",i=>this.handleClick(i));n(this,"handleChangeProxy",(i,t,e)=>this.handleChange(i,t,e));n(this,"handleSelectionChangeProxy",i=>this.addBlotsSelectedClass(i));var s;I(),i.resizer=this,this.isDestroyed=!1,this.quill=i;const e=t.modules?[...t.modules]:null;this.options={...k,...t},e&&(this.options.modules=e),this.moduleClasses=this.options.modules,this.quill.root.addEventListener("mousedown",this.handleClickProxy,!1),this.quill.on("text-change",this.handleChangeProxy),this.quill.container.style.position=this.quill.container.style.position||"relative",this.quill.on("selection-change",this.handleSelectionChangeProxy),b.injectInit(this.quill),(s=this.options.embedTags)!=null&&s.length&&this.initializeEmbed()}destroy(){var i;this.isDestroyed||(this.isDestroyed=!0,this.updateAnimationFrame!==null&&(cancelAnimationFrame(this.updateAnimationFrame),this.updateAnimationFrame=null),this.overlayScrollAnimationFrame!==null&&(cancelAnimationFrame(this.overlayScrollAnimationFrame),this.overlayScrollAnimationFrame=null),this.pendingOverlayMarginTop=null,this.hide(),this.quill.root.removeEventListener("mousedown",this.handleClickProxy,!1),this.quill.off("text-change",this.handleChangeProxy),this.quill.off("selection-change",this.handleSelectionChangeProxy),(i=this.embedStyleElement)==null||i.remove(),this.embedStyleElement=null,this.embedClassName&&this.quill.root.classList.remove(this.embedClassName))}initializeModules(){this.modules.forEach(i=>i.onDestroy()),this.modules=[],this.modules=this.moduleClasses.map(i=>new(this.constructor.Modules[i]||i)(this)),this.modules.forEach(i=>i.onCreate()),this.repositionElements(),this.modules.forEach(i=>i.onUpdate())}initializeEmbed(){if(!this.options.embedTags.length)return;this.embedClassName=`ql-${N(F)}`;const i=[""].concat(this.options.embedTags).join(`, .${this.embedClassName} `).slice(2)+"{pointer-events: none;}",t=document.createElement("style");t.textContent=i,this.embedStyleElement=t,this.quill.container.appendChild(t),this.quill.root.classList.add(this.embedClassName)}scheduleUpdate(i){this.scheduledFromModule=this.scheduledFromModule||!!i,this.updateAnimationFrame===null&&(this.updateAnimationFrame=requestAnimationFrame(()=>{this.updateAnimationFrame=null;const t=this.scheduledFromModule;this.scheduledFromModule=!1,this.onUpdate(t)}))}onUpdate(i){this.updateFromModule=!!i,this.repositionElements(),this.modules.forEach(t=>t.onUpdate())}resolveMediaTarget(i){if(!(i instanceof HTMLElement))return null;const t=["img","iframe","video",".ql-video"].join(", ");if(i.matches(t))return i;const e=i.closest(t);return e||null}handleClick(i){if(this.overlay&&(i.target===this.overlay||this.overlay.contains(i.target)))return;let t=i.target;if(t=this.getEventTarget(i,t),t!=null&&t.tagName){const e=this.quill.scroll.find(t);if(e&&this.judgeShow(e,t)){i.preventDefault();return}}this.activeEle&&this.hide()}getEventTarget(i,t){var l;const e=(l=this.options.embedTags)==null?void 0:l.join(),s=this.resolveMediaTarget(t);if(s)return s;if(typeof document.elementsFromPoint=="function"){const r=document.elementsFromPoint(i.clientX,i.clientY).map(a=>this.resolveMediaTarget(a)).find(a=>!!a&&this.quill.root.contains(a));if(r)return r}if(!e)return t;const o=this.quill.root;if(t===o||t.querySelectorAll(e).length){o.classList.remove(this.embedClassName);const r=document.elementFromPoint(i.clientX,i.clientY);o.classList.add(this.embedClassName);const a=this.resolveMediaTarget(r);if(a&&o.contains(a))return a;r&&(t=r)}return t}judgeShow(i,t){if(!i||!this.options.contentOptions)return!1;!t&&i.domNode&&(t=i.domNode);const e=this.options.contentOptions.find(o=>o.blotName===i.statics.blotName);if(!e)return!1;if(this.activeEle===t)return!0;const s=e.limit||{};return!s.minWidth||s.minWidth&&t.offsetWidth>=s.minWidth?(this.activeEle&&this.hide(),this.activeEle=t,this.blot=i,this.showOverlay(),this.initializeModules(),!0):!1}handleChange(i,t,e){if(this.updateFromModule){this.updateFromModule=!1;return}e!=="user"||!this.overlay||!this.activeEle||this.onUpdate()}showOverlay(){this.overlay&&this.hideOverlay(),this.quill.setSelection(null),this.previousBodyUserSelect=document.body.style.userSelect,this.previousRootUserSelect=this.quill.root.style.userSelect,document.body.style.userSelect="none",this.quill.root.style.userSelect="none",this.overlay=document.createElement("div"),this.overlay.className=`${u.S[g.OVERLAY]}`,this.quill.container.appendChild(this.overlay),this.hideProxy=()=>this.activeEle&&this.hide(),this.updateOverlayPositionProxy=()=>this.scheduleOverlayMarginSync(),this.quill.root.addEventListener("input",this.hideProxy,!0),this.quill.root.addEventListener("scroll",this.updateOverlayPositionProxy,{passive:!0}),this.repositionElements()}hideOverlay(){this.overlay&&(this.overlayScrollAnimationFrame!==null&&(cancelAnimationFrame(this.overlayScrollAnimationFrame),this.overlayScrollAnimationFrame=null),this.pendingOverlayMarginTop=null,this.overlay.remove(),this.overlay=void 0,this.hideProxy&&this.quill.root.removeEventListener("input",this.hideProxy,!0),this.updateOverlayPositionProxy&&this.quill.root.removeEventListener("scroll",this.updateOverlayPositionProxy),this.hideProxy=null,this.updateOverlayPositionProxy=null,this.previousBodyUserSelect!==null&&(document.body.style.userSelect=this.previousBodyUserSelect,this.previousBodyUserSelect=null),this.previousRootUserSelect!==null&&(this.quill.root.style.userSelect=this.previousRootUserSelect,this.previousRootUserSelect=null))}repositionElements(){if(!this.overlay||!this.activeEle)return;const i=this.quill.container,t=this.activeEle.getBoundingClientRect(),e=i.getBoundingClientRect();Object.assign(this.overlay.style,{left:`${t.left-e.left-1+i.scrollLeft}px`,top:`${t.top-e.top+this.quill.root.scrollTop}px`,width:`${t.width}px`,height:`${t.height}px`,marginTop:-1*this.quill.root.scrollTop+"px"})}addBlotsSelectedClass(i){if(!i){this.selectedBlots=[];return}try{const t=s=>{var o;return["image","iframe","video"].includes((o=s.statics)==null?void 0:o.blotName)},e=this.quill.scroll.descendants(t,i.index,i.length);this.selectedBlots=e.filter(s=>!s.statics||!this.options.contentOptions?!1:this.options.contentOptions.some(o=>o.blotName===s.statics.blotName))}catch(t){console.warn("Error during blot selection:",t)}}hide(){this.hideOverlay(),this.modules.forEach(i=>i.onDestroy()),this.modules=[],this.activeEle=void 0,this.blot=void 0}scheduleOverlayMarginSync(){this.overlay&&(this.pendingOverlayMarginTop=-1*this.quill.root.scrollTop,this.overlayScrollAnimationFrame===null&&(this.overlayScrollAnimationFrame=requestAnimationFrame(()=>{this.overlayScrollAnimationFrame=null,!(!this.overlay||this.pendingOverlayMarginTop===null)&&(this.overlay.style.marginTop=`${this.pendingOverlayMarginTop}px`,this.pendingOverlayMarginTop=null)})))}}n(C,"Modules",{Base:y,DisplaySize:U,Toolbar:A,Resize:j,Keyboard:b});exports.default=C;
1
+ "use strict";var P=Object.defineProperty;var w=(h,i,t)=>i in h?P(h,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):h[i]=t;var n=(h,i,t)=>w(h,typeof i!="symbol"?i+"":i,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./index-CPRUEkbV.cjs"),g={OVERLAY:"ql-image-resizer-overlay",HANDLE:"ql-image-resizer-handle",DISPLAY:"ql-image-resizer-display",TOOLBAR:"ql-image-resizer-toolbar",TOOLBAR_BUTTON:"ql-image-resizer-toolbar-button"},d={BACKSPACE:8,DELETE:46,LEFT:37,UP:38,RIGHT:39,DOWN:40};function M(h){switch(h.key){case"Backspace":return d.BACKSPACE;case"Delete":return d.DELETE;case"ArrowLeft":return d.LEFT;case"ArrowUp":return d.UP;case"ArrowRight":return d.RIGHT;case"ArrowDown":return d.DOWN;default:return 0}}const q=["tl","tr","br","bl"],F=8;function N(h){var t;const i=new Uint32Array(h);if(typeof((t=globalThis.crypto)==null?void 0:t.getRandomValues)=="function")globalThis.crypto.getRandomValues(i);else{let e=Date.now();for(let s=0;s<h;s++)e=e*1103515245+12345&2147483647,i[s]=e}return Array.from(i,e=>e%62).join("")}const v=(h,i)=>{const t=h?"top":"bottom",e=i?"left":"right",s=h===i?"nwse-resize":"nesw-resize";return{[t]:"-5px",[e]:"-5px",cursor:s}},R={tl:v(!0,!0),tr:v(!0,!1),bl:v(!1,!0),br:v(!1,!1)},O=new Map,L=globalThis;function B(h){const i=O.get(h);if(i)return i;const t=u.ReactDOMServer.renderToString(u.jsxRuntimeExports.jsx(u.AIcon,{icon:h,size:"xs"}));return O.set(h,t),t}const k={modules:["DisplaySize","Toolbar","Resize","Keyboard"],embedTags:["VIDEO","IFRAME"],tools:["left","center","right","justify"],contentOptions:[{attribute:["width"],limit:{minWidth:100},blotName:"image"},{attribute:["width","height"],limit:{minWidth:200,ratio:.5625},blotName:"video"}]},z=u.Quill.import("formats/image");class E extends z{static get ATTRIBUTES(){return["alt","height","width","class","style","data-align"]}static formats(i){return this.ATTRIBUTES.reduce((t,e)=>(i.hasAttribute(e)&&(t[e]=i.getAttribute(e)??""),t),{})}format(i,t){this.constructor.ATTRIBUTES.includes(i)?t?this.domNode.setAttribute(i,t):this.domNode.removeAttribute(i):super.format(i,t)}}n(E,"blotName","image"),n(E,"tagName","img"),n(E,"scope",u.Scope.INLINE);function I(){L.__AEDITOR_IMAGE_BLOT_REGISTERED__||(u.Quill.register("formats/image",E,!0),L.__AEDITOR_IMAGE_BLOT_REGISTERED__=!0)}class y{constructor(i){n(this,"resizer");n(this,"quill");n(this,"overlay");n(this,"activeEle");n(this,"blot");n(this,"options");n(this,"requestUpdate");this.resizer=i,this.quill=i.quill,this.overlay=i.overlay,this.activeEle=i.activeEle,this.blot=i.blot,this.options=i.options,this.requestUpdate=()=>i.scheduleUpdate(!0)}onCreate(){}onDestroy(){}onUpdate(){}}class U extends y{constructor(){super(...arguments);n(this,"display")}onCreate(){var t;this.display=document.createElement("div"),this.display.className=u.S[g.DISPLAY],(t=this.overlay)==null||t.appendChild(this.display)}onUpdate(){if(!this.display||!this.activeEle)return;const[t,e]=[this.activeEle.offsetWidth,this.activeEle.offsetHeight];this.display.textContent=`${t} × ${e}`,this.positionDisplay(t,e)}positionDisplay(t,e){var p;if(!this.display)return;const s=this.display.getBoundingClientRect(),o=t>120&&e>30,l=((p=this.activeEle)==null?void 0:p.style.float)==="right";let r,a,c;o?(r="4px",a="4px",c="auto"):(a=`-${s.height+4}px`,l?(r="auto",c=`-${s.width+4}px`):(r=`-${s.width+4}px`,c="auto")),Object.assign(this.display.style,{right:r,bottom:a,left:c})}}class j extends y{constructor(){super(...arguments);n(this,"boxes",[]);n(this,"dragBox",null);n(this,"dragStartX",0);n(this,"dragStartY",0);n(this,"contentOption");n(this,"preDragSize",{width:0,height:0});n(this,"naturalSize",[0,0]);n(this,"handleDragProxy",null);n(this,"handleMouseupProxy",null);n(this,"dragAnimationFrame",null);n(this,"pendingDragEvent",null);n(this,"handleMousedown",t=>{t.button!==0||!this.blot||!this.activeEle||(t.preventDefault(),t.stopPropagation(),this.cancelDragFrame(),this.removeEventListeners(),this.dragBox=t.target,this.dragStartX=t.clientX,this.dragStartY=t.clientY,this.preDragSize={width:this.activeEle.offsetWidth,height:this.activeEle.offsetHeight},this.naturalSize=this.getNaturalSize(),this.setCursor(globalThis.getComputedStyle(this.dragBox).cursor),this.handleDragProxy=this.handleDrag,this.handleMouseupProxy=this.handleMouseup,document.addEventListener("mousemove",this.handleDragProxy,!0),document.addEventListener("mouseup",this.handleMouseupProxy,!0))});n(this,"handleMouseup",t=>{if(!this.activeEle||!this.blot||!this.contentOption)return;this.cancelDragFrame();const e=this.calcSize(t,this.contentOption.limit);Object.assign(this.activeEle,e),Object.assign(this.activeEle.style,{width:null,height:null}),this.setCursor(""),this.removeEventListeners()});n(this,"handleDrag",t=>{!this.activeEle||!this.blot||!this.contentOption||(t.preventDefault(),this.pendingDragEvent=t,this.dragAnimationFrame===null&&(this.dragAnimationFrame=requestAnimationFrame(()=>{this.dragAnimationFrame=null;const e=this.pendingDragEvent;this.pendingDragEvent=null,!(!e||!this.activeEle||!this.contentOption)&&(Object.assign(this.activeEle.style,this.calcSize(e,{...this.contentOption.limit,unit:!0})),this.requestUpdate())})))});n(this,"handleDoubleClick",t=>{if(!this.blot||!this.activeEle||!this.contentOption)return;t.stopPropagation();const[e,s]=this.naturalSize,o={};this.contentOption.attribute.includes("width")&&(o.width=e),this.contentOption.attribute.includes("height")&&(o.height=s);const l=this.applyConstraints(o,this.contentOption.limit);Object.assign(this.activeEle,l),this.requestUpdate()})}onCreate(){!this.blot||!this.options.contentOptions||(this.contentOption=this.options.contentOptions.find(t=>t.blotName===this.blot.statics.blotName),this.boxes=[],q.forEach(t=>this.addBox(t)))}onDestroy(){this.setCursor(""),this.cancelDragFrame(),this.removeEventListeners(),this.boxes.forEach(t=>{t.removeEventListener("mousedown",this.handleMousedown,!1),t.removeEventListener("dblclick",this.handleDoubleClick,!1)}),this.boxes=[]}addBox(t){var s;const e=document.createElement("div");e.className=`${u.S[g.HANDLE]} ${t}`,e.addEventListener("mousedown",this.handleMousedown,!1),e.addEventListener("dblclick",this.handleDoubleClick,!1),Object.assign(e.style,R[t]),(s=this.overlay)==null||s.appendChild(e),this.boxes.push(e)}removeEventListeners(){this.handleDragProxy&&(document.removeEventListener("mousemove",this.handleDragProxy,!0),this.handleDragProxy=null),this.handleMouseupProxy&&(document.removeEventListener("mouseup",this.handleMouseupProxy,!0),this.handleMouseupProxy=null)}calcSize(t,e={}){var a;if(!this.dragBox||!this.activeEle)return{};const s=t.clientX-this.dragStartX,o=t.clientY-this.dragStartY,l=this.dragBox===this.boxes[0]||this.dragBox===this.boxes[3]?-1:1,r={};return(a=this.contentOption)!=null&&a.attribute?this.contentOption.attribute.forEach(c=>r[c]=this.preDragSize[c]):r.width=this.preDragSize.width,r.width&&(r.width=Math.round(this.preDragSize.width+s*l)),r.height&&(r.height=Math.round(this.preDragSize.height+o*l)),this.applyConstraints(r,e)}constrainDimensionsWithRatio(t,e){const s=e.ratio;let o=this.applyLimit(t,e.minWidth,e.maxWidth),l=o*s;const r=this.applyLimit(l,e.minHeight,e.maxHeight);return r!==l&&(l=r,o=l/s),{rw:o,rh:l}}applyConstraints(t,e={}){const s=typeof t.width=="string"?Number.parseInt(t.width,10):t.width||0,o=typeof t.height=="string"?Number.parseInt(t.height,10):t.height||0;let l=s,r=o;e.ratio?{rw:l,rh:r}=this.constrainDimensionsWithRatio(l,e):(s&&(l=this.applyLimit(l,e.minWidth,e.maxWidth)),o&&(r=this.applyLimit(r,e.minHeight,e.maxHeight)));const a={};return t.width!==void 0&&(a.width=e.unit?`${l}px`:l),t.height!==void 0&&(a.height=e.unit?`${r}px`:r),a}applyLimit(t,e,s){let o=t;return e!==void 0&&(o=Math.max(e,o)),s!==void 0&&(o=Math.min(s,o)),o}getNaturalSize(){if(!this.activeEle)return[0,0];const t=this.activeEle.dataset.size;if(!t){const e=this.activeEle,s=[e.offsetWidth,e.offsetHeight];return e.dataset.size=s.join(","),s}return t.split(",").map(Number)}setCursor(t){[document.body,this.activeEle].forEach(e=>e&&(e.style.cursor=t))}cancelDragFrame(){this.dragAnimationFrame!==null&&(cancelAnimationFrame(this.dragAnimationFrame),this.dragAnimationFrame=null),this.pendingDragEvent=null}}const m=class m extends y{constructor(){super(...arguments);n(this,"keyboardProxy",t=>this.keyboardHandle(t))}static injectInit(t){var s;if(m.injectedQuills.has(t))return;const e=(s=t.keyboard)==null?void 0:s.bindings;e&&([m.keys.LEFT,m.keys.RIGHT].forEach(o=>(e[o]||[]).unshift(m.makeArrowHandler(o))),m.injectedQuills.add(t))}static makeArrowHandler(t){const e=t===m.keys.LEFT;return{key:t,shiftKey:!1,altKey:null,[e?"prefix":"suffix"]:/^$/,handler(s){const o=this.quill;if(!o.resizer)return!0;let l=s.index;const r=t===m.keys.RIGHT,[a]=o.getLine(l+(e?-1:0));if(!a)return!0;if(o.resizer.judgeShow(a))return!1;const c=o.getIndex(a);if(r&&c+a.length()-1===l)return!0;r&&(l+=s.length+1);const[p]=o.getLeaf(l);if(!p)return!0;const x=p.offset(p.parent),D=p.constructor&&"scope"in p.constructor&&p.constructor.scope===u.Scope.BLOCK_BLOT;if(e&&(D&&l===x||l===0||l===c))return!0;let S=p;if(e&&x===0){const[T]=o.getLeaf(l-1);T&&(S=T)}return!S||!o.resizer.judgeShow(S)}}}onCreate(){document.addEventListener("keydown",this.keyboardProxy,!0)}onDestroy(){document.removeEventListener("keydown",this.keyboardProxy,!0)}keyboardHandle(t){if(t.defaultPrevented||t.shiftKey||t.ctrlKey||t.altKey||!this.activeEle||!this.blot)return;const e=M(t);let s=this.blot.offset(this.quill.scroll),o=null,l=!1;e===d.BACKSPACE||e===d.DELETE?(this.handleDelete(),l=!0):e>=d.LEFT&&e<=d.DOWN&&([s,o]=this.handleArrowKeys(e,s),l=!0),l&&(t.stopPropagation(),t.preventDefault()),!(o&&this.resizer.judgeShow(o,o.domNode))&&(this.quill.setSelection(s),this.resizer.hide())}handleDelete(){if(!this.blot)return;const t=this.blot.length();this.blot.deleteAt(0,t),this.blot=void 0,this.activeEle=void 0,this.resizer.hide()}handleArrowKeys(t,e){let s=null;return t===d.RIGHT?e+=this.blot.length()||1:t===d.UP?(e=this.getOtherLineIndex(-1),s=this.quill.getLeaf(e)[0]):t===d.DOWN&&(e=this.getOtherLineIndex(1),s=this.quill.getLeaf(e)[0]),[e,s]}getOtherLineIndex(t){if(!this.blot)return 0;const e=this.blot.offset(this.quill.scroll),[s]=this.quill.getLine(e);if(!s)return e;const o=this.blot.offset(s)+1,l=t>0?s.next:s.prev;if(!l)return e;let r=l.length();return l.statics.blotName==="block"&&r--,l.offset(this.quill.scroll)+Math.min(r,o)}};n(m,"keys",d),n(m,"injectedQuills",new WeakSet);let b=m;const f=class f extends y{constructor(t){super(t);n(this,"toolbar");n(this,"blot");n(this,"tools",{});n(this,"toolbarClickProxy",t=>this.handleToolbarClick(t));this.blot=t.blot}createStyleTool(t,e){const s={left:{float:"left"},right:{float:"right"},center:{display:"block",margin:"0 auto",float:"none"},justify:{display:"block",float:"none",margin:"0",width:"100%"}};return{icon:t,apply:o=>{this.clearAlignmentStyles(o);const l=s[e];Object.assign(o.style,l),o.dataset.align=e},isApplied:o=>{const l=o.style;switch(e){case"center":return l.float==="none";case"justify":return l.display==="block"&&l.width==="100%";case"left":case"right":return l.float===e;default:return!1}}}}clearAlignmentStyles(t){const e=t.dataset.align;t.style.removeProperty("display"),t.style.removeProperty("float"),t.style.removeProperty("margin"),e==="justify"&&t.style.removeProperty("width"),delete t.dataset.align}onCreate(){var t;this.toolbar=document.createElement("div"),this.toolbar.className=u.S[g.TOOLBAR],this.toolbar.addEventListener("click",this.toolbarClickProxy),(t=this.overlay)==null||t.appendChild(this.toolbar),this.initializeTools(),this._addToolbarButtons()}onDestroy(){var t;(t=this.toolbar)==null||t.removeEventListener("click",this.toolbarClickProxy),this.toolbar=void 0}initializeTools(){Object.keys(f.Tools).forEach(t=>{const e=t;this.tools[e]=this.createStyleTool(f.Tools[e].icon,e)})}_addToolbarButtons(){!this.toolbar||!this.activeEle||this.options.tools.forEach(t=>{const e=this.tools[t];if(!e)return;const s=document.createElement("button");s.type="button",s.className=u.S[g.TOOLBAR_BUTTON],s.innerHTML=B(e.icon),s.dataset.tool=t,e.isApplied&&this.activeEle&&e.isApplied.call(this,this.activeEle)&&(s.style.backgroundColor="var(--AEditor_Addon_Secondary_color)"),this.toolbar.appendChild(s)})}handleToolbarClick(t){var r,a;if(!this.activeEle||!this.blot||!this.toolbar)return;const e=(r=t.target)==null?void 0:r.closest("button[data-tool]");if(!e||!this.toolbar.contains(e))return;const s=e.dataset.tool;if(!s)return;const o=this.tools[s];if(!o||(t.stopPropagation(),o.handler&&o.handler.call(this,t,e,this.activeEle)!==!0))return;const l=o.isApplied?o.isApplied.call(this,this.activeEle):!1;Array.from(this.toolbar.querySelectorAll("button")).forEach(c=>c.style.backgroundColor=""),l?this.clearAlignmentStyles(this.activeEle):(e.style.backgroundColor="var(--AEditor_Addon_Secondary_color)",(a=o.apply)==null||a.call(o,this.activeEle)),this.requestUpdate()}};n(f,"Tools",{left:{icon:"AlignLeft"},center:{icon:"AlignCenter"},right:{icon:"AlignRight"},justify:{icon:"AlignJustify"}});let A=f;class C{constructor(i,t={}){n(this,"isDestroyed",!1);n(this,"quill");n(this,"options");n(this,"moduleClasses");n(this,"modules",[]);n(this,"blot");n(this,"selectedBlots",[]);n(this,"embedClassName","");n(this,"activeEle");n(this,"overlay");n(this,"updateFromModule",!1);n(this,"hideProxy",null);n(this,"updateOverlayPositionProxy",null);n(this,"embedStyleElement",null);n(this,"updateAnimationFrame",null);n(this,"overlayScrollAnimationFrame",null);n(this,"pendingOverlayMarginTop",null);n(this,"scheduledFromModule",!1);n(this,"previousBodyUserSelect",null);n(this,"previousRootUserSelect",null);n(this,"handleClickProxy",i=>this.handleClick(i));n(this,"handleChangeProxy",(i,t,e)=>this.handleChange(i,t,e));n(this,"handleSelectionChangeProxy",i=>this.addBlotsSelectedClass(i));var s;I(),i.resizer=this,this.isDestroyed=!1,this.quill=i;const e=t.modules?[...t.modules]:null;this.options={...k,...t},e&&(this.options.modules=e),this.moduleClasses=this.options.modules,this.quill.root.addEventListener("mousedown",this.handleClickProxy,!1),this.quill.on("text-change",this.handleChangeProxy),this.quill.container.style.position=this.quill.container.style.position||"relative",this.quill.on("selection-change",this.handleSelectionChangeProxy),b.injectInit(this.quill),(s=this.options.embedTags)!=null&&s.length&&this.initializeEmbed()}destroy(){var i;this.isDestroyed||(this.isDestroyed=!0,this.updateAnimationFrame!==null&&(cancelAnimationFrame(this.updateAnimationFrame),this.updateAnimationFrame=null),this.overlayScrollAnimationFrame!==null&&(cancelAnimationFrame(this.overlayScrollAnimationFrame),this.overlayScrollAnimationFrame=null),this.pendingOverlayMarginTop=null,this.hide(),this.quill.root.removeEventListener("mousedown",this.handleClickProxy,!1),this.quill.off("text-change",this.handleChangeProxy),this.quill.off("selection-change",this.handleSelectionChangeProxy),(i=this.embedStyleElement)==null||i.remove(),this.embedStyleElement=null,this.embedClassName&&this.quill.root.classList.remove(this.embedClassName))}initializeModules(){this.modules.forEach(i=>i.onDestroy()),this.modules=[],this.modules=this.moduleClasses.map(i=>new(this.constructor.Modules[i]||i)(this)),this.modules.forEach(i=>i.onCreate()),this.repositionElements(),this.modules.forEach(i=>i.onUpdate())}initializeEmbed(){if(!this.options.embedTags.length)return;this.embedClassName=`ql-${N(F)}`;const i=[""].concat(this.options.embedTags).join(`, .${this.embedClassName} `).slice(2)+"{pointer-events: none;}",t=document.createElement("style");t.textContent=i,this.embedStyleElement=t,this.quill.container.appendChild(t),this.quill.root.classList.add(this.embedClassName)}scheduleUpdate(i){this.scheduledFromModule=this.scheduledFromModule||!!i,this.updateAnimationFrame===null&&(this.updateAnimationFrame=requestAnimationFrame(()=>{this.updateAnimationFrame=null;const t=this.scheduledFromModule;this.scheduledFromModule=!1,this.onUpdate(t)}))}onUpdate(i){this.updateFromModule=!!i,this.repositionElements(),this.modules.forEach(t=>t.onUpdate())}resolveMediaTarget(i){if(!(i instanceof HTMLElement))return null;const t=["img","iframe","video",".ql-video"].join(", ");if(i.matches(t))return i;const e=i.closest(t);return e||null}handleClick(i){if(this.overlay&&(i.target===this.overlay||this.overlay.contains(i.target)))return;let t=i.target;if(t=this.getEventTarget(i,t),t!=null&&t.tagName){const e=this.quill.scroll.find(t);if(e&&this.judgeShow(e,t)){i.preventDefault();return}}this.activeEle&&this.hide()}getEventTarget(i,t){var l;const e=(l=this.options.embedTags)==null?void 0:l.join(),s=this.resolveMediaTarget(t);if(s)return s;if(typeof document.elementsFromPoint=="function"){const r=document.elementsFromPoint(i.clientX,i.clientY).map(a=>this.resolveMediaTarget(a)).find(a=>!!a&&this.quill.root.contains(a));if(r)return r}if(!e)return t;const o=this.quill.root;if(t===o||t.querySelectorAll(e).length){o.classList.remove(this.embedClassName);const r=document.elementFromPoint(i.clientX,i.clientY);o.classList.add(this.embedClassName);const a=this.resolveMediaTarget(r);if(a&&o.contains(a))return a;r&&(t=r)}return t}judgeShow(i,t){if(!i||!this.options.contentOptions)return!1;!t&&i.domNode&&(t=i.domNode);const e=this.options.contentOptions.find(o=>o.blotName===i.statics.blotName);if(!e)return!1;if(this.activeEle===t)return!0;const s=e.limit||{};return!s.minWidth||s.minWidth&&t.offsetWidth>=s.minWidth?(this.activeEle&&this.hide(),this.activeEle=t,this.blot=i,this.showOverlay(),this.initializeModules(),!0):!1}handleChange(i,t,e){if(this.updateFromModule){this.updateFromModule=!1;return}e!=="user"||!this.overlay||!this.activeEle||this.onUpdate()}showOverlay(){this.overlay&&this.hideOverlay(),this.quill.setSelection(null),this.previousBodyUserSelect=document.body.style.userSelect,this.previousRootUserSelect=this.quill.root.style.userSelect,document.body.style.userSelect="none",this.quill.root.style.userSelect="none",this.overlay=document.createElement("div"),this.overlay.className=`${u.S[g.OVERLAY]}`,this.quill.container.appendChild(this.overlay),this.hideProxy=()=>this.activeEle&&this.hide(),this.updateOverlayPositionProxy=()=>this.scheduleOverlayMarginSync(),this.quill.root.addEventListener("input",this.hideProxy,!0),this.quill.root.addEventListener("scroll",this.updateOverlayPositionProxy,{passive:!0}),this.repositionElements()}hideOverlay(){this.overlay&&(this.overlayScrollAnimationFrame!==null&&(cancelAnimationFrame(this.overlayScrollAnimationFrame),this.overlayScrollAnimationFrame=null),this.pendingOverlayMarginTop=null,this.overlay.remove(),this.overlay=void 0,this.hideProxy&&this.quill.root.removeEventListener("input",this.hideProxy,!0),this.updateOverlayPositionProxy&&this.quill.root.removeEventListener("scroll",this.updateOverlayPositionProxy),this.hideProxy=null,this.updateOverlayPositionProxy=null,this.previousBodyUserSelect!==null&&(document.body.style.userSelect=this.previousBodyUserSelect,this.previousBodyUserSelect=null),this.previousRootUserSelect!==null&&(this.quill.root.style.userSelect=this.previousRootUserSelect,this.previousRootUserSelect=null))}repositionElements(){if(!this.overlay||!this.activeEle)return;const i=this.quill.container,t=this.activeEle.getBoundingClientRect(),e=i.getBoundingClientRect();Object.assign(this.overlay.style,{left:`${t.left-e.left-1+i.scrollLeft}px`,top:`${t.top-e.top+this.quill.root.scrollTop}px`,width:`${t.width}px`,height:`${t.height}px`,marginTop:-1*this.quill.root.scrollTop+"px"})}addBlotsSelectedClass(i){if(!i){this.selectedBlots=[];return}try{const t=s=>{var o;return["image","iframe","video"].includes((o=s.statics)==null?void 0:o.blotName)},e=this.quill.scroll.descendants(t,i.index,i.length);this.selectedBlots=e.filter(s=>!s.statics||!this.options.contentOptions?!1:this.options.contentOptions.some(o=>o.blotName===s.statics.blotName))}catch(t){console.warn("Error during blot selection:",t)}}hide(){this.hideOverlay(),this.modules.forEach(i=>i.onDestroy()),this.modules=[],this.activeEle=void 0,this.blot=void 0}scheduleOverlayMarginSync(){this.overlay&&(this.pendingOverlayMarginTop=-1*this.quill.root.scrollTop,this.overlayScrollAnimationFrame===null&&(this.overlayScrollAnimationFrame=requestAnimationFrame(()=>{this.overlayScrollAnimationFrame=null,!(!this.overlay||this.pendingOverlayMarginTop===null)&&(this.overlay.style.marginTop=`${this.pendingOverlayMarginTop}px`,this.pendingOverlayMarginTop=null)})))}}n(C,"Modules",{Base:y,DisplaySize:U,Toolbar:A,Resize:j,Keyboard:b});exports.default=C;
@@ -1,7 +1,7 @@
1
1
  var w = Object.defineProperty;
2
2
  var M = (h, i, t) => i in h ? w(h, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : h[i] = t;
3
3
  var n = (h, i, t) => M(h, typeof i != "symbol" ? i + "" : i, t);
4
- import { S as f, b as C, Q as D, R as q, j as F, A as N } from "./index-B9qg5reR.js";
4
+ import { S as f, b as C, Q as D, R as q, j as F, A as N } from "./index-DDuJ7D9p.js";
5
5
  const g = {
6
6
  OVERLAY: "ql-image-resizer-overlay",
7
7
  HANDLE: "ql-image-resizer-handle",
@@ -1,9 +1,9 @@
1
1
  var B = Object.defineProperty;
2
2
  var q = (n, l, e) => l in n ? B(n, l, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[l] = e;
3
3
  var p = (n, l, e) => q(n, typeof l != "symbol" ? l + "" : l, e);
4
- import { m as I, T as M, l as y, r as U, c as j, s as Y, Q as O, e as x, p as z } from "./index-B9qg5reR.js";
5
- import { randomId as C, blotName as u, TableColFormat as G, TableCellFormat as E, TableCellInnerFormat as H, tableUpSize as _ } from "./index-DmPtSBKF.js";
6
- import { normalizeVideoUrl as X } from "./Video-DMdvJFHX.js";
4
+ import { m as I, T as M, l as y, r as U, c as j, s as Y, Q as O, e as x, p as z } from "./index-DDuJ7D9p.js";
5
+ import { randomId as C, blotName as u, TableColFormat as G, TableCellFormat as E, TableCellInnerFormat as H, tableUpSize as _ } from "./index-xCUqmBUD.js";
6
+ import { normalizeVideoUrl as X } from "./Video-B8tjesz-.js";
7
7
  const T = O.import("delta"), $ = O.import("modules/clipboard"), K = /<table[\s>]/i, Q = /(?:youtube\.com\/watch.*v=|youtu\.be\/)([a-zA-Z0-9_-]+)/, Z = /vimeo\.com\/(\d+)/, R = /* @__PURE__ */ new Set(["", "transparent", "rgba(0,0,0,0)", "rgba(0, 0, 0, 0)"]), N = "data-aeditor-empty-row";
8
8
  function L(n) {
9
9
  if (typeof n == "number" && Number.isFinite(n)) {
@@ -1,4 +1,4 @@
1
- "use strict";var H=Object.defineProperty;var v=(n,l,e)=>l in n?H(n,l,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[l]=e;var p=(n,l,e)=>v(n,typeof l!="symbol"?l+"":l,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("./index-CIZPix6V.cjs"),i=require("./index-DgoWwYvV.cjs"),k=require("./Video-vhWfOFFz.cjs"),T=h.Quill.import("delta"),O=h.Quill.import("modules/clipboard"),W=/<table[\s>]/i,D=/(?:youtube\.com\/watch.*v=|youtu\.be\/)([a-zA-Z0-9_-]+)/,F=/vimeo\.com\/(\d+)/,E=new Set(["","transparent","rgba(0,0,0,0)","rgba(0, 0, 0, 0)"]),A="data-aeditor-empty-row";function w(n){if(typeof n=="number"&&Number.isFinite(n)){const l=Math.floor(n);return l>0?l:1}if(typeof n=="string"){const l=Number.parseInt(n.trim(),10);if(Number.isFinite(l)&&l>0)return l}return 1}function N(n){return!D.test(n)&&!F.test(n)?null:new T().insert({video:k.normalizeVideoUrl(n)}).insert(`
1
+ "use strict";var H=Object.defineProperty;var v=(n,l,e)=>l in n?H(n,l,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[l]=e;var p=(n,l,e)=>v(n,typeof l!="symbol"?l+"":l,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("./index-CPRUEkbV.cjs"),i=require("./index-C5oVnw57.cjs"),k=require("./Video-CINCo-Nb.cjs"),T=h.Quill.import("delta"),O=h.Quill.import("modules/clipboard"),W=/<table[\s>]/i,D=/(?:youtube\.com\/watch.*v=|youtu\.be\/)([a-zA-Z0-9_-]+)/,F=/vimeo\.com\/(\d+)/,E=new Set(["","transparent","rgba(0,0,0,0)","rgba(0, 0, 0, 0)"]),A="data-aeditor-empty-row";function w(n){if(typeof n=="number"&&Number.isFinite(n)){const l=Math.floor(n);return l>0?l:1}if(typeof n=="string"){const l=Number.parseInt(n.trim(),10);if(Number.isFinite(l)&&l>0)return l}return 1}function N(n){return!D.test(n)&&!F.test(n)?null:new T().insert({video:k.normalizeVideoUrl(n)}).insert(`
2
2
  `)}const _=globalThis;function B(){if(_.__AEDITOR_TABLE_CLIPBOARD_STYLES_PATCHED__)return;const n=new Set([...i.TableCellFormat.allowStyle,...h.TABLE_CELL_ALLOWED_STYLE_PREFIXES]);i.TableCellFormat.allowStyle=n,i.TableCellInnerFormat.allowStyle=new Set([...i.TableCellInnerFormat.allowStyle,...h.TABLE_CELL_ALLOWED_STYLE_PREFIXES]),_.__AEDITOR_TABLE_CLIPBOARD_STYLES_PATCHED__=!0}function R(n){let l=Number.parseFloat(n.getAttribute("width")||"");if(Number.isNaN(l)){const e=n.style.width;l=e?Number.parseFloat(e):n.offsetWidth}return l||i.tableUpSize.colDefaultWidth}function P(n,l){const e=Number.parseFloat(l.getComputedStyle(n).width);return Number.isFinite(e)&&e>0?e:R(n)}function q(n){const l=Array.from(n.querySelectorAll("col")).reduce((t,o)=>{const r=Number.parseInt(o.getAttribute("span")||"1",10);return t+(Number.isNaN(r)||r<1?1:r)},0),e=Array.from(n.rows).reduce((t,o)=>{const r=Array.from(o.cells).reduce((s,d)=>s+Math.max(d.colSpan||1,1),0);return Math.max(t,r)},0);return Math.max(l,e)}function x(n,l,e=R){const t=new Array(l).fill(i.tableUpSize.colDefaultWidth),o=Array.from(n.querySelectorAll("tr")),r=[];for(const s of o){const d=Array.from(s.querySelectorAll("td, th"));let a=I(0,L(r));for(const c of d){const u=Math.max(c.colSpan||1,1);if(a=I(a,r),a>=l)break;M(r,a,u,c.rowSpan||1);const m=e(c)/u;for(let b=0;b<u&&a+b<l;b+=1)t[a+b]=m||t[a+b];a+=u}}return t}function S(n){const l=Math.round(n*100)/100;return Number.isFinite(l)&&l>0?l:i.tableUpSize.colDefaultWidth}function U(n,l){const e=n==null?void 0:n.width;let t;if(typeof e=="number")t=e;else if(typeof e=="string")t=Number.parseFloat(e);else return S(l);return Number.isFinite(t)&&t>0?S(t):S(l)}function j(n,l){return typeof(n==null?void 0:n.full)=="boolean"?n.full:Object.hasOwn(l.dataset,"full")||l.querySelector("col[data-full], colgroup[data-full]")!==null}function Y(n){if(!n)return;const l=h.parseInlineStyleText(n)["background-color"];if(!(!l||E.has(l)))return l}function z(n,l,e){let t=n;for(;t;){const o=t===n?e.getComputedStyle(t).getPropertyValue("background-color").trim():e.getComputedStyle(t).backgroundColor.trim();if(o&&!E.has(o))return o;if(t===l)break;t=t.parentElement}}function L(n){for(let l=0;l<n.length;l+=1)n[l]>0&&(n[l]-=1);return n}function I(n,l){let e=n;for(;l[e]>0;)e+=1;return e}function M(n,l,e,t){if(!(t<=1))for(let o=0;o<e;o+=1)n[l+o]=Math.max(n[l+o]||0,t)}class $ extends O{constructor(e,t){B();super(e,t);p(this,"matchCaptionHandler",(e,t)=>this.matchCaption(e,t));p(this,"matchColHandler",(e,t)=>this.matchCol(e,t));p(this,"matchColgroupHandler",(e,t)=>this.matchColgroup(e,t));p(this,"matchTableHandler",(e,t)=>this.matchTable(e,t));p(this,"matchTbodyHandler",(e,t)=>this.matchTbody(e,t));p(this,"matchTdAttributorHandler",(e,t)=>this.matchTdAttributor(e,t));p(this,"matchTdHandler",(e,t)=>this.matchTd(e,t));p(this,"matchTheadHandler",(e,t)=>this.matchThead(e,t));p(this,"matchTrHandler",(e,t)=>this.matchTr(e,t));p(this,"matchTfootHandler",(e,t)=>this.matchTfoot(e,t));p(this,"matchYouTubeLinkHandler",(e,t)=>this.matchYouTubeLink(e,t));p(this,"tableId",i.randomId());p(this,"rowId",i.randomId());p(this,"colIds",[]);p(this,"rowspanCount",[]);p(this,"cellCount",0);p(this,"colCount",0);this.quill=e,this.addMatcher("a",this.matchYouTubeLinkHandler),this.addMatcher("table",this.matchTableHandler),this.addMatcher("thead",this.matchTheadHandler),this.addMatcher("tbody",this.matchTbodyHandler),this.addMatcher("tfoot",this.matchTfootHandler),this.addMatcher("colgroup",this.matchColgroupHandler),this.addMatcher("col",this.matchColHandler),this.addMatcher("tr",this.matchTrHandler),this.addMatcher("td",this.matchTdHandler),this.addMatcher("th",this.matchTdHandler),this.addMatcher("caption",this.matchCaptionHandler),this.addMatcher(Node.ELEMENT_NODE,this.matchTdAttributorHandler)}resetTableState(){this.tableId=i.randomId(),this.rowId=i.randomId(),this.colIds=[],this.rowspanCount=[],this.cellCount=0,this.colCount=0}getStyleBackgroundColor(e,t){var r;const o=e.style.backgroundColor;if(o)for(const s of t.ops){if(!((r=s.attributes)!=null&&r[i.blotName.tableCellInner]))continue;const{style:d,...a}=s.attributes[i.blotName.tableCellInner];if(Y(d))continue;const c=h.mergeInlineStyles(d,`background-color:${o}`);s.attributes[i.blotName.tableCellInner]={...a,style:c}}}matchYouTubeLink(e,t){const r=e.getAttribute("href")||"";return N(r)??t}readPreprocessedColumnWidths(e){const t=e.getAttribute(h.TABLE_COLUMN_WIDTHS_DATA_ATTRIBUTE);if(!t)return null;const o=t.split(",").map(r=>Number.parseFloat(r)).filter(r=>Number.isFinite(r)&&r>0).map(r=>S(r));return o.length?o:null}matchTable(e,t){if(t.ops.length===0)return t;const o=[],r=[];let s=-1;for(const f of t.ops){const{attributes:m,insert:b}=f;if(!h.lodashExports.isObject(b)&&(!m||!m[i.blotName.tableCellInner]&&!m[i.blotName.tableCaption]))continue;const{table:C,[i.blotName.tableCell]:g,...y}=m||{};if(h.lodashExports.isObject(b)&&b[i.blotName.tableCol]){r.push({insert:b});continue}o.push({attributes:y,insert:b}),!(y!=null&&y[i.blotName.tableCellInner])&&!(y!=null&&y[i.blotName.tableCaption])&&h.lodashExports.isString(b)&&b.trim().length>0&&(s=o.length-1)}const d=e,c=(this.readPreprocessedColumnWidths(d)??x(d,this.colIds.length)).map((f,m)=>{var y;const b=(y=r[m])==null?void 0:y.insert,C=h.lodashExports.isObject(b)?b[i.blotName.tableCol]:void 0,g=h.lodashExports.isObject(C)?C:void 0;return{insert:{[i.blotName.tableCol]:{...g,tableId:this.tableId,colId:this.colIds[m],width:U(g,f),full:j(g,d)}}}});o.splice(s+1,0,...c);const u=new T(o);return this.getStyleBackgroundColor(e,u),this.resetTableState(),u}createEmptyRowIdsForPlainInsert(e){let t=0;e&&(t=h.lodashExports.isString(e)?e.split(`
3
3
  `).length-1:1);const o=[];for(let r=0;r<t;r+=1)o.push(i.randomId());return o}mergeEmptyRowsIntoCellValue(e,t){const o=w(e.rowspan),r=Math.max(o-1,0);if(t.length===0||r===0)return;const s=t.slice(0,r);e.emptyRow??(e.emptyRow=[]),s.length>e.emptyRow.length&&e.emptyRow.push(...s.slice(e.emptyRow.length))}matchTbody(e,t){var r,s;this.getStyleBackgroundColor(e,t);let o=[];for(let d=t.ops.length-1;d>=0;d-=1){const a=t.ops[d];if(!((r=a.attributes)!=null&&r[i.blotName.tableCellInner])){o=(s=a.attributes)!=null&&s[A]?this.createEmptyRowIdsForPlainInsert(a.insert):[];continue}const c=a.attributes[i.blotName.tableCellInner];if(w(c.rowspan)<=1){o=[];continue}this.mergeEmptyRowsIntoCellValue(c,o)}return this.rowspanCount=[],t}matchThead(e,t){const o=this.matchTbody(e,t);return this.applySectionWrapTag(o,"thead"),o}matchTfoot(e,t){const o=this.matchTbody(e,t);return this.applySectionWrapTag(o,"tfoot"),o}applySectionWrapTag(e,t){var o;for(const r of e.ops)(o=r.attributes)!=null&&o[i.blotName.tableCellInner]&&(r.attributes[i.blotName.tableCellInner].wrapTag=t)}matchColgroup(e,t){const o=t.ops.filter(r=>h.lodashExports.isObject(r.insert)&&r.insert[i.blotName.tableCol]);return new T(o)}matchCol(e,t){let o=Number.parseInt(e.getAttribute("span")||"1",10);(Number.isNaN(o)||o<1)&&(o=1);const r=new T;for(let s=0;s<o;s+=1)this.colIds[this.colCount]=i.randomId(),r.insert({[i.blotName.tableCol]:Object.assign(i.TableColFormat.value(e),{tableId:this.tableId,colId:this.colIds[this.colCount]})}),this.colCount+=1;return r}matchTr(e,t){return this.rowId=i.randomId(),this.cellCount=I(0,L(this.rowspanCount)),this.getStyleBackgroundColor(e,t),t.ops.length===0?new T([{attributes:{[A]:!0},insert:`
4
4
  `}]):t}matchTd(e,t){const o=e,r=i.TableCellFormat.formats(o),s=Math.max(r.colspan||1,1);this.cellCount=I(this.cellCount,this.rowspanCount),this.ensureColumnSlots(this.cellCount+s),M(this.rowspanCount,this.cellCount,s,r.rowspan||1);const d=this.colIds[this.cellCount];this.cellCount+=s;const a=Object.assign(r,{tableId:this.tableId,rowId:this.rowId,colId:d});this.handleBorderNoneStyles(o,a);const c=t.ops.map(f=>{const{attributes:m={},...b}=f,{[i.blotName.tableCell]:C,...g}=m;return{...b,attributes:{...g,[i.blotName.tableCellInner]:a}}}),u=c.at(-1);return(!c.length||!h.lodashExports.isString(u==null?void 0:u.insert)||!u.insert.endsWith(`
@@ -1,6 +1,6 @@
1
- import { Q as I } from "./index-B9qg5reR.js";
2
- import { TableSelection as X } from "./index-DmPtSBKF.js";
3
- import { a as Y, b as w, c as F, d as G } from "./TableUpLogical-b63j81zc.js";
1
+ import { Q as I } from "./index-DDuJ7D9p.js";
2
+ import { TableSelection as X } from "./index-xCUqmBUD.js";
3
+ import { a as Y, b as w, c as F, d as G } from "./TableUpLogical-Deo7zQ8T.js";
4
4
  function C(s) {
5
5
  return w(s);
6
6
  }
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const I=require("./index-CIZPix6V.cjs"),O=require("./index-DgoWwYvV.cjs"),p=require("./TableUpLogical-DraICC-w.cjs");function P(s){return p.buildDomTableGrid(s)}function X(s){const t=s.domNode.closest("td, th");return t instanceof HTMLTableCellElement?t:null}function Y(s,t){const e=s.getBoundingClientRect(),o=t.right-t.left,l=t.bottom-t.top,n=t.left-e.left+s.scrollLeft,i=t.top-e.top+s.scrollTop;return{height:l,width:o,x:n,x1:n+o,y:i,y1:i+l}}function m(s,t){const e=t??P(s);if(!e)return null;const o=p.buildDomTableGeometry(e);return o?{geometry:o,grid:e}:null}function T(s,t){const e=t.tableRect;return e.right<=e.left||e.bottom<=e.top?null:{x:Math.min(Math.max(s.x,e.left+.5),e.right-.5),y:Math.min(Math.max(s.y,e.top+.5),e.bottom-.5)}}function B(s,t,e){const o=T(s,e),l=T(t,e);return!o||!l?null:{x:Math.min(o.x,l.x),x1:Math.max(o.x,l.x),y:Math.min(o.y,l.y),y1:Math.max(o.y,l.y)}}function w(s,t,e){if(e){const n=s.x1<t.left||s.x>t.right,i=s.y1<t.top||s.y>t.bottom;return!(n||i)}const o=s.x1<=t.left||s.x>=t.right,l=s.y1<=t.top||s.y>=t.bottom;return!(o||l)}function F(s,t,e){const o=[],l=Array.from(t.placements.values()).map((r,c)=>({cell:r.cell,index:c}));let n=s,i=!0;for(;i;){i=!1;for(let r=0;r<l.length;r+=1){const c=l[r],a=e.cellRects.get(c.cell);if(!a)continue;const u={bottom:Math.floor(a.bottom),left:Math.floor(a.left),right:Math.floor(a.right),top:Math.floor(a.top)},d={x:Math.floor(n.x),x1:Math.floor(n.x1),y:Math.floor(n.y),y1:Math.floor(n.y1)};if(w(d,u,o.length===0)){o.push(c),l.splice(r,1),n={x:Math.min(n.x,u.left),x1:Math.max(n.x1,u.right),y:Math.min(n.y,u.top),y1:Math.max(n.y1,u.bottom)},i=!0;break}}}return o.toSorted((r,c)=>r.index-c.index).map(({cell:r})=>r)}function C(s,t,e){const o=t.map(n=>e.cellRects.get(n)).filter(n=>!!n),l=p.resolveViewportRectBounds(o);return l?Y(s,l):null}class G extends O.TableSelection{resolveSelectedCellsFromBoundary(t,e,o,l){const n=l?{geometry:l,grid:o??P(t)}:m(t,o);if(!(n!=null&&n.grid))return[];const{geometry:i,grid:r}=n,c=p.resolveRectangularSelection(r,F(e,r,i));if(!c)return[];const a=c.cells.reduce((d,f)=>{const h=I.Quill.find(f);return h&&d.push(h.getCellInner()),d},[]),u=C(this.quill.root,c.cells,i);return!u||a.length===0?[]:(this.boundary=u,a)}computeSelectedTds(t,e){if(!this.table)return[];const o=this.table,l=m(o);if(!l)return[];const{geometry:n,grid:i}=l,r=B(t,e,n);return r?this.resolveSelectedCellsFromBoundary(o,r,i,n):[]}tableSelectHandler(t){const{button:e,target:o,clientX:l,clientY:n}=t,i=o instanceof HTMLElement?o:null,r=i==null?void 0:i.closest("table"),c=i==null?void 0:i.closest("caption");if(e!==0||!r||c)return;const a={x:l,y:n};this.setSelectionTable(r);const u=r.dataset.tableId;this.recordScrollPosition(),this.setSelectedTds(this.computeSelectedTds(a,a)),this.show();const d=R=>{this.dragging=!0;const{button:L,target:b,clientX:g,clientY:x}=R,y=b instanceof HTMLElement?b:null,E=y==null?void 0:y.closest("caption");if(L!==0||E||r.dataset.tableId!==u)return;const q={x:g,y:x},v=m(r);if(!v)return;const{geometry:M,grid:H}=v,S=B(a,q,M);S&&(this.setSelectedTds(this.resolveSelectedCellsFromBoundary(r,S,H,M)),this.selectedTds.length>1&&this.quill.blur(),this.update(),this.autoScroller.updateMousePosition(g,x))},f=()=>{document.body.removeEventListener("mousemove",d,!1),document.body.removeEventListener("mouseup",f,!1),this.autoScroller.stop(),this.dragging=!1,this.clearRecordScrollPosition()};document.body.addEventListener("mousemove",d,!1),document.body.addEventListener("mouseup",f,!1);const h=r.parentElement;h&&(this.autoScroller.updateMousePosition(l,n),this.autoScroller.start(h))}updateWithSelectedTds(){if(this.selectedTds.length<=0){this.hide();return}if(!this.table){this.hide();return}const t=m(this.table);if(!t){this.hide();return}const e=this.selectedTds.reduce((l,n)=>{const i=X(n);return i&&l.push(i),l},[]),o=C(this.quill.root,e,t.geometry);if(!o){this.hide();return}this.boundary=o,this.update()}}exports.default=G;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const I=require("./index-CPRUEkbV.cjs"),O=require("./index-C5oVnw57.cjs"),p=require("./TableUpLogical-CMAk-fuC.cjs");function P(s){return p.buildDomTableGrid(s)}function X(s){const t=s.domNode.closest("td, th");return t instanceof HTMLTableCellElement?t:null}function Y(s,t){const e=s.getBoundingClientRect(),o=t.right-t.left,l=t.bottom-t.top,n=t.left-e.left+s.scrollLeft,i=t.top-e.top+s.scrollTop;return{height:l,width:o,x:n,x1:n+o,y:i,y1:i+l}}function m(s,t){const e=t??P(s);if(!e)return null;const o=p.buildDomTableGeometry(e);return o?{geometry:o,grid:e}:null}function T(s,t){const e=t.tableRect;return e.right<=e.left||e.bottom<=e.top?null:{x:Math.min(Math.max(s.x,e.left+.5),e.right-.5),y:Math.min(Math.max(s.y,e.top+.5),e.bottom-.5)}}function B(s,t,e){const o=T(s,e),l=T(t,e);return!o||!l?null:{x:Math.min(o.x,l.x),x1:Math.max(o.x,l.x),y:Math.min(o.y,l.y),y1:Math.max(o.y,l.y)}}function w(s,t,e){if(e){const n=s.x1<t.left||s.x>t.right,i=s.y1<t.top||s.y>t.bottom;return!(n||i)}const o=s.x1<=t.left||s.x>=t.right,l=s.y1<=t.top||s.y>=t.bottom;return!(o||l)}function F(s,t,e){const o=[],l=Array.from(t.placements.values()).map((r,c)=>({cell:r.cell,index:c}));let n=s,i=!0;for(;i;){i=!1;for(let r=0;r<l.length;r+=1){const c=l[r],a=e.cellRects.get(c.cell);if(!a)continue;const u={bottom:Math.floor(a.bottom),left:Math.floor(a.left),right:Math.floor(a.right),top:Math.floor(a.top)},d={x:Math.floor(n.x),x1:Math.floor(n.x1),y:Math.floor(n.y),y1:Math.floor(n.y1)};if(w(d,u,o.length===0)){o.push(c),l.splice(r,1),n={x:Math.min(n.x,u.left),x1:Math.max(n.x1,u.right),y:Math.min(n.y,u.top),y1:Math.max(n.y1,u.bottom)},i=!0;break}}}return o.toSorted((r,c)=>r.index-c.index).map(({cell:r})=>r)}function C(s,t,e){const o=t.map(n=>e.cellRects.get(n)).filter(n=>!!n),l=p.resolveViewportRectBounds(o);return l?Y(s,l):null}class G extends O.TableSelection{resolveSelectedCellsFromBoundary(t,e,o,l){const n=l?{geometry:l,grid:o??P(t)}:m(t,o);if(!(n!=null&&n.grid))return[];const{geometry:i,grid:r}=n,c=p.resolveRectangularSelection(r,F(e,r,i));if(!c)return[];const a=c.cells.reduce((d,f)=>{const h=I.Quill.find(f);return h&&d.push(h.getCellInner()),d},[]),u=C(this.quill.root,c.cells,i);return!u||a.length===0?[]:(this.boundary=u,a)}computeSelectedTds(t,e){if(!this.table)return[];const o=this.table,l=m(o);if(!l)return[];const{geometry:n,grid:i}=l,r=B(t,e,n);return r?this.resolveSelectedCellsFromBoundary(o,r,i,n):[]}tableSelectHandler(t){const{button:e,target:o,clientX:l,clientY:n}=t,i=o instanceof HTMLElement?o:null,r=i==null?void 0:i.closest("table"),c=i==null?void 0:i.closest("caption");if(e!==0||!r||c)return;const a={x:l,y:n};this.setSelectionTable(r);const u=r.dataset.tableId;this.recordScrollPosition(),this.setSelectedTds(this.computeSelectedTds(a,a)),this.show();const d=R=>{this.dragging=!0;const{button:L,target:b,clientX:g,clientY:x}=R,y=b instanceof HTMLElement?b:null,E=y==null?void 0:y.closest("caption");if(L!==0||E||r.dataset.tableId!==u)return;const q={x:g,y:x},v=m(r);if(!v)return;const{geometry:M,grid:H}=v,S=B(a,q,M);S&&(this.setSelectedTds(this.resolveSelectedCellsFromBoundary(r,S,H,M)),this.selectedTds.length>1&&this.quill.blur(),this.update(),this.autoScroller.updateMousePosition(g,x))},f=()=>{document.body.removeEventListener("mousemove",d,!1),document.body.removeEventListener("mouseup",f,!1),this.autoScroller.stop(),this.dragging=!1,this.clearRecordScrollPosition()};document.body.addEventListener("mousemove",d,!1),document.body.addEventListener("mouseup",f,!1);const h=r.parentElement;h&&(this.autoScroller.updateMousePosition(l,n),this.autoScroller.start(h))}updateWithSelectedTds(){if(this.selectedTds.length<=0){this.hide();return}if(!this.table){this.hide();return}const t=m(this.table);if(!t){this.hide();return}const e=this.selectedTds.reduce((l,n)=>{const i=X(n);return i&&l.push(i),l},[]),o=C(this.quill.root,e,t.geometry);if(!o){this.hide();return}this.boundary=o,this.update()}}exports.default=G;
@@ -1,6 +1,6 @@
1
- import { Q as b } from "./index-B9qg5reR.js";
2
- import S, { TableSelection as x, findParentBlot as I, blotName as m, randomId as f, TableCellInnerFormat as v, findParentBlots as N } from "./index-DmPtSBKF.js";
3
- import { b as p, r as y } from "./TableUpLogical-b63j81zc.js";
1
+ import { Q as b } from "./index-DDuJ7D9p.js";
2
+ import S, { TableSelection as x, findParentBlot as I, blotName as m, randomId as f, TableCellInnerFormat as v, findParentBlots as N } from "./index-xCUqmBUD.js";
3
+ import { b as p, r as y } from "./TableUpLogical-Deo7zQ8T.js";
4
4
  class R extends S {
5
5
  getTableSelectionModule() {
6
6
  return this.getModule(x.moduleName);
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("./index-CIZPix6V.cjs"),d=require("./index-DgoWwYvV.cjs"),w=require("./TableUpLogical-DraICC-w.cjs");class p extends d.default{getTableSelectionModule(){return this.getModule(d.TableSelection.moduleName)}resolveSelectedCells(t){var e;return t.length>0?t:((e=this.getTableSelectionModule())==null?void 0:e.selectedTds)||[]}moveSelectionToCell(t){const e=this.quill.getIndex(t);this.quill.focus(),this.quill.setSelection({index:e,length:0},b.Quill.sources.SILENT)}clearDisplayedSelection(){var t;(t=this.getTableSelectionModule())==null||t.hide()}resolveSplitTargetCell(t){if(t.length===1)return t[0];const e=this.getTableSelectionModule();if((e==null?void 0:e.selectedTds.length)===1)return e.selectedTds[0];const l=this.quill.getSelection();if(!l)return null;const[s]=this.quill.getLine(l.index);if(!s)return null;try{return d.findParentBlot(s,d.blotName.tableCellInner)}catch{return null}}resolveTableCellNode(t){const e=t.domNode.closest("td, th");return e instanceof HTMLTableCellElement?e:null}resolveCellInnerFromNode(t){const e=b.Quill.find(t);return(e==null?void 0:e.getCellInner())??null}readElementHeight(t){if(!(t instanceof HTMLElement))return null;const e=t.getBoundingClientRect().height;return Number.isFinite(e)&&e>0?Math.round(e*100)/100:null}applyCellHeight(t,e){e===null||e<=0||t.setFormatValue("height",`${Math.round(e*100)/100}px`,!0)}resolveUniqueId(t,e){const l=t==null?void 0:t.trim();if(l&&!e.has(l))return e.add(l),l;let s=d.randomId();for(;e.has(s);)s=d.randomId();return e.add(s),s}normalizeTableStructure(t){const e=t.domNode;if(!(e instanceof HTMLTableElement))return;const l=w.buildDomTableGrid(e);if(!l)return;const s=e.dataset.tableId||t.tableId||d.randomId();e.dataset.tableId=s;const h=t.getRows(),a=t.getCols();if(h.length<l.rows.length||a.length<l.colIds.length)return;const c=new Set,u=l.rows.map((n,i)=>{var I;const o=h[i],g=n.dataset.wrapTag||((I=n.parentElement)==null?void 0:I.tagName.toLowerCase())||"tbody",f=this.resolveUniqueId(n.dataset.rowId,c);return o.setFormatValue("table-id",s),o.setFormatValue("row-id",f),o.setFormatValue("wrap-tag",g),{rowId:f,wrapTag:g}}),m=new Set,r=Array.from({length:l.colIds.length},(n,i)=>{const o=a[i],g=this.resolveUniqueId(o==null?void 0:o.domNode.dataset.colId,m);return o.domNode.dataset.tableId=s,o.domNode.dataset.colId=g,g});t.getBodys().forEach(n=>{n.domNode.dataset.tableId=s}),t.descendants(d.TableCellInnerFormat).forEach(n=>{n.emptyRow=[]}),Array.from(l.placements.values()).forEach(n=>{const i=b.Quill.find(n.cell),o=i==null?void 0:i.getCellInner();if(!o)return;const g=u[n.rowIndex],f=(g==null?void 0:g.rowId)||d.randomId(),I=(g==null?void 0:g.wrapTag)||"tbody",C=r[n.colIndex]||d.randomId();o.setFormatValue("table-id",s),o.setFormatValue("row-id",f),o.setFormatValue("col-id",C),o.setFormatValue("rowspan",n.rowspan),o.setFormatValue("colspan",n.colspan),o.setFormatValue("wrap-tag",I),o.setFormatValue("tag",n.cell.tagName.toLowerCase()),o.emptyRow=[]}),t.checkEmptyRow(!1),this.quill.update(b.Quill.sources.SILENT)}normalizeTableForCell(t){if(t)try{const e=d.findParentBlot(t,d.blotName.tableMain);this.normalizeTableStructure(e)}catch{}}resolveStableMergeSelection(t){if(t.length<=1)return null;const e=d.findParentBlot(t[0],d.blotName.tableMain);if(!e)return null;this.normalizeTableStructure(e);const l=e.domNode;if(!(l instanceof HTMLTableElement))return null;const s=w.buildDomTableGrid(l);if(!s)return null;const h=t.reduce((r,n)=>{const i=this.resolveTableCellNode(n);return i&&r.push(i),r},[]),a=w.resolveMergePlan(s,h);if(!a)return null;const c=a.cells.reduce((r,n)=>{const i=this.resolveCellInnerFromNode(n);return i&&r.push(i),r},[]),u=this.resolveCellInnerFromNode(a.baseCell);if(!u||c.length!==a.cells.length)return null;const m=s.rows.slice(a.rowStartIndex,a.rowEndIndex+1).reduce((r,n)=>{const i=this.readElementHeight(n);return i===null?r:(r??0)+i},null);return{baseCell:u,cells:c,colCount:a.colEndIndex-a.colStartIndex+1,rowCount:a.rowEndIndex-a.rowStartIndex+1,totalHeight:m}}mergeStableSelection(t){const{baseCell:e,cells:l,colCount:s,rowCount:h}=t,a=e.getTableBody();let c=e.getTableRow();if(!a||!c)return;for(let r=1;r<l.length;r+=1){const n=l[r],i=n.getTableBody();if(i&&i!==a){const o=n.getTableRow();o&&(c.parent.insertBefore(o,c.next),c=o)}}a.convertBody(e.wrapTag);for(let r=1;r<l.length;r+=1){const n=l[r];n.length()>1&&n.moveChildren(e),n.parent.remove()}e.colspan=s,e.rowspan=h;const u=this.quill.getIndex(e);this.quill.setSelection({index:u,length:0},b.Quill.sources.SILENT);const m=d.findParentBlot(e,d.blotName.tableMain);this.fixTableByRemove(m)}resolveSplitCellHeights(t){const[e,l]=d.findParentBlots(t,[d.blotName.tableMain,d.blotName.tableRow]),s=e.getRows(),h=s.indexOf(l);if(h<0)return null;const a=Array.from({length:t.rowspan},(m,r)=>{const n=s[h+r],i=this.readElementHeight((n==null?void 0:n.domNode)??null);if(i!==null)return i;const o=this.readElementHeight(this.resolveTableCellNode(t));return o!==null&&t.rowspan>0?o/t.rowspan:null}),c=t.getColumnIndex(),u=e.getColIds().slice(c,c+t.colspan);return u.length===0?null:{colIds:u,rowHeights:a,startRowIndex:h,tableBlot:e}}syncSplitCellHeights(t,e,l,s){const h=t.getRows();s.forEach((a,c)=>{if(a===null)return;const u=h[e+c];u&&l.forEach(m=>{const r=u.getCellByColId(m,"next"),n=r==null?void 0:r.getCellInner();!n||n.rowId!==u.rowId||n.colId!==m||this.applyCellHeight(n,a)})})}mergeCells(t){const e=this.resolveSelectedCells(t),l=this.resolveStableMergeSelection(e);l&&(this.clearDisplayedSelection(),this.mergeStableSelection(l),this.applyCellHeight(l.baseCell,l.totalHeight),this.moveSelectionToCell(l.baseCell))}splitCell(t){const e=this.resolveSplitTargetCell(t);if(!e)return;this.normalizeTableForCell(e);const l=this.resolveSplitCellHeights(e);this.clearDisplayedSelection(),super.splitCell([e]),l&&this.syncSplitCellHeights(l.tableBlot,l.startRowIndex,l.colIds,l.rowHeights),this.moveSelectionToCell(e)}}exports.default=p;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("./index-CPRUEkbV.cjs"),d=require("./index-C5oVnw57.cjs"),w=require("./TableUpLogical-CMAk-fuC.cjs");class p extends d.default{getTableSelectionModule(){return this.getModule(d.TableSelection.moduleName)}resolveSelectedCells(t){var e;return t.length>0?t:((e=this.getTableSelectionModule())==null?void 0:e.selectedTds)||[]}moveSelectionToCell(t){const e=this.quill.getIndex(t);this.quill.focus(),this.quill.setSelection({index:e,length:0},b.Quill.sources.SILENT)}clearDisplayedSelection(){var t;(t=this.getTableSelectionModule())==null||t.hide()}resolveSplitTargetCell(t){if(t.length===1)return t[0];const e=this.getTableSelectionModule();if((e==null?void 0:e.selectedTds.length)===1)return e.selectedTds[0];const l=this.quill.getSelection();if(!l)return null;const[s]=this.quill.getLine(l.index);if(!s)return null;try{return d.findParentBlot(s,d.blotName.tableCellInner)}catch{return null}}resolveTableCellNode(t){const e=t.domNode.closest("td, th");return e instanceof HTMLTableCellElement?e:null}resolveCellInnerFromNode(t){const e=b.Quill.find(t);return(e==null?void 0:e.getCellInner())??null}readElementHeight(t){if(!(t instanceof HTMLElement))return null;const e=t.getBoundingClientRect().height;return Number.isFinite(e)&&e>0?Math.round(e*100)/100:null}applyCellHeight(t,e){e===null||e<=0||t.setFormatValue("height",`${Math.round(e*100)/100}px`,!0)}resolveUniqueId(t,e){const l=t==null?void 0:t.trim();if(l&&!e.has(l))return e.add(l),l;let s=d.randomId();for(;e.has(s);)s=d.randomId();return e.add(s),s}normalizeTableStructure(t){const e=t.domNode;if(!(e instanceof HTMLTableElement))return;const l=w.buildDomTableGrid(e);if(!l)return;const s=e.dataset.tableId||t.tableId||d.randomId();e.dataset.tableId=s;const h=t.getRows(),a=t.getCols();if(h.length<l.rows.length||a.length<l.colIds.length)return;const c=new Set,u=l.rows.map((n,i)=>{var I;const o=h[i],g=n.dataset.wrapTag||((I=n.parentElement)==null?void 0:I.tagName.toLowerCase())||"tbody",f=this.resolveUniqueId(n.dataset.rowId,c);return o.setFormatValue("table-id",s),o.setFormatValue("row-id",f),o.setFormatValue("wrap-tag",g),{rowId:f,wrapTag:g}}),m=new Set,r=Array.from({length:l.colIds.length},(n,i)=>{const o=a[i],g=this.resolveUniqueId(o==null?void 0:o.domNode.dataset.colId,m);return o.domNode.dataset.tableId=s,o.domNode.dataset.colId=g,g});t.getBodys().forEach(n=>{n.domNode.dataset.tableId=s}),t.descendants(d.TableCellInnerFormat).forEach(n=>{n.emptyRow=[]}),Array.from(l.placements.values()).forEach(n=>{const i=b.Quill.find(n.cell),o=i==null?void 0:i.getCellInner();if(!o)return;const g=u[n.rowIndex],f=(g==null?void 0:g.rowId)||d.randomId(),I=(g==null?void 0:g.wrapTag)||"tbody",C=r[n.colIndex]||d.randomId();o.setFormatValue("table-id",s),o.setFormatValue("row-id",f),o.setFormatValue("col-id",C),o.setFormatValue("rowspan",n.rowspan),o.setFormatValue("colspan",n.colspan),o.setFormatValue("wrap-tag",I),o.setFormatValue("tag",n.cell.tagName.toLowerCase()),o.emptyRow=[]}),t.checkEmptyRow(!1),this.quill.update(b.Quill.sources.SILENT)}normalizeTableForCell(t){if(t)try{const e=d.findParentBlot(t,d.blotName.tableMain);this.normalizeTableStructure(e)}catch{}}resolveStableMergeSelection(t){if(t.length<=1)return null;const e=d.findParentBlot(t[0],d.blotName.tableMain);if(!e)return null;this.normalizeTableStructure(e);const l=e.domNode;if(!(l instanceof HTMLTableElement))return null;const s=w.buildDomTableGrid(l);if(!s)return null;const h=t.reduce((r,n)=>{const i=this.resolveTableCellNode(n);return i&&r.push(i),r},[]),a=w.resolveMergePlan(s,h);if(!a)return null;const c=a.cells.reduce((r,n)=>{const i=this.resolveCellInnerFromNode(n);return i&&r.push(i),r},[]),u=this.resolveCellInnerFromNode(a.baseCell);if(!u||c.length!==a.cells.length)return null;const m=s.rows.slice(a.rowStartIndex,a.rowEndIndex+1).reduce((r,n)=>{const i=this.readElementHeight(n);return i===null?r:(r??0)+i},null);return{baseCell:u,cells:c,colCount:a.colEndIndex-a.colStartIndex+1,rowCount:a.rowEndIndex-a.rowStartIndex+1,totalHeight:m}}mergeStableSelection(t){const{baseCell:e,cells:l,colCount:s,rowCount:h}=t,a=e.getTableBody();let c=e.getTableRow();if(!a||!c)return;for(let r=1;r<l.length;r+=1){const n=l[r],i=n.getTableBody();if(i&&i!==a){const o=n.getTableRow();o&&(c.parent.insertBefore(o,c.next),c=o)}}a.convertBody(e.wrapTag);for(let r=1;r<l.length;r+=1){const n=l[r];n.length()>1&&n.moveChildren(e),n.parent.remove()}e.colspan=s,e.rowspan=h;const u=this.quill.getIndex(e);this.quill.setSelection({index:u,length:0},b.Quill.sources.SILENT);const m=d.findParentBlot(e,d.blotName.tableMain);this.fixTableByRemove(m)}resolveSplitCellHeights(t){const[e,l]=d.findParentBlots(t,[d.blotName.tableMain,d.blotName.tableRow]),s=e.getRows(),h=s.indexOf(l);if(h<0)return null;const a=Array.from({length:t.rowspan},(m,r)=>{const n=s[h+r],i=this.readElementHeight((n==null?void 0:n.domNode)??null);if(i!==null)return i;const o=this.readElementHeight(this.resolveTableCellNode(t));return o!==null&&t.rowspan>0?o/t.rowspan:null}),c=t.getColumnIndex(),u=e.getColIds().slice(c,c+t.colspan);return u.length===0?null:{colIds:u,rowHeights:a,startRowIndex:h,tableBlot:e}}syncSplitCellHeights(t,e,l,s){const h=t.getRows();s.forEach((a,c)=>{if(a===null)return;const u=h[e+c];u&&l.forEach(m=>{const r=u.getCellByColId(m,"next"),n=r==null?void 0:r.getCellInner();!n||n.rowId!==u.rowId||n.colId!==m||this.applyCellHeight(n,a)})})}mergeCells(t){const e=this.resolveSelectedCells(t),l=this.resolveStableMergeSelection(e);l&&(this.clearDisplayedSelection(),this.mergeStableSelection(l),this.applyCellHeight(l.baseCell,l.totalHeight),this.moveSelectionToCell(l.baseCell))}splitCell(t){const e=this.resolveSplitTargetCell(t);if(!e)return;this.normalizeTableForCell(e);const l=this.resolveSplitCellHeights(e);this.clearDisplayedSelection(),super.splitCell([e]),l&&this.syncSplitCellHeights(l.tableBlot,l.startRowIndex,l.colIds,l.rowHeights),this.moveSelectionToCell(e)}}exports.default=p;
@@ -1 +1 @@
1
- "use strict";const g=require("./index-DgoWwYvV.cjs");function w(e){return Number.isFinite(e)&&e>0?e:1}function x(e){return Math.round(e*100)/100}function m(e){if(!(e instanceof HTMLElement))return null;const n=e.getBoundingClientRect();return[n.left,n.right,n.top,n.bottom].every(Number.isFinite)?{bottom:x(n.bottom),left:x(n.left),right:x(n.right),top:x(n.top)}:null}function f(e,n,t){!Number.isFinite(t)||!e[n]||e[n].push(x(t))}function C(e){if(e.length===0)return null;const n=[...e].sort((r,o)=>r-o),t=Math.floor(n.length/2);return n.length%2===1?n[t]:x((n[t-1]+n[t])/2)}function b(e){if(e.length===0)return[];const n=[...e],t=n.findIndex(o=>o!==null);if(t<0)return new Array(e.length).fill(0);for(let o=0;o<t;o+=1)n[o]=n[t];let r=t;for(let o=t+1;o<n.length;o+=1){if(n[o]===null)continue;const s=n[r],u=n[o],c=o-r;for(let l=1;l<c;l+=1)n[r+l]=x(s+(u-s)*l/c);r=o}for(let o=r+1;o<n.length;o+=1)n[o]=n[r];return n.map(o=>x(o??0))}function v(e){const n=[...e];for(let t=1;t<n.length;t+=1)n[t]=Math.max(n[t],n[t-1]);for(let t=n.length-2;t>=0;t-=1)n[t]=Math.min(n[t],n[t+1]);return n.map(t=>x(t))}function p(e){return v(b(e.map(C)))}function N(e){const n=Array.from(e.querySelectorAll("col")).reduce((r,o)=>{const s=Number.parseInt(o.getAttribute("span")||"1",10);return r+(Number.isNaN(s)||s<1?1:s)},0),t=Array.from(e.rows).reduce((r,o)=>{const s=Array.from(o.cells).reduce((u,c)=>u+Math.max(c.colSpan||1,1),0);return Math.max(r,s)},0);return Math.max(n,t)}function R(e,n){const t=Array.from(e.querySelectorAll("col")).map(r=>r.dataset.colId||g.randomId());return t.length>=n?t:t.concat(Array.from({length:n-t.length},()=>g.randomId()))}function V(e){const n=Array.from(e.rows),t=N(e),r=R(e,t),o=Array.from({length:n.length},()=>new Array(t).fill(null)),s=new Map;return n.forEach((u,c)=>{let l=0;Array.from(u.cells).forEach(i=>{for(;l<t&&o[c][l];)l+=1;if(l>=t)throw new Error("Invalid table grid: cell exceeds column bounds.");const d=w(i.colSpan);if(l+d>t)throw new Error("Invalid table grid: colspan exceeds column bounds.");const a={cell:i,colIndex:l,colspan:d,rowIndex:c,rowspan:w(i.rowSpan)};s.set(i,a);const y=Math.min(n.length,c+a.rowspan),A=Math.min(t,l+a.colspan);for(let h=c;h<y;h+=1)for(let I=l;I<A;I+=1)o[h][I]=i;l+=a.colspan})}),{colIds:r,matrix:o,placements:s,rows:n,table:e}}function B(e){const n=m(e.table);if(!n)return null;const t=Array.from({length:e.colIds.length+1},()=>[]),r=Array.from({length:e.rows.length+1},()=>[]);f(t,0,n.left),f(t,e.colIds.length,n.right),f(r,0,n.top),f(r,e.rows.length,n.bottom),e.rows.forEach((c,l)=>{const i=m(c);i&&(f(r,l,i.top),f(r,l+1,i.bottom))}),Array.from(e.placements.values()).forEach(c=>{const l=m(c.cell);l&&(f(t,c.colIndex,l.left),f(t,c.colIndex+c.colspan,l.right),f(r,c.rowIndex,l.top),f(r,c.rowIndex+c.rowspan,l.bottom))});const o=p(t),s=p(r),u=new Map;return Array.from(e.placements.values()).forEach(c=>{const l=o[c.colIndex],i=o[c.colIndex+c.colspan],d=s[c.rowIndex],a=s[c.rowIndex+c.rowspan];[l,i,d,a].every(Number.isFinite)&&u.set(c.cell,{bottom:a,left:l,right:i,top:d})}),{cellRects:u,colEdges:o,rowEdges:s,tableRect:{bottom:s[s.length-1]??n.bottom,left:o[0]??n.left,right:o[o.length-1]??n.right,top:s[0]??n.top}}}function T(e){return e.length===0?null:{bottom:Math.max(...e.map(n=>n.bottom)),left:Math.min(...e.map(n=>n.left)),right:Math.max(...e.map(n=>n.right)),top:Math.min(...e.map(n=>n.top))}}function F(e){const n=[],t=new Set;return e.forEach(r=>{!r||t.has(r)||(t.add(r),n.push(r))}),n}function E(e){return e.reduce((n,t)=>({colEndIndex:Math.max(n.colEndIndex,t.colIndex+t.colspan-1),colStartIndex:Math.min(n.colStartIndex,t.colIndex),rowEndIndex:Math.max(n.rowEndIndex,t.rowIndex+t.rowspan-1),rowStartIndex:Math.min(n.rowStartIndex,t.rowIndex)}),{colEndIndex:-1,colStartIndex:Number.POSITIVE_INFINITY,rowEndIndex:-1,rowStartIndex:Number.POSITIVE_INFINITY})}function S(e,n,t,r,o){var c;const s=[],u=new Set;for(let l=n;l<=t;l+=1)for(let i=r;i<=o;i+=1){const d=(c=e.matrix[l])==null?void 0:c[i];if(!d)return null;const a=e.placements.get(d);if(!a)return null;u.has(d)||(u.add(d),s.push(a))}return s}function P(e,n){let t=n;for(;;){const r=S(e,t.rowStartIndex,t.rowEndIndex,t.colStartIndex,t.colEndIndex);if(!(r!=null&&r.length))return null;const o=E(r);if(!(o.rowStartIndex!==t.rowStartIndex||o.rowEndIndex!==t.rowEndIndex||o.colStartIndex!==t.colStartIndex||o.colEndIndex!==t.colEndIndex))return o;t=o}}function z(e,n){const t=S(e,n.rowStartIndex,n.rowEndIndex,n.colStartIndex,n.colEndIndex);return t!=null&&t.length?t.map(r=>r.cell):null}function M(e,n){const t=F(n);if(t.length===0)return null;const r=t.map(u=>e.placements.get(u)).filter(u=>!!u);if(r.length===0||r.length!==t.length)return null;const o=P(e,E(r));if(!o)return null;const s=z(e,o);return s!=null&&s.length?{...o,cells:s}:null}function D(e,n){var i;const t=M(e,n);if(!t||t.cells.length<=1)return null;const{colEndIndex:r,colStartIndex:o,rowEndIndex:s,rowStartIndex:u}=t,c=(i=e.matrix[u])==null?void 0:i[o];if(!c)return null;const l=e.placements.get(c);return(l==null?void 0:l.rowIndex)!==u||l.colIndex!==o?null:{baseCell:c,cells:t.cells,colEndIndex:r,colStartIndex:o,rowEndIndex:s,rowStartIndex:u}}exports.buildDomTableGeometry=B;exports.buildDomTableGrid=V;exports.resolveMergePlan=D;exports.resolveRectangularSelection=M;exports.resolveViewportRectBounds=T;
1
+ "use strict";const g=require("./index-C5oVnw57.cjs");function w(e){return Number.isFinite(e)&&e>0?e:1}function x(e){return Math.round(e*100)/100}function m(e){if(!(e instanceof HTMLElement))return null;const n=e.getBoundingClientRect();return[n.left,n.right,n.top,n.bottom].every(Number.isFinite)?{bottom:x(n.bottom),left:x(n.left),right:x(n.right),top:x(n.top)}:null}function f(e,n,t){!Number.isFinite(t)||!e[n]||e[n].push(x(t))}function C(e){if(e.length===0)return null;const n=[...e].sort((r,o)=>r-o),t=Math.floor(n.length/2);return n.length%2===1?n[t]:x((n[t-1]+n[t])/2)}function b(e){if(e.length===0)return[];const n=[...e],t=n.findIndex(o=>o!==null);if(t<0)return new Array(e.length).fill(0);for(let o=0;o<t;o+=1)n[o]=n[t];let r=t;for(let o=t+1;o<n.length;o+=1){if(n[o]===null)continue;const s=n[r],u=n[o],c=o-r;for(let l=1;l<c;l+=1)n[r+l]=x(s+(u-s)*l/c);r=o}for(let o=r+1;o<n.length;o+=1)n[o]=n[r];return n.map(o=>x(o??0))}function v(e){const n=[...e];for(let t=1;t<n.length;t+=1)n[t]=Math.max(n[t],n[t-1]);for(let t=n.length-2;t>=0;t-=1)n[t]=Math.min(n[t],n[t+1]);return n.map(t=>x(t))}function p(e){return v(b(e.map(C)))}function N(e){const n=Array.from(e.querySelectorAll("col")).reduce((r,o)=>{const s=Number.parseInt(o.getAttribute("span")||"1",10);return r+(Number.isNaN(s)||s<1?1:s)},0),t=Array.from(e.rows).reduce((r,o)=>{const s=Array.from(o.cells).reduce((u,c)=>u+Math.max(c.colSpan||1,1),0);return Math.max(r,s)},0);return Math.max(n,t)}function R(e,n){const t=Array.from(e.querySelectorAll("col")).map(r=>r.dataset.colId||g.randomId());return t.length>=n?t:t.concat(Array.from({length:n-t.length},()=>g.randomId()))}function V(e){const n=Array.from(e.rows),t=N(e),r=R(e,t),o=Array.from({length:n.length},()=>new Array(t).fill(null)),s=new Map;return n.forEach((u,c)=>{let l=0;Array.from(u.cells).forEach(i=>{for(;l<t&&o[c][l];)l+=1;if(l>=t)throw new Error("Invalid table grid: cell exceeds column bounds.");const d=w(i.colSpan);if(l+d>t)throw new Error("Invalid table grid: colspan exceeds column bounds.");const a={cell:i,colIndex:l,colspan:d,rowIndex:c,rowspan:w(i.rowSpan)};s.set(i,a);const y=Math.min(n.length,c+a.rowspan),A=Math.min(t,l+a.colspan);for(let h=c;h<y;h+=1)for(let I=l;I<A;I+=1)o[h][I]=i;l+=a.colspan})}),{colIds:r,matrix:o,placements:s,rows:n,table:e}}function B(e){const n=m(e.table);if(!n)return null;const t=Array.from({length:e.colIds.length+1},()=>[]),r=Array.from({length:e.rows.length+1},()=>[]);f(t,0,n.left),f(t,e.colIds.length,n.right),f(r,0,n.top),f(r,e.rows.length,n.bottom),e.rows.forEach((c,l)=>{const i=m(c);i&&(f(r,l,i.top),f(r,l+1,i.bottom))}),Array.from(e.placements.values()).forEach(c=>{const l=m(c.cell);l&&(f(t,c.colIndex,l.left),f(t,c.colIndex+c.colspan,l.right),f(r,c.rowIndex,l.top),f(r,c.rowIndex+c.rowspan,l.bottom))});const o=p(t),s=p(r),u=new Map;return Array.from(e.placements.values()).forEach(c=>{const l=o[c.colIndex],i=o[c.colIndex+c.colspan],d=s[c.rowIndex],a=s[c.rowIndex+c.rowspan];[l,i,d,a].every(Number.isFinite)&&u.set(c.cell,{bottom:a,left:l,right:i,top:d})}),{cellRects:u,colEdges:o,rowEdges:s,tableRect:{bottom:s[s.length-1]??n.bottom,left:o[0]??n.left,right:o[o.length-1]??n.right,top:s[0]??n.top}}}function T(e){return e.length===0?null:{bottom:Math.max(...e.map(n=>n.bottom)),left:Math.min(...e.map(n=>n.left)),right:Math.max(...e.map(n=>n.right)),top:Math.min(...e.map(n=>n.top))}}function F(e){const n=[],t=new Set;return e.forEach(r=>{!r||t.has(r)||(t.add(r),n.push(r))}),n}function E(e){return e.reduce((n,t)=>({colEndIndex:Math.max(n.colEndIndex,t.colIndex+t.colspan-1),colStartIndex:Math.min(n.colStartIndex,t.colIndex),rowEndIndex:Math.max(n.rowEndIndex,t.rowIndex+t.rowspan-1),rowStartIndex:Math.min(n.rowStartIndex,t.rowIndex)}),{colEndIndex:-1,colStartIndex:Number.POSITIVE_INFINITY,rowEndIndex:-1,rowStartIndex:Number.POSITIVE_INFINITY})}function S(e,n,t,r,o){var c;const s=[],u=new Set;for(let l=n;l<=t;l+=1)for(let i=r;i<=o;i+=1){const d=(c=e.matrix[l])==null?void 0:c[i];if(!d)return null;const a=e.placements.get(d);if(!a)return null;u.has(d)||(u.add(d),s.push(a))}return s}function P(e,n){let t=n;for(;;){const r=S(e,t.rowStartIndex,t.rowEndIndex,t.colStartIndex,t.colEndIndex);if(!(r!=null&&r.length))return null;const o=E(r);if(!(o.rowStartIndex!==t.rowStartIndex||o.rowEndIndex!==t.rowEndIndex||o.colStartIndex!==t.colStartIndex||o.colEndIndex!==t.colEndIndex))return o;t=o}}function z(e,n){const t=S(e,n.rowStartIndex,n.rowEndIndex,n.colStartIndex,n.colEndIndex);return t!=null&&t.length?t.map(r=>r.cell):null}function M(e,n){const t=F(n);if(t.length===0)return null;const r=t.map(u=>e.placements.get(u)).filter(u=>!!u);if(r.length===0||r.length!==t.length)return null;const o=P(e,E(r));if(!o)return null;const s=z(e,o);return s!=null&&s.length?{...o,cells:s}:null}function D(e,n){var i;const t=M(e,n);if(!t||t.cells.length<=1)return null;const{colEndIndex:r,colStartIndex:o,rowEndIndex:s,rowStartIndex:u}=t,c=(i=e.matrix[u])==null?void 0:i[o];if(!c)return null;const l=e.placements.get(c);return(l==null?void 0:l.rowIndex)!==u||l.colIndex!==o?null:{baseCell:c,cells:t.cells,colEndIndex:r,colStartIndex:o,rowEndIndex:s,rowStartIndex:u}}exports.buildDomTableGeometry=B;exports.buildDomTableGrid=V;exports.resolveMergePlan=D;exports.resolveRectangularSelection=M;exports.resolveViewportRectBounds=T;
@@ -1,4 +1,4 @@
1
- import { randomId as g } from "./index-DmPtSBKF.js";
1
+ import { randomId as g } from "./index-xCUqmBUD.js";
2
2
  function w(e) {
3
3
  return Number.isFinite(e) && e > 0 ? e : 1;
4
4
  }
@@ -1,7 +1,7 @@
1
1
  var f = Object.defineProperty;
2
2
  var A = (s, t, e) => t in s ? f(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
3
3
  var c = (s, t, e) => A(s, typeof t != "symbol" ? t + "" : t, e);
4
- import { Q as b } from "./index-B9qg5reR.js";
4
+ import { Q as b } from "./index-DDuJ7D9p.js";
5
5
  const g = b.import("blots/block/embed"), U = b.import("formats/link"), h = ["height", "width"], w = new Set(h), a = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Map(), p = [/(?:youtube\.com\/watch\?(?:.*&)?v=|youtu\.be\/)([a-z0-9_-]+)/i, /youtube\.com\/embed\/([a-z0-9_-]+)/i, /youtube\.com\/shorts\/([a-z0-9_-]+)/i], E = /vimeo\.com\/(?:video\/)?(\d+)/i;
6
6
  function d(s) {
7
7
  if (u.has(s)) return u.get(s) ?? null;
@@ -1 +1 @@
1
- "use strict";var A=Object.defineProperty;var g=(s,t,e)=>t in s?A(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var c=(s,t,e)=>g(s,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("./index-CIZPix6V.cjs"),U=b.Quill.import("blots/block/embed"),w=b.Quill.import("formats/link"),h=["height","width"],T=new Set(h),l=new Map,u=new Map,y=[/(?:youtube\.com\/watch\?(?:.*&)?v=|youtu\.be\/)([a-z0-9_-]+)/i,/youtube\.com\/embed\/([a-z0-9_-]+)/i,/youtube\.com\/shorts\/([a-z0-9_-]+)/i],E=/vimeo\.com\/(?:video\/)?(\d+)/i;function m(s){if(u.has(s))return u.get(s)??null;const t=w.sanitize(s),e=!t||t==="about:blank"?null:t;return u.set(s,e),e}const f=s=>{const t=s.trim(),e=l.get(t);if(e)return e;for(const r of y){const i=r.exec(t);if(i!=null&&i[1]){const a=`https://www.youtube.com/embed/${i[1]}`;return l.set(t,a),a}}const o=E.exec(t);if(o!=null&&o[1]){const r=`https://player.vimeo.com/video/${o[1]}`;return l.set(t,r),r}return l.set(t,t),t},n=class n extends U{static create(t){const e=f(t),o=m(e)??m(t)??"about:blank",r=super.create(o);return r.setAttribute("frameborder","0"),r.setAttribute("allowfullscreen","true"),r.setAttribute("loading","lazy"),r.setAttribute("src",o),r}static formats(t){return h.reduce((e,o)=>(t.hasAttribute(o)&&(e[o]=t.getAttribute(o)),e),{})}static value(t){return t.getAttribute("src")??""}format(t,e){if(T.has(t)){e?this.domNode.setAttribute(t,e):this.domNode.removeAttribute(t);return}super.format(t,e)}html(){const t=n.value(this.domNode),e=this.domNode.getAttribute("width"),o=this.domNode.getAttribute("height"),r=this.domNode.getAttribute("style"),i=this.domNode.getAttribute("loading");return`<iframe ${['class="ql-video"','frameborder="0"','allowfullscreen="true"',`src="${t}"`,e?`width="${e}"`:"",o?`height="${o}"`:"",r?`style="${r}"`:"",i?`loading="${i}"`:""].filter(Boolean).join(" ")}></iframe>`}};c(n,"blotName","video"),c(n,"className","ql-video"),c(n,"tagName","IFRAME");let d=n;exports.default=d;exports.normalizeVideoUrl=f;
1
+ "use strict";var A=Object.defineProperty;var g=(s,t,e)=>t in s?A(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var c=(s,t,e)=>g(s,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("./index-CPRUEkbV.cjs"),U=b.Quill.import("blots/block/embed"),w=b.Quill.import("formats/link"),h=["height","width"],T=new Set(h),l=new Map,u=new Map,y=[/(?:youtube\.com\/watch\?(?:.*&)?v=|youtu\.be\/)([a-z0-9_-]+)/i,/youtube\.com\/embed\/([a-z0-9_-]+)/i,/youtube\.com\/shorts\/([a-z0-9_-]+)/i],E=/vimeo\.com\/(?:video\/)?(\d+)/i;function m(s){if(u.has(s))return u.get(s)??null;const t=w.sanitize(s),e=!t||t==="about:blank"?null:t;return u.set(s,e),e}const f=s=>{const t=s.trim(),e=l.get(t);if(e)return e;for(const r of y){const i=r.exec(t);if(i!=null&&i[1]){const a=`https://www.youtube.com/embed/${i[1]}`;return l.set(t,a),a}}const o=E.exec(t);if(o!=null&&o[1]){const r=`https://player.vimeo.com/video/${o[1]}`;return l.set(t,r),r}return l.set(t,t),t},n=class n extends U{static create(t){const e=f(t),o=m(e)??m(t)??"about:blank",r=super.create(o);return r.setAttribute("frameborder","0"),r.setAttribute("allowfullscreen","true"),r.setAttribute("loading","lazy"),r.setAttribute("src",o),r}static formats(t){return h.reduce((e,o)=>(t.hasAttribute(o)&&(e[o]=t.getAttribute(o)),e),{})}static value(t){return t.getAttribute("src")??""}format(t,e){if(T.has(t)){e?this.domNode.setAttribute(t,e):this.domNode.removeAttribute(t);return}super.format(t,e)}html(){const t=n.value(this.domNode),e=this.domNode.getAttribute("width"),o=this.domNode.getAttribute("height"),r=this.domNode.getAttribute("style"),i=this.domNode.getAttribute("loading");return`<iframe ${['class="ql-video"','frameborder="0"','allowfullscreen="true"',`src="${t}"`,e?`width="${e}"`:"",o?`height="${o}"`:"",r?`style="${r}"`:"",i?`loading="${i}"`:""].filter(Boolean).join(" ")}></iframe>`}};c(n,"blotName","video"),c(n,"className","ql-video"),c(n,"tagName","IFRAME");let d=n;exports.default=d;exports.normalizeVideoUrl=f;