ados-rcm 1.1.521 → 1.1.523
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +2 -2
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
@@ -354,7 +354,7 @@ received: ${r.quality}
|
|
354
354
|
received: ${r.imageType}
|
355
355
|
-> using default image/jpeg`),r.imageType="image/jpeg"),r.keepImageTypes||(r.keepImageTypes=[]),r.keepImageTypes&&!Array.isArray(r.keepImageTypes)&&(e.warn(`quill.imageCompressor: [config error] 'keepImageTypes' is required to be a "array", received: ${r.keepImageTypes} -> using default []`),r.keepImageTypes=[]),r.ignoreImageTypes||(r.ignoreImageTypes=[]),r.ignoreImageTypes&&!Array.isArray(r.ignoreImageTypes)&&(e.warn(`quill.imageCompressor: [config error] 'ignoreImageTypes' is required to be a "array", received: ${r.ignoreImageTypes} -> using default []`),r.ignoreImageTypes=[]),r.handleOnPaste&&typeof r.handleOnPaste!="boolean"&&typeof r.handleOnPaste!="function"&&(e.warn(`quill.imageCompressor: [config error] 'handlePaste' is required to be a "boolean" or a "function", received: ${r.ignoreImageTypes} -> using default true`),r.handleOnPaste=!0),r.insertIntoEditor&&typeof r.insertIntoEditor!="function"&&(e.warn(`quill.imageCompressor: [config error] 'insertIntoEditor' is required to be a "function", received: ${r.insertIntoEditor} -> using default undefined`),r.insertIntoEditor=void 0)}function fb(r){return!!r.match(/^image\/(gif|jpe?g|a?png|svg|webp|bmp)/i)}class rP{constructor(e,t,n,o){ue(this,"localDrag",!1);this.quill=e,this.onNewDataUrl=t,this.logger=n,this.handleOnPaste=o,this.quill.root.addEventListener("dragstart",i=>this.handleDragStart(i),!1),this.quill.root.addEventListener("dragend",i=>this.handleDragEnd(i),!1),this.quill.root.addEventListener("drop",i=>this.handleDrop(i),!0),this.handleOnPaste!==!1&&this.quill.root.addEventListener("paste",i=>this.handlePaste(i),!0)}handleDragStart(e){this.localDrag=!0}handleDragEnd(e){this.localDrag=!1}async handleDrop(e){var i,a,c,d;if(this.localDrag)return;if(e.preventDefault(),document.caretRangeFromPoint){const f=document.getSelection(),p=document.caretRangeFromPoint(e.clientX,e.clientY);f&&p&&f.setBaseAndExtent(p.startContainer,p.startOffset,p.startContainer,p.startOffset)}this.logger.log("handleDrop",{evt:e});const t=(i=e.dataTransfer)==null?void 0:i.files,n=Array.from(t||[]).filter(f=>fb(f.type));if(n.length>0){e.stopPropagation(),this.logger.log("handleDrop","found files",{evt:e,files:t,imageFiles:n}),await this.pasteFilesIntoQuill(n);return}if((a=e.dataTransfer)!=null&&a.items){e.stopPropagation(),this.logger.log("handleDrop","found items",{evt:e,files:t,imageFiles:n}),await this.handleDataTransferList((c=e.dataTransfer)==null?void 0:c.items,e);return}const o=(d=e.dataTransfer)==null?void 0:d.getData("URL");if(this.logger.log("handleDrop","trying getData('URL')",{draggedUrl:o}),o){const f=await(await fetch(o)).blob();this.logger.log("handleDrop","blob from drag event",{evt:e,files:t,imageFiles:n}),await this.pasteFilesIntoQuill([f])}}async handlePaste(e){var t;typeof this.handleOnPaste=="function"&&!this.handleOnPaste(e)||await this.handleDataTransferList((t=e.clipboardData)==null?void 0:t.items,e)}async handleDataTransferList(e,t){const n=Array.from(e||[]),o=n.filter(c=>c.kind==="file"&&fb(c.type)),i=n.map(c=>({type:c.type,kind:c.kind}));if(this.logger.log("handleDataTransferList",{fileTypes:i,imageCount:o.length}),!o.length)return;t.preventDefault(),t.stopPropagation();const a=o.map(c=>c.getAsFile());await this.pasteFilesIntoQuill(a)}async pasteFilesIntoQuill(e){this.logger.log(" pasteFilesIntoQuill",`pasting ${e.length} images...`),await Promise.all(e.map(async(t,n)=>{if(!t)return;const o=await J2(t);this.logger.log(" pasteFilesIntoQuill",`pasting image (${n})`),this.onNewDataUrl(o)})),this.logger.log(" pasteFilesIntoQuill","done")}}class fh{constructor(e,t){ue(this,"quill");ue(this,"range");ue(this,"options");ue(this,"imageDrop");ue(this,"fileHolder");ue(this,"Logger");this.quill=e,this.options=t||{};const n=!!t.debug,o=!!t.suppressErrorLogging;this.Logger=new JN(n,o),tP(t,this.Logger);const i=async c=>{this.Logger.log("onImageDrop",{dataUrl:c});const d=await this.downscaleImageFromUrl(c);this.insertToEditor(d,fh.b64toBlob(d))};this.imageDrop=new rP(e,i,this.Logger,typeof this.options.handleOnPaste=="function"?this.options.handleOnPaste:this.options.handleOnPaste!==!1),this.Logger.log("fileChanged",{options:t,quill:e,debug:n});const a=this.quill.getModule("toolbar");a?a.addHandler("image",()=>this.selectLocalImage()):this.Logger.error("Quill toolbar module not found! need { toolbar: // options } in Quill.modules for image icon to sit in")}static b64toBlob(e){const t=atob(e.split(",")[1]),n=e.slice(5).split(";")[0],o=new ArrayBuffer(t.length);let i=new Uint8Array(o);for(let a=0;a<t.length;a++)i[a]=t.charCodeAt(a);return new Blob([o],{type:n})}destroy(){this.imageDrop&&console.warn("ImageDrop instance cleanup")}selectLocalImage(e){this.range=this.quill.getSelection(),this.fileHolder=document.createElement("input"),this.fileHolder.setAttribute("type","file"),this.fileHolder.setAttribute("accept","image/*"),this.fileHolder.setAttribute("style","visibility:hidden"),this.fileHolder.onchange=()=>this.fileChanged().then(()=>e&&e()),document.body.appendChild(this.fileHolder),this.fileHolder.click(),window.requestAnimationFrame(()=>{this.fileHolder&&document.body.removeChild(this.fileHolder)})}async fileChanged(e){var a;const t=e||((a=this.fileHolder)==null?void 0:a.files);if(!t||!t.length)return;const n=t[0];if(this.Logger.log("fileChanged",{file:n}),!n)return;const o=await J2(n),i=await this.downscaleImageFromUrl(o);this.insertToEditor(i,fh.b64toBlob(i))}async downscaleImageFromUrl(e){const t=await eP(this.Logger,e,this.options.maxWidth,this.options.maxHeight,this.options.imageType,this.options.keepImageTypes,this.options.ignoreImageTypes,this.options.quality);return this.Logger.log("downscaleImageFromUrl",{dataUrl:e,dataUrlCompressed:t}),t}insertToEditor(e,t){if(this.options.insertIntoEditor)this.options.insertIntoEditor(e,t,this.quill);else{this.Logger.log("insertToEditor",{url:e}),this.range=this.quill.getSelection();const n=this.range;if(!n)return;this.logFileSize(e),this.quill.insertEmbed(n.index,"image",`${e}`,"user"),n.index++,this.quill.setSelection(n,"api")}}logFileSize(e){const o=(Math.round((e.length-"data:image/png;base64,".length)*3/4)/1024).toFixed(0);this.Logger.log("estimated img size: "+o+" kb")}}window.imageCompressor=fh;const hh={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"},Ec={BACKSPACE:8,DELETE:46,LEFT:37,UP:38,RIGHT:39,DOWN:40},sp=(r,e)=>{const t=r?"top":"bottom",n=e?"left":"right",o=r===e?"nwse-resize":"nesw-resize";return{[t]:"-5px",[n]:"-5px",cursor:o}},nP={tl:sp(!0,!0),tr:sp(!0,!1),bl:sp(!1,!0),br:sp(!1,!1)},oP={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"}]},iP=ke.import("formats/image");class mp extends iP{static get ATTRIBUTES(){return["alt","height","width","class","style","data-align"]}static formats(e){return this.ATTRIBUTES.reduce((t,n)=>(e.hasAttribute(n)&&(t[n]=e.getAttribute(n)||""),t),{})}format(e,t){this.constructor.ATTRIBUTES.indexOf(e)>-1?t?this.domNode.setAttribute(e,t):this.domNode.removeAttribute(e):super.format(e,t)}}ue(mp,"blotName","image"),ue(mp,"tagName","img"),ue(mp,"scope",Jt.INLINE);ke.register("formats/image",mp,!0);class wh{constructor(e){ue(this,"resizer");ue(this,"quill");ue(this,"overlay");ue(this,"activeEle");ue(this,"blot");ue(this,"options");ue(this,"requestUpdate");this.resizer=e,this.quill=e.quill,this.overlay=e.overlay,this.activeEle=e.activeEle,this.blot=e.blot,this.options=e.options,this.requestUpdate=()=>e.onUpdate(!0)}onCreate(){}onDestroy(){}onUpdate(){}}class sP extends wh{constructor(){super(...arguments);ue(this,"display")}onCreate(){var t;this.display=document.createElement("div"),this.display.className=Mi[hh.DISPLAY],(t=this.overlay)==null||t.appendChild(this.display)}onUpdate(){if(!this.display||!this.activeEle)return;const[t,n]=[this.activeEle.offsetWidth,this.activeEle.offsetHeight];this.display.innerHTML=`${t} × ${n}`,this.positionDisplay(t,n)}positionDisplay(t,n){var c;if(!this.display)return;const o=this.display.getBoundingClientRect(),i=t>120&&n>30,a=((c=this.activeEle)==null?void 0:c.style.float)==="right";Object.assign(this.display.style,{right:i?"4px":a?"auto":`-${o.width+4}px`,bottom:i?"4px":`-${o.height+4}px`,left:i?"auto":a?`-${o.width+4}px`:"auto"})}}class aP extends wh{constructor(){super(...arguments);ue(this,"boxes",[]);ue(this,"dragBox",null);ue(this,"dragStartX",0);ue(this,"dragStartY",0);ue(this,"contentOption");ue(this,"preDragSize",{width:0,height:0});ue(this,"naturalSize",[0,0]);ue(this,"handleDragProxy",null);ue(this,"handleMouseupProxy",null);ue(this,"handleMousedown",t=>{!this.blot||!this.activeEle||(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(window.getComputedStyle(this.dragBox).cursor),this.handleDragProxy=this.handleDrag.bind(this),this.handleMouseupProxy=this.handleMouseup.bind(this),document.addEventListener("mousemove",this.handleDragProxy,!0),document.addEventListener("mouseup",this.handleMouseupProxy,!0))});ue(this,"handleMouseup",t=>{if(!this.activeEle||!this.blot||!this.contentOption)return;const n=this.calcSize(t,this.contentOption.limit);Object.assign(this.activeEle,n),Object.assign(this.activeEle.style,{width:null,height:null}),this.setCursor(""),this.removeEventListeners()});ue(this,"handleDrag",t=>{!this.activeEle||!this.blot||!this.contentOption||(Object.assign(this.activeEle.style,this.calcSize(t,{...this.contentOption.limit,unit:!0})),this.requestUpdate())});ue(this,"handleDoubleClick",t=>{if(!this.blot||!this.activeEle||!this.contentOption)return;t.stopPropagation();const[n,o]=this.naturalSize,i={};this.contentOption.attribute.includes("width")&&(i.width=n),this.contentOption.attribute.includes("height")&&(i.height=o);const a=this.applyConstraints(i,this.contentOption.limit);Object.assign(this.activeEle,a),this.requestUpdate()})}onCreate(){!this.blot||!this.options.contentOptions||(this.contentOption=this.options.contentOptions.find(t=>t.blotName===this.blot.statics.blotName),this.boxes=[],["tl","tr","br","bl"].forEach(this.addBox.bind(this)))}onDestroy(){this.setCursor("")}addBox(t){var o;const n=document.createElement("div");n.className=`${Mi[hh.HANDLE]} ${t}`,n.addEventListener("mousedown",this.handleMousedown,!1),n.addEventListener("dblclick",this.handleDoubleClick,!1),Object.assign(n.style,nP[t]),(o=this.overlay)==null||o.appendChild(n),this.boxes.push(n)}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,n={}){var d;if(!this.dragBox||!this.activeEle)return{};const o=t.clientX-this.dragStartX,i=t.clientY-this.dragStartY,a=this.dragBox===this.boxes[0]||this.dragBox===this.boxes[3]?-1:1,c={};return(d=this.contentOption)!=null&&d.attribute?this.contentOption.attribute.forEach(f=>c[f]=this.preDragSize[f]):c.width=this.preDragSize.width,c.width&&(c.width=Math.round(this.preDragSize.width+o*a)),c.height&&(c.height=Math.round(this.preDragSize.height+i*a)),this.applyConstraints(c,n)}applyConstraints(t,n={}){const o=typeof t.width=="string"?parseInt(t.width,10):t.width||0,i=typeof t.height=="string"?parseInt(t.height,10):t.height||0;let a=o,c=i;if(n.ratio){a=this.applyLimit(a,n.minWidth,n.maxWidth),c=a*n.ratio;const f=this.applyLimit(c,n.minHeight,n.maxHeight);f!==c&&(c=f,a=c/n.ratio)}else o&&(a=this.applyLimit(a,n.minWidth,n.maxWidth)),i&&(c=this.applyLimit(c,n.minHeight,n.maxHeight));const d={};return t.width!==void 0&&(d.width=n.unit?`${a}px`:a),t.height!==void 0&&(d.height=n.unit?`${c}px`:c),d}applyLimit(t,n,o){let i=t;return n!==void 0&&(i=Math.max(n,i)),o!==void 0&&(i=Math.min(o,i)),i}getNaturalSize(){if(!this.activeEle)return[0,0];const t=this.activeEle.getAttribute("data-size");if(!t){const n=this.activeEle,o=[n.offsetWidth,n.offsetHeight];return n.setAttribute("data-size",o.join(",")),o}return t.split(",").map(Number)}setCursor(t){[document.body,this.activeEle].forEach(n=>n&&(n.style.cursor=t))}}const Ic=class Ic extends wh{constructor(){super(...arguments);ue(this,"keyboardProxy",null)}static injectInit(t){var o;const n=(o=t.keyboard)==null?void 0:o.bindings;n&&[Ic.keys.LEFT,Ic.keys.RIGHT].forEach(i=>(n[i]||[]).unshift(Ic.makeArrowHandler(i)))}static makeArrowHandler(t){const n=t===Ic.keys.LEFT;return{key:t,shiftKey:!1,altKey:null,[n?"prefix":"suffix"]:/^$/,handler(o){const i=this.quill;if(!i.resizer)return!0;let a=o.index;const c=t===Ic.keys.RIGHT,[d]=i.getLine(a+(n?-1:0));if(!d)return!0;if(i.resizer.judgeShow(d))return!1;const f=i.getIndex(d);if(c&&f+d.length()-1===a)return!0;c&&(a+=o.length+1);const[p]=i.getLeaf(a);if(!p)return!0;const m=p.offset(p.parent),g=p.constructor&&"scope"in p.constructor&&p.constructor.scope===Jt.BLOCK_BLOT;if(n&&(g&&a===m||a===0||a===f))return!0;let v=p;if(n&&m===0){const[w]=i.getLeaf(a-1);w&&(v=w)}return!v||!i.resizer.judgeShow(v)}}}onCreate(){this.keyboardProxy=this.keyboardHandle.bind(this),document.addEventListener("keydown",this.keyboardProxy,!0)}onDestroy(){this.keyboardProxy&&document.removeEventListener("keydown",this.keyboardProxy,!0)}keyboardHandle(t){if(t.defaultPrevented||t.shiftKey||t.ctrlKey||t.altKey||!this.activeEle)return;const n=t.keyCode;let o=this.blot.offset(this.quill.scroll),i=null,a=!1;n===Ec.BACKSPACE||n===Ec.DELETE?(this.handleDelete(),a=!0):n>=Ec.LEFT&&n<=Ec.DOWN&&([o,i]=this.handleArrowKeys(n,o),a=!0),a&&(t.stopPropagation(),t.preventDefault()),!(i&&this.resizer.judgeShow(i,i.domNode))&&(this.quill.setSelection(o),this.resizer.hide())}handleDelete(){this.blot&&(this.blot.deleteAt(0,1),this.blot.parent.optimize({}))}handleArrowKeys(t,n){let o=null;return t===Ec.RIGHT?n+=this.blot.length()||1:t===Ec.UP?(n=this.getOtherLineIndex(-1),o=this.quill.getLeaf(n)[0]):t===Ec.DOWN&&(n=this.getOtherLineIndex(1),o=this.quill.getLeaf(n)[0]),[n,o]}getOtherLineIndex(t){if(!this.blot)return 0;const n=this.blot.offset(this.quill.scroll),[o]=this.quill.getLine(n);if(!o)return n;const i=this.blot.offset(o)+1,a=t>0?o.next:o.prev;if(!a)return n;let c=a.length();return a.statics.blotName==="block"&&c--,a.offset(this.quill.scroll)+Math.min(c,i)}};ue(Ic,"keys",Ec);let Bp=Ic;const jd=class jd extends wh{constructor(t){super(t);ue(this,"toolbar");ue(this,"blot");this.blot=t.blot}createStyleTool(t,n){const o={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:i=>{const a=o[n];Object.assign(i.style,a),i.setAttribute("data-align",n)},isApplied:i=>{const a=i.style;switch(n){case"center":return a.float==="none";case"justify":return a.display==="block"&&a.width==="100%";case"left":case"right":return a.float===n;default:return!1}}}}onCreate(){var t;this.toolbar=document.createElement("div"),this.toolbar.className=Mi[hh.TOOLBAR],(t=this.overlay)==null||t.appendChild(this.toolbar),Object.keys(jd.Tools).forEach(n=>{const o=n;jd.Tools[o]=this.createStyleTool(jd.Tools[o].icon,o)}),this._addToolbarButtons()}_addToolbarButtons(){if(!this.toolbar||!this.activeEle)return;const{Tools:t}=this.constructor;this.options.tools.forEach(n=>{const o=n,i=t[o];if(!i)return;const a=document.createElement("button");a.type="button",a.className=Mi[hh.TOOLBAR_BUTTON],a.innerHTML=yp.renderToString(_.jsx(ln,{icon:i.icon,size:"xs"})),a.setAttribute("data-tool",o),i.isApplied&&i.isApplied.call(this,this.activeEle)&&(a.style.backgroundColor="var(--AEditor_Addon_Secondary_color)"),this.addButtonClickHandler(a,i),this.toolbar.appendChild(a)})}addButtonClickHandler(t,n){!this.activeEle||!this.blot||t.addEventListener("click",o=>{var a;if(o.stopPropagation(),n.handler&&n.handler.call(this,o,t,this.activeEle)!==!0)return;const i=n.isApplied&&n.isApplied.call(this,this.activeEle);return this.toolbar&&Array.from(this.toolbar.querySelectorAll("button")).forEach(c=>c.style.backgroundColor=""),i?(this.activeEle.style.cssText="",this.activeEle.setAttribute("data-align","")):(t.style.backgroundColor="var(--AEditor_Addon_Secondary_color)",(a=n.apply)==null||a.call(n,this.activeEle)),this.requestUpdate(),!1})}};ue(jd,"Tools",{left:{icon:"AlignLeft"},center:{icon:"AlignCenter"},right:{icon:"AlignRight"},justify:{icon:"AlignJustify"}});let T1=jd;class Q2{constructor(e,t={}){ue(this,"quill");ue(this,"options");ue(this,"moduleClasses");ue(this,"modules",[]);ue(this,"blot");ue(this,"selectedBlots",[]);ue(this,"embedClassName","");ue(this,"activeEle");ue(this,"overlay");ue(this,"updateFromModule",!1);ue(this,"hideProxy",null);ue(this,"updateOverlayPositionProxy",null);var o;e.resizer=this,this.quill=e;const n=t.modules?[...t.modules]:null;this.options={...oP,...t},n&&(this.options.modules=n),document.execCommand("enableObjectResizing",!1,"false"),this.moduleClasses=this.options.modules,this.quill.root.addEventListener("mousedown",this.handleClick.bind(this),!1),this.quill.on("text-change",this.handleChange.bind(this)),this.quill.container.style.position=this.quill.container.style.position||"relative",this.quill.on("selection-change",this.addBlotsSelectedClass.bind(this)),Bp.injectInit(this.quill),(o=this.options.embedTags)!=null&&o.length&&this.initializeEmbed()}initializeModules(){this.modules.forEach(e=>e.onDestroy()),this.modules=[],this.modules=this.moduleClasses.map(e=>new(this.constructor.Modules[e]||e)(this)),this.modules.forEach(e=>e.onCreate()),this.repositionElements(),this.modules.forEach(e=>e.onUpdate())}initializeEmbed(){if(!this.options.embedTags.length)return;this.embedClassName=`ql-${Array.from({length},()=>[Math.floor(Math.random()*62)]).join("")}`;const e=[""].concat(this.options.embedTags).join(`, .${this.embedClassName} `).slice(2)+"{pointer-events: none;}",t=document.createElement("style");t.textContent=e,this.quill.container.appendChild(t),this.quill.root.classList.add(this.embedClassName)}onUpdate(e){this.updateFromModule=!!e,this.repositionElements(),this.modules.forEach(t=>t.onUpdate())}handleClick(e){if(this.overlay&&(e.target===this.overlay||this.overlay.contains(e.target)))return;let t=e.target;if(t=this.getEventTarget(e,t),t!=null&&t.tagName){const n=this.quill.scroll.find(t);if(n&&this.judgeShow(n,t)){e.preventDefault();return}}this.activeEle&&this.hide()}getEventTarget(e,t){var i;const n=(i=this.options.embedTags)==null?void 0:i.join();if(!n)return t;const o=this.quill.root;return(t===o||t.querySelectorAll(n).length)&&(o.classList.remove(this.embedClassName),t=document.elementFromPoint(e.clientX,e.clientY),o.classList.add(this.embedClassName)),t}judgeShow(e,t){if(!e||!this.options.contentOptions)return!1;!t&&e.domNode&&(t=e.domNode);const n=this.options.contentOptions.find(i=>i.blotName===e.statics.blotName);if(!n)return!1;if(this.activeEle===t)return!0;const o=n.limit||{};return!o.minWidth||o.minWidth&&t.offsetWidth>=o.minWidth?(this.activeEle&&this.hide(),this.activeEle=t,this.blot=e,this.showOverlay(),this.initializeModules(),!0):!1}handleChange(e,t,n){if(this.updateFromModule){this.updateFromModule=!1;return}n!=="user"||!this.overlay||!this.activeEle||this.onUpdate()}showOverlay(){this.overlay&&this.hideOverlay(),this.quill.setSelection(null),[document.body,this.quill.root].forEach(e=>e.style.userSelect="none"),this.overlay=document.createElement("div"),this.overlay.className=`${Mi[hh.OVERLAY]}`,this.overlay.addEventListener("wheel",e=>{e.preventDefault(),e.stopPropagation(),this.quill.root.scrollTop+=e.deltaY*.5},{passive:!1}),this.quill.container.appendChild(this.overlay),this.hideProxy=()=>this.activeEle&&this.hide(),this.updateOverlayPositionProxy=()=>this.overlay&&(this.overlay.style.marginTop=-1*this.quill.root.scrollTop+"px"),this.quill.root.addEventListener("input",this.hideProxy,!0),this.quill.root.addEventListener("scroll",this.updateOverlayPositionProxy),this.repositionElements()}hideOverlay(){this.overlay&&(this.quill.container.removeChild(this.overlay),this.overlay=void 0,this.hideProxy&&this.quill.root.removeEventListener("input",this.hideProxy,!0),this.updateOverlayPositionProxy&&this.quill.root.removeEventListener("scroll",this.updateOverlayPositionProxy),[document.body,this.quill.root].forEach(e=>e.style.userSelect=""))}repositionElements(){if(!this.overlay||!this.activeEle)return;const e=this.quill.container,t=this.activeEle.getBoundingClientRect(),n=e.getBoundingClientRect();Object.assign(this.overlay.style,{left:`${t.left-n.left-1+e.scrollLeft}px`,top:`${t.top-n.top+this.quill.root.scrollTop}px`,width:`${t.width}px`,height:`${t.height}px`,marginTop:-1*this.quill.root.scrollTop+"px"})}addBlotsSelectedClass(e){if(!e){this.selectedBlots=[];return}try{const t=o=>{var i;return((i=o.statics)==null?void 0:i.blotName)==="image"},n=this.quill.scroll.descendants(t,e.index,e.length);this.selectedBlots=n.filter(o=>!o.statics||!this.options.contentOptions?!1:!!this.options.contentOptions.find(i=>i.blotName===o.statics.blotName))}catch{}}hide(){this.hideOverlay(),this.modules.forEach(e=>e.onDestroy()),this.modules=[],this.activeEle=void 0,this.blot=void 0}}ue(Q2,"Modules",{Base:wh,DisplaySize:sP,Toolbar:T1,Resize:aP,Keyboard:Bp});const ap=ke.import("delta"),lP=ke.import("modules/clipboard");function cP(r){let e=Number.parseFloat(r.getAttribute("width")||String(jn.colDefaultWidth));if(Number.isNaN(e)){const t=r.style.width;e=t?Number.parseFloat(t):r.offsetWidth}return e}function uP(r,e){const t=new Array(e).fill(jn.colDefaultWidth),n=Array.from(r.querySelectorAll("tr"));for(const o of n){const i=Array.from(o.querySelectorAll("td"));for(const[a,c]of i.entries())if(a<e){const d=cP(c);t[a]=d||t[a]}else break}return t}class dP extends lP{constructor(t,n){super(t,n);ue(this,"tableId",Lo());ue(this,"rowId",Lo());ue(this,"colIds",[]);ue(this,"rowspanCount",[]);ue(this,"cellCount",0);ue(this,"colCount",0);ue(this,"STYLE_PROPERTIES",["color","background","background-color","mso-pattern","border","border-color","border-top","border-right","border-bottom","border-left"]);this.quill=t,this.addMatcher("table",this.matchTable.bind(this)),this.addMatcher("colgroup",this.matchColgroup.bind(this)),this.addMatcher("col",this.matchCol.bind(this)),this.addMatcher("tr",this.matchTr.bind(this)),this.addMatcher("td",this.matchTd.bind(this)),this.addMatcher("th",this.matchTd.bind(this)),this.addMatcher("caption",this.matchCaption.bind(this))}matchTable(t,n){if(n.ops.length===0)return n;const o=[],i=[];let a=-1;for(let f=0;f<n.ops.length;f++){const{attributes:p,insert:m}=n.ops[f],{table:g,[je.tableCell]:v,...w}=p||{},E=Dc.isObject(m)&&m[je.tableCol];E?i.push({insert:m}):o.push({attributes:w,insert:m}),!(w!=null&&w[je.tableCellInner])&&!E&&(a=f)}const d=uP(t,this.colIds.length).reduce((f,p,m)=>(i[m]?f.push(i[m]):f.push({insert:{[je.tableCol]:{tableId:this.tableId,colId:this.colIds[m],width:p,full:!0}}}),f),[]);return o.splice(a+1,0,...d),this.tableId=Lo(),this.colIds=[],this.rowspanCount=[],this.cellCount=0,this.colCount=0,new ap(o)}matchColgroup(t,n){const o=[];for(let i=0;i<n.ops.length;i++){const a=n.ops[i];a&&Dc.isObject(a.insert)&&a.insert[je.tableCol]&&o.push(a)}return new ap(o)}matchCol(t){this.colIds[this.colCount]=Lo();const n=new ap().insert({[je.tableCol]:Object.assign(Ol.value(t),{tableId:this.tableId,colId:this.colIds[this.colCount]})});return this.colCount+=1,n}matchTr(t,n){this.rowId=Lo(),this.cellCount=0;for(const[o,i]of this.rowspanCount.entries())i.rowspan>0&&(i.rowspan-=1),i.rowspan<=0&&(this.rowspanCount[o]={rowspan:0,colspan:0});return n}matchTd(t,n){const o=t,i=xo.formats(o);if(!this.colIds[this.cellCount]||!this.rowspanCount[this.cellCount])for(let p=this.cellCount;p>=0;p--)this.colIds[p]||(this.colIds[p]=Lo()),this.rowspanCount[p]||(this.rowspanCount[p]={rowspan:0,colspan:0});const{colspan:a}=this.rowspanCount[this.cellCount];this.cellCount+=a,i.rowspan>0&&(this.rowspanCount[this.cellCount]={rowspan:i.rowspan,colspan:i.colspan});const c=this.colIds[this.cellCount];this.cellCount+=i.colspan;const d=Object.assign(i,{tableId:this.tableId,rowId:this.rowId,colId:c});this.handleBorderNoneStyles(o,d);const f=[];for(const p of n.ops){const{attributes:m={},...g}=p,{[je.tableCell]:v,...w}=m;f.push({...g,attributes:{...w,[je.tableCellInner]:d}})}return(f.length<=0||!Dc.isString(f[f.length-1].insert)||!f[f.length-1].insert.endsWith(`
|
356
356
|
`))&&f.push({insert:`
|
357
|
-
`,attributes:{[je.tableCellInner]:d}}),new ap(f)}handleBorderNoneStyles(t,n){if(!(n!=null&&n.style))return;["border",...["top","right","bottom","left"].flatMap(i=>[`border-${i}`,`border-${i}-style`])].filter(i=>t.style[i]==="none").forEach(i=>n.style=n.style.replaceAll(new RegExp(`${i}:none;?`,"g"),""))}convert({html:t,text:n},o={}){if(t){const c=new DOMParser().parseFromString(t,"text/html");this.preprocessTableHtml(c),this.mergeClassStylesToInline(c),t=c.body.innerHTML}const i=super.convert({html:t,text:n},o);if(o[je.tableCellInner])for(const a of i.ops){if(Dc.isObject(a.insert)&&a.insert[je.tableCol]){a.insert="";continue}a.attributes||(a.attributes={}),a.attributes[je.tableCellInner]=o[je.tableCellInner]}return i}parseStyleWithFilter(t,n){if(!t)return{};const o={};let i="",a="",c=!0,d=0;for(let f=0;f<t.length;f++){const p=t[f];p===":"&&c?(i=t.substring(d,f).trim(),d=f+1,c=!1):p===";"&&(!c&&i&&(a=t.substring(d,f).trim(),(!n||n(i))&&(o[i]=a)),d=f+1,c=!0)}return!c&&i&&d<t.length&&(a=t.substring(d).trim(),(!n||n(i))&&(o[i]=a)),o}mergeClassStylesToInline(t){var n;try{const o=t.querySelectorAll("td[class], th[class]");if(o.length===0)return;const i=new Set;for(const p of o)(p.getAttribute("class")||"").split(/\s+/).filter(Boolean).forEach(g=>i.add(g));if(i.size===0)return;const a=t.querySelectorAll("style");if(a.length===0)return;const c=Array.from(a).map(p=>p.textContent||"").join("");if(!c)return;const d={},f=p=>this.STYLE_PROPERTIES.some(m=>p.startsWith(m));for(const p of i){const m=new RegExp(`\\.${p}[^{]*{([^}]*)}`,"g");let g;for(;(g=m.exec(c))!==null;){const v=g[1],w=this.parseStyleWithFilter(v),E={};let S=!1;for(const A in w)f(A)&&(E[A]=w[A],S=!0);S&&(d[p]=E)}}if(Object.keys(d).length===0)return;for(let p=0;p<o.length;p++){const m=o[p],g=((n=m.getAttribute("class"))==null?void 0:n.split(/\s+/).filter(Boolean))||[],v=m.getAttribute("style")||"",w=this.parseStyleWithFilter(v);let E=!1;for(const S of g){const A=d[S];if(A)for(const k in A)w[k]||(w[k]=A[k],E=!0)}if(E){let S="";for(const A in w)S+=A+":"+w[A]+";";S&&m.setAttribute("style",S)}m.removeAttribute("class")}}catch(o){console.error("스타일 처리 오류",o)}}matchCaption(t,n){for(let o=0;o<n.ops.length;o++){const i=n.ops[o],{attributes:a}=i;a&&a[je.tableCaption]&&(a[je.tableCaption].tableId=this.tableId,i.attributes=a)}return n}preprocessTableHtml(t){try{const n=t.querySelectorAll("table");for(const o of Array.from(n))o.querySelectorAll("tr").length!==0&&(this.cleanupTableStyles(o),this.applyRowspanHeights(o),this.fixRowspanCells(o));this.mergeClassStylesToInline(t)}catch(n){console.error("테이블 전처리 오류",n)}}cleanupTableStyles(t){const n=t.querySelectorAll("td, th, tr, colgroup");for(const o of n){const i=o;i.removeAttribute("height");const a=i.getAttribute("style");if(a){const c=a.replace(/height\s*:[^;]*;?/gi,"").trim();i.setAttribute("style",c||"")}}}applyRowspanHeights(t){const o=t.querySelectorAll("td, th");t.style.borderCollapse="collapse";for(const i of o){const a=i,d=parseInt(a.getAttribute("rowspan")||"1")*24,f=a.getAttribute("style")||"",p=f+(f?"; ":"")+`height: ${d}px`;a.setAttribute("style",p)}}fixRowspanCells(t){const n=t.querySelectorAll("tr");if(n.length<=1)return;const o=[],i=new Map;for(let a=0;a<n.length;a++){const d=n[a].querySelectorAll("td, th");if(d.length===0&&a<n.length-1){o.push(a);continue}for(const f of Array.from(d)){const p=parseInt(f.getAttribute("rowspan")||"1");if(p>1)for(let m=1;m<p;m++){const g=a+m;if(g>=n.length)break;i.has(g)||i.set(g,[]),i.get(g).push(f)}}}o.length>0&&this.processEmptyRows(o,n,i)}processEmptyRows(t,n,o){for(const i of t){const a=o.get(i);if(a)for(const c of a){const d=parseInt(c.getAttribute("rowspan")||"1");d>1&&c.setAttribute("rowspan",(d-1).toString())}}for(const i of t.reverse())n[i].remove()}}class fP extends Pp{fixUnusuaDeletelTable(){}mergeCells(e){if(!this.table||!this.tableSelection)return;const t=this.tableSelection.selectedTds||[];if(t.length>1&&(e=t),!e||e.length<=1)return;const n=Un(e[0],je.tableMain),o=n.getRows(),i=e.map(g=>{if(!g||!g.parent||!g.parent.domNode)return null;const v=g.parent.domNode;if(!v)return null;const w=o.findIndex(A=>A.rowId===g.rowId);if(w===-1)return null;const E=g.getColumnIndex();if(E===-1)return null;const S=v.getBoundingClientRect();return!S||S.width===0||S.height===0?null:{td:g,rowIndex:w,colIndex:E,rowspan:g.rowspan,colspan:g.colspan,visualLeft:S.left,visualRight:S.right,visualTop:S.top,visualBottom:S.bottom}}).filter(Boolean);if(i.length<=1)return;i.sort((g,v)=>g.visualTop-v.visualTop||g.visualLeft-v.visualLeft);const a=i[0],c=a.td,d=Math.max(...i.map(g=>g.rowIndex+g.rowspan-1)),f=Math.max(...i.map(g=>g.colIndex+g.colspan-1)),p=d-a.rowIndex+1,m=f-a.colIndex+1;for(const g of i)g.td!==c&&(g.td.moveChildren(c),g.td.parent.remove());c.rowspan=p,c.colspan=m,this.fixTableByRemove(n)}}ke.register({"modules/imageCompress":fh,"modules/resize":Q2,"modules/tableUp":fP,"modules/magicUrl":YO,"formats/divider":E1,"modules/clipboard":dP,"modules/copy":YN},!0);const Pd={KB:1024,QUALITY:.7,IMAGE_SIZES:new Map},hP={getCharLength:r=>Array.from(r).length,calculateTextSize:r=>{if(!r.ops||r.ops.length===0)return 0;let e=0;for(const t of r.ops)if(typeof t.insert=="string")e+=new TextEncoder().encode(t.insert).length-1;else if(typeof t.insert=="object"&&t.insert.image){const n=t.insert.image;n&&(e+=Pd.IMAGE_SIZES.get(n)||Math.ceil(n.length*Pd.QUALITY))}return e}},pP=r=>{const{errorMessage:e,type:t="Primary",editorRef:n,useValue:o,useError:i,placeholder:a,tabIndex:c,autoFocus:d,editorProps:f,wrapProps:p,helperText:m,label:g,labelProps:v,wrapType:w,style:E,minHeight:S,maxHeight:A,contentHeight:k,contentMaxHeight:O=1e3,toolbarSize:I="Med",toolbarType:P="Default",readOnly:j,limitPosition:W="Bottom",maxLength:F,size:G=100,editorClassName:ge,editorStyle:B,noImageResize:q,...V}=r,X=C.useMemo(()=>t==="ReadOnly"||j,[t,j]),ce=C.useMemo(()=>k?20:0,[k]),[oe,ie]=C.useState(I==="Med"?40:50),se=C.useMemo(()=>X?0:oe,[X,oe]),[pe,ee]=C.useMemo(()=>!i||X||W==="Top"?[0,0]:[20,6],[i,X,W]),ne=C.useMemo(()=>pe+ee,[pe,ee]),[ae,we]=C.useState(k),[De,le]=C.useState(!1),[Ae,Ie]=C.useState(!1),Ue=C.useRef(null),We=C.useRef(0),xe=C.useRef(0),Se=C.useMemo(()=>g?24:0,[g]),Ce=C.useMemo(()=>P==="Title",[P]),Re=C.useMemo(()=>k||S||Ce,[k,S,Ce]),ze=C.useMemo(()=>Re?"fit-content":A?A+Se:`calc(100% - ${Se}px)`,[Re,A,Se]),nt=C.useMemo(()=>{if(k){if(ae)switch(t){case"ReadOnly":return ae;case"Raw":return ae+ne;default:return ae+se+ne}}else return},[k,ae,t,se,ne]),He=C.useMemo(()=>{if(!(!A||A<=se+ne))switch(t){case"ReadOnly":return A;case"Raw":return A-ne;default:return A-se-ne}},[t,se,ne,A]),tt=C.useMemo(()=>{if(S&&k){const it=Math.min(S-se-ne,k);return X?it:it+se+ne}else return S||(k?void 0:`calc(100% - ${Se}px)`)},[S,k,Se,se,ne,X]),lt=C.useMemo(()=>(Array.isArray(e)?e.some(Boolean):!!e)?"Error":t,[e,t]),Be=C.useCallback(it=>{const st=document.createElement("div");return st.innerHTML=it,new ke(st,{readOnly:!0}).getContents()},[]),[Ye,dt]=gn(o,""),[xt,vt]=C.useState(()=>Be(Ye));C.useEffect(()=>{dt===void 0&&vt(Be(Ye))},[Be,dt,Ye]);const At=C.useMemo(()=>_.jsx(gP,{htmlDelta:xt,isReadonly:X,limit:G*Pd.KB,useError:i}),[xt,X,G,i]),Ve=C.useRef(null),et=C.useRef([]),[ft,kt]=C.useState(!0);C.useEffect(()=>{const it=setTimeout(()=>kt(!1),0);return()=>{clearTimeout(it),et.current.forEach(st=>st()),et.current=[]}},[]);const St=C.useCallback((it,st)=>{if(!k)return st;const yt=S?S-se-ne:k,pt=Math.max(yt,0),Ot=A?A-se-ne:O;return Math.min(Ot,Math.max(pt,st+it))},[k,S,se,ne,A,O]),Rt=C.useCallback(it=>{if(!De||!k)return;const st=it.clientY-xe.current,yt=St(st,We.current);ae!==yt&&we(yt),it.preventDefault(),it.stopPropagation()},[De,k,St,ae]),Yt=C.useCallback(it=>{le(!1),Ie(!1),document.removeEventListener("mousemove",Rt),document.removeEventListener("mouseup",Yt),it.preventDefault(),it.stopPropagation()},[Rt]),qt=C.useCallback(it=>{if(!k)return;if(it.detail===2){we(k);return}ae===void 0?(we(k),We.current=k):We.current=ae,le(!0),Ie(!0),xe.current=it.clientY;const st=pt=>{if(!k)return;const Ot=pt.clientY-xe.current,Dt=St(Ot,We.current);we(Dt),pt.preventDefault(),pt.stopPropagation()},yt=pt=>{le(!1),Ie(!1),document.removeEventListener("mousemove",st),document.removeEventListener("mouseup",yt),pt.preventDefault(),pt.stopPropagation()};document.addEventListener("mousemove",st),document.addEventListener("mouseup",yt),it.preventDefault(),it.stopPropagation()},[k,ae,St]),fr=C.useCallback((it,st,yt,pt)=>{if(yt!=="user"&&yt!=="api")return;const Ot=pt.getContents(),rr=pt.getLength()-1>F,Vt=re=>re.replace(/\s{2,}/g,ye=>" ".repeat(ye.length)),zt=Vt(it);if(!rr){vt(Ot),dt==null||dt(zt);return}const pr=Sr(Ot,F);vt(pr);const Or=new ke(document.createElement("div"));Or.setContents(pr);const Ke=Vt(Or.root.innerHTML);dt==null||dt(Ke)},[dt,F]),Sr=(it,st)=>{var Ot,Dt,rr;if(!it.ops)return it;const yt=new Xt;let pt=0;for(const Vt of it.ops){if(pt>=st)break;if(Vt.insert&&typeof Vt.insert=="string"){const zt=Vt.insert,pr=st-pt;if(zt.length<=pr)(Ot=yt.ops)==null||Ot.push(Vt),pt+=zt.length;else{const Or={...Vt,insert:zt.substring(0,pr)};(Dt=yt.ops)==null||Dt.push(Or),pt+=pr;break}}else pt<st&&((rr=yt.ops)==null||rr.push(Vt),pt+=1)}return yt},hr=C.useCallback(it=>{var Ot,Dt;const st=it.getEditor().container;if(!st)return null;const yt=(Ot=st.closest(".AEditorContainer"))==null?void 0:Ot.querySelector(".ql-toolbar");return yt||((Dt=st.parentElement)==null?void 0:Dt.querySelector(".ql-toolbar"))||null},[]),Ee=C.useCallback((it,st,yt,pt)=>{if(!it)return;const Ot=yt;it.addEventListener(st,Ot,pt),et.current.push(()=>it.removeEventListener(st,Ot,pt))},[]),de=C.useCallback((it,st,yt)=>{const pt=st.getFormat();it.forEach(Ot=>{if(pt[Ot]){const Dt=pt[Ot],rr=`.ql-${Ot}`,Vt=yt.querySelector(`${rr} .ql-picker-label`),zt=yt.querySelectorAll(`${rr} .ql-picker-item`),pr=Array.from(zt).find(Or=>Or.getAttribute("data-value")===Dt);pr&&(pr.classList.add("ql-selected"),Vt==null||Vt.classList.add("ql-active"))}})},[]),rt=C.useCallback(it=>{if(!it.length)return;const pt=it[0].target.getBoundingClientRect(),Ot=Math.ceil(pt.height);ie(Dt=>Math.abs(Dt-Ot)<.1?Dt:Ot)},[]),qe=C.useCallback((it,st)=>{if(it.key!=="Backspace")return;const yt=st.getSelection(!1);if(!yt||yt.length>0)return;const pt=yt.index;if(pt<=0)return;const[Ot]=st.getLine(pt);if(Ot&&pt===st.getIndex(Ot)||st.getFormat(pt,1).link)return;const Dt=st.getFormat(pt-1,1);if(Dt.link){it.preventDefault();let rr=pt-1;for(;rr>0&&st.getFormat(rr-1,1).link===Dt.link;)rr--;const[Vt]=st.scroll.descendant(zt=>{var pr;return((pr=zt==null?void 0:zt.statics)==null?void 0:pr.blotName)==="link"},rr);if(Vt!=null&&Vt.domNode){const zt=(Vt.domNode.textContent||"").length;st.removeFormat(rr,zt)}}},[]),ht=C.useCallback(()=>({clipboard:{matchers:[["img",()=>!1],["table",()=>!1],["iframe",()=>!1],["video",()=>!1],["h1, h2, h3, h4, h5, h6",()=>!1],["blockquote",()=>!1],["hr",()=>!1]]},copy:{isTitleMode:!0},keyboard:{bindings:{enter:{key:"Enter",handler:()=>!1},newline:{key:"Enter",shiftKey:!0,handler:()=>!1},tab:{key:"Tab",handler:()=>!1},"remove-newline":{key:"Backspace",collapsed:!0,format:["blockquote","list","code-block"],offset:0,handler:function(it){const{blockquote:st,list:yt,["code-block"]:pt}=it.getFormat();return st||yt||pt?(it.format("blockquote",!1),it.format("list",!1),it.format("code-block",!1),!1):!0}}}},magicUrl:!0,toolbar:{container:[["bold","italic","underline","strike",{color:[]},{background:[]},"clean"]]}}),[]),wt=C.useCallback(()=>({clipboard:{},copy:!0,keyboard:{},magicUrl:!0,imageCompress:{quality:Pd.QUALITY,imageType:"image/jpeg",maxWidth:1500,maxHeight:1500,debug:!1,handleOnPaste:it=>{var st,yt;try{const pt=(st=it.clipboardData)==null?void 0:st.items;if(!pt)return!0;const Ot=Array.from(pt).some(Vt=>{const zt=Vt.type.toLowerCase();return zt.includes("Excel")||zt.includes("text/html")}),Dt=(yt=it.clipboardData)==null?void 0:yt.getData("text/html"),rr=Dt&&(Dt.includes("<table")||Dt.includes("<tbody")||Dt.includes("<td"));return!(Ot||rr)}catch(pt){return console.warn("Error in handleOnPaste:",pt),!0}},insertIntoEditor:(it,st,yt)=>{Pd.IMAGE_SIZES.has(it)||Pd.IMAGE_SIZES.set(it,st.size);const pt=yt.getSelection();pt&&yt.insertEmbed(pt.index,"image",it,ke.sources.USER)}},...!X&&{...!q&&{resize:{}},table:!1,tableUp:{fullSwitch:!1,icon:yp.renderToString(_.jsx(ln,{icon:"Table",size:I==="Med"?"sm":"md",strokeWidth:2.5})),resize:MN,resizeScale:LN,customSelect:jN,selection:DN,fixUnusuaDeletelTable:!1,selectionOptions:{tableMenu:RN,tableMenuOptions:{localstorageKey:"used-color",tipText:!0,tools:[Gr.InsertCaption,Gr.InsertTop,Gr.InsertRight,Gr.InsertBottom,Gr.InsertLeft,Gr.Break,Gr.MergeCell,Gr.SplitCell,Gr.Break,Gr.DeleteRow,Gr.DeleteColumn,Gr.DeleteTable,Gr.Break,Gr.BackgroundColor,Gr.BorderColor,Gr.Break,Gr.CopyCell,Gr.CutCell,Gr.Break,Gr.SwitchWidth]}},texts:{fullCheckboxText:dr.AEditor["Insert Full Width Table"],customBtnText:dr.AEditor.Custom,confirmText:dr.AEditor.Confirm,cancelText:dr.AEditor.Cancel,rowText:dr.AEditor.Row,colText:dr.AEditor.Column,CopyCell:dr.AEditor["Copy Cell"],CutCell:dr.AEditor["Cut Cell"],notPositiveNumberError:dr.AEditor["Not Positive Number Error"],custom:dr.AEditor.Custom,clear:dr.AEditor.Clear,transparent:dr.AEditor.Transparent,perWidthInsufficient:dr.AEditor.perWidthInsufficient,InsertTop:dr.AEditor["Insert Row Top"],InsertRight:dr.AEditor["Insert Column Right"],InsertBottom:dr.AEditor["Insert Row Bottom"],InsertLeft:dr.AEditor["Insert Column Left"],MergeCell:dr.AEditor["Merge Cell"],SplitCell:dr.AEditor["Split Cell"],DeleteRow:dr.AEditor["Delete Row"],DeleteColumn:dr.AEditor["Delete Column"],DeleteTable:dr.AEditor["Delete Table"],BackgroundColor:dr.AEditor["Set Background Color"],BorderColor:dr.AEditor["Set Border Color"],SwitchWidth:dr.AEditor["Switch Table Width"],InsertCaption:dr.AEditor["Insert Table Caption"]}},toolbar:{container:[[{header:[1,2,3,!1,4]}],["bold","italic","underline","strike","blockquote","divider",{[Pp.toolName]:[]},{color:[]},{background:[]}],[{list:"ordered"},{list:"bullet"},{indent:"-1"},{indent:"+1"},{align:[]}],["link","image","video"],["clean"]],handlers:{divider:function(){const it=this.quill,st=it.getSelection(!0);if(!st)return;const yt=Math.min(st.index+1,it.getLength()-1);it.insertEmbed(yt,"divider",!0,ke.sources.USER),setTimeout(()=>it.setSelection(Math.min(yt+1,it.getLength()-1),0,ke.sources.SILENT),0)}}}}}),[X,q,I]),Tt=C.useMemo(()=>Ce?ht():wt(),[Ce,ht,wt]),Ft=C.useCallback(it=>{if(!it)return;const st=it.getEditor();if(!st)return;const yt=st.root,pt=hr(it);yt&&ge&&yt.classList.add(...ge.split(" ")),yt&&B&&Object.entries(B).forEach(([Dt,rr])=>{const Vt=Dt.replace(/([A-Z])/g,zt=>`-${zt[0].toLowerCase()}`);yt.style[Vt]=rr}),Ee(yt,"keydown",Dt=>qe(Dt,st));const Ot=new ResizeObserver(rt);if(pt){Ot.observe(pt),et.current.push(()=>Ot.disconnect());const Dt=["header","color","background"];Dt.forEach(rr=>{const Vt=pt.querySelector(`.ql-${rr} .ql-picker-label`);Vt&&Ee(Vt,"click",()=>de(Dt,st,pt))})}},[hr,ge,B,Ee,rt,qe,de]),Lt=C.useCallback(it=>{if(et.current.forEach(yt=>yt()),et.current=[],Ve.current=it,!it){Dc.isFunction(n)?n(null):n!=null&&n.current&&(n.current=null);return}const st=it;st.copyContent=yt=>{it.getEditor().getModule("copy").copyContent(yt)},Dc.isFunction(n)?n(st):n!=null&&n.current&&(n.current=st),Ft(it)},[n,Ft]);return _.jsx($c,{helperText:m,wrapType:w,labelProps:{...v,style:{minHeight:g?20:void 0,marginBottom:g?4:0,...v==null?void 0:v.style}},errorMessage:e,label:_.jsxs(Tn,{style:{gap:4},children:[g,W==="Top"&&At]}),wrapProps:{...p,className:Ge.clsx(p==null?void 0:p.className,!Re&&Mi.AEditorWrapper),style:{...p==null?void 0:p.style,height:ze}},children:_.jsxs(Zr,{...V,className:Ge.clsx(V.className,Mi.AEditorContainer,ft&&"NoTransition"),style:{...E,height:nt,minHeight:tt},children:[_.jsx(tg,{...f,ref:Lt,preserveWhitespace:!0,modules:Tt,placeholder:a,readOnly:X,theme:"snow",value:xt,className:Ge.clsx(f==null?void 0:f.className,Mi.AEditor,Mi[lt],Ce&&"Title",ft&&"NoTransition"),style:{...f==null?void 0:f.style,maxHeight:He?He+se:void 0,"--icon-size":`${I==="Med"?20:24}px`,"--editor-padding":Ce?"8px 12px":"12px","--toolbar-padding":`${I==="Med"?7.5:12.5}px`,"--content-height":Ce?"fit-content":ae?`${ae}px`:"100%","--content-max-height":He?`${He}px`:"100%","--default-text":`'${dr.AEditor.Default}'`,"--visit-url-text":`'${dr.AEditor["Visit URL:"]}'`,"--enter-link-text":`'${dr.AEditor["Enter link:"]}'`,"--enter-video-text":`'${dr.AEditor["Enter video:"]}'`,"--edit-text":`'${dr.AEditor.Edit}'`,"--save-text":`'${dr.AEditor.Save}'`,"--remove-text":`'${dr.AEditor.Remove}'`,"--arrow-background":`url("data:image/svg+xml,${encodeURIComponent(yp.renderToString(_.jsx(ln,{icon:"EditorArrow"})))}`,"--title-color-picker-row":Ce?1:4,"--title-header-font-size":`${I==="Med"?12:16}px`},onChange:fr}),k&&_.jsxs(_.Fragment,{children:[_.jsx("div",{ref:Ue,className:Ge.clsx(Mi.Resizer,ft&&"NoTransition"),style:{height:ce,bottom:i&&!X?ne:0},onMouseDown:qt}),_.jsx("div",{children:`${Math.round(ae)}px`,className:Ge.clsx(Mi.Indicator,"NoSelect","Label1",ft&&"NoTransition"),style:{height:ce,bottom:i&&!X?ne:0,display:Ae?"flex":"none"}})]}),_.jsx("div",{children:At,className:Ge.clsx(Mi.LimitContainer,"NoSelect",ft&&"NoTransition"),style:{marginTop:ee,minHeight:pe,display:W==="Bottom"?"flex":"none"}})]})})},gP=({htmlDelta:r,limit:e,useError:t,isReadonly:n})=>{const[o,i]=gn(t,!1),a=C.useMemo(()=>hP.calculateTextSize(r),[r]);return C.useEffect(()=>{i&&i(a>e)},[a,e,i]),!t||n?null:_.jsxs(Ya,{className:Mi.Limit,children:["(",_.jsx("span",{className:Ge.clsx(o&&Mi.Error),children:Lu(a)})," / ",Lu(e),")"]})};function mP(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];return C.useMemo(()=>n=>{e.forEach(o=>o(n))},e)}const og=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function lf(r){const e=Object.prototype.toString.call(r);return e==="[object Window]"||e==="[object global]"}function pv(r){return"nodeType"in r}function Di(r){var e,t;return r?lf(r)?r:pv(r)&&(e=(t=r.ownerDocument)==null?void 0:t.defaultView)!=null?e:window:window}function gv(r){const{Document:e}=Di(r);return r instanceof e}function Ch(r){return lf(r)?!1:r instanceof Di(r).HTMLElement}function eC(r){return r instanceof Di(r).SVGElement}function cf(r){return r?lf(r)?r.document:pv(r)?gv(r)?r:Ch(r)||eC(r)?r.ownerDocument:document:document:document}const el=og?C.useLayoutEffect:C.useEffect;function mv(r){const e=C.useRef(r);return el(()=>{e.current=r}),C.useCallback(function(){for(var t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];return e.current==null?void 0:e.current(...n)},[])}function vP(){const r=C.useRef(null),e=C.useCallback((n,o)=>{r.current=setInterval(n,o)},[]),t=C.useCallback(()=>{r.current!==null&&(clearInterval(r.current),r.current=null)},[]);return[e,t]}function ph(r,e){e===void 0&&(e=[r]);const t=C.useRef(r);return el(()=>{t.current!==r&&(t.current=r)},e),t}function Sh(r,e){const t=C.useRef();return C.useMemo(()=>{const n=r(t.current);return t.current=n,n},[...e])}function jp(r){const e=mv(r),t=C.useRef(null),n=C.useCallback(o=>{o!==t.current&&(e==null||e(o,t.current)),t.current=o},[]);return[t,n]}function k1(r){const e=C.useRef();return C.useEffect(()=>{e.current=r},[r]),e.current}let nm={};function _h(r,e){return C.useMemo(()=>{if(e)return e;const t=nm[r]==null?0:nm[r]+1;return nm[r]=t,r+"-"+t},[r,e])}function tC(r){return function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];return n.reduce((i,a)=>{const c=Object.entries(a);for(const[d,f]of c){const p=i[d];p!=null&&(i[d]=p+r*f)}return i},{...e})}}const Gd=tC(1),Fp=tC(-1);function yP(r){return"clientX"in r&&"clientY"in r}function vv(r){if(!r)return!1;const{KeyboardEvent:e}=Di(r.target);return e&&r instanceof e}function bP(r){if(!r)return!1;const{TouchEvent:e}=Di(r.target);return e&&r instanceof e}function R1(r){if(bP(r)){if(r.touches&&r.touches.length){const{clientX:e,clientY:t}=r.touches[0];return{x:e,y:t}}else if(r.changedTouches&&r.changedTouches.length){const{clientX:e,clientY:t}=r.changedTouches[0];return{x:e,y:t}}}return yP(r)?{x:r.clientX,y:r.clientY}:null}const gh=Object.freeze({Translate:{toString(r){if(!r)return;const{x:e,y:t}=r;return"translate3d("+(e?Math.round(e):0)+"px, "+(t?Math.round(t):0)+"px, 0)"}},Scale:{toString(r){if(!r)return;const{scaleX:e,scaleY:t}=r;return"scaleX("+e+") scaleY("+t+")"}},Transform:{toString(r){if(r)return[gh.Translate.toString(r),gh.Scale.toString(r)].join(" ")}},Transition:{toString(r){let{property:e,duration:t,easing:n}=r;return e+" "+t+"ms "+n}}}),hb="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function xP(r){return r.matches(hb)?r:r.querySelector(hb)}const wP={display:"none"};function CP(r){let{id:e,value:t}=r;return C.createElement("div",{id:e,style:wP},t)}function SP(r){let{id:e,announcement:t,ariaLiveType:n="assertive"}=r;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return C.createElement("div",{id:e,style:o,role:"status","aria-live":n,"aria-atomic":!0},t)}function _P(){const[r,e]=C.useState("");return{announce:C.useCallback(n=>{n!=null&&e(n)},[]),announcement:r}}const rC=C.createContext(null);function AP(r){const e=C.useContext(rC);C.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of <DndContext>");return e(r)},[r,e])}function EP(){const[r]=C.useState(()=>new Set),e=C.useCallback(n=>(r.add(n),()=>r.delete(n)),[r]);return[C.useCallback(n=>{let{type:o,event:i}=n;r.forEach(a=>{var c;return(c=a[o])==null?void 0:c.call(a,i)})},[r]),e]}const TP={draggable:`
|
357
|
+
`,attributes:{[je.tableCellInner]:d}}),new ap(f)}handleBorderNoneStyles(t,n){if(!(n!=null&&n.style))return;["border",...["top","right","bottom","left"].flatMap(i=>[`border-${i}`,`border-${i}-style`])].filter(i=>t.style[i]==="none").forEach(i=>n.style=n.style.replaceAll(new RegExp(`${i}:none;?`,"g"),""))}convert({html:t,text:n},o={}){if(t){const c=new DOMParser().parseFromString(t,"text/html");this.preprocessTableHtml(c),this.mergeClassStylesToInline(c),t=c.body.innerHTML}const i=super.convert({html:t,text:n},o);if(o[je.tableCellInner])for(const a of i.ops){if(Dc.isObject(a.insert)&&a.insert[je.tableCol]){a.insert="";continue}a.attributes||(a.attributes={}),a.attributes[je.tableCellInner]=o[je.tableCellInner]}return i}parseStyleWithFilter(t,n){if(!t)return{};const o={};let i="",a="",c=!0,d=0;for(let f=0;f<t.length;f++){const p=t[f];p===":"&&c?(i=t.substring(d,f).trim(),d=f+1,c=!1):p===";"&&(!c&&i&&(a=t.substring(d,f).trim(),(!n||n(i))&&(o[i]=a)),d=f+1,c=!0)}return!c&&i&&d<t.length&&(a=t.substring(d).trim(),(!n||n(i))&&(o[i]=a)),o}mergeClassStylesToInline(t){var n;try{const o=t.querySelectorAll("td[class], th[class]");if(o.length===0)return;const i=new Set;for(const p of o)(p.getAttribute("class")||"").split(/\s+/).filter(Boolean).forEach(g=>i.add(g));if(i.size===0)return;const a=t.querySelectorAll("style");if(a.length===0)return;const c=Array.from(a).map(p=>p.textContent||"").join("");if(!c)return;const d={},f=p=>this.STYLE_PROPERTIES.some(m=>p.startsWith(m));for(const p of i){const m=new RegExp(`\\.${p}[^{]*{([^}]*)}`,"g");let g;for(;(g=m.exec(c))!==null;){const v=g[1],w=this.parseStyleWithFilter(v),E={};let S=!1;for(const A in w)f(A)&&(E[A]=w[A],S=!0);S&&(d[p]=E)}}if(Object.keys(d).length===0)return;for(let p=0;p<o.length;p++){const m=o[p],g=((n=m.getAttribute("class"))==null?void 0:n.split(/\s+/).filter(Boolean))||[],v=m.getAttribute("style")||"",w=this.parseStyleWithFilter(v);let E=!1;for(const S of g){const A=d[S];if(A)for(const k in A)w[k]||(w[k]=A[k],E=!0)}if(E){let S="";for(const A in w)S+=A+":"+w[A]+";";S&&m.setAttribute("style",S)}m.removeAttribute("class")}}catch(o){console.error("스타일 처리 오류",o)}}matchCaption(t,n){for(let o=0;o<n.ops.length;o++){const i=n.ops[o],{attributes:a}=i;a&&a[je.tableCaption]&&(a[je.tableCaption].tableId=this.tableId,i.attributes=a)}return n}preprocessTableHtml(t){try{const n=t.querySelectorAll("table");for(const o of Array.from(n))o.querySelectorAll("tr").length!==0&&(this.cleanupTableStyles(o),this.applyRowspanHeights(o),this.fixRowspanCells(o));this.mergeClassStylesToInline(t)}catch(n){console.error("테이블 전처리 오류",n)}}cleanupTableStyles(t){const n=t.querySelectorAll("td, th, tr, colgroup");for(const o of n){const i=o;i.removeAttribute("height");const a=i.getAttribute("style");if(a){const c=a.replace(/height\s*:[^;]*;?/gi,"").trim();i.setAttribute("style",c||"")}}}applyRowspanHeights(t){const o=t.querySelectorAll("td, th");t.style.borderCollapse="collapse";for(const i of o){const a=i,d=parseInt(a.getAttribute("rowspan")||"1")*24,f=a.getAttribute("style")||"",p=f+(f?"; ":"")+`height: ${d}px`;a.setAttribute("style",p)}}fixRowspanCells(t){const n=t.querySelectorAll("tr");if(n.length<=1)return;const o=[],i=new Map;for(let a=0;a<n.length;a++){const d=n[a].querySelectorAll("td, th");if(d.length===0&&a<n.length-1){o.push(a);continue}for(const f of Array.from(d)){const p=parseInt(f.getAttribute("rowspan")||"1");if(p>1)for(let m=1;m<p;m++){const g=a+m;if(g>=n.length)break;i.has(g)||i.set(g,[]),i.get(g).push(f)}}}o.length>0&&this.processEmptyRows(o,n,i)}processEmptyRows(t,n,o){for(const i of t){const a=o.get(i);if(a)for(const c of a){const d=parseInt(c.getAttribute("rowspan")||"1");d>1&&c.setAttribute("rowspan",(d-1).toString())}}for(const i of t.reverse())n[i].remove()}}class fP extends Pp{fixUnusuaDeletelTable(){}mergeCells(e){if(!this.table||!this.tableSelection)return;const t=this.tableSelection.selectedTds||[];if(t.length>1&&(e=t),!e||e.length<=1)return;const n=Un(e[0],je.tableMain),o=n.getRows(),i=e.map(g=>{if(!g||!g.parent||!g.parent.domNode)return null;const v=g.parent.domNode;if(!v)return null;const w=o.findIndex(A=>A.rowId===g.rowId);if(w===-1)return null;const E=g.getColumnIndex();if(E===-1)return null;const S=v.getBoundingClientRect();return!S||S.width===0||S.height===0?null:{td:g,rowIndex:w,colIndex:E,rowspan:g.rowspan,colspan:g.colspan,visualLeft:S.left,visualRight:S.right,visualTop:S.top,visualBottom:S.bottom}}).filter(Boolean);if(i.length<=1)return;i.sort((g,v)=>g.visualTop-v.visualTop||g.visualLeft-v.visualLeft);const a=i[0],c=a.td,d=Math.max(...i.map(g=>g.rowIndex+g.rowspan-1)),f=Math.max(...i.map(g=>g.colIndex+g.colspan-1)),p=d-a.rowIndex+1,m=f-a.colIndex+1;for(const g of i)g.td!==c&&(g.td.moveChildren(c),g.td.parent.remove());c.rowspan=p,c.colspan=m,this.fixTableByRemove(n)}}ke.register({"modules/imageCompress":fh,"modules/resize":Q2,"modules/tableUp":fP,"modules/magicUrl":YO,"formats/divider":E1,"modules/clipboard":dP,"modules/copy":YN},!0);const Pd={KB:1024,QUALITY:.7,IMAGE_SIZES:new Map},hP={getCharLength:r=>Array.from(r).length,calculateTextSize:r=>{if(!r.ops||r.ops.length===0)return 0;let e=0;for(const t of r.ops)if(typeof t.insert=="string")e+=new TextEncoder().encode(t.insert).length-1;else if(typeof t.insert=="object"&&t.insert.image){const n=t.insert.image;n&&(e+=Pd.IMAGE_SIZES.get(n)||Math.ceil(n.length*Pd.QUALITY))}return e}},pP=r=>{const{errorMessage:e,type:t="Primary",editorRef:n,useValue:o,useError:i,placeholder:a,tabIndex:c,autoFocus:d,editorProps:f,wrapProps:p,helperText:m,label:g,labelProps:v,wrapType:w,style:E,minHeight:S,maxHeight:A,contentHeight:k,contentMaxHeight:O=1e3,toolbarSize:I="Med",toolbarType:P="Default",readOnly:j,limitPosition:W="Bottom",maxLength:F,size:G=100,editorClassName:ge,editorStyle:B,noImageResize:q,...V}=r,X=C.useMemo(()=>t==="ReadOnly"||j,[t,j]),ce=C.useMemo(()=>k?20:0,[k]),[oe,ie]=C.useState(I==="Med"?40:50),se=C.useMemo(()=>X?0:oe,[X,oe]),[pe,ee]=C.useMemo(()=>!i||X||W==="Top"?[0,0]:[20,6],[i,X,W]),ne=C.useMemo(()=>pe+ee,[pe,ee]),[ae,we]=C.useState(k),[De,le]=C.useState(!1),[Ae,Ie]=C.useState(!1),Ue=C.useRef(null),We=C.useRef(0),xe=C.useRef(0),Se=C.useMemo(()=>g?24:0,[g]),Ce=C.useMemo(()=>P==="Title",[P]),Re=C.useMemo(()=>k||S||Ce,[k,S,Ce]),ze=C.useMemo(()=>Re?"fit-content":A?A+Se:`calc(100% - ${Se}px)`,[Re,A,Se]),nt=C.useMemo(()=>{if(k){if(ae)switch(t){case"ReadOnly":return ae;case"Raw":return ae+ne;default:return ae+se+ne}}else return},[k,ae,t,se,ne]),He=C.useMemo(()=>{if(!(!A||A<=se+ne))switch(t){case"ReadOnly":return A;case"Raw":return A-ne;default:return A-se-ne}},[t,se,ne,A]),tt=C.useMemo(()=>{if(S&&k){const it=Math.min(S-se-ne,k);return X?it:it+se+ne}else return S||(k?void 0:`calc(100% - ${Se}px)`)},[S,k,Se,se,ne,X]),lt=C.useMemo(()=>(Array.isArray(e)?e.some(Boolean):!!e)?"Error":t,[e,t]),Be=C.useCallback(it=>{const st=document.createElement("div");return st.innerHTML=it,new ke(st,{readOnly:!0}).getContents()},[]),[Ye,dt]=gn(o,""),[xt,vt]=C.useState(()=>Be(Ye));C.useEffect(()=>{dt===void 0&&vt(Be(Ye))},[Be,dt,Ye]);const At=C.useMemo(()=>_.jsx(gP,{htmlDelta:xt,isReadonly:X,limit:G*Pd.KB,useError:i}),[xt,X,G,i]),Ve=C.useRef(null),et=C.useRef([]),[ft,kt]=C.useState(!0);C.useEffect(()=>{const it=setTimeout(()=>kt(!1),0);return()=>{clearTimeout(it),et.current.forEach(st=>st()),et.current=[]}},[]);const St=C.useCallback((it,st)=>{if(!k)return st;const yt=S?S-se-ne:k,pt=Math.max(yt,0),Ot=A?A-se-ne:O;return Math.min(Ot,Math.max(pt,st+it))},[k,S,se,ne,A,O]),Rt=C.useCallback(it=>{if(!De||!k)return;const st=it.clientY-xe.current,yt=St(st,We.current);ae!==yt&&we(yt),it.preventDefault(),it.stopPropagation()},[De,k,St,ae]),Yt=C.useCallback(it=>{le(!1),Ie(!1),document.removeEventListener("mousemove",Rt),document.removeEventListener("mouseup",Yt),it.preventDefault(),it.stopPropagation()},[Rt]),qt=C.useCallback(it=>{if(!k)return;if(it.detail===2){we(k);return}ae===void 0?(we(k),We.current=k):We.current=ae,le(!0),Ie(!0),xe.current=it.clientY;const st=pt=>{if(!k)return;const Ot=pt.clientY-xe.current,Dt=St(Ot,We.current);we(Dt),pt.preventDefault(),pt.stopPropagation()},yt=pt=>{le(!1),Ie(!1),document.removeEventListener("mousemove",st),document.removeEventListener("mouseup",yt),pt.preventDefault(),pt.stopPropagation()};document.addEventListener("mousemove",st),document.addEventListener("mouseup",yt),it.preventDefault(),it.stopPropagation()},[k,ae,St]),fr=C.useCallback((it,st,yt,pt)=>{if(yt!=="user"&&yt!=="api")return;const Ot=pt.getContents(),rr=pt.getLength()-1>F,Vt=re=>re.replace(/\s{2,}/g,ye=>" ".repeat(ye.length)),zt=Vt(it);if(!rr){vt(Ot),dt==null||dt(zt);return}const pr=Sr(Ot,F);vt(pr);const Or=new ke(document.createElement("div"));Or.setContents(pr);const Ke=Vt(Or.root.innerHTML);dt==null||dt(Ke)},[dt,F]),Sr=(it,st)=>{var Ot,Dt,rr;if(!it.ops)return it;const yt=new Xt;let pt=0;for(const Vt of it.ops){if(pt>=st)break;if(Vt.insert&&typeof Vt.insert=="string"){const zt=Vt.insert,pr=st-pt;if(zt.length<=pr)(Ot=yt.ops)==null||Ot.push(Vt),pt+=zt.length;else{const Or={...Vt,insert:zt.substring(0,pr)};(Dt=yt.ops)==null||Dt.push(Or),pt+=pr;break}}else pt<st&&((rr=yt.ops)==null||rr.push(Vt),pt+=1)}return yt},hr=C.useCallback(it=>{var Ot,Dt;const st=it.getEditor().container;if(!st)return null;const yt=(Ot=st.closest(".AEditorContainer"))==null?void 0:Ot.querySelector(".ql-toolbar");return yt||((Dt=st.parentElement)==null?void 0:Dt.querySelector(".ql-toolbar"))||null},[]),Ee=C.useCallback((it,st,yt,pt)=>{if(!it)return;const Ot=yt;it.addEventListener(st,Ot,pt),et.current.push(()=>it.removeEventListener(st,Ot,pt))},[]),de=C.useCallback((it,st,yt)=>{const pt=st.getFormat();it.forEach(Ot=>{if(pt[Ot]){const Dt=pt[Ot],rr=`.ql-${Ot}`,Vt=yt.querySelector(`${rr} .ql-picker-label`),zt=yt.querySelectorAll(`${rr} .ql-picker-item`),pr=Array.from(zt).find(Or=>Or.getAttribute("data-value")===Dt);pr&&(pr.classList.add("ql-selected"),Vt==null||Vt.classList.add("ql-active"))}})},[]),rt=C.useCallback(it=>{if(!it.length)return;const pt=it[0].target.getBoundingClientRect(),Ot=Math.ceil(pt.height);ie(Dt=>Math.abs(Dt-Ot)<.1?Dt:Ot)},[]),qe=C.useCallback((it,st)=>{if(it.key!=="Backspace")return;const yt=st.getSelection(!1);if(!yt||yt.length>0)return;const pt=yt.index;if(pt<=0)return;const[Ot]=st.getLine(pt);if(Ot&&pt===st.getIndex(Ot)||st.getFormat(pt,1).link)return;const Dt=st.getFormat(pt-1,1);if(Dt.link){it.preventDefault();let rr=pt-1;for(;rr>0&&st.getFormat(rr-1,1).link===Dt.link;)rr--;const[Vt]=st.scroll.descendant(zt=>{var pr;return((pr=zt==null?void 0:zt.statics)==null?void 0:pr.blotName)==="link"},rr);if(Vt!=null&&Vt.domNode){const zt=(Vt.domNode.textContent||"").length;st.removeFormat(rr,zt)}}},[]),ht=C.useCallback(()=>({clipboard:{matchers:[["img",()=>!1],["table",()=>!1],["iframe",()=>!1],["video",()=>!1],["h1, h2, h3, h4, h5, h6",()=>!1],["blockquote",()=>!1],["hr",()=>!1]]},copy:{isTitleMode:!0},keyboard:{bindings:{enter:{key:"Enter",handler:()=>!1},newline:{key:"Enter",shiftKey:!0,handler:()=>!1},tab:{key:"Tab",handler:()=>!1},"remove-newline":{key:"Backspace",collapsed:!0,format:["blockquote","list","code-block"],offset:0,handler:function(it){const{blockquote:st,list:yt,["code-block"]:pt}=it.getFormat();return st||yt||pt?(it.format("blockquote",!1),it.format("list",!1),it.format("code-block",!1),!1):!0}}}},magicUrl:!0,toolbar:{container:[["bold","italic","underline","strike",{color:[]},{background:[]},"clean"]]}}),[]),wt=C.useCallback(()=>({clipboard:{},copy:{},keyboard:{},magicUrl:!0,imageCompress:{quality:Pd.QUALITY,imageType:"image/jpeg",maxWidth:1500,maxHeight:1500,debug:!1,handleOnPaste:it=>{var st,yt;try{const pt=(st=it.clipboardData)==null?void 0:st.items;if(!pt)return!0;const Ot=Array.from(pt).some(Vt=>{const zt=Vt.type.toLowerCase();return zt.includes("Excel")||zt.includes("text/html")}),Dt=(yt=it.clipboardData)==null?void 0:yt.getData("text/html"),rr=Dt&&(Dt.includes("<table")||Dt.includes("<tbody")||Dt.includes("<td"));return!(Ot||rr)}catch(pt){return console.warn("Error in handleOnPaste:",pt),!0}},insertIntoEditor:(it,st,yt)=>{Pd.IMAGE_SIZES.has(it)||Pd.IMAGE_SIZES.set(it,st.size);const pt=yt.getSelection();pt&&yt.insertEmbed(pt.index,"image",it,ke.sources.USER)}},...!X&&{...!q&&{resize:{}},table:!1,tableUp:{fullSwitch:!1,icon:yp.renderToString(_.jsx(ln,{icon:"Table",size:I==="Med"?"sm":"md",strokeWidth:2.5})),resize:MN,resizeScale:LN,customSelect:jN,selection:DN,fixUnusuaDeletelTable:!1,selectionOptions:{tableMenu:RN,tableMenuOptions:{localstorageKey:"used-color",tipText:!0,tools:[Gr.InsertCaption,Gr.InsertTop,Gr.InsertRight,Gr.InsertBottom,Gr.InsertLeft,Gr.Break,Gr.MergeCell,Gr.SplitCell,Gr.Break,Gr.DeleteRow,Gr.DeleteColumn,Gr.DeleteTable,Gr.Break,Gr.BackgroundColor,Gr.BorderColor,Gr.Break,Gr.CopyCell,Gr.CutCell,Gr.Break,Gr.SwitchWidth]}},texts:{fullCheckboxText:dr.AEditor["Insert Full Width Table"],customBtnText:dr.AEditor.Custom,confirmText:dr.AEditor.Confirm,cancelText:dr.AEditor.Cancel,rowText:dr.AEditor.Row,colText:dr.AEditor.Column,CopyCell:dr.AEditor["Copy Cell"],CutCell:dr.AEditor["Cut Cell"],notPositiveNumberError:dr.AEditor["Not Positive Number Error"],custom:dr.AEditor.Custom,clear:dr.AEditor.Clear,transparent:dr.AEditor.Transparent,perWidthInsufficient:dr.AEditor.perWidthInsufficient,InsertTop:dr.AEditor["Insert Row Top"],InsertRight:dr.AEditor["Insert Column Right"],InsertBottom:dr.AEditor["Insert Row Bottom"],InsertLeft:dr.AEditor["Insert Column Left"],MergeCell:dr.AEditor["Merge Cell"],SplitCell:dr.AEditor["Split Cell"],DeleteRow:dr.AEditor["Delete Row"],DeleteColumn:dr.AEditor["Delete Column"],DeleteTable:dr.AEditor["Delete Table"],BackgroundColor:dr.AEditor["Set Background Color"],BorderColor:dr.AEditor["Set Border Color"],SwitchWidth:dr.AEditor["Switch Table Width"],InsertCaption:dr.AEditor["Insert Table Caption"]}},toolbar:{container:[[{header:[1,2,3,!1,4]}],["bold","italic","underline","strike","blockquote","divider",{[Pp.toolName]:[]},{color:[]},{background:[]}],[{list:"ordered"},{list:"bullet"},{indent:"-1"},{indent:"+1"},{align:[]}],["link","image","video"],["clean"]],handlers:{divider:function(){const it=this.quill,st=it.getSelection(!0);if(!st)return;const yt=Math.min(st.index+1,it.getLength()-1);it.insertEmbed(yt,"divider",!0,ke.sources.USER),setTimeout(()=>it.setSelection(Math.min(yt+1,it.getLength()-1),0,ke.sources.SILENT),0)}}}}}),[X,q,I]),Tt=C.useMemo(()=>Ce?ht():wt(),[Ce,ht,wt]),Ft=C.useCallback(it=>{if(!it)return;const st=it.getEditor();if(!st)return;const yt=st.root,pt=hr(it);yt&&ge&&yt.classList.add(...ge.split(" ")),yt&&B&&Object.entries(B).forEach(([Dt,rr])=>{const Vt=Dt.replace(/([A-Z])/g,zt=>`-${zt[0].toLowerCase()}`);yt.style[Vt]=rr}),Ee(yt,"keydown",Dt=>qe(Dt,st));const Ot=new ResizeObserver(rt);if(pt){Ot.observe(pt),et.current.push(()=>Ot.disconnect());const Dt=["header","color","background"];Dt.forEach(rr=>{const Vt=pt.querySelector(`.ql-${rr} .ql-picker-label`);Vt&&Ee(Vt,"click",()=>de(Dt,st,pt))})}},[hr,ge,B,Ee,rt,qe,de]),Lt=C.useCallback(it=>{if(et.current.forEach(yt=>yt()),et.current=[],Ve.current=it,!it){Dc.isFunction(n)?n(null):n!=null&&n.current&&(n.current=null);return}const st=it;st.copyContent=yt=>{it.getEditor().getModule("copy").copyContent(yt)},Dc.isFunction(n)?n(st):n&&(n.current=st),Ft(it)},[n,Ft]);return _.jsx($c,{helperText:m,wrapType:w,labelProps:{...v,style:{minHeight:g?20:void 0,marginBottom:g?4:0,...v==null?void 0:v.style}},errorMessage:e,label:_.jsxs(Tn,{style:{gap:4},children:[g,W==="Top"&&At]}),wrapProps:{...p,className:Ge.clsx(p==null?void 0:p.className,!Re&&Mi.AEditorWrapper),style:{...p==null?void 0:p.style,height:ze}},children:_.jsxs(Zr,{...V,className:Ge.clsx(V.className,Mi.AEditorContainer,ft&&"NoTransition"),style:{...E,height:nt,minHeight:tt},children:[_.jsx(tg,{...f,ref:Lt,preserveWhitespace:!0,modules:Tt,placeholder:a,readOnly:X,theme:"snow",value:xt,className:Ge.clsx(f==null?void 0:f.className,Mi.AEditor,Mi[lt],Ce&&"Title",ft&&"NoTransition"),style:{...f==null?void 0:f.style,maxHeight:He?He+se:void 0,"--icon-size":`${I==="Med"?20:24}px`,"--editor-padding":Ce?"8px 12px":"12px","--toolbar-padding":`${I==="Med"?7.5:12.5}px`,"--content-height":Ce?"fit-content":ae?`${ae}px`:"100%","--content-max-height":He?`${He}px`:"100%","--default-text":`'${dr.AEditor.Default}'`,"--visit-url-text":`'${dr.AEditor["Visit URL:"]}'`,"--enter-link-text":`'${dr.AEditor["Enter link:"]}'`,"--enter-video-text":`'${dr.AEditor["Enter video:"]}'`,"--edit-text":`'${dr.AEditor.Edit}'`,"--save-text":`'${dr.AEditor.Save}'`,"--remove-text":`'${dr.AEditor.Remove}'`,"--arrow-background":`url("data:image/svg+xml,${encodeURIComponent(yp.renderToString(_.jsx(ln,{icon:"EditorArrow"})))}`,"--title-color-picker-row":Ce?1:4,"--title-header-font-size":`${I==="Med"?12:16}px`},onChange:fr}),k&&_.jsxs(_.Fragment,{children:[_.jsx("div",{ref:Ue,className:Ge.clsx(Mi.Resizer,ft&&"NoTransition"),style:{height:ce,bottom:i&&!X?ne:0},onMouseDown:qt}),_.jsx("div",{children:`${Math.round(ae)}px`,className:Ge.clsx(Mi.Indicator,"NoSelect","Label1",ft&&"NoTransition"),style:{height:ce,bottom:i&&!X?ne:0,display:Ae?"flex":"none"}})]}),_.jsx("div",{children:At,className:Ge.clsx(Mi.LimitContainer,"NoSelect",ft&&"NoTransition"),style:{marginTop:ee,minHeight:pe,display:W==="Bottom"?"flex":"none"}})]})})},gP=({htmlDelta:r,limit:e,useError:t,isReadonly:n})=>{const[o,i]=gn(t,!1),a=C.useMemo(()=>hP.calculateTextSize(r),[r]);return C.useEffect(()=>{i&&i(a>e)},[a,e,i]),!t||n?null:_.jsxs(Ya,{className:Mi.Limit,children:["(",_.jsx("span",{className:Ge.clsx(o&&Mi.Error),children:Lu(a)})," / ",Lu(e),")"]})};function mP(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];return C.useMemo(()=>n=>{e.forEach(o=>o(n))},e)}const og=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function lf(r){const e=Object.prototype.toString.call(r);return e==="[object Window]"||e==="[object global]"}function pv(r){return"nodeType"in r}function Di(r){var e,t;return r?lf(r)?r:pv(r)&&(e=(t=r.ownerDocument)==null?void 0:t.defaultView)!=null?e:window:window}function gv(r){const{Document:e}=Di(r);return r instanceof e}function Ch(r){return lf(r)?!1:r instanceof Di(r).HTMLElement}function eC(r){return r instanceof Di(r).SVGElement}function cf(r){return r?lf(r)?r.document:pv(r)?gv(r)?r:Ch(r)||eC(r)?r.ownerDocument:document:document:document}const el=og?C.useLayoutEffect:C.useEffect;function mv(r){const e=C.useRef(r);return el(()=>{e.current=r}),C.useCallback(function(){for(var t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];return e.current==null?void 0:e.current(...n)},[])}function vP(){const r=C.useRef(null),e=C.useCallback((n,o)=>{r.current=setInterval(n,o)},[]),t=C.useCallback(()=>{r.current!==null&&(clearInterval(r.current),r.current=null)},[]);return[e,t]}function ph(r,e){e===void 0&&(e=[r]);const t=C.useRef(r);return el(()=>{t.current!==r&&(t.current=r)},e),t}function Sh(r,e){const t=C.useRef();return C.useMemo(()=>{const n=r(t.current);return t.current=n,n},[...e])}function jp(r){const e=mv(r),t=C.useRef(null),n=C.useCallback(o=>{o!==t.current&&(e==null||e(o,t.current)),t.current=o},[]);return[t,n]}function k1(r){const e=C.useRef();return C.useEffect(()=>{e.current=r},[r]),e.current}let nm={};function _h(r,e){return C.useMemo(()=>{if(e)return e;const t=nm[r]==null?0:nm[r]+1;return nm[r]=t,r+"-"+t},[r,e])}function tC(r){return function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];return n.reduce((i,a)=>{const c=Object.entries(a);for(const[d,f]of c){const p=i[d];p!=null&&(i[d]=p+r*f)}return i},{...e})}}const Gd=tC(1),Fp=tC(-1);function yP(r){return"clientX"in r&&"clientY"in r}function vv(r){if(!r)return!1;const{KeyboardEvent:e}=Di(r.target);return e&&r instanceof e}function bP(r){if(!r)return!1;const{TouchEvent:e}=Di(r.target);return e&&r instanceof e}function R1(r){if(bP(r)){if(r.touches&&r.touches.length){const{clientX:e,clientY:t}=r.touches[0];return{x:e,y:t}}else if(r.changedTouches&&r.changedTouches.length){const{clientX:e,clientY:t}=r.changedTouches[0];return{x:e,y:t}}}return yP(r)?{x:r.clientX,y:r.clientY}:null}const gh=Object.freeze({Translate:{toString(r){if(!r)return;const{x:e,y:t}=r;return"translate3d("+(e?Math.round(e):0)+"px, "+(t?Math.round(t):0)+"px, 0)"}},Scale:{toString(r){if(!r)return;const{scaleX:e,scaleY:t}=r;return"scaleX("+e+") scaleY("+t+")"}},Transform:{toString(r){if(r)return[gh.Translate.toString(r),gh.Scale.toString(r)].join(" ")}},Transition:{toString(r){let{property:e,duration:t,easing:n}=r;return e+" "+t+"ms "+n}}}),hb="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function xP(r){return r.matches(hb)?r:r.querySelector(hb)}const wP={display:"none"};function CP(r){let{id:e,value:t}=r;return C.createElement("div",{id:e,style:wP},t)}function SP(r){let{id:e,announcement:t,ariaLiveType:n="assertive"}=r;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return C.createElement("div",{id:e,style:o,role:"status","aria-live":n,"aria-atomic":!0},t)}function _P(){const[r,e]=C.useState("");return{announce:C.useCallback(n=>{n!=null&&e(n)},[]),announcement:r}}const rC=C.createContext(null);function AP(r){const e=C.useContext(rC);C.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of <DndContext>");return e(r)},[r,e])}function EP(){const[r]=C.useState(()=>new Set),e=C.useCallback(n=>(r.add(n),()=>r.delete(n)),[r]);return[C.useCallback(n=>{let{type:o,event:i}=n;r.forEach(a=>{var c;return(c=a[o])==null?void 0:c.call(a,i)})},[r]),e]}const TP={draggable:`
|
358
358
|
To pick up a draggable item, press the space bar.
|
359
359
|
While dragging, use the arrow keys to move the item.
|
360
360
|
Press space again to drop the item in its new position, or press escape to cancel.
|
package/dist/index.es.js
CHANGED
@@ -35305,7 +35305,7 @@ const Fd = {
|
|
35305
35305
|
}
|
35306
35306
|
}), []), Ct = ge(() => ({
|
35307
35307
|
clipboard: {},
|
35308
|
-
copy:
|
35308
|
+
copy: {},
|
35309
35309
|
keyboard: {},
|
35310
35310
|
magicUrl: !0,
|
35311
35311
|
imageCompress: {
|
@@ -35482,7 +35482,7 @@ const Fd = {
|
|
35482
35482
|
const at = st;
|
35483
35483
|
at.copyContent = (bt) => {
|
35484
35484
|
st.getEditor().getModule("copy").copyContent(bt);
|
35485
|
-
}, Pc.isFunction(n) ? n(at) : n
|
35485
|
+
}, Pc.isFunction(n) ? n(at) : n && (n.current = at), qt(st);
|
35486
35486
|
},
|
35487
35487
|
[n, qt]
|
35488
35488
|
);
|