ados-rcm 1.1.548 → 1.1.549
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 +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
@@ -355,7 +355,7 @@ received: ${r.quality}
|
|
355
355
|
received: ${r.imageType}
|
356
356
|
-> 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 Wb(r){return!!r.match(/^image\/(gif|jpe?g|a?png|svg|webp|bmp)/i)}class fB{constructor(e,t,n,o){de(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 h=document.getSelection(),g=document.caretRangeFromPoint(e.clientX,e.clientY);h&&g&&h.setBaseAndExtent(g.startContainer,g.startOffset,g.startContainer,g.startOffset)}this.logger.log("handleDrop",{evt:e});const t=(i=e.dataTransfer)==null?void 0:i.files,n=Array.from(t||[]).filter(h=>Wb(h.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 h=await(await fetch(o)).blob();this.logger.log("handleDrop","blob from drag event",{evt:e,files:t,imageFiles:n}),await this.pasteFilesIntoQuill([h])}}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"&&Wb(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 FC(t);this.logger.log(" pasteFilesIntoQuill",`pasting image (${n})`),this.onNewDataUrl(o)})),this.logger.log(" pasteFilesIntoQuill","done")}}class Eh{constructor(e,t){de(this,"quill");de(this,"range");de(this,"options");de(this,"imageDrop");de(this,"fileHolder");de(this,"Logger");this.quill=e,this.options=t||{};const n=!!t.debug,o=!!t.suppressErrorLogging;this.Logger=new lB(n,o),dB(t,this.Logger);const i=async c=>{this.Logger.log("onImageDrop",{dataUrl:c});const d=await this.downscaleImageFromUrl(c);this.insertToEditor(d,Eh.b64toBlob(d))};this.imageDrop=new fB(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 FC(n),i=await this.downscaleImageFromUrl(o);this.insertToEditor(i,Eh.b64toBlob(i))}async downscaleImageFromUrl(e){const t=await uB(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=Eh;const Th={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"},Dc={BACKSPACE:8,DELETE:46,LEFT:37,UP:38,RIGHT:39,DOWN:40},Cp=(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}},hB={tl:Cp(!0,!0),tr:Cp(!0,!1),bl:Cp(!1,!0),br:Cp(!1,!1)},pB={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"}]},gB=ke.import("formats/image");class Dp extends gB{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)}}de(Dp,"blotName","image"),de(Dp,"tagName","img"),de(Dp,"scope",nr.INLINE);ke.register("formats/image",Dp,!0);class Nh{constructor(e){de(this,"resizer");de(this,"quill");de(this,"overlay");de(this,"activeEle");de(this,"blot");de(this,"options");de(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 mB extends Nh{constructor(){super(...arguments);de(this,"display")}onCreate(){var t;this.display=document.createElement("div"),this.display.className=Ni[Th.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 vB extends Nh{constructor(){super(...arguments);de(this,"boxes",[]);de(this,"dragBox",null);de(this,"dragStartX",0);de(this,"dragStartY",0);de(this,"contentOption");de(this,"preDragSize",{width:0,height:0});de(this,"naturalSize",[0,0]);de(this,"handleDragProxy",null);de(this,"handleMouseupProxy",null);de(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))});de(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()});de(this,"handleDrag",t=>{!this.activeEle||!this.blot||!this.contentOption||(Object.assign(this.activeEle.style,this.calcSize(t,{...this.contentOption.limit,unit:!0})),this.requestUpdate())});de(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=`${Ni[Th.HANDLE]} ${t}`,n.addEventListener("mousedown",this.handleMousedown,!1),n.addEventListener("dblclick",this.handleDoubleClick,!1),Object.assign(n.style,hB[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(h=>c[h]=this.preDragSize[h]):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 h=this.applyLimit(c,n.minHeight,n.maxHeight);h!==c&&(c=h,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 Bc=class Bc extends Nh{constructor(){super(...arguments);de(this,"keyboardProxy",null)}static injectInit(t){var o;const n=(o=t.keyboard)==null?void 0:o.bindings;n&&[Bc.keys.LEFT,Bc.keys.RIGHT].forEach(i=>(n[i]||[]).unshift(Bc.makeArrowHandler(i)))}static makeArrowHandler(t){const n=t===Bc.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===Bc.keys.RIGHT,[d]=i.getLine(a+(n?-1:0));if(!d)return!0;if(i.resizer.judgeShow(d))return!1;const h=i.getIndex(d);if(c&&h+d.length()-1===a)return!0;c&&(a+=o.length+1);const[g]=i.getLeaf(a);if(!g)return!0;const m=g.offset(g.parent),p=g.constructor&&"scope"in g.constructor&&g.constructor.scope===nr.BLOCK_BLOT;if(n&&(p&&a===m||a===0||a===h))return!0;let v=g;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===Dc.BACKSPACE||n===Dc.DELETE?(this.handleDelete(),a=!0):n>=Dc.LEFT&&n<=Dc.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===Dc.RIGHT?n+=this.blot.length()||1:t===Dc.UP?(n=this.getOtherLineIndex(-1),o=this.quill.getLeaf(n)[0]):t===Dc.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)}};de(Bc,"keys",Dc);let eg=Bc;const Gd=class Gd extends Nh{constructor(t){super(t);de(this,"toolbar");de(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=Ni[Th.TOOLBAR],(t=this.overlay)==null||t.appendChild(this.toolbar),Object.keys(Gd.Tools).forEach(n=>{const o=n;Gd.Tools[o]=this.createStyleTool(Gd.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=Ni[Th.TOOLBAR_BUTTON],a.innerHTML=Np.renderToString(S.jsx(gn,{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})}};de(Gd,"Tools",{left:{icon:"AlignLeft"},center:{icon:"AlignCenter"},right:{icon:"AlignRight"},justify:{icon:"AlignJustify"}});let X1=Gd;class jC{constructor(e,t={}){de(this,"quill");de(this,"options");de(this,"moduleClasses");de(this,"modules",[]);de(this,"blot");de(this,"selectedBlots",[]);de(this,"embedClassName","");de(this,"activeEle");de(this,"overlay");de(this,"updateFromModule",!1);de(this,"hideProxy",null);de(this,"updateOverlayPositionProxy",null);var o;e.resizer=this,this.quill=e;const n=t.modules?[...t.modules]:null;this.options={...pB,...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)),eg.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=`${Ni[Th.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["image","iframe","video"].includes((i=o.statics)==null?void 0:i.blotName)},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}}de(jC,"Modules",{Base:Nh,DisplaySize:mB,Toolbar:X1,Resize:vB,Keyboard:eg});const Sp=ke.import("delta"),yB=ke.import("modules/clipboard");function bB(r){let e=Number.parseFloat(r.getAttribute("width")||String(qn.colDefaultWidth));if(Number.isNaN(e)){const t=r.style.width;e=t?Number.parseFloat(t):r.offsetWidth}return e}function xB(r,e){const t=new Array(e).fill(qn.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=bB(c);t[a]=d||t[a]}else break}return t}class wB extends yB{constructor(t,n){super(t,n);de(this,"tableId",Do());de(this,"rowId",Do());de(this,"colIds",[]);de(this,"rowspanCount",[]);de(this,"cellCount",0);de(this,"colCount",0);de(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 h=0;h<n.ops.length;h++){const{attributes:g,insert:m}=n.ops[h],{table:p,[$e.tableCell]:v,...w}=g||{},T=Hc.isObject(m)&&m[$e.tableCol];T?i.push({insert:m}):o.push({attributes:w,insert:m}),!(w!=null&&w[$e.tableCellInner])&&!T&&(a=h)}const d=xB(t,this.colIds.length).reduce((h,g,m)=>(i[m]?h.push(i[m]):h.push({insert:{[$e.tableCol]:{tableId:this.tableId,colId:this.colIds[m],width:g,full:!0}}}),h),[]);return o.splice(a+1,0,...d),this.tableId=Do(),this.colIds=[],this.rowspanCount=[],this.cellCount=0,this.colCount=0,new Sp(o)}matchColgroup(t,n){const o=[];for(let i=0;i<n.ops.length;i++){const a=n.ops[i];a&&Hc.isObject(a.insert)&&a.insert[$e.tableCol]&&o.push(a)}return new Sp(o)}matchCol(t){this.colIds[this.colCount]=Do();const n=new Sp().insert({[$e.tableCol]:Object.assign(zl.value(t),{tableId:this.tableId,colId:this.colIds[this.colCount]})});return this.colCount+=1,n}matchTr(t,n){this.rowId=Do(),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=wo.formats(o);if(!this.colIds[this.cellCount]||!this.rowspanCount[this.cellCount])for(let g=this.cellCount;g>=0;g--)this.colIds[g]||(this.colIds[g]=Do()),this.rowspanCount[g]||(this.rowspanCount[g]={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 h=[];for(const g of n.ops){const{attributes:m={},...p}=g,{[$e.tableCell]:v,...w}=m;h.push({...p,attributes:{...w,[$e.tableCellInner]:d}})}return(h.length<=0||!Hc.isString(h[h.length-1].insert)||!h[h.length-1].insert.endsWith(`
|
357
357
|
`))&&h.push({insert:`
|
358
|
-
`,attributes:{[$e.tableCellInner]:d}}),new Sp(h)}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[$e.tableCellInner])for(const a of i.ops){if(Hc.isObject(a.insert)&&a.insert[$e.tableCol]){a.insert="";continue}a.attributes||(a.attributes={}),a.attributes[$e.tableCellInner]=o[$e.tableCellInner]}return i}parseStyleWithFilter(t,n){if(!t)return{};const o={};let i="",a="",c=!0,d=0;for(let h=0;h<t.length;h++){const g=t[h];g===":"&&c?(i=t.substring(d,h).trim(),d=h+1,c=!1):g===";"&&(!c&&i&&(a=t.substring(d,h).trim(),(!n||n(i))&&(o[i]=a)),d=h+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 g of o)(g.getAttribute("class")||"").split(/\s+/).filter(Boolean).forEach(p=>i.add(p));if(i.size===0)return;const a=t.querySelectorAll("style");if(a.length===0)return;const c=Array.from(a).map(g=>g.textContent||"").join("");if(!c)return;const d={},h=g=>this.STYLE_PROPERTIES.some(m=>g.startsWith(m));for(const g of i){const m=new RegExp(`\\.${g}[^{]*{([^}]*)}`,"g");let p;for(;(p=m.exec(c))!==null;){const v=p[1],w=this.parseStyleWithFilter(v),T={};let _=!1;for(const A in w)h(A)&&(T[A]=w[A],_=!0);_&&(d[g]=T)}}if(Object.keys(d).length===0)return;for(let g=0;g<o.length;g++){const m=o[g],p=((n=m.getAttribute("class"))==null?void 0:n.split(/\s+/).filter(Boolean))||[],v=m.getAttribute("style")||"",w=this.parseStyleWithFilter(v);let T=!1;for(const _ of p){const A=d[_];if(A)for(const R in A)w[R]||(w[R]=A[R],T=!0)}if(T){let _="";for(const A in w)_+=A+":"+w[A]+";";_&&m.setAttribute("style",_)}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[$e.tableCaption]&&(a[$e.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,h=a.getAttribute("style")||"",g=h+(h?"; ":"")+`height: ${d}px`;a.setAttribute("style",g)}}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 h of Array.from(d)){const g=parseInt(h.getAttribute("rowspan")||"1");if(g>1)for(let m=1;m<g;m++){const p=a+m;if(p>=n.length)break;i.has(p)||i.set(p,[]),i.get(p).push(h)}}}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 CB extends Qp{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=Yn(e[0],$e.tableMain),o=n.getRows(),i=e.map(p=>{if(!p||!p.parent||!p.parent.domNode)return null;const v=p.parent.domNode;if(!v)return null;const w=o.findIndex(A=>A.rowId===p.rowId);if(w===-1)return null;const T=p.getColumnIndex();if(T===-1)return null;const _=v.getBoundingClientRect();return!_||_.width===0||_.height===0?null:{td:p,rowIndex:w,colIndex:T,rowspan:p.rowspan,colspan:p.colspan,visualLeft:_.left,visualRight:_.right,visualTop:_.top,visualBottom:_.bottom}}).filter(Boolean);if(i.length<=1)return;i.sort((p,v)=>p.visualTop-v.visualTop||p.visualLeft-v.visualLeft);const a=i[0],c=a.td,d=Math.max(...i.map(p=>p.rowIndex+p.rowspan-1)),h=Math.max(...i.map(p=>p.colIndex+p.colspan-1)),g=d-a.rowIndex+1,m=h-a.colIndex+1;for(const p of i)p.td!==c&&(p.td.moveChildren(c),p.td.parent.remove());c.rowspan=g,c.colspan=m,this.fixTableByRemove(n)}}ke.register({"modules/imageCompress":Eh,"modules/resize":jC,"modules/tableUp":CB,"modules/magicUrl":iP,"formats/divider":K1,"modules/clipboard":wB,"modules/copy":iB},!0);const Wd={KB:1024,QUALITY:.7,IMAGE_SIZES:new Map},SB={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+=Wd.IMAGE_SIZES.get(n)||Math.ceil(n.length*Wd.QUALITY))}return e}},_B=r=>{const{type:e="Primary",editorRef:t,useValue:n,useError:o,placeholder:i,tabIndex:a,autoFocus:c,editorProps:d,style:h,minHeight:g,maxHeight:m,contentHeight:p,contentMaxHeight:v=1e3,toolbarSize:w="Med",toolbarType:T="Default",readOnly:_,limitPosition:A="Bottom",maxLength:R,size:D=100,editorClassName:I,editorStyle:F,noImageResize:B,...H}=r,[{wrapId:j,wrapProps:G,labelProps:ge,...P},q]=Yu(H),V=C.useMemo(()=>e==="ReadOnly"||_,[e,_]),Q=C.useMemo(()=>p?20:0,[p]),[ie,se]=C.useState(w==="Med"?40:50),ae=C.useMemo(()=>V?0:ie,[V,ie]),[le,fe]=C.useMemo(()=>!o||V||A==="Top"?[0,0]:[20,6],[o,V,A]),ee=C.useMemo(()=>le+fe,[le,fe]),[ne,ce]=C.useState(p),[xe,Me]=C.useState(!1),[oe,Se]=C.useState(!1),Le=C.useRef(null),We=C.useRef(0),Ve=C.useRef(0),we=C.useMemo(()=>P.label?24:0,[P.label]),_e=C.useMemo(()=>T==="Title",[T]),Ae=C.useMemo(()=>p||g||_e,[p,g,_e]),Ie=C.useMemo(()=>Ae?"fit-content":m?m+we:`calc(100% - ${we}px)`,[Ae,m,we]),je=C.useMemo(()=>{if(p){if(ne)switch(e){case"ReadOnly":return ne;case"Raw":return ne+ee;default:return ne+ae+ee}}else return},[p,ne,e,ae,ee]),it=C.useMemo(()=>{if(!(!m||m<=ae+ee))switch(e){case"ReadOnly":return m;case"Raw":return m-ee;default:return m-ae-ee}},[e,ae,ee,m]),Ue=C.useMemo(()=>{if(g&&p){const Ge=Math.min(g-ae-ee,p);return V?Ge:Ge+ae+ee}else return g||(p?void 0:`calc(100% - ${we}px)`)},[g,p,we,ae,ee,V]),tt=C.useMemo(()=>(Array.isArray(P.errorMessage)?P.errorMessage.some(Boolean):!!P.errorMessage)?"Error":e,[P.errorMessage,e]),lt=C.useCallback(Ge=>{let st=Ge;st=f9.sanitize(Ge);const ct=document.createElement("div");return ct.innerHTML=st,new ke(ct,{readOnly:!0}).getContents()},[]),[bt,Mt]=wn(n,""),[Qe,Xe]=C.useState(()=>lt(bt));C.useEffect(()=>{Mt===void 0&&Xe(lt(bt))},[lt,Mt,bt]);const ht=C.useMemo(()=>S.jsx(AB,{htmlDelta:Qe,isReadonly:V,limit:D*Wd.KB,useError:o}),[Qe,V,D,o]),ft=C.useRef(null),Oe=C.useRef([]),[Je,gt]=C.useState(!0);C.useEffect(()=>{const Ge=setTimeout(()=>gt(!1),0);return()=>{clearTimeout(Ge),Oe.current.forEach(st=>st()),Oe.current=[]}},[]);const It=C.useCallback((Ge,st)=>{if(!p)return st;const ct=g?g-ae-ee:p,xt=Math.max(ct,0),Nt=m?m-ae-ee:v;return Math.min(Nt,Math.max(xt,st+Ge))},[p,g,ae,ee,m,v]),Et=C.useCallback(Ge=>{if(!xe||!p)return;const st=Ge.clientY-Ve.current,ct=It(st,We.current);ne!==ct&&ce(ct),Ge.preventDefault(),Ge.stopPropagation()},[xe,p,It,ne]),Dt=C.useCallback(Ge=>{Me(!1),Se(!1),document.removeEventListener("mousemove",Et),document.removeEventListener("mouseup",Dt),Ge.preventDefault(),Ge.stopPropagation()},[Et]),Xt=C.useCallback(Ge=>{if(!p)return;if(Ge.detail===2){ce(p);return}ne===void 0?(ce(p),We.current=p):We.current=ne,Me(!0),Se(!0),Ve.current=Ge.clientY;const st=xt=>{if(!p)return;const Nt=xt.clientY-Ve.current,Bt=It(Nt,We.current);ce(Bt),xt.preventDefault(),xt.stopPropagation()},ct=xt=>{Me(!1),Se(!1),document.removeEventListener("mousemove",st),document.removeEventListener("mouseup",ct),xt.preventDefault(),xt.stopPropagation()};document.addEventListener("mousemove",st),document.addEventListener("mouseup",ct),Ge.preventDefault(),Ge.stopPropagation()},[p,ne,It]),Wt=C.useCallback((Ge,st,ct,xt)=>{if(ct!=="user"&&ct!=="api")return;const Nt=xt.getContents(),Bt=xt.getLength()-1,qt=R!==void 0&&Bt>R,Yt=te=>te.replace(/\s{2,}/g,ye=>" ".repeat(ye.length)),ir=Ge.replace(/<p><br><\/p>/gi,"").trim(),jt=Yt(ir);if(!qt){Xe(Nt),Mt==null||Mt(jt);return}const xr=hr(Nt,R);Xe(xr);const jr=new ke(document.createElement("div"));jr.setContents(xr);const Ze=Yt(jr.root.innerHTML.replace(/<p><br><\/p>/gi,"").trim());Mt==null||Mt(Ze)},[R,Mt]),hr=(Ge,st)=>{var Nt,Bt,qt;if(!Ge.ops)return Ge;const ct=new rr;let xt=0;for(const Yt of Ge.ops){if(xt>=st)break;if(Yt.insert&&typeof Yt.insert=="string"){const ir=Yt.insert,jt=st-xt;if(ir.length<=jt)(Nt=ct.ops)==null||Nt.push(Yt),xt+=ir.length;else{const xr={...Yt,insert:ir.substring(0,jt)};(Bt=ct.ops)==null||Bt.push(xr),xt+=jt;break}}else xt<st&&((qt=ct.ops)==null||qt.push(Yt),xt+=1)}return ct},dr=C.useCallback(Ge=>{var Nt,Bt;const st=Ge.getEditor().container;if(!st)return null;const ct=(Nt=st.closest(".AEditorContainer"))==null?void 0:Nt.querySelector(".ql-toolbar");return ct||((Bt=st.parentElement)==null?void 0:Bt.querySelector(".ql-toolbar"))||null},[]),cr=C.useCallback((Ge,st,ct,xt)=>{if(!Ge)return;const Nt=ct;Ge.addEventListener(st,Nt,xt),Oe.current.push(()=>Ge.removeEventListener(st,Nt,xt))},[]),Te=C.useCallback((Ge,st,ct)=>{const xt=st.getFormat();Ge.forEach(Nt=>{if(xt[Nt]){const Bt=xt[Nt],qt=`.ql-${Nt}`,Yt=ct.querySelector(`${qt} .ql-picker-label`),ir=ct.querySelectorAll(`${qt} .ql-picker-item`),jt=Array.from(ir).find(xr=>xr.getAttribute("data-value")===Bt);jt&&(jt.classList.add("ql-selected"),Yt==null||Yt.classList.add("ql-active"))}})},[]),ue=C.useCallback(Ge=>{if(!Ge.length)return;const xt=Ge[0].target.getBoundingClientRect(),Nt=Math.ceil(xt.height);se(Bt=>Math.abs(Bt-Nt)<.1?Bt:Nt)},[]),at=C.useCallback((Ge,st)=>{if(Ge.key!=="Backspace")return;const ct=st.getSelection(!1);if(!ct||ct.length>0)return;const xt=ct.index;if(xt<=0)return;const[Nt]=st.getLine(xt);if(Nt&&xt===st.getIndex(Nt)||st.getFormat(xt,1).link)return;const Bt=st.getFormat(xt-1,1);if(Bt.link){Ge.preventDefault();let qt=xt-1;for(;qt>0&&st.getFormat(qt-1,1).link===Bt.link;)qt--;const[Yt]=st.scroll.descendant(ir=>{var jt;return((jt=ir==null?void 0:ir.statics)==null?void 0:jt.blotName)==="link"},qt);if(Yt!=null&&Yt.domNode){const ir=(Yt.domNode.textContent||"").length;st.removeFormat(qt,ir)}}},[]),ze=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(Ge){const{blockquote:st,list:ct,["code-block"]:xt}=Ge.getFormat();return st||ct||xt?(Ge.format("blockquote",!1),Ge.format("list",!1),Ge.format("code-block",!1),!1):!0}}}},magicUrl:!0,toolbar:{container:[["bold","italic","underline","strike",{color:[]},{background:[]},"clean"]]}}),[]),vt=C.useCallback(()=>({clipboard:{},copy:{},keyboard:{},magicUrl:!0,imageCompress:{quality:Wd.QUALITY,imageType:"image/jpeg",maxWidth:1500,maxHeight:1500,debug:!1,handleOnPaste:Ge=>{var st,ct;try{const xt=(st=Ge.clipboardData)==null?void 0:st.items;if(!xt)return!0;const Nt=Array.from(xt).some(Yt=>{const ir=Yt.type.toLowerCase();return ir.includes("Excel")||ir.includes("text/html")}),Bt=(ct=Ge.clipboardData)==null?void 0:ct.getData("text/html"),qt=Bt&&(Bt.includes("<table")||Bt.includes("<tbody")||Bt.includes("<td"));return!(Nt||qt)}catch(xt){return console.warn("Error in handleOnPaste:",xt),!0}},insertIntoEditor:(Ge,st,ct)=>{Wd.IMAGE_SIZES.has(Ge)||Wd.IMAGE_SIZES.set(Ge,st.size);const xt=ct.getSelection();xt&&ct.insertEmbed(xt.index,"image",Ge,ke.sources.USER)}},...!V&&{...!B&&{resize:{}},table:!1,tableUp:{fullSwitch:!1,icon:Np.renderToString(S.jsx(gn,{icon:"Table",size:w==="Med"?"sm":"md",strokeWidth:2.5})),resize:zP,resizeScale:$P,customSelect:YP,selection:UP,fixUnusuaDeletelTable:!1,selectionOptions:{tableMenu:jP,tableMenuOptions:{localstorageKey:"used-color",tipText:!0,tools:[Xr.InsertCaption,Xr.InsertTop,Xr.InsertRight,Xr.InsertBottom,Xr.InsertLeft,Xr.Break,Xr.MergeCell,Xr.SplitCell,Xr.Break,Xr.DeleteRow,Xr.DeleteColumn,Xr.DeleteTable,Xr.Break,Xr.BackgroundColor,Xr.BorderColor,Xr.Break,Xr.CopyCell,Xr.CutCell,Xr.Break,Xr.SwitchWidth]}},texts:{fullCheckboxText:wr.AEditor["Insert Full Width Table"],customBtnText:wr.AEditor.Custom,confirmText:wr.AEditor.Confirm,cancelText:wr.AEditor.Cancel,rowText:wr.AEditor.Row,colText:wr.AEditor.Column,CopyCell:wr.AEditor["Copy Cell"],CutCell:wr.AEditor["Cut Cell"],notPositiveNumberError:wr.AEditor["Not Positive Number Error"],custom:wr.AEditor.Custom,clear:wr.AEditor.Clear,transparent:wr.AEditor.Transparent,perWidthInsufficient:wr.AEditor.perWidthInsufficient,InsertTop:wr.AEditor["Insert Row Top"],InsertRight:wr.AEditor["Insert Column Right"],InsertBottom:wr.AEditor["Insert Row Bottom"],InsertLeft:wr.AEditor["Insert Column Left"],MergeCell:wr.AEditor["Merge Cell"],SplitCell:wr.AEditor["Split Cell"],DeleteRow:wr.AEditor["Delete Row"],DeleteColumn:wr.AEditor["Delete Column"],DeleteTable:wr.AEditor["Delete Table"],BackgroundColor:wr.AEditor["Set Background Color"],BorderColor:wr.AEditor["Set Border Color"],SwitchWidth:wr.AEditor["Switch Table Width"],InsertCaption:wr.AEditor["Insert Table Caption"]}},toolbar:{container:[[{header:[1,2,3,!1,4]}],["bold","italic","underline","strike","blockquote","divider",{[Qp.toolName]:[]},{color:[]},{background:[]}],[{list:"ordered"},{list:"bullet"},{indent:"-1"},{indent:"+1"},{align:[]}],["link","image","video"],["clean"]],handlers:{divider:function(){const Ge=this.quill,st=Ge.getSelection(!0);if(!st)return;const ct=Math.min(st.index+1,Ge.getLength()-1);Ge.insertEmbed(ct,"divider",!0,ke.sources.USER),setTimeout(()=>Ge.setSelection(Math.min(ct+1,Ge.getLength()-1),0,ke.sources.SILENT),0)}}}}}),[V,B,w]),_t=C.useMemo(()=>_e?ze():vt(),[_e,ze,vt]),Tt=C.useCallback(Ge=>{if(!Ge)return;const st=Ge.getEditor();if(!st)return;const ct=st.root,xt=dr(Ge);ct&&I&&ct.classList.add(...I.split(" ")),ct&&F&&Object.entries(F).forEach(([Bt,qt])=>{const Yt=Bt.replace(/([A-Z])/g,ir=>`-${ir[0].toLowerCase()}`);ct.style[Yt]=qt}),cr(ct,"keydown",Bt=>at(Bt,st));const Nt=new ResizeObserver(ue);if(xt){Nt.observe(xt),Oe.current.push(()=>Nt.disconnect());const Bt=["header","color","background"];Bt.forEach(qt=>{const Yt=xt.querySelector(`.ql-${qt} .ql-picker-label`);Yt&&cr(Yt,"click",()=>Te(Bt,st,xt))})}},[dr,I,F,cr,ue,at,Te]),Ut=C.useCallback(Ge=>{if(Oe.current.forEach(ct=>ct()),Oe.current=[],ft.current=Ge,!Ge){Hc.isFunction(t)?t(null):t!=null&&t.current&&(t.current=null);return}const st=Ge;st.copyContent=ct=>{Ge.getEditor().getModule("copy").copyContent(ct)},Hc.isFunction(t)?t(st):t&&(t.current=st),Tt(Ge)},[t,Tt]);return S.jsx(Yc,{wrapId:j,...P,label:S.jsxs(On,{style:{gap:4},children:[P.label,A==="Top"&&ht]}),labelProps:{...ge,style:{minHeight:P.label?20:void 0,marginBottom:P.label?4:0,...ge==null?void 0:ge.style}},wrapProps:{...G,className:Ye.clsx(G==null?void 0:G.className,!Ae&&Ni.AEditorWrapper),style:{...G==null?void 0:G.style,height:Ie}},children:S.jsxs(Jr,{...q,className:Ye.clsx(q.className,Ni.AEditorContainer,Je&&"NoTransition"),style:{...h,height:je,minHeight:Ue},children:[S.jsx(yg,{...d,ref:Ut,preserveWhitespace:!0,modules:_t,placeholder:i,readOnly:V,theme:"snow",value:Qe,className:Ye.clsx(d==null?void 0:d.className,Ni.AEditor,Ni[tt],_e&&"Title",Je&&"NoTransition"),style:{...d==null?void 0:d.style,maxHeight:it?it+ae:void 0,"--icon-size":`${w==="Med"?20:24}px`,"--editor-padding":_e?"8px 12px":"12px","--toolbar-padding":`${w==="Med"?7.5:12.5}px`,"--content-height":_e?"fit-content":ne?`${ne}px`:"100%","--content-max-height":it?`${it}px`:"100%","--default-text":`'${wr.AEditor.Default}'`,"--visit-url-text":`'${wr.AEditor["Visit URL:"]}'`,"--enter-link-text":`'${wr.AEditor["Enter link:"]}'`,"--enter-video-text":`'${wr.AEditor["Enter video:"]}'`,"--edit-text":`'${wr.AEditor.Edit}'`,"--save-text":`'${wr.AEditor.Save}'`,"--remove-text":`'${wr.AEditor.Remove}'`,"--arrow-background":`url("data:image/svg+xml,${encodeURIComponent(Np.renderToString(S.jsx(gn,{icon:"EditorArrow"})))}`,"--title-color-picker-row":_e?1:4,"--title-header-font-size":`${w==="Med"?12:16}px`},onChange:Wt}),p&&S.jsxs(S.Fragment,{children:[S.jsx("div",{ref:Le,className:Ye.clsx(Ni.Resizer,Je&&"NoTransition"),style:{height:Q,bottom:o&&!V?ee:0},onMouseDown:Xt}),S.jsx("div",{children:`${Math.round(ne)}px`,className:Ye.clsx(Ni.Indicator,"NoSelect","Label1",Je&&"NoTransition"),style:{height:Q,bottom:o&&!V?ee:0,display:oe?"flex":"none"}})]}),S.jsx("div",{children:ht,className:Ye.clsx(Ni.LimitContainer,"NoSelect",Je&&"NoTransition"),style:{marginTop:fe,minHeight:le,display:A==="Bottom"?"flex":"none"}})]})})},AB=({htmlDelta:r,limit:e,useError:t,isReadonly:n})=>{const[o,i]=wn(t,!1),a=C.useMemo(()=>SB.calculateTextSize(r),[r]);return C.useEffect(()=>{i&&i(a>e)},[a,e,i]),!t||n?null:S.jsxs(tl,{className:Ni.Limit,children:["(",S.jsx("span",{className:Ye.clsx(o&&Ni.Error),children:Hu(a)})," / ",Hu(e),")"]})};function EB(){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 wg=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function vf(r){const e=Object.prototype.toString.call(r);return e==="[object Window]"||e==="[object global]"}function Fv(r){return"nodeType"in r}function Bi(r){var e,t;return r?vf(r)?r:Fv(r)&&(e=(t=r.ownerDocument)==null?void 0:t.defaultView)!=null?e:window:window}function jv(r){const{Document:e}=Bi(r);return r instanceof e}function Ph(r){return vf(r)?!1:r instanceof Bi(r).HTMLElement}function HC(r){return r instanceof Bi(r).SVGElement}function yf(r){return r?vf(r)?r.document:Fv(r)?jv(r)?r:Ph(r)||HC(r)?r.ownerDocument:document:document:document}const sl=wg?C.useLayoutEffect:C.useEffect;function Hv(r){const e=C.useRef(r);return sl(()=>{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 TB(){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 Rh(r,e){e===void 0&&(e=[r]);const t=C.useRef(r);return sl(()=>{t.current!==r&&(t.current=r)},e),t}function Bh(r,e){const t=C.useRef();return C.useMemo(()=>{const n=r(t.current);return t.current=n,n},[...e])}function tg(r){const e=Hv(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 J1(r){const e=C.useRef();return C.useEffect(()=>{e.current=r},[r]),e.current}let Am={};function Fh(r,e){return C.useMemo(()=>{if(e)return e;const t=Am[r]==null?0:Am[r]+1;return Am[r]=t,r+"-"+t},[r,e])}function zC(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,h]of c){const g=i[d];g!=null&&(i[d]=g+r*h)}return i},{...e})}}const rf=zC(1),rg=zC(-1);function RB(r){return"clientX"in r&&"clientY"in r}function zv(r){if(!r)return!1;const{KeyboardEvent:e}=Bi(r.target);return e&&r instanceof e}function kB(r){if(!r)return!1;const{TouchEvent:e}=Bi(r.target);return e&&r instanceof e}function Q1(r){if(kB(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 RB(r)?{x:r.clientX,y:r.clientY}:null}const kh=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[kh.Translate.toString(r),kh.Scale.toString(r)].join(" ")}},Transition:{toString(r){let{property:e,duration:t,easing:n}=r;return e+" "+t+"ms "+n}}}),Vb="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function IB(r){return r.matches(Vb)?r:r.querySelector(Vb)}const MB={display:"none"};function LB(r){let{id:e,value:t}=r;return C.createElement("div",{id:e,style:MB},t)}function DB(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 OB(){const[r,e]=C.useState("");return{announce:C.useCallback(n=>{n!=null&&e(n)},[]),announcement:r}}const $C=C.createContext(null);function NB(r){const e=C.useContext($C);C.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of <DndContext>");return e(r)},[r,e])}function PB(){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 BB={draggable:`
|
358
|
+
`,attributes:{[$e.tableCellInner]:d}}),new Sp(h)}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[$e.tableCellInner])for(const a of i.ops){if(Hc.isObject(a.insert)&&a.insert[$e.tableCol]){a.insert="";continue}a.attributes||(a.attributes={}),a.attributes[$e.tableCellInner]=o[$e.tableCellInner]}return i}parseStyleWithFilter(t,n){if(!t)return{};const o={};let i="",a="",c=!0,d=0;for(let h=0;h<t.length;h++){const g=t[h];g===":"&&c?(i=t.substring(d,h).trim(),d=h+1,c=!1):g===";"&&(!c&&i&&(a=t.substring(d,h).trim(),(!n||n(i))&&(o[i]=a)),d=h+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 g of o)(g.getAttribute("class")||"").split(/\s+/).filter(Boolean).forEach(p=>i.add(p));if(i.size===0)return;const a=t.querySelectorAll("style");if(a.length===0)return;const c=Array.from(a).map(g=>g.textContent||"").join("");if(!c)return;const d={},h=g=>this.STYLE_PROPERTIES.some(m=>g.startsWith(m));for(const g of i){const m=new RegExp(`\\.${g}[^{]*{([^}]*)}`,"g");let p;for(;(p=m.exec(c))!==null;){const v=p[1],w=this.parseStyleWithFilter(v),T={};let _=!1;for(const A in w)h(A)&&(T[A]=w[A],_=!0);_&&(d[g]=T)}}if(Object.keys(d).length===0)return;for(let g=0;g<o.length;g++){const m=o[g],p=((n=m.getAttribute("class"))==null?void 0:n.split(/\s+/).filter(Boolean))||[],v=m.getAttribute("style")||"",w=this.parseStyleWithFilter(v);let T=!1;for(const _ of p){const A=d[_];if(A)for(const R in A)w[R]||(w[R]=A[R],T=!0)}if(T){let _="";for(const A in w)_+=A+":"+w[A]+";";_&&m.setAttribute("style",_)}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[$e.tableCaption]&&(a[$e.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,h=a.getAttribute("style")||"",g=h+(h?"; ":"")+`height: ${d}px`;a.setAttribute("style",g)}}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 h of Array.from(d)){const g=parseInt(h.getAttribute("rowspan")||"1");if(g>1)for(let m=1;m<g;m++){const p=a+m;if(p>=n.length)break;i.has(p)||i.set(p,[]),i.get(p).push(h)}}}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 CB extends Qp{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=Yn(e[0],$e.tableMain),o=n.getRows(),i=e.map(p=>{if(!p||!p.parent||!p.parent.domNode)return null;const v=p.parent.domNode;if(!v)return null;const w=o.findIndex(A=>A.rowId===p.rowId);if(w===-1)return null;const T=p.getColumnIndex();if(T===-1)return null;const _=v.getBoundingClientRect();return!_||_.width===0||_.height===0?null:{td:p,rowIndex:w,colIndex:T,rowspan:p.rowspan,colspan:p.colspan,visualLeft:_.left,visualRight:_.right,visualTop:_.top,visualBottom:_.bottom}}).filter(Boolean);if(i.length<=1)return;i.sort((p,v)=>p.visualTop-v.visualTop||p.visualLeft-v.visualLeft);const a=i[0],c=a.td,d=Math.max(...i.map(p=>p.rowIndex+p.rowspan-1)),h=Math.max(...i.map(p=>p.colIndex+p.colspan-1)),g=d-a.rowIndex+1,m=h-a.colIndex+1;for(const p of i)p.td!==c&&(p.td.moveChildren(c),p.td.parent.remove());c.rowspan=g,c.colspan=m,this.fixTableByRemove(n)}}ke.register({"modules/imageCompress":Eh,"modules/resize":jC,"modules/tableUp":CB,"modules/magicUrl":iP,"formats/divider":K1,"modules/clipboard":wB,"modules/copy":iB},!0);const Wd={KB:1024,QUALITY:.7,IMAGE_SIZES:new Map},SB={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+=Wd.IMAGE_SIZES.get(n)||Math.ceil(n.length*Wd.QUALITY))}return e}},_B=r=>{const{type:e="Primary",editorRef:t,useValue:n,useError:o,placeholder:i,tabIndex:a,autoFocus:c,editorProps:d,style:h,minHeight:g,maxHeight:m,contentHeight:p,contentMaxHeight:v=1e3,toolbarSize:w="Med",toolbarType:T="Default",readOnly:_,limitPosition:A="Bottom",maxLength:R,size:D=100,editorClassName:I,editorStyle:F,noImageResize:B,...H}=r,[{wrapId:j,wrapProps:G,labelProps:ge,...P},q]=Yu(H),V=C.useMemo(()=>e==="ReadOnly"||_,[e,_]),Q=C.useMemo(()=>p?20:0,[p]),[ie,se]=C.useState(w==="Med"?40:50),ae=C.useMemo(()=>V?0:ie,[V,ie]),[le,fe]=C.useMemo(()=>!o||V||A==="Top"?[0,0]:[20,6],[o,V,A]),ee=C.useMemo(()=>le+fe,[le,fe]),[ne,ce]=C.useState(p),[xe,Me]=C.useState(!1),[oe,Se]=C.useState(!1),Le=C.useRef(null),We=C.useRef(0),Ve=C.useRef(0),we=C.useMemo(()=>P.label?24:0,[P.label]),_e=C.useMemo(()=>T==="Title",[T]),Ae=C.useMemo(()=>p||g||_e,[p,g,_e]),Ie=C.useMemo(()=>Ae?"fit-content":m?m+we:`calc(100% - ${we}px)`,[Ae,m,we]),je=C.useMemo(()=>{if(p){if(ne)switch(e){case"ReadOnly":return ne;case"Raw":return ne+ee;default:return ne+ae+ee}}else return},[p,ne,e,ae,ee]),it=C.useMemo(()=>{if(!(!m||m<=ae+ee))switch(e){case"ReadOnly":return m;case"Raw":return m-ee;default:return m-ae-ee}},[e,ae,ee,m]),Ue=C.useMemo(()=>{if(g&&p){const Ge=Math.min(g-ae-ee,p);return V?Ge:Ge+ae+ee}else return g||(p?void 0:`calc(100% - ${we}px)`)},[g,p,we,ae,ee,V]),tt=C.useMemo(()=>(Array.isArray(P.errorMessage)?P.errorMessage.some(Boolean):!!P.errorMessage)?"Error":e,[P.errorMessage,e]),lt=C.useCallback(Ge=>{let st=Ge;st=f9.sanitize(Ge);const ct=document.createElement("div");return ct.innerHTML=st,new ke(ct,{readOnly:!0}).getContents()},[]),[bt,Mt]=wn(n,""),[Qe,Xe]=C.useState(()=>lt(bt));C.useEffect(()=>{Mt===void 0&&Xe(lt(bt))},[lt,Mt,bt]);const ht=C.useMemo(()=>S.jsx(AB,{htmlDelta:Qe,isReadonly:V,limit:D*Wd.KB,useError:o}),[Qe,V,D,o]),ft=C.useRef(null),Oe=C.useRef([]),[Je,gt]=C.useState(!0);C.useEffect(()=>{const Ge=setTimeout(()=>gt(!1),0);return()=>{clearTimeout(Ge),Oe.current.forEach(st=>st()),Oe.current=[]}},[]);const It=C.useCallback((Ge,st)=>{if(!p)return st;const ct=g?g-ae-ee:p,xt=Math.max(ct,0),Nt=m?m-ae-ee:v;return Math.min(Nt,Math.max(xt,st+Ge))},[p,g,ae,ee,m,v]),Et=C.useCallback(Ge=>{if(!xe||!p)return;const st=Ge.clientY-Ve.current,ct=It(st,We.current);ne!==ct&&ce(ct),Ge.preventDefault(),Ge.stopPropagation()},[xe,p,It,ne]),Dt=C.useCallback(Ge=>{Me(!1),Se(!1),document.removeEventListener("mousemove",Et),document.removeEventListener("mouseup",Dt),Ge.preventDefault(),Ge.stopPropagation()},[Et]),Xt=C.useCallback(Ge=>{if(!p)return;if(Ge.detail===2){ce(p);return}ne===void 0?(ce(p),We.current=p):We.current=ne,Me(!0),Se(!0),Ve.current=Ge.clientY;const st=xt=>{if(!p)return;const Nt=xt.clientY-Ve.current,Bt=It(Nt,We.current);ce(Bt),xt.preventDefault(),xt.stopPropagation()},ct=xt=>{Me(!1),Se(!1),document.removeEventListener("mousemove",st),document.removeEventListener("mouseup",ct),xt.preventDefault(),xt.stopPropagation()};document.addEventListener("mousemove",st),document.addEventListener("mouseup",ct),Ge.preventDefault(),Ge.stopPropagation()},[p,ne,It]),Wt=C.useCallback((Ge,st,ct,xt)=>{if(ct!=="user"&&ct!=="api")return;const Nt=xt.getContents(),Bt=xt.getLength()-1,qt=R!==void 0&&Bt>R,Yt=te=>te.replace(/\s{2,}/g,ye=>" ".repeat(ye.length)),ir=Ge.replace(/<p><br><\/p>/gi,"").trim(),jt=Yt(ir);if(!qt){Xe(Nt),Mt==null||Mt(jt);return}const xr=hr(Nt,R);Xe(xr);const jr=new ke(document.createElement("div"));jr.setContents(xr);const Ze=Yt(jr.root.innerHTML.replace(/<p><br><\/p>/gi,"").trim());Mt==null||Mt(Ze)},[R,Mt]),hr=(Ge,st)=>{var Nt,Bt,qt;if(!Ge.ops)return Ge;const ct=new rr;let xt=0;for(const Yt of Ge.ops){if(xt>=st)break;if(Yt.insert&&typeof Yt.insert=="string"){const ir=Yt.insert,jt=st-xt;if(ir.length<=jt)(Nt=ct.ops)==null||Nt.push(Yt),xt+=ir.length;else{const xr={...Yt,insert:ir.substring(0,jt)};(Bt=ct.ops)==null||Bt.push(xr),xt+=jt;break}}else xt<st&&((qt=ct.ops)==null||qt.push(Yt),xt+=1)}return ct},dr=C.useCallback(Ge=>{var Nt,Bt;const st=Ge.getEditor().container;if(!st)return null;const ct=(Nt=st.closest(".AEditorContainer"))==null?void 0:Nt.querySelector(".ql-toolbar");return ct||((Bt=st.parentElement)==null?void 0:Bt.querySelector(".ql-toolbar"))||null},[]),cr=C.useCallback((Ge,st,ct,xt)=>{if(!Ge)return;const Nt=ct;Ge.addEventListener(st,Nt,xt),Oe.current.push(()=>Ge.removeEventListener(st,Nt,xt))},[]),Te=C.useCallback((Ge,st,ct)=>{const xt=st.getFormat();Ge.forEach(Nt=>{if(xt[Nt]){const Bt=xt[Nt],qt=`.ql-${Nt}`,Yt=ct.querySelector(`${qt} .ql-picker-label`),ir=ct.querySelectorAll(`${qt} .ql-picker-item`),jt=Array.from(ir).find(xr=>xr.getAttribute("data-value")===Bt);jt&&(jt.classList.add("ql-selected"),Yt==null||Yt.classList.add("ql-active"))}})},[]),ue=C.useCallback(Ge=>{if(!Ge.length)return;const xt=Ge[0].target.getBoundingClientRect(),Nt=Math.ceil(xt.height);se(Bt=>Math.abs(Bt-Nt)<.1?Bt:Nt)},[]),at=C.useCallback((Ge,st)=>{if(Ge.key!=="Backspace")return;const ct=st.getSelection(!1);if(!ct||ct.length>0)return;const xt=ct.index;if(xt<=0)return;const[Nt]=st.getLine(xt);if(Nt&&xt===st.getIndex(Nt)||st.getFormat(xt,1).link)return;const Bt=st.getFormat(xt-1,1);if(Bt.link){Ge.preventDefault();let qt=xt-1;for(;qt>0&&st.getFormat(qt-1,1).link===Bt.link;)qt--;const[Yt]=st.scroll.descendant(ir=>{var jt;return((jt=ir==null?void 0:ir.statics)==null?void 0:jt.blotName)==="link"},qt);if(Yt!=null&&Yt.domNode){const ir=(Yt.domNode.textContent||"").length;st.removeFormat(qt,ir)}}},[]),ze=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(Ge){const{blockquote:st,list:ct,["code-block"]:xt}=Ge.getFormat();return st||ct||xt?(Ge.format("blockquote",!1),Ge.format("list",!1),Ge.format("code-block",!1),!1):!0}}}},magicUrl:!0,toolbar:{container:[["bold","italic","underline","strike",{color:[]},{background:[]},"clean"]]}}),[]),vt=C.useCallback(()=>({clipboard:{},copy:{},keyboard:{},magicUrl:!0,imageCompress:{quality:Wd.QUALITY,imageType:"image/jpeg",maxWidth:1500,maxHeight:1500,debug:!1,handleOnPaste:Ge=>{var st,ct;try{const xt=(st=Ge.clipboardData)==null?void 0:st.items;if(!xt)return!0;const Nt=Array.from(xt).some(Yt=>{const ir=Yt.type.toLowerCase();return ir.includes("Excel")||ir.includes("text/html")}),Bt=(ct=Ge.clipboardData)==null?void 0:ct.getData("text/html"),qt=Bt&&(Bt.includes("<table")||Bt.includes("<tbody")||Bt.includes("<td"));return!(Nt||qt)}catch(xt){return console.warn("Error in handleOnPaste:",xt),!0}},insertIntoEditor:(Ge,st,ct)=>{Wd.IMAGE_SIZES.has(Ge)||Wd.IMAGE_SIZES.set(Ge,st.size);const xt=ct.getSelection();xt&&ct.insertEmbed(xt.index,"image",Ge,ke.sources.USER)}},...!V&&{...!B&&{resize:{}},table:!1,tableUp:{fullSwitch:!1,icon:Np.renderToString(S.jsx(gn,{icon:"Table",size:w==="Med"?"sm":"md",strokeWidth:2.5})),resize:zP,resizeScale:$P,customSelect:YP,selection:UP,fixUnusuaDeletelTable:!1,selectionOptions:{tableMenu:jP,tableMenuOptions:{localstorageKey:"used-color",tipText:!0,tools:[Xr.InsertCaption,Xr.InsertTop,Xr.InsertRight,Xr.InsertBottom,Xr.InsertLeft,Xr.Break,Xr.MergeCell,Xr.SplitCell,Xr.Break,Xr.DeleteRow,Xr.DeleteColumn,Xr.DeleteTable,Xr.Break,Xr.BackgroundColor,Xr.BorderColor,Xr.Break,Xr.CopyCell,Xr.CutCell,Xr.Break,Xr.SwitchWidth]}},texts:{fullCheckboxText:wr.AEditor["Insert Full Width Table"],customBtnText:wr.AEditor.Custom,confirmText:wr.AEditor.Confirm,cancelText:wr.AEditor.Cancel,rowText:wr.AEditor.Row,colText:wr.AEditor.Column,CopyCell:wr.AEditor["Copy Cell"],CutCell:wr.AEditor["Cut Cell"],notPositiveNumberError:wr.AEditor["Not Positive Number Error"],custom:wr.AEditor.Custom,clear:wr.AEditor.Clear,transparent:wr.AEditor.Transparent,perWidthInsufficient:wr.AEditor.perWidthInsufficient,InsertTop:wr.AEditor["Insert Row Top"],InsertRight:wr.AEditor["Insert Column Right"],InsertBottom:wr.AEditor["Insert Row Bottom"],InsertLeft:wr.AEditor["Insert Column Left"],MergeCell:wr.AEditor["Merge Cell"],SplitCell:wr.AEditor["Split Cell"],DeleteRow:wr.AEditor["Delete Row"],DeleteColumn:wr.AEditor["Delete Column"],DeleteTable:wr.AEditor["Delete Table"],BackgroundColor:wr.AEditor["Set Background Color"],BorderColor:wr.AEditor["Set Border Color"],SwitchWidth:wr.AEditor["Switch Table Width"],InsertCaption:wr.AEditor["Insert Table Caption"]}},toolbar:{container:[[{header:[1,2,3,!1,4]}],["bold","italic","underline","strike","blockquote","divider",{[Qp.toolName]:[]},{color:[]},{background:[]}],[{list:"ordered"},{list:"bullet"},{indent:"-1"},{indent:"+1"},{align:[]}],["link","image","video"],["clean"]],handlers:{divider:function(){const Ge=this.quill,st=Ge.getSelection(!0);if(!st)return;const ct=Math.min(st.index+1,Ge.getLength()-1);Ge.insertEmbed(ct,"divider",!0,ke.sources.USER),setTimeout(()=>Ge.setSelection(Math.min(ct+1,Ge.getLength()-1),0,ke.sources.SILENT),0)}}}}}),[V,B,w]),_t=C.useMemo(()=>_e?ze():vt(),[_e,ze,vt]),Tt=C.useCallback(Ge=>{if(!Ge)return;const st=Ge.getEditor();if(!st)return;const ct=st.root,xt=dr(Ge);ct&&I&&ct.classList.add(...I.split(" ")),ct&&F&&Object.entries(F).forEach(([Bt,qt])=>{const Yt=Bt.replace(/([A-Z])/g,ir=>`-${ir[0].toLowerCase()}`);ct.style[Yt]=qt}),cr(ct,"keydown",Bt=>at(Bt,st));const Nt=new ResizeObserver(ue);if(xt){Nt.observe(xt),Oe.current.push(()=>Nt.disconnect());const Bt=["header","color","background"];Bt.forEach(qt=>{const Yt=xt.querySelector(`.ql-${qt} .ql-picker-label`);Yt&&cr(Yt,"click",()=>Te(Bt,st,xt))})}},[dr,I,F,cr,ue,at,Te]),Ut=C.useCallback(Ge=>{if(Oe.current.forEach(ct=>ct()),Oe.current=[],ft.current=Ge,!Ge){Hc.isFunction(t)?t(null):t!=null&&t.current&&(t.current=null);return}const st=Ge;st.copyContent=ct=>{Ge.getEditor().getModule("copy").copyContent(ct)},Hc.isFunction(t)?t(st):t&&(t.current=st),Tt(Ge)},[t,Tt]);return S.jsx(Yc,{wrapId:j,...P,label:S.jsxs(On,{style:{gap:4},children:[P.label,A==="Top"&&ht]}),labelProps:{...ge,style:{minHeight:P.label?20:void 0,marginBottom:P.label?4:0,...ge==null?void 0:ge.style}},wrapProps:{...G,className:Ye.clsx(G==null?void 0:G.className,!Ae&&Ni.AEditorWrapper),style:{...G==null?void 0:G.style,height:Ie}},children:S.jsxs(Jr,{...q,className:Ye.clsx(q.className,Ni.AEditorContainer,Je&&"NoTransition"),style:{...h,height:je,minHeight:Ue},children:[S.jsx(yg,{...d,ref:Ut,preserveWhitespace:!0,modules:_t,placeholder:i,readOnly:V,theme:"snow",value:Qe,className:Ye.clsx(d==null?void 0:d.className,Ni.AEditor,Ni[tt],_e&&"Title",Je&&"NoTransition"),style:{...d==null?void 0:d.style,maxHeight:it?it+ae:void 0,"--icon-size":`${w==="Med"?20:24}px`,"--editor-padding":_e?"8px 12px":"12px","--toolbar-padding":`${w==="Med"?7.5:12.5}px`,"--content-height":_e?"fit-content":ne?`${ne}px`:"100%","--content-max-height":it?`${it}px`:"100%","--default-text":`'${wr.AEditor.Default}'`,"--visit-url-text":`'${wr.AEditor["Visit URL:"]}'`,"--enter-link-text":`'${wr.AEditor["Enter link:"]}'`,"--enter-video-text":`'${wr.AEditor["Enter video:"]}'`,"--edit-text":`'${wr.AEditor.Edit}'`,"--save-text":`'${wr.AEditor.Save}'`,"--remove-text":`'${wr.AEditor.Remove}'`,"--arrow-background":`url("data:image/svg+xml,${encodeURIComponent(Np.renderToString(S.jsx(gn,{icon:"EditorArrow"})))}`,"--title-color-picker-row":_e?1:4,"--title-header-font-size":`${w==="Med"?12:14}px`},onChange:Wt}),p&&S.jsxs(S.Fragment,{children:[S.jsx("div",{ref:Le,className:Ye.clsx(Ni.Resizer,Je&&"NoTransition"),style:{height:Q,bottom:o&&!V?ee:0},onMouseDown:Xt}),S.jsx("div",{children:`${Math.round(ne)}px`,className:Ye.clsx(Ni.Indicator,"NoSelect","Label1",Je&&"NoTransition"),style:{height:Q,bottom:o&&!V?ee:0,display:oe?"flex":"none"}})]}),S.jsx("div",{children:ht,className:Ye.clsx(Ni.LimitContainer,"NoSelect",Je&&"NoTransition"),style:{marginTop:fe,minHeight:le,display:A==="Bottom"?"flex":"none"}})]})})},AB=({htmlDelta:r,limit:e,useError:t,isReadonly:n})=>{const[o,i]=wn(t,!1),a=C.useMemo(()=>SB.calculateTextSize(r),[r]);return C.useEffect(()=>{i&&i(a>e)},[a,e,i]),!t||n?null:S.jsxs(tl,{className:Ni.Limit,children:["(",S.jsx("span",{className:Ye.clsx(o&&Ni.Error),children:Hu(a)})," / ",Hu(e),")"]})};function EB(){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 wg=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function vf(r){const e=Object.prototype.toString.call(r);return e==="[object Window]"||e==="[object global]"}function Fv(r){return"nodeType"in r}function Bi(r){var e,t;return r?vf(r)?r:Fv(r)&&(e=(t=r.ownerDocument)==null?void 0:t.defaultView)!=null?e:window:window}function jv(r){const{Document:e}=Bi(r);return r instanceof e}function Ph(r){return vf(r)?!1:r instanceof Bi(r).HTMLElement}function HC(r){return r instanceof Bi(r).SVGElement}function yf(r){return r?vf(r)?r.document:Fv(r)?jv(r)?r:Ph(r)||HC(r)?r.ownerDocument:document:document:document}const sl=wg?C.useLayoutEffect:C.useEffect;function Hv(r){const e=C.useRef(r);return sl(()=>{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 TB(){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 Rh(r,e){e===void 0&&(e=[r]);const t=C.useRef(r);return sl(()=>{t.current!==r&&(t.current=r)},e),t}function Bh(r,e){const t=C.useRef();return C.useMemo(()=>{const n=r(t.current);return t.current=n,n},[...e])}function tg(r){const e=Hv(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 J1(r){const e=C.useRef();return C.useEffect(()=>{e.current=r},[r]),e.current}let Am={};function Fh(r,e){return C.useMemo(()=>{if(e)return e;const t=Am[r]==null?0:Am[r]+1;return Am[r]=t,r+"-"+t},[r,e])}function zC(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,h]of c){const g=i[d];g!=null&&(i[d]=g+r*h)}return i},{...e})}}const rf=zC(1),rg=zC(-1);function RB(r){return"clientX"in r&&"clientY"in r}function zv(r){if(!r)return!1;const{KeyboardEvent:e}=Bi(r.target);return e&&r instanceof e}function kB(r){if(!r)return!1;const{TouchEvent:e}=Bi(r.target);return e&&r instanceof e}function Q1(r){if(kB(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 RB(r)?{x:r.clientX,y:r.clientY}:null}const kh=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[kh.Translate.toString(r),kh.Scale.toString(r)].join(" ")}},Transition:{toString(r){let{property:e,duration:t,easing:n}=r;return e+" "+t+"ms "+n}}}),Vb="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function IB(r){return r.matches(Vb)?r:r.querySelector(Vb)}const MB={display:"none"};function LB(r){let{id:e,value:t}=r;return C.createElement("div",{id:e,style:MB},t)}function DB(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 OB(){const[r,e]=C.useState("");return{announce:C.useCallback(n=>{n!=null&&e(n)},[]),announcement:r}}const $C=C.createContext(null);function NB(r){const e=C.useContext($C);C.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of <DndContext>");return e(r)},[r,e])}function PB(){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 BB={draggable:`
|
359
359
|
To pick up a draggable item, press the space bar.
|
360
360
|
While dragging, use the arrow keys to move the item.
|
361
361
|
Press space again to drop the item in its new position, or press escape to cancel.
|
package/dist/index.es.js
CHANGED
@@ -36133,7 +36133,7 @@ const Gd = {
|
|
36133
36133
|
Up.renderToString(/* @__PURE__ */ C.jsx(An, { icon: "EditorArrow" }))
|
36134
36134
|
)}`,
|
36135
36135
|
"--title-color-picker-row": Ae ? 1 : 4,
|
36136
|
-
"--title-header-font-size": `${w === "Med" ? 12 :
|
36136
|
+
"--title-header-font-size": `${w === "Med" ? 12 : 14}px`
|
36137
36137
|
},
|
36138
36138
|
onChange: Zt
|
36139
36139
|
}
|