ados-rcm 1.1.1006 → 1.1.1007

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 (31) hide show
  1. package/dist/AModule/AComponents/AEditor/modules/TableClipboard.d.ts +0 -1
  2. package/dist/AModule/AComponents/AEditor/modules/Video.d.ts +2 -1
  3. package/dist/{Copy-Bc0ARAc3.js → Copy-BvZ-0__X.js} +1 -1
  4. package/dist/{Copy-C-avW8I5.cjs → Copy-DcHpOgCF.cjs} +1 -1
  5. package/dist/{Divider-3zHYe6BA.cjs → Divider-BVEQj-EX.cjs} +1 -1
  6. package/dist/{Divider-C9wfMsDK.js → Divider-ZH1cEhE7.js} +1 -1
  7. package/dist/{FullScreen-B7qYpCiP.js → FullScreen-BcvJGyDD.js} +1 -1
  8. package/dist/{FullScreen-Ke3e61Uz.cjs → FullScreen-DiAluvff.cjs} +1 -1
  9. package/dist/{ImageResizer-92mnUOy3.js → ImageResizer-C_vqKWRL.js} +1 -1
  10. package/dist/{ImageResizer-X1Poqw9j.cjs → ImageResizer-Dqs9RGH8.cjs} +1 -1
  11. package/dist/{TableClipboard-DArH8NQL.js → TableClipboard-Cv4O5dsJ.js} +135 -144
  12. package/dist/TableClipboard-Df3wJU8m.cjs +6 -0
  13. package/dist/{TableSelection-Cga1LE7t.js → TableSelection-C7dNejQZ.js} +3 -3
  14. package/dist/{TableSelection-yP_nGXMj.cjs → TableSelection-DlqwQtwn.cjs} +1 -1
  15. package/dist/{TableUp-DjzmM6m7.cjs → TableUp-B2rjSNVN.cjs} +1 -1
  16. package/dist/{TableUp-CSh6uEgx.js → TableUp-CmKkYX4l.js} +3 -3
  17. package/dist/{TableUpLogical-DVHBPoU2.cjs → TableUpLogical-C5o_itQt.cjs} +1 -1
  18. package/dist/{TableUpLogical-XjLJbvWM.js → TableUpLogical-Cv5dDkYL.js} +1 -1
  19. package/dist/{Video-DvBtcSS1.js → Video-DGTP8c5d.js} +1 -1
  20. package/dist/{Video-BkurZRCI.cjs → Video-Df3l-Q5Y.cjs} +1 -1
  21. package/dist/{index-Bm06pYwk.cjs → index-2aSOnLaI.cjs} +1 -1
  22. package/dist/{index-D_bqsoUp.js → index-BRQ8EtDS.js} +1 -1
  23. package/dist/{index-F6M2jTiI.js → index-BU5UfEjR.js} +8185 -8210
  24. package/dist/{index-BXowBKHg.js → index-DVR0BtEG.js} +1 -1
  25. package/dist/{index-BWB4czWj.cjs → index-DmqfsPy3.cjs} +98 -98
  26. package/dist/{index-CHiSNs7Y.cjs → index-Q2cPTI_j.cjs} +1 -1
  27. package/dist/index.cjs.js +1 -1
  28. package/dist/index.es.js +1 -1
  29. package/package.json +1 -1
  30. package/dist/AModule/AComponents/AEditor/core/AEditorValueSyncPolicy.d.ts +0 -2
  31. package/dist/TableClipboard-C-rG1Hq8.cjs +0 -6
@@ -51,7 +51,6 @@ export declare class TableClipboard extends Clipboard {
51
51
  }, formats?: Record<string, unknown>): TypeDelta;
52
52
  matchCaption(_node: Node, delta: TypeDelta): TypeDelta;
53
53
  private preprocessTableHtml;
54
- private ensureRenderableTableStructure;
55
54
  private inlineComputedTableStyles;
56
55
  private inlineComputedTableStylesFromRendered;
57
56
  private buildComputedCellStyle;
@@ -1,4 +1,5 @@
1
- declare const BlockEmbedBlot: any;
1
+ import { BlockEmbed } from 'quill/blots/block';
2
+ declare const BlockEmbedBlot: typeof BlockEmbed;
2
3
  export declare function isVideoUrl(url: string): boolean;
3
4
  export declare const normalizeVideoUrl: (url: string) => string;
4
5
  declare class Video extends BlockEmbedBlot {
@@ -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 d, d as m } from "./index-F6M2jTiI.js";
4
+ import { D as u, Q as d, d as m } from "./index-BU5UfEjR.js";
5
5
  const h = {
6
6
  capture: !0
7
7
  }, E = /* @__PURE__ */ new Set(["P", "DIV", "LI", "BLOCKQUOTE", "PRE", "TR", "TD", "TH", "SECTION", "ARTICLE", "H1", "H2", "H3", "H4", "H5", "H6"]), C = /<(?:br|p|div|li|blockquote|pre|tr|td|th|section|article|h[1-6])\b|[\r\n\t]/i, T = /[\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 c=require("./index-BWB4czWj.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 s=this.normalizeTitlePasteText(n);this.applyPasteText(a.index,a.length,s),this.scheduleSelection(a.index+s.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,s;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=((s=n.textContent)==null?void 0:s.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 c.Delta().retain(t).delete(r).concat(e);this.quill.updateContents(l,c.Quill.sources.USER)}applyPasteText(t,r,e){const l=new c.Delta().retain(t).delete(r);e&&l.insert(e),this.quill.updateContents(l,c.Quill.sources.USER)}scheduleSelection(t){c.deferMicrotask(()=>this.quill.setSelection(t,0,c.Quill.sources.SILENT))}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 c=require("./index-DmqfsPy3.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 s=this.normalizeTitlePasteText(n);this.applyPasteText(a.index,a.length,s),this.scheduleSelection(a.index+s.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,s;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=((s=n.textContent)==null?void 0:s.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 c.Delta().retain(t).delete(r).concat(e);this.quill.updateContents(l,c.Quill.sources.USER)}applyPasteText(t,r,e){const l=new c.Delta().retain(t).delete(r);e&&l.insert(e),this.quill.updateContents(l,c.Quill.sources.USER)}scheduleSelection(t){c.deferMicrotask(()=>this.quill.setSelection(t,0,c.Quill.sources.SILENT))}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-BWB4czWj.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-DmqfsPy3.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-F6M2jTiI.js";
4
+ import { Q as i, R as c, j as d, A as m } from "./index-BU5UfEjR.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, b as c } from "./index-F6M2jTiI.js";
4
+ import { a as u, b as c } from "./index-BU5UfEjR.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-BWB4czWj.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-DmqfsPy3.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,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, c as C, Q as D, R as q, j as F, A as N } from "./index-F6M2jTiI.js";
4
+ import { S as f, c as C, Q as D, R as q, j as F, A as N } from "./index-BU5UfEjR.js";
5
5
  const g = {
6
6
  OVERLAY: "ql-image-resizer-overlay",
7
7
  HANDLE: "ql-image-resizer-handle",
@@ -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-BWB4czWj.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-DmqfsPy3.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;