@ones-editor/editor 1.1.8-beta.13 → 1.1.8-beta.14
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.js
CHANGED
|
@@ -610,7 +610,7 @@ ${t}
|
|
|
610
610
|
</clipPath>
|
|
611
611
|
</defs>
|
|
612
612
|
</svg>
|
|
613
|
-
`,cP=Object.freeze(Object.defineProperty({__proto__:null,ClearIcon:ty,CloseIcon:qh,PrevIcon:pT,NextIcon:CT,MoreIcon:qp,TextColorIcon:Xp,ArrowDownIcon:Xh,ArrowUpIcon:GN,ArrowLeftIcon:WN,ArrowRightIcon:Yp,DeleteRowIcon:ET,DeleteColIcon:AT,MergeCellIcon:xT,SplitCellIcon:bT,DeleteTableIcon:vT,Heading1Icon:Yh,Heading2Icon:Qh,Heading3Icon:Jh,Heading4Icon:Zh,Heading5Icon:t0,Heading6Icon:e0,Heading7Icon:n0,Heading8Icon:r0,HeadingNIcon:qN,OrderedListIcon:BT,UnorderedListIcon:TT,CheckListIcon:yT,BlockquoteIcon:kT,AlignCenterIcon:o0,AlignLeftIcon:Fa,AlignRightIcon:i0,ImageIcon:RT,ImageMenuIcon:wT,ImageErrorIcon:Jp,ImageEmptyIcon:LT,LinkIcon:nC,LinkOffIcon:IT,WarningIcon:Qp,PasteSpecialIcon:ST,LaunchIcon:Zp,CodeIcon:zT,AudioIcon:VT,GraphIcon:XN,VideoIcon:$T,FileIcon:YN,MathIcon:JN,MathMenuIcon:DT,TableIcon:ZN,TableMenuIcon:_T,BilibiliIcon:UT,YoukuIcon:OT,ModaoIcon:PT,FigmaIcon:NT,EditIcon:s0,CommentIcon:ll,RefreshIcon:MT,HelpIcon:tC,CheckMarkIcon:eC,TextIcon:Ka,RightArrowIcon:QN,TencentVideoIcon:FT,WebPageIcon:KT,UmlIcon:HT,DividingLineIcon:jT,HeadingH1Icon:tP,HeadingH2Icon:eP,HeadingH3Icon:nP,HeadingH4Icon:rP,HeadingH5Icon:iP,HeadingH6Icon:oP,HeadingH7Icon:sP,HeadingH8Icon:lP,CheckboxIcon:rC,QuoteIcon:iC,LinkHrefIcon:aP,OrderedIcon:sC,UnorderedIcon:oC,CopyIcon:GT,CutIcon:WT,DeleteIcon:qT,LockBlockIcon:XT,UnLockBlockIcon:YT,InsertBeforeIcon:QT,InsertAfterIcon:JT,MentionIcon:ZT,CircleAddIcon:ey,LoadingIcon:ny,DragIcon:lC,UmlBrandIcon:l0,OnesLoadingIcon:ry,BoldIcon:iy,ItalicIcon:oy,UnderlineIcon:sy,LineThroughIcon:ly,SubscriptIcon:cy,SuperscriptIcon:uy,InlineCodeIcon:ay,ToMindMapIcon:fy,FitIcon:dy,FullScreenIcon:aC,ExitFullScreenIcon:hy,CaretDownIcon:my,StatusIcon:gy},Symbol.toStringTag,{value:"Module"}));function py(){const n=B("span",["editor-loading-icon"],null);return n.innerHTML=ry,n}const act="";function uP(n,t){const e=B("button",["editor-checkbox-wrapper"],null);e.setAttribute("data-button-id",n),t!=null&&t.includes("checked")&&z(e,"checked"),t!=null&&t.includes("disabled")&&(e.disabled=!0);const r=B("span",["editor-checkbox"],e);return B("span",["editor-checkbox-inner"],r),e}const cct="",Va=I("ui-command-bar-base"),fP={itemElementTag:"div",tippyArrow:!1},wA=class extends Be.TypedEmitter{constructor(e,r,i){var o,s;super();m(this,"content");m(this,"items");m(this,"subBar",null);m(this,"parentItem",null);m(this,"closeable",null);m(this,"closeReason",null);m(this,"options");m(this,"id");m(this,"header",null);m(this,"footer",null);m(this,"handleDocumentKeydown",e=>{if(!!this.isVisible&&!e.isComposing&&!qs(e.target)){if(this.subBar){this.subBar.handleDocumentKeydown(e);return}if(this.items.length!==0){if(e.key==="Escape"){this.close("cancelBar");return}if(e.key==="ArrowUp"){const r=this.getPrevItemIndex(this.getSelectedItemIndex());this.startPauseMouseEnter(),this.selectItem(this.items[r].id),e.preventDefault(),e.stopPropagation()}else if(e.key==="ArrowDown"){const r=this.getNextItemIndex(this.getSelectedItemIndex());this.startPauseMouseEnter(),this.selectItem(this.items[r].id),e.preventDefault(),e.stopPropagation()}else if(e.key==="ArrowRight"){const r=this.getSelectedItem();r&&r.children&&this.showSubCommandBar(r.childrenMenuId)}else if(e.key==="ArrowLeft")this.parentItem&&this.close("switchItem");else if(e.key==="Enter"){const r=this.getSelectedItemIndex();if(r===-1)return;const i=this.items[r],o=this.getItemElementById(i.id);o&&this.emit("click",this,i,o)}}}});m(this,"handleDocumentMouseDown",e=>{if(e.target instanceof Element&&!this.isInCommandBar(e.target)){const r=this.listeners("closing");for(let i=0;i<r.length;i++)if(r[i](this,e)===!1)return;this.close("clickBackground")}});m(this,"handleHidden",()=>{this.closeReason!=="fromHover"&&this.emit("close",this),this.close(null),Hg(this.id)});m(this,"handleShow",()=>{this.popper&&(this.popper.setAttribute("data-command-bar-id",this.id),this.options.classes&&z(this.popper,...this.options.classes),this.options.refuseOverflow&&this.popper.classList.add("reference-hidden")),this.emit("show",this),this.options.disablePageScroll&&$g(this.id)});m(this,"lastEnterPauseTime",0);m(this,"startPauseMouseEnter",()=>{this.lastEnterPauseTime=Date.now()});m(this,"handleItemMouseEnter",e=>{if(Date.now()-this.lastEnterPauseTime<100)return;const r=this.getParentCommandItemElement(e.target);if(!r)return;const i=this.getItemElementId(r),o=this.getItemById(i);if(this.selectItem(i),o.manualShowChildren)return;const s=o.childrenMenuId||"";this.showSubCommandBar(s)});m(this,"handleItemMouseLeave",e=>{var i,o;const r=this.getParentCommandItemElement(e.target);!r||((o=(i=this.subBar)==null?void 0:i.parentItem)==null?void 0:o.id)!==this.getItemElementId(r)&&(ot(r,"selected"),this.emit("selectionChange",this,""))});m(this,"handleItemClick",e=>{const r=this.getParentCommandItemElement(e.target);if(!r)return;const i=this.getItemElementId(r),o=this.items.find(s=>s.id===i);if(!!o&&!(o.states&&o.states.indexOf("disabled")!==-1)){if(o.children&&o.children.length>0&&o.manualShowChildren){this.showSubCommandBar(o.childrenMenuId);return}o.element||(this.emit("click",this,o,r),this.options.autoClose&&this.close("clickItem"))}});m(this,"handleWheel",e=>{if(!this.options.disablePageScroll&&!document.querySelector(".editor-disable-scroll"))return;const r=e.target;if(!r||!(r instanceof Node))return;const i=r instanceof HTMLElement?r:r.parentElement;if(!i)return;const o=Ge(i);if(!re(this.content,o)){e.stopPropagation(),e.preventDefault();return}e.deltaY<0?o.scrollTop===0&&(e.stopPropagation(),e.preventDefault()):e.deltaY>0&&o.scrollTop+o.clientHeight>=o.scrollHeight&&(e.stopPropagation(),e.preventDefault())});this.id=(o=i==null?void 0:i.id)!=null?o:tt(),this.options={...fP,...i},this.items=e,this.parentItem=(s=i==null?void 0:i.parentItem)!=null?s:null,this.closeable=r!=null?r:null,this.content=this.createCommandBarContent(e)}close(e){this.closeReason=e,this.subBar&&this.subBar.close(e),document.removeEventListener("keydown",this.handleDocumentKeydown),document.removeEventListener("mousedown",this.handleDocumentMouseDown)}click(e,r){this.emit("click",this,e,r)}createPopperOptions(){var i,o;const e={modifiers:[]},r=this.options.overflowBoundary;return r&&((i=e==null?void 0:e.modifiers)==null||i.push({name:"flip",options:{boundary:r,fallbackPlacements:["top","bottom"]}})),this.options.padding&&((o=e==null?void 0:e.modifiers)==null||o.push({name:"preventOverflow",options:{padding:this.options.padding}})),e}destroy(){var e;this.close(null),this.removeAllListeners(),(e=this.subBar)==null||e.destroy(),this.subBar=null,this.closeable=null,this.content.removeEventListener("wheel",this.handleWheel)}get isSubCommandBar(){return!!this.parentItem}updateItems(e){var i;this.subBar&&e.findIndex(s=>{var l,c;return s.id===((c=(l=this.subBar)==null?void 0:l.parentItem)==null?void 0:c.id)})===-1&&((i=this.subBar)==null||i.destroy(),this.subBar=null),this.items=e;const r=this.createCommandBarContent(e);this.content.innerHTML="",Array.from(r.children).forEach(o=>{this.content.appendChild(o)})}get popper(){return this.content.closest("[data-tippy-root]")}getSelectedItemIndex(){const e=this.getSelectedItem();return e?this.items.indexOf(e):-1}getPrevItemIndex(e){if(e<=0)return this.items.length-1;let r=e-1;for(;;){const i=this.items[r],o=i.type,l=!(i.states&&i.states.indexOf("disabled")!==-1);if(o!=="separator"&&o!=="section"&&l)return r;if(r-=1,r<0)return this.items.length-1}}getNextItemIndex(e){let r=e+1;for(;;){if(!this.items[r])return this.getNextItemIndex(-1);const i=this.items[r],o=i.type,l=!(i.states&&i.states.indexOf("disabled")!==-1);if(o!=="separator"&&o!=="section"&&l)return r;if(r+=1,r>this.items.length-1)return 0}}clearSelectedItem(){const e=this.getSelectedItem();if(!e)return;const r=this.getItemElementById(e.id);r&&ot(r,"selected")}selectItem(e){const r=this.getSelectedItem();if(r){if(r.id===e)return;const o=r.id,s=this.getItemElementById(o);s&&ot(s,"selected")}const i=this.getItemElementById(e);i?(z(i,"selected"),this.emit("selectionChange",this,i.getAttribute("data-id")||""),this.options.disableSelectedScroll||i.scrollIntoView({block:"nearest"})):this.emit("selectionChange",this,"")}showSubCommandBar(e){var s,l,c,d;const r=this.getSelectedItem();if(!r||!r.children&&((l=(s=this.subBar)==null?void 0:s.parentItem)==null?void 0:l.manualShowChildren))return;if(this.subBar){if(((c=this.subBar.parentItem)==null?void 0:c.id)===r.id){r.manualShowChildren&&this.subBar.close("switchItem");return}this.subBar.destroy(),this.subBar=null}if(!r.children)return;const i=this.getItemElementById(r.id);if(!i)return;const o=wA.createSubCommandBar(r,(d=this.closeable)!=null?d:this,e?{id:e}:{});this.subBar=o,this.subBar.on("click",(h,C,E)=>{this.emit("click",h,C,E)}),this.subBar.on("close",()=>{var h;(h=this.subBar)==null||h.destroy(),this.subBar=null,ot(i,"active")}),r.beforePopup&&r.beforePopup(o),this.subBar.manualShow(i,this.getSubBarOptions(r)),z(i,"active")}isInCommandBar(e){if(!e||!(e instanceof Node))return!1;const r=this.getCommandBarRoot();return r&&re(r,e)||re(this.content,e)?!0:this.subBar?this.subBar.isInCommandBar(e):!1}createCommandItem(e){var o,s,l,c;let r=(o=this.options.itemElementTag)!=null?o:"div";e.element&&(r="div");const i=B(r,["command-item"],null);return i.setAttribute("data-id",e.id),e.type==="separator"?i.classList.add("separator"):e.type==="section"?(i.classList.add("section","text"),e.element&&(typeof e.element=="function"?i.appendChild(e.element(e)):i.appendChild(e.element))):((s=e.states)!=null&&s.includes("selected")&&i.classList.add("selected"),(l=e.states)!=null&&l.includes("checked")&&i.classList.add("checked"),(c=e.states)!=null&&c.includes("disabled")&&i.classList.add("disabled"),i.onclick=this.handleItemClick,i.onmouseenter=this.handleItemMouseEnter,i.onmouseleave=this.handleItemMouseLeave,e.element?typeof e.element=="function"?i.appendChild(e.element(e)):i.appendChild(e.element):i.classList.add("standard")),this.initItemElement(e,i),i}getItemById(e){const r=this.items.find(i=>i.id===e);return p(Va,r,`can not find command item for id: ${e}`),r}getSelectedItem(){const e=this.content.querySelector(":scope >.editor-command-bar >.command-item.selected");if(e){const r=this.getItemElementId(e),i=this.items.find(o=>o.id===r);return p(Va,i,`can not find command item for id: ${r}`),i}return null}getItemElementId(e){const r=e.getAttribute("data-id");return p(Va,r,"no data-id attribute"),r}getItemElementById(e){const r=this.content.querySelector(`:scope >.editor-command-bar > .command-item[data-id="${e}"]`);return p(Va,r,`no exists command item, id=${e}`),r}getParentCommandItemElement(e){if(!e||!(e instanceof Element))return null;if(wt(e,"command-item"))return e;const r=e.closest(".command-item");return r||null}createCommandBarContent(e){this.content&&this.content.removeEventListener("wheel",this.handleWheel);const r=B("div",["editor-command-bar-root"],null);if(this.options.header){const o=B("div",["editor-command-bar-header"],null);if(this.options.header instanceof Function){const s=this.options.header();s&&o.appendChild(s)}else o.appendChild(this.options.header);this.header=o,this.header&&r.appendChild(this.header)}const i=B("div",["editor-command-bar"],r);if(e.forEach(o=>{var l;const s=this.createCommandItem(o);i.appendChild(s),o.element&&o.setCloseable&&o.setCloseable((l=this.closeable)!=null?l:this)}),this.options.footer){const o=B("div",["menu-item","editor-command-bar","footer"],null);if(this.options.footer instanceof Function){const s=this.options.footer();s&&o.appendChild(s)}else o.appendChild(this.options.footer);this.footer=o,this.footer&&r.appendChild(this.footer)}return(this.options.header||this.options.footer)&&z(r,"scrollable-bar"),this.initCommandBarElement(i),r.addEventListener("wheel",this.handleWheel,{passive:!1}),r}getSubBarOptions(e){var r;return{placement:(r=e.childrenPlacement)!=null?r:"right-start",offset:e.childrenOffset,arrow:e.childArrow}}static registerManualCommandBar(e,r){this.commandBarCreators.set(e,r)}static createSubCommandBar(e,r,i){var l;p(Va,e.children&&e.children.length>0,"no item children");const o=(l=e.childrenType)!=null?l:"menu",s=this.commandBarCreators.get(o);return p(Va,s,`no creator for command type: ${o}`),s(e,r,i)}static hasExistsCommandBar(){return!!document.querySelector("[data-command-bar-id]")}};let al=wA;m(al,"commandBarCreators",new Map),I("ui-command-bar");class a0 extends al{constructor(){super(...arguments);m(this,"tippyInstance",null)}manualShow(e,r){var i,o,s;if(!this.isVisible){if(this.tippyInstance&&(this.tippyInstance.destroy(),this.tippyInstance=null),this.tippyInstance=n9.default(e,{interactive:!0,content:this.content,trigger:"manual",triggerTarget:null,hideOnClick:!1,placement:(i=r==null?void 0:r.placement)!=null?i:"bottom-start",maxWidth:650,arrow:(o=r==null?void 0:r.arrow)!=null?o:this.options.tippyArrow,appendTo:document.body,onShow:this.handleShow,onHidden:this.handleHidden,theme:r==null?void 0:r.theme,getReferenceClientRect:r==null?void 0:r.getReferenceClientRect,offset:(s=r==null?void 0:r.offset)!=null?s:[0,0],popperOptions:this.createPopperOptions()}),r!=null&&r.point){const{x:l,y:c}=r.point;this.tippyInstance.setProps({getReferenceClientRect:()=>new DOMRect(l,c,0,0)})}this.clearSelectedItem(),this.tippyInstance.show(),this.parentItem||(document.addEventListener("keydown",this.handleDocumentKeydown),document.addEventListener("mousedown",this.handleDocumentMouseDown)),this.popper&&this.options.id&&this.popper.setAttribute("data-command-bar-id",this.options.id)}}close(e){var r;super.close(e),this.isVisible&&((r=this.tippyInstance)==null||r.hide())}destroy(){var e;(e=this.tippyInstance)==null||e.destroy(),this.tippyInstance=null,super.destroy()}getCommandBarRoot(){return this.content.closest("[data-tippy-root]")}get isVisible(){var e,r;return(r=(e=this.tippyInstance)==null?void 0:e.state.isVisible)!=null?r:!1}get popper(){return this.content.closest("[data-tippy-root]")}}const Cy=I("ui-base");class $a extends a0{constructor(t,e){var o;const i=[{id:(o=e==null?void 0:e.id)!=null?o:`popup-${tt()}`,name:"",element:t}];super(i,void 0,{disablePageScroll:!0,id:e==null?void 0:e.id})}initCommandBarElement(t){z(t,"popper")}initItemElement(t,e){}get popupContent(){const t=this.items[0];p(Cy,t,"no dialog item");const e=typeof t.element=="function"?t.element(t):t.element;return p(Cy,e,"no item element"),e}}const co=I("filterable-list");function Ey(n){var e,r;const t=B("div",["list-item"],null);return t.setAttribute("data-id",n.id),t.appendChild(B("div",["list-item-text"],null,n.name)),(e=n.states)!=null&&e.includes("selected")&&(z(t,"selected"),Os(eC,["list-item-selected-icon"],t)),(r=n.states)!=null&&r.includes("disabled")&&z(t,"disabled"),t}function Ay(n){const t=B("div",["list-root"],null);return n.forEach(e=>{t.appendChild(Ey(e))}),n.length||t.appendChild(Ey({id:"placeholder",states:["disabled"],name:D.t("search.emptyTips")})),t}function xy(n,t){return n.map(e=>({...e,states:t===e.id?["selected"]:[]}))}function dP(n,t){const e=B("div",["filterable-list"],null),r=B("div",["filter"],e),i=B("div",["filter-container"],r),o=B("input",["filter-input"],i);t&&t.placeholder&&(o.placeholder=t.placeholder);const s=B("div",["list"],e),l=Ay(xy(n,t==null?void 0:t.initialSelectedId));return s.appendChild(l),e}function by(n,t,e){const r=n.querySelector(".list");p(co,r,"no list root");const i=Ay(xy(t,e)),o=r.querySelector(".list-root");if(p(co,o,"no exists menu"),tu(o,i),e){const s=r.querySelector(".list-item.selected");s&&(p(co,s,"no selected menu item"),s.scrollIntoView({block:"nearest"}))}}class hP{constructor(t,e){m(this,"root");m(this,"visibleItems");m(this,"selectedId");m(this,"filter","");m(this,"onSelected",null);m(this,"handleKeydown",t=>{this.processKeyDown(t)});m(this,"handleInputChanged",()=>{const t=this.root.querySelector(".filter-input");p(co,t,"no input");const e=t.value.toLocaleLowerCase();this.setFilter(e)});m(this,"handleClick",t=>{this.processClick(t)});var r;this.items=t,this.options=e,this.root=dP(t,e),this.bindEvents(),this.selectedId=(r=e==null?void 0:e.initialSelectedId)!=null?r:"",this.visibleItems=t}bindEvents(){const t=this.root.querySelector(".filter-input");p(co,t,"no input"),t.addEventListener("keyup",this.handleInputChanged),t.addEventListener("keydown",this.handleKeydown),this.root.addEventListener("click",this.handleClick)}unbindEvents(){const t=this.root.querySelector(".filter-input");p(co,t,"no input"),t.removeEventListener("keyup",this.handleInputChanged),t.removeEventListener("keydown",this.handleKeydown),this.root.removeEventListener("click",this.handleClick)}destroy(){this.unbindEvents(),this.onSelected=null}getSelectedIndex(){return this.selectedId?this.visibleItems.findIndex(t=>t.id===this.selectedId):-1}setSelectedId(t){this.selectedId=t,by(this.root,this.visibleItems,t)}focus(){const t=this.root.querySelector(".filter-input");p(co,t,"no input"),t.focus()}moveSelectedItemIntoView(){const t=this.root.querySelector(".list-item.selected");t&&(p(co,t,"no selected menu item"),t.scrollIntoView({block:"nearest"}))}reset(){this.setFilter("");const t=this.root.querySelector(".filter-input");p(co,t,"no input"),t.value=""}setFilter(t){this.filter!==t&&(this.filter=t,this.visibleItems=this.items.filter(e=>e.name.toLocaleLowerCase().includes(t)),by(this.root,this.visibleItems,this.selectedId))}processClick(t){var s,l;const e=t.target;if(!(e instanceof HTMLElement))return;const r=e.closest(".list-item");if(!r)return;const i=(s=r.getAttribute("data-id"))!=null?s:"",o=(l=this.visibleItems.find(c=>c.id===i))!=null?l:null;this.onSelected&&this.onSelected(this,o)}processKeyDown(t){var e;if(t.key==="ArrowUp"){let r=this.getSelectedIndex();r===-1?r=this.visibleItems.length-1:r>0&&(r-=1);let i="";r!==-1&&(i=this.visibleItems[r].id),this.setSelectedId(i);return}if(t.key==="ArrowDown"){let r=this.getSelectedIndex();r===-1?r=0:r<this.visibleItems.length-1&&(r+=1);let i="";r!==-1&&(i=this.visibleItems[r].id),this.setSelectedId(i);return}if(t.key==="Enter"){const r=(e=this.visibleItems.find(i=>i.id===this.selectedId))!=null?e:null;this.onSelected&&this.onSelected(this,r)}}}class mP extends hP{constructor(e,r,i){super(e,i);m(this,"popup");m(this,"onShow",null);m(this,"onHide",null);m(this,"custom",null);m(this,"handleShow",()=>{this.onShow&&this.onShow(this)});m(this,"handleHide",()=>{this.onHide&&this.onHide(this)});m(this,"handleShown",()=>{this.focus()});this.popup=new $a(this.root)}destroy(){super.destroy(),this.onShow=null,this.onHide=null}show(e){this.reset(),this.popup.manualShow(e,{theme:"dropdown-list"}),this.focus(),this.moveSelectedItemIntoView()}processKeyDown(e){super.processKeyDown(e),(e.key==="Esc"||e.key==="Enter")&&this.popup.close("cancelBar")}processClick(e){super.processClick(e);const r=e.target;!(r instanceof HTMLElement)||!r.closest(".list-item")||this.popup.close("clickItem")}}const uct="",fct="";function gP(n,t){const e=document.createElement("div");e.classList.add("toast","show"),t!=null&&t.theme&&e.setAttribute("data-theme",t.theme),t!=null&&t.id&&e.setAttribute("data-id",t.id),t!=null&&t.html?e.innerHTML=n:e.textContent=n,t!=null&&t.position&&(e.style.left=`${t.position.x}px`,e.style.top=`${t.position.y}px`,e.classList.add("positioned")),document.body.appendChild(e),setTimeout(()=>{e.classList.remove("show"),setTimeout(()=>{e.remove()},500)},(t==null?void 0:t.duration)||3e3)}function pP(n,t){var e,r;if(z(t,"menu-item"),!n.element){if(n.type==="section"){const i=B("div",["section-name"],null,n.name);t.appendChild(i)}else if(n.type!=="separator"){if(n.icon){const o=B("div",["menu-item-icon"],null);n.icon&&(o.innerHTML=n.icon),t.appendChild(o)}const i=B("div",["menu-item-name","text"],null);if(B("span",[],i,n.name),n.ellipsisTooltip&&(t.setAttribute("data-editor-tooltip-allow-markdown","true"),t.setAttribute("data-editor-tooltip-offset-y","25"),t.setAttribute("data-editor-tooltip-placement","right"),t.setAttribute("data-editor-tooltip-common",`<div style="word-break: break-word;">${n.ellipsisTooltip}</div>`)),((e=n.states)==null?void 0:e.includes("disabled"))&&n.disableReason&&(t.setAttribute("data-editor-tooltip-maxwidth","800"),t.setAttribute("data-editor-tooltip-placement","right"),t.setAttribute("data-editor-tooltip-common",n.disableReason)),t.appendChild(i),n.subText&&B("div",["item-subtext","text"],t,n.subText),n.children&&!n.element){const o=B("div",["menu-item-sub-indicator"],null);o.innerHTML=Yp,t.appendChild(o)}if((r=n.states)!=null&&r.includes("checked")){const o=B("div",["menu-item-checked-icon"],null);o.innerHTML=eC,t.appendChild(o)}}}}class es extends a0{constructor(t,e,r){super(t,e,{autoClose:!0,disablePageScroll:!0,...r})}manualShow(t,e){const r={theme:"menu",...e};super.manualShow(t,r)}initCommandBarElement(t){z(t,"menu")}initItemElement(t,e){pP(t,e)}}function CP(n,t,e){var r;return new es((r=n.children)!=null?r:[],t,{...e,parentItem:n})}function vy(n,t,e){t.setAttribute("data-button-id",n.id),e.tooltipId&&n.name&&!n.disableTooltip&&(t.setAttribute(`data-editor-tooltip-${e.tooltipId}`,n.name),n.desc&&t.setAttribute(`data-editor-tooltip-desc-${e.tooltipId}`,n.desc));const r=t;if(!n.element)if(n.icon){const i=B("span",["toolbar-item-icon-container"],r);n.icon.trim().startsWith("<")?i.innerHTML=n.icon:i.innerText=n.icon}else{const i=B("span",["toolbar-item-name-container"],r);i.innerText=n.name}if(n.dropdown){t.setAttribute("data-dropdown","true");const i=B("span",["toolbar-item-dropdown-container"],r);i.innerHTML=Xh}n.states&&(n.states.indexOf("checked")!==-1&&z(r,"checked"),n.states.indexOf("disabled")!==-1&&(r.disabled=!0))}class Fu extends a0{constructor(t,e,r){super(t,e,{itemElementTag:"button",tippyArrow:!1,...r})}getSubBarOptions(t){var i,o;const e=()=>{const s=this.getItemElementById(t.id),c=this.content.getBoundingClientRect(),d=s.getBoundingClientRect();return new DOMRect(d.left,c.top,d.width,c.height)};return{placement:(i=t.childrenPlacement)!=null?i:"top",getReferenceClientRect:e,offset:(o=t.childrenOffset)!=null?o:[0,4]}}manualShow(t,e){const r={theme:"toolbar",...e};super.manualShow(t,r)}initCommandBarElement(t){z(t,"toolbar")}initItemElement(t,e){vy(t,e,this.options)}}function EP(n,t,e){var r;return new Fu((r=n.children)!=null?r:[],t,{...e,parentItem:n})}class AP extends al{constructor(t,e,r){super(e,void 0,r),t.appendChild(this.content),document.addEventListener("keydown",this.handleDocumentKeydown),document.addEventListener("mousedown",this.handleDocumentMouseDown)}initCommandBarElement(t){z(t,"toolbar","fixed")}initItemElement(t,e){vy(t,e,this.options)}close(){this.clearSelectedItem(),this.subBar&&(this.subBar.close("cancelBar"),this.subBar=null)}destroy(){this.content.remove(),super.destroy(),document.removeEventListener("keydown",this.handleDocumentKeydown),document.removeEventListener("mousedown",this.handleDocumentMouseDown)}getCommandBarRoot(){return this.content.parentElement}get isVisible(){return!0}}const dct="";al.registerManualCommandBar("menu",CP),al.registerManualCommandBar("toolbar",EP);const hct="",By=I("ui-base");class Ku extends a0{constructor(e,r){super(Ku.getCommandItems(e,r),void 0,{disablePageScroll:!0,...r});m(this,"handleDocumentMouseDown",e=>{})}initCommandBarElement(e){z(e,"dialog","manual")}initItemElement(e,r){}show(e,r){this.manualShow(e,{...r,theme:"light"})}get dialogContent(){const e=this.items[0];p(By,e,"no dialog item");const r=e.element;return p(By,r,"no item element"),r}static getCommandItems(e,r){var s;return[{id:(s=r==null?void 0:r.id)!=null?s:`manual-dialog-${tt()}`,name:"",element:e}]}}const mct="",xP=I("ui-base");class Ty{constructor(t){m(this,"menu");m(this,"currentText","");m(this,"handleSearchText");m(this,"handleClick",Me.default((t,e)=>{this.options.onClickItem(this,e)},300,{leading:!0,trailing:!1}));m(this,"handleShow",t=>{});m(this,"handleClose",()=>{var t,e;(e=(t=this.options).onClose)==null||e.call(t)});m(this,"handleKeydown",t=>{this.menu.handleDocumentKeydown(t)});this.options=t,this.menu=new es([],void 0,{id:t.id,header:t.header,footer:t.footer,disableSelectedScroll:t.disableSelectedScroll}),this.menu.addListener("click",this.handleClick),this.menu.addListener("close",this.handleClose),this.menu.addListener("show",this.handleShow),this.options.wait?this.handleSearchText=Me.default(async e=>{this.handleSearchTextPure(e)},this.options.wait):this.handleSearchText=this.handleSearchTextPure}setItems(t){if(this.menu.updateItems(t),t.length>0){const e=t.find(r=>r.type!=="section"&&r.type!=="separator");e&&this.menu.selectItem(e.id)}}async popup(t,e){var i,o;if(!(e!=null&&e.noEvent)&&((o=(i=this.options).onShow)==null?void 0:o.call(i,this))===!1)return;this.menu.manualShow(t),this.options.placeholder&&this.showPlaceholder();const r=await this.options.queryItems(this,"");this.highlightText("",r),this.setItems(r)}showLoading(){!this.options.showLoading||(this.options.loadingElement?this.setItems([{id:"loading",name:"",element:this.options.loadingElement,states:["disabled"]}]):this.setItems([{id:"loading",name:"loading",states:["disabled"]}]))}showPlaceholder(){this.setItems([{id:"placeholder",name:"enter text to search",states:["disabled"]}])}showNoResultMessage(t){if(this.options.noResultMessage){const e={name:"",id:"placeholder",states:["disabled"]};typeof this.options.noResultMessage=="string"?e.name=this.options.noResultMessage:(this.options.noResultMessage instanceof HTMLElement||typeof this.options.noResultMessage=="function")&&(e.element=this.options.noResultMessage),this.setItems([e])}else this.setItems([{id:"placeholder",name:this.options.emptyPlaceholder||D.t("search.emptyTips"),states:["disabled"]}])}close(){this.menu.close("cancelBar")}get isVisible(){return this.menu.isVisible}destroy(){this.menu.close("cancelBar"),this.menu.removeAllListeners(),this.menu.destroy()}isInCommandBar(t){return this.menu.isInCommandBar(t)}async handleSearchTextPure(t){this.currentText=t;const e="auto-suggest";try{await Sr.lock(e),this.showLoading();const r=this.currentText,i=await this.options.queryItems(this,t);if(this.currentText===r&&(this.currentText=""),i.length===0){this.showNoResultMessage(t);return}this.setItems(i),this.options.highlight&&this.highlightText(r.replace(/^\s+|\s+$/g,""),i)}finally{Sr.release(e)}}highlightText(t,e){xP.debug(`highlight menu text: ${t}`);const r=this.menu.content,i=(s,l)=>{if(!l)return s;let c="";const d=l.length,h=l.toLocaleLowerCase();let C=0;for(C=0;C<=s.length-d;C){let E=s.substring(C,C+d);if(E.toLocaleLowerCase()===h){C+=d;const x=s.charAt(C);let v=!1;E.endsWith(" ")&&(v=!0,E=E.trimEnd()),c+=`<span class="highlight">${E}${x===" "||v?" ":""}</span>`}else c+=s.charAt(C),C++}return C<s.length&&(c+=s.substring(C)),c},o=s=>{if(wt(s,"text")){const l=e==null?void 0:e.find(h=>h.id===s.getAttribute("data-id"));if(l&&l.element)return;const c=s.textContent;if(!c)return;const d=i(c,t);s.innerHTML=d;return}Array.from(s.children).forEach(o)};o(r)}}class cC{constructor(t,e){m(this,"root");m(this,"input");m(this,"text");m(this,"dropdownIcon");m(this,"clearIcon");m(this,"autoSuggest");m(this,"labels");m(this,"items",[]);m(this,"handleClick",()=>{this.autoSuggest.popup(this.root),this.input.focus()});m(this,"handleClickItem",(t,e)=>{var r,i;(i=(r=this.options)==null?void 0:r.onClickItem)==null||i.call(r,e)});m(this,"handleInput",()=>{this.autoSuggest.handleSearchText(this.input.value),this.updatePlaceholder()});m(this,"handleClear",t=>{var e,r;this.clear(),this.autoSuggest.handleSearchText(""),t.preventDefault(),t.stopPropagation(),(r=(e=this.options)==null?void 0:e.onClear)==null||r.call(e)});m(this,"handleQueryItems",async(t,e)=>this.items.filter(i=>{var o;return(o=this.options)!=null&&o.filter?this.options.filter(i,e):!0}));m(this,"handleShow",()=>{z(this.root,"active"),this.input.focus()});m(this,"handleClose",()=>{var t,e;(e=(t=this.options)==null?void 0:t.onClose)==null||e.call(t),ot(this.root,"active")});var c,d,h,C,E;this.options=e,this.labels=(d=(c=this.options)==null?void 0:c.labels)!=null?d:[];const{root:r,input:i,text:o,clearIcon:s,dropdownIcon:l}=cC.createDropdown(t,this.labels);this.root=r,this.input=i,this.text=o,this.clearIcon=s,this.dropdownIcon=l,this.autoSuggest=new Ty({id:(e==null?void 0:e.popupId)||"dropdown-auto-suggest",header:(h=this.options)==null?void 0:h.header,onClickItem:this.handleClickItem,queryItems:this.handleQueryItems,onClose:this.handleClose,onShow:this.handleShow,highlight:e==null?void 0:e.highlight,emptyPlaceholder:e==null?void 0:e.emptyPlaceholder,disableSelectedScroll:e==null?void 0:e.disableSelectedScroll}),this.items=(E=(C=this.options)==null?void 0:C.items)!=null?E:[],this.root.addEventListener("click",this.handleClick),this.input.addEventListener("input",this.handleInput),this.clearIcon.addEventListener("click",this.handleClear)}close(){this.autoSuggest.close()}destroy(){this.input.removeEventListener("input",this.handleInput),this.root.removeEventListener("click",this.handleClick),this.clearIcon.removeEventListener("click",this.handleClear),this.autoSuggest.destroy()}updateItems(t){this.items=t,this.autoSuggest.handleSearchText("")}setText(t){this.text.innerText=t,this.input.value=t,this.updatePlaceholder()}clear(){this.setText(""),this.setLabels([])}setLabels(t){this.labels=t,this.updateLabels()}static createDropdown(t,e){const r=B("div",["editor-dropdown","empty"],t),i=B("input",["dropdown-input"],r),o=B("div",["dropdown-text"],r),s=B("div",["dropdown-labels"],r);for(let d=0;d<e.length;d+=1){const h=e[d];B("span",["dropdown-label"],s,h)}const l=B("div",["dropdown-clear-icon"],r);l.innerHTML=ty;const c=B("div",["dropdown-icon"],r);return c.innerHTML=Xh,{root:r,input:i,text:o,clearIcon:l,dropdownIcon:c}}updateLabels(){const t=this.root.querySelector(".dropdown-labels");if(t){t.innerHTML="";for(let e=0;e<this.labels.length;e+=1){const r=this.labels[e];B("span",["dropdown-label"],t,r)}}}updatePlaceholder(){var t;if(this.input.value===""){const e=(t=this.options)==null?void 0:t.placeholder;e&&(this.input.placeholder=e,this.text.textContent=e),z(this.root,"empty")}else ot(this.root,"empty")}}const bP=[-1,6,0,1,2,3,4,5],vP=[-1,6,0,1,2,3,4,5,14,13,7,8,9,10,11,12],yy=I("color-palette");function ky(n,t,e,r){p(yy,n>0,"no color in palette");const i=t||1;p(yy,i>0,`invalid palette rows: ${i}`);const o=n/i,s=B("div",["palette-container",r],null);for(let l=0;l<i;l++){const c=B("div",["palette-container-row"],s);for(let d=0;d<o;d++){const h=e(l*o+d);c.appendChild(h)}}return s}function BP(n){const t=B("button",["color-button"],null),e=bP[n];return t.setAttribute("data-color-index",`${e}`),t.innerHTML=Xp,t}function TP(n){const t=B("button",["background-color-button"],null),e=vP[n];return t.setAttribute("data-color-index",`${e}`),t}function yP(){const n=B("div",["clear-button-container"],null),t=B("button",["clear-button"],n);return t.innerText=D.t("colorPalette.reset"),n}function kP(n){const t=B("div",["color-palette"],null);return n.color!==!1&&(B("div",["bar-desc"],t,D.t("colorPalette.colorDesc")),t.appendChild(ky(8,1,BP,"color"))),n.backgroundColor!==!1&&(B("div",["bar-desc"],t,D.t("colorPalette.backgroundDesc")),t.appendChild(ky(16,2,TP,"background-color"))),n.clearColorButton!==!1&&t.appendChild(yP()),t}function RP(n,t,e){const r=t==="color"?"color":"background-color",i=n.querySelector(`.${r} button.selected`);i&&ot(i,"selected"),e===null&&(e=-1);const o=n.querySelector(`.${r} button[data-color-index="${e}"]`);o&&z(o,"selected")}const gct="",wP={};class SP extends Be.TypedEmitter{constructor(e=wP){super();m(this,"root");m(this,"handleClick",e=>{const r=e.target;if(!r||!(r instanceof Element))return;const i=r.closest("button");if(!i)return;if(wt(i,"clear-button")){this.setColor("backgroundColor",null),this.setColor("color",null),this.emit("onClick","clearColor",0);return}const o=i.getAttribute("data-color-index");if(!o)return;const s=Number.parseInt(o,10);Number.isNaN(s)||(wt(i,"color-button")?s===-1?(this.setColor("color",null),this.emit("onClick","clearColor",1)):(this.setColor("color",s),this.emit("onClick","color",s)):s===-1?(this.setColor("backgroundColor",null),this.emit("onClick","clearColor",2)):(this.setColor("backgroundColor",s),this.emit("onClick","backgroundColor",s)))});this.options=e,this.root=kP(e),this.root.addEventListener("click",this.handleClick)}destroy(){this.removeAllListeners(),this.root.removeEventListener("click",this.handleClick)}setColor(e,r){RP(this.root,e,r)}}class Ry{constructor(t,e){m(this,"name","Color Palette");m(this,"element");m(this,"palette");m(this,"closeable",null);this.id=t,this.palette=new SP(e),this.element=this.palette.root}setCloseable(t){this.closeable=t}destroy(){this.palette.destroy(),this.closeable=null}}function LP(){const n=B("button",["color-button"],null);return n.innerHTML=Xp,n}function uC(n,t){const[e,r]=t;e===null?n.removeAttribute("data-color"):n.setAttribute("data-color",`${e}`),r===null?n.removeAttribute("data-background-color"):n.setAttribute("data-background-color",`${r}`)}class wy extends Be.TypedEmitter{constructor(e){super();m(this,"id","text-color-item");m(this,"name",D.t("colorPalette.name"));m(this,"dropdown",!0);m(this,"manualShowChildren",!0);m(this,"children",[]);m(this,"element");m(this,"colorPaletteItem");m(this,"latestColors",[null,null]);m(this,"handlePaletteClick",(e,r)=>{this.emit("onClick",e,r)});m(this,"setLatestColors",(e,r)=>{e==="color"||e==="backgroundColor"?e==="color"?this.latestColors[0]=r:this.latestColors[1]=r:this.latestColors=[null,null],uC(this.element,this.latestColors)});m(this,"beforePopup",()=>{this.updatePaletteColor(this.latestColors),this.emit("beforePopup")});this.editor=e,this.colorPaletteItem=new Ry("text-color-palette-item"),this.colorPaletteItem.palette.addListener("onClick",this.handlePaletteClick),this.children.push(this.colorPaletteItem),this.element=LP()}destroy(){this.colorPaletteItem.destroy()}updatePaletteColor(e){this.colorPaletteItem.palette.setColor("color",e[0]),this.colorPaletteItem.palette.setColor("backgroundColor",e[1]),this.latestColors=e,uC(this.element,this.latestColors)}updateButtonColor(e){this.latestColors=e,uC(this.element,this.latestColors)}}const pct="";function c0(n,t){const e=B("div",["editor-input-wrap"],n);if(t!=null&&t.className&&z(e,t==null?void 0:t.className),t.label){const s=B("div",["editor-input-label"],e);B("span",[],s,t.label),t.required&&z(s,"required")}const r=B("div",["editor-input-container"],e),i=B("input",["editor-input"],null);if(t.placeholder&&(i.placeholder=t.placeholder),t.defaultValue&&(i.value=t.defaultValue),t.maxLength&&(i.maxLength=t.maxLength),t.maxLength){const s=B("div",["editor-input-suffix"],r);B("span",[],s,`${i.value.length} / ${t.maxLength}`),i.addEventListener("input",l=>{const c=l.target;s.innerText=`${c.value.length} / ${t.maxLength}`})}r.appendChild(i);const o=B("div",["editor-input-error"],e);return i.addEventListener("input",s=>{var l;(l=t.onChange)==null||l.call(t,s),ot(e,"error")}),i.addEventListener("keydown",s=>{var l;(l=t.onKeyDown)==null||l.call(t,s)}),{getField:()=>i,getInputValue:()=>i.value,setFieldError:s=>{z(e,"error"),o.innerText=s},focus:()=>{setTimeout(()=>{i.focus()})}}}function fC(n){const t=document.getSelection();if(!t)return!0;const e=t.focusNode;if(!e)return!0;const r=t.focusOffset,i=e.childNodes[r];if(!i)return!0;if(i instanceof HTMLElement){const o=i.tagName.toLowerCase();if(i===n.input.inputElement)return!0;if(o==="input"||o==="textarea")return!1}return!0}class IP extends Ty{constructor(e,r){super(r);m(this,"handleClose",()=>{var e,r;fC(this.editor)&&this.editor.focus(),(r=(e=this.options).onClose)==null||r.call(e)});this.editor=e,this.editorOptions=r}async popupInEditor(e,r,i){var d,h;if(((h=(d=this.editorOptions).onShow)==null?void 0:h.call(d,this,e,r,i))===!1)return;this.options.showLoading&&this.showLoading();const o=this.editor.getBlockByIndex(e,r);if(!re(this.editor.rootContainer,o)||dt(this.editor,o)<i)return;const s=Wi(this.editor,o,ye(this.editor,o,i));if(s.length===0)return;const l=s[0],c=Yi(this.editor,o,"editor-auto-suggest-menu",l);super.popup(c,{noEvent:!0})}}const dC=I("auto-suggest-menu");class hC{constructor(t,e){m(this,"order",100);m(this,"menu");m(this,"anchor",null);m(this,"close",()=>{this.menu.close()});m(this,"handleSelectionChanged",t=>{var r,i;if(!((r=this.menu)!=null&&r.isVisible))return;const e=t.selection.range.start;if(e.isSimple()&&e.blockId===((i=this.anchor)==null?void 0:i.blockId)&&e.offset>=this.anchor.offset){const o=t.getBlockById(e.blockId);if(de(Dn(Bn(t,o),e.offset).left).startsWith(this.anchor.leftText))return}this.menu.close()});m(this,"deleteTrigger",()=>{const t=this.editor,e=t.selection.range.start;if(!e.isSimple()||!this.anchor)return!1;const{blockId:r,offset:i}=e,o=t.getBlockById(r),s=de(Ch(t,o,i));if(p(dC,this.anchor,"no anchor"),!s.startsWith(this.anchor.leftText))return!1;const l=this.anchor.offset-this.anchor.trigger.length,c=i-l;return t.selection.selectBlock(o,l),c&&(t.deleteTextFromBlock(o,l,c),this.anchor.offset-=this.anchor.trigger.length),this.anchor.trigger.length||this.menu.close(),!0});m(this,"onClose",()=>{var t,e;(e=(t=this.options).onClose)==null||e.call(t)});m(this,"onShow",(t,e,r,i)=>{var o;if((o=this.options)!=null&&o.onShow)return this.options.onShow(this,e,r,i)});m(this,"onClickItem",(t,e)=>{!this.anchor||(this.options.autoDeleteTrigger&&this.deleteTrigger(),this.options.onClickItem(this,e,this.anchor))});m(this,"queryItems",(t,e)=>this.options.queryItems(this,e));m(this,"renderMenuItem",(t,e)=>{var i,o;return(o=(i=this.options).renderMenuItem)==null?void 0:o.call(i,this,e)});m(this,"hasExistsMenuThemeCommandBar",()=>!!document.querySelector('div.tippy-box[data-theme="menu"]'));this.editor=t,this.options=e,this.menu=new IP(t,{id:e.id,showLoading:e.showLoading,loadingElement:e.loadingElement,placeholder:e.placeholder,header:e.header,footer:e.footer,wait:e.wait,noResultMessage:e.noResultMessage,highlight:e.highlight,onClose:this.onClose,onShow:this.onShow,onClickItem:this.onClickItem,queryItems:this.queryItems,renderMenuItem:this.renderMenuItem}),t.input.addHandler(this),t.addListener("selectionChanged",this.handleSelectionChanged)}handleBeforeKeyDown(t,e){var r;return!((r=this.menu)!=null&&r.isVisible)||Ng(e.key)?!1:rv(e)&&!Ks(e)?(setTimeout(()=>{this.resetItems()}),!1):Pg(e)?(this.menu.close(),!0):(this.menu.handleKeydown(e),!0)}popup(t,e,r,i){this.anchor={blockId:lt(t),offset:e,leftText:r,trigger:i};const o=ut(it(t)),s=Bt(t);this.menu.popupInEditor(o,s,e)}handleAfterInsertText(t,e,r,i,o){var h,C;const s=t.selection.range.start;if(!s.isSimple())return!1;const l=t.getBlockByIndex(e,r);if(zi(l))return!1;const{blockId:c,offset:d}=s;if(lt(l)!==c)return!1;if((h=this.menu)!=null&&h.isVisible)this.resetItems();else if(this.options.trigger.indexOf(o)!==-1){if(i>0&&this.options.needSpaceBeforeTrigger&&(((C=t.getBlockData(l).text)==null?void 0:C.reduce((R,L)=>R+L.insert,""))||"")[i-1].trim().length!==0||this.hasExistsMenuThemeCommandBar())return!1;const E=de(Ch(t,l,d));this.popup(l,d,E,o)}return!1}handleUpdateCompositionText(t,e,r,i,o){var d;const s=t.selection.range.start;if(!s.isSimple())return!1;const{blockId:l}=s,c=t.getBlockByIndex(e,r);return lt(c)!==l||(d=this.menu)!=null&&d.isVisible&&this.resetItems(),!1}resetItems(){var l;if(!((l=this.menu)!=null&&l.isVisible))return;const t=this.editor,e=t.selection.range.start;if(!e.isSimple())return;const{blockId:r,offset:i}=e,o=t.getBlockById(r),s=de(Ch(t,o,i));if(p(dC,this.anchor,"no anchor"),s.startsWith(this.anchor.leftText)){const c=s.substring(this.anchor.leftText.length);dC.debug(`search text: ${c}`),this.menu.handleSearchText(c)}}destroy(){var t;this.editor.input.removeHandler(this),this.editor.removeListener("selectionChanged",this.handleSelectionChanged),(t=this.menu)==null||t.destroy()}}function DP(){const n={};for(let t=1;t<=8;t++)n[`heading-${t}`]={shortcut:`/h${t}`};return n}const _P={"insert-hr":{shortcut:"/hr"},"insert-uml":{shortcut:"/uml"},"insert-table":{shortcut:"/table"},"insert-image":{shortcut:"/image"},"insert-code":{shortcut:"/code"},"insert-link":{shortcut:"/link"},"insert-drawio":{shortcut:"/uml"},"insert-video":{shortcut:"/video"},"insert-audio":{shortcut:"/audio"},"insert-math":{shortcut:"/math"},"insert-webPage":{shortcut:"/web"},"insert-bilibili":{shortcut:"/bilibili"},"insert-youku":{shortcut:"/youku"},"insert-figma":{shortcut:"/figma"},"insert-modao":{shortcut:"/modao"},"insert-tencent":{shortcut:"/tencent"},"insert-unordered":{shortcut:"/bl"},"insert-ordered":{shortcut:"/nu"},"insert-checkbox":{shortcut:"/todo"},"insert-quote":{shortcut:"/quote"},...DP()};function Tn(n){var t;return(t=_P[n])==null?void 0:t.shortcut}function MP(n){var t;return(t=n.subText)!=null?t:""}const xi=I("table-dom");function bi(n){return`${lt(n)}_scroll`}function Ve(n){const t=n.querySelector("div[data-type=table-content] >table");return p(xi,t instanceof HTMLTableElement,"invalid table"),t}function vi(n,t){const r=n.getCustom(bi(t)).contentElement.firstElementChild;p(xi,r instanceof HTMLElement,"invalid table content");let i=r.querySelector(":scope >div[data-type=table-tools]");return i||(i=B("div",[],r),i.setAttribute("data-type","table-tools"),n.domEvents.addEventListener(i,"dblclick",(o,s)=>s.stopPropagation()),n.domEvents.addEventListener(i,"click",(o,s)=>{s.detail===3&&s.stopPropagation()})),p(xi,i,"no table tools"),i}function UP(n,t){return n.findCustom(bi(t))?vi(n,t):null}function Sy(n){const t=[];return Array.from(n.rows).forEach(e=>{t.push(...Array.from(e.cells))}),t}function Vu(n){const t=n.querySelector(":scope div[data-type=editor-container]");return p(xi,t,"no child container in cell"),t}function OP(n){const r=Sy(n).map(i=>{const o=Vu(i),s=ut(o),l=i.colSpan,c=i.rowSpan;return`${s}/${l}/${c}`}).join();return wd.default(r)}function $e(n){return Dt(n)==="table"}function mC(n){const t=it(n);if(Xt(t))return null;const e=J(t);return p(xi,e,"no parent block"),$e(e)?t:mC(e)}function uo(n){if($e(n))return n;const t=it(n);if(Xt(t))return null;const e=J(t);return p(xi,e,"no parent block"),$e(e)?e:uo(e)}function NP(n,t){const e=n.querySelector("colgroup");p(xi,e,"no colgroup");const r=e.children[t];return p(xi,r,"no col"),p(xi,r instanceof HTMLTableColElement,`invalid col: ${r.tagName}`),r}function Ly(n){try{return Ve(n),!0}catch{return!1}}function PP(n){return ie(n).querySelector(":scope > .block-helper")}function Iy(n){const t=J(n.contentElement);p(xi,t,"no block");const e=PP(t);if(e){const o=Math.min(n.contentElement.offsetLeft+29,n.rootElement.scrollLeft),s=t.getBoundingClientRect().width;e.style.right=`${o+s+5}px`}}const zr=I("doc-table-grid");class FP{constructor(t){m(this,"_cells",[]);for(let e=0;e<t;e++)this._cells.push(void 0)}cols(){return this._cells.length}setCell(t,e){p(zr,t>=0&&t<this.cols(),`set cell, invalid col: ${t}`),this._cells[t]=e}getCell(t){p(zr,t>=0&&t<this.cols(),`get cell, invalid col: ${t}`);const e=this._cells[t];return p(zr,e,"get cell, no cell"),e}getCellAllowEmpty(t){return p(zr,t>=0&&t<this.cols(),`get cell, invalid col, ${t}`),this._cells[t]}getNextNonVirtualCell(t){return this._cells.slice(t+1).find(e=>!e.virtual)}forEach(t){this._cells.forEach(t)}}class u0{constructor(t){m(this,"_data");m(this,"_rows");this._data=t,this._rows=[];for(let e=0;e<this.rowCount;e++)this._rows.push(new FP(this.colCount));this.fillGrid()}get rowCount(){return this._data.rows}get colCount(){return this._data.cols}getNextEmptyCell(t,e){let r=t,i=e;for(;;){if(r+=1,r===this.colCount&&(r=0,i+=1),i>=this.rowCount)return null;if(this._rows[i].getCellAllowEmpty(r)===void 0)return{col:r,row:i}}}fillGrid(){const t=this._data.children;p(zr,t,"no children");let e=0,r=0;t.forEach((i,o)=>{const s=this._data[`${i}_colSpan`]||1,l=this._data[`${i}_rowSpan`]||1;for(let d=0;d<l;d++)for(let h=0;h<s;h++)this._rows[r+d].setCell(e+h,{col:e,row:r,containerId:i,virtual:h!==0||d!==0,colSpan:s,rowSpan:l});const c=this.getNextEmptyCell(e,r);c?(e=c.col,r=c.row):p(zr,o===t.length-1,`invalid table data, no next empty cell: ${JSON.stringify(this._data)}`)}),this._rows.forEach(i=>{i.forEach(o=>{p(zr,o,"no cell"),p(zr,o.containerId,"no containerId")})})}getCell(t){const{col:e,row:r}=t,i=this._rows[r];p(zr,i,`get cell, no row: ${r}`);const o=i.getCell(e);return p(zr,o,`get cell, no cell: ${e}`),o}getRow(t){const e=this._rows[t];return p(zr,e,`get row, no row: ${t}`),e}forEach(t){this._rows.forEach(t)}}const f0=I("table-data");function KP(n){const t=n.firstElementChild;return p(f0,t,"no child element for cell"),p(f0,Gi(t),"cell first child is not a container"),p(f0,Mr(t),"cell first child is not a container"),t}function VP(n){const t=J(n);p(f0,t,"no parent block for table");const e=[],r={};Array.from(n.rows).forEach(l=>{Array.from(l.cells).forEach(c=>{const d=KP(c),h=ut(d);e.push(h),(c.colSpan>1||c.rowSpan>1)&&(r[`${h}_colSpan`]=c.colSpan,r[`${h}_rowSpan`]=c.rowSpan)})});const i=n.rows.length,o=Array.from(n.rows[0].cells).map(l=>l.colSpan).reduce((l,c)=>l+c,0);return{id:lt(t),type:Dt(t),rows:i,cols:o,children:e,colsWidth:Array(o).fill(100),...r}}function cl(n){return new u0(n)}function $P(n){return cl(VP(n))}const Qe=I("table-grid"),HP=60;class jP{constructor(t,e){m(this,"containerId");m(this,"row");m(this,"col");m(this,"colSpan");m(this,"rowSpan");m(this,"virtual");m(this,"table");this.table=t,this.containerId=e.containerId,this.row=e.row,this.col=e.col,this.colSpan=e.colSpan,this.rowSpan=e.rowSpan,this.virtual=e.virtual}get cell(){const e=this.container.closest("td");return p(Qe,e,"no parent cell for child container"),e}get container(){const t=this.table.querySelectorAll(`[data-container-id=${this.containerId}]`);p(Qe,t.length===1,"containers !== 1"),p(Qe,Gi(t[0]),"not a container");const e=t[0];return p(Qe,Mr(e),"not a child container"),e}}class zP{constructor(t,e){m(this,"_cells",[]);e.forEach(r=>{this._cells.push(new jP(t,r))})}get cells(){return this._cells}getCell(t){return p(Qe,t<this._cells.length,"get cell, invalid col"),this._cells[t]}getNextNonVirtualCell(t){return this._cells.slice(t+1).find(e=>!e.virtual)}getSpannedCell(){return this._cells.find(t=>t.virtual||t.colSpan>1||t.rowSpan>1)}}const SA=class{constructor(t){m(this,"_rows",[]);this.table=t,$P(t).forEach(i=>{this._rows.push(new zP(t,i))});const r=this.colCount;this._rows.forEach(i=>{p(Qe,i.cells.length===r,"row.cells.length !== colCount")})}get rowCount(){return this._rows.length}get colCount(){return this._rows.length===0?0:(p(Qe,this.rowCount>0,"rowCount <= 0"),this.getRow(0).cells.length)}getRow(t){return this._rows[t]}getCell(t){const e=this.getRow(t.row);return p(Qe,e,"no row"),e.getCell(t.col)}getCellContainer(t){return this.getCell(t).container}getFirstCellContainer(){return this.getCellContainer({row:0,col:0})}getLastCellContainer(){const t=this.rowCount-1,e=this.colCount-1;return this.getCellContainer({row:t,col:e})}getColumnCells(t){p(Qe,t>=0&&t<this.colCount,"colIndex out of range");const e=this.rowCount,r=[];for(let i=0;i<e;i++){const o=this.getCell({row:i,col:t});r.push(o)}return r}toRealCells(t){const e=[];return t.forEach(r=>{const i=this.getRealCell(r);e.findIndex(o=>o.containerId===i.containerId)===-1&&e.push(i)}),e}getColumnRealCells(t){const e=this.getColumnCells(t);return this.toRealCells(e)}getRowRealCells(t){const e=this.getRow(t).cells;return this.toRealCells(e)}getFirstSpannedCell(t){p(Qe,t>=0&&t<this.colCount,"colIndex out of range");const e=this.rowCount;for(let r=0;r<e;r++){const i=this.getCell({row:r,col:t});if(i.virtual||i.colSpan>1||i.rowSpan>1)return i}}getRealCell(t){const e=this.getCell(t);if(!e.virtual)return e;const r=this.getCellById(e.containerId);return p(Qe,!r.virtual,"found a virtual cell"),r}getColumnSpannedRange(t){const e=this.getColumnRealCells(t);let r=1e5,i=-1;return e.forEach(o=>{r=Math.min(o.col,r),i=Math.max(o.col+o.colSpan-1,i)}),p(Qe,r<=i,"min > max"),p(Qe,r>=0,"min < 0"),p(Qe,i<this.colCount,"max >= colCount"),[r,i]}getRowSpannedRange(t){const e=this.getRowRealCells(t);let r=1e5,i=-1;return e.forEach(o=>{r=Math.min(o.row,r),i=Math.max(o.row+o.rowSpan-1,i)}),p(Qe,r<=i,"min > max"),p(Qe,r>=0,"min < 0"),p(Qe,i<this.rowCount,"max >= rowCount"),[r,i]}getSpannedRange(t,e){const r=Math.min(t.row,e.row),i=Math.max(t.row,e.row),o=Math.min(t.col,e.col),s=Math.max(t.col,e.col),l=[];for(let x=r;x<=i;x++)for(let v=o;v<=s;v++)l.push(this.getCell({row:x,col:v}));const c=this.toRealCells(l);let d=1e4,h=1e4,C=-1,E=-1;return c.forEach(x=>{h=Math.min(x.col,h),d=Math.min(x.row,d),E=Math.max(x.col+x.colSpan-1,E),C=Math.max(x.row+x.rowSpan-1,C)}),[{row:d,col:h},{row:C,col:E}]}getAllCells(){return this.getCells({col:0,row:0},{col:this.colCount-1,row:this.rowCount-1})}sub(t,e){const r=[];for(let i=t.row;i<=e.row;i++){const o=[];for(let s=t.col;s<=e.col;s++){const l=this.getCell({row:i,col:s});o.push(l)}r.push(o)}return r}getAllContainers(){return this.getAllCells().map(e=>e.container)}getCells(t,e){const r=[],i=this.getSpannedRange(t,e),o=i[0],s=i[1],l=Math.min(o.row,s.row),c=Math.max(o.row,s.row),d=Math.min(o.col,s.col),h=Math.max(o.col,s.col);for(let C=l;C<=c;C++)for(let E=d;E<=h;E++){const x=this.getCell({row:C,col:E});x.virtual||r.push(x)}return r}map(t){const e=[];for(let r=0;r<this.rowCount;r++){const i=[];for(let o=0;o<this.colCount;o++){const s=this.getCell({row:r,col:o});i.push(t(s))}e.push(i)}return e}getBottomCell(t){const e=this.rowCount;let r=t,i=t.row;for(;r.containerId===t.containerId;){if(i+=1,i>=e)return null;r=this.getCell({row:i,col:t.col})}return this.getRealCell(r)}getTopCell(t){let e=t,r=t.row;for(;e.containerId===t.containerId;){if(r-=1,r<0)return null;e=this.getCell({row:r,col:t.col})}return this.getRealCell(e)}get cells(){let t=[];return this._rows.forEach(e=>{t=t.concat(e.cells)}),t}getVirtualCellContainersGrid(){return this.map(t=>t.containerId)}static virtualCellContainersGridToChildren(t){const e=t,r=[];return e.forEach(i=>{i.forEach(o=>{r.indexOf(o)===-1&&r.push(o)})}),r}getCellById(t){const r=this.cells.find(i=>i.containerId===t);return p(Qe,r,"cell not found"),r}getCellByCellElement(t){const e=Vu(t);return this.getCellByContainerId(ut(e))}getCellByContainerId(t){return this.getCellById(t)}static fromTable(t){const e=OP(t),r=this.caches.getSync(e,()=>(Qe.debug("create table grid"),new SA(t)));return r.table!==t?(this.caches.delete(e),this.fromTable(t)):r}static fromBlock(t){return this.fromTable(Ve(t))}};let It=SA;m(It,"caches",new Pb(HP));function d0(n,t){Object.entries(n).forEach(([e])=>{e.startsWith(`${t}/`)&&delete n[e]})}const GP=I("table-selection-range");function Gr(n,t,e){var U,F,G,W;const r=It.fromBlock(n),i=t,o=e,s=r.getCellByContainerId(i.childContainerId),l=r.getCellByContainerId(o.childContainerId),c=i.custom,d=o.custom,h=(U=c==null?void 0:c.rowIndex)!=null?U:s.row,C=(F=c==null?void 0:c.colIndex)!=null?F:s.col,E=(G=d==null?void 0:d.rowIndex)!=null?G:l.row+l.rowSpan-1,x=(W=d==null?void 0:d.colIndex)!=null?W:l.col+l.colSpan-1,v=Math.min(h,E),R=Math.max(h,E),L=Math.min(C,x),M=Math.max(C,x);return{fromRow:v,toRow:R,fromCol:L,toCol:M}}function gC(n,t){const e=new Set,r=new Set,i=n.selection.range;if(!i.isSimple()&&i.start.blockId===lt(t)){const o=It.fromBlock(t),{start:s,end:l}=i;p(GP,!s.isSimple()&&!l.isSimple(),"invalid range");const{fromCol:c,toCol:d,fromRow:h,toRow:C}=Gr(t,s,l);if(h===0&&C===o.rowCount-1)for(let E=c;E<=d;E++)r.add(E);if(c===0&&d===o.colCount-1)for(let E=h;E<=C;E++)e.add(E)}return{selectedRows:e,selectedColumns:r}}function $u(n,t){let e=null;if(t.isCollapsed()&&t.isSimple()){const r=n.getBlockById(t.start.blockId);if($e(r)){const i=it(r),o=J(i);o&&(e=uo(o))}else e=uo(r)}else{const r=n.getBlockById(t.start.blockId),i=uo(r),o=n.getBlockById(t.end.blockId),s=uo(o);i===s&&(e=i)}return e}const Ha=I("delete-columns");function Dy(n,t,e){const{start:r,end:i}=e;if(r.blockId!==i.blockId||e.isSimple()||n.getBlockById(r.blockId)!==t||Dt(t)!=="table")return!1;const{fromRow:s,toRow:l}=Gr(t,e.start,e.end),c=It.fromBlock(t);return s===0&&l===c.rowCount-1}function pC(n){const t=n.getEditor();t.undoManager.runInGroup(()=>{var F,G;const e=t.getBlockById(n.start.blockId);if(!Dy(t,e,n))return;if(n.isSimple()){t.deleteBlock(e);return}const{fromCol:r,toCol:i}=Gr(e,n.start,n.end),o=It.fromBlock(e);if(r===0&&i===o.colCount-1){t.deleteBlock(e);return}const s=new Set,l=o.map(W=>W.containerId);for(let W=0;W<l.length;W++){const rt=l[W];for(let st=r;st<=i;st++){const Et=rt[st];s.add(Et)}rt.splice(r,i-r+1)}const c=new Set(l.flat()),d=new Set(Array.from(s).filter(W=>!c.has(W))),h=i-r+1,C=new Map,E=new Map;s.forEach(W=>{if(d.has(W))return;const rt=o.getCellByContainerId(W);if(p(Ha,rt.colSpan>1,"invalid effected cell, colSpan === 1"),rt.col<r){p(Ha,c.has(W),"invalid effected cell, not exists");let Yt=rt.col+rt.colSpan-1;Yt>i&&(Yt=i);const an=Yt-r+1,be=rt.colSpan-an;C.set(W,be);return}p(Ha,rt.col<=i,"invalid effected cell, col > endCol");const st=rt.col,Et=rt.col+rt.colSpan-1,vt=rt.col-r,xt=Et-st+1-h+vt;p(Ha,xt>0,"invalid effected cell, newSpanned <= 0");const Gt=no(t.doc);E.set(W,{newContainerId:Gt,colSpan:xt})});for(let W=0;W<l.length;W++){const rt=l[W];for(let st=r;st<rt.length;st++){const Et=rt[st],vt=E.get(Et);vt&&(rt[st]=vt.newContainerId)}}const x=mt.default(t.getBlockData(e));((F=x.colsWidth)!=null?F:new Array(x.cols).fill(0)).splice(r,i-r+1),d.forEach(W=>{d0(x,W)}),C.forEach((W,rt)=>{p(Ha,W>=1,"invalid modified colSpan, colSpan < 1"),W===1?x[`${rt}_colSpan`]=void 0:x[`${rt}_colSpan`]=W}),E.forEach((W,rt)=>{d0(x,rt);const{newContainerId:st,colSpan:Et}=W;p(Ha,Et>=1,"invalid newContainerData, colSpan < 1"),Et>1&&(x[`${st}_colSpan`]=Et);const vt=o.getCellByContainerId(rt).rowSpan;vt>1&&(x[`${st}_rowSpan`]=vt)});const R=(G=l[0][r])!=null?G:l[0][r-1],L=t.getChildContainerData(R)[0],M=It.virtualCellContainersGridToChildren(l),U={...x,cols:x.cols-h,children:M};cl(U),t.updateBlockData(e,U,ye(t,L.id,0)),t.deleteChildContainers(Array.from(d)),t.deleteChildContainers(Array.from(E.keys()))})}const ja=I("delete-rows");function _y(n,t,e){const{start:r,end:i}=e;if(r.blockId!==i.blockId||e.isSimple()||n.getBlockById(r.blockId)!==t||Dt(t)!=="table")return!1;const{fromCol:s,toCol:l}=Gr(t,e.start,e.end),c=It.fromBlock(t);return s===0&&l===c.colCount-1}function CC(n){const t=n.getEditor();t.undoManager.runInGroup(()=>{const e=t.getBlockById(n.start.blockId);if(!_y(t,e,n))return;if(n.isSimple()){t.deleteBlock(e);return}const{fromRow:r,toRow:i}=Gr(e,n.start,n.end),o=It.fromBlock(e);if(r===0&&i===o.rowCount-1){t.deleteBlock(e);return}const s=new Set,l=o.map(U=>U.containerId);for(let U=i;U>=r;U--)l[U].forEach(G=>s.add(G)),l.splice(U,1);const c=new Set(l.flat()),d=new Set(Array.from(s).filter(U=>!c.has(U))),h=i-r+1,C=new Map,E=new Map;s.forEach(U=>{if(d.has(U))return;const F=o.getCellByContainerId(U);if(p(ja,F.rowSpan>1,"invalid effected cell, rowSpan === 1"),F.row<r){p(ja,c.has(U),"invalid effected cell, not exists");let vt=F.row+F.rowSpan-1;vt>i&&(vt=i);const xt=vt-r+1,Gt=F.rowSpan-xt;C.set(U,Gt);return}p(ja,F.row<=i,"invalid effected cell, col > endCol");const G=F.row,W=F.row+F.rowSpan-1,rt=F.row-r,st=W-G+1-h+rt;p(ja,st>0,"invalid effected cell, newSpanned <= 0");const Et=no(t.doc);E.set(U,{newContainerId:Et,rowSpan:st})});for(let U=r;U<l.length;U++){const F=l[U];for(let G=0;G<F.length;G++){const W=F[G],rt=E.get(W);rt&&(F[G]=rt.newContainerId)}}const x=mt.default(t.getBlockData(e));d.forEach(U=>{d0(x,U)}),C.forEach((U,F)=>{p(ja,U>=1,"invalid modified rowSpan, rowSpan < 1"),U===1?x[`${F}_rowSpan`]=void 0:x[`${F}_rowSpan`]=U}),E.forEach((U,F)=>{d0(x,F);const{newContainerId:G,rowSpan:W}=U;p(ja,W>=1,"invalid newContainerData, rowSpan < 1"),W>1&&(x[`${G}_rowSpan`]=W);const rt=o.getCellByContainerId(F).colSpan;rt>1&&(x[`${G}_colSpan`]=rt)});const v=l[r]?l[r][0]:l[r-1][0],R=t.getChildContainerData(v)[0],L=It.virtualCellContainersGridToChildren(l),M={...x,rows:x.rows-h,children:L};cl(M),t.updateBlockData(e,M,ye(t,R.id,0)),t.deleteChildContainers(Array.from(d)),t.deleteChildContainers(Array.from(E.keys()))})}const Hu=I("table-range");function h0(n){p(Hu,!n.isSimple(),"must be complex selection range");const{anchor:t,focus:e}=n;p(Hu,!t.isSimple(),"invalid start pos type"),p(Hu,!e.isSimple(),"invalid end pos type");const r=n.getEditor();p(Hu,t.blockId===e.blockId,"invalid range, not same block");const i=r.getBlockById(t.blockId);p(Hu,Dt(i)==="table","invalid block type, not a table block");const o=Ve(i),s=It.fromTable(o),l=s.getCellByContainerId(t.childContainerId),c=s.getCellByContainerId(e.childContainerId),d=Math.min(l.row,c.row),h=Math.max(l.row,c.row),C=Math.min(l.col,c.col),E=Math.max(l.col,c.col),x=s.getCell({row:d,col:C}),v=s.getCell({row:h,col:E});return{editor:r,block:i,table:o,startCell:x,endCell:v,startRow:d,startCol:C,endRow:h,endCol:E}}const EC=I("split-cell");function AC(n,t,e){n.undoManager.runInGroup(()=>{const r=It.fromBlock(t),i=r.getRealCell(e);p(EC,!i.virtual,"should not split virtual cell"),p(EC,i.colSpan>1||i.rowSpan>1,"cell does not has span data");const o=r.getVirtualCellContainersGrid();for(let C=0;C<i.rowSpan;C++)for(let E=0;E<i.colSpan;E++){if(C===0&&E===0)continue;const x=C+i.row,v=E+i.col,R=no(n.doc);o[x][v]=R}const s=n.getBlockData(t),l=mt.default(s);l[`${i.containerId}_colSpan`]=null,l[`${i.containerId}_rowSpan`]=null,l.children=It.virtualCellContainersGridToChildren(o);const d=n.getChildContainerData(i.containerId)[0];p(EC,d,"no child block");const h=ye(n,d.id,0);cl(l),n.updateBlockData(t,l,h)})}function WP(n,t,e){e.forEach(r=>{const i=It.fromBlock(t).getCell(r);(i.virtual||i.colSpan>1||i.rowSpan>1)&&AC(n,t,r)})}function My(n,t,e){if(e.isSimple())return!1;const{start:r,end:i}=e;if(r.blockId!==i.blockId||n.getBlockById(r.blockId)!==t||Dt(t)!=="table")return!1;const{startCell:s,endCell:l}=h0(e);return!(s.cell!==l.cell||s.colSpan===1&&s.rowSpan===1)}function xC(n){const{editor:t,block:e,startRow:r,startCol:i,endRow:o,endCol:s}=h0(n),l=[];for(let c=r;c<=o;c++)for(let d=i;d<=s;d++)l.push({row:c,col:d});return WP(t,e,l),!0}const za=I("merge-cells");function Uy(n,t,e){if(e.isSimple())return!1;const{start:r,end:i}=e;if(r.blockId!==i.blockId||n.getBlockById(r.blockId)!==t||Dt(t)!=="table")return!1;const{startCell:s,endCell:l}=h0(e);return s.cell!==l.cell}function Oy(n){const t=h0(n),e=t.editor;e.undoManager.runInGroup(()=>{const r=t.endCell,i=r.row+r.rowSpan-1,o=r.col+r.colSpan-1,s=lt(t.block);xC(n);const l=e.getBlockById(s),c=Ve(l),{startRow:d,startCol:h}=t,C=mt.default(e.getBlockData(l));p(za,C.children,"no table children");const E=It.fromTable(c),x=[];for(let vt=d;vt<=i;vt++)for(let xt=h;xt<=o;xt++){const Gt=E.getCell({row:vt,col:xt});p(za,!Gt.virtual,"cell is virtual"),x.push(Gt)}p(za,x.length>0,"no selected cells");const v=x[0],R=x.slice(1),L=E.getCellByContainerId(v.containerId).container,M=[];R.forEach(vt=>{const xt=E.getCellByContainerId(vt.containerId).container,Gt=ut(xt);if(!uu(e,xt)){const Yt=Y5(e,Gt);if(uu(e,L)){const an=fe(L)[0];e.insertDocAt(L,0,Yt),e.deleteBlock(an)}else e.insertDocAt(L,Ir(L),Yt)}M.push(Gt)});const U=ut(L),F=o-h+1,G=i-d+1;C[`${U}_colSpan`]=F,C[`${U}_rowSpan`]=G,M.forEach(vt=>{p(za,C.children,"no table children");const xt=C.children.indexOf(vt);p(za,xt>0,"no deleted container"),C.children.splice(xt,1)});const W=C,st=e.getChildContainerData(U)[0];p(za,st,"no child block");const Et=ye(e,st.id,0);cl(W),e.updateBlockData(l,W,Et),e.deleteChildContainers(M)})}const bC=10,qP=["table/merge-cells","table/split-cell","table/insert-column","table/insert-row","table/delete-rows","table/delete-columns","table/delete"];class m0{constructor(){m(this,"id","TableBlockCommandProvider")}getAvailableCommands(t,e,r){if(Dt(e)!=="table")return[];const i={blockId:lt(e),blockKind:Dr(t,e),blockType:Dt(e)},o=[];Uy(t,e,r)&&o.push({id:"table/merge-cells",name:D.t("table.mergeCell"),icon:xT,groupIndex:bC,...i}),My(t,e,r)&&o.push({id:"table/split-cell",name:D.t("table.splitCell"),icon:bT,groupIndex:bC,...i});const s=Dy(t,e,r),l=_y(t,e,r);return s&&l&&o.push({id:"table/delete",name:D.t("table.deleteTable"),icon:vT,groupIndex:bC,...i}),o}executeCommand(t,e,r,i,o,s){return Dt(e)!=="table"||!new Set(qP).has(i.id)?!1:i.id==="table/merge-cells"?(Oy(r),!0):i.id==="table/split-cell"?(xC(r),!0):i.id==="table/delete-columns"?(pC(r),!0):i.id==="table/delete-rows"?(CC(r),!0):i.id==="table/delete"?(t.deleteBlock(e),!0):!1}}var Ny=(n=>(n.COL_TITLE_TABLE="col-title-table",n.COL_TITLE_ITEM="col-title-item",n.STRIPE_STYLE_TABLE="stripe-style-table",n.NO_BORDER="table-no-border",n))(Ny||{});const Ga=6,ju=20,vC="table-cell-menu-btn";function XP(n,t){if(!n.isBlockWritable(t))return;const r={...mt.default(n.getBlockData(t)),hasColTitle:!0};n.updateBlockData(t,r)}function YP(n,t){if(!n.isBlockWritable(t))return;const r={...mt.default(n.getBlockData(t)),hasColTitle:!1};n.updateBlockData(t,r)}function QP(n,t){if(!n.isBlockWritable(t))return;const r={...mt.default(n.getBlockData(t)),hasRowTitle:!0};n.updateBlockData(t,r)}function JP(n,t){if(!n.isBlockWritable(t))return;const r={...mt.default(n.getBlockData(t)),hasRowTitle:!1};n.updateBlockData(t,r)}function ZP(n,t){if(!n.isBlockWritable(t))return;const r={...mt.default(n.getBlockData(t)),isStripeStyle:!0};n.updateBlockData(t,r)}function tF(n,t){if(!n.isBlockWritable(t))return;const r={...mt.default(n.getBlockData(t)),isStripeStyle:!1};n.updateBlockData(t,r)}function eF(n,t,e){if(!n.isBlockWritable(t))return;const i={...mt.default(n.getBlockData(t)),noBorder:!e};n.updateBlockData(t,i)}const ul=I("table-cell-dom");function nF(n,t,e){let r=n.getBlockById(e);for(;r;){const i=r.closest("td");p(ul,i,"no parent cell");const o=J(i);if(p(ul,o,"no parent block"),o===t)return i;r=o}return p(ul,!1,"filed to get cell by child block id"),null}function ns(n,t,e){if(n.getBlockById(e.blockId)===t&&!e.isSimple())return p(ul,e.childContainerId,"block position must have childContainerId attribute"),e;const i=nF(n,t,e.blockId),o=ut(Vu(i));return Ee(t,o)}function BC(n,t){const e=n.selection.range,r=ns(n,t,e.start),i=ns(n,t,e.end);return Gr(t,r,i)}function Py(n,t,e,r){p(ul,$e(t),"invalid table block");const i=vi(n,t),o=ie(t),s=()=>{const c=i.querySelector(".table-border-bar-container.top");p(ul,c,"no top border bar container"),c.querySelectorAll(".table-border-bar-cell.top").forEach(h=>{const C=parseInt(h.getAttribute("data-top-index")||"0",10);r.includes(C)?z(h,"danger"):ot(h,"danger")})},l=()=>{const c=o.querySelector(".table-border-bar-container.left");p(ul,c,"no left border bar container"),c.querySelectorAll(".table-border-bar-cell.left").forEach(h=>{const C=parseInt(h.getAttribute("data-left-index")||"0",10);e.includes(C)?z(h,"danger"):ot(h,"danger")})};s(),l()}function rs(n,t,e=!0,r){const o=It.fromBlock(t).map(h=>h),{fromCol:s,toCol:l,fromRow:c,toRow:d}=BC(n,t);for(let h=0;h<o.length;h++){const C=o[h];for(let E=0;E<C.length;E++){const x=C[E],v=r?E>=s&&E+x.colSpan-1<=l:h>=c&&h+x.rowSpan-1<=d;e&&v?x.virtual||z(x.cell,"danger"):x.virtual||ot(x.cell,"danger")}}}function is(n,t,e=!0,r){const i=new Set,o=new Set;if(!e){Py(n,t,Array.from(i),Array.from(o));return}const{fromCol:s,toCol:l,fromRow:c,toRow:d}=BC(n,t);if(r)for(let h=s;h<=l;h++)o.add(h);else for(let h=c;h<=d;h++)i.add(h);Py(n,t,Array.from(i),Array.from(o))}function Fy(n,t,e){const{fromCol:r,toCol:i,fromRow:o,toRow:s}=BC(n,t),l=It.fromBlock(t);let c=null,d=null;return e?(c=l.getCell({col:r,row:0}),d=l.getCell({col:i,row:l.rowCount-1}),Xe(n,{anchor:Ee(t,c.containerId,{colIndex:r,rowIndex:0}),focus:Ee(t,d.containerId,{colIndex:i,rowIndex:l.rowCount-1})})):(c=l.getCell({col:0,row:o}),d=l.getCell({col:l.colCount-1,row:s}),Xe(n,{anchor:Ee(t,c.containerId,{colIndex:0,rowIndex:o}),focus:Ee(t,d.containerId,{colIndex:l.colCount-1,rowIndex:s})}))}const Ky=["style-bg-color-0","style-bg-color-1","style-bg-color-2","style-bg-color-3","style-bg-color-4","style-bg-color-5","style-bg-color-6","style-bg-color-7","style-bg-color-8","style-bg-color-9","style-bg-color-10","style-bg-color-11","style-bg-color-12","style-bg-color-13"];function Vy(n){return`style-bg-color-${n}`}function zu(n){return`${n}_background`}function rF(n,t,e){const r=Ve(n),s=(e!=null?e:It.fromTable(r)).getCell(t).cell;for(let l=0;l<Ky.length;l++){const c=Ky[l];if(wt(s,c))return c}}function $y(n,t,e){if(!n.isBlockWritable(t))return;const r=n.selection.range,o={...mt.default(n.getBlockData(t))},s=ns(n,t,r.start),l=ns(n,t,r.end);if(r.isSimple()){const c=s.childContainerId;e===-1?o[zu(c)]=void 0:o[zu(c)]=Vy(e)}else{const c=It.fromBlock(t),d=Gr(t,s,l),h=new Set;for(let C=d.fromRow;C<=d.toRow;C++)for(let E=d.fromCol;E<=d.toCol;E++){const x=c.getCell({row:C,col:E});!h.has(x.containerId)&&x.col>=d.fromCol&&x.row>=d.fromRow&&x.col+x.colSpan-1<=d.toCol&&x.row+x.rowSpan-1<=d.toRow&&(h.add(x.containerId),e===-1?o[zu(x.containerId)]=void 0:o[zu(x.containerId)]=Vy(e))}}n.updateBlockData(t,o)}function iF(n,t,e){if(!n.isBlockWritable(t))return;const i={...mt.default(n.getBlockData(t)),chart:e};n.updateBlockData(t,i)}const Hy=I("table-chart");function oF(n,t){const e=UP(n,t);if(e){const r=e.querySelector(".editor-table-chart");if(r){const i=r.chartObject;i&&i.destroy(),r.remove()}}}async function sF(n,t){if(!n.contains(t)||!n.isBlockWritable(t))return;if(!!!n.getBlockData(t).chart){oF(n,t);return}const i=[],o=It.fromBlock(t),s=["line","bar","pie","radar"];let l=o.getCell({row:0,col:0}).container.innerText.trim().toLowerCase();new Set(s).has(l)||(l=s[0]);const c=[];for(let R=1;R<o.colCount;R++)c.push(o.getCell({row:0,col:R}).container.innerText);for(let R=1;R<o.rowCount;R++){const L=o.getCell({row:R,col:0}),U=L.container.innerText,F=[];for(let Yt=1;Yt<o.colCount;Yt++){const an=o.getCell({row:R,col:Yt}).container.innerText,be=Number.parseFloat(an)||0;F.push(be)}let G;const W=rF(t,L,o);W?G=window.getComputedStyle(n.rootElement).getPropertyValue(`--${W}`).trim():G=window.getComputedStyle(n.rootElement).getPropertyValue("--background-color").trim();let[rt,st,Et,vt]=G?Bg.fromString(G).toRgbaArray():[];if(!rt&&!st&&!Et&&!vt){const Yt=(R-1)%n.options.colors.length;G=n.options.colors[Yt],[rt,st,Et,vt]=Bg.fromString(G).toRgbaArray()}const xt=G,Gt=Bg.fromRgba([rt,st,Et,vt/3]).toHexString();i.push({label:U,data:F,borderColor:xt,backgroundColor:Gt,borderWidth:2})}const d=vi(n,t);let h=null,C=d.querySelector(".editor-table-chart");C?h=C.chartObject:C=B("div",["editor-table-chart"],d);const E=C;p(Hy,E,"no chart container");const x=n.getComponentOptions("table"),v=(x==null?void 0:x.chartCdn)||"https://cdn.jsdelivr.net/npm/chart.js@2.9.4/dist/Chart.min.js";try{await Ps(v,"editor-chartjs");let R=!1;(h&&h.config.data.datasets.length>i.length||h&&h.config.data.datasets[0].data.length>i[0].data.length)&&(R=!0),h&&(l!==h.config.type||R)&&(h.destroy(),h=null,Array.from(C.querySelectorAll(".editor-chartjs-canvas")).forEach(U=>{U.remove()}));const L=yg.default({},{type:l,data:{datasets:i,labels:c},options:{onClick:()=>{n.selection.selectBlock(t,0,0)}}});if(h)yg.default(h.config,L),h.update();else{const U=B("canvas",["editor-chartjs-canvas"],E).getContext("2d");h=new window.Chart(U,L),C.chartObject=h}}catch(R){Hy.error(`failed to resolve chart cdn: ${JSON.stringify(R)}`)}}async function jy(n,t){await Sr.lock("updateTableChart");try{await sF(n,t)}finally{Sr.release("updateTableChart")}}const zy=Me.default(jy,1e3);let Gy=null;function TC(n,t,e){if(Gy!==t&&(zy.flush(),Gy=t),e.updateNow){jy(n,t);return}zy(n,t)}function yC(n,t,e){e&&$e(e)&&TC(n,e,{updateNow:!1})}function lF(n,t){$e(t)&&TC(n,t,{updateNow:!0})}const Er={SCROLL:"container-scroll-tool",COMMON:"container-border-shadow",RIGHT:"container-right-border-shadow",LEFT:"container-left-border-shadow",LAYOUT_SIGN:"container-layout-border-shadow",ACTIVE:"active"},g0={SCROLL_BAR:"container-scrollbar",FIXED:"fixed"},os={SCROLL_CONTAINER:"scroll-container",TOOL:"container-scroll-tool",CONTAINER:"scroll-container-root",MAC:"mac",SCROLL_AREA:"scroll-area"};function Gu(n,t){return n.containers.get(t)}function Wy(n){return n.closest(`.${os.SCROLL_CONTAINER}`)}function Wr(n){return n.firstElementChild}function yn(n){return n.closest(`.${os.CONTAINER}`)}function Wu(n){const t=yn(n);let e=t.querySelector(`:scope >.${os.TOOL}`);return e||(e=B("div",[os.TOOL],t)),e}function aF(n){return yn(n).firstElementChild}function cF(n,t){const e=Gu(n,yn(t));return e!=null&&e.barFloatWindowBottom?typeof e.barFloatWindowBottom=="function"?e.barFloatWindowBottom():e.barFloatWindowBottom:0}function Ar(n,t){const e=ur(n);return t/e}function qu(n){const t=window.getComputedStyle(n),e=ur(n);return{paddingBottom:parseFloat(t.paddingBottom)*e,paddingTop:parseFloat(t.paddingTop)*e,paddingLeft:parseFloat(t.paddingLeft)*e,paddingRight:parseFloat(t.paddingRight)*e}}function Wa(n){const t=ur(n);return{scrollLeft:n.scrollLeft*t,scrollWidth:n.scrollWidth*t,clientWidth:n.clientWidth*t,clientHeight:n.clientHeight*t}}function uF(n,t){const e=ur(n);return n[t]*e}function kC(n,t){const e=yn(t),r=Gu(n,e),i=(r==null?void 0:r.safeRightSpace)||0,o=(r==null?void 0:r.safeLeftSpace)||0,l=(r==null?void 0:r.locatingContainer).getBoundingClientRect(),c=e.getBoundingClientRect(),d=c.width;let h=Math.floor(c.left-l.left-o);h<0&&(h=0);let C=l.right;C-=i;let E=C-c.right;return E<0&&(E=0),h=Math.round(h),E=Math.round(E),{originWidth:d,maxLeft:h,maxRight:E}}function fF(n,t){const e=kC(n,t),{maxLeft:r}=e;t.style.marginLeft=`${Ar(t,0-r)}px`,t.style.paddingLeft=`${Ar(t,r)}px`}function dF(n,t){const e=kC(n,t);t.style.marginRight=`${Ar(t,0-e.maxRight)}px`}function hF(n){if(n!==document.documentElement&&n!==document.body)return n.getBoundingClientRect();const t=0,e=0,r=document.documentElement.clientWidth,i=document.documentElement.clientHeight;return new DOMRect(t,e,r,i)}const qy=I("scroll-bar-handle"),mF=2;function qa(n){const t=Wu(n);let e=t.querySelector(`.${g0.SCROLL_BAR}`);return e||(e=B("div",[g0.SCROLL_BAR],t)),p(qy,e instanceof HTMLDivElement,"invalid child for container tools"),e.firstElementChild||B("div",[],e),e}function p0(n,t){const e=Wy(t),r=qa(e),{scrollWidth:i,clientWidth:o}=Wa(e),{paddingLeft:s,paddingRight:l}=qu(t),c=kC(n,e),{originWidth:d,maxRight:h}=c;dF(n,e),fF(n,e);const C=i-o;p(qy,r.firstElementChild instanceof HTMLDivElement,"invalid child for scroll bar"),r.style.width=`${Ar(e,d+h-s-l)}px`,r.firstElementChild.style.width=`${Ar(e,d+h+C-s-l)}px`}function gF(n,t){const e=Wr(n),{paddingLeft:r}=qu(e);if(wt(t,"fixed")){const o=yn(n).getBoundingClientRect();t.style.left=`${Ar(n,o.left+r)}px`}else t.style.left=`${Ar(n,r)}px`}function Xa(n,t){var U;const e=n.getParentScrollContainer(),r=hF(e),i=t.getBoundingClientRect(),o=qa(t),s=o.getBoundingClientRect(),l=Gu(n,yn(t)),c=cF(n,t),d=Wr(t),{paddingTop:h,paddingBottom:C}=qu(d),{scrollWidth:E,clientWidth:x}=Wa(t),v=document.documentElement.clientHeight-c,R=r.top+Wa(e).clientHeight-v,L=v+Math.min(0,R);if(E>x&&i.top+h<L-s.height&&i.bottom>L-s.height+C&&!((U=l==null?void 0:l.isSetScale)!=null&&U.call(l))){l!=null&&l.allowScrollBarFixed&&z(o,g0.FIXED);const F=R>0?c:0;o.style.bottom=`${Math.max(document.documentElement.clientHeight-r.bottom,0)+mF+F}px`}else ot(o,g0.FIXED),o.style.bottom=`${Ar(t,C-s.height)}px`;gF(t,o)}class pF{constructor(t,e){m(this,"intersectionObserver");m(this,"handleIntersection",t=>{t.forEach(e=>{this.containers.get(yn(e.target))?(this.handleIntersectionEntry(e),this.callback(e)):this.intersectionObserver.unobserve(e.target)})});m(this,"handleIntersectionEntry",t=>{const e=t.target;Xa(this.scrollCore,e);const r=Wr(e);p0(this.scrollCore,r)});this.scrollCore=t,this.callback=e;const i={root:this.scrollCore.getParentScrollContainer(),rootMargin:"20px",threshold:0};this.intersectionObserver=new IntersectionObserver(this.handleIntersection,i)}get containers(){return this.scrollCore.containers}bind(t){this.unbind(t),this.intersectionObserver.observe(t)}unbind(t){this.intersectionObserver.unobserve(t)}destroy(){this.intersectionObserver.disconnect()}}const fl=I("container-scroll-shadow");function Xy(n,t,e){const r=n,i=t.getBoundingClientRect(),o=e.getBoundingClientRect(),{paddingTop:s,paddingBottom:l}=qu(e);r.style.top=`${Ar(t,o.top-i.top+s)}px`,r.style.bottom=`${Ar(t,i.bottom-o.bottom+l)}px`}function Yy(n,t){const e=n;t<24?e.style.width=`${(t/3).toFixed(2)}px`:e.style.width=""}function CF(n){const t=Wu(n);p(fl,t,"no container tools");let e=t.querySelector(`.${Er.LEFT}`);if(!e){const l=Wr(n),c=[Er.COMMON,Er.LEFT];e=B("div",c,t),p(fl,e instanceof HTMLDivElement,"invalid child for container tools"),Xy(e,n,l)}p(fl,e instanceof HTMLElement,"invalid child for container tools");const i=yn(n).getBoundingClientRect(),o=n.getBoundingClientRect();e.style.left=`${Ar(n,o.left-i.left)}px`;const s=Wa(n).scrollLeft;p(fl,e instanceof HTMLDivElement,"invalid child for container tools"),Yy(e,s),z(e,Er.ACTIVE)}function EF(n){const t=Wu(n);let e=t.querySelector(`.${Er.RIGHT}`);if(!e){const h=Wr(n),C=[Er.COMMON,Er.RIGHT];e=B("div",C,t),p(fl,e instanceof HTMLDivElement,"no div, create shadow failed"),Xy(e,n,h)}p(fl,e instanceof HTMLElement,"");const i=yn(n).getBoundingClientRect(),o=n.getBoundingClientRect();e.style.right=`${Ar(n,i.right-o.right)}px`;const{scrollWidth:s,scrollLeft:l,clientWidth:c}=Wa(n),d=s-l-c;p(fl,e instanceof HTMLDivElement,"no shadow element"),Yy(e,d),z(e,Er.ACTIVE)}function AF(n){const e=Wu(n).querySelector(`.${Er.LEFT}`);e&&ot(e,Er.ACTIVE)}function xF(n){const e=Wu(n).querySelector(`.${Er.RIGHT}`);e&&ot(e,Er.ACTIVE)}function Xu(n){const{scrollLeft:t,scrollWidth:e,clientWidth:r}=Wa(n),i=Wr(n),{paddingLeft:o,paddingRight:s}=qu(i),l=uF(i,"offsetLeft");e-o<=r-s||e-o<=t+r-s?xF(n):EF(n),i&&t>=l+o?CF(n):AF(n)}class bF{constructor(t,e){m(this,"resizeObserver");m(this,"handleResizeEntry",t=>{const e=t.target,r=Wr(e);Xu(e),p0(this.scrollCore,r),Xa(this.scrollCore,e),this.callback(e)});m(this,"handleContentResize",t=>{t.forEach(e=>{this.containers.get(yn(e.target))?this.handleResizeEntry(e):this.unbind(e.target)})});this.scrollCore=t,this.callback=e,this.resizeObserver=new Us(this.handleContentResize)}get containers(){return this.scrollCore.containers}bind(t){this.unbind(t),this.resizeObserver.observe(t)}unbind(t){this.resizeObserver.unobserve(t)}destroy(){this.resizeObserver.disconnect()}}const Qy=I("container-scroll-observer");class vF{constructor(t,e){m(this,"handleContentScroll",t=>{const e=t.target;p(Qy,e instanceof Element,"invalid target for scroll event");const r=qa(e);r.removeEventListener("scroll",this.handleScroll);const i=!0;this.fixScrollXPos(e,e.scrollLeft,i),this.bind(r),Xu(e),this.callback(e)});m(this,"handleScroll",t=>{const e=t.target;p(Qy,e instanceof HTMLElement,"");const r=e.scrollLeft,i=!1,o=aF(e);this.unbindContentScroll(o),this.fixScrollXPos(o,r,i),this.bindContentScroll(o),Xu(o),this.callback(o)});m(this,"handlePrevent",t=>{t.stopPropagation()});m(this,"bindContentScrollCore",t=>{this.unbindContentScroll(t),t.addEventListener("scroll",this.handleContentScroll)});m(this,"unbindContentScroll",t=>{t.removeEventListener("scroll",this.handleContentScroll)});m(this,"bindContentScroll",Me.default(this.bindContentScrollCore,300));m(this,"bind",Me.default(this.bindCore,200));this.scrollCore=t,this.callback=e}fixScrollXPos(t,e,r){const i=qa(t);r||(t.scrollLeft=e),r&&i.scrollLeft!==e&&(i.scrollLeft=e)}bindCore(t){this.unbind(t),t.addEventListener("scroll",this.handleScroll),t.addEventListener("mousedown",this.handlePrevent)}unbind(t){t.removeEventListener("scroll",this.handleScroll),t.removeEventListener("mousedown",this.handlePrevent)}}class BF{constructor(t){m(this,"scrollContainers",new Set);m(this,"handleParentContainerScroll",()=>{this.scrollContainers.forEach(t=>{Xa(this.scrollCore,t)})});m(this,"bindScrollContainer",t=>{const e=this.scrollContainers.size===0;this.scrollContainers.add(t),e&&this.eventTarget.addEventListener("scroll",this.handleParentContainerScroll)});m(this,"unbindScrollContainer",t=>{let e=!1;this.scrollContainers.has(t)&&(this.scrollContainers.delete(t),e=this.scrollContainers.size===0),e&&this.eventTarget.removeEventListener("scroll",this.handleParentContainerScroll)});this.scrollCore=t}get eventTarget(){const t=this.scrollCore.getParentScrollContainer();return t===document.documentElement?document:t}destroy(){this.eventTarget.removeEventListener("scroll",this.handleParentContainerScroll),this.scrollContainers.clear()}}const TF=I("scroll-wrap-resize-observer");class yF{constructor(t){m(this,"resizeObserver");m(this,"handleScrollWrapResize",t=>{t.forEach(e=>{this.containers.get(yn(e.target))?this.handleScrollWrapResizeEntry(e):this.unbind(e.target)})});m(this,"handleScrollWrapResizeEntry",t=>{const e=t.target;p(TF,e instanceof HTMLElement,"invalid target for observer entry");const r=Wy(e);p0(this.scrollCore,e),Xu(r),Xa(this.scrollCore,r)});this.scrollCore=t,this.resizeObserver=new Us(this.handleScrollWrapResize)}get containers(){return this.scrollCore.containers}bind(t){this.unbind(t),this.resizeObserver.observe(t)}unbind(t){this.resizeObserver.unobserve(t)}destroy(){this.resizeObserver.disconnect()}}class kF{constructor(t,e){m(this,"resizeObserver");m(this,"scrollContainersMap",new Map);m(this,"handleResizeEntry",t=>{t==null||t.forEach(e=>{const r=Wr(e);Xu(e),p0(this.scrollCore,r),Xa(this.scrollCore,e),this.callback(e)})});m(this,"handleResize",t=>{t.forEach(e=>{const r=this.scrollContainersMap.get(e.target);r!=null&&r.length&&this.handleResizeEntry(r)})});this.scrollCore=t,this.callback=e,this.resizeObserver=new Us(this.handleResize)}bind(t){var i,o;const e=yn(t),r=(i=Gu(this.scrollCore,e))==null?void 0:i.locatingContainer;this.scrollContainersMap.has(r)?(o=this.scrollContainersMap.get(r))==null||o.push(t):(this.scrollContainersMap.set(r,[t]),this.resizeObserver.observe(r))}unbind(t){var o,s;const e=yn(t),r=(o=Gu(this.scrollCore,e))==null?void 0:o.locatingContainer;if(!r)return;const i=this.scrollContainersMap.get(r);this.scrollContainersMap.set(r,(i==null?void 0:i.filter(l=>l!==t))||[]),(s=this.scrollContainersMap.get(r))!=null&&s.length||(this.resizeObserver.unobserve(r),this.scrollContainersMap.delete(r))}destroy(){this.scrollContainersMap.clear(),this.resizeObserver.disconnect()}}const Cct="";class RF extends Be.TypedEmitter{constructor(e){super();m(this,"containerIntersectionObserver",null);m(this,"containerResizeObserver",null);m(this,"containerScrollObserver",null);m(this,"parentContainerScrollObserver",null);m(this,"scrollWrapResizeObserve",null);m(this,"locatingContainerResizeObserver",null);m(this,"isWindowEventBind",!1);m(this,"containers",new Map);m(this,"handleScrollContainerScroll",e=>{this.emit("scroll",this,e)});m(this,"handleResize",e=>{this.emit("resize",this,e)});m(this,"handleIntersection",e=>{const r=e.target,i=Wr(r);e.isIntersecting?(this.load(),this.bindCore(r,i)):this.unbindCore(r,i)});m(this,"handleWindowEffect",()=>{var e;(e=this.getScrollContainerInViewable())==null||e.forEach(r=>{Xa(this,r)})});this.parentContainer=e}load(){this.containerResizeObserver||(this.containerResizeObserver=new bF(this,this.handleResize)),this.containerScrollObserver||(this.containerScrollObserver=new vF(this,this.handleScrollContainerScroll)),this.parentContainerScrollObserver||(this.parentContainerScrollObserver=new BF(this)),this.scrollWrapResizeObserve||(this.scrollWrapResizeObserve=new yF(this)),this.locatingContainerResizeObserver||(this.locatingContainerResizeObserver=new kF(this,this.handleResize)),this.isWindowEventBind||(window.addEventListener("resize",this.handleWindowEffect),this.getParentScrollContainer()!==document.documentElement&&window.addEventListener("scroll",this.handleWindowEffect))}getParentScrollContainer(){return this.parentContainer}getScrollContainerInViewable(){var e;return(e=this.parentContainerScrollObserver)==null?void 0:e.scrollContainers}unbindCore(e,r){var o,s,l,c,d,h;const i=qa(e);(o=this.containerScrollObserver)==null||o.unbindContentScroll(e),(s=this.containerScrollObserver)==null||s.unbind(i),(l=this.scrollWrapResizeObserve)==null||l.unbind(r),(c=this.containerResizeObserver)==null||c.unbind(e),(d=this.parentContainerScrollObserver)==null||d.unbindScrollContainer(e),(h=this.locatingContainerResizeObserver)==null||h.unbind(e)}bindCore(e,r){var s,l,c,d,h,C;if(this.unbindCore(e,r),!e.closest("body"))return;const i=qa(e);(s=this.containerScrollObserver)==null||s.bindContentScrollCore(e),(l=this.containerScrollObserver)==null||l.bindCore(i),(c=this.scrollWrapResizeObserve)==null||c.bind(r),(d=this.containerResizeObserver)==null||d.bind(e);const o=this.containers.get(yn(e));o!=null&&o.allowScrollBarFixed&&((h=this.parentContainerScrollObserver)==null||h.bindScrollContainer(e)),(C=this.locatingContainerResizeObserver)==null||C.bind(e)}bind(e,r){this.containers.set(e,r);const i=e.firstElementChild;this.containerIntersectionObserver||(this.containerIntersectionObserver=new pF(this,this.handleIntersection)),this.containerIntersectionObserver.bind(i)}unbind(e){var o;const r=e.firstElementChild,i=Wr(r);this.unbindCore(r,i),this.containers.delete(e),(o=this.containerIntersectionObserver)==null||o.unbind(r),this.containers.size||this.destroy()}destroy(){var e,r,i,o,s;this.containers.forEach((l,c)=>{this.unbind(c)}),this.containers.clear(),(e=this.parentContainerScrollObserver)==null||e.destroy(),(r=this.containerIntersectionObserver)==null||r.destroy(),(i=this.containerResizeObserver)==null||i.destroy(),(o=this.scrollWrapResizeObserve)==null||o.destroy(),(s=this.locatingContainerResizeObserver)==null||s.destroy(),window.removeEventListener("resize",this.handleWindowEffect),window.removeEventListener("scroll",this.handleWindowEffect)}}const Jy=I("scroll-container"),C0=new Map;class wF extends Be.TypedEmitter{constructor(){super(...arguments);m(this,"scrollListener");m(this,"options");m(this,"scrollContainerElement");m(this,"init",e=>{this.options=e;const r=B("div",[os.CONTAINER],e.parentElement);ue.isMac&&z(r,os.MAC);const i=B("div",[os.SCROLL_CONTAINER],r),o=B("div",[os.SCROLL_AREA],i);o.style.paddingLeft=e.paddingLeft?`${e.paddingLeft}px`:"",o.style.paddingTop=e.paddingTop?`${e.paddingTop}px`:"",o.style.paddingBottom=e.paddingBottom?`${e.paddingBottom}px`:"",o.style.paddingRight=e.paddingRight?`${e.paddingRight}px`:"",o.appendChild(e.childElement);const s=e.parentContainer;this.scrollListener=C0.get(s),this.scrollListener||(this.scrollListener=new RF(s),C0.set(s,this.scrollListener)),this.scrollListener.unbind(r),this.scrollListener.bind(r,e),this.scrollListener.on("scroll",this.handleContainerScroll),this.scrollListener.on("resize",this.handleResize),this.scrollContainerElement=i});m(this,"handleContainerScroll",(e,r)=>{r===this.scrollContainerElement&&this.emit("scroll",this)});m(this,"handleResize",(e,r)=>{r===this.scrollContainerElement&&this.emit("scroll",this)})}get rootElement(){return this.scrollContainerElement}get contentElement(){return p(Jy,this.scrollContainerElement,"scrollContainerElement cannot be undefined"),Wr(this.scrollContainerElement)}get scrollOptions(){return p(Jy,this.options,"options cannot be undefined"),{...this.options}}handleBaseListenerDestroy(e){e.destroy()}destroy(){var r;(r=this.scrollListener)==null||r.off("scroll",this.handleContainerScroll);const e=yn(this.contentElement);e&&C0.forEach((i,o)=>{i.unbind(e),i.containers.size===0&&(this.handleBaseListenerDestroy(i),C0.delete(o))})}}function SF(){return new wF}const RC=I("column-width");function LF(n,t,e){NP(n,t).style.width=`${e}px`}function IF(n){const e=Array.from(n.querySelector("colgroup").children).map(c=>c.getBoundingClientRect().width);if(e[0]!==0)return e;const r=It.fromTable(n),i=Array(r.colCount).fill(-1),o=n.getBoundingClientRect().left;r.toRealCells(r.cells).forEach(c=>{const d=c.col+c.colSpan-1;i[d]===-1&&(i[d]=c.cell.getBoundingClientRect().right-o)}),RC.debug(`cellRightOffsets1: ${i.join()}`);for(let c=0;c<i.length;c++){const d=i[c];if(d===-1||c===0)continue;let h=c-1;for(;i[h]===-1&&(h--,h!==-1););const C=h===-1?0:i[h],x=(d-C)/(c-h);for(let v=h+1;v<c;v++)i[v]=C+x*(v-h)}RC.debug(`cellRightOffsets2: ${i.join()}`);const s=[];let l=0;for(let c=0;c<i.length;c++){const d=i[c];s.push(d-l),l=d}return RC.debug(`widths: ${s.join()}`),s}function Yu(n){return Array.from(n.querySelector("colgroup").children).map(r=>r.getBoundingClientRect().width||Number.parseInt(r.style.width,10))}const wC=200,DF=40,_F=I("table-resize-gripper"),Zy=7,SC=(Zy-1)/2,MF=3;function UF(n,t,e){const{rows:r}=n;for(let i=0;i<r.length;i++){const o=r[i],s=Array.from(o.cells);for(let l=0;l<s.length;l++){const c=s[l],d=c.getBoundingClientRect(),h=Math.round(d.right);if(Math.abs(t-h)<=SC&&d.top<=e&&e<=d.bottom)return c}}return null}function OF(n){return!!n.rootContainer.querySelector(".table-resize-gripper")}function LC(n,t){return vi(n,t).querySelector(".table-resize-gripper")}function tk(n,t){const e=LC(n,t);p(_F,!e,"resize gripper has already exists");const r=vi(n,t),i=B("div",["table-resize-gripper","table-indicator"],r);return B("div",["table-resize-gripper-indicator"],i),i}function ek(n,t,e){let r=LC(n,t);r||(r=tk(n,t));const o=Ve(t).getBoundingClientRect(),s=e.getBoundingClientRect(),l=0,c=o.height,d=n.getCustom(bi(t)).contentElement.getBoundingClientRect(),h=s.right-d.left;r.style.left=`${h-SC-Ga-ju}px`,r.style.top=`${l}px`,r.style.height=`${c}px`,r.style.width=`${Zy}px`}function IC(n){n.rootContainer.querySelectorAll(".table-resize-gripper").forEach(t=>{t.remove()})}function NF(n,t,e){const i={...n.getBlockData(t),colsWidth:e};n.updateBlockData(t,i)}function PF(n,t,e,r){const i=t,o=It.fromTable(e),s=o.getCellByCellElement(i),l=s.col+s.colSpan-1,c=Yu(e);let d=r;const h=(E,x)=>{const v=x+1,R=E.col+E.colSpan;return c.slice(v,R).reduce((M,U)=>M+U,0)},C=new Set;for(let E=0;E<o.rowCount;E++){const x=o.getCell({row:E,col:l});if(C.has(x.cell))continue;C.add(x.cell);const v=x.cell,R=v.getBoundingClientRect();let L=r-R.left+SC-MF;const M=Vu(v),U=l1(n,M)||DF*x.colSpan,F=h(x,l),G=U-F;L<G&&(L=G);const W=R.left+L;d=Math.max(d,W)}return d}const FF=I("table-resize-drag-drop");class KF{constructor(t,e,r,i){m(this,"cursor","col-resize");this.editor=t,this.elem=e,this.data=r,this.onEnd=i}onDragStart(t,e,r){}onDragging(t,e,r,i,o){const{table:s,block:l,draggingRefCell:c}=t.data,h=PF(this.editor,c,s,e.x-t.dragOffsetX)-s.getBoundingClientRect().left;p(FF,c,"no dragging cell");const E=It.fromTable(s).getCellByCellElement(c),x=E.col+E.colSpan-1,v=Yu(s),R=v.slice(0,x).reduce((M,U)=>M+U,0),L=h-R;if(LF(s,x,L),L){const M=parseFloat(s.style.minWidth);s.style.minWidth=`${M+(L-v[x])}px`}ek(this.editor,l,c),this.editor.selection.caret.update()}onDragEnd(t,e,r,i,o){const s=Yu(t.data.table);NF(this.editor,t.data.block,s),IC(this.editor),this.onEnd&&(this.onEnd(e),this.onEnd=null)}}function VF(n,t){const e=document.elementFromPoint(t.x,t.y);if(!e)return null;const r=J(e);return!r||!n.contains(r)||!$e(r)?null:r}I("table-resize");class $F{constructor(t){m(this,"draggingRefCell",null);m(this,"handleMouseMove",(t,e)=>{if(t.readonly||t.selectionHandler.isSelecting()&&!this.draggingRefCell||this.draggingRefCell)return;const r=e.target;if(!(r instanceof Element)||r.closest(".table-indicator"))return;const o=e,s=VF(t,o);if(!s||!Ly(s)||!t.isBlockWritable(s)){IC(t);return}this.updateGripper(s,o.x,o.y)});this.editor=t,t.domEvents.addEventListener(document,"mousemove",this.handleMouseMove)}destroy(){this.editor.domEvents.removeEventListener(document,"mousemove",this.handleMouseMove)}updateGripper(t,e,r){const i=Ve(t),o=UF(i,e,r);if(o){if(!LC(this.editor,t)){if(OF(this.editor))return;const l=tk(this.editor,t),c={block:t,table:i,draggingRefCell:o};Ug(new KF(this.editor,l,c,d=>{this.updateGripper(t,d.x,d.y)}))}ek(this.editor,t,o)}else IC(this.editor)}}function nk(n){n.addCustom("table-mouse-event-handler",t=>new $F(t))}const rk=I("table-insert-column");function ik(n,t,e){n.undoManager.runInGroup(()=>{var E;const r=Ve(t),i=It.fromTable(r),o=i.colCount;p(rk,e>=0&&e<=o,`insert index ${e} is out of range [0, ${o}]`);const s=i.map(x=>x.containerId),l=new Set;n.doc.beginBatchUpdate();for(let x=0;x<s.length;x++){const v=s[x],R=v[e-1],L=v[e];if(e===0||e===v.length||R!==L){const M=no(n.doc);v.splice(e,0,M)}else v.splice(e,0,R),l.add(R)}n.doc.endBatchUpdate();const c=mt.default(n.getBlockData(t));l.forEach(x=>{const v=`${x}_colSpan`,R=c[v];p(rk,typeof R=="number"&&R>1,`no colSpan for containerId ${x}, ${R}`),c[v]=R+1});const d=((E=c.colsWidth)==null?void 0:E.concat())||new Array(c.cols).fill(0);d.splice(e,0,wC);const h=It.virtualCellContainersGridToChildren(s),C={...c,cols:c.cols+1,children:h,colsWidth:d};cl(C),n.updateBlockData(t,C)})}const E0=I("table-insert-row");function DC(n,t,e){n.undoManager.runInGroup(()=>{const r=Ve(t),i=It.fromTable(r),o=i.rowCount;p(E0,e>=0&&e<=o,`insert index ${e} is out of range [0, ${o}]`);const s=i.map(E=>E.containerId),l=new Set;n.doc.beginBatchUpdate();const c=[];for(let E=0;E<i.colCount;E++){const x=e>0&&s[e-1][E],v=e<i.rowCount&&s[e][E];if(p(E0,x||v,"no top and bottom cell"),e===0||e===i.rowCount||x!==v){const R=no(n.doc);c.push(R)}else p(E0,x,"no top cell"),c.push(x),l.add(x)}n.doc.endBatchUpdate(),s.splice(e,0,c);const d=mt.default(n.getBlockData(t));l.forEach(E=>{const x=`${E}_rowSpan`,v=d[x];p(E0,typeof v=="number"&&v>1,`no rowSpan for containerId ${E}, ${v}`),d[x]=v+1});const h=It.virtualCellContainersGridToChildren(s),C={...d,rows:d.rows+1,children:h};cl(C),n.updateBlockData(t,C)})}const _C=I("paste-table-in-table-block");function HF(n,t,e,r,i){let o=It.fromBlock(e);const s=t.blocks.root[0];p(_C,s,"no table data"),p(_C,s.type==="table",`table data type is not table, but ${s.type}`);const l=s,c=o.getCellByCellElement(r),d=l.cols,h=l.rows,C=c.col,E=c.row,x=C+d,v=E+h,R=[];for(let L=C;L<x&&L<o.colCount;L++)for(let M=E;M<v&&M<o.rowCount;M++){const U=o.getCell({col:L,row:M});U.virtual?U.virtual&&R.push({col:L,row:M}):(U.colSpan>1||U.rowSpan>1)&&R.push({col:L,row:M})}n.undoManager.runInGroup(()=>{if(n.doc.beginBatchUpdate(),R.forEach(F=>{const G=It.fromBlock(e).getCell(F);(G.colSpan>1||G.rowSpan>1)&&AC(n,e,F)}),x>o.colCount)for(let F=o.colCount;F<x;F++)ik(n,e,F);if(v>o.rowCount)for(let F=o.rowCount;F<v;F++)DC(n,e,F);o=It.fromBlock(e);const L=new u0(l);let M;for(let F=0;F<L.colCount;F++)for(let G=0;G<L.rowCount;G++){const W=L.getCell({col:F,row:G});if(!W.virtual){const rt=lp(n.editorBlocks,t,W.containerId,i),st=C+F,Et=E+G,vt={col:st,row:Et},xt=o.getCellContainer(vt);o5(n,xt,rt,i),M=xt}}n.doc.endBatchUpdate(),p(_C,M,"no last container");const U=tn(M);n.selection.selectBlock(U,dt(n,U))})}const MC=I("paste-in-table-block");class jF{constructor(t){m(this,"pasteData");this.editor=t,setTimeout(()=>{t.input.addHandler(this)})}destroy(){this.pasteData=void 0}async handleBeforePaste(t,e,r,i){return this.pasteData={doc:r,files:i,event:e},!1}async handleBeforePasteDoc(t,e){var E,x,v,R;if(!t.selection.range.isSimple())return this.pasteData=void 0,!1;if(t.selection.range.start.offset!==0)return this.pasteData=void 0,!1;const i=t.selection.startBlock,o=it(i);if(Xt(o))return this.pasteData=void 0,!1;if(!uu(t,o))return this.pasteData=void 0,!1;const s=J(o);if(p(MC,s,"no parent block"),!$e(s))return this.pasteData=void 0,!1;if(e.blocks.root.length!==1)return this.pasteData=void 0,!1;if(e.blocks.root[0].type!=="table")return this.pasteData=void 0,!1;MC.debug("paste child table in table");const d=It.fromBlock(s).getCellByContainerId(ut(o)).cell;Tp(t,e);const h={blockIdMap:new Map,containerIdMap:new Map,boxIdMap:new Map};HF(t,e,s,d,h),p(MC,this.pasteData,"invalid paste data");const C=[];t.input.forEach(L=>{C.push(L)});for(let L=0;L<C.length&&!await((x=(E=C[L]).handleAfterPasteDoc)==null?void 0:x.call(E,t,e,h));L++);for(let L=0;L<C.length&&!await((R=(v=C[L]).handleAfterPaste)==null?void 0:R.call(v,t,this.pasteData.event,this.pasteData.doc));L++);return this.pasteData=void 0,!0}}function ok(n){n.addCustom("table-block-paste-event",t=>new jF(t))}const UC=I("table-select-columns");function zF(n,t,e,r,i){p(UC,$e(t),"is not a table block");const o=It.fromBlock(t);p(UC,e>=0&&e<o.colCount,"invalid from"),p(UC,r>0&&e+r<=o.colCount,"invalid count");const s=o.getCell({row:0,col:e}),l=o.getCell({row:o.rowCount-1,col:e+r-1}),c=Ee(t,s.containerId,{colIndex:e,rowIndex:0}),d=Ee(t,l.containerId,{colIndex:e+r-1,rowIndex:o.rowCount-1});i!=null&&i.reverse?n.selection.setSelection(d,c):n.selection.setSelection(c,d)}const OC=I("table-select-columns");function GF(n,t,e,r,i){p(OC,$e(t),"is not a table block");const o=It.fromBlock(t);p(OC,e>=0&&e<o.rowCount,"invalid from"),p(OC,r>0&&e+r<=o.rowCount,"invalid count");const s=o.getCell({row:e,col:0}),l=o.getCell({row:e+r-1,col:o.colCount-1}),c=Ee(t,s.containerId,{rowIndex:e,colIndex:0}),d=Ee(t,l.containerId,{rowIndex:e+r-1,colIndex:o.colCount-1});i!=null&&i.reverse?n.selection.setSelection(d,c):n.selection.setSelection(c,d)}const Ect="",sk=I("get-toolbar-reference-client");function lk(n,t){const e=n.selection.range;if(!e.isSimple()){p(sk,e.start.blockId===e.end.blockId,"invalid selection range");const s=n.getBlockById(e.start.blockId);p(sk,Mt(n,s),"not a complex block");const l=Qt(n,s);if(l.getTextToolbarReferenceClient){const c=l.getTextToolbarReferenceClient(n,s);if(c)return c}}const r=e.isReverse()?t.start:t.end,i=Xe(n,{anchor:r,focus:r}),o=Wi(n,t.block,i);if(o.length!==0)return o[0]}function WF(n){var t,e;if(n.children){let r=!1;const i=[];for(const o of n.children){if((t=o.states)!=null&&t.includes("checked")){r=!0;break}(e=n.defaultCheckedChildren)!=null&&e.includes(o.id)&&i.push(o)}if(!r&&(i==null?void 0:i.length))for(const o of i)Array.isArray(o.states)?o.states.push("checked"):o.states=["checked"]}}function A0(n){const t=(i,o)=>{const s=i.findIndex(c=>c.id===o.id);if(s===-1){i.push(o);return}const l=i[s];if(l.value!==o.value&&delete l.value,!!l.states){if(!o.states){l.states=[];return}l.states=kg.default(l.states,o.states)}},e=[],r=new Map;return n.forEach(i=>{var o,s;(o=i.children)!=null&&o.length&&(r.has(i.id)?(s=r.get(i.id))==null||s.push(...i.children):r.set(i.id,[...i.children])),t(e,i)}),r.forEach((i,o)=>{const s=e.find(l=>l.id===o);s&&(s.children=A0(i),WF(s))}),e}function x0(n){return n.findCustom("toolbar-handler")}const Act="";class qF{constructor(){m(this,"linkPopup",null);m(this,"form",{});m(this,"onFinished",null);m(this,"onClose",null);m(this,"handleOk",async()=>{var t;try{await this.checkValue();const{linkText:e,linkUrl:r}=this.form,i=this.formatUrl(r.getInputValue());(t=this.onFinished)==null||t.call(this,e.getInputValue()||i,i),this._destroy()}catch{}});m(this,"handleClose",()=>{var t;(t=this.onClose)==null||t.call(this),this._destroy()});m(this,"onShow",()=>{setTimeout(()=>{var t;(t=this.form.linkText)==null||t.getField().focus()},400)});m(this,"onChange",()=>{var e;const t=(e=this.linkPopup)==null?void 0:e.content.querySelector('[data-button-id="submit-button"]');t.disabled=!1});m(this,"handleTextKeyboard",t=>{var e;if(!t.isComposing){if(t.key==="Enter"){(e=this.form.linkUrl)==null||e.getField().focus(),t.stopPropagation();return}t.key==="Escape"&&this.handleClose()}});m(this,"handleUrlKeyboard",t=>{if(!t.isComposing){if(t.key==="Enter"){this.handleOk(),t.preventDefault();return}t.key==="Escape"&&this.handleClose()}})}async checkValue(){const{linkUrl:t}=this.form;if(!t.getInputValue())throw t.setFieldError(D.t("link.urlPlaceholder")),new Error(D.t("link.urlPlaceholder"))}formatUrl(t){if(!t)return"";try{new URL(t)}catch{return`${window.location.protocol}//${t}`}return t}editLink(t){var h,C;const{target:e,linkText:r,linkUrl:i,onFinished:o,onClose:s,placement:l="bottom-start"}=t;this.linkPopup=new $a(this.createPopupContent(r,i)),this.linkPopup.addListener("show",this.onShow),this.linkPopup.manualShow(e,{theme:"light",placement:l}),this.onFinished=o,s&&(this.onClose=s);const c=(h=this.linkPopup)==null?void 0:h.content.querySelector('[data-button-id="submit-button"]'),d=(C=this.linkPopup)==null?void 0:C.content.querySelector('[data-button-id="cancel-button"]');c==null||c.addEventListener("click",this.handleOk),d==null||d.addEventListener("click",this.handleClose)}createPopupContent(t,e){const r=B("div",["link-popup-content"],null);this.form.linkText=c0(r,{label:D.t("link.textLabel"),required:!1,placeholder:D.t("link.textPlaceholder"),defaultValue:t,onChange:this.onChange,onKeyDown:this.handleTextKeyboard}),this.form.linkUrl=c0(r,{className:"link-popup-gap",label:D.t("link.urlLabel"),required:!0,placeholder:D.t("link.urlPlaceholder"),defaultValue:e,onChange:this.onChange,onKeyDown:this.handleUrlKeyboard});const i=B("div",["link-popup-footer"],r),o=Cr("cancel-button",D.t("link.cancelText"));i.appendChild(o);const s=Cr("submit-button",D.t("link.submitText"),void 0,["disabled","primary"]);return i.appendChild(s),r}_destroy(){var r,i,o,s;const t=(r=this.linkPopup)==null?void 0:r.content.querySelector('[data-button-id="submit-button"]'),e=(i=this.linkPopup)==null?void 0:i.content.querySelector('[data-button-id="cancel-button"]');t==null||t.removeEventListener("click",this.handleOk),e==null||e.removeEventListener("click",this.handleClose),this.onFinished=null,this.onClose=null,this.form={},(o=this.linkPopup)==null||o.removeAllListeners(),(s=this.linkPopup)==null||s.destroy()}destroy(){this._destroy()}}function Qu(n,t){n.addCustom("link-editor",()=>new qF).editLink(t)}const XF=I("link-popup");function YF(n){return wt(n,"link")}function Ju(n){var t,e;return(e=(t=n.getAttribute("link"))!=null?t:n.textContent)!=null?e:""}function QF(n,t,e){var i,o,s,l;if(n.isBlockWritable(t)&&e&&hr(e)){const c=e,d=(o=(i=n.editorBoxes.getBoxClass(lu(c))).getBoxProperties)==null?void 0:o.call(i,n,c);if(d!=null&&d.boxCommands){const h=(l=(s=d.boxCommands["hovering-toolbar"])==null?void 0:s.commands)!=null?l:[];return{element:e,commands:h}}return{element:null,commands:[]}}if(n.isWritable()&&e&&nt(n,t)&&YF(e)){const c=B("a",["link-href-button"],null,Ju(e));c.href=Ju(e),c.target="_blank",c.rel="noopener noreferrer";const d=[{id:"link-text",name:Ju(e),disableTooltip:!0,element:c},{id:"edit-link",name:D.t("link.edit"),icon:s0},{id:"remove-link",name:D.t("link.remove"),icon:IT}];return{element:e,commands:d}}return Gv(n,t,"hovering-toolbar")}function ak(n,t,e){var l;const r=Wo(t,e),i=n.getBlockText(t),o={start:0,end:0};let s=(l=e.textContent)!=null?l:"";for(let c=0;c<i.length;c++){const d=i[c];if(o.end+d.insert.length>=r.end){o.end+=d.insert.length,s=d.insert;break}o.start<r.start&&(o.start+=d.insert.length,o.end=o.start)}return[o,s]}function JF(n,t,e){const[r,i]=ak(n,t,e);n.selection.selectBlock(t,r.start,r.end);const o=Ju(e),s=(h,C)=>{try{const E=n.getBlockText(t),x=K1(E,r.start,r.end-r.start),v=to(x,r.start,h,{link:C});n.setBlockText(t,v),n.selection.selectBlock(t,r.start+h.length),n.focus()}catch(E){XF.error(E)}},l=()=>{n.selection.selectBlock(t,r.end),n.focus()},c=Wi(n,t,n.selection.range)[0];if(!c)return;const d=Yi(n,t,"link-button-anchor",c);Qu(n,{target:d,linkText:i,linkUrl:o,onFinished:s,onClose:l})}function ZF(n,t,e){const[r]=ak(n,t,e),i=n.getBlockText(t),o=Ju(e),s=xa(r.start,r.end-r.start,i,"link",o);n.setBlockText(t,s),n.selection.selectBlock(t,r.end)}function tK(n,t,e,r){var s,l,c;if(e){if(n.isBlockWritable(t)&&hr(e)){const h=e,C=(l=(s=n.editorBoxes.getBoxClass(lu(h))).getBoxProperties)==null?void 0:l.call(s,n,h);if(C!=null&&C.boxCommands){C.boxCommands["hovering-toolbar"].executeCommand(n,t,h,r);return}return}const d=x0(n);d==null||d.disableTextToolbar(),d==null||d.hide(),setTimeout(()=>{d==null||d.enableTextToolbar()},400),r.id==="edit-link"?JF(n,t,e):r.id==="remove-link"&&ZF(n,t,e);return}const i=zv(n,t);if(!i)return;const o=(c=i.blockCommands)==null?void 0:c["hovering-toolbar"];!o||o.executeCommand(n,t,r)}function b0(){let n=8;for(;n>0&&!document.querySelector(`div[data-style-heading='${n}']`);)n--;return n}function qr(n){const e=n.selection.range;if(e.isCollapsed()||e.start.blockId!==e.end.blockId||!e.start.isSimple()||!e.end.isSimple()||e.end.offset-e.start.offset!==1)return!1;const r=n.getBlockById(e.start.blockId);return Eu(n,r,e.start.offset).charType==="box"}const eK=[Yh,Qh,Jh,Zh,t0,e0,n0,r0];class nK{constructor(t){m(this,"id","BlockTurnIntoCommandProvider");this.editor=t}getHeadingIndex(){let t=b0();return t<=4?t=5:t<8&&(t+=1),t}getAvailableCommands(t,e,r){if(!nt(t,e))return[];if(qr(t))return[];const i=lt(e),o=Dt(e),s=Dr(t,e),c=t.getBlockData(e).heading,d=[];for(let C=0;C<this.getHeadingIndex();C++)d.push({id:`heading-${C+1}`,name:D.t("commands.heading",{name:`${C+1}`}),icon:eK[C],states:c===C+1?["checked"]:[],value:`${C+1}`});const h=C=>{var x;const E=B("span",["toolbar-item-name-container"],null);for(const v of C.children)if((x=v.states)!=null&&x.includes("checked"))return E.innerHTML=v.icon||Ka,E;return E.innerHTML=Ka,E};return[{id:"turn-into",name:D.t("commands.headingGroup"),blockId:i,blockType:o,blockKind:s,element:h,groupIndex:200,dropdown:!0,manualShowChildren:!0,childrenPlacement:"bottom-start",defaultCheckedChildren:["text"],children:[{id:"text",name:D.t("commands.text"),icon:Ka,states:c?[]:["checked"]},...d],childrenType:"menu"}]}applyHeadingStyle(t,e,r){t.updateBlockData(e,{heading:r})}executeCommand(t,e,r,i){if(qr(t))return!1;if(nt(t,e)&&(i.id.startsWith("heading-")||i.id==="text")){const o=i.value?Number(i.value):null;return this.applyHeadingStyle(t,e,o),!0}return!1}}const rK=8,Se=I("list-block"),v0=I("list-block");function Kt(n){return Dt(n)==="list"}function Ue(n){p(v0,Kt(n),"not a list block")}function Jn(n){Ue(n);const t=n.getAttribute("data-list-type");return p(v0,t,"no list type"),t}function B0(n){return Kt(n)&&Jn(n)==="text-only"}function Zn(n){var t,e;return Ue(n),(e=Number.parseInt((t=n.getAttribute("data-list-start"))!=null?t:"1",10))!=null?e:1}function sn(n){var t,e;return Ue(n),(e=Number.parseInt((t=n.getAttribute("data-list-level"))!=null?t:"1",10))!=null?e:1}function Ya(n){Ue(n);const t=n.getAttribute("data-list-group-id");return p(v0,t,"no group id"),t}function ss(n){var o,s,l,c,d;Ue(n);const t=(o=n.getAttribute("data-list-type"))!=null?o:"ordered",e=(l=Number.parseInt((s=n.getAttribute("data-list-start"))!=null?s:"1",10))!=null?l:1,r=(d=Number.parseInt((c=n.getAttribute("data-list-level"))!=null?c:"1",10))!=null?d:1,i=n.getAttribute("data-list-group-id");return p(v0,i,"no group id"),{type:t,start:e,level:r,groupId:i}}function NC(n){switch(n){case"ordered":return{ordered:!0,checkbox:null,textOnly:null};case"unordered":return{ordered:!1,checkbox:null,textOnly:null};case"checked":return{checkbox:"checked",ordered:!1,textOnly:null};case"unchecked":return{checkbox:"unchecked",ordered:!1,textOnly:null};case"text-only":return{checkbox:null,ordered:!1,textOnly:!0};default:return{checkbox:null,ordered:!0,textOnly:!1}}}function iK(n){const t={M:1e3,CM:900,D:500,CD:400,C:100,XC:90,L:50,XL:40,X:10,IX:9,V:5,IV:4,I:1};let e="",r=n;return Object.entries(t).forEach(([i,o])=>{for(;r>=o;)e+=i,r-=o}),e.toLowerCase()}const oK="abcdefghijklmnopqrstuvwxyz";function ck(n){if(n<=0)return`${n}`;const t=(n-1)%26,e=Math.floor((n-1)/26),r=oK[t];return e?ck(e)+r:r}function sK(n){return`${n}`}const uk=[sK,ck,iK];function lK(n,t){const e=uk[(n-1)%uk.length];return e(t)}function aK(n){return["\u2022","\u25E6","\u25AA"][(n-1)%3]}function ls(n,t){Ue(n);const{level:e,groupId:r,type:i}=ss(n);let o=Ae(n);for(;o;){if(!Kt(o))return null;const{level:s,groupId:l,type:c}=ss(o);if(s<e)return null;if(e===s&&((t==null?void 0:t.ignoreGroupId)||r===l)&&(c==="text-only"||i==="text-only"||i===c))return o;o=Ae(o)}return null}function fk(n){return ls(n,{ignoreGroupId:!0})}function dl(n){Ue(n);const{level:t,groupId:e,type:r}=ss(n);let i=Zt(n);for(;i;){if(Kt(i)){const{level:o,groupId:s,type:l}=ss(i);if(t===o&&e===s&&(l==="text-only"||r==="text-only"||r===l))return i;if(o<t)return null}i=Zt(i)}return null}function dk(n){Ue(n);const t=[];let e=ls(n);for(;e;)t.unshift(e),e=ls(e);return t}function Qa(n){Ue(n);const t=[];let e=dl(n);for(;e;)t.push(e),e=dl(e);return t}function Zu(n){Ue(n);let t=ls(n);for(;t;){const e=ls(t);if(!e)return t;t=e}return n}function cK(n){Ue(n);let t=dl(n);for(;t;){const e=dl(t);if(!e)return t;t=e}return null}function hk(n,t){const e=dk(n),r=Qa(n);return t.withSelf?[...e,n,...r]:[...e,...r]}function T0(n){Ue(n);let t=n;const e=dk(n);e.length>0&&(t=e[0]);const r=Ae(t);return!r||!Kt(r)?null:sn(r)<sn(t)?r:null}function uK(n,t){Ue(n);let e=n;for(;e;){const r=sn(e);if(r===t)return e;if(r>t)e=T0(e);else if(r<t)return null}return null}function fK(n){let t=Zu(n);for(;;){const e=T0(t);if(!e)return t;t=Zu(e)}}class dK{constructor(){m(this,"nodeMap",new Map);m(this,"rootNodes",[])}addNode(t,e){const r={block:e,children:[]};if(this.nodeMap.set(e,r),t){const i=this.nodeMap.get(t);p(Se,i,"no parent node"),i.children.push(r)}else this.rootNodes.push(r)}}function mk(n,t){const e=fK(t),r=new dK;r.addNode(null,e);let i=Zt(e);for(;i&&Kt(i);){if(B0(i)){r.addNode(null,i),i=Zt(i);continue}if(sn(i)===0&&Jn(i)!==Jn(e))break;const s=T0(i);r.addNode(s,i),i=Zt(i)}return r.rootNodes}function hK(n){const t=document.fullscreenEnabled||document.mozFullScreenEnabled||document.documentElement.webkitRequestFullScreen,e=r=>{if(r.requestFullscreen)return r.requestFullscreen();if(r.mozRequestFullScreen)return r.mozRequestFullScreen();if(r.webkitRequestFullScreen){try{document.fullscreenElement=n}catch{}return r.webkitRequestFullScreen()}return Promise.resolve(0)};return t?e(n):Promise.resolve(0)}function gk(){const e=(document.exitFullscreen||document.webkitExitFullscreen).bind(document)();try{document.fullscreenElement=null}catch{}return e}function PC(n){return wt(n,"editor-in-mindmap-first")}function FC(n){if(p(Se,Kt(n),"not a list block"),wt(n,"editor-in-mindmap-first")||!su(n))return!0;const t=n.classList,e="editor-mindmap-root-";return!!Array.from(t).find(i=>{if(i.startsWith(e))return i})}function mK(n,t,e){const r=it(n);if(t){const s=it(t);p(Se,r===s,"invalid block container")}const i=Bt(n);if(t){const s=Bt(t);p(Se,i<=s,"invalid block index")}if(z(n,...e),!t||t===n)return;let o=Zt(n);for(;o!==t;)p(Se,o,"no next button"),z(o,...e),o=Zt(o);o&&z(o,...e)}function gK(n){const t=`editor-mindmap-root-${n.id}`,r=it(n).querySelectorAll(`.${t}`);return r[r.length-1]}async function pK(n,t,e){const r=ie(t),i=r.querySelector('[data-button-id="mindmap-fullscreen"]');p(Se,i,"no full screen button");const o=()=>{setTimeout(()=>{e.toMindmap(n,t,{},{reset:!0,mindmapTools:e})},300)},s=()=>{ot(r,"fullscreen"),i.innerHTML=aC,i.setAttribute(`data-editor-tooltip-${n.clientId}-dynamic`,D.t("mindmap.fullScreen")),FC(t)&&setTimeout(()=>{o()},300)};if(document.fullscreenElement===r){try{await gk()}catch(l){Se.error(l)}s()}else{try{z(r,"fullscreen"),await hK(r),o()}catch(l){Se.error(l)}i.innerHTML=hy,i.setAttribute(`data-editor-tooltip-${n.clientId}-dynamic`,D.t("mindmap.exitFullscreen"))}r.onfullscreenchange=()=>{document.fullscreenElement||s()}}function KC(n,t,e,r,i){if(t.querySelector(`[data-button-id="${e}"]`))return null;const s=Cr(e,r,i,[]);return s.setAttribute(`data-editor-tooltip-${n.clientId}-dynamic`,r),z(s,"mindmap-button"),t.appendChild(s),s}function VC(n,t){return n.querySelector(`[data-button-id="${t}"]`)}function CK(n){return VC(n,"mindmap-fullscreen")}function EK(n){return VC(n,"mindmap-fit")}function AK(n){return VC(n,"mindmap-close")}function xK(n,t,e,r){const i=KC(n,t,"mindmap-close",D.t("mindmap.close"),qh);!i||n.domEvents.addEventListener(i,"click",()=>{r.closeMindmap(n,e)})}function bK(n,t,e,r){const i=KC(n,t,"mindmap-fit",D.t("mindmap.autoFit"),dy);!i||n.domEvents.addEventListener(i,"click",()=>{r.fitMindmap(n,e)})}function vK(n,t,e,r){if(navigator.userAgent.includes("Mobile")&&!navigator.userAgent.includes("iPad"))return;const o=KC(n,t,"mindmap-fullscreen",D.t("mindmap.fullScreen"),aC);!o||n.domEvents.addEventListener(o,"click",()=>{pK(n,e,r)})}function BK(n,t){const e=Gd(t);if(!e)return;const r=EK(e);r&&(r.remove(),n.domEvents.removeAllListeners(r));const i=AK(e);i&&(i.remove(),n.domEvents.removeAllListeners(i));const o=CK(e);o&&(o.remove(),n.domEvents.removeAllListeners(o))}const Ja=new Map;function $C(n,t,e){const r=(s,l)=>{s.forEach(c=>{l?z(c.block,"to-mindmap-highlight"):ot(c.block,"to-mindmap-highlight"),r(c.children,l)})},i=mk(n,t);if(i.length===0)return;const o=i[0].block;if(e){const s=Ja.get(o);s&&(s.forEach(l=>l.cancel()),Ja.delete(o)),r(i,!0)}else{const s=setTimeout(()=>{r(i,!1),Ja.delete(o)},300),l=()=>{clearTimeout(s),Ja.delete(o)},c=Ja.get(o);c?c.push({cancel:l}):Ja.set(o,[{cancel:l}])}}const{Markmap:TK}=i9;function yK(n,t){Ue(t);const e=mk(n,t),r=e[0].block,i=d=>({t:"text",v:Ot(d.block).textContent,d:1,c:d.children.length>0?d.children.map(C=>i(C)):void 0});let o=null;e.length>1?o={t:"root",v:"root",d:0,c:e.length>0?e.map(d=>i(d)):void 0}:o=i(e[0]);const l=d=>{if(d.length===0)return null;const h=d[d.length-1];return h.children&&h.children.length>0?l(h.children):h},c=l(e);return{root:o,block:r,nodes:e,last:c}}function y0(n,t,e,r){const{root:i,block:o,last:s}=yK(n,t);r.selectBlock&&n.selection.selectBlock(o,0,0),$C(n,o,!1),r.saveData&&n.updateBlockData(o,{viewAsMindmap:!0});const l=ie(o);let c=l.querySelector(".editor-mindmap-svg");if(r.reset&&(c&&c.remove(),c=null),c)c.innerHTML="";else{const M="http://www.w3.org/2000/svg",U=l.getBoundingClientRect(),F=document.fullscreenElement===l,G=F?`${U.width}`:`${t.getBoundingClientRect().width}`,W=F?`${U.height}`:"600",rt=document.createElementNS(M,"svg");rt.setAttributeNS(null,"viewBox",`0 0 ${G} ${W}`),rt.setAttributeNS(null,"width","100%"),rt.setAttributeNS(null,"height",W),rt.style.display="block",rt.style.width="100%",rt.style.height=`${W}px`,rt.classList.add("editor-mindmap-svg"),l.appendChild(rt),c=rt}const d=o,C=`editor-mindmap-root-${lt(o)}`;z(d,"editor-in-mindmap-first",C,"readonly"),d.contentEditable="false";const E=Zt(o);E&&Bt(E)<=Bt(s.block)&&mK(E,s.block,["block-hidden",C]);const x=(M,U)=>{if(U.length>0){const F=U[0].parentElement;F&&(F.style.width="100vw",F.style.maxWidth="200px")}U.forEach(F=>{z(F,"editor-mindmap-node")})},v=new TK(c,{...e,autoFit:!0});v.viewHooks.transformHtml.tap(x),v.setData(i),v.fit();const R=ie(o);let L=R.querySelector(".mindmap-toolbar");L||(L=B("div",["mindmap-toolbar"],R)),bK(n,L,d,r.mindmapTools),vK(n,L,d,r.mindmapTools),xK(n,L,d,r.mindmapTools),n.domEvents.addEventListener(c,"click",()=>{n.selection.selectBlock(o,0),n.input.focus()}),d.mindMap=v}function kK(n){const t=B("div",["list-to-mindmap-wrap"],null),e=Cr("list-to-mindmap",D.t("mindmap.viewAsMindMap"),fy,[],n.clientId);return t.appendChild(e),t}async function pk(n,t){const e=`editor-mindmap-root-${t.id}`,r=it(t);fe(r).forEach(l=>{wt(l,e)&&ot(l,e,"editor-in-mindmap-first","block-hidden")});const o=ie(t);document.fullscreenElement===o&&await gk();const s=o.querySelector(".editor-mindmap-svg");!s||(p(Se,s,"no mindmap svg"),s.remove(),n.domEvents.removeAllListeners(s),BK(n,t))}function RK(n){const t=n.classList,e="editor-mindmap-root-";return Array.from(t).find(i=>{if(i.startsWith(e))return i})}async function Ck(n,t){!RK(t)||(n.updateBlockData(t,{viewAsMindmap:null}),pk(n,t),n.selection.selectBlock(t,0))}function wK(n,t){const e=t.mindMap;e&&e.fit()}const k0={toMindmap:y0,closeMindmap:Ck,fitMindmap:wK},xct="";class R0{constructor(t){m(this,"toMindmapButton");m(this,"currentBlock",null);m(this,"handleHoveringBlock",t=>{t&&Kt(t)&&Jn(t)!=="unchecked"&&Jn(t)!=="checked"&&this.editor.isWritable()?ie(t).appendChild(this.toMindmapButton):this.toMindmapButton.remove()});m(this,"handleMouseEnter",()=>{const t=J(this.toMindmapButton);p(Se,t&&Kt(t),"no parent list"),$C(this.editor,t,!0),this.currentBlock=t});m(this,"handleMouseLeave",()=>{this.currentBlock&&($C(this.editor,this.currentBlock,!1),this.currentBlock=null)});m(this,"handleClick",()=>{const t=J(this.toMindmapButton);p(Se,t&&Kt(t),"no parent list"),y0(this.editor,t,{},{saveData:!0,selectBlock:!0,mindmapTools:k0})});this.editor=t,Te.get(this.editor).addListener("change",this.handleHoveringBlock),this.toMindmapButton=kK(t),t.domEvents.addEventListener(this.toMindmapButton,"mouseenter",this.handleMouseEnter),t.domEvents.addEventListener(this.toMindmapButton,"mouseleave",this.handleMouseLeave),t.domEvents.addEventListener(this.toMindmapButton,"click",this.handleClick)}static get(t){return t.findCustomByType(R0)}destroy(){Te.get(this.editor).removeListener("change",this.handleHoveringBlock)}hide(){this.currentBlock&&(this.currentBlock=null),this.toMindmapButton.remove()}}function SK(n,t,e){var r;t==="beginDrag"&&((r=R0.get(n))==null||r.hide())}function Za(n,t,e,r){var o;const i=(o=r==null?void 0:r.groupId)!=null?o:tt();t.forEach(s=>{const l=n.getBlockData(s);if(l.start!==e||(r==null?void 0:r.resetGroupId)){const c={...l,start:e};r!=null&&r.resetGroupId&&(c.groupId=i),n.updateBlockData(s,c)}l.textOnly||(e+=1)})}function HC(n,t,e,r){const i=hk(t,{withSelf:!0});i.length!==0&&Za(n,i,e,r)}class w0{constructor(t,e){m(this,"listStart",0);m(this,"listBrother",null);if(this.editor=t,B0(e))return;const r=Zu(e),i=Zn(r);this.listStart=i,r===e?this.listBrother=dl(r):this.listBrother=r}fix(){!this.listBrother||HC(this.editor,this.listBrother,this.listStart)}}class hl{constructor(t,e,r){m(this,"listStart");m(this,"listBrother",null);this.editor=t,this.options=r;const i=Zu(e),o=Zn(i);this.listStart=o,this.listBrother=i,r!=null&&r.resetStart&&(this.listStart=1)}fix(){!this.listBrother||HC(this.editor,this.listBrother,this.listStart,this.options)}}class Ek{constructor(t,e,r){m(this,"listStart");m(this,"listNextBrothers",[]);this.editor=t,this.listNextBrothers=Qa(e);const{start:i,resetStart:o}=r||{};this.listStart=o?1:i!=null?i:1}fix(){!this.listNextBrothers.length||Za(this.editor,this.listNextBrothers,this.listStart)}}function LK(n,t,e){n.getBlockData(t).quoted&&(e.quoted=!0)}function jC(n,t,e,r){if(Se.debug("drag a block on a list block"),!nt(n,t))return!1;p(Se,Kt(e),"target is not a list block");const{type:i,start:o,level:s,groupId:l}=ss(e),c=r==="after"?o+1:o,d=n.getBlockData(t),h={id:tt(),type:"list",groupId:l,level:s,start:c,text:d.text,...NC(i)};LK(n,e,h);let C=Bt(e);const E=it(e);r==="after"&&(C+=1);let x=null;Kt(t)&&(x=new w0(n,t));const v=n.insertBlock(ut(E),C,h,gh(h.id,0));return n.deleteBlock(t),new hl(n,v).fix(),x==null||x.fix(),!0}function IK(n,t,e,r){if(Se.debug("drag a list between text blocks"),r==="after"){const d=Zt(e);if(d&&Kt(d))return jC(n,t,d,"before")}if(r==="before"){const d=Ae(e);if(d&&Kt(d))return jC(n,t,d,"after")}const o={...n.getBlockData(t),groupId:tt(),start:1,level:1};let s=Bt(e);const l=it(e);r==="after"&&(s+=1),n.insertBlock(ut(l),s,o,gh(o.id,0));const c=new w0(n,t);return n.deleteBlock(t),c.fix(),!0}function DK(n,t,e,r,i){if(Vd(e))return!1;const{blockId:o}=e,s=n.getBlockById(o);p(Se,s,"no dragged block");const{isSourceBlock:l,targetBlock:c}=i;return!l&&c?(p(Se,t===c,"block !== target block"),p(Se,Kt(c),"target is not a list block"),jC(n,s,c,r)):IK(n,s,c,r)}function Ak(n,t){if(!n.isWritable())return!1;const e=n.selection.range,i=n.editorCommandProviders.getCommands(e).find(o=>o.id===t);return i?(n.editorCommandProviders.executeCommand(e,i,{}),!0):!1}const _K={"Shift+CtrlOrCmd+L":n=>Ak(n,"ordered-list"),"Shift+CtrlOrCmd+U":n=>Ak(n,"unordered-list")};function S0(n){const t=n.getAttribute("block-padding-level");return t?Number(t):null}function MK(n,t){let e;const r=S0(t);if(!r)e=1;else{if(r>=12)return e=12,!1;e=r+1}return n.updateBlockData(t,{...n.getBlockData(t),padding:e}),!0}function xk(n,t){const e=S0(t);if(!e)return!1;const r=n.getBlockData(t);return e>1?(n.updateBlockData(t,{...r,padding:e-1}),!0):(n.updateBlockData(t,{...r,padding:null}),!0)}function zC(n){return n.readonly||!n.isWritable()}function UK(n){return n.selection.range.getSelectedBlocks().forEach(e=>{const r=e.block;nt(n,r)&&MK(n,r)}),!0}function OK(n){return n.selection.range.getSelectedBlocks().forEach(e=>{const r=e.block;nt(n,r)&&xk(n,r)}),!0}function NK(n){return zC(n)?!1:n.undoManager.runInGroup(()=>(UK(n),!0))}function PK(n){return zC(n)?!1:n.undoManager.runInGroup(()=>(OK(n),!0))}function FK(n){if(zC(n))return!1;if(!n.selection.range.isCollapsed())return;const t=n.selection.focusedBlock;if(!nt(n,t))return;const e=n.selection.range.focus;if(!(!e.isSimple()||e.offset!==0||!S0(t)))return xk(n,t),!0}class GC{renderBlock(t,e,r){const{padding:i}=r;return i?{attributes:{"block-padding-level":i}}:{}}}const bct="",KK={Tab:NK,"Shift+Tab":PK,Backspace:FK};function VK(n,t,e=1){if(!t)return null;let r=Ae(n);for(;r;){const i=r.getAttribute("data-style-heading"),o=Number(r.getAttribute("data-list-level"));if(i){if(i<t)return null;if(i===t&&o===e)return Kt(r)?r:null}r=Ae(r)}return null}function $K(n,t){const e=n.getAttribute("data-style-heading"),r=VK(n,e);if(r)return r;const i=Ae(n);if(i&&Kt(i)&&Jn(i)===t)return i;const o=Zt(n);return o&&Kt(o)&&Jn(o)===t?o:null}function HK(n,t,e){var R,L,M;const r=(R=e.data)!=null?R:{};let i=1;if(Kt(t))i=sn(t);else{const U=S0(t);U&&(i=U+1),i>8&&(i=8)}const o=(L=r.listType)!=null?L:"ordered";if(o==="text-only")return null;const s=n.getBlockData(t);let l=(M=s.text)!=null?M:[],d=de(l);const h=e.offset||0;h<=dn(l)&&(l=Dn(l,h).right,d=d.substring(0,h));let C=1;o==="ordered"&&(C=Number.parseInt(d,10)||1);let E=tt();const x=$K(t,o);if(x)if(sn(x)===i){if(Bt(t)>Bt(x))C=Zn(x)+1;else{const U=Zn(x);U>1&&(C=U-1),new Ek(n,x,{start:C+1}).fix()}E=Ya(x)}else{const U=uK(x,i);U&&(C=Zn(U)+1)}else Kt(t)&&new Ek(n,t,{start:1}).fix();const v={id:tt(),type:"list",level:i,start:C,groupId:E,ordered:!1,text:l};return s.quoted&&(v.quoted=!0),s.heading&&(v.heading=s.heading),o==="ordered"?v.ordered=!0:(o==="checked"||o==="unchecked")&&(v.checkbox=o),{blockData:v,onConverted:(U,F)=>{new hl(U,F).fix()}}}function tc(n){return n.textOnly?"text-only":n.checkbox?n.checkbox:n.ordered?"ordered":"unordered"}function jK(n){var e,r;if(n.checkbox)return"";const t=(e=n.level)!=null?e:1;return n.ordered?`${lK(t,(r=n.start)!=null?r:1)}.`:aK(t)}function L0(n){return n==="checked"||n==="unchecked"}function bk(n,t,e,r){const i=t,{containerId:o,blockIndex:s}=r[r.length-1];if(s===0)return!0;const l=e.blocks[o][s-1];if(l.type!=="list")return!0;const c=tc(i),d=tc(l);return c!==d&&(!L0(c)||!L0(d))||(i.level||1)>(l.level||1)}function vk(n,t,e,r){const i=t,{containerId:o,blockIndex:s}=r[r.length-1];if(s===e.blocks[o].length-1)return!0;const l=e.blocks[o][s+1];if(l.type!=="list")return!0;const c=tc(i),d=tc(l);return c!==d&&(!L0(c)||!L0(d))||(i.level||1)>(l.level||1)}function zK(n,t,e,r,i){var s,l,c;const o=t;if(r==="text")return((s=Un.convertTo)==null?void 0:s.call(Un,n,t,e,"text",i))||"";if(r==="markdown"){let d=((l=Un.convertTo)==null?void 0:l.call(Un,n,t,e,"markdown",i))||"";o.checkbox==="checked"?d=`[x] ${d}`:o.checkbox==="unchecked"&&(d=`[ ] ${d}`),o.ordered?d=`${o.start}. ${d}`:d=`- ${d}`;const h=o.level||0;return d=(h>0?" ".repeat(h-1):"")+d,bk(n,t,e,i)&&(d=`${d}`),vk(n,t,e,i)&&(d=`${d}`,h<=1&&(d+=`
|
|
613
|
+
`,cP=Object.freeze(Object.defineProperty({__proto__:null,ClearIcon:ty,CloseIcon:qh,PrevIcon:pT,NextIcon:CT,MoreIcon:qp,TextColorIcon:Xp,ArrowDownIcon:Xh,ArrowUpIcon:GN,ArrowLeftIcon:WN,ArrowRightIcon:Yp,DeleteRowIcon:ET,DeleteColIcon:AT,MergeCellIcon:xT,SplitCellIcon:bT,DeleteTableIcon:vT,Heading1Icon:Yh,Heading2Icon:Qh,Heading3Icon:Jh,Heading4Icon:Zh,Heading5Icon:t0,Heading6Icon:e0,Heading7Icon:n0,Heading8Icon:r0,HeadingNIcon:qN,OrderedListIcon:BT,UnorderedListIcon:TT,CheckListIcon:yT,BlockquoteIcon:kT,AlignCenterIcon:o0,AlignLeftIcon:Fa,AlignRightIcon:i0,ImageIcon:RT,ImageMenuIcon:wT,ImageErrorIcon:Jp,ImageEmptyIcon:LT,LinkIcon:nC,LinkOffIcon:IT,WarningIcon:Qp,PasteSpecialIcon:ST,LaunchIcon:Zp,CodeIcon:zT,AudioIcon:VT,GraphIcon:XN,VideoIcon:$T,FileIcon:YN,MathIcon:JN,MathMenuIcon:DT,TableIcon:ZN,TableMenuIcon:_T,BilibiliIcon:UT,YoukuIcon:OT,ModaoIcon:PT,FigmaIcon:NT,EditIcon:s0,CommentIcon:ll,RefreshIcon:MT,HelpIcon:tC,CheckMarkIcon:eC,TextIcon:Ka,RightArrowIcon:QN,TencentVideoIcon:FT,WebPageIcon:KT,UmlIcon:HT,DividingLineIcon:jT,HeadingH1Icon:tP,HeadingH2Icon:eP,HeadingH3Icon:nP,HeadingH4Icon:rP,HeadingH5Icon:iP,HeadingH6Icon:oP,HeadingH7Icon:sP,HeadingH8Icon:lP,CheckboxIcon:rC,QuoteIcon:iC,LinkHrefIcon:aP,OrderedIcon:sC,UnorderedIcon:oC,CopyIcon:GT,CutIcon:WT,DeleteIcon:qT,LockBlockIcon:XT,UnLockBlockIcon:YT,InsertBeforeIcon:QT,InsertAfterIcon:JT,MentionIcon:ZT,CircleAddIcon:ey,LoadingIcon:ny,DragIcon:lC,UmlBrandIcon:l0,OnesLoadingIcon:ry,BoldIcon:iy,ItalicIcon:oy,UnderlineIcon:sy,LineThroughIcon:ly,SubscriptIcon:cy,SuperscriptIcon:uy,InlineCodeIcon:ay,ToMindMapIcon:fy,FitIcon:dy,FullScreenIcon:aC,ExitFullScreenIcon:hy,CaretDownIcon:my,StatusIcon:gy},Symbol.toStringTag,{value:"Module"}));function py(){const n=B("span",["editor-loading-icon"],null);return n.innerHTML=ry,n}const act="";function uP(n,t){const e=B("button",["editor-checkbox-wrapper"],null);e.setAttribute("data-button-id",n),t!=null&&t.includes("checked")&&z(e,"checked"),t!=null&&t.includes("disabled")&&(e.disabled=!0);const r=B("span",["editor-checkbox"],e);return B("span",["editor-checkbox-inner"],r),e}const cct="",Va=I("ui-command-bar-base"),fP={itemElementTag:"div",tippyArrow:!1},wA=class extends Be.TypedEmitter{constructor(e,r,i){var o,s;super();m(this,"content");m(this,"items");m(this,"subBar",null);m(this,"parentItem",null);m(this,"closeable",null);m(this,"closeReason",null);m(this,"options");m(this,"id");m(this,"header",null);m(this,"footer",null);m(this,"handleDocumentKeydown",e=>{if(!!this.isVisible&&!e.isComposing&&!qs(e.target)){if(this.subBar){this.subBar.handleDocumentKeydown(e);return}if(this.items.length!==0){if(e.key==="Escape"){this.close("cancelBar");return}if(e.key==="ArrowUp"){const r=this.getPrevItemIndex(this.getSelectedItemIndex());this.startPauseMouseEnter(),this.selectItem(this.items[r].id),e.preventDefault(),e.stopPropagation()}else if(e.key==="ArrowDown"){const r=this.getNextItemIndex(this.getSelectedItemIndex());this.startPauseMouseEnter(),this.selectItem(this.items[r].id),e.preventDefault(),e.stopPropagation()}else if(e.key==="ArrowRight"){const r=this.getSelectedItem();r&&r.children&&this.showSubCommandBar(r.childrenMenuId)}else if(e.key==="ArrowLeft")this.parentItem&&this.close("switchItem");else if(e.key==="Enter"){const r=this.getSelectedItemIndex();if(r===-1)return;const i=this.items[r],o=this.getItemElementById(i.id);o&&this.emit("click",this,i,o)}}}});m(this,"handleDocumentMouseDown",e=>{if(e.target instanceof Element&&!this.isInCommandBar(e.target)){const r=this.listeners("closing");for(let i=0;i<r.length;i++)if(r[i](this,e)===!1)return;this.close("clickBackground")}});m(this,"handleHidden",()=>{this.closeReason!=="fromHover"&&this.emit("close",this),this.close(null),Hg(this.id)});m(this,"handleShow",()=>{this.popper&&(this.popper.setAttribute("data-command-bar-id",this.id),this.options.classes&&z(this.popper,...this.options.classes),this.options.refuseOverflow&&this.popper.classList.add("reference-hidden")),this.emit("show",this),this.options.disablePageScroll&&$g(this.id)});m(this,"lastEnterPauseTime",0);m(this,"startPauseMouseEnter",()=>{this.lastEnterPauseTime=Date.now()});m(this,"handleItemMouseEnter",e=>{if(Date.now()-this.lastEnterPauseTime<100)return;const r=this.getParentCommandItemElement(e.target);if(!r)return;const i=this.getItemElementId(r),o=this.getItemById(i);if(this.selectItem(i),o.manualShowChildren)return;const s=o.childrenMenuId||"";this.showSubCommandBar(s)});m(this,"handleItemMouseLeave",e=>{var i,o;const r=this.getParentCommandItemElement(e.target);!r||((o=(i=this.subBar)==null?void 0:i.parentItem)==null?void 0:o.id)!==this.getItemElementId(r)&&(ot(r,"selected"),this.emit("selectionChange",this,""))});m(this,"handleItemClick",e=>{const r=this.getParentCommandItemElement(e.target);if(!r)return;const i=this.getItemElementId(r),o=this.items.find(s=>s.id===i);if(!!o&&!(o.states&&o.states.indexOf("disabled")!==-1)){if(o.children&&o.children.length>0&&o.manualShowChildren){this.showSubCommandBar(o.childrenMenuId);return}o.element||(this.emit("click",this,o,r),this.options.autoClose&&this.close("clickItem"))}});m(this,"handleWheel",e=>{if(!this.options.disablePageScroll&&!document.querySelector(".editor-disable-scroll"))return;const r=e.target;if(!r||!(r instanceof Node))return;const i=r instanceof HTMLElement?r:r.parentElement;if(!i)return;const o=Ge(i);if(!re(this.content,o)){e.stopPropagation(),e.preventDefault();return}e.deltaY<0?o.scrollTop===0&&(e.stopPropagation(),e.preventDefault()):e.deltaY>0&&o.scrollTop+o.clientHeight>=o.scrollHeight&&(e.stopPropagation(),e.preventDefault())});this.id=(o=i==null?void 0:i.id)!=null?o:tt(),this.options={...fP,...i},this.items=e,this.parentItem=(s=i==null?void 0:i.parentItem)!=null?s:null,this.closeable=r!=null?r:null,this.content=this.createCommandBarContent(e)}close(e){this.closeReason=e,this.subBar&&this.subBar.close(e),document.removeEventListener("keydown",this.handleDocumentKeydown),document.removeEventListener("mousedown",this.handleDocumentMouseDown)}click(e,r){this.emit("click",this,e,r)}createPopperOptions(){var i,o;const e={modifiers:[]},r=this.options.overflowBoundary;return r&&((i=e==null?void 0:e.modifiers)==null||i.push({name:"flip",options:{boundary:r,fallbackPlacements:["top","bottom"]}})),this.options.padding&&((o=e==null?void 0:e.modifiers)==null||o.push({name:"preventOverflow",options:{padding:this.options.padding}})),e}destroy(){var e;this.close(null),this.removeAllListeners(),(e=this.subBar)==null||e.destroy(),this.subBar=null,this.closeable=null,this.content.removeEventListener("wheel",this.handleWheel)}get isSubCommandBar(){return!!this.parentItem}updateItems(e){var i;this.subBar&&e.findIndex(s=>{var l,c;return s.id===((c=(l=this.subBar)==null?void 0:l.parentItem)==null?void 0:c.id)})===-1&&((i=this.subBar)==null||i.destroy(),this.subBar=null),this.items=e;const r=this.createCommandBarContent(e);this.content.innerHTML="",Array.from(r.children).forEach(o=>{this.content.appendChild(o)})}get popper(){return this.content.closest("[data-tippy-root]")}getSelectedItemIndex(){const e=this.getSelectedItem();return e?this.items.indexOf(e):-1}getPrevItemIndex(e){if(e<=0)return this.items.length-1;let r=e-1;for(;;){const i=this.items[r],o=i.type,l=!(i.states&&i.states.indexOf("disabled")!==-1);if(o!=="separator"&&o!=="section"&&l)return r;if(r-=1,r<0)return this.items.length-1}}getNextItemIndex(e){let r=e+1;for(;;){if(!this.items[r])return this.getNextItemIndex(-1);const i=this.items[r],o=i.type,l=!(i.states&&i.states.indexOf("disabled")!==-1);if(o!=="separator"&&o!=="section"&&l)return r;if(r+=1,r>this.items.length-1)return 0}}clearSelectedItem(){const e=this.getSelectedItem();if(!e)return;const r=this.getItemElementById(e.id);r&&ot(r,"selected")}selectItem(e){const r=this.getSelectedItem();if(r){if(r.id===e)return;const o=r.id,s=this.getItemElementById(o);s&&ot(s,"selected")}const i=this.getItemElementById(e);i?(z(i,"selected"),this.emit("selectionChange",this,i.getAttribute("data-id")||""),this.options.disableSelectedScroll||i.scrollIntoView({block:"nearest"})):this.emit("selectionChange",this,"")}showSubCommandBar(e){var s,l,c,d;const r=this.getSelectedItem();if(!r||!r.children&&((l=(s=this.subBar)==null?void 0:s.parentItem)==null?void 0:l.manualShowChildren))return;if(this.subBar){if(((c=this.subBar.parentItem)==null?void 0:c.id)===r.id){r.manualShowChildren&&this.subBar.close("switchItem");return}this.subBar.destroy(),this.subBar=null}if(!r.children)return;const i=this.getItemElementById(r.id);if(!i)return;const o=wA.createSubCommandBar(r,(d=this.closeable)!=null?d:this,e?{id:e}:{});this.subBar=o,this.subBar.on("click",(h,C,E)=>{this.emit("click",h,C,E)}),this.subBar.on("close",()=>{var h;(h=this.subBar)==null||h.destroy(),this.subBar=null,ot(i,"active")}),r.beforePopup&&r.beforePopup(o),this.subBar.manualShow(i,this.getSubBarOptions(r)),z(i,"active")}isInCommandBar(e){if(!e||!(e instanceof Node))return!1;const r=this.getCommandBarRoot();return r&&re(r,e)||re(this.content,e)?!0:this.subBar?this.subBar.isInCommandBar(e):!1}createCommandItem(e){var o,s,l,c;let r=(o=this.options.itemElementTag)!=null?o:"div";e.element&&(r="div");const i=B(r,["command-item"],null);return i.setAttribute("data-id",e.id),e.type==="separator"?i.classList.add("separator"):e.type==="section"?(i.classList.add("section","text"),e.element&&(typeof e.element=="function"?i.appendChild(e.element(e)):i.appendChild(e.element))):((s=e.states)!=null&&s.includes("selected")&&i.classList.add("selected"),(l=e.states)!=null&&l.includes("checked")&&i.classList.add("checked"),(c=e.states)!=null&&c.includes("disabled")&&i.classList.add("disabled"),i.onclick=this.handleItemClick,i.onmouseenter=this.handleItemMouseEnter,i.onmouseleave=this.handleItemMouseLeave,e.element?typeof e.element=="function"?i.appendChild(e.element(e)):i.appendChild(e.element):i.classList.add("standard")),this.initItemElement(e,i),i}getItemById(e){const r=this.items.find(i=>i.id===e);return p(Va,r,`can not find command item for id: ${e}`),r}getSelectedItem(){const e=this.content.querySelector(":scope >.editor-command-bar >.command-item.selected");if(e){const r=this.getItemElementId(e),i=this.items.find(o=>o.id===r);return p(Va,i,`can not find command item for id: ${r}`),i}return null}getItemElementId(e){const r=e.getAttribute("data-id");return p(Va,r,"no data-id attribute"),r}getItemElementById(e){const r=this.content.querySelector(`:scope >.editor-command-bar > .command-item[data-id="${e}"]`);return p(Va,r,`no exists command item, id=${e}`),r}getParentCommandItemElement(e){if(!e||!(e instanceof Element))return null;if(wt(e,"command-item"))return e;const r=e.closest(".command-item");return r||null}createCommandBarContent(e){this.content&&this.content.removeEventListener("wheel",this.handleWheel);const r=B("div",["editor-command-bar-root"],null);if(this.options.header){const o=B("div",["editor-command-bar-header"],null);if(this.options.header instanceof Function){const s=this.options.header();s&&o.appendChild(s)}else o.appendChild(this.options.header);this.header=o,this.header&&r.appendChild(this.header)}const i=B("div",["editor-command-bar"],r);if(e.forEach(o=>{var l;const s=this.createCommandItem(o);i.appendChild(s),o.element&&o.setCloseable&&o.setCloseable((l=this.closeable)!=null?l:this)}),this.options.footer){const o=B("div",["menu-item","editor-command-bar","footer"],null);if(this.options.footer instanceof Function){const s=this.options.footer();s&&o.appendChild(s)}else o.appendChild(this.options.footer);this.footer=o,this.footer&&r.appendChild(this.footer)}return(this.options.header||this.options.footer)&&z(r,"scrollable-bar"),this.initCommandBarElement(i),r.addEventListener("wheel",this.handleWheel,{passive:!1}),r}getSubBarOptions(e){var r;return{placement:(r=e.childrenPlacement)!=null?r:"right-start",offset:e.childrenOffset,arrow:e.childArrow}}static registerManualCommandBar(e,r){this.commandBarCreators.set(e,r)}static createSubCommandBar(e,r,i){var l;p(Va,e.children&&e.children.length>0,"no item children");const o=(l=e.childrenType)!=null?l:"menu",s=this.commandBarCreators.get(o);return p(Va,s,`no creator for command type: ${o}`),s(e,r,i)}static hasExistsCommandBar(){return!!document.querySelector("[data-command-bar-id]")}};let al=wA;m(al,"commandBarCreators",new Map),I("ui-command-bar");class a0 extends al{constructor(){super(...arguments);m(this,"tippyInstance",null)}manualShow(e,r){var i,o,s;if(!this.isVisible){if(this.tippyInstance&&(this.tippyInstance.destroy(),this.tippyInstance=null),this.tippyInstance=n9.default(e,{interactive:!0,content:this.content,trigger:"manual",triggerTarget:null,hideOnClick:!1,placement:(i=r==null?void 0:r.placement)!=null?i:"bottom-start",maxWidth:650,arrow:(o=r==null?void 0:r.arrow)!=null?o:this.options.tippyArrow,appendTo:document.body,onShow:this.handleShow,onHidden:this.handleHidden,theme:r==null?void 0:r.theme,getReferenceClientRect:r==null?void 0:r.getReferenceClientRect,offset:(s=r==null?void 0:r.offset)!=null?s:[0,0],popperOptions:this.createPopperOptions()}),r!=null&&r.point){const{x:l,y:c}=r.point;this.tippyInstance.setProps({getReferenceClientRect:()=>new DOMRect(l,c,0,0)})}this.clearSelectedItem(),this.tippyInstance.show(),this.parentItem||(document.addEventListener("keydown",this.handleDocumentKeydown),document.addEventListener("mousedown",this.handleDocumentMouseDown)),this.popper&&this.options.id&&this.popper.setAttribute("data-command-bar-id",this.options.id)}}close(e){var r;super.close(e),this.isVisible&&((r=this.tippyInstance)==null||r.hide())}destroy(){var e;(e=this.tippyInstance)==null||e.destroy(),this.tippyInstance=null,super.destroy()}getCommandBarRoot(){return this.content.closest("[data-tippy-root]")}get isVisible(){var e,r;return(r=(e=this.tippyInstance)==null?void 0:e.state.isVisible)!=null?r:!1}get popper(){return this.content.closest("[data-tippy-root]")}}const Cy=I("ui-base");class $a extends a0{constructor(t,e){var o;const i=[{id:(o=e==null?void 0:e.id)!=null?o:`popup-${tt()}`,name:"",element:t}];super(i,void 0,{disablePageScroll:!0,id:e==null?void 0:e.id})}initCommandBarElement(t){z(t,"popper")}initItemElement(t,e){}get popupContent(){const t=this.items[0];p(Cy,t,"no dialog item");const e=typeof t.element=="function"?t.element(t):t.element;return p(Cy,e,"no item element"),e}}const co=I("filterable-list");function Ey(n){var e,r;const t=B("div",["list-item"],null);return t.setAttribute("data-id",n.id),t.appendChild(B("div",["list-item-text"],null,n.name)),(e=n.states)!=null&&e.includes("selected")&&(z(t,"selected"),Os(eC,["list-item-selected-icon"],t)),(r=n.states)!=null&&r.includes("disabled")&&z(t,"disabled"),t}function Ay(n){const t=B("div",["list-root"],null);return n.forEach(e=>{t.appendChild(Ey(e))}),n.length||t.appendChild(Ey({id:"placeholder",states:["disabled"],name:D.t("search.emptyTips")})),t}function xy(n,t){return n.map(e=>({...e,states:t===e.id?["selected"]:[]}))}function dP(n,t){const e=B("div",["filterable-list"],null),r=B("div",["filter"],e),i=B("div",["filter-container"],r),o=B("input",["filter-input"],i);t&&t.placeholder&&(o.placeholder=t.placeholder);const s=B("div",["list"],e),l=Ay(xy(n,t==null?void 0:t.initialSelectedId));return s.appendChild(l),e}function by(n,t,e){const r=n.querySelector(".list");p(co,r,"no list root");const i=Ay(xy(t,e)),o=r.querySelector(".list-root");if(p(co,o,"no exists menu"),tu(o,i),e){const s=r.querySelector(".list-item.selected");s&&(p(co,s,"no selected menu item"),s.scrollIntoView({block:"nearest"}))}}class hP{constructor(t,e){m(this,"root");m(this,"visibleItems");m(this,"selectedId");m(this,"filter","");m(this,"onSelected",null);m(this,"handleKeydown",t=>{this.processKeyDown(t)});m(this,"handleInputChanged",()=>{const t=this.root.querySelector(".filter-input");p(co,t,"no input");const e=t.value.toLocaleLowerCase();this.setFilter(e)});m(this,"handleClick",t=>{this.processClick(t)});var r;this.items=t,this.options=e,this.root=dP(t,e),this.bindEvents(),this.selectedId=(r=e==null?void 0:e.initialSelectedId)!=null?r:"",this.visibleItems=t}bindEvents(){const t=this.root.querySelector(".filter-input");p(co,t,"no input"),t.addEventListener("keyup",this.handleInputChanged),t.addEventListener("keydown",this.handleKeydown),this.root.addEventListener("click",this.handleClick)}unbindEvents(){const t=this.root.querySelector(".filter-input");p(co,t,"no input"),t.removeEventListener("keyup",this.handleInputChanged),t.removeEventListener("keydown",this.handleKeydown),this.root.removeEventListener("click",this.handleClick)}destroy(){this.unbindEvents(),this.onSelected=null}getSelectedIndex(){return this.selectedId?this.visibleItems.findIndex(t=>t.id===this.selectedId):-1}setSelectedId(t){this.selectedId=t,by(this.root,this.visibleItems,t)}focus(){const t=this.root.querySelector(".filter-input");p(co,t,"no input"),t.focus()}moveSelectedItemIntoView(){const t=this.root.querySelector(".list-item.selected");t&&(p(co,t,"no selected menu item"),t.scrollIntoView({block:"nearest"}))}reset(){this.setFilter("");const t=this.root.querySelector(".filter-input");p(co,t,"no input"),t.value=""}setFilter(t){this.filter!==t&&(this.filter=t,this.visibleItems=this.items.filter(e=>e.name.toLocaleLowerCase().includes(t)),by(this.root,this.visibleItems,this.selectedId))}processClick(t){var s,l;const e=t.target;if(!(e instanceof HTMLElement))return;const r=e.closest(".list-item");if(!r)return;const i=(s=r.getAttribute("data-id"))!=null?s:"",o=(l=this.visibleItems.find(c=>c.id===i))!=null?l:null;this.onSelected&&this.onSelected(this,o)}processKeyDown(t){var e;if(t.key==="ArrowUp"){let r=this.getSelectedIndex();r===-1?r=this.visibleItems.length-1:r>0&&(r-=1);let i="";r!==-1&&(i=this.visibleItems[r].id),this.setSelectedId(i);return}if(t.key==="ArrowDown"){let r=this.getSelectedIndex();r===-1?r=0:r<this.visibleItems.length-1&&(r+=1);let i="";r!==-1&&(i=this.visibleItems[r].id),this.setSelectedId(i);return}if(t.key==="Enter"){const r=(e=this.visibleItems.find(i=>i.id===this.selectedId))!=null?e:null;this.onSelected&&this.onSelected(this,r)}}}class mP extends hP{constructor(e,r,i){super(e,i);m(this,"popup");m(this,"onShow",null);m(this,"onHide",null);m(this,"custom",null);m(this,"handleShow",()=>{this.onShow&&this.onShow(this)});m(this,"handleHide",()=>{this.onHide&&this.onHide(this)});m(this,"handleShown",()=>{this.focus()});this.popup=new $a(this.root)}destroy(){super.destroy(),this.onShow=null,this.onHide=null}show(e){this.reset(),this.popup.manualShow(e,{theme:"dropdown-list"}),this.focus(),this.moveSelectedItemIntoView()}processKeyDown(e){super.processKeyDown(e),(e.key==="Esc"||e.key==="Enter")&&this.popup.close("cancelBar")}processClick(e){super.processClick(e);const r=e.target;!(r instanceof HTMLElement)||!r.closest(".list-item")||this.popup.close("clickItem")}}const uct="",fct="";function gP(n,t){const e=document.createElement("div");e.classList.add("toast","show"),t!=null&&t.theme&&e.setAttribute("data-theme",t.theme),t!=null&&t.id&&e.setAttribute("data-id",t.id),t!=null&&t.html?e.innerHTML=n:e.textContent=n,t!=null&&t.position&&(e.style.left=`${t.position.x}px`,e.style.top=`${t.position.y}px`,e.classList.add("positioned")),document.body.appendChild(e),setTimeout(()=>{e.classList.remove("show"),setTimeout(()=>{e.remove()},500)},(t==null?void 0:t.duration)||3e3)}function pP(n,t){var e,r;if(z(t,"menu-item"),!n.element){if(n.type==="section"){const i=B("div",["section-name"],null,n.name);t.appendChild(i)}else if(n.type!=="separator"){if(n.icon){const o=B("div",["menu-item-icon"],null);n.icon&&(o.innerHTML=n.icon),t.appendChild(o)}const i=B("div",["menu-item-name","text"],null);if(B("span",[],i,n.name),n.ellipsisTooltip&&(t.setAttribute("data-editor-tooltip-allow-markdown","true"),t.setAttribute("data-editor-tooltip-offset-y","25"),t.setAttribute("data-editor-tooltip-placement","right"),t.setAttribute("data-editor-tooltip-common",`<div style="word-break: break-word;">${n.ellipsisTooltip}</div>`)),((e=n.states)==null?void 0:e.includes("disabled"))&&n.disableReason&&(t.setAttribute("data-editor-tooltip-maxwidth","800"),t.setAttribute("data-editor-tooltip-placement","right"),t.setAttribute("data-editor-tooltip-common",n.disableReason)),t.appendChild(i),n.subText&&B("div",["item-subtext","text"],t,n.subText),n.children&&!n.element){const o=B("div",["menu-item-sub-indicator"],null);o.innerHTML=Yp,t.appendChild(o)}if((r=n.states)!=null&&r.includes("checked")){const o=B("div",["menu-item-checked-icon"],null);o.innerHTML=eC,t.appendChild(o)}}}}class es extends a0{constructor(t,e,r){super(t,e,{autoClose:!0,disablePageScroll:!0,...r})}manualShow(t,e){const r={theme:"menu",...e};super.manualShow(t,r)}initCommandBarElement(t){z(t,"menu")}initItemElement(t,e){pP(t,e)}}function CP(n,t,e){var r;return new es((r=n.children)!=null?r:[],t,{...e,parentItem:n})}function vy(n,t,e){t.setAttribute("data-button-id",n.id),e.tooltipId&&n.name&&!n.disableTooltip&&(t.setAttribute(`data-editor-tooltip-${e.tooltipId}`,n.name),n.desc&&t.setAttribute(`data-editor-tooltip-desc-${e.tooltipId}`,n.desc));const r=t;if(!n.element)if(n.icon){const i=B("span",["toolbar-item-icon-container"],r);n.icon.trim().startsWith("<")?i.innerHTML=n.icon:i.innerText=n.icon}else{const i=B("span",["toolbar-item-name-container"],r);i.innerText=n.name}if(n.dropdown){t.setAttribute("data-dropdown","true");const i=B("span",["toolbar-item-dropdown-container"],r);i.innerHTML=Xh}n.states&&(n.states.indexOf("checked")!==-1&&z(r,"checked"),n.states.indexOf("disabled")!==-1&&(r.disabled=!0))}class Fu extends a0{constructor(t,e,r){super(t,e,{itemElementTag:"button",tippyArrow:!1,...r})}getSubBarOptions(t){var i,o;const e=()=>{const s=this.getItemElementById(t.id),c=this.content.getBoundingClientRect(),d=s.getBoundingClientRect();return new DOMRect(d.left,c.top,d.width,c.height)};return{placement:(i=t.childrenPlacement)!=null?i:"top",getReferenceClientRect:e,offset:(o=t.childrenOffset)!=null?o:[0,4]}}manualShow(t,e){const r={theme:"toolbar",...e};super.manualShow(t,r)}initCommandBarElement(t){z(t,"toolbar")}initItemElement(t,e){vy(t,e,this.options)}}function EP(n,t,e){var r;return new Fu((r=n.children)!=null?r:[],t,{...e,parentItem:n})}class AP extends al{constructor(t,e,r){super(e,void 0,r),t.appendChild(this.content),document.addEventListener("keydown",this.handleDocumentKeydown),document.addEventListener("mousedown",this.handleDocumentMouseDown)}initCommandBarElement(t){z(t,"toolbar","fixed")}initItemElement(t,e){vy(t,e,this.options)}close(){this.clearSelectedItem(),this.subBar&&(this.subBar.close("cancelBar"),this.subBar=null)}destroy(){this.content.remove(),super.destroy(),document.removeEventListener("keydown",this.handleDocumentKeydown),document.removeEventListener("mousedown",this.handleDocumentMouseDown)}getCommandBarRoot(){return this.content.parentElement}get isVisible(){return!0}}const dct="";al.registerManualCommandBar("menu",CP),al.registerManualCommandBar("toolbar",EP);const hct="",By=I("ui-base");class Ku extends a0{constructor(e,r){super(Ku.getCommandItems(e,r),void 0,{disablePageScroll:!0,...r});m(this,"handleDocumentMouseDown",e=>{})}initCommandBarElement(e){z(e,"dialog","manual")}initItemElement(e,r){}show(e,r){this.manualShow(e,{...r,theme:"light"})}get dialogContent(){const e=this.items[0];p(By,e,"no dialog item");const r=e.element;return p(By,r,"no item element"),r}static getCommandItems(e,r){var s;return[{id:(s=r==null?void 0:r.id)!=null?s:`manual-dialog-${tt()}`,name:"",element:e}]}}const mct="",xP=I("ui-base");class Ty{constructor(t){m(this,"menu");m(this,"currentText","");m(this,"handleSearchText");m(this,"handleClick",Me.default((t,e)=>{this.options.onClickItem(this,e)},300,{leading:!0,trailing:!1}));m(this,"handleShow",t=>{});m(this,"handleClose",()=>{var t,e;(e=(t=this.options).onClose)==null||e.call(t)});m(this,"handleKeydown",t=>{this.menu.handleDocumentKeydown(t)});this.options=t,this.menu=new es([],void 0,{id:t.id,header:t.header,footer:t.footer,disableSelectedScroll:t.disableSelectedScroll}),this.menu.addListener("click",this.handleClick),this.menu.addListener("close",this.handleClose),this.menu.addListener("show",this.handleShow),this.options.wait?this.handleSearchText=Me.default(async e=>{this.handleSearchTextPure(e)},this.options.wait):this.handleSearchText=this.handleSearchTextPure}setItems(t){if(this.menu.updateItems(t),t.length>0){const e=t.find(r=>r.type!=="section"&&r.type!=="separator");e&&this.menu.selectItem(e.id)}}async popup(t,e){var i,o;if(!(e!=null&&e.noEvent)&&((o=(i=this.options).onShow)==null?void 0:o.call(i,this))===!1)return;this.menu.manualShow(t),this.options.placeholder&&this.showPlaceholder();const r=await this.options.queryItems(this,"");this.highlightText("",r),this.setItems(r)}showLoading(){!this.options.showLoading||(this.options.loadingElement?this.setItems([{id:"loading",name:"",element:this.options.loadingElement,states:["disabled"]}]):this.setItems([{id:"loading",name:"loading",states:["disabled"]}]))}showPlaceholder(){this.setItems([{id:"placeholder",name:"enter text to search",states:["disabled"]}])}showNoResultMessage(t){if(this.options.noResultMessage){const e={name:"",id:"placeholder",states:["disabled"]};typeof this.options.noResultMessage=="string"?e.name=this.options.noResultMessage:(this.options.noResultMessage instanceof HTMLElement||typeof this.options.noResultMessage=="function")&&(e.element=this.options.noResultMessage),this.setItems([e])}else this.setItems([{id:"placeholder",name:this.options.emptyPlaceholder||D.t("search.emptyTips"),states:["disabled"]}])}close(){this.menu.close("cancelBar")}get isVisible(){return this.menu.isVisible}destroy(){this.menu.close("cancelBar"),this.menu.removeAllListeners(),this.menu.destroy()}isInCommandBar(t){return this.menu.isInCommandBar(t)}async handleSearchTextPure(t){this.currentText=t;const e="auto-suggest";try{await Sr.lock(e),this.showLoading();const r=this.currentText,i=await this.options.queryItems(this,t);if(this.currentText===r&&(this.currentText=""),i.length===0){this.showNoResultMessage(t);return}this.setItems(i),this.options.highlight&&this.highlightText(r.replace(/^\s+|\s+$/g,""),i)}finally{Sr.release(e)}}highlightText(t,e){xP.debug(`highlight menu text: ${t}`);const r=this.menu.content,i=(s,l)=>{if(!l)return s;let c="";const d=l.length,h=l.toLocaleLowerCase();let C=0;for(C=0;C<=s.length-d;C){let E=s.substring(C,C+d);if(E.toLocaleLowerCase()===h){C+=d;const x=s.charAt(C);let v=!1;E.endsWith(" ")&&(v=!0,E=E.trimEnd()),c+=`<span class="highlight">${E}${x===" "||v?" ":""}</span>`}else c+=s.charAt(C),C++}return C<s.length&&(c+=s.substring(C)),c},o=s=>{if(wt(s,"text")){const l=e==null?void 0:e.find(h=>h.id===s.getAttribute("data-id"));if(l&&l.element)return;const c=s.textContent;if(!c)return;const d=i(c,t);s.innerHTML=d;return}Array.from(s.children).forEach(o)};o(r)}}class cC{constructor(t,e){m(this,"root");m(this,"input");m(this,"text");m(this,"dropdownIcon");m(this,"clearIcon");m(this,"autoSuggest");m(this,"labels");m(this,"items",[]);m(this,"handleClick",()=>{this.autoSuggest.popup(this.root),this.input.focus()});m(this,"handleClickItem",(t,e)=>{var r,i;(i=(r=this.options)==null?void 0:r.onClickItem)==null||i.call(r,e)});m(this,"handleInput",()=>{this.autoSuggest.handleSearchText(this.input.value),this.updatePlaceholder()});m(this,"handleClear",t=>{var e,r;this.clear(),this.autoSuggest.handleSearchText(""),t.preventDefault(),t.stopPropagation(),(r=(e=this.options)==null?void 0:e.onClear)==null||r.call(e)});m(this,"handleQueryItems",async(t,e)=>this.items.filter(i=>{var o;return(o=this.options)!=null&&o.filter?this.options.filter(i,e):!0}));m(this,"handleShow",()=>{z(this.root,"active"),this.input.focus()});m(this,"handleClose",()=>{var t,e;(e=(t=this.options)==null?void 0:t.onClose)==null||e.call(t),ot(this.root,"active")});var c,d,h,C,E;this.options=e,this.labels=(d=(c=this.options)==null?void 0:c.labels)!=null?d:[];const{root:r,input:i,text:o,clearIcon:s,dropdownIcon:l}=cC.createDropdown(t,this.labels);this.root=r,this.input=i,this.text=o,this.clearIcon=s,this.dropdownIcon=l,this.autoSuggest=new Ty({id:(e==null?void 0:e.popupId)||"dropdown-auto-suggest",header:(h=this.options)==null?void 0:h.header,onClickItem:this.handleClickItem,queryItems:this.handleQueryItems,onClose:this.handleClose,onShow:this.handleShow,highlight:e==null?void 0:e.highlight,emptyPlaceholder:e==null?void 0:e.emptyPlaceholder,disableSelectedScroll:e==null?void 0:e.disableSelectedScroll}),this.items=(E=(C=this.options)==null?void 0:C.items)!=null?E:[],this.root.addEventListener("click",this.handleClick),this.input.addEventListener("input",this.handleInput),this.clearIcon.addEventListener("click",this.handleClear)}close(){this.autoSuggest.close()}destroy(){this.input.removeEventListener("input",this.handleInput),this.root.removeEventListener("click",this.handleClick),this.clearIcon.removeEventListener("click",this.handleClear),this.autoSuggest.destroy()}updateItems(t){this.items=t,this.autoSuggest.handleSearchText("")}setText(t){this.text.innerText=t,this.input.value=t,this.updatePlaceholder()}clear(){this.setText(""),this.setLabels([])}setLabels(t){this.labels=t,this.updateLabels()}static createDropdown(t,e){const r=B("div",["editor-dropdown","empty"],t),i=B("input",["dropdown-input"],r),o=B("div",["dropdown-text"],r),s=B("div",["dropdown-labels"],r);for(let d=0;d<e.length;d+=1){const h=e[d];B("span",["dropdown-label"],s,h)}const l=B("div",["dropdown-clear-icon"],r);l.innerHTML=ty;const c=B("div",["dropdown-icon"],r);return c.innerHTML=Xh,{root:r,input:i,text:o,clearIcon:l,dropdownIcon:c}}updateLabels(){const t=this.root.querySelector(".dropdown-labels");if(t){t.innerHTML="";for(let e=0;e<this.labels.length;e+=1){const r=this.labels[e];B("span",["dropdown-label"],t,r)}}}updatePlaceholder(){var t;if(this.input.value===""){const e=(t=this.options)==null?void 0:t.placeholder;e&&(this.input.placeholder=e,this.text.textContent=e),z(this.root,"empty")}else ot(this.root,"empty")}}const bP=[-1,6,0,1,2,3,4,5],vP=[-1,6,0,1,2,3,4,5,14,13,7,8,9,10,11,12],yy=I("color-palette");function ky(n,t,e,r){p(yy,n>0,"no color in palette");const i=t||1;p(yy,i>0,`invalid palette rows: ${i}`);const o=n/i,s=B("div",["palette-container",r],null);for(let l=0;l<i;l++){const c=B("div",["palette-container-row"],s);for(let d=0;d<o;d++){const h=e(l*o+d);c.appendChild(h)}}return s}function BP(n){const t=B("button",["color-button"],null),e=bP[n];return t.setAttribute("data-color-index",`${e}`),t.innerHTML=Xp,t}function TP(n){const t=B("button",["background-color-button"],null),e=vP[n];return t.setAttribute("data-color-index",`${e}`),t}function yP(){const n=B("div",["clear-button-container"],null),t=B("button",["clear-button"],n);return t.innerText=D.t("colorPalette.reset"),n}function kP(n){const t=B("div",["color-palette"],null);return n.color!==!1&&(B("div",["bar-desc"],t,D.t("colorPalette.colorDesc")),t.appendChild(ky(8,1,BP,"color"))),n.backgroundColor!==!1&&(B("div",["bar-desc"],t,D.t("colorPalette.backgroundDesc")),t.appendChild(ky(16,2,TP,"background-color"))),n.clearColorButton!==!1&&t.appendChild(yP()),t}function RP(n,t,e){const r=t==="color"?"color":"background-color",i=n.querySelector(`.${r} button.selected`);i&&ot(i,"selected"),e===null&&(e=-1);const o=n.querySelector(`.${r} button[data-color-index="${e}"]`);o&&z(o,"selected")}const gct="",wP={};class SP extends Be.TypedEmitter{constructor(e=wP){super();m(this,"root");m(this,"handleClick",e=>{const r=e.target;if(!r||!(r instanceof Element))return;const i=r.closest("button");if(!i)return;if(wt(i,"clear-button")){this.setColor("backgroundColor",null),this.setColor("color",null),this.emit("onClick","clearColor",0);return}const o=i.getAttribute("data-color-index");if(!o)return;const s=Number.parseInt(o,10);Number.isNaN(s)||(wt(i,"color-button")?s===-1?(this.setColor("color",null),this.emit("onClick","clearColor",1)):(this.setColor("color",s),this.emit("onClick","color",s)):s===-1?(this.setColor("backgroundColor",null),this.emit("onClick","clearColor",2)):(this.setColor("backgroundColor",s),this.emit("onClick","backgroundColor",s)))});this.options=e,this.root=kP(e),this.root.addEventListener("click",this.handleClick)}destroy(){this.removeAllListeners(),this.root.removeEventListener("click",this.handleClick)}setColor(e,r){RP(this.root,e,r)}}class Ry{constructor(t,e){m(this,"name","Color Palette");m(this,"element");m(this,"palette");m(this,"closeable",null);this.id=t,this.palette=new SP(e),this.element=this.palette.root}setCloseable(t){this.closeable=t}destroy(){this.palette.destroy(),this.closeable=null}}function LP(){const n=B("button",["color-button"],null);return n.innerHTML=Xp,n}function uC(n,t){const[e,r]=t;e===null?n.removeAttribute("data-color"):n.setAttribute("data-color",`${e}`),r===null?n.removeAttribute("data-background-color"):n.setAttribute("data-background-color",`${r}`)}class wy extends Be.TypedEmitter{constructor(e){super();m(this,"id","text-color-item");m(this,"name",D.t("colorPalette.name"));m(this,"dropdown",!0);m(this,"manualShowChildren",!0);m(this,"children",[]);m(this,"element");m(this,"colorPaletteItem");m(this,"latestColors",[null,null]);m(this,"handlePaletteClick",(e,r)=>{this.emit("onClick",e,r)});m(this,"setLatestColors",(e,r)=>{e==="color"||e==="backgroundColor"?e==="color"?this.latestColors[0]=r:this.latestColors[1]=r:this.latestColors=[null,null],uC(this.element,this.latestColors)});m(this,"beforePopup",()=>{this.updatePaletteColor(this.latestColors),this.emit("beforePopup")});this.editor=e,this.colorPaletteItem=new Ry("text-color-palette-item"),this.colorPaletteItem.palette.addListener("onClick",this.handlePaletteClick),this.children.push(this.colorPaletteItem),this.element=LP()}destroy(){this.colorPaletteItem.destroy()}updatePaletteColor(e){this.colorPaletteItem.palette.setColor("color",e[0]),this.colorPaletteItem.palette.setColor("backgroundColor",e[1]),this.latestColors=e,uC(this.element,this.latestColors)}updateButtonColor(e){this.latestColors=e,uC(this.element,this.latestColors)}}const pct="";function c0(n,t){const e=B("div",["editor-input-wrap"],n);if(t!=null&&t.className&&z(e,t==null?void 0:t.className),t.label){const s=B("div",["editor-input-label"],e);B("span",[],s,t.label),t.required&&z(s,"required")}const r=B("div",["editor-input-container"],e),i=B("input",["editor-input"],null);if(t.placeholder&&(i.placeholder=t.placeholder),t.defaultValue&&(i.value=t.defaultValue),t.maxLength&&(i.maxLength=t.maxLength),t.maxLength){const s=B("div",["editor-input-suffix"],r);B("span",[],s,`${i.value.length} / ${t.maxLength}`),i.addEventListener("input",l=>{const c=l.target;s.innerText=`${c.value.length} / ${t.maxLength}`})}r.appendChild(i);const o=B("div",["editor-input-error"],e);return i.addEventListener("input",s=>{var l;(l=t.onChange)==null||l.call(t,s),ot(e,"error")}),i.addEventListener("keydown",s=>{var l;(l=t.onKeyDown)==null||l.call(t,s)}),{getField:()=>i,getInputValue:()=>i.value,setFieldError:s=>{z(e,"error"),o.innerText=s},focus:()=>{setTimeout(()=>{i.focus()})}}}function fC(n){const t=document.getSelection();if(!t)return!0;const e=t.focusNode;if(!e)return!0;const r=t.focusOffset,i=e.childNodes[r];if(!i)return!0;if(i instanceof HTMLElement){const o=i.tagName.toLowerCase();if(i===n.input.inputElement)return!0;if(o==="input"||o==="textarea")return!1}return!0}class IP extends Ty{constructor(e,r){super(r);m(this,"handleClose",()=>{var e,r;fC(this.editor)&&this.editor.focus(),(r=(e=this.options).onClose)==null||r.call(e)});this.editor=e,this.editorOptions=r}async popupInEditor(e,r,i){var d,h;if(((h=(d=this.editorOptions).onShow)==null?void 0:h.call(d,this,e,r,i))===!1)return;this.options.showLoading&&this.showLoading();const o=this.editor.getBlockByIndex(e,r);if(!re(this.editor.rootContainer,o)||dt(this.editor,o)<i)return;const s=Wi(this.editor,o,ye(this.editor,o,i));if(s.length===0)return;const l=s[0],c=Yi(this.editor,o,"editor-auto-suggest-menu",l);super.popup(c,{noEvent:!0})}}const dC=I("auto-suggest-menu");class hC{constructor(t,e){m(this,"order",100);m(this,"menu");m(this,"anchor",null);m(this,"close",()=>{this.menu.close()});m(this,"handleSelectionChanged",t=>{var r,i;if(!((r=this.menu)!=null&&r.isVisible))return;const e=t.selection.range.start;if(e.isSimple()&&e.blockId===((i=this.anchor)==null?void 0:i.blockId)&&e.offset>=this.anchor.offset){const o=t.getBlockById(e.blockId);if(de(Dn(Bn(t,o),e.offset).left).startsWith(this.anchor.leftText))return}this.menu.close()});m(this,"deleteTrigger",()=>{const t=this.editor,e=t.selection.range.start;if(!e.isSimple()||!this.anchor)return!1;const{blockId:r,offset:i}=e,o=t.getBlockById(r),s=de(Ch(t,o,i));if(p(dC,this.anchor,"no anchor"),!s.startsWith(this.anchor.leftText))return!1;const l=this.anchor.offset-this.anchor.trigger.length,c=i-l;return t.selection.selectBlock(o,l),c&&(t.deleteTextFromBlock(o,l,c),this.anchor.offset-=this.anchor.trigger.length),this.anchor.trigger.length||this.menu.close(),!0});m(this,"onClose",()=>{var t,e;(e=(t=this.options).onClose)==null||e.call(t)});m(this,"onShow",(t,e,r,i)=>{var o;if((o=this.options)!=null&&o.onShow)return this.options.onShow(this,e,r,i)});m(this,"onClickItem",(t,e)=>{!this.anchor||(this.options.autoDeleteTrigger&&this.deleteTrigger(),this.options.onClickItem(this,e,this.anchor))});m(this,"queryItems",(t,e)=>this.options.queryItems(this,e));m(this,"renderMenuItem",(t,e)=>{var i,o;return(o=(i=this.options).renderMenuItem)==null?void 0:o.call(i,this,e)});m(this,"hasExistsMenuThemeCommandBar",()=>!!document.querySelector('div.tippy-box[data-theme="menu"]'));this.editor=t,this.options=e,this.menu=new IP(t,{id:e.id,showLoading:e.showLoading,loadingElement:e.loadingElement,placeholder:e.placeholder,header:e.header,footer:e.footer,wait:e.wait,noResultMessage:e.noResultMessage,highlight:e.highlight,onClose:this.onClose,onShow:this.onShow,onClickItem:this.onClickItem,queryItems:this.queryItems,renderMenuItem:this.renderMenuItem}),t.input.addHandler(this),t.addListener("selectionChanged",this.handleSelectionChanged)}handleBeforeKeyDown(t,e){var r;return!((r=this.menu)!=null&&r.isVisible)||Ng(e.key)?!1:rv(e)&&!Ks(e)?(setTimeout(()=>{this.resetItems()}),!1):Pg(e)?(this.menu.close(),!0):(this.menu.handleKeydown(e),!0)}popup(t,e,r,i){this.anchor={blockId:lt(t),offset:e,leftText:r,trigger:i};const o=ut(it(t)),s=Bt(t);this.menu.popupInEditor(o,s,e)}handleAfterInsertText(t,e,r,i,o){var h,C;const s=t.selection.range.start;if(!s.isSimple())return!1;const l=t.getBlockByIndex(e,r);if(zi(l))return!1;const{blockId:c,offset:d}=s;if(lt(l)!==c)return!1;if((h=this.menu)!=null&&h.isVisible)this.resetItems();else if(this.options.trigger.indexOf(o)!==-1){if(i>0&&this.options.needSpaceBeforeTrigger&&(((C=t.getBlockData(l).text)==null?void 0:C.reduce((R,L)=>R+L.insert,""))||"")[i-1].trim().length!==0||this.hasExistsMenuThemeCommandBar())return!1;const E=de(Ch(t,l,d));this.popup(l,d,E,o)}return!1}handleUpdateCompositionText(t,e,r,i,o){var d;const s=t.selection.range.start;if(!s.isSimple())return!1;const{blockId:l}=s,c=t.getBlockByIndex(e,r);return lt(c)!==l||(d=this.menu)!=null&&d.isVisible&&this.resetItems(),!1}resetItems(){var l;if(!((l=this.menu)!=null&&l.isVisible))return;const t=this.editor,e=t.selection.range.start;if(!e.isSimple())return;const{blockId:r,offset:i}=e,o=t.getBlockById(r),s=de(Ch(t,o,i));if(p(dC,this.anchor,"no anchor"),s.startsWith(this.anchor.leftText)){const c=s.substring(this.anchor.leftText.length);dC.debug(`search text: ${c}`),this.menu.handleSearchText(c)}}destroy(){var t;this.editor.input.removeHandler(this),this.editor.removeListener("selectionChanged",this.handleSelectionChanged),(t=this.menu)==null||t.destroy()}}function DP(){const n={};for(let t=1;t<=8;t++)n[`heading-${t}`]={shortcut:`/h${t}`};return n}const _P={"insert-hr":{shortcut:"/hr"},"insert-uml":{shortcut:"/uml"},"insert-table":{shortcut:"/table"},"insert-image":{shortcut:"/image"},"insert-code":{shortcut:"/code"},"insert-link":{shortcut:"/link"},"insert-drawio":{shortcut:"/uml"},"insert-video":{shortcut:"/video"},"insert-audio":{shortcut:"/audio"},"insert-math":{shortcut:"/math"},"insert-webPage":{shortcut:"/web"},"insert-bilibili":{shortcut:"/bilibili"},"insert-youku":{shortcut:"/youku"},"insert-figma":{shortcut:"/figma"},"insert-modao":{shortcut:"/modao"},"insert-tencent":{shortcut:"/tencent"},"insert-unordered":{shortcut:"/bl"},"insert-ordered":{shortcut:"/nu"},"insert-checkbox":{shortcut:"/todo"},"insert-quote":{shortcut:"/quote"},...DP()};function Tn(n){var t;return(t=_P[n])==null?void 0:t.shortcut}function MP(n){var t;return(t=n.subText)!=null?t:""}const xi=I("table-dom");function bi(n){return`${lt(n)}_scroll`}function Ve(n){const t=n.querySelector("div[data-type=table-content] >table");return p(xi,t instanceof HTMLTableElement,"invalid table"),t}function vi(n,t){const r=n.getCustom(bi(t)).contentElement.firstElementChild;p(xi,r instanceof HTMLElement,"invalid table content");let i=r.querySelector(":scope >div[data-type=table-tools]");return i||(i=B("div",[],r),i.setAttribute("data-type","table-tools"),n.domEvents.addEventListener(i,"dblclick",(o,s)=>s.stopPropagation()),n.domEvents.addEventListener(i,"click",(o,s)=>{s.detail===3&&s.stopPropagation()})),p(xi,i,"no table tools"),i}function UP(n,t){return n.findCustom(bi(t))?vi(n,t):null}function Sy(n){const t=[];return Array.from(n.rows).forEach(e=>{t.push(...Array.from(e.cells))}),t}function Vu(n){const t=n.querySelector(":scope div[data-type=editor-container]");return p(xi,t,"no child container in cell"),t}function OP(n){const r=Sy(n).map(i=>{const o=Vu(i),s=ut(o),l=i.colSpan,c=i.rowSpan;return`${s}/${l}/${c}`}).join();return wd.default(r)}function $e(n){return Dt(n)==="table"}function mC(n){const t=it(n);if(Xt(t))return null;const e=J(t);return p(xi,e,"no parent block"),$e(e)?t:mC(e)}function uo(n){if($e(n))return n;const t=it(n);if(Xt(t))return null;const e=J(t);return p(xi,e,"no parent block"),$e(e)?e:uo(e)}function NP(n,t){const e=n.querySelector("colgroup");p(xi,e,"no colgroup");const r=e.children[t];return p(xi,r,"no col"),p(xi,r instanceof HTMLTableColElement,`invalid col: ${r.tagName}`),r}function Ly(n){try{return Ve(n),!0}catch{return!1}}function PP(n){return ie(n).querySelector(":scope > .block-helper")}function Iy(n){const t=J(n.contentElement);p(xi,t,"no block");const e=PP(t);if(e){const o=Math.min(n.contentElement.offsetLeft+29,n.rootElement.scrollLeft),s=t.getBoundingClientRect().width;e.style.right=`${o+s+5}px`}}const zr=I("doc-table-grid");class FP{constructor(t){m(this,"_cells",[]);for(let e=0;e<t;e++)this._cells.push(void 0)}cols(){return this._cells.length}setCell(t,e){p(zr,t>=0&&t<this.cols(),`set cell, invalid col: ${t}`),this._cells[t]=e}getCell(t){p(zr,t>=0&&t<this.cols(),`get cell, invalid col: ${t}`);const e=this._cells[t];return p(zr,e,"get cell, no cell"),e}getCellAllowEmpty(t){return p(zr,t>=0&&t<this.cols(),`get cell, invalid col, ${t}`),this._cells[t]}getNextNonVirtualCell(t){return this._cells.slice(t+1).find(e=>!e.virtual)}forEach(t){this._cells.forEach(t)}}class u0{constructor(t){m(this,"_data");m(this,"_rows");this._data=t,this._rows=[];for(let e=0;e<this.rowCount;e++)this._rows.push(new FP(this.colCount));this.fillGrid()}get rowCount(){return this._data.rows}get colCount(){return this._data.cols}getNextEmptyCell(t,e){let r=t,i=e;for(;;){if(r+=1,r===this.colCount&&(r=0,i+=1),i>=this.rowCount)return null;if(this._rows[i].getCellAllowEmpty(r)===void 0)return{col:r,row:i}}}fillGrid(){const t=this._data.children;p(zr,t,"no children");let e=0,r=0;t.forEach((i,o)=>{const s=this._data[`${i}_colSpan`]||1,l=this._data[`${i}_rowSpan`]||1;for(let d=0;d<l;d++)for(let h=0;h<s;h++)this._rows[r+d].setCell(e+h,{col:e,row:r,containerId:i,virtual:h!==0||d!==0,colSpan:s,rowSpan:l});const c=this.getNextEmptyCell(e,r);c?(e=c.col,r=c.row):p(zr,o===t.length-1,`invalid table data, no next empty cell: ${JSON.stringify(this._data)}`)}),this._rows.forEach(i=>{i.forEach(o=>{p(zr,o,"no cell"),p(zr,o.containerId,"no containerId")})})}getCell(t){const{col:e,row:r}=t,i=this._rows[r];p(zr,i,`get cell, no row: ${r}`);const o=i.getCell(e);return p(zr,o,`get cell, no cell: ${e}`),o}getRow(t){const e=this._rows[t];return p(zr,e,`get row, no row: ${t}`),e}forEach(t){this._rows.forEach(t)}}const f0=I("table-data");function KP(n){const t=n.firstElementChild;return p(f0,t,"no child element for cell"),p(f0,Gi(t),"cell first child is not a container"),p(f0,Mr(t),"cell first child is not a container"),t}function VP(n){const t=J(n);p(f0,t,"no parent block for table");const e=[],r={};Array.from(n.rows).forEach(l=>{Array.from(l.cells).forEach(c=>{const d=KP(c),h=ut(d);e.push(h),(c.colSpan>1||c.rowSpan>1)&&(r[`${h}_colSpan`]=c.colSpan,r[`${h}_rowSpan`]=c.rowSpan)})});const i=n.rows.length,o=Array.from(n.rows[0].cells).map(l=>l.colSpan).reduce((l,c)=>l+c,0);return{id:lt(t),type:Dt(t),rows:i,cols:o,children:e,colsWidth:Array(o).fill(100),...r}}function cl(n){return new u0(n)}function $P(n){return cl(VP(n))}const Qe=I("table-grid"),HP=60;class jP{constructor(t,e){m(this,"containerId");m(this,"row");m(this,"col");m(this,"colSpan");m(this,"rowSpan");m(this,"virtual");m(this,"table");this.table=t,this.containerId=e.containerId,this.row=e.row,this.col=e.col,this.colSpan=e.colSpan,this.rowSpan=e.rowSpan,this.virtual=e.virtual}get cell(){const e=this.container.closest("td");return p(Qe,e,"no parent cell for child container"),e}get container(){const t=this.table.querySelectorAll(`[data-container-id=${this.containerId}]`);p(Qe,t.length===1,"containers !== 1"),p(Qe,Gi(t[0]),"not a container");const e=t[0];return p(Qe,Mr(e),"not a child container"),e}}class zP{constructor(t,e){m(this,"_cells",[]);e.forEach(r=>{this._cells.push(new jP(t,r))})}get cells(){return this._cells}getCell(t){return p(Qe,t<this._cells.length,"get cell, invalid col"),this._cells[t]}getNextNonVirtualCell(t){return this._cells.slice(t+1).find(e=>!e.virtual)}getSpannedCell(){return this._cells.find(t=>t.virtual||t.colSpan>1||t.rowSpan>1)}}const SA=class{constructor(t){m(this,"_rows",[]);this.table=t,$P(t).forEach(i=>{this._rows.push(new zP(t,i))});const r=this.colCount;this._rows.forEach(i=>{p(Qe,i.cells.length===r,"row.cells.length !== colCount")})}get rowCount(){return this._rows.length}get colCount(){return this._rows.length===0?0:(p(Qe,this.rowCount>0,"rowCount <= 0"),this.getRow(0).cells.length)}getRow(t){return this._rows[t]}getCell(t){const e=this.getRow(t.row);return p(Qe,e,"no row"),e.getCell(t.col)}getCellContainer(t){return this.getCell(t).container}getFirstCellContainer(){return this.getCellContainer({row:0,col:0})}getLastCellContainer(){const t=this.rowCount-1,e=this.colCount-1;return this.getCellContainer({row:t,col:e})}getColumnCells(t){p(Qe,t>=0&&t<this.colCount,"colIndex out of range");const e=this.rowCount,r=[];for(let i=0;i<e;i++){const o=this.getCell({row:i,col:t});r.push(o)}return r}toRealCells(t){const e=[];return t.forEach(r=>{const i=this.getRealCell(r);e.findIndex(o=>o.containerId===i.containerId)===-1&&e.push(i)}),e}getColumnRealCells(t){const e=this.getColumnCells(t);return this.toRealCells(e)}getRowRealCells(t){const e=this.getRow(t).cells;return this.toRealCells(e)}getFirstSpannedCell(t){p(Qe,t>=0&&t<this.colCount,"colIndex out of range");const e=this.rowCount;for(let r=0;r<e;r++){const i=this.getCell({row:r,col:t});if(i.virtual||i.colSpan>1||i.rowSpan>1)return i}}getRealCell(t){const e=this.getCell(t);if(!e.virtual)return e;const r=this.getCellById(e.containerId);return p(Qe,!r.virtual,"found a virtual cell"),r}getColumnSpannedRange(t){const e=this.getColumnRealCells(t);let r=1e5,i=-1;return e.forEach(o=>{r=Math.min(o.col,r),i=Math.max(o.col+o.colSpan-1,i)}),p(Qe,r<=i,"min > max"),p(Qe,r>=0,"min < 0"),p(Qe,i<this.colCount,"max >= colCount"),[r,i]}getRowSpannedRange(t){const e=this.getRowRealCells(t);let r=1e5,i=-1;return e.forEach(o=>{r=Math.min(o.row,r),i=Math.max(o.row+o.rowSpan-1,i)}),p(Qe,r<=i,"min > max"),p(Qe,r>=0,"min < 0"),p(Qe,i<this.rowCount,"max >= rowCount"),[r,i]}getSpannedRange(t,e){const r=Math.min(t.row,e.row),i=Math.max(t.row,e.row),o=Math.min(t.col,e.col),s=Math.max(t.col,e.col),l=[];for(let x=r;x<=i;x++)for(let v=o;v<=s;v++)l.push(this.getCell({row:x,col:v}));const c=this.toRealCells(l);let d=1e4,h=1e4,C=-1,E=-1;return c.forEach(x=>{h=Math.min(x.col,h),d=Math.min(x.row,d),E=Math.max(x.col+x.colSpan-1,E),C=Math.max(x.row+x.rowSpan-1,C)}),[{row:d,col:h},{row:C,col:E}]}getAllCells(){return this.getCells({col:0,row:0},{col:this.colCount-1,row:this.rowCount-1})}sub(t,e){const r=[];for(let i=t.row;i<=e.row;i++){const o=[];for(let s=t.col;s<=e.col;s++){const l=this.getCell({row:i,col:s});o.push(l)}r.push(o)}return r}getAllContainers(){return this.getAllCells().map(e=>e.container)}getCells(t,e){const r=[],i=this.getSpannedRange(t,e),o=i[0],s=i[1],l=Math.min(o.row,s.row),c=Math.max(o.row,s.row),d=Math.min(o.col,s.col),h=Math.max(o.col,s.col);for(let C=l;C<=c;C++)for(let E=d;E<=h;E++){const x=this.getCell({row:C,col:E});x.virtual||r.push(x)}return r}map(t){const e=[];for(let r=0;r<this.rowCount;r++){const i=[];for(let o=0;o<this.colCount;o++){const s=this.getCell({row:r,col:o});i.push(t(s))}e.push(i)}return e}getBottomCell(t){const e=this.rowCount;let r=t,i=t.row;for(;r.containerId===t.containerId;){if(i+=1,i>=e)return null;r=this.getCell({row:i,col:t.col})}return this.getRealCell(r)}getTopCell(t){let e=t,r=t.row;for(;e.containerId===t.containerId;){if(r-=1,r<0)return null;e=this.getCell({row:r,col:t.col})}return this.getRealCell(e)}get cells(){let t=[];return this._rows.forEach(e=>{t=t.concat(e.cells)}),t}getVirtualCellContainersGrid(){return this.map(t=>t.containerId)}static virtualCellContainersGridToChildren(t){const e=t,r=[];return e.forEach(i=>{i.forEach(o=>{r.indexOf(o)===-1&&r.push(o)})}),r}getCellById(t){const r=this.cells.find(i=>i.containerId===t);return p(Qe,r,"cell not found"),r}getCellByCellElement(t){const e=Vu(t);return this.getCellByContainerId(ut(e))}getCellByContainerId(t){return this.getCellById(t)}static fromTable(t){const e=OP(t),r=this.caches.getSync(e,()=>(Qe.debug("create table grid"),new SA(t)));return r.table!==t?(this.caches.delete(e),this.fromTable(t)):r}static fromBlock(t){return this.fromTable(Ve(t))}};let It=SA;m(It,"caches",new Pb(HP));function d0(n,t){Object.entries(n).forEach(([e])=>{e.startsWith(`${t}/`)&&delete n[e]})}const GP=I("table-selection-range");function Gr(n,t,e){var U,F,G,W;const r=It.fromBlock(n),i=t,o=e,s=r.getCellByContainerId(i.childContainerId),l=r.getCellByContainerId(o.childContainerId),c=i.custom,d=o.custom,h=(U=c==null?void 0:c.rowIndex)!=null?U:s.row,C=(F=c==null?void 0:c.colIndex)!=null?F:s.col,E=(G=d==null?void 0:d.rowIndex)!=null?G:l.row+l.rowSpan-1,x=(W=d==null?void 0:d.colIndex)!=null?W:l.col+l.colSpan-1,v=Math.min(h,E),R=Math.max(h,E),L=Math.min(C,x),M=Math.max(C,x);return{fromRow:v,toRow:R,fromCol:L,toCol:M}}function gC(n,t){const e=new Set,r=new Set,i=n.selection.range;if(!i.isSimple()&&i.start.blockId===lt(t)){const o=It.fromBlock(t),{start:s,end:l}=i;p(GP,!s.isSimple()&&!l.isSimple(),"invalid range");const{fromCol:c,toCol:d,fromRow:h,toRow:C}=Gr(t,s,l);if(h===0&&C===o.rowCount-1)for(let E=c;E<=d;E++)r.add(E);if(c===0&&d===o.colCount-1)for(let E=h;E<=C;E++)e.add(E)}return{selectedRows:e,selectedColumns:r}}function $u(n,t){let e=null;if(t.isCollapsed()&&t.isSimple()){const r=n.getBlockById(t.start.blockId);if($e(r)){const i=it(r),o=J(i);o&&(e=uo(o))}else e=uo(r)}else{const r=n.getBlockById(t.start.blockId),i=uo(r),o=n.getBlockById(t.end.blockId),s=uo(o);i===s&&(e=i)}return e}const Ha=I("delete-columns");function Dy(n,t,e){const{start:r,end:i}=e;if(r.blockId!==i.blockId||e.isSimple()||n.getBlockById(r.blockId)!==t||Dt(t)!=="table")return!1;const{fromRow:s,toRow:l}=Gr(t,e.start,e.end),c=It.fromBlock(t);return s===0&&l===c.rowCount-1}function pC(n){const t=n.getEditor();t.undoManager.runInGroup(()=>{var F,G;const e=t.getBlockById(n.start.blockId);if(!Dy(t,e,n))return;if(n.isSimple()){t.deleteBlock(e);return}const{fromCol:r,toCol:i}=Gr(e,n.start,n.end),o=It.fromBlock(e);if(r===0&&i===o.colCount-1){t.deleteBlock(e);return}const s=new Set,l=o.map(W=>W.containerId);for(let W=0;W<l.length;W++){const rt=l[W];for(let st=r;st<=i;st++){const Et=rt[st];s.add(Et)}rt.splice(r,i-r+1)}const c=new Set(l.flat()),d=new Set(Array.from(s).filter(W=>!c.has(W))),h=i-r+1,C=new Map,E=new Map;s.forEach(W=>{if(d.has(W))return;const rt=o.getCellByContainerId(W);if(p(Ha,rt.colSpan>1,"invalid effected cell, colSpan === 1"),rt.col<r){p(Ha,c.has(W),"invalid effected cell, not exists");let Yt=rt.col+rt.colSpan-1;Yt>i&&(Yt=i);const an=Yt-r+1,be=rt.colSpan-an;C.set(W,be);return}p(Ha,rt.col<=i,"invalid effected cell, col > endCol");const st=rt.col,Et=rt.col+rt.colSpan-1,vt=rt.col-r,xt=Et-st+1-h+vt;p(Ha,xt>0,"invalid effected cell, newSpanned <= 0");const Gt=no(t.doc);E.set(W,{newContainerId:Gt,colSpan:xt})});for(let W=0;W<l.length;W++){const rt=l[W];for(let st=r;st<rt.length;st++){const Et=rt[st],vt=E.get(Et);vt&&(rt[st]=vt.newContainerId)}}const x=mt.default(t.getBlockData(e));((F=x.colsWidth)!=null?F:new Array(x.cols).fill(0)).splice(r,i-r+1),d.forEach(W=>{d0(x,W)}),C.forEach((W,rt)=>{p(Ha,W>=1,"invalid modified colSpan, colSpan < 1"),W===1?x[`${rt}_colSpan`]=void 0:x[`${rt}_colSpan`]=W}),E.forEach((W,rt)=>{d0(x,rt);const{newContainerId:st,colSpan:Et}=W;p(Ha,Et>=1,"invalid newContainerData, colSpan < 1"),Et>1&&(x[`${st}_colSpan`]=Et);const vt=o.getCellByContainerId(rt).rowSpan;vt>1&&(x[`${st}_rowSpan`]=vt)});const R=(G=l[0][r])!=null?G:l[0][r-1],L=t.getChildContainerData(R)[0],M=It.virtualCellContainersGridToChildren(l),U={...x,cols:x.cols-h,children:M};cl(U),t.updateBlockData(e,U,ye(t,L.id,0)),t.deleteChildContainers(Array.from(d)),t.deleteChildContainers(Array.from(E.keys()))})}const ja=I("delete-rows");function _y(n,t,e){const{start:r,end:i}=e;if(r.blockId!==i.blockId||e.isSimple()||n.getBlockById(r.blockId)!==t||Dt(t)!=="table")return!1;const{fromCol:s,toCol:l}=Gr(t,e.start,e.end),c=It.fromBlock(t);return s===0&&l===c.colCount-1}function CC(n){const t=n.getEditor();t.undoManager.runInGroup(()=>{const e=t.getBlockById(n.start.blockId);if(!_y(t,e,n))return;if(n.isSimple()){t.deleteBlock(e);return}const{fromRow:r,toRow:i}=Gr(e,n.start,n.end),o=It.fromBlock(e);if(r===0&&i===o.rowCount-1){t.deleteBlock(e);return}const s=new Set,l=o.map(U=>U.containerId);for(let U=i;U>=r;U--)l[U].forEach(G=>s.add(G)),l.splice(U,1);const c=new Set(l.flat()),d=new Set(Array.from(s).filter(U=>!c.has(U))),h=i-r+1,C=new Map,E=new Map;s.forEach(U=>{if(d.has(U))return;const F=o.getCellByContainerId(U);if(p(ja,F.rowSpan>1,"invalid effected cell, rowSpan === 1"),F.row<r){p(ja,c.has(U),"invalid effected cell, not exists");let vt=F.row+F.rowSpan-1;vt>i&&(vt=i);const xt=vt-r+1,Gt=F.rowSpan-xt;C.set(U,Gt);return}p(ja,F.row<=i,"invalid effected cell, col > endCol");const G=F.row,W=F.row+F.rowSpan-1,rt=F.row-r,st=W-G+1-h+rt;p(ja,st>0,"invalid effected cell, newSpanned <= 0");const Et=no(t.doc);E.set(U,{newContainerId:Et,rowSpan:st})});for(let U=r;U<l.length;U++){const F=l[U];for(let G=0;G<F.length;G++){const W=F[G],rt=E.get(W);rt&&(F[G]=rt.newContainerId)}}const x=mt.default(t.getBlockData(e));d.forEach(U=>{d0(x,U)}),C.forEach((U,F)=>{p(ja,U>=1,"invalid modified rowSpan, rowSpan < 1"),U===1?x[`${F}_rowSpan`]=void 0:x[`${F}_rowSpan`]=U}),E.forEach((U,F)=>{d0(x,F);const{newContainerId:G,rowSpan:W}=U;p(ja,W>=1,"invalid newContainerData, rowSpan < 1"),W>1&&(x[`${G}_rowSpan`]=W);const rt=o.getCellByContainerId(F).colSpan;rt>1&&(x[`${G}_colSpan`]=rt)});const v=l[r]?l[r][0]:l[r-1][0],R=t.getChildContainerData(v)[0],L=It.virtualCellContainersGridToChildren(l),M={...x,rows:x.rows-h,children:L};cl(M),t.updateBlockData(e,M,ye(t,R.id,0)),t.deleteChildContainers(Array.from(d)),t.deleteChildContainers(Array.from(E.keys()))})}const Hu=I("table-range");function h0(n){p(Hu,!n.isSimple(),"must be complex selection range");const{anchor:t,focus:e}=n;p(Hu,!t.isSimple(),"invalid start pos type"),p(Hu,!e.isSimple(),"invalid end pos type");const r=n.getEditor();p(Hu,t.blockId===e.blockId,"invalid range, not same block");const i=r.getBlockById(t.blockId);p(Hu,Dt(i)==="table","invalid block type, not a table block");const o=Ve(i),s=It.fromTable(o),l=s.getCellByContainerId(t.childContainerId),c=s.getCellByContainerId(e.childContainerId),d=Math.min(l.row,c.row),h=Math.max(l.row,c.row),C=Math.min(l.col,c.col),E=Math.max(l.col,c.col),x=s.getCell({row:d,col:C}),v=s.getCell({row:h,col:E});return{editor:r,block:i,table:o,startCell:x,endCell:v,startRow:d,startCol:C,endRow:h,endCol:E}}const EC=I("split-cell");function AC(n,t,e){n.undoManager.runInGroup(()=>{const r=It.fromBlock(t),i=r.getRealCell(e);p(EC,!i.virtual,"should not split virtual cell"),p(EC,i.colSpan>1||i.rowSpan>1,"cell does not has span data");const o=r.getVirtualCellContainersGrid();for(let C=0;C<i.rowSpan;C++)for(let E=0;E<i.colSpan;E++){if(C===0&&E===0)continue;const x=C+i.row,v=E+i.col,R=no(n.doc);o[x][v]=R}const s=n.getBlockData(t),l=mt.default(s);l[`${i.containerId}_colSpan`]=null,l[`${i.containerId}_rowSpan`]=null,l.children=It.virtualCellContainersGridToChildren(o);const d=n.getChildContainerData(i.containerId)[0];p(EC,d,"no child block");const h=ye(n,d.id,0);cl(l),n.updateBlockData(t,l,h)})}function WP(n,t,e){e.forEach(r=>{const i=It.fromBlock(t).getCell(r);(i.virtual||i.colSpan>1||i.rowSpan>1)&&AC(n,t,r)})}function My(n,t,e){if(e.isSimple())return!1;const{start:r,end:i}=e;if(r.blockId!==i.blockId||n.getBlockById(r.blockId)!==t||Dt(t)!=="table")return!1;const{startCell:s,endCell:l}=h0(e);return!(s.cell!==l.cell||s.colSpan===1&&s.rowSpan===1)}function xC(n){const{editor:t,block:e,startRow:r,startCol:i,endRow:o,endCol:s}=h0(n),l=[];for(let c=r;c<=o;c++)for(let d=i;d<=s;d++)l.push({row:c,col:d});return WP(t,e,l),!0}const za=I("merge-cells");function Uy(n,t,e){if(e.isSimple())return!1;const{start:r,end:i}=e;if(r.blockId!==i.blockId||n.getBlockById(r.blockId)!==t||Dt(t)!=="table")return!1;const{startCell:s,endCell:l}=h0(e);return s.cell!==l.cell}function Oy(n){const t=h0(n),e=t.editor;e.undoManager.runInGroup(()=>{const r=t.endCell,i=r.row+r.rowSpan-1,o=r.col+r.colSpan-1,s=lt(t.block);xC(n);const l=e.getBlockById(s),c=Ve(l),{startRow:d,startCol:h}=t,C=mt.default(e.getBlockData(l));p(za,C.children,"no table children");const E=It.fromTable(c),x=[];for(let vt=d;vt<=i;vt++)for(let xt=h;xt<=o;xt++){const Gt=E.getCell({row:vt,col:xt});p(za,!Gt.virtual,"cell is virtual"),x.push(Gt)}p(za,x.length>0,"no selected cells");const v=x[0],R=x.slice(1),L=E.getCellByContainerId(v.containerId).container,M=[];R.forEach(vt=>{const xt=E.getCellByContainerId(vt.containerId).container,Gt=ut(xt);if(!uu(e,xt)){const Yt=Y5(e,Gt);if(uu(e,L)){const an=fe(L)[0];e.insertDocAt(L,0,Yt),e.deleteBlock(an)}else e.insertDocAt(L,Ir(L),Yt)}M.push(Gt)});const U=ut(L),F=o-h+1,G=i-d+1;C[`${U}_colSpan`]=F,C[`${U}_rowSpan`]=G,M.forEach(vt=>{p(za,C.children,"no table children");const xt=C.children.indexOf(vt);p(za,xt>0,"no deleted container"),C.children.splice(xt,1)});const W=C,st=e.getChildContainerData(U)[0];p(za,st,"no child block");const Et=ye(e,st.id,0);cl(W),e.updateBlockData(l,W,Et),e.deleteChildContainers(M)})}const bC=10,qP=["table/merge-cells","table/split-cell","table/insert-column","table/insert-row","table/delete-rows","table/delete-columns","table/delete"];class m0{constructor(){m(this,"id","TableBlockCommandProvider")}getAvailableCommands(t,e,r){if(Dt(e)!=="table")return[];const i={blockId:lt(e),blockKind:Dr(t,e),blockType:Dt(e)},o=[];Uy(t,e,r)&&o.push({id:"table/merge-cells",name:D.t("table.mergeCell"),icon:xT,groupIndex:bC,...i}),My(t,e,r)&&o.push({id:"table/split-cell",name:D.t("table.splitCell"),icon:bT,groupIndex:bC,...i});const s=Dy(t,e,r),l=_y(t,e,r);return s&&l&&o.push({id:"table/delete",name:D.t("table.deleteTable"),icon:vT,groupIndex:bC,...i}),o}executeCommand(t,e,r,i,o,s){return Dt(e)!=="table"||!new Set(qP).has(i.id)?!1:i.id==="table/merge-cells"?(Oy(r),!0):i.id==="table/split-cell"?(xC(r),!0):i.id==="table/delete-columns"?(pC(r),!0):i.id==="table/delete-rows"?(CC(r),!0):i.id==="table/delete"?(t.deleteBlock(e),!0):!1}}var Ny=(n=>(n.COL_TITLE_TABLE="col-title-table",n.COL_TITLE_ITEM="col-title-item",n.STRIPE_STYLE_TABLE="stripe-style-table",n.NO_BORDER="table-no-border",n))(Ny||{});const Ga=6,ju=20,vC="table-cell-menu-btn";function XP(n,t){if(!n.isBlockWritable(t))return;const r={...mt.default(n.getBlockData(t)),hasColTitle:!0};n.updateBlockData(t,r)}function YP(n,t){if(!n.isBlockWritable(t))return;const r={...mt.default(n.getBlockData(t)),hasColTitle:!1};n.updateBlockData(t,r)}function QP(n,t){if(!n.isBlockWritable(t))return;const r={...mt.default(n.getBlockData(t)),hasRowTitle:!0};n.updateBlockData(t,r)}function JP(n,t){if(!n.isBlockWritable(t))return;const r={...mt.default(n.getBlockData(t)),hasRowTitle:!1};n.updateBlockData(t,r)}function ZP(n,t){if(!n.isBlockWritable(t))return;const r={...mt.default(n.getBlockData(t)),isStripeStyle:!0};n.updateBlockData(t,r)}function tF(n,t){if(!n.isBlockWritable(t))return;const r={...mt.default(n.getBlockData(t)),isStripeStyle:!1};n.updateBlockData(t,r)}function eF(n,t,e){if(!n.isBlockWritable(t))return;const i={...mt.default(n.getBlockData(t)),noBorder:!e};n.updateBlockData(t,i)}const ul=I("table-cell-dom");function nF(n,t,e){let r=n.getBlockById(e);for(;r;){const i=r.closest("td");p(ul,i,"no parent cell");const o=J(i);if(p(ul,o,"no parent block"),o===t)return i;r=o}return p(ul,!1,"filed to get cell by child block id"),null}function ns(n,t,e){if(n.getBlockById(e.blockId)===t&&!e.isSimple())return p(ul,e.childContainerId,"block position must have childContainerId attribute"),e;const i=nF(n,t,e.blockId),o=ut(Vu(i));return Ee(t,o)}function BC(n,t){const e=n.selection.range,r=ns(n,t,e.start),i=ns(n,t,e.end);return Gr(t,r,i)}function Py(n,t,e,r){p(ul,$e(t),"invalid table block");const i=vi(n,t),o=ie(t),s=()=>{const c=i.querySelector(".table-border-bar-container.top");p(ul,c,"no top border bar container"),c.querySelectorAll(".table-border-bar-cell.top").forEach(h=>{const C=parseInt(h.getAttribute("data-top-index")||"0",10);r.includes(C)?z(h,"danger"):ot(h,"danger")})},l=()=>{const c=o.querySelector(".table-border-bar-container.left");p(ul,c,"no left border bar container"),c.querySelectorAll(".table-border-bar-cell.left").forEach(h=>{const C=parseInt(h.getAttribute("data-left-index")||"0",10);e.includes(C)?z(h,"danger"):ot(h,"danger")})};s(),l()}function rs(n,t,e=!0,r){const o=It.fromBlock(t).map(h=>h),{fromCol:s,toCol:l,fromRow:c,toRow:d}=BC(n,t);for(let h=0;h<o.length;h++){const C=o[h];for(let E=0;E<C.length;E++){const x=C[E],v=r?E>=s&&E+x.colSpan-1<=l:h>=c&&h+x.rowSpan-1<=d;e&&v?x.virtual||z(x.cell,"danger"):x.virtual||ot(x.cell,"danger")}}}function is(n,t,e=!0,r){const i=new Set,o=new Set;if(!e){Py(n,t,Array.from(i),Array.from(o));return}const{fromCol:s,toCol:l,fromRow:c,toRow:d}=BC(n,t);if(r)for(let h=s;h<=l;h++)o.add(h);else for(let h=c;h<=d;h++)i.add(h);Py(n,t,Array.from(i),Array.from(o))}function Fy(n,t,e){const{fromCol:r,toCol:i,fromRow:o,toRow:s}=BC(n,t),l=It.fromBlock(t);let c=null,d=null;return e?(c=l.getCell({col:r,row:0}),d=l.getCell({col:i,row:l.rowCount-1}),Xe(n,{anchor:Ee(t,c.containerId,{colIndex:r,rowIndex:0}),focus:Ee(t,d.containerId,{colIndex:i,rowIndex:l.rowCount-1})})):(c=l.getCell({col:0,row:o}),d=l.getCell({col:l.colCount-1,row:s}),Xe(n,{anchor:Ee(t,c.containerId,{colIndex:0,rowIndex:o}),focus:Ee(t,d.containerId,{colIndex:l.colCount-1,rowIndex:s})}))}const Ky=["style-bg-color-0","style-bg-color-1","style-bg-color-2","style-bg-color-3","style-bg-color-4","style-bg-color-5","style-bg-color-6","style-bg-color-7","style-bg-color-8","style-bg-color-9","style-bg-color-10","style-bg-color-11","style-bg-color-12","style-bg-color-13"];function Vy(n){return`style-bg-color-${n}`}function zu(n){return`${n}_background`}function rF(n,t,e){const r=Ve(n),s=(e!=null?e:It.fromTable(r)).getCell(t).cell;for(let l=0;l<Ky.length;l++){const c=Ky[l];if(wt(s,c))return c}}function $y(n,t,e){if(!n.isBlockWritable(t))return;const r=n.selection.range,o={...mt.default(n.getBlockData(t))},s=ns(n,t,r.start),l=ns(n,t,r.end);if(r.isSimple()){const c=s.childContainerId;e===-1?o[zu(c)]=void 0:o[zu(c)]=Vy(e)}else{const c=It.fromBlock(t),d=Gr(t,s,l),h=new Set;for(let C=d.fromRow;C<=d.toRow;C++)for(let E=d.fromCol;E<=d.toCol;E++){const x=c.getCell({row:C,col:E});!h.has(x.containerId)&&x.col>=d.fromCol&&x.row>=d.fromRow&&x.col+x.colSpan-1<=d.toCol&&x.row+x.rowSpan-1<=d.toRow&&(h.add(x.containerId),e===-1?o[zu(x.containerId)]=void 0:o[zu(x.containerId)]=Vy(e))}}n.updateBlockData(t,o)}function iF(n,t,e){if(!n.isBlockWritable(t))return;const i={...mt.default(n.getBlockData(t)),chart:e};n.updateBlockData(t,i)}const Hy=I("table-chart");function oF(n,t){const e=UP(n,t);if(e){const r=e.querySelector(".editor-table-chart");if(r){const i=r.chartObject;i&&i.destroy(),r.remove()}}}async function sF(n,t){if(!n.contains(t)||!n.isBlockWritable(t))return;if(!!!n.getBlockData(t).chart){oF(n,t);return}const i=[],o=It.fromBlock(t),s=["line","bar","pie","radar"];let l=o.getCell({row:0,col:0}).container.innerText.trim().toLowerCase();new Set(s).has(l)||(l=s[0]);const c=[];for(let R=1;R<o.colCount;R++)c.push(o.getCell({row:0,col:R}).container.innerText);for(let R=1;R<o.rowCount;R++){const L=o.getCell({row:R,col:0}),U=L.container.innerText,F=[];for(let Yt=1;Yt<o.colCount;Yt++){const an=o.getCell({row:R,col:Yt}).container.innerText,be=Number.parseFloat(an)||0;F.push(be)}let G;const W=rF(t,L,o);W?G=window.getComputedStyle(n.rootElement).getPropertyValue(`--${W}`).trim():G=window.getComputedStyle(n.rootElement).getPropertyValue("--background-color").trim();let[rt,st,Et,vt]=G?Bg.fromString(G).toRgbaArray():[];if(!rt&&!st&&!Et&&!vt){const Yt=(R-1)%n.options.colors.length;G=n.options.colors[Yt],[rt,st,Et,vt]=Bg.fromString(G).toRgbaArray()}const xt=G,Gt=Bg.fromRgba([rt,st,Et,vt/3]).toHexString();i.push({label:U,data:F,borderColor:xt,backgroundColor:Gt,borderWidth:2})}const d=vi(n,t);let h=null,C=d.querySelector(".editor-table-chart");C?h=C.chartObject:C=B("div",["editor-table-chart"],d);const E=C;p(Hy,E,"no chart container");const x=n.getComponentOptions("table"),v=(x==null?void 0:x.chartCdn)||"https://cdn.jsdelivr.net/npm/chart.js@2.9.4/dist/Chart.min.js";try{await Ps(v,"editor-chartjs");let R=!1;(h&&h.config.data.datasets.length>i.length||h&&h.config.data.datasets[0].data.length>i[0].data.length)&&(R=!0),h&&(l!==h.config.type||R)&&(h.destroy(),h=null,Array.from(C.querySelectorAll(".editor-chartjs-canvas")).forEach(U=>{U.remove()}));const L=yg.default({},{type:l,data:{datasets:i,labels:c},options:{onClick:()=>{n.selection.selectBlock(t,0,0)}}});if(h)yg.default(h.config,L),h.update();else{const U=B("canvas",["editor-chartjs-canvas"],E).getContext("2d");h=new window.Chart(U,L),C.chartObject=h}}catch(R){Hy.error(`failed to resolve chart cdn: ${JSON.stringify(R)}`)}}async function jy(n,t){await Sr.lock("updateTableChart");try{await sF(n,t)}finally{Sr.release("updateTableChart")}}const zy=Me.default(jy,1e3);let Gy=null;function TC(n,t,e){if(Gy!==t&&(zy.flush(),Gy=t),e.updateNow){jy(n,t);return}zy(n,t)}function yC(n,t,e){e&&$e(e)&&TC(n,e,{updateNow:!1})}function lF(n,t){$e(t)&&TC(n,t,{updateNow:!0})}const Er={SCROLL:"container-scroll-tool",COMMON:"container-border-shadow",RIGHT:"container-right-border-shadow",LEFT:"container-left-border-shadow",LAYOUT_SIGN:"container-layout-border-shadow",ACTIVE:"active"},g0={SCROLL_BAR:"container-scrollbar",FIXED:"fixed"},os={SCROLL_CONTAINER:"scroll-container",TOOL:"container-scroll-tool",CONTAINER:"scroll-container-root",MAC:"mac",SCROLL_AREA:"scroll-area"};function Gu(n,t){return n.containers.get(t)}function Wy(n){return n.closest(`.${os.SCROLL_CONTAINER}`)}function Wr(n){return n.firstElementChild}function yn(n){return n.closest(`.${os.CONTAINER}`)}function Wu(n){const t=yn(n);let e=t.querySelector(`:scope >.${os.TOOL}`);return e||(e=B("div",[os.TOOL],t)),e}function aF(n){return yn(n).firstElementChild}function cF(n,t){const e=Gu(n,yn(t));return e!=null&&e.barFloatWindowBottom?typeof e.barFloatWindowBottom=="function"?e.barFloatWindowBottom():e.barFloatWindowBottom:0}function Ar(n,t){const e=ur(n);return t/e}function qu(n){const t=window.getComputedStyle(n),e=ur(n);return{paddingBottom:parseFloat(t.paddingBottom)*e,paddingTop:parseFloat(t.paddingTop)*e,paddingLeft:parseFloat(t.paddingLeft)*e,paddingRight:parseFloat(t.paddingRight)*e}}function Wa(n){const t=ur(n);return{scrollLeft:n.scrollLeft*t,scrollWidth:n.scrollWidth*t,clientWidth:n.clientWidth*t,clientHeight:n.clientHeight*t}}function uF(n,t){const e=ur(n);return n[t]*e}function kC(n,t){const e=yn(t),r=Gu(n,e),i=(r==null?void 0:r.safeRightSpace)||0,o=(r==null?void 0:r.safeLeftSpace)||0,l=(r==null?void 0:r.locatingContainer).getBoundingClientRect(),c=e.getBoundingClientRect(),d=c.width;let h=Math.floor(c.left-l.left-o);h<0&&(h=0);let C=l.right;C-=i;let E=C-c.right;return E<0&&(E=0),h=Math.round(h),E=Math.round(E),{originWidth:d,maxLeft:h,maxRight:E}}function fF(n,t){const e=kC(n,t),{maxLeft:r}=e;t.style.marginLeft=`${Ar(t,0-r)}px`,t.style.paddingLeft=`${Ar(t,r)}px`}function dF(n,t){const e=kC(n,t);t.style.marginRight=`${Ar(t,0-e.maxRight)}px`}function hF(n){if(n!==document.documentElement&&n!==document.body)return n.getBoundingClientRect();const t=0,e=0,r=document.documentElement.clientWidth,i=document.documentElement.clientHeight;return new DOMRect(t,e,r,i)}const qy=I("scroll-bar-handle"),mF=2;function qa(n){const t=Wu(n);let e=t.querySelector(`.${g0.SCROLL_BAR}`);return e||(e=B("div",[g0.SCROLL_BAR],t)),p(qy,e instanceof HTMLDivElement,"invalid child for container tools"),e.firstElementChild||B("div",[],e),e}function p0(n,t){const e=Wy(t),r=qa(e),{scrollWidth:i,clientWidth:o}=Wa(e),{paddingLeft:s,paddingRight:l}=qu(t),c=kC(n,e),{originWidth:d,maxRight:h}=c;dF(n,e),fF(n,e);const C=i-o;p(qy,r.firstElementChild instanceof HTMLDivElement,"invalid child for scroll bar"),r.style.width=`${Ar(e,d+h-s-l)}px`,r.firstElementChild.style.width=`${Ar(e,d+h+C-s-l)}px`}function gF(n,t){const e=Wr(n),{paddingLeft:r}=qu(e);if(wt(t,"fixed")){const o=yn(n).getBoundingClientRect();t.style.left=`${Ar(n,o.left+r)}px`}else t.style.left=`${Ar(n,r)}px`}function Xa(n,t){var U;const e=n.getParentScrollContainer(),r=hF(e),i=t.getBoundingClientRect(),o=qa(t),s=o.getBoundingClientRect(),l=Gu(n,yn(t)),c=cF(n,t),d=Wr(t),{paddingTop:h,paddingBottom:C}=qu(d),{scrollWidth:E,clientWidth:x}=Wa(t),v=document.documentElement.clientHeight-c,R=r.top+Wa(e).clientHeight-v,L=v+Math.min(0,R);if(E>x&&i.top+h<L-s.height&&i.bottom>L-s.height+C&&!((U=l==null?void 0:l.isSetScale)!=null&&U.call(l))){l!=null&&l.allowScrollBarFixed&&z(o,g0.FIXED);const F=R>0?c:0;o.style.bottom=`${Math.max(document.documentElement.clientHeight-r.bottom,0)+mF+F}px`}else ot(o,g0.FIXED),o.style.bottom=`${Ar(t,C-s.height)}px`;gF(t,o)}class pF{constructor(t,e){m(this,"intersectionObserver");m(this,"handleIntersection",t=>{t.forEach(e=>{this.containers.get(yn(e.target))?(this.handleIntersectionEntry(e),this.callback(e)):this.intersectionObserver.unobserve(e.target)})});m(this,"handleIntersectionEntry",t=>{const e=t.target;Xa(this.scrollCore,e);const r=Wr(e);p0(this.scrollCore,r)});this.scrollCore=t,this.callback=e;const i={root:this.scrollCore.getParentScrollContainer(),rootMargin:"20px",threshold:0};this.intersectionObserver=new IntersectionObserver(this.handleIntersection,i)}get containers(){return this.scrollCore.containers}bind(t){this.unbind(t),this.intersectionObserver.observe(t)}unbind(t){this.intersectionObserver.unobserve(t)}destroy(){this.intersectionObserver.disconnect()}}const fl=I("container-scroll-shadow");function Xy(n,t,e){const r=n,i=t.getBoundingClientRect(),o=e.getBoundingClientRect(),{paddingTop:s,paddingBottom:l}=qu(e);r.style.top=`${Ar(t,o.top-i.top+s)}px`,r.style.bottom=`${Ar(t,i.bottom-o.bottom+l)}px`}function Yy(n,t){const e=n;t<24?e.style.width=`${(t/3).toFixed(2)}px`:e.style.width=""}function CF(n){const t=Wu(n);p(fl,t,"no container tools");let e=t.querySelector(`.${Er.LEFT}`);if(!e){const l=Wr(n),c=[Er.COMMON,Er.LEFT];e=B("div",c,t),p(fl,e instanceof HTMLDivElement,"invalid child for container tools"),Xy(e,n,l)}p(fl,e instanceof HTMLElement,"invalid child for container tools");const i=yn(n).getBoundingClientRect(),o=n.getBoundingClientRect();e.style.left=`${Ar(n,o.left-i.left)}px`;const s=Wa(n).scrollLeft;p(fl,e instanceof HTMLDivElement,"invalid child for container tools"),Yy(e,s),z(e,Er.ACTIVE)}function EF(n){const t=Wu(n);let e=t.querySelector(`.${Er.RIGHT}`);if(!e){const h=Wr(n),C=[Er.COMMON,Er.RIGHT];e=B("div",C,t),p(fl,e instanceof HTMLDivElement,"no div, create shadow failed"),Xy(e,n,h)}p(fl,e instanceof HTMLElement,"");const i=yn(n).getBoundingClientRect(),o=n.getBoundingClientRect();e.style.right=`${Ar(n,i.right-o.right)}px`;const{scrollWidth:s,scrollLeft:l,clientWidth:c}=Wa(n),d=s-l-c;p(fl,e instanceof HTMLDivElement,"no shadow element"),Yy(e,d),z(e,Er.ACTIVE)}function AF(n){const e=Wu(n).querySelector(`.${Er.LEFT}`);e&&ot(e,Er.ACTIVE)}function xF(n){const e=Wu(n).querySelector(`.${Er.RIGHT}`);e&&ot(e,Er.ACTIVE)}function Xu(n){const{scrollLeft:t,scrollWidth:e,clientWidth:r}=Wa(n),i=Wr(n),{paddingLeft:o,paddingRight:s}=qu(i),l=uF(i,"offsetLeft");e-o<=r-s||e-o<=t+r-s?xF(n):EF(n),i&&t>=l+o?CF(n):AF(n)}class bF{constructor(t,e){m(this,"resizeObserver");m(this,"handleResizeEntry",t=>{const e=t.target,r=Wr(e);Xu(e),p0(this.scrollCore,r),Xa(this.scrollCore,e),this.callback(e)});m(this,"handleContentResize",t=>{t.forEach(e=>{this.containers.get(yn(e.target))?this.handleResizeEntry(e):this.unbind(e.target)})});this.scrollCore=t,this.callback=e,this.resizeObserver=new Us(this.handleContentResize)}get containers(){return this.scrollCore.containers}bind(t){this.unbind(t),this.resizeObserver.observe(t)}unbind(t){this.resizeObserver.unobserve(t)}destroy(){this.resizeObserver.disconnect()}}const Qy=I("container-scroll-observer");class vF{constructor(t,e){m(this,"handleContentScroll",t=>{const e=t.target;p(Qy,e instanceof Element,"invalid target for scroll event");const r=qa(e);r.removeEventListener("scroll",this.handleScroll);const i=!0;this.fixScrollXPos(e,e.scrollLeft,i),this.bind(r),Xu(e),this.callback(e)});m(this,"handleScroll",t=>{const e=t.target;p(Qy,e instanceof HTMLElement,"");const r=e.scrollLeft,i=!1,o=aF(e);this.unbindContentScroll(o),this.fixScrollXPos(o,r,i),this.bindContentScroll(o),Xu(o),this.callback(o)});m(this,"handlePrevent",t=>{t.stopPropagation()});m(this,"bindContentScrollCore",t=>{this.unbindContentScroll(t),t.addEventListener("scroll",this.handleContentScroll)});m(this,"unbindContentScroll",t=>{t.removeEventListener("scroll",this.handleContentScroll)});m(this,"bindContentScroll",Me.default(this.bindContentScrollCore,300));m(this,"bind",Me.default(this.bindCore,200));this.scrollCore=t,this.callback=e}fixScrollXPos(t,e,r){const i=qa(t);r||(t.scrollLeft=e),r&&i.scrollLeft!==e&&(i.scrollLeft=e)}bindCore(t){this.unbind(t),t.addEventListener("scroll",this.handleScroll),t.addEventListener("mousedown",this.handlePrevent)}unbind(t){t.removeEventListener("scroll",this.handleScroll),t.removeEventListener("mousedown",this.handlePrevent)}}class BF{constructor(t){m(this,"scrollContainers",new Set);m(this,"handleParentContainerScroll",()=>{this.scrollContainers.forEach(t=>{Xa(this.scrollCore,t)})});m(this,"bindScrollContainer",t=>{const e=this.scrollContainers.size===0;this.scrollContainers.add(t),e&&this.eventTarget.addEventListener("scroll",this.handleParentContainerScroll)});m(this,"unbindScrollContainer",t=>{let e=!1;this.scrollContainers.has(t)&&(this.scrollContainers.delete(t),e=this.scrollContainers.size===0),e&&this.eventTarget.removeEventListener("scroll",this.handleParentContainerScroll)});this.scrollCore=t}get eventTarget(){const t=this.scrollCore.getParentScrollContainer();return t===document.documentElement?document:t}destroy(){this.eventTarget.removeEventListener("scroll",this.handleParentContainerScroll),this.scrollContainers.clear()}}const TF=I("scroll-wrap-resize-observer");class yF{constructor(t){m(this,"resizeObserver");m(this,"handleScrollWrapResize",t=>{t.forEach(e=>{this.containers.get(yn(e.target))?this.handleScrollWrapResizeEntry(e):this.unbind(e.target)})});m(this,"handleScrollWrapResizeEntry",t=>{const e=t.target;p(TF,e instanceof HTMLElement,"invalid target for observer entry");const r=Wy(e);p0(this.scrollCore,e),Xu(r),Xa(this.scrollCore,r)});this.scrollCore=t,this.resizeObserver=new Us(this.handleScrollWrapResize)}get containers(){return this.scrollCore.containers}bind(t){this.unbind(t),this.resizeObserver.observe(t)}unbind(t){this.resizeObserver.unobserve(t)}destroy(){this.resizeObserver.disconnect()}}class kF{constructor(t,e){m(this,"resizeObserver");m(this,"scrollContainersMap",new Map);m(this,"handleResizeEntry",t=>{t==null||t.forEach(e=>{const r=Wr(e);Xu(e),p0(this.scrollCore,r),Xa(this.scrollCore,e),this.callback(e)})});m(this,"handleResize",t=>{t.forEach(e=>{const r=this.scrollContainersMap.get(e.target);r!=null&&r.length&&this.handleResizeEntry(r)})});this.scrollCore=t,this.callback=e,this.resizeObserver=new Us(this.handleResize)}bind(t){var i,o;const e=yn(t),r=(i=Gu(this.scrollCore,e))==null?void 0:i.locatingContainer;this.scrollContainersMap.has(r)?(o=this.scrollContainersMap.get(r))==null||o.push(t):(this.scrollContainersMap.set(r,[t]),this.resizeObserver.observe(r))}unbind(t){var o,s;const e=yn(t),r=(o=Gu(this.scrollCore,e))==null?void 0:o.locatingContainer;if(!r)return;const i=this.scrollContainersMap.get(r);this.scrollContainersMap.set(r,(i==null?void 0:i.filter(l=>l!==t))||[]),(s=this.scrollContainersMap.get(r))!=null&&s.length||(this.resizeObserver.unobserve(r),this.scrollContainersMap.delete(r))}destroy(){this.scrollContainersMap.clear(),this.resizeObserver.disconnect()}}const Cct="";class RF extends Be.TypedEmitter{constructor(e){super();m(this,"containerIntersectionObserver",null);m(this,"containerResizeObserver",null);m(this,"containerScrollObserver",null);m(this,"parentContainerScrollObserver",null);m(this,"scrollWrapResizeObserve",null);m(this,"locatingContainerResizeObserver",null);m(this,"isWindowEventBind",!1);m(this,"containers",new Map);m(this,"handleScrollContainerScroll",e=>{this.emit("scroll",this,e)});m(this,"handleResize",e=>{this.emit("resize",this,e)});m(this,"handleIntersection",e=>{const r=e.target,i=Wr(r);e.isIntersecting?(this.load(),this.bindCore(r,i)):this.unbindCore(r,i)});m(this,"handleWindowEffect",()=>{var e;(e=this.getScrollContainerInViewable())==null||e.forEach(r=>{Xa(this,r)})});this.parentContainer=e}load(){this.containerResizeObserver||(this.containerResizeObserver=new bF(this,this.handleResize)),this.containerScrollObserver||(this.containerScrollObserver=new vF(this,this.handleScrollContainerScroll)),this.parentContainerScrollObserver||(this.parentContainerScrollObserver=new BF(this)),this.scrollWrapResizeObserve||(this.scrollWrapResizeObserve=new yF(this)),this.locatingContainerResizeObserver||(this.locatingContainerResizeObserver=new kF(this,this.handleResize)),this.isWindowEventBind||(window.addEventListener("resize",this.handleWindowEffect),this.getParentScrollContainer()!==document.documentElement&&window.addEventListener("scroll",this.handleWindowEffect))}getParentScrollContainer(){return this.parentContainer}getScrollContainerInViewable(){var e;return(e=this.parentContainerScrollObserver)==null?void 0:e.scrollContainers}unbindCore(e,r){var o,s,l,c,d,h;const i=qa(e);(o=this.containerScrollObserver)==null||o.unbindContentScroll(e),(s=this.containerScrollObserver)==null||s.unbind(i),(l=this.scrollWrapResizeObserve)==null||l.unbind(r),(c=this.containerResizeObserver)==null||c.unbind(e),(d=this.parentContainerScrollObserver)==null||d.unbindScrollContainer(e),(h=this.locatingContainerResizeObserver)==null||h.unbind(e)}bindCore(e,r){var s,l,c,d,h,C;if(this.unbindCore(e,r),!e.closest("body"))return;const i=qa(e);(s=this.containerScrollObserver)==null||s.bindContentScrollCore(e),(l=this.containerScrollObserver)==null||l.bindCore(i),(c=this.scrollWrapResizeObserve)==null||c.bind(r),(d=this.containerResizeObserver)==null||d.bind(e);const o=this.containers.get(yn(e));o!=null&&o.allowScrollBarFixed&&((h=this.parentContainerScrollObserver)==null||h.bindScrollContainer(e)),(C=this.locatingContainerResizeObserver)==null||C.bind(e)}bind(e,r){this.containers.set(e,r);const i=e.firstElementChild;this.containerIntersectionObserver||(this.containerIntersectionObserver=new pF(this,this.handleIntersection)),this.containerIntersectionObserver.bind(i)}unbind(e){var o;const r=e.firstElementChild,i=Wr(r);this.unbindCore(r,i),this.containers.delete(e),(o=this.containerIntersectionObserver)==null||o.unbind(r),this.containers.size||this.destroy()}destroy(){var e,r,i,o,s;this.containers.forEach((l,c)=>{this.unbind(c)}),this.containers.clear(),(e=this.parentContainerScrollObserver)==null||e.destroy(),(r=this.containerIntersectionObserver)==null||r.destroy(),(i=this.containerResizeObserver)==null||i.destroy(),(o=this.scrollWrapResizeObserve)==null||o.destroy(),(s=this.locatingContainerResizeObserver)==null||s.destroy(),window.removeEventListener("resize",this.handleWindowEffect),window.removeEventListener("scroll",this.handleWindowEffect)}}const Jy=I("scroll-container"),C0=new Map;class wF extends Be.TypedEmitter{constructor(){super(...arguments);m(this,"scrollListener");m(this,"options");m(this,"scrollContainerElement");m(this,"init",e=>{this.options=e;const r=B("div",[os.CONTAINER],e.parentElement);ue.isMac&&z(r,os.MAC);const i=B("div",[os.SCROLL_CONTAINER],r),o=B("div",[os.SCROLL_AREA],i);o.style.paddingLeft=e.paddingLeft?`${e.paddingLeft}px`:"",o.style.paddingTop=e.paddingTop?`${e.paddingTop}px`:"",o.style.paddingBottom=e.paddingBottom?`${e.paddingBottom}px`:"",o.style.paddingRight=e.paddingRight?`${e.paddingRight}px`:"",o.appendChild(e.childElement);const s=e.parentContainer;this.scrollListener=C0.get(s),this.scrollListener||(this.scrollListener=new RF(s),C0.set(s,this.scrollListener)),this.scrollListener.unbind(r),this.scrollListener.bind(r,e),this.scrollListener.on("scroll",this.handleContainerScroll),this.scrollListener.on("resize",this.handleResize),this.scrollContainerElement=i});m(this,"handleContainerScroll",(e,r)=>{r===this.scrollContainerElement&&this.emit("scroll",this)});m(this,"handleResize",(e,r)=>{r===this.scrollContainerElement&&this.emit("scroll",this)})}get rootElement(){return this.scrollContainerElement}get contentElement(){return p(Jy,this.scrollContainerElement,"scrollContainerElement cannot be undefined"),Wr(this.scrollContainerElement)}get scrollOptions(){return p(Jy,this.options,"options cannot be undefined"),{...this.options}}handleBaseListenerDestroy(e){e.destroy()}destroy(){var r;(r=this.scrollListener)==null||r.off("scroll",this.handleContainerScroll);const e=yn(this.contentElement);e&&C0.forEach((i,o)=>{i.unbind(e),i.containers.size===0&&(this.handleBaseListenerDestroy(i),C0.delete(o))})}}function SF(){return new wF}const RC=I("column-width");function LF(n,t,e){NP(n,t).style.width=`${e}px`}function IF(n){const e=Array.from(n.querySelector("colgroup").children).map(c=>c.getBoundingClientRect().width);if(e[0]!==0)return e;const r=It.fromTable(n),i=Array(r.colCount).fill(-1),o=n.getBoundingClientRect().left;r.toRealCells(r.cells).forEach(c=>{const d=c.col+c.colSpan-1;i[d]===-1&&(i[d]=c.cell.getBoundingClientRect().right-o)}),RC.debug(`cellRightOffsets1: ${i.join()}`);for(let c=0;c<i.length;c++){const d=i[c];if(d===-1||c===0)continue;let h=c-1;for(;i[h]===-1&&(h--,h!==-1););const C=h===-1?0:i[h],x=(d-C)/(c-h);for(let v=h+1;v<c;v++)i[v]=C+x*(v-h)}RC.debug(`cellRightOffsets2: ${i.join()}`);const s=[];let l=0;for(let c=0;c<i.length;c++){const d=i[c];s.push(d-l),l=d}return RC.debug(`widths: ${s.join()}`),s}function Yu(n){return Array.from(n.querySelector("colgroup").children).map(r=>r.getBoundingClientRect().width||Number.parseInt(r.style.width,10))}const wC=200,DF=40,_F=I("table-resize-gripper"),Zy=7,SC=(Zy-1)/2,MF=3;function UF(n,t,e){const{rows:r}=n;for(let i=0;i<r.length;i++){const o=r[i],s=Array.from(o.cells);for(let l=0;l<s.length;l++){const c=s[l],d=c.getBoundingClientRect(),h=Math.round(d.right);if(Math.abs(t-h)<=SC&&d.top<=e&&e<=d.bottom)return c}}return null}function OF(n){return!!n.rootContainer.querySelector(".table-resize-gripper")}function LC(n,t){return vi(n,t).querySelector(".table-resize-gripper")}function tk(n,t){const e=LC(n,t);p(_F,!e,"resize gripper has already exists");const r=vi(n,t),i=B("div",["table-resize-gripper","table-indicator"],r);return B("div",["table-resize-gripper-indicator"],i),i}function ek(n,t,e){let r=LC(n,t);r||(r=tk(n,t));const o=Ve(t).getBoundingClientRect(),s=e.getBoundingClientRect(),l=0,c=o.height,d=n.getCustom(bi(t)).contentElement.getBoundingClientRect(),h=s.right-d.left;r.style.left=`${h-SC-Ga-ju}px`,r.style.top=`${l}px`,r.style.height=`${c}px`,r.style.width=`${Zy}px`}function IC(n){n.rootContainer.querySelectorAll(".table-resize-gripper").forEach(t=>{t.remove()})}function NF(n,t,e){const i={...n.getBlockData(t),colsWidth:e};n.updateBlockData(t,i)}function PF(n,t,e,r){const i=t,o=It.fromTable(e),s=o.getCellByCellElement(i),l=s.col+s.colSpan-1,c=Yu(e);let d=r;const h=(E,x)=>{const v=x+1,R=E.col+E.colSpan;return c.slice(v,R).reduce((M,U)=>M+U,0)},C=new Set;for(let E=0;E<o.rowCount;E++){const x=o.getCell({row:E,col:l});if(C.has(x.cell))continue;C.add(x.cell);const v=x.cell,R=v.getBoundingClientRect();let L=r-R.left+SC-MF;const M=Vu(v),U=l1(n,M)||DF*x.colSpan,F=h(x,l),G=U-F;L<G&&(L=G);const W=R.left+L;d=Math.max(d,W)}return d}const FF=I("table-resize-drag-drop");class KF{constructor(t,e,r,i){m(this,"cursor","col-resize");this.editor=t,this.elem=e,this.data=r,this.onEnd=i}onDragStart(t,e,r){}onDragging(t,e,r,i,o){const{table:s,block:l,draggingRefCell:c}=t.data,h=PF(this.editor,c,s,e.x-t.dragOffsetX)-s.getBoundingClientRect().left;p(FF,c,"no dragging cell");const E=It.fromTable(s).getCellByCellElement(c),x=E.col+E.colSpan-1,v=Yu(s),R=v.slice(0,x).reduce((M,U)=>M+U,0),L=h-R;if(LF(s,x,L),L){const M=parseFloat(s.style.minWidth);s.style.minWidth=`${M+(L-v[x])}px`}ek(this.editor,l,c),this.editor.selection.caret.update()}onDragEnd(t,e,r,i,o){const s=Yu(t.data.table);NF(this.editor,t.data.block,s),IC(this.editor),this.onEnd&&(this.onEnd(e),this.onEnd=null)}}function VF(n,t){const e=document.elementFromPoint(t.x,t.y);if(!e)return null;const r=J(e);return!r||!n.contains(r)||!$e(r)?null:r}I("table-resize");class $F{constructor(t){m(this,"draggingRefCell",null);m(this,"handleMouseMove",(t,e)=>{if(t.readonly||t.selectionHandler.isSelecting()&&!this.draggingRefCell||this.draggingRefCell)return;const r=e.target;if(!(r instanceof Element)||r.closest(".table-indicator"))return;const o=e,s=VF(t,o);if(!s||!Ly(s)||!t.isBlockWritable(s)){IC(t);return}this.updateGripper(s,o.x,o.y)});this.editor=t,t.domEvents.addEventListener(document,"mousemove",this.handleMouseMove)}destroy(){this.editor.domEvents.removeEventListener(document,"mousemove",this.handleMouseMove)}updateGripper(t,e,r){const i=Ve(t),o=UF(i,e,r);if(o){if(!LC(this.editor,t)){if(OF(this.editor))return;const l=tk(this.editor,t),c={block:t,table:i,draggingRefCell:o};Ug(new KF(this.editor,l,c,d=>{this.updateGripper(t,d.x,d.y)}))}ek(this.editor,t,o)}else IC(this.editor)}}function nk(n){n.addCustom("table-mouse-event-handler",t=>new $F(t))}const rk=I("table-insert-column");function ik(n,t,e){n.undoManager.runInGroup(()=>{var E;const r=Ve(t),i=It.fromTable(r),o=i.colCount;p(rk,e>=0&&e<=o,`insert index ${e} is out of range [0, ${o}]`);const s=i.map(x=>x.containerId),l=new Set;n.doc.beginBatchUpdate();for(let x=0;x<s.length;x++){const v=s[x],R=v[e-1],L=v[e];if(e===0||e===v.length||R!==L){const M=no(n.doc);v.splice(e,0,M)}else v.splice(e,0,R),l.add(R)}n.doc.endBatchUpdate();const c=mt.default(n.getBlockData(t));l.forEach(x=>{const v=`${x}_colSpan`,R=c[v];p(rk,typeof R=="number"&&R>1,`no colSpan for containerId ${x}, ${R}`),c[v]=R+1});const d=((E=c.colsWidth)==null?void 0:E.concat())||new Array(c.cols).fill(0);d.splice(e,0,wC);const h=It.virtualCellContainersGridToChildren(s),C={...c,cols:c.cols+1,children:h,colsWidth:d};cl(C),n.updateBlockData(t,C)})}const E0=I("table-insert-row");function DC(n,t,e){n.undoManager.runInGroup(()=>{const r=Ve(t),i=It.fromTable(r),o=i.rowCount;p(E0,e>=0&&e<=o,`insert index ${e} is out of range [0, ${o}]`);const s=i.map(E=>E.containerId),l=new Set;n.doc.beginBatchUpdate();const c=[];for(let E=0;E<i.colCount;E++){const x=e>0&&s[e-1][E],v=e<i.rowCount&&s[e][E];if(p(E0,x||v,"no top and bottom cell"),e===0||e===i.rowCount||x!==v){const R=no(n.doc);c.push(R)}else p(E0,x,"no top cell"),c.push(x),l.add(x)}n.doc.endBatchUpdate(),s.splice(e,0,c);const d=mt.default(n.getBlockData(t));l.forEach(E=>{const x=`${E}_rowSpan`,v=d[x];p(E0,typeof v=="number"&&v>1,`no rowSpan for containerId ${E}, ${v}`),d[x]=v+1});const h=It.virtualCellContainersGridToChildren(s),C={...d,rows:d.rows+1,children:h};cl(C),n.updateBlockData(t,C)})}const _C=I("paste-table-in-table-block");function HF(n,t,e,r,i){let o=It.fromBlock(e);const s=t.blocks.root[0];p(_C,s,"no table data"),p(_C,s.type==="table",`table data type is not table, but ${s.type}`);const l=s,c=o.getCellByCellElement(r),d=l.cols,h=l.rows,C=c.col,E=c.row,x=C+d,v=E+h,R=[];for(let L=C;L<x&&L<o.colCount;L++)for(let M=E;M<v&&M<o.rowCount;M++){const U=o.getCell({col:L,row:M});U.virtual?U.virtual&&R.push({col:L,row:M}):(U.colSpan>1||U.rowSpan>1)&&R.push({col:L,row:M})}n.undoManager.runInGroup(()=>{if(n.doc.beginBatchUpdate(),R.forEach(F=>{const G=It.fromBlock(e).getCell(F);(G.colSpan>1||G.rowSpan>1)&&AC(n,e,F)}),x>o.colCount)for(let F=o.colCount;F<x;F++)ik(n,e,F);if(v>o.rowCount)for(let F=o.rowCount;F<v;F++)DC(n,e,F);o=It.fromBlock(e);const L=new u0(l);let M;for(let F=0;F<L.colCount;F++)for(let G=0;G<L.rowCount;G++){const W=L.getCell({col:F,row:G});if(!W.virtual){const rt=lp(n.editorBlocks,t,W.containerId,i),st=C+F,Et=E+G,vt={col:st,row:Et},xt=o.getCellContainer(vt);o5(n,xt,rt,i),M=xt}}n.doc.endBatchUpdate(),p(_C,M,"no last container");const U=tn(M);n.selection.selectBlock(U,dt(n,U))})}const MC=I("paste-in-table-block");class jF{constructor(t){m(this,"pasteData");this.editor=t,setTimeout(()=>{t.input.addHandler(this)})}destroy(){this.pasteData=void 0}async handleBeforePaste(t,e,r,i){return this.pasteData={doc:r,files:i,event:e},!1}async handleBeforePasteDoc(t,e){var E,x,v,R;if(!t.selection.range.isSimple())return this.pasteData=void 0,!1;if(t.selection.range.start.offset!==0)return this.pasteData=void 0,!1;const i=t.selection.startBlock,o=it(i);if(Xt(o))return this.pasteData=void 0,!1;if(!uu(t,o))return this.pasteData=void 0,!1;const s=J(o);if(p(MC,s,"no parent block"),!$e(s))return this.pasteData=void 0,!1;if(e.blocks.root.length!==1)return this.pasteData=void 0,!1;if(e.blocks.root[0].type!=="table")return this.pasteData=void 0,!1;MC.debug("paste child table in table");const d=It.fromBlock(s).getCellByContainerId(ut(o)).cell;Tp(t,e);const h={blockIdMap:new Map,containerIdMap:new Map,boxIdMap:new Map};HF(t,e,s,d,h),p(MC,this.pasteData,"invalid paste data");const C=[];t.input.forEach(L=>{C.push(L)});for(let L=0;L<C.length&&!await((x=(E=C[L]).handleAfterPasteDoc)==null?void 0:x.call(E,t,e,h));L++);for(let L=0;L<C.length&&!await((R=(v=C[L]).handleAfterPaste)==null?void 0:R.call(v,t,this.pasteData.event,this.pasteData.doc));L++);return this.pasteData=void 0,!0}}function ok(n){n.addCustom("table-block-paste-event",t=>new jF(t))}const UC=I("table-select-columns");function zF(n,t,e,r,i){p(UC,$e(t),"is not a table block");const o=It.fromBlock(t);p(UC,e>=0&&e<o.colCount,"invalid from"),p(UC,r>0&&e+r<=o.colCount,"invalid count");const s=o.getCell({row:0,col:e}),l=o.getCell({row:o.rowCount-1,col:e+r-1}),c=Ee(t,s.containerId,{colIndex:e,rowIndex:0}),d=Ee(t,l.containerId,{colIndex:e+r-1,rowIndex:o.rowCount-1});i!=null&&i.reverse?n.selection.setSelection(d,c):n.selection.setSelection(c,d)}const OC=I("table-select-columns");function GF(n,t,e,r,i){p(OC,$e(t),"is not a table block");const o=It.fromBlock(t);p(OC,e>=0&&e<o.rowCount,"invalid from"),p(OC,r>0&&e+r<=o.rowCount,"invalid count");const s=o.getCell({row:e,col:0}),l=o.getCell({row:e+r-1,col:o.colCount-1}),c=Ee(t,s.containerId,{rowIndex:e,colIndex:0}),d=Ee(t,l.containerId,{rowIndex:e+r-1,colIndex:o.colCount-1});i!=null&&i.reverse?n.selection.setSelection(d,c):n.selection.setSelection(c,d)}const Ect="",sk=I("get-toolbar-reference-client");function lk(n,t){const e=n.selection.range;if(!e.isSimple()){p(sk,e.start.blockId===e.end.blockId,"invalid selection range");const s=n.getBlockById(e.start.blockId);p(sk,Mt(n,s),"not a complex block");const l=Qt(n,s);if(l.getTextToolbarReferenceClient){const c=l.getTextToolbarReferenceClient(n,s);if(c)return c}}const r=e.isReverse()?t.start:t.end,i=Xe(n,{anchor:r,focus:r}),o=Wi(n,t.block,i);if(o.length!==0)return o[0]}function WF(n){var t,e;if(n.children){let r=!1;const i=[];for(const o of n.children){if((t=o.states)!=null&&t.includes("checked")){r=!0;break}(e=n.defaultCheckedChildren)!=null&&e.includes(o.id)&&i.push(o)}if(!r&&(i==null?void 0:i.length))for(const o of i)Array.isArray(o.states)?o.states.push("checked"):o.states=["checked"]}}function A0(n){const t=(i,o)=>{const s=i.findIndex(c=>c.id===o.id);if(s===-1){i.push(o);return}const l=i[s];if(l.value!==o.value&&delete l.value,!!l.states){if(!o.states){l.states=[];return}l.states=kg.default(l.states,o.states)}},e=[],r=new Map;return n.forEach(i=>{var o,s;(o=i.children)!=null&&o.length&&(r.has(i.id)?(s=r.get(i.id))==null||s.push(...i.children):r.set(i.id,[...i.children])),t(e,i)}),r.forEach((i,o)=>{const s=e.find(l=>l.id===o);s&&(s.children=A0(i),WF(s))}),e}function x0(n){return n.findCustom("toolbar-handler")}const Act="";class qF{constructor(){m(this,"linkPopup",null);m(this,"form",{});m(this,"onFinished",null);m(this,"onClose",null);m(this,"handleOk",async()=>{var t;try{await this.checkValue();const{linkText:e,linkUrl:r}=this.form,i=this.formatUrl(r.getInputValue());(t=this.onFinished)==null||t.call(this,e.getInputValue()||i,i),this._destroy()}catch{}});m(this,"handleClose",()=>{var t;(t=this.onClose)==null||t.call(this),this._destroy()});m(this,"onShow",()=>{setTimeout(()=>{var t;(t=this.form.linkText)==null||t.getField().focus()},400)});m(this,"onChange",()=>{var e;const t=(e=this.linkPopup)==null?void 0:e.content.querySelector('[data-button-id="submit-button"]');t.disabled=!1});m(this,"handleTextKeyboard",t=>{var e;if(!t.isComposing){if(t.key==="Enter"){(e=this.form.linkUrl)==null||e.getField().focus(),t.stopPropagation();return}t.key==="Escape"&&this.handleClose()}});m(this,"handleUrlKeyboard",t=>{if(!t.isComposing){if(t.key==="Enter"){this.handleOk(),t.preventDefault();return}t.key==="Escape"&&this.handleClose()}})}async checkValue(){const{linkUrl:t}=this.form;if(!t.getInputValue())throw t.setFieldError(D.t("link.urlPlaceholder")),new Error(D.t("link.urlPlaceholder"))}formatUrl(t){if(!t)return"";try{new URL(t)}catch{return`${window.location.protocol}//${t}`}return t}editLink(t){var h,C;const{target:e,linkText:r,linkUrl:i,onFinished:o,onClose:s,placement:l="bottom-start"}=t;this.linkPopup=new $a(this.createPopupContent(r,i)),this.linkPopup.addListener("show",this.onShow),this.linkPopup.manualShow(e,{theme:"light",placement:l}),this.onFinished=o,s&&(this.onClose=s);const c=(h=this.linkPopup)==null?void 0:h.content.querySelector('[data-button-id="submit-button"]'),d=(C=this.linkPopup)==null?void 0:C.content.querySelector('[data-button-id="cancel-button"]');c==null||c.addEventListener("click",this.handleOk),d==null||d.addEventListener("click",this.handleClose)}createPopupContent(t,e){const r=B("div",["link-popup-content"],null);this.form.linkText=c0(r,{label:D.t("link.textLabel"),required:!1,placeholder:D.t("link.textPlaceholder"),defaultValue:t,onChange:this.onChange,onKeyDown:this.handleTextKeyboard}),this.form.linkUrl=c0(r,{className:"link-popup-gap",label:D.t("link.urlLabel"),required:!0,placeholder:D.t("link.urlPlaceholder"),defaultValue:e,onChange:this.onChange,onKeyDown:this.handleUrlKeyboard});const i=B("div",["link-popup-footer"],r),o=Cr("cancel-button",D.t("link.cancelText"));i.appendChild(o);const s=Cr("submit-button",D.t("link.submitText"),void 0,["disabled","primary"]);return i.appendChild(s),r}_destroy(){var r,i,o,s;const t=(r=this.linkPopup)==null?void 0:r.content.querySelector('[data-button-id="submit-button"]'),e=(i=this.linkPopup)==null?void 0:i.content.querySelector('[data-button-id="cancel-button"]');t==null||t.removeEventListener("click",this.handleOk),e==null||e.removeEventListener("click",this.handleClose),this.onFinished=null,this.onClose=null,this.form={},(o=this.linkPopup)==null||o.removeAllListeners(),(s=this.linkPopup)==null||s.destroy()}destroy(){this._destroy()}}function Qu(n,t){n.addCustom("link-editor",()=>new qF).editLink(t)}const XF=I("link-popup");function YF(n){return wt(n,"link")}function Ju(n){var t,e;return(e=(t=n.getAttribute("link"))!=null?t:n.textContent)!=null?e:""}function QF(n,t,e){var i,o,s,l;if(n.isBlockWritable(t)&&e&&hr(e)){const c=e,d=(o=(i=n.editorBoxes.getBoxClass(lu(c))).getBoxProperties)==null?void 0:o.call(i,n,c);if(d!=null&&d.boxCommands){const h=(l=(s=d.boxCommands["hovering-toolbar"])==null?void 0:s.commands)!=null?l:[];return{element:e,commands:h}}return{element:null,commands:[]}}if(n.isWritable()&&e&&nt(n,t)&&YF(e)){const c=B("a",["link-href-button"],null,Ju(e));c.href=Ju(e),c.target="_blank",c.rel="noopener noreferrer";const d=[{id:"link-text",name:Ju(e),disableTooltip:!0,element:c},{id:"edit-link",name:D.t("link.edit"),icon:s0},{id:"remove-link",name:D.t("link.remove"),icon:IT}];return{element:e,commands:d}}return Gv(n,t,"hovering-toolbar")}function ak(n,t,e){var l;const r=Wo(t,e),i=n.getBlockText(t),o={start:0,end:0};let s=(l=e.textContent)!=null?l:"";for(let c=0;c<i.length;c++){const d=i[c];if(o.end+d.insert.length>=r.end){o.end+=d.insert.length,s=d.insert;break}o.start<r.start&&(o.start+=d.insert.length,o.end=o.start)}return[o,s]}function JF(n,t,e){const[r,i]=ak(n,t,e);n.selection.selectBlock(t,r.start,r.end);const o=Ju(e),s=(h,C)=>{try{const E=n.getBlockText(t),x=K1(E,r.start,r.end-r.start),v=to(x,r.start,h,{link:C});n.setBlockText(t,v),n.selection.selectBlock(t,r.start+h.length),n.focus()}catch(E){XF.error(E)}},l=()=>{n.selection.selectBlock(t,r.end),n.focus()},c=Wi(n,t,n.selection.range)[0];if(!c)return;const d=Yi(n,t,"link-button-anchor",c);Qu(n,{target:d,linkText:i,linkUrl:o,onFinished:s,onClose:l})}function ZF(n,t,e){const[r]=ak(n,t,e),i=n.getBlockText(t),o=Ju(e),s=xa(r.start,r.end-r.start,i,"link",o);n.setBlockText(t,s),n.selection.selectBlock(t,r.end)}function tK(n,t,e,r){var s,l,c;if(e){if(n.isBlockWritable(t)&&hr(e)){const h=e,C=(l=(s=n.editorBoxes.getBoxClass(lu(h))).getBoxProperties)==null?void 0:l.call(s,n,h);if(C!=null&&C.boxCommands){C.boxCommands["hovering-toolbar"].executeCommand(n,t,h,r);return}return}const d=x0(n);d==null||d.disableTextToolbar(),d==null||d.hide(),setTimeout(()=>{d==null||d.enableTextToolbar()},400),r.id==="edit-link"?JF(n,t,e):r.id==="remove-link"&&ZF(n,t,e);return}const i=zv(n,t);if(!i)return;const o=(c=i.blockCommands)==null?void 0:c["hovering-toolbar"];!o||o.executeCommand(n,t,r)}function b0(){let n=8;for(;n>0&&!document.querySelector(`div[data-style-heading='${n}']`);)n--;return n}function qr(n){const e=n.selection.range;if(e.isCollapsed()||e.start.blockId!==e.end.blockId||!e.start.isSimple()||!e.end.isSimple()||e.end.offset-e.start.offset!==1)return!1;const r=n.getBlockById(e.start.blockId);return!(!nt(n,r)||Eu(n,r,e.start.offset).charType!=="box")}const eK=[Yh,Qh,Jh,Zh,t0,e0,n0,r0];class nK{constructor(t){m(this,"id","BlockTurnIntoCommandProvider");this.editor=t}getHeadingIndex(){let t=b0();return t<=4?t=5:t<8&&(t+=1),t}getAvailableCommands(t,e,r){if(!nt(t,e))return[];if(qr(t))return[];const i=lt(e),o=Dt(e),s=Dr(t,e),c=t.getBlockData(e).heading,d=[];for(let C=0;C<this.getHeadingIndex();C++)d.push({id:`heading-${C+1}`,name:D.t("commands.heading",{name:`${C+1}`}),icon:eK[C],states:c===C+1?["checked"]:[],value:`${C+1}`});const h=C=>{var x;const E=B("span",["toolbar-item-name-container"],null);for(const v of C.children)if((x=v.states)!=null&&x.includes("checked"))return E.innerHTML=v.icon||Ka,E;return E.innerHTML=Ka,E};return[{id:"turn-into",name:D.t("commands.headingGroup"),blockId:i,blockType:o,blockKind:s,element:h,groupIndex:200,dropdown:!0,manualShowChildren:!0,childrenPlacement:"bottom-start",defaultCheckedChildren:["text"],children:[{id:"text",name:D.t("commands.text"),icon:Ka,states:c?[]:["checked"]},...d],childrenType:"menu"}]}applyHeadingStyle(t,e,r){t.updateBlockData(e,{heading:r})}executeCommand(t,e,r,i){if(qr(t))return!1;if(nt(t,e)&&(i.id.startsWith("heading-")||i.id==="text")){const o=i.value?Number(i.value):null;return this.applyHeadingStyle(t,e,o),!0}return!1}}const rK=8,Se=I("list-block"),v0=I("list-block");function Kt(n){return Dt(n)==="list"}function Ue(n){p(v0,Kt(n),"not a list block")}function Jn(n){Ue(n);const t=n.getAttribute("data-list-type");return p(v0,t,"no list type"),t}function B0(n){return Kt(n)&&Jn(n)==="text-only"}function Zn(n){var t,e;return Ue(n),(e=Number.parseInt((t=n.getAttribute("data-list-start"))!=null?t:"1",10))!=null?e:1}function sn(n){var t,e;return Ue(n),(e=Number.parseInt((t=n.getAttribute("data-list-level"))!=null?t:"1",10))!=null?e:1}function Ya(n){Ue(n);const t=n.getAttribute("data-list-group-id");return p(v0,t,"no group id"),t}function ss(n){var o,s,l,c,d;Ue(n);const t=(o=n.getAttribute("data-list-type"))!=null?o:"ordered",e=(l=Number.parseInt((s=n.getAttribute("data-list-start"))!=null?s:"1",10))!=null?l:1,r=(d=Number.parseInt((c=n.getAttribute("data-list-level"))!=null?c:"1",10))!=null?d:1,i=n.getAttribute("data-list-group-id");return p(v0,i,"no group id"),{type:t,start:e,level:r,groupId:i}}function NC(n){switch(n){case"ordered":return{ordered:!0,checkbox:null,textOnly:null};case"unordered":return{ordered:!1,checkbox:null,textOnly:null};case"checked":return{checkbox:"checked",ordered:!1,textOnly:null};case"unchecked":return{checkbox:"unchecked",ordered:!1,textOnly:null};case"text-only":return{checkbox:null,ordered:!1,textOnly:!0};default:return{checkbox:null,ordered:!0,textOnly:!1}}}function iK(n){const t={M:1e3,CM:900,D:500,CD:400,C:100,XC:90,L:50,XL:40,X:10,IX:9,V:5,IV:4,I:1};let e="",r=n;return Object.entries(t).forEach(([i,o])=>{for(;r>=o;)e+=i,r-=o}),e.toLowerCase()}const oK="abcdefghijklmnopqrstuvwxyz";function ck(n){if(n<=0)return`${n}`;const t=(n-1)%26,e=Math.floor((n-1)/26),r=oK[t];return e?ck(e)+r:r}function sK(n){return`${n}`}const uk=[sK,ck,iK];function lK(n,t){const e=uk[(n-1)%uk.length];return e(t)}function aK(n){return["\u2022","\u25E6","\u25AA"][(n-1)%3]}function ls(n,t){Ue(n);const{level:e,groupId:r,type:i}=ss(n);let o=Ae(n);for(;o;){if(!Kt(o))return null;const{level:s,groupId:l,type:c}=ss(o);if(s<e)return null;if(e===s&&((t==null?void 0:t.ignoreGroupId)||r===l)&&(c==="text-only"||i==="text-only"||i===c))return o;o=Ae(o)}return null}function fk(n){return ls(n,{ignoreGroupId:!0})}function dl(n){Ue(n);const{level:t,groupId:e,type:r}=ss(n);let i=Zt(n);for(;i;){if(Kt(i)){const{level:o,groupId:s,type:l}=ss(i);if(t===o&&e===s&&(l==="text-only"||r==="text-only"||r===l))return i;if(o<t)return null}i=Zt(i)}return null}function dk(n){Ue(n);const t=[];let e=ls(n);for(;e;)t.unshift(e),e=ls(e);return t}function Qa(n){Ue(n);const t=[];let e=dl(n);for(;e;)t.push(e),e=dl(e);return t}function Zu(n){Ue(n);let t=ls(n);for(;t;){const e=ls(t);if(!e)return t;t=e}return n}function cK(n){Ue(n);let t=dl(n);for(;t;){const e=dl(t);if(!e)return t;t=e}return null}function hk(n,t){const e=dk(n),r=Qa(n);return t.withSelf?[...e,n,...r]:[...e,...r]}function T0(n){Ue(n);let t=n;const e=dk(n);e.length>0&&(t=e[0]);const r=Ae(t);return!r||!Kt(r)?null:sn(r)<sn(t)?r:null}function uK(n,t){Ue(n);let e=n;for(;e;){const r=sn(e);if(r===t)return e;if(r>t)e=T0(e);else if(r<t)return null}return null}function fK(n){let t=Zu(n);for(;;){const e=T0(t);if(!e)return t;t=Zu(e)}}class dK{constructor(){m(this,"nodeMap",new Map);m(this,"rootNodes",[])}addNode(t,e){const r={block:e,children:[]};if(this.nodeMap.set(e,r),t){const i=this.nodeMap.get(t);p(Se,i,"no parent node"),i.children.push(r)}else this.rootNodes.push(r)}}function mk(n,t){const e=fK(t),r=new dK;r.addNode(null,e);let i=Zt(e);for(;i&&Kt(i);){if(B0(i)){r.addNode(null,i),i=Zt(i);continue}if(sn(i)===0&&Jn(i)!==Jn(e))break;const s=T0(i);r.addNode(s,i),i=Zt(i)}return r.rootNodes}function hK(n){const t=document.fullscreenEnabled||document.mozFullScreenEnabled||document.documentElement.webkitRequestFullScreen,e=r=>{if(r.requestFullscreen)return r.requestFullscreen();if(r.mozRequestFullScreen)return r.mozRequestFullScreen();if(r.webkitRequestFullScreen){try{document.fullscreenElement=n}catch{}return r.webkitRequestFullScreen()}return Promise.resolve(0)};return t?e(n):Promise.resolve(0)}function gk(){const e=(document.exitFullscreen||document.webkitExitFullscreen).bind(document)();try{document.fullscreenElement=null}catch{}return e}function PC(n){return wt(n,"editor-in-mindmap-first")}function FC(n){if(p(Se,Kt(n),"not a list block"),wt(n,"editor-in-mindmap-first")||!su(n))return!0;const t=n.classList,e="editor-mindmap-root-";return!!Array.from(t).find(i=>{if(i.startsWith(e))return i})}function mK(n,t,e){const r=it(n);if(t){const s=it(t);p(Se,r===s,"invalid block container")}const i=Bt(n);if(t){const s=Bt(t);p(Se,i<=s,"invalid block index")}if(z(n,...e),!t||t===n)return;let o=Zt(n);for(;o!==t;)p(Se,o,"no next button"),z(o,...e),o=Zt(o);o&&z(o,...e)}function gK(n){const t=`editor-mindmap-root-${n.id}`,r=it(n).querySelectorAll(`.${t}`);return r[r.length-1]}async function pK(n,t,e){const r=ie(t),i=r.querySelector('[data-button-id="mindmap-fullscreen"]');p(Se,i,"no full screen button");const o=()=>{setTimeout(()=>{e.toMindmap(n,t,{},{reset:!0,mindmapTools:e})},300)},s=()=>{ot(r,"fullscreen"),i.innerHTML=aC,i.setAttribute(`data-editor-tooltip-${n.clientId}-dynamic`,D.t("mindmap.fullScreen")),FC(t)&&setTimeout(()=>{o()},300)};if(document.fullscreenElement===r){try{await gk()}catch(l){Se.error(l)}s()}else{try{z(r,"fullscreen"),await hK(r),o()}catch(l){Se.error(l)}i.innerHTML=hy,i.setAttribute(`data-editor-tooltip-${n.clientId}-dynamic`,D.t("mindmap.exitFullscreen"))}r.onfullscreenchange=()=>{document.fullscreenElement||s()}}function KC(n,t,e,r,i){if(t.querySelector(`[data-button-id="${e}"]`))return null;const s=Cr(e,r,i,[]);return s.setAttribute(`data-editor-tooltip-${n.clientId}-dynamic`,r),z(s,"mindmap-button"),t.appendChild(s),s}function VC(n,t){return n.querySelector(`[data-button-id="${t}"]`)}function CK(n){return VC(n,"mindmap-fullscreen")}function EK(n){return VC(n,"mindmap-fit")}function AK(n){return VC(n,"mindmap-close")}function xK(n,t,e,r){const i=KC(n,t,"mindmap-close",D.t("mindmap.close"),qh);!i||n.domEvents.addEventListener(i,"click",()=>{r.closeMindmap(n,e)})}function bK(n,t,e,r){const i=KC(n,t,"mindmap-fit",D.t("mindmap.autoFit"),dy);!i||n.domEvents.addEventListener(i,"click",()=>{r.fitMindmap(n,e)})}function vK(n,t,e,r){if(navigator.userAgent.includes("Mobile")&&!navigator.userAgent.includes("iPad"))return;const o=KC(n,t,"mindmap-fullscreen",D.t("mindmap.fullScreen"),aC);!o||n.domEvents.addEventListener(o,"click",()=>{pK(n,e,r)})}function BK(n,t){const e=Gd(t);if(!e)return;const r=EK(e);r&&(r.remove(),n.domEvents.removeAllListeners(r));const i=AK(e);i&&(i.remove(),n.domEvents.removeAllListeners(i));const o=CK(e);o&&(o.remove(),n.domEvents.removeAllListeners(o))}const Ja=new Map;function $C(n,t,e){const r=(s,l)=>{s.forEach(c=>{l?z(c.block,"to-mindmap-highlight"):ot(c.block,"to-mindmap-highlight"),r(c.children,l)})},i=mk(n,t);if(i.length===0)return;const o=i[0].block;if(e){const s=Ja.get(o);s&&(s.forEach(l=>l.cancel()),Ja.delete(o)),r(i,!0)}else{const s=setTimeout(()=>{r(i,!1),Ja.delete(o)},300),l=()=>{clearTimeout(s),Ja.delete(o)},c=Ja.get(o);c?c.push({cancel:l}):Ja.set(o,[{cancel:l}])}}const{Markmap:TK}=i9;function yK(n,t){Ue(t);const e=mk(n,t),r=e[0].block,i=d=>({t:"text",v:Ot(d.block).textContent,d:1,c:d.children.length>0?d.children.map(C=>i(C)):void 0});let o=null;e.length>1?o={t:"root",v:"root",d:0,c:e.length>0?e.map(d=>i(d)):void 0}:o=i(e[0]);const l=d=>{if(d.length===0)return null;const h=d[d.length-1];return h.children&&h.children.length>0?l(h.children):h},c=l(e);return{root:o,block:r,nodes:e,last:c}}function y0(n,t,e,r){const{root:i,block:o,last:s}=yK(n,t);r.selectBlock&&n.selection.selectBlock(o,0,0),$C(n,o,!1),r.saveData&&n.updateBlockData(o,{viewAsMindmap:!0});const l=ie(o);let c=l.querySelector(".editor-mindmap-svg");if(r.reset&&(c&&c.remove(),c=null),c)c.innerHTML="";else{const M="http://www.w3.org/2000/svg",U=l.getBoundingClientRect(),F=document.fullscreenElement===l,G=F?`${U.width}`:`${t.getBoundingClientRect().width}`,W=F?`${U.height}`:"600",rt=document.createElementNS(M,"svg");rt.setAttributeNS(null,"viewBox",`0 0 ${G} ${W}`),rt.setAttributeNS(null,"width","100%"),rt.setAttributeNS(null,"height",W),rt.style.display="block",rt.style.width="100%",rt.style.height=`${W}px`,rt.classList.add("editor-mindmap-svg"),l.appendChild(rt),c=rt}const d=o,C=`editor-mindmap-root-${lt(o)}`;z(d,"editor-in-mindmap-first",C,"readonly"),d.contentEditable="false";const E=Zt(o);E&&Bt(E)<=Bt(s.block)&&mK(E,s.block,["block-hidden",C]);const x=(M,U)=>{if(U.length>0){const F=U[0].parentElement;F&&(F.style.width="100vw",F.style.maxWidth="200px")}U.forEach(F=>{z(F,"editor-mindmap-node")})},v=new TK(c,{...e,autoFit:!0});v.viewHooks.transformHtml.tap(x),v.setData(i),v.fit();const R=ie(o);let L=R.querySelector(".mindmap-toolbar");L||(L=B("div",["mindmap-toolbar"],R)),bK(n,L,d,r.mindmapTools),vK(n,L,d,r.mindmapTools),xK(n,L,d,r.mindmapTools),n.domEvents.addEventListener(c,"click",()=>{n.selection.selectBlock(o,0),n.input.focus()}),d.mindMap=v}function kK(n){const t=B("div",["list-to-mindmap-wrap"],null),e=Cr("list-to-mindmap",D.t("mindmap.viewAsMindMap"),fy,[],n.clientId);return t.appendChild(e),t}async function pk(n,t){const e=`editor-mindmap-root-${t.id}`,r=it(t);fe(r).forEach(l=>{wt(l,e)&&ot(l,e,"editor-in-mindmap-first","block-hidden")});const o=ie(t);document.fullscreenElement===o&&await gk();const s=o.querySelector(".editor-mindmap-svg");!s||(p(Se,s,"no mindmap svg"),s.remove(),n.domEvents.removeAllListeners(s),BK(n,t))}function RK(n){const t=n.classList,e="editor-mindmap-root-";return Array.from(t).find(i=>{if(i.startsWith(e))return i})}async function Ck(n,t){!RK(t)||(n.updateBlockData(t,{viewAsMindmap:null}),pk(n,t),n.selection.selectBlock(t,0))}function wK(n,t){const e=t.mindMap;e&&e.fit()}const k0={toMindmap:y0,closeMindmap:Ck,fitMindmap:wK},xct="";class R0{constructor(t){m(this,"toMindmapButton");m(this,"currentBlock",null);m(this,"handleHoveringBlock",t=>{t&&Kt(t)&&Jn(t)!=="unchecked"&&Jn(t)!=="checked"&&this.editor.isWritable()?ie(t).appendChild(this.toMindmapButton):this.toMindmapButton.remove()});m(this,"handleMouseEnter",()=>{const t=J(this.toMindmapButton);p(Se,t&&Kt(t),"no parent list"),$C(this.editor,t,!0),this.currentBlock=t});m(this,"handleMouseLeave",()=>{this.currentBlock&&($C(this.editor,this.currentBlock,!1),this.currentBlock=null)});m(this,"handleClick",()=>{const t=J(this.toMindmapButton);p(Se,t&&Kt(t),"no parent list"),y0(this.editor,t,{},{saveData:!0,selectBlock:!0,mindmapTools:k0})});this.editor=t,Te.get(this.editor).addListener("change",this.handleHoveringBlock),this.toMindmapButton=kK(t),t.domEvents.addEventListener(this.toMindmapButton,"mouseenter",this.handleMouseEnter),t.domEvents.addEventListener(this.toMindmapButton,"mouseleave",this.handleMouseLeave),t.domEvents.addEventListener(this.toMindmapButton,"click",this.handleClick)}static get(t){return t.findCustomByType(R0)}destroy(){Te.get(this.editor).removeListener("change",this.handleHoveringBlock)}hide(){this.currentBlock&&(this.currentBlock=null),this.toMindmapButton.remove()}}function SK(n,t,e){var r;t==="beginDrag"&&((r=R0.get(n))==null||r.hide())}function Za(n,t,e,r){var o;const i=(o=r==null?void 0:r.groupId)!=null?o:tt();t.forEach(s=>{const l=n.getBlockData(s);if(l.start!==e||(r==null?void 0:r.resetGroupId)){const c={...l,start:e};r!=null&&r.resetGroupId&&(c.groupId=i),n.updateBlockData(s,c)}l.textOnly||(e+=1)})}function HC(n,t,e,r){const i=hk(t,{withSelf:!0});i.length!==0&&Za(n,i,e,r)}class w0{constructor(t,e){m(this,"listStart",0);m(this,"listBrother",null);if(this.editor=t,B0(e))return;const r=Zu(e),i=Zn(r);this.listStart=i,r===e?this.listBrother=dl(r):this.listBrother=r}fix(){!this.listBrother||HC(this.editor,this.listBrother,this.listStart)}}class hl{constructor(t,e,r){m(this,"listStart");m(this,"listBrother",null);this.editor=t,this.options=r;const i=Zu(e),o=Zn(i);this.listStart=o,this.listBrother=i,r!=null&&r.resetStart&&(this.listStart=1)}fix(){!this.listBrother||HC(this.editor,this.listBrother,this.listStart,this.options)}}class Ek{constructor(t,e,r){m(this,"listStart");m(this,"listNextBrothers",[]);this.editor=t,this.listNextBrothers=Qa(e);const{start:i,resetStart:o}=r||{};this.listStart=o?1:i!=null?i:1}fix(){!this.listNextBrothers.length||Za(this.editor,this.listNextBrothers,this.listStart)}}function LK(n,t,e){n.getBlockData(t).quoted&&(e.quoted=!0)}function jC(n,t,e,r){if(Se.debug("drag a block on a list block"),!nt(n,t))return!1;p(Se,Kt(e),"target is not a list block");const{type:i,start:o,level:s,groupId:l}=ss(e),c=r==="after"?o+1:o,d=n.getBlockData(t),h={id:tt(),type:"list",groupId:l,level:s,start:c,text:d.text,...NC(i)};LK(n,e,h);let C=Bt(e);const E=it(e);r==="after"&&(C+=1);let x=null;Kt(t)&&(x=new w0(n,t));const v=n.insertBlock(ut(E),C,h,gh(h.id,0));return n.deleteBlock(t),new hl(n,v).fix(),x==null||x.fix(),!0}function IK(n,t,e,r){if(Se.debug("drag a list between text blocks"),r==="after"){const d=Zt(e);if(d&&Kt(d))return jC(n,t,d,"before")}if(r==="before"){const d=Ae(e);if(d&&Kt(d))return jC(n,t,d,"after")}const o={...n.getBlockData(t),groupId:tt(),start:1,level:1};let s=Bt(e);const l=it(e);r==="after"&&(s+=1),n.insertBlock(ut(l),s,o,gh(o.id,0));const c=new w0(n,t);return n.deleteBlock(t),c.fix(),!0}function DK(n,t,e,r,i){if(Vd(e))return!1;const{blockId:o}=e,s=n.getBlockById(o);p(Se,s,"no dragged block");const{isSourceBlock:l,targetBlock:c}=i;return!l&&c?(p(Se,t===c,"block !== target block"),p(Se,Kt(c),"target is not a list block"),jC(n,s,c,r)):IK(n,s,c,r)}function Ak(n,t){if(!n.isWritable())return!1;const e=n.selection.range,i=n.editorCommandProviders.getCommands(e).find(o=>o.id===t);return i?(n.editorCommandProviders.executeCommand(e,i,{}),!0):!1}const _K={"Shift+CtrlOrCmd+L":n=>Ak(n,"ordered-list"),"Shift+CtrlOrCmd+U":n=>Ak(n,"unordered-list")};function S0(n){const t=n.getAttribute("block-padding-level");return t?Number(t):null}function MK(n,t){let e;const r=S0(t);if(!r)e=1;else{if(r>=12)return e=12,!1;e=r+1}return n.updateBlockData(t,{...n.getBlockData(t),padding:e}),!0}function xk(n,t){const e=S0(t);if(!e)return!1;const r=n.getBlockData(t);return e>1?(n.updateBlockData(t,{...r,padding:e-1}),!0):(n.updateBlockData(t,{...r,padding:null}),!0)}function zC(n){return n.readonly||!n.isWritable()}function UK(n){return n.selection.range.getSelectedBlocks().forEach(e=>{const r=e.block;nt(n,r)&&MK(n,r)}),!0}function OK(n){return n.selection.range.getSelectedBlocks().forEach(e=>{const r=e.block;nt(n,r)&&xk(n,r)}),!0}function NK(n){return zC(n)?!1:n.undoManager.runInGroup(()=>(UK(n),!0))}function PK(n){return zC(n)?!1:n.undoManager.runInGroup(()=>(OK(n),!0))}function FK(n){if(zC(n))return!1;if(!n.selection.range.isCollapsed())return;const t=n.selection.focusedBlock;if(!nt(n,t))return;const e=n.selection.range.focus;if(!(!e.isSimple()||e.offset!==0||!S0(t)))return xk(n,t),!0}class GC{renderBlock(t,e,r){const{padding:i}=r;return i?{attributes:{"block-padding-level":i}}:{}}}const bct="",KK={Tab:NK,"Shift+Tab":PK,Backspace:FK};function VK(n,t,e=1){if(!t)return null;let r=Ae(n);for(;r;){const i=r.getAttribute("data-style-heading"),o=Number(r.getAttribute("data-list-level"));if(i){if(i<t)return null;if(i===t&&o===e)return Kt(r)?r:null}r=Ae(r)}return null}function $K(n,t){const e=n.getAttribute("data-style-heading"),r=VK(n,e);if(r)return r;const i=Ae(n);if(i&&Kt(i)&&Jn(i)===t)return i;const o=Zt(n);return o&&Kt(o)&&Jn(o)===t?o:null}function HK(n,t,e){var R,L,M;const r=(R=e.data)!=null?R:{};let i=1;if(Kt(t))i=sn(t);else{const U=S0(t);U&&(i=U+1),i>8&&(i=8)}const o=(L=r.listType)!=null?L:"ordered";if(o==="text-only")return null;const s=n.getBlockData(t);let l=(M=s.text)!=null?M:[],d=de(l);const h=e.offset||0;h<=dn(l)&&(l=Dn(l,h).right,d=d.substring(0,h));let C=1;o==="ordered"&&(C=Number.parseInt(d,10)||1);let E=tt();const x=$K(t,o);if(x)if(sn(x)===i){if(Bt(t)>Bt(x))C=Zn(x)+1;else{const U=Zn(x);U>1&&(C=U-1),new Ek(n,x,{start:C+1}).fix()}E=Ya(x)}else{const U=uK(x,i);U&&(C=Zn(U)+1)}else Kt(t)&&new Ek(n,t,{start:1}).fix();const v={id:tt(),type:"list",level:i,start:C,groupId:E,ordered:!1,text:l};return s.quoted&&(v.quoted=!0),s.heading&&(v.heading=s.heading),o==="ordered"?v.ordered=!0:(o==="checked"||o==="unchecked")&&(v.checkbox=o),{blockData:v,onConverted:(U,F)=>{new hl(U,F).fix()}}}function tc(n){return n.textOnly?"text-only":n.checkbox?n.checkbox:n.ordered?"ordered":"unordered"}function jK(n){var e,r;if(n.checkbox)return"";const t=(e=n.level)!=null?e:1;return n.ordered?`${lK(t,(r=n.start)!=null?r:1)}.`:aK(t)}function L0(n){return n==="checked"||n==="unchecked"}function bk(n,t,e,r){const i=t,{containerId:o,blockIndex:s}=r[r.length-1];if(s===0)return!0;const l=e.blocks[o][s-1];if(l.type!=="list")return!0;const c=tc(i),d=tc(l);return c!==d&&(!L0(c)||!L0(d))||(i.level||1)>(l.level||1)}function vk(n,t,e,r){const i=t,{containerId:o,blockIndex:s}=r[r.length-1];if(s===e.blocks[o].length-1)return!0;const l=e.blocks[o][s+1];if(l.type!=="list")return!0;const c=tc(i),d=tc(l);return c!==d&&(!L0(c)||!L0(d))||(i.level||1)>(l.level||1)}function zK(n,t,e,r,i){var s,l,c;const o=t;if(r==="text")return((s=Un.convertTo)==null?void 0:s.call(Un,n,t,e,"text",i))||"";if(r==="markdown"){let d=((l=Un.convertTo)==null?void 0:l.call(Un,n,t,e,"markdown",i))||"";o.checkbox==="checked"?d=`[x] ${d}`:o.checkbox==="unchecked"&&(d=`[ ] ${d}`),o.ordered?d=`${o.start}. ${d}`:d=`- ${d}`;const h=o.level||0;return d=(h>0?" ".repeat(h-1):"")+d,bk(n,t,e,i)&&(d=`${d}`),vk(n,t,e,i)&&(d=`${d}`,h<=1&&(d+=`
|
|
614
614
|
`)),d}if(r==="html"){let d=((c=Un.convertTo)==null?void 0:c.call(Un,n,t,e,"html",i))||"";d=d.replace("<p>","").replace("</p>",""),o.checkbox==="checked"?d=`<input type="checkbox" checked="checked" disabled="disabled" /> ${d}`:o.checkbox==="unchecked"&&(d=`<input type="checkbox" disabled="disabled" /> ${d}`);let h="ul",C="";if(o.ordered)switch(d=`<li value="${o.start}">${d}</li>`,h="ol",o.level){case 2:case 5:case 8:C="list-style-type: lower-alpha;";break;case 3:case 6:C="list-style-type: lower-roman;";break}else d=`<li>${d}</li>`;return bk(n,t,e,i)&&(d=`<${h}${C?` style="${C}"`:""}>${d}`),vk(n,t,e,i)&&(d=`${d}</${h}>`),d}return""}function Bk(n){const t=B("label",["editor-check-list-wrapper"],null);n&&z(t,"editor-check-list-wrapper-checked");const e=B("span",["editor-check-box"],t);return B("span",["editor-check-box-inner"],e),t}function GK(n,t){const e=tc(t);if(e!=="text-only"){if(e==="checked"){n.append(Bk(!0));return}if(e==="unchecked"){n.append(Bk(!1));return}n.innerText=jK(t)}}function WK(n){const t=B("div",["list-container"],null),e=B("button",["list-marker"],t);return GK(e,n),t}function ec(n,t){Ue(t);const e=n.getBlockData(t),r={id:tt(),type:"text",text:e.text};e.heading&&(r.heading=e.heading),e.heading&&(r.heading=e.heading);const i=new w0(n,t),o=it(t),s=Bt(t);n.deleteBlock(t);const l=gh(r.id,0);if(uu(n,o)&&!Xt(o)){const c=we(o);n.insertBlock(ut(o),s,r,l),n.deleteBlock(c)}else n.insertBlock(ut(o),s,r,l);i.fix()}function qK(n){if(!n.selection.range.isCollapsed())return!1;const t=n.selection.focusedBlock;if(!Kt(t))return!1;const e=n.selection.range.focus;return!e.isSimple()||e.offset!==0?!1:(ec(n,t),!0)}function Tk(n){let t=Zt(n);if(!t)return null;const e=dl(n);for(;t!==e;){if(p(Se,t,"no next block"),Kt(t))return sn(t)>sn(n)?t:null;if(t=Zt(t),!t)return null}return null}function WC(n){const t=[];let e=Tk(n);if(!e)return t;for(;e;){const r=dl(e);t.push({block:e,children:WC(e)}),e=r}return t}function XK(n){const t=(r,i)=>{i.push(r.block),r.children.forEach(o=>t(o,i))},e=[];return n.forEach(r=>t(r,e)),e}function yk(n,t){return sn(t)!==1}function kk(n,t,e){t.forEach(r=>{const i=n.getBlockData(r.block);n.updateBlockData(r.block,{...i,groupId:e,level:(i.level||1)-1}),r.children.length&&kk(n,r.children,i.groupId)})}function qC(n,t){if(!yk(n,t))return!1;const e=sn(t);if(e===1)return!1;let r=tt(),i=1,o=Jn(t);const s=e-1,l=T0(t);l&&(r=Ya(l),i=Zn(l)+1,o!=="text-only"&&(o=Jn(l)));const c=WC(t),d=n.getBlockData(t),h={...d,groupId:r,level:s,start:i,...NC(o)};n.updateBlockData(t,h),n.doc.beginBatchUpdate(),kk(n,c,d.groupId),n.doc.endBatchUpdate(),new hl(n,t).fix();const E=Tk(t);return E&&new hl(n,E,{resetStart:!0,resetGroupId:!0}).fix(),!0}const YK=I("list-block");function QK(n,t,e){p(YK,Kt(t),"not a list block");const r={...n.getBlockData(t),id:tt()};return e!=null&&e.level&&(r.level=e.level),e!=null&&e.start&&(r.start=e.start),e!=null&&e.keepText||delete r.text,(r==null?void 0:r.checkbox)==="checked"&&(r.checkbox="unchecked"),r}function JK(n){if(Ue(n),!B0(n))return n;let t=ls(n);for(;t;){if(!B0(t))return t;t=ls(t)}return null}function ZK(n,t,e,r){const i=new hl(n,r),o=Zn(r)+1;wa(n,t,e,{forceInsertAfter:!0,newBlockData:QK(n,r,{start:o})}),i.fix()}function tV(n){var s;if(n.selection.range.isCollapsed()){const l=n.selection.focusedBlock;if(Kt(l)&&dt(n,l)===0)return sn(l)===1?ec(n,l):qC(n,l),!0}n.clearSelectedContents();const t=n.selection.focusedBlock;if(!Kt(t))return!1;const e=n.selection.range.focus;if(!e.isSimple())return!1;const r=e.offset,o=(s=r===dt(n,t)?JK(t):t)!=null?s:t;return ZK(n,t,r,o),!0}function Rk(n){p(Se,Kt(n),"not a list block");const{level:t}=ss(n);let e=Ae(n);for(;e;){if(Kt(e)){const{level:r}=ss(e);if(t===r)return e;if(r<t)return null}e=Ae(e)}return null}function wk(n,t){return Ue(t),Rk(t)?sn(t)<rK:!1}function eV(n,t,e){let r=Ae(t);p(Se,r,"no prev brother");const i=sn(e);for(;r;){if(r===e)return null;if(Kt(r)&&sn(r)===i+1)return r;r=Ae(r)}return null}function Sk(n,t){if(!wk(n,t))return!1;Ue(t);const e=Rk(t);p(Se,e,"no list prev brother");const r=e,i=eV(n,t,r),o=sn(r)+1;let s=tt(),l=1,c=Jn(t);i&&(s=Ya(i),l=Zn(i)+1,c=Jn(i));const d=WC(t),C={...n.getBlockData(t),groupId:s,level:o,start:l,...NC(c)};return n.updateBlockData(t,C),n.doc.beginBatchUpdate(),XK(d).forEach(x=>{const v=n.getBlockData(x);n.updateBlockData(x,{...v,level:(v.level||1)+1})}),n.doc.endBatchUpdate(),!0}function nV(n,t,e){return t.length===0||!t.every(r=>Kt(r.block))?!1:e==="increase"?wk(n,t[0].block):yk(n,t[0].block)}function Lk(n,t,e){if(!nV(n,t,e))return!1;const r=t[0].block,i=sn(r),o=t.filter(d=>sn(d.block)<=i),s=hk(r,{withSelf:!1}),l=new Set(o.map(d=>d.block)),c=s.filter(d=>!l.has(d));return n.undoManager.runInGroup(()=>{let d=null;c.length>0&&(d=new hl(n,c[0])),o.forEach(h=>{e==="increase"?Sk(n,h.block):qC(n,h.block)}),d==null||d.fix()}),!0}function rV(n,t){return Sk(n,t)}function iV(n,t){return qC(n,t)}function oV(n){const t=n.selection.range.getSelectedBlocks();if(t.length>1)return Lk(n,t,"increase"),!0;const e=t[0].block;if(!Kt(e))return!1;const r=new w0(n,e);return rV(n,e)&&(r.fix(),new hl(n,e).fix()),!0}function sV(n){const t=n.selection.range.getSelectedBlocks();if(t.length>1)return Lk(n,t,"decrease"),!0;const e=t[0].block;return Kt(e)?(iV(n,e),!0):!1}class lV{constructor(t){this.editor=t}handleBeforeKeyDown(t,e){const r=t.selection.range.getSelectedBlocks();if(r.length===0||!r.some(o=>Kt(o.block)))return!1;switch(e.key){case"Enter":return this.handleEnter(e);case"Backspace":return this.handleBackspace();case"Tab":return this.handleTab(e);default:return!1}}handleEnter(t){const e=this.editor.selection.range.getSelectedBlocks()[0];return!e.block||!Kt(e.block)||ci(t,"Shift+Enter")?!1:this.editor.undoManager.runInGroup(()=>tV(this.editor))}handleBackspace(){return this.editor.undoManager.runInGroup(()=>qK(this.editor))}handleTab(t){return ci(t,"Shift+Tab")?this.editor.undoManager.runInGroup(()=>sV(this.editor)):this.editor.undoManager.runInGroup(()=>oV(this.editor))}}class aV{constructor(t){m(this,"effectedBlockIds",new Map);m(this,"handleBeforeClearSelection",()=>{this.effectedBlockIds.clear();const t=this.editor.selection.range.getSelectedBlocks();if(t.length===0)return;const e=new Set;t.forEach(i=>{const o=i.block;Kt(o)&&e.add(o)});const r=new Map;Array.from(e.values()).forEach(i=>{var c;const o=Zu(i),{start:s}=ss(o);r.set(lt(o),s);const l=(c=cK(i))!=null?c:i;r.set(lt(l),s)}),this.effectedBlockIds=r});m(this,"handleAfterClearSelection",()=>{Array.from(this.effectedBlockIds.entries()).forEach(([t,e])=>{const r=this.editor.findBlockById(t);!r||HC(this.editor,r,e)}),this.effectedBlockIds.clear()});this.editor=t,this.editor.addListener("beforeClearSelection",this.handleBeforeClearSelection),this.editor.addListener("afterClearSelection",this.handleAfterClearSelection)}destroy(){this.editor.removeListener("beforeClearSelection",this.handleBeforeClearSelection),this.editor.removeListener("afterClearSelection",this.handleAfterClearSelection)}}const cV=I("customize-list-start-menu");class uV{constructor(t){m(this,"popup");m(this,"block",null);m(this,"show",(t,e)=>{const r=e.querySelector("div.list-container");p(cV,r,"list-block mark does not exist"),this.block=e,this.popup.manualShow(r,{theme:"light"})});m(this,"createDialogContent",()=>{const t=B("div",["customize-start-panel"],null);B("span",["customize-start-panel-title"],t,D.t("list.numberLabel"));const e=this.createNumericInput();t.appendChild(e);const r=B("button",["customize-start-panel-button"],t,D.t("list.confirm"));return this.editor.domEvents.addEventListener(t,"keydown",this.handleKeydown),this.editor.domEvents.addEventListener(r,"click",this.handleOk),t});m(this,"handleDialogShow",()=>{const t=this.block;if(!t)return;const e=this.popup.popupContent,r=e.querySelector("button.customize-start-panel-button"),i=e.querySelector("input.customize-start-panel-input"),o=Zn(t);!r||!i||requestAnimationFrame(()=>{i.focus(),i.value=String(o)})});m(this,"handleOk",()=>{const e=this.popup.popupContent.querySelector("input.customize-start-panel-input"),r=this.block;if(!r)return;const i=Number(e.value);!i||(this.editor.undoManager.runInGroup(()=>{Za(this.editor,[r,...Qa(r)],i,{resetGroupId:!0})}),this.popup.close("clickItem"))});m(this,"handleKeydown",(t,e)=>{const r=e;r.isComposing||(r.key==="Escape"?this.popup.close("cancelBar"):r.key==="Enter"&&this.handleOk())});this.editor=t,this.popup=new $a(this.createDialogContent()),this.popup.on("show",this.handleDialogShow)}destroy(){this.popup.destroy()}createNumericInput(){const t=B("input",["customize-start-panel-input"],null);t.type="number",t.min="1";const e=()=>{const i=t.value.replace(/[^\d]/g,"").replace(/^0+/,""),o=parseInt(i,10);o<=0||Number.isNaN(o)?t.value="":t.value=i};return this.editor.domEvents.addEventListener(t,"input",e),t}}function fV(n,t){return Ya(n)===Ya(t)}function dV(n,t){const e=fk(t);return e?fV(e,t)?Zn(e)!==Zn(t)-1:!0:!1}function hV(n,t){return ls(t)?!0:Zn(t)!==1}function mV(n,t){return Ue(t),[{id:"continue-numbering",name:D.t("list.continueList"),states:dV(n,t)?[]:["disabled"]},{id:"start-new-list",name:D.t("list.restartList"),states:hV(n,t)?[]:["disabled"]},{id:"set-numbering-value",name:D.t("list.changeNumber")}]}function gV(n,t,e){var r,i;if(Ue(t),e.id==="continue-numbering"){const o=fk(t);o&&Za(n,[t,...Qa(t)],Zn(o)+1,{resetGroupId:!0,groupId:Ya(o)})}if(e.id==="start-new-list"&&n.undoManager.runInGroup(()=>{Za(n,[t,...Qa(t)],1,{resetGroupId:!0})}),e.id==="set-numbering-value"){const o=(r=n.options.componentsOptions)==null?void 0:r.list;if((i=o==null?void 0:o.onChangeStart)!=null&&i.call(o,n,t,e))return;n.addCustom("list-customize-start-dialog",()=>new uV(n)).show(n,t)}}class pV{constructor(t){m(this,"menu");m(this,"handleClick",(t,e)=>{const r=ua(e,"div.list-container");if(r&&this.editor.isWritable()){const i=J(r);p(Se,i,"no parent block"),Ue(i);const o=t.getBlockData(i);if(o&&o.checkbox){t.updateBlockData(i,{...o,checkbox:o.checkbox==="checked"?"unchecked":"checked"});return}if(Jn(i)==="unordered")return;this.menu.updateItems(this.getCommandItems(i)),this.menu.manualShow(r),this.activeList(r,!0)}});m(this,"handleMenuClose",()=>{var e;const t=(e=this.menu.tippyInstance)==null?void 0:e.reference;t&&this.activeList(t,!1)});m(this,"handleMenuClick",(t,e)=>{var i;const r=(i=this.menu.tippyInstance)==null?void 0:i.reference;if(r){const o=J(r);o&&gV(this.editor,o,e)}});this.editor=t,this.editor.addListener("click",this.handleClick),this.menu=new es([]),this.menu.addListener("close",this.handleMenuClose),this.menu.addListener("click",this.handleMenuClick)}destroy(){this.editor.removeListener("click",this.handleClick),this.menu.removeListener("close",this.handleMenuClose)}getCommandItems(t){return mV(this.editor,t)}activeList(t,e){const r=J(t);!r||(e?(z(t,"active"),z(r,"active")):(ot(t,"active"),ot(r,"active")))}}class CV{constructor(t){this.editor=t}handleBeforeKeyDown(t,e){const r=t.selection.range.getSelectedBlocks();if(r.length===0)return!1;const i=r[0].block;if(!Kt(i)||!FC(i))return!1;if(e.key==="ArrowUp"||e.key==="ArrowLeft"){const o=Gs(i);return o&&t.selection.selectBlock(o,dt(t,o)),!0}if(e.key==="ArrowDown"||e.key==="ArrowRight"){const o=Ws(i);return o&&t.selection.selectBlock(o,0),!0}return(e.key==="Delete"||e.key==="Backspace"||e.key==="Escape")&&Ck(t,i),!0}}function EV(n,t,e,r,i){kp(n,"list-block-init",()=>{setTimeout(()=>{n.input.addHandler(new CV(n)),n.input.addHandler(new lV(n)),n.addCustom("list-clear-selection-handler",()=>new aV(n)),n.addCustom("list-marker-menu",()=>new pV(n))})});const o=Un.createBlockContent(n,t,e,r,i),s=i,{level:l,start:c,groupId:d}=s,h=tc(s);r.setAttribute("data-list-level",`${l||1}`),r.setAttribute("data-list-start",`${c||1}`),r.setAttribute("data-list-group-id",`${d}`),r.setAttribute("data-list-type",h);const C=WK(s);return r.insertBefore(C,o),s.viewAsMindmap?setTimeout(()=>{const E=n.getBlockById(i.id);E&&y0(n,E,{},{mindmapTools:k0,saveData:!1})}):setTimeout(()=>{const E=n.getBlockById(i.id);E&&pk(n,E)}),o}const AV={list:{confirm:"\u786E\u5B9A",setStart:"\u8BBE\u7F6E\u7F16\u53F7",continueList:"\u7EE7\u7EED\u7F16\u53F7",restartList:"\u5F00\u59CB\u65B0\u5217\u8868",changeNumber:"\u4FEE\u6539\u7F16\u53F7\u503C",numberLabel:"\u7F16\u53F7\u987A\u5E8F",mention:{tooltip:"\u63D0\u53CA\u4EBA\u5458\u5E76\u901A\u77E5"}},mindmap:{viewAsMindMap:"\u663E\u793A\u4E3A\u8111\u56FE",autoFit:"\u81EA\u52A8\u7F29\u653E",fullScreen:"\u5168\u5C4F\u67E5\u770B",close:"\u5173\u95ED",exitFullscreen:"\u9000\u51FA\u5168\u5C4F"}},xV={list:{confirm:"Confirm",setStart:"Set number",continueList:"Continue numbering",restartList:"Start a new list",changeNumber:"Set numbering value",numberLabel:"Numbering order",mention:{tooltip:"Mention and notify users"}},mindmap:{viewAsMindMap:"View as MindMap",autoFit:"Auto zoom",fullScreen:"Full screen",close:"Close",exitFullscreen:"Exit full screen"}},bV={list:{confirm:"OK",setStart:"\u756A\u53F7\u3092\u8A2D\u5B9A",continueList:"\u9023\u756A\u3092\u8A2D\u5B9A",restartList:"\u65B0\u3057\u3044\u30EA\u30B9\u30C8\u3092\u4F5C\u6210",changeNumber:"\u756A\u53F7\u3092\u7DE8\u96C6",numberLabel:"\u756A\u53F7",mention:{tooltip:"\u30E1\u30F3\u30B7\u30E7\u30F3\u304A\u3088\u3073\u901A\u77E5"}},mindmap:{viewAsMindMap:"\u30DE\u30A4\u30F3\u30C9\u30DE\u30C3\u30D7\u3067\u8868\u793A",autoFit:"\u81EA\u52D5\u30D5\u30A3\u30C3\u30C8",fullScreen:"\u5168\u753B\u9762\u8868\u793A\u306E\u30AA\u30F3",close:"\u9589\u3058\u308B",exitFullscreen:"\u5168\u753B\u9762\u8868\u793A\u306E\u30AA\u30D5"}};D.mergeLang({"zh-CN":AV,"en-US":xV,"ja-JP":bV});const vct="",Ik={...Un,blockType:"list",createBlockContent:EV,convertFrom:HK,convertTo:zK,handleDrop:DK,notify:SK},XC=I("paragraph");class vV{constructor(t){m(this,"id","BlockParagraphProvider");this.editor=t}isChecked(t,e){return!!(t[e]||t.level&&(t.ordered===!0&&!t.checkbox&&e==="ordered-list"||t.ordered===!1&&!t.checkbox&&e==="unordered-list")||e==="check-list"&&t.checkbox)}getAvailableCommands(t,e){if(!nt(t,e))return[];if(qr(t))return[];const r=[],i={"unordered-list":[D.t("commands.unordered"),ze("CtrlOrCmd+Shift+U"),TT],"ordered-list":[D.t("commands.ordered"),ze("CtrlOrCmd+Shift+L"),BT],"check-list":[D.t("commands.check"),void 0,yT],link:[D.t("commands.link"),ze("CtrlOrCmd+K"),nC],quoted:[D.t("commands.quote"),void 0,kT]},o=lt(e),s=Dt(e),l=Dr(t,e),c=t.getBlockData(e);return Object.entries(i).forEach(([d,[h,C,E]])=>{const x=[];if(this.isChecked(c,d)&&x.push("checked"),d==="link"){if(!t.selection.range.isSimple())return;t.selection.range.getSelectedBlocks().length!==1&&x.push("disabled")}r.push({blockId:o,blockType:s,blockKind:l,id:d,name:h,desc:C,states:x,icon:E,groupIndex:600})}),r}convertLink(t,e,r){p(XC,Or(e.start),""),p(XC,Or(e.start),"");const i="bottom-start",o=e.start.offset,s=e.end.offset,l=(x,v)=>{t.undoManager.runInGroup(()=>{try{const R=t.selection.range.isCollapsed();let L;if(R){L=to(t.getBlockText(r),s,x,{link:v}),t.setBlockText(r,L);return}L=dh(t.getBlockText(r),o,s,x),L=gu(o,x.length,L,"link",v),t.setBlockText(r,L),t.selection.selectBlock(r,o+x.length),t.focus()}catch(R){XC.error(R)}})},c=()=>{t.selection.selectBlock(r,s),t.focus()},d=Wi(t,r,e)[0];if(!d)return;const h=Yi(t,r,"link-button-anchor",d),C=t.getBlockText(r),E=ba(C,o);Qu(t,{target:h,linkText:t.getSelectedText(),linkUrl:(E==null?void 0:E.link)||"",onFinished:l,onClose:c,placement:i})}convertToList(t,e,r){const i=qd(t,e,"list",{offset:0,data:{listType:r}});i&&t.undoManager.runInGroup(()=>{const o=Bt(e),s=it(e);t.insertBlock(ut(s),o,i.blockData),t.deleteBlock(e)})}executeCommand(t,e,r,i){var c;if(!nt(t,e)||qr(t))return!1;const o=i.id,s=(c=i.states)==null?void 0:c.includes("checked");let l=!1;if(o==="unordered-list"&&(s?ec(t,e):this.convertToList(t,e,"unordered"),l=!0),o==="ordered-list"&&(s?ec(t,e):this.convertToList(t,e,"ordered"),l=!0),o==="check-list"&&(s?ec(t,e):this.convertToList(t,e,"unchecked"),l=!0),o==="quoted"){const h=t.getBlockData(e).quoted;t.updateBlockData(e,{quoted:h?void 0:!0}),l=!0}if(o==="link"){const d=x0(t);d==null||d.disableTextToolbar(),d==null||d.hide(),setTimeout(()=>{d==null||d.enableTextToolbar()},1e3),this.convertLink(t,r,e),l=!0}return l}}const BV={left:Fa,right:i0,center:o0};class TV{constructor(t){m(this,"id","BlockAlignProvider");this.editor=t}applyAlignStyle(t,e,r){Object.keys(BV).includes(r)?t.updateBlockData(e,{align:r}):t.updateBlockData(e,{align:null})}isChecked(t,e){return t.align===e}getAvailableCommands(t,e,r){if(!nt(t,e))return[];if(qr(t))return[];const i=lt(e),o=Dt(e),s=Dr(t,e),l=t.getBlockData(e),c=d=>{var C;const h=B("span",["toolbar-item-name-container"],null);for(const E of d.children)if((C=E.states)!=null&&C.includes("checked"))return h.innerHTML=E.icon||Fa,h;return h.innerHTML=Fa,h};return[{id:"align",name:D.t("commands.alignGroup"),blockId:i,blockType:o,blockKind:s,groupIndex:700,dropdown:!0,element:c,manualShowChildren:!0,childrenPlacement:"bottom-start",defaultCheckedChildren:["align-left"],children:[{id:"align-left",name:D.t("commands.alignLeft"),icon:Fa,states:this.isChecked(l,"left")?["checked"]:[]},{id:"align-center",name:D.t("commands.alignCenter"),icon:o0,states:this.isChecked(l,"center")?["checked"]:[]},{id:"align-right",name:D.t("commands.alignRight"),icon:i0,states:this.isChecked(l,"right")?["checked"]:[]}],childrenType:"menu"}]}executeCommand(t,e,r,i){if(!nt(t,e)||qr(t))return!1;if(i.id.startsWith("align")){const o=i.id.replace(/^align-/,"");return this.applyAlignStyle(t,e,o),!0}return!1}}const yV=I("toolbar-handler"),kV={id:"",name:"",type:"separator"};class nc{constructor(t){m(this,"toolbar");m(this,"toolbarType","object");m(this,"mouseDown",!1);m(this,"oldRange",null);m(this,"hoveringBlock",null);m(this,"hoveringTextChild",null);m(this,"_disableTextToolbar",!1);m(this,"isInToolbar",t=>this.toolbar.isInCommandBar(t.target));m(this,"handleButtonClick",(t,e)=>{const r=this.editor.getCustom("editor-tooltip");r.lastClickButtonId=e.id,this.toolbarType==="text"?(this.editor.editorCommandProviders.executeCommand(this.editor.selection.range,e,{}),this.editor.isWritable()&&this.showTextToolbar("click")):this.hoveringBlock&&tK(this.editor,this.hoveringBlock,this.hoveringTextChild,e)});m(this,"handleClose",()=>{fC(this.editor)&&this.editor.focus()});m(this,"handleClosing",(t,e)=>{if(this.toolbarType==="object"){const r=Hb(e);if(this.hoveringBlock===r)return!1}return!0});m(this,"handleDocumentMouseDown",t=>{t.button===0&&(document.addEventListener("mouseup",this.handleDocumentMouseUp),this.mouseDown=!0)});m(this,"handleDocumentMouseUp",()=>{document.removeEventListener("mouseup",this.handleDocumentMouseUp),this.mouseDown=!1,this.handleSelectionChange(this.editor)});m(this,"handleHoveringBlockChildChange",(t,e,r,i)=>{if(!(this.hoveringBlock===t&&this.hoveringTextChild===e)&&(this.hoveringBlock=t,this.hoveringTextChild=e,!(this.toolbar.isVisible&&this.toolbarType==="text"))){if(!t){this.toolbar.close("fromHover");return}this.showObjectToolbar(i)}});m(this,"handleSelectionChange",Me.default(t=>{var r;if(p(yV,t===this.editor,"editor mismatch"),t.selection.range.isCollapsed()||this.mouseDown){if(this.toolbarType==="object"){const i=(r=this.toolbar.tippyInstance)==null?void 0:r.reference,o=this.editor.selection.focusedBlock;if(i&&re(i,o))return}this.toolbar.close("selectionChange"),this.oldRange=null;return}if(!this.editor.isWritable()){this.toolbar.close("selectionChange"),this.oldRange=null;return}if(t.selection.range.getSelectedBlocks().length===0){this.toolbar.close("selectionChange"),this.oldRange=null;return}this.oldRange&&this.oldRange.isEqual(t.selection.range)||(this.oldRange=t.selection.range,this.showTextToolbar("selectionChange"))},50));this.editor=t;const e=t.options.componentsOptions.popover;this.toolbar=new Fu([],void 0,{tooltipId:t.clientId,id:"editor-toolbar",overflowBoundary:e==null?void 0:e.overflowBoundary,refuseOverflow:!0,padding:20}),this.toolbar.on("click",this.handleButtonClick),this.toolbar.on("close",this.handleClose),this.toolbar.on("closing",this.handleClosing),this.bindEvents(),t.addListener("selectionChanged",this.handleSelectionChange),Te.get(t).addListener("childChange",this.handleHoveringBlockChildChange),Te.get(t).addFilter(this),t.editorCommandProviders.registerCommandProvider(new nK(t)),t.editorCommandProviders.registerCommandProvider(new vV(t)),t.editorCommandProviders.registerCommandProvider(new TV(t))}disableTextToolbar(){this._disableTextToolbar=!0}enableTextToolbar(){this._disableTextToolbar=!1}hide(){this.toolbar.close("selectionChange")}destroy(){this.unbindEvents(),this.toolbar.destroy(),this.editor.removeListener("selectionChanged",this.handleSelectionChange),Te.get(this.editor).removeListener("childChange",this.handleHoveringBlockChildChange)}isInBlock(t,e){return t!==this.hoveringBlock?!1:!!(e.target&&e.target instanceof Node&&this.toolbar.popper&&re(this.toolbar.popper,e.target))}bindEvents(){document.addEventListener("mousedown",this.handleDocumentMouseDown)}unbindEvents(){document.removeEventListener("mousedown",this.handleDocumentMouseDown)}update(t){!this.editor.isWritable()||this.showTextToolbar(t)}showTextToolbar(t){var R,L;if(this._disableTextToolbar)return;const e=this.editor.selection.range,r=e.getSelectedBlocks();if(r.length===0)return;const i=r[0];if(!i)return;if(r.length===1){if(ge(i.block)){t==="click"&&this.showObjectToolbar(null);return}if(Mt(this.editor,i.block)&&e.isSimple())return}if(zi(i.block)){this.toolbar.close("selectionChange");return}const o=this.editor.editorCommandProviders.getCommands(this.editor.selection.range),s=new Map;o.forEach(M=>{const U=M.groupIndex,F=s.get(U);F?F.push(M):s.set(U,[M])});const l=[[]],c=Array.from(s.entries()).sort((M,U)=>M[0]-U[0]);for(let M=0;M<c.length;M++){const[,U]=c[M];if(U.length===0)continue;let F=l[l.length-1];F.length>0&&F[F.length-1].groupIndex!==U[U.length-1].groupIndex&&(F=[],l.push(F)),F.push(...A0(U))}if(l.length===0){this.toolbar.close("selectionChange");return}this.toolbarType="text";const d=[];if(l.forEach((M,U)=>{const F=M.sort((G,W)=>{var rt,st;return((rt=G.order)!=null?rt:0)-((st=W.order)!=null?st:0)});d.push(...F),U!==l.length-1&&d.push(kV)}),d.length===0){this.toolbar.close("selectionChange");return}this.toolbar.updateItems(d);const h=r[r.length-1],C=!this.editor.selection.range.isReverse()&&h!==i,E=C?h:i,x=lk(this.editor,E),v=Yi(this.editor,E.block,"editor-quick-menu",x);this.toolbar.manualShow(v,{placement:C?"bottom":"top",offset:[0,C?5:10]}),(L=(R=this.toolbar.tippyInstance)==null?void 0:R.popperInstance)==null||L.update()}showObjectToolbar(t){var l,c,d;if(!this.hoveringBlock||this.mouseDown)return;const e=this.hoveringBlock,r=this.hoveringTextChild,{commands:i,element:o}=QF(this.editor,e,r);if(!i.length||!o){this.toolbar.close("fromHover");return}this.toolbarType="object",this.toolbar.isVisible&&((c=(l=this.toolbar)==null?void 0:l.tippyInstance)==null?void 0:c.reference)!==o&&this.toolbar.close("fromHover");const s=()=>{let h;const C=o.getClientRects(),E=[];if(Array.from(C).forEach(x=>{const{y:v}=x;E.includes(v)||E.push(v)}),E.length>1){if(h=r?C[C.length-1]:C[0],t)for(let x=0;x<C.length;x++){const v=C[x],R=new DOMRect(v.x-4,v.y-4,v.width+8,v.height+8);if(R.x<t.clientX&&t.clientX<R.right&&R.y<t.clientY&&t.clientY<R.bottom){h=v;break}}}else{if(h=o.getBoundingClientRect(),r){const x=r.getBoundingClientRect();return new DOMRect(x.x,x.y,x.width,x.height)}return new DOMRect(C[0].x,C[0].y,C[0].width,C[0].height)}if(t){const x=h.y,v=t.clientX;return new DOMRect(v,x,10,h.height)}return h};this.toolbar.updateItems(i),this.toolbar.isVisible||(this.toolbar.manualShow(o,{placement:r?"bottom":"top",getReferenceClientRect:s}),(d=this.toolbar.tippyInstance)!=null&&d.popper&&(this.toolbar.tippyInstance.popper.style.paddingTop="10px",this.toolbar.tippyInstance.popper.style.paddingBottom="5px"))}static register(t){return t.addCustom("toolbar-handler",e=>new nc(e))}static get(t){return t.getCustom("toolbar-handler")}}function I0(n,t,e){n.getBlockData(t).heading===e?n.updateBlockData(t,{heading:null}):n.updateBlockData(t,{heading:e})}function Dk(n,t,e){["left","center","right"].includes(e)?n.updateBlockData(t,{align:e}):n.updateBlockData(t,{align:null})}function YC(n,t){const r=n.getBlockData(t).quoted;n.updateBlockData(t,{quoted:r?void 0:!0})}function QC(n,t){return!!(n[t]||n.level&&(n.ordered===!0&&!n.checkbox&&t==="ordered-list"||n.ordered===!1&&!n.checkbox&&t==="unordered-list")||t==="check-list"&&n.checkbox)}function JC(n,t,e){if(!n.selection.range.focus.isSimple())return;const i=n.getBlockData(t);let o;switch(e){case"unordered-list":o=QC(i,"unordered-list")?void 0:"unordered";break;case"ordered-list":o=QC(i,"ordered-list")?void 0:"ordered";break;case"check-list":o=QC(i,"check-list")?void 0:"unchecked";break}if(o){const s=qd(n,t,"list",{offset:0,data:{listType:o}});s&&n.undoManager.runInGroup(()=>{const l=Bt(t),c=it(t);n.deleteBlock(t);const d=n.insertBlock(ut(c),l,s.blockData);s.onConverted&&s.onConverted(n,d)})}else ec(n,t)}const RV=Object.freeze(Object.defineProperty({__proto__:null,applyHeadingStyle:I0,applyAlignStyle:Dk,applyQuoteStyle:YC,applyList:JC},Symbol.toStringTag,{value:"Module"})),wV=[Yh,Qh,Jh,Zh,t0,e0,n0,r0],SV={Unordered:oC,Ordered:sC,Checkbox:rC,Quote:iC};function _k(n,t){const e=n;e.blockOptions=t,e.itemType="insert-block",n.children&&n.children.forEach(r=>_k(r,t))}function LV(){return{name:"basic",insertBlockCommandItems:[{id:"text",icon:Ka,name:D.t("commands.text"),order:0,group:"basics",value:"text"}]}}function ZC(n=1){var i;const t={name:"basic",insertBlockCommandItems:[]};let e=b0();e<=4?e=5:e<8&&(e+=1);let r=n;for(;r<=e;){const o=`heading-${r}`;(i=t.insertBlockCommandItems)==null||i.push({id:o,icon:wV[r-1],name:D.t("quickMenu.basic.heading.title",{heading:String(r)}),order:r,group:"basics",value:String(r),subText:Tn(o)}),r++}return t}function IV(){const n={name:"basic",insertBlockCommandItems:[]};return["Unordered","Ordered","Checkbox","Quote"].forEach((e,r)=>{var o;const i=`insert-${e.toLocaleLowerCase()}`;(o=n.insertBlockCommandItems)==null||o.push({id:i,name:D.t(`quickMenu.basic.${e.toLocaleLowerCase()}`),icon:SV[e],value:e.toLocaleLowerCase(),group:"basics",order:10+r,subText:Tn(i)})}),n}class Mk{constructor(t){this.withPlainText=t}getCommands(){const t=LV(),e=ZC(),r=IV();return[...this.withPlainText?t.insertBlockCommandItems||[]:[],...e.insertBlockCommandItems||[],...r.insertBlockCommandItems||[]]}updateBlock(t,e,r,i){const{value:o,id:s}=i;return s.startsWith("heading-")?I0(t,r,Number.parseInt(o!=null?o:"1",10)||1):o==="ordered"||o==="unordered"||o==="checkbox"?JC(t,r,{ordered:"ordered-list",unordered:"unordered-list",checkbox:"check-list"}[o]):o==="quote"&&YC(t,r),null}async handleUpdateBlockCore(t,e){const r=t.getBlockByIndex(e.containerId,e.blockIndex);return this.updateBlock(t,e.containerId,r,e.item)}async handleInsertEmptyBlockCore(t,e){const{containerId:r,blockIndex:i}=e,o=t.insertTextBlock(void 0,r,i);return this.updateBlock(t,e.containerId,o,e.item)}async executeCommand(t,e,r){if(r.from==="quick-menu"){const i=t.getBlockById(r.blockId),o=t.getParentContainer(i),s=ut(o),l=t.getBlockIndex(i);t.undoManager.runInGroup(()=>this.handleUpdateBlockCore(t,{item:e,containerId:s,blockIndex:l})),t.focus()}else r.from==="block-menu"&&(t.undoManager.runInGroup(()=>this.handleInsertEmptyBlockCore(t,{item:e,containerId:r.containerId,blockIndex:r.blockIndex})),t.focus());return null}}const Uk={basics:100,system:200,common:300,thirdParty:400};class tE{constructor(){m(this,"dataUrl","");m(this,"error",null)}destroy(){}setDataUrl(t){this.error=null,this.dataUrl=t}setError(t){this.dataUrl="",this.error=t}}const DV=I("mathjax-converter"),_V="MathJax-script",MV=30,Ok=8;async function UV(n){var r;window.MathJax||(window.MathJax={options:{skipHtmlTags:["script","noscript","style","textarea","pre","code","annotation","annotation-xml","body"]}});const t=n.getComponentOptions("mathjax"),e=((r=t==null?void 0:t.cdn)==null?void 0:r.mathjax)||"https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js";await Ps(e,_V)}function OV(){try{window.MathJax&&window.MathJax.texReset()}catch{}}async function eE(n,t){const e="mathjax2Svg";try{await Sr.lock(e),OV(),await UV(n);const r=await window.MathJax.tex2svgPromise(t),i=r.querySelector("merror");if(i)throw new Error(i.textContent);return r.querySelector("svg").outerHTML}catch(r){throw DV.error(r),r}finally{Sr.release(e)}}function NV(n){const t=new DOMParser().parseFromString(n,"image/svg+xml"),e={width:0,height:0};if(t&&t.firstChild){const r=t.firstChild,i=r.getAttribute("height"),o=r.style.minWidth;i&&(e.width=parseInt(o,10)*Ok+MV,e.height=parseInt(i,10)*Ok)}return e}async function Nk(n,t){const e=await eE(n,t);return e?await Vg(e,"image/svg+xml"):""}async function Pk(n,t){const r=await eE(n,t),i=new File([r],"math.svg");return(await n.doc.uploadResource(i)).resourceId}async function PV(n,t){const e=await eE(n,t),r=NV(e),i=e,o=new File([i],"math.svg");return{resourceId:(await n.doc.uploadResource(o)).resourceId,...r}}const Fk=I("edit-mathjax");class FV{constructor(){m(this,"editMathjaxPopup",null);m(this,"onChange",null);m(this,"tex","");m(this,"observer",null);m(this,"handleClose",t=>{var r;const e=t.content.querySelector("textarea");if(e){const i=e.value;i!==this.tex&&((r=this.onChange)==null||r.call(this,i,!0))}});m(this,"handleKeyup",t=>{var e;t.isComposing||(t.key==="Escape"&&((e=this.editMathjaxPopup)==null||e.close("cancelBar")),this.handleChange(t.target.value))});m(this,"handleChange",Me.default(t=>{var e;(e=this.onChange)==null||e.call(this,t,!1)},300))}editMathjax(t,e,r,i){if(!this.editMathjaxPopup)this.editMathjaxPopup=new $a(this.createPopupContent(e),{id:"mathjax-popover"});else{const o=this.getTextarea();o.value=e}this.tex=e,this.editMathjaxPopup.manualShow(t,{theme:"light",placement:i==null?void 0:i.placement}),this.editMathjaxPopup.removeAllListeners("close"),this.editMathjaxPopup.addListener("close",this.handleClose),this.onChange=r}createPopupContent(t){const e=B("textarea",["mathjax-editor-textarea"],null);return e.value=t,e.addEventListener("keyup",this.handleKeyup),this.textareaWatcher(e),e}textareaWatcher(t){const e=t;e.onblur=()=>{var i;(i=this.editMathjaxPopup)!=null&&i.isVisible&&t.focus()};const r=()=>{setTimeout(()=>{t.focus()})};this.observer=new IntersectionObserver(r,{}),this.observer.observe(t)}getTextarea(){p(Fk,this.editMathjaxPopup,"no exists mathjax editor popup");const t=this.editMathjaxPopup.content.querySelector("textarea");return p(Fk,t,"no textarea"),t}destroy(){var t,e;this.onChange=null,(t=this.observer)==null||t.disconnect(),(e=this.editMathjaxPopup)==null||e.removeAllListeners()}}function Kk(n,t,e,r,i){n.addCustom("mathjax-editor",()=>new FV).editMathjax(t,e.trim(),r,i)}function Vk(){return{insert:" ",attributes:{id:tt(),box:!0,type:"math",tex:" ",src:"",created:Date.now()}}}function D0(n,t){const e=n.getBoxData(t),r=J(t);if(!r)return;const i=Wo(r,t);n.selection.selectBlock(r,i.start,i.end);const o=async(s,l)=>{if(!s.trim()){n.updateBoxData({...e,tex:s,src:null});return}try{await Sr.lock("convertAndUploadMathjax");const c=await Pk(n,s);n.updateBoxData({...e,tex:s,src:c})}catch(c){const d=n.getBoxData(t);n.addCustom(`mathjax-box-${d.id}`,()=>new tE).setError(c),n.updateBoxData({...e,tex:s,src:""})}finally{Sr.release("convertAndUploadMathjax"),l&&n.focus()}};Kk(n,t,e.tex,o)}const $k=I("mathjax-box");function nE(n,t){n.selection.updateSelection(null);const e=t.target;!e||!(e instanceof HTMLElement)||n.domEvents.removeEventListener(e,null,nE)}async function KV(n,t,e){try{if(!t.tex.trim())return;const r=await Nk(n,t.tex),i=n.findBoxById(t.id);if(!i)return;const o=Zg(i);o.innerHTML="";const s=B("img",["mathjax"],o);s.src=r,e.setDataUrl(r),n.domEvents.addEventListener(s,"load",nE)}catch(r){e.setError(r);const i=n.findBoxById(t.id);if(!i)return;const o=i.querySelector(".mathjax-tex-text");z(o,"mathjax-error"),o.innerText=r.message,n.selection.updateSelection(null)}}function VV(n,t,e,r){const i=r,o=n.addCustom(`mathjax-box-${i.id}`,()=>new tE);if(i.src||o.dataUrl){const c=B("img",["mathjax"],e);c.src=n.doc.buildResourceUrl(i.src||o.dataUrl,{syncNewResources:async(d,h)=>{var E,x;await n.doc.addResources([d]);const C=(x=(E=n.doc).getServerMeta)==null?void 0:x.call(E).appId;if(i.src&&i.src!==h&&C&&i.src.includes(C)){const v=J(e),R=mt.default(i);v&&n.isBlockWritable(v)&&!n.readonly&&(R.src=d,n.updateBoxData(R))}}}),n.domEvents.addEventListener(c,"load",nE);return}const s=["mathjax-tex-text"];let l=i.tex;l.trim()?o.error&&(l=o.error.message,s.push("mathjax-error")):l=D.t("mathjax.emptyText"),B("span",s,e,l),KV(n,i,o)}function $V(n,t){const e={id:tt(),box:!0,type:"math",tex:t,src:"",created:Date.now()};return Pk(n,t).then(r=>{if(!n.findBoxById(e.id))return;const o={...e,src:r};n.updateBoxData(o)}).catch(r=>{$k.error(`failed to convert and upload mathjax: ${JSON.stringify(r)}`)}),e}function HV(n,t,e,r){const i=t;return r==="text"?i.tex:r==="markdown"?` $${i.tex}$ `:i.src?`<img src="${n.doc.buildResourceUrl(i.src,{withToken:!0})}" />`:`<code>$${i.tex}$</code>`}function jV(n,t,e){const r=J(t);p($k,r,"failed to get block"),!(n.readonly||!n.isBlockWritable(r))&&D0(n,t)}function zV(){return{abstract:`[${D.t("mathjax.abstract")}]`}}const Hk={boxType:"math",updateBoxContent:VV,convertFrom:$V,convertTo:HV,handleClickBox:jV,getBoxProperties:zV};async function GV(n,t,e){try{const r=t.embedData,i=await Nk(n,r.mathjaxText),o=n.findBlockById(t.id);if(!o)return;const s=Ot(o);s.innerHTML="";const l=B("img",["mathjax"],s);l.src=i,e.setDataUrl(i)}catch(r){e.setError(r)}}function WV(n,t){if(n.readonly||!t.target||!(t.target instanceof Node))return;const e=J(t.target);if(!e||!ge(e)||We(e)!=="math")return;const r=Ot(e),i=r.querySelector("img")||r.querySelector("span.mathjax-tex-text");if(!i||!re(i,t.target))return;const s=n.getBlockData(e).embedData;Kk(n,i,s.mathjaxText,async l=>{const{resourceId:c,width:d,height:h}=await PV(n,l),C={mathjaxText:l,src:c,width:d,height:h};n.updateEmbedData(e,C)},{placement:"bottom"})}function qV(n,t,e){const r=e.embedData,{src:i,width:o}=r,s=n.addCustom(`mathjax-block-${e.id}`,()=>new tE);if(n.domEvents.addEventListener(t,"click",WV),!r.mathjaxText.trim()){B("span",["mathjax-tex-text"],t,D.t("mathjax.emptyText"));return}if(i||s.dataUrl){const l=B("img",["mathjax"],t);l.src=n.doc.buildResourceUrl(i||s.dataUrl,{syncNewResources:async(c,d)=>{var h,C;if(i){await n.doc.addResources([c]);const E=(C=(h=n.doc).getServerMeta)==null?void 0:C.call(h).appId;if(i&&d!==i&&E&&i.includes(E)){const x=J(t);setTimeout(()=>{if(x&&!n.readonly&&n.isBlockWritable(x)){const v=mt.default(e);v.embedData.src=c,n.updateBlockData(x,v)}})}}}}),o&&(l.style.minWidth=`${o}px`,setTimeout(()=>{const c=t.getBoundingClientRect().width;o>c?(z(t,"mathjax-overflow"),t.style.overflow="auto",t.style.setProperty("--mathjax-width",`${o}px`)):(ot(t,"mathjax-overflow"),t.removeAttribute("data-mathjax-width"),t.style.removeProperty("--mathjax-width"))}));return}s.error,B("span",["mathjax-tex-text"],t,r.mathjaxText),GV(n,e,s)}function XV(n,t,e){if(!nt(n,t))return null;const r=n.getBlockString(t).trim();if(!r||!r.startsWith("$$")||!r.endsWith("$$"))return null;const i=Og(r,"$");if(!i)return null;const o={mathjaxText:i,src:""};return{blockData:{id:tt(),type:"embed",embedType:"math",embedData:o}}}function YV(n){return{name:"Mathjax"}}function QV(n,t){var r;const e=Ot(t);n.domEvents.removeAllListeners(e),n.findCustom("mathjax-editor")&&((r=n.getCustom("mathjax-editor").editMathjaxPopup)==null||r.close("cancelBar"))}function JV(n,t,e,r){const i=t.embedData;return r==="html"?`<img src="${n.doc.buildResourceUrl(i.src,{withToken:!0})}" />`:r==="markdown"?`
|
|
615
615
|
$$${i.mathjaxText}$$
|
|
616
616
|
`:i.mathjaxText}function ZV(){return{abstract:D.t("mathjax.abstract")}}const t$={embedType:"math",createEmbedContent:qV,getOptions:YV,convertFrom:XV,handleDeleteBlock:QV,convertTo:JV,getBlockProperties:ZV},Bct="",e$={mathjax:{emptyText:"\u7A7A\u7684\u516C\u5F0F",abstract:"\u516C\u5F0F"}},n$={mathjax:{emptyText:"Empty formula",abstract:"Formula"}},r$={mathjax:{emptyText:"\u6570\u5F0F\u306A\u3057",abstract:"\u6570\u5F0F"}};D.mergeLang({"zh-CN":e$,"en-US":n$,"ja-JP":r$});function i$(n,t,e,r){const i=n.getBlockByIndex(t,e),o=n.getBlockText(i),{left:s}=Dn(o,r);if(!de(s).endsWith("$$$$"))return!1;const c=r-4,d=r,h={id:tt(),box:!0,type:"math",tex:" ",src:"",created:Date.now()};return n.undoManager.runInGroup(()=>{n.deleteTextFromBlock(i,c,d-c),n.insertBoxToBlock(i,c,h),setTimeout(()=>{const C=n.getBoxById(h.id);D0(n,C)})}),!0}class o${handleAfterInsertText(t,e,r,i,o){return!!(o===" "&&i$(t,e,r,i))}}var tr={exports:{}};/**
|
|
@@ -959,4 +959,4 @@ ${o.mermaidText}
|
|
|
959
959
|
${o.flowchartText}
|
|
960
960
|
\`\`\`\`\`\``}return""}const ott={embedType:"flowchart",convertFrom:ntt,handleUpdateBlock:ett,createEmbedContent:ttt,getBlockProperties:rtt,convertTo:itt},stt=I("plantuml-helper");function wS(n,t){var l;let r=((l=(n.getComponentOptions("plantuml")||{}).cdn)==null?void 0:l.plantuml)||NZ;r.endsWith("/")||(r+="/");const i=l9.default.encode(t);p(stt,i,i),r+=i;const s=new URLSearchParams(document.location.search).get("doc");return Fg(r,{id:`${s}-${tt()}`})}async function ltt(n,t){try{const e=await AA(n,t);return(await n.doc.uploadResource(e)).resourceId}catch{return Promise.resolve(t)}}class Ac extends BA{constructor(t){super(t,"plantuml","plantumlText")}static get(t,e){return t.addCustom(`plantuml-${e.id}`,()=>new Ac(t))}code2ObjectUrl(t){return Promise.resolve(wS(this.editor,t))}code2ResourceId(t){const e=wS(this.editor,t);return ltt(this.editor,e)}destroy(){}}function att(n,t,e){Ac.get(n,e).createEmbedContent(t,e)}function ctt(n,t,e){const r=Ac.get(n,e),i=Ot(t);return r.updateEmbedContent(i,e),!0}function utt(n,t,e){const{data:r}=e,i=n.getBlockString(t).trim();if(!r||r.embedType!=="plantuml"||i!=="```plantuml"||!nt(n,t))return null;const o={src:"",plantumlText:""};return{blockData:{id:tt(),type:"embed",embedType:"plantuml",embedData:o},onConverted:(c,d)=>{Ac.get(c,c.getBlockData(d)).editGraph(Ot(d))}}}function ftt(n,t){return Ac.get(n,n.getBlockData(t)).getBlockProperties(t)}function dtt(n,t,e,r){const{embedData:i}=t,o=i;if(r==="html")return o.src?`<img src="${n.doc.buildResourceUrl(o.src,{withToken:!0})}" />`:o.flowchartText?`<div>${o.flowchartText}</div>`:"<p>[plantuml]</p>";if(r==="markdown"){if(o.src)return`})`;if(o.flowchartText)return`\`\`\`plantuml\`\`\`
|
|
961
961
|
${o.flowchartText}
|
|
962
|
-
\`\`\`\`\`\``}return""}const htt={embedType:"plantuml",convertFrom:utt,handleUpdateBlock:ctt,createEmbedContent:att,getBlockProperties:ftt,convertTo:dtt},Cut="",mtt="hr",gtt={dividingLine:{type:"\u5206\u5272\u7EBF",abstract:"\u5206\u5272\u7EBF"}},ptt={dividingLine:{type:"Dividing-Line",abstract:"Dividing-Line"}},Ctt={dividingLine:{type:"\u533A\u5207\u308A\u7DDA",abstract:"\u533A\u5207\u308A\u7DDA"}};D.mergeLang({"zh-CN":gtt,"en-US":ptt,"ja-JP":Ctt});function Ett(n,t){const e=B("div",["editor-embed-container"],t);B("hr",["editor-embed-hr"],e)}function Att(n,t,e,r){return r==="html"?"<hr />":r==="markdown"?"---":"------------"}function xtt(){return{name:"hr",insertEmbedCommandItems:[{id:"insert-hr",name:D.t("dividingLine.type"),icon:jT,order:500,group:"common",subText:Tn("insert-hr")}],handleInsertEmptyEmbed:async(n,t)=>{const{containerId:e,blockIndex:r}=t;return n.insertEmbed(e,r,mtt,{})}}}function btt(n,t,e){const{data:r}=e;if(!r||r.embedType!=="dividing-line"||!nt(n,t))return null;const i={};return{blockData:{id:tt(),type:"embed",embedType:"hr",embedData:i}}}function vtt(){return{abstract:D.t("dividingLine.abstract")}}const Btt={embedType:"hr",createEmbedContent:Ett,convertTo:Att,getOptions:xtt,convertFrom:btt,getBlockProperties:vtt},Eut="",Aut="",Ttt={media:{upload:{failed:'<div class="line-1">{name}\u4E0A\u4F20\u5931\u8D25</div><div class="line-2">\u7F51\u7EDC\u670D\u52A1\u5F02\u5E38\uFF0C\u4F60\u53EF\u4EE5 <span class="retry-upload">\u91CD\u8BD5</span></div>',maxSizeFailed:'<div class="line-1">{name}\u4E0A\u4F20\u5931\u8D25</div><div class="line-2">\u6587\u4EF6\u5927\u5C0F\u8D85\u8FC7\u9650\u5236\uFF0C\u8BF7\u91CD\u65B0\u9009\u62E9\u6587\u4EF6</div>'},load:{failed:'<div class="line-1">{name}\u52A0\u8F7D\u5931\u8D25</div><div class="line-2">\u7F51\u7EDC\u670D\u52A1\u5F02\u5E38\uFF0C\u4F60\u53EF\u4EE5 <span class="retry-upload">\u91CD\u8BD5</span></div>'},audio:{menuItem:"\u97F3\u9891",abstract:"\u97F3\u9891"},video:{menuItem:"\u89C6\u9891",abstract:"\u89C6\u9891"}}},ytt={media:{upload:{failed:'<div class="line-1">{name} upload failed</div><div class="line-2">Network error, you can <span class="retry-upload">Retry</span></div>',maxSizeFailed:'<div class="line-1">{name} upload failed</div><div class="line-2">The file size exceeds limit. Please choose another file.</div>'},load:{failed:'<div class="line-1">{name} loading failed</div><div class="line-2">Network error, you can <span class="retry-upload">Retry</span></div>'},audio:{menuItem:"Audio",abstract:"Audio"},video:{menuItem:"Video",abstract:"Video"}}},ktt={media:{upload:{failed:'<div class="line-1">{name}\u306E\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u306B\u5931\u6557\u3057\u307E\u3057\u305F</div><div class="line-2">\u304A\u4F7F\u3044\u306E\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF\u63A5\u7D9A\u306B\u554F\u984C\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002\u6B21\u306E\u64CD\u4F5C\u3092\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002 <span class="retry-upload">\u518D\u8A66\u884C</span></div>',maxSizeFailed:'<div class="line-1">{name}\u306E\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u306B\u5931\u6557\u3057\u307E\u3057\u305F</div><div class="line-2">\u30D5\u30A1\u30A4\u30EB\u306E\u30B5\u30A4\u30BA\u304C\u4E0A\u9650\u3092\u8D85\u3048\u3066\u3044\u308B\u305F\u3081\u3001\u4ED6\u306E\u30D5\u30A1\u30A4\u30EB\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044</div>'},load:{failed:'<div class="line-1">{name}\u3092\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093\u3067\u3057\u305F</div><div class="line-2">\u304A\u4F7F\u3044\u306E\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF\u63A5\u7D9A\u306B\u554F\u984C\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002\u6B21\u306E\u64CD\u4F5C\u3092\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002 <span class="retry-upload">\u518D\u8A66\u884C</span></div>'},audio:{menuItem:"\u97F3\u58F0",abstract:"\u97F3\u58F0"},video:{menuItem:"\u52D5\u753B",abstract:"\u52D5\u753B"}}};D.mergeLang({"zh-CN":Ttt,"en-US":ytt,"ja-JP":ktt});var Jr=(n=>(n.AUDIO="audio",n.VIDEO="video",n))(Jr||{}),Lf=(n=>(n.Empty="empty",n.Progress="progress",n.Error="error",n))(Lf||{});const SS=10*1024*1024,Rtt=["wav","mp3","aac","ogg","webm","flac"],wtt=["ogg","mp4","webm"],Stt=()=>{};function LS(n){var h,C,E,x,v,R;const t=(h=n.getComponentOptions("media"))!=null?h:{},{allowedMedias:e,maxSize:r,callbacks:i}=t,o=(C=e==null?void 0:e.audio)!=null?C:Rtt,s=(E=e==null?void 0:e.video)!=null?E:wtt,l=(x=r==null?void 0:r.audio)!=null?x:SS,c=(v=r==null?void 0:r.video)!=null?v:SS,d=(R=i==null?void 0:i.onError)!=null?R:Stt;return{allowedMedias:{audio:o,video:s},maxSize:{audio:l,video:c},callbacks:{onError:d}}}function Ltt(n,t){const e=o=>o.map(s=>`.${s}`).join(","),{allowedMedias:r}=LS(n),i=r[t];return i?e(i):"*"}function Itt(n,t,e){const{maxSize:r,callbacks:i,allowedMedias:o}=LS(t),{[e]:s}=r,{[e]:l}=o;if(s&&n.size>s){const d=new Error("media is too large");throw d.code=`MaxMediaSize-${e}`,i!=null&&i.onError&&(i==null||i.onError(t,d)),d}const c=eu(n.name);if(l&&!l.includes(c.toLowerCase())){const d=new Error(`media file is not allowed: ${c}`);throw d.code="NotAllowedFile",i!=null&&i.onError&&(i==null||i.onError(t,d)),d}}function Dtt(n){return n===Lf.Empty||n===Lf.Error}const Je=I("media");class _tt extends Be.TypedEmitter{constructor(e){super();m(this,"mediaContainer",null);m(this,"media",null);m(this,"abstract",null);m(this,"handleMediaLoadError",(e,r)=>{if(!r.target||!(r.target instanceof Node)||!(r.target instanceof Element?r.target:r.target.parentElement))return;const o=J(r.target);if(!o||!o.contains(this.mediaContainer))return;const s=this.renderError();this.updateMediaContent(s),this.emit("mediaError",e,"load_error",lt(o))});m(this,"handleUploadFile",async e=>{p(Je,this.abstract,"no abstract"),p(Je,this.mediaContainer,"The media element not exist");const{editor:r}=this.options,i=J(this.mediaContainer);p(Je,i,"The block element not exist");const o=r.getBlockData(i);try{const{resourceId:s}=await r.doc.uploadResource(e,{onProgress:C=>{this.renderProgress(C,e)}}),{name:l,type:c,size:d}=e,h={...o,embedData:{...o.embedData,src:s,fileName:l,fileSize:d,fileType:c}};r.updateBlockData(i,h)}catch(s){Je.error(s),this.emit("mediaError",r,"upload_error",o.id),this.renderRetry(e,s)}ot(i,"media-block-uploading")});m(this,"destroy",()=>{this.mediaContainer=null});this.options=e}bindMediaEvent(){const{editor:e}=this.options;this.media&&e.domEvents.addEventListener(this.media,"error",this.handleMediaLoadError)}unbindMediaEvent(){const{editor:e}=this.options;this.media&&e.domEvents.removeEventListener(this.media,"error",this.handleMediaLoadError)}updateMediaContent(e){p(Je,this.mediaContainer,"The media element not exist"),this.mediaContainer.innerHTML="",this.mediaContainer.append(e)}renderError(){p(Je,this.abstract,"no abstract");const{editor:e,createMediaElement:r}=this.options,{mediaIcon:i,mediaName:o}=this.abstract;p(Je,this.mediaContainer,"The media element not exist");const s=J(this.mediaContainer);p(Je,s,"The block element not exist");const l=e.getBlockData(s),c=B("div",["media-error","embed-selected-content","embed-hover-content"],null),d=B("span",["media-error-icon"],c);d.innerHTML=i;const h=B("div",[],c);h.innerHTML=D.t("media.load.failed",{name:o}),c.appendChild(h);const C=h.querySelector(".retry-upload");return p(Je,C,"The element not exist"),e.domEvents.addEventListener(C,"click",(E,x)=>{const v=B("div",["media-element"],null),R=this.getResourceUrl(l),L=r(E,v,l,R);this.unbindMediaEvent(),this.media=L,this.bindMediaEvent(),this.updateMediaContent(v)}),this.setFullScreen(),c}renderRetry(e,r){var E,x;p(Je,this.abstract,"no abstract");const{editor:i}=this.options,{mediaIcon:o,mediaName:s}=this.abstract,l=B("div",["media-error","embed-selected-content","embed-hover-content"],null),c=B("span",["media-error-icon"],l);c.innerHTML=o;const d=B("div",[],l);let h=D.t("media.upload.failed",{name:s});(((E=r.response)==null?void 0:E.status)===420||((x=r.response)==null?void 0:x.status)===413)&&(h=D.t("media.upload.maxSizeFailed",{name:s})),d.innerHTML=h,l.appendChild(d);const C=d.querySelector(".retry-upload");C&&i.domEvents.addEventListener(C,"click",()=>{i.readonly||(p(Je,this.abstract,"no abstract"),this.handleUploadFile(e))}),this.updateMediaContent(l),this.setFullScreen()}renderProgress(e,r){p(Je,this.mediaContainer,"The media element not exist");const i=this.mediaContainer.querySelector(":scope .media-progress"),o=e===-1||e===100?100:e;if(i){const{updateProgressElement:s}=this.options;s(i,o)}else{const{createProgressElement:s}=this.options,l=J(this.mediaContainer);p(Je,l,"The element not exist"),z(l,"media-block-uploading");const c=B("div",["media-progress"],null);s(c,o,r),this.updateMediaContent(c)}this.setFullScreen()}renderMediaElement(e,r){p(Je,this.mediaContainer,"The media element not exist");const i=this.mediaContainer.querySelector(":scope > .media-element"),{createMediaElement:o,updateMediaElement:s,editor:l}=this.options,c=this.getResourceUrl(e,r);if(i){const d=s(l,i,e,c);this.unbindMediaEvent(),this.media=d,this.bindMediaEvent()}else{const d=B("div",["media-element"],null),h=o(l,d,e,c);this.unbindMediaEvent(),this.media=h,this.bindMediaEvent(),this.updateMediaContent(d)}}renderEmpty(e){p(Je,this.abstract,"no abstract"),p(Je,this.mediaContainer,"The media element not exist");const r=B("div",["media-empty","embed-selected-content","embed-hover-content"],this.mediaContainer);r.innerHTML=this.abstract.mediaIcon,this.updateMediaContent(r);const{editor:i}=this.options;i.findBlockById(e.id)&&this.emit("mediaError",i,"empty",e.id),this.setFullScreen()}getResourceUrl(e,r){const{src:i}=e.embedData,{editor:o}=this.options;return o.doc.buildResourceUrl(i,{syncNewResources:async(s,l)=>{var d,h;if(!r)return;await o.doc.addResources([s]);const c=(h=(d=o.doc).getServerMeta)==null?void 0:h.call(d).appId;if(l!==e.embedData.src&&c&&e.embedData.src.includes(c)){const C=J(r);if(C&&!o.readonly&&o.isBlockWritable(C)){const E=mt.default(e);E.embedData.src=s,o.updateBlockData(C,E)}}}})}setFullScreen(){p(Je,this.mediaContainer,"The media element not exist"),z(this.mediaContainer,"full-screen")}removeFullScreen(){p(Je,this.mediaContainer,"The media element not exist"),ot(this.mediaContainer,"full-screen")}updateBlockAlign(e,r){const i=J(r);p(Je,i,"The block element not exist");const{align:o}=e;e.embedType==="video"&&(i.hasAttribute("data-style-align")&&i.removeAttribute("data-style-align"),i.setAttribute("data-style-align",o))}render(e,r){const{src:i}=e.embedData;(!this.mediaContainer||!r.contains(this.mediaContainer))&&(this.mediaContainer=B("div",["media"],r)),this.updateBlockAlign(e,r),Dtt(i)?i===Lf.Empty&&this.renderEmpty(e):this.renderMediaElement(e,r)}setAbstract(e){this.abstract=e}}I("media-embed");const Mtt="left";class IS{constructor(){m(this,"handleInsertEmptyEmbed",async(t,e)=>{var C;const{containerId:r,blockIndex:i}=e;let o;(C=e.data)!=null&&C.file&&(o=e.data.file);const s=Ltt(t,this.embedType);if(o=o!=null?o:await ma(s,{}),!o)return null;const{mediaType:l}=this.getAbstract();try{Itt(o,t,l)}catch{return null}const c={id:tt(),type:"embed",embedType:this.embedType,embedData:{src:Lf.Empty}};l==="video"&&(c.align=Mtt);const d=t.insertBlock(r,i,c);return await this.getMedia(t,c.id).handleUploadFile(o),d})}getMedia(t,e){const r=t.addCustom(`media-${e}`,()=>new _tt({editor:t,createMediaElement:this.createMediaElement,updateMediaElement:this.updateMediaElement,createProgressElement:this.createProgressElement,updateProgressElement:this.updateProgressElement}));return r.setAbstract({...this.getAbstract()}),r}getOptions(){const{menuItem:t,mediaIcon:e,mediaName:r,order:i,group:o}=this.getAbstract();return{name:r,insertEmbedCommandItems:[{id:`insert-${this.embedType}`,name:t,icon:e,order:i,group:o,subText:Tn(`insert-${this.embedType}`)}],handleInsertEmptyEmbed:this.handleInsertEmptyEmbed}}createEmbedContent(t,e,r){const{id:i}=r;this.getMedia(t,i).render(r,e)}handleUpdateBlock(t,e,r){const{id:i}=r,o=this.getMedia(t,i),s=Ot(e);return o.render(r,s),!0}handleDeleteBlock(t,e){const r=e.id,i=this.getMedia(t,r);i.removeAllListeners(),i.destroy()}convertTo(t,e,r,i){const o=e.embedData,s=t.doc.buildResourceUrl(o.src,{withToken:!0});return i==="html"?`<${o.type} src="${s}" />`:i==="markdown"?``:s}}function DS(n,t){const e=B("div",["uploading-progress-mask"],n),r=B("div",["uploading-progress-bar"],e),i=B("div",["uploading-progress-bar-value"],r);i.style.width=`${t}%`}function _S(n,t){const e=n.querySelector(".uploading-progress-bar-value");e&&(e.style.width=`${t}%`)}const Utt=I("media-audio");class Ott extends IS{constructor(){super(...arguments);m(this,"embedType",Jr.AUDIO);m(this,"updateProgressElement",_S);m(this,"createMediaElement",(e,r,i,o)=>{const s=B("div",["audio-container","embed-hover-content","embed-selected-content"],r),l=B("audio",[],s);return l.innerHTML="Your browser does not support the <code>audio</code> element.",l.controls=!0,l.src=o,setTimeout(()=>{this.getMedia(e,i.id).setFullScreen()}),l})}getAbstract(){return{mediaIcon:VT,mediaName:D.t(`media.${Jr.AUDIO}.menuItem`),menuItem:D.t(`media.${Jr.AUDIO}.menuItem`),order:800,mediaType:Jr.AUDIO,group:"common"}}getBlockProperties(){return{abstract:`${D.t(`media.${Jr.AUDIO}.abstract`)}`}}updateMediaElement(e,r,i,o){const s=r.querySelector(":scope .audio-container > audio");return p(Utt,s,"The media element not exist"),s.src!==o&&(s.src=o),s}createProgressElement(e,r){const i=B("audio",[],e);i.innerHTML="Your browser does not support the <code>audio</code> element.",i.controls=!0,i.src="about:blank",DS(e,r)}}const Ntt=new Ott;I("video-resizer");function MS(n){return n&&ge(n)&&We(n)==="video"}const Ptt=50;class TA{constructor(t){m(this,"currentResizableElement",null);m(this,"resizing",!1);m(this,"handleHoveringBlockChange",(t,e)=>{if(!this.resizing&&!window.isDragging&&(e&&MS(e)&&this.disableBlockResize(e),t&&MS(t)&&this.editor.isBlockWritable(t))){const r=this.getVideoElement(t);if(!r)return;this.enableBlockResize(t,r)}});m(this,"handleResizing",(t,e)=>{if(this.resizing=!0,!this.currentResizableElement)return;const r=t.getBlock();if(!r)return;const i=r.getBoundingClientRect().width,o=Math.min(Math.max(e.width,Ptt),i);this.currentResizableElement.style.width=`${o}px`,this.currentResizableElement.style.pointerEvents="none"});m(this,"handleResized",t=>{this.resizing=!1;const e=t.getBlock();if(!this.currentResizableElement||!e)return;const r=this.editor.getBlockData(e),{width:i}=this.currentResizableElement.getBoundingClientRect();this.currentResizableElement.style.pointerEvents="auto",this.editor.updateBlockData(e,{...r,width:i})});this.editor=t,Te.get(t).addListener("change",this.handleHoveringBlockChange)}destroy(){this.currentResizableElement=null,Te.get(this.editor).removeListener("change",this.handleHoveringBlockChange)}getVideoElement(t){return Ot(t).querySelector(":scope .video-container > video")}updateResizer(t){const e=this.editor.findCustom(`${lt(t)}-resizer`);e&&e.updateResizer()}disableBlockResize(t){const e=this.editor.findCustom(`${lt(t)}-resizer`);e&&e.disableResize()}enableBlockResize(t,e){const r=this.editor.addCustom(`${lt(t)}-resizer`,()=>new cf(this.editor,{resize:["top-left","top-right","bottom-left","bottom-right"]}));r.enableResize(t,e),r.removeListener("resizing",this.handleResizing),r.removeListener("resized",this.handleResized),r.addListener("resizing",this.handleResizing),r.addListener("resized",this.handleResized),this.currentResizableElement=e}}const Ftt=I("video");class Ktt extends IS{constructor(){super(...arguments);m(this,"embedType",Jr.VIDEO);m(this,"updateProgressElement",_S);m(this,"createMediaElement",(e,r,i,o)=>{const s=B("div",["video-container","embed-selected-content","drag-preview-element"],r),l=B("video",[],s);return l.innerHTML="Your browser does not support the <code>video</code> element.",l.controls=!0,l.src=o,l.addEventListener("canplay",()=>{e.addCustom("video-resizer",()=>new TA(e)),this.getMedia(e,i.id).removeListener("mediaError",this.handleMediaError),this.getMedia(e,i.id).addListener("mediaError",this.handleMediaError),this.getMedia(e,i.id).removeFullScreen()}),i.width&&(l.style.width=`${i.width}px`),l});m(this,"createProgressElement",(e,r,i)=>{const o=B("video",["progress-video"],e);o.innerHTML="Your browser does not support the <code>audio</code> element.",o.controls=!0,DS(e,r),da(i).then(s=>{const l=e.querySelector(".progress-video");l&&e1(e)&&(l.src=s)})})}getAbstract(){return{mediaName:D.t(`media.${Jr.VIDEO}.menuItem`),mediaIcon:$T,menuItem:D.t(`media.${Jr.VIDEO}.menuItem`),order:700,mediaType:Jr.VIDEO,group:"common"}}getBlockProperties(){return{abstract:`${D.t(`media.${Jr.VIDEO}.abstract`)}`}}handleMediaError(e,r,i){const o=e.addCustom("video-resizer",()=>new TA(e)),s=e.getBlockById(i);o.disableBlockResize(s)}updateMediaElement(e,r,i,o){const s=r.querySelector(":scope .video-container > video");p(Ftt,s,"The media element not exist"),s.src!==o&&(s.src=o),i.width?s.style.width=`${i.width}px`:s.style.width="";const l=e.getBlockById(i.id);return setTimeout(()=>{e.addCustom("video-resizer",()=>new TA(e)).updateResizer(l)}),s}}const Vtt=new Ktt,US=[fE,AE,xE,Ik],yA=[TS,$J,YZ,ott,htt,t$,Btt,Vtt,Ntt,tW,eS,UY],OS=[Hk,iS,w4,qk];function $tt(n,t,e){var i,o,s,l;ai.level=(i=e.logLevel)!=null?i:Ms.DEBUG;const r=ku(n,t,{components:{blocks:[...US,...((o=e==null?void 0:e.components)==null?void 0:o.blocks)||[]],embeds:[...yA,...((s=e.components)==null?void 0:s.embeds)||[]],boxes:[...OS,...((l=e.components)==null?void 0:l.boxes)||[]],textRenders:[new GC],options:{...e.componentsOptions}}});return r.readonly=!0,r.addCustom("heading-collapse",()=>new uA(r)),r.addCustom("editor-tooltip",()=>new tf(r)),r.addListener("clickLink",(c,d,h)=>{var E;if((E=e==null?void 0:e.events)!=null&&E.onClickLink){e.events.onClickLink(c,d,h);return}const C=h.getAttribute("link");C&&(c.readonly||d.ctrlKey||d.metaKey)&&window.open(C,"_blank")}),r}class NS{constructor(t){this.createOptions=t,t.lang&&D.setLang(t.lang)}createHistoryEditor(t,e){return $tt(t,e,this.createOptions)}}I("create-editor");function PS(n,{root:t,childDoc:e,doc:r}){var h,C;e.uploadResource=r.uploadResource.bind(r),e.buildResourceUrl=r.buildResourceUrl.bind(r);const i=n.getComponentOptions("comment"),o={image:{defaultAlign:"left"},table:{locatingContainer:t,hideCellMenu:!0,hideToolbar:!0},...i==null?void 0:i.componentsOptions},s=[];n.editorBlocks.forEach(E=>{E.blockType==="text"||E.blockType==="embed"||s.push(E)});const l=[];n.editorEmbeds.forEach(E=>{l.push(E)});const c=[];n.editorBoxes.forEach(E=>{E.boxType==="text"||E.boxType==="br"||E.boxType==="image"||E.boxType==="anchor"||c.push(E)});const d=ku(t,e,{shortcuts:[Uh],components:{blocks:s,commandProviders:[new m0],decorators:[new V0],embeds:l,boxes:c,options:o}});if(d.input.addHandler(new H0),d.input.addHandler(new FE(d)),d.input.addHandler(new zE(d)),d.input.addHandler(new zX(d)),d.input.addHandler(new W0),d.addCustom("image-paste-handler",()=>new PE(d)),ue.isMobile||d.addCustom("editor-tooltip",()=>new tf(d)),(h=n.options.componentsOptions)!=null&&h.mention){const E=n.options.componentsOptions.mention;d.addCustom("mention",()=>new rS(d,{...E}))}if((C=n.options.componentsOptions)!=null&&C.comment){const E=n.options.componentsOptions.comment;E.onCommentEditorClick&&d.addListener("click",E.onCommentEditorClick)}return d}function Htt(n,t){const e=Array.from(n.rootContainer.querySelectorAll(`[comment-${t.toLocaleLowerCase()}="${t}"]`)),r=new Set;e.forEach(i=>{const o=J(i);o&&r.add(o)}),r.forEach(i=>{GX(n,i,t)})}class jtt{constructor(t){m(this,"listeners",new Set);m(this,"doc");this.editor=t,this.doc=this.editor.doc.externalDoc,this.doc.registerCallback(this)}getComments(){return this.doc.getComments()}getComment(t){return this.doc.getComment(t)}getCommentDoc(t){return this.doc.getCommentDoc(t)}localCreateComment(t,e){this.doc.localCreateComment(t,e)}localDeleteComment(t){const e=this.getComment(t);this.doc.localDeleteComment(t);const r=e.groupId;this.getComments().filter(o=>o.groupId===r).length===0&&Htt(this.editor,r)}localUpdateComment(t,e){this.doc.localUpdateComment(t,e)}onCreateComment(t,e){Array.from(this.listeners.values()).forEach(r=>r.onCreateComment(t,e))}onDeleteComment(t,e){Array.from(this.listeners.values()).forEach(r=>r.onDeleteComment(t,e))}onUpdateComment(t,e){Array.from(this.listeners.values()).forEach(r=>r.onUpdateComment(t,e))}addListener(t){this.listeners.add(t)}removeListener(t){this.listeners.delete(t)}createCommentEditor(t,e){return PS(this.editor,{root:t,childDoc:e,doc:this.doc})}allowEdit(t){return t.userId===this.doc.getUser().userId}}class ztt{constructor(t,e){m(this,"listeners",new Set);this.editor=t,this.localDoc=e}get doc(){return this.localDoc.toJSON()}getComments(){return Object.values(this.doc.comments)}getComment(t){return this.doc.comments[t]}getCommentDoc(t){const e=this.doc.comments[t];return jp(e)}addListener(t){this.listeners.add(t)}removeListener(t){this.listeners.delete(t)}localCreateComment(t,e){}localDeleteComment(t){}localUpdateComment(t,e){}createCommentEditor(t,e){return PS(this.editor,{root:t,childDoc:e,doc:this.localDoc})}allowEdit(t){return t.userId===this.localDoc.getUser().userId}}const Gtt={placeholder:{common:{title:"\u8BF7\u8F93\u5165\u6807\u9898",readonlyTitle:"\u8BF7\u8F93\u5165\u6807\u9898",content:"\u70B9\u51FB + \uFF0C\u6216\u8F93\u5165 / \u5FEB\u6377\u63D2\u5165\u7EC4\u4EF6",contentInTable:"\u8F93\u5165 / \u5FEB\u6377\u63D2\u5165\u7EC4\u4EF6"},local:{readonlyTitle:"\u672A\u547D\u540D"}},copyCutProperty:{copy:"\u590D\u5236",cut:"\u526A\u5207",unsafeEnvTips:"\u7531\u4E8E\u5F53\u524D http \u8BBF\u95EE\u73AF\u5883\u4E0B\u7684\u9650\u5236\uFF0C\u8BF7\u4F7F\u7528\u5FEB\u6377\u952E({shortCut}) {operation}"}},Wtt={placeholder:{common:{title:"Enter a title",readonlyTitle:"Enter a title",content:'Click "+", or enter "/" to insert components quickly',contentInTable:'Enter "/" to insert components quickly'},local:{readonlyTitle:"Untitled"}},copyCutProperty:{copy:"Copy",cut:"Cut",unsafeEnvTips:"Due to the limitations of the current http access environment, please use the shortcut ({shortCut}) {operation}"}},qtt={placeholder:{common:{title:"\u30BF\u30A4\u30C8\u30EB\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044",readonlyTitle:"\u30BF\u30A4\u30C8\u30EB\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044",content:"\u300C+\u300D\u3092\u30AF\u30EA\u30C3\u30AF\u3059\u308B\u304B\u3001\u300C/\u300D\u3092\u5165\u529B\u3059\u308B\u3068\u3001\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u304C\u7D20\u65E9\u304F\u633F\u5165\u3067\u304D\u307E\u3059",contentInTable:"\u300C/\u300D\u3092\u5165\u529B\u3059\u308B\u3068\u3001\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u304C\u7D20\u65E9\u304F\u633F\u5165\u3067\u304D\u307E\u3059"},local:{readonlyTitle:"\u7121\u984C"}},copyCutProperty:{copy:"\u8907\u88FD",cut:"\u5207\u308B",unsafeEnvTips:"HTTP\u74B0\u5883\u306E\u5236\u7D04\u306B\u3088\u308A\u3001{operation}\u3059\u308B\u306B\u306F\u3001\u30B7\u30E7\u30FC\u30C8\u30AB\u30C3\u30C8({shortCut}) \u3092\u3054\u4F7F\u7528\u304F\u3060\u3055\u3044"}};D.mergeLang({"zh-CN":Gtt,"en-US":Wtt,"ja-JP":qtt});const Xtt="UEsDBBQABgAIAAAAIQBk9WPugQEAACkGAAATAAgCW0NvbnRlbnRfVHlwZXNdLnhtbCCiBAIooAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AADYcAAB3b3JkL251bWJlcmluZy54bWxQSwECLQAUAAYACAAAACEA+JXI7/wOAADzmQAADwAAAAAAAAAAAAAAAAAfIgAAd29yZC9zdHlsZXMueG1sUEsBAi0AFAAGAAgAAAAhAMySUFR9AQAA8QIAABEAAAAAAAAAAAAAAAAASDEAAGRvY1Byb3BzL2NvcmUueG1sUEsBAi0AFAAGAAgAAAAhACJREfHVAQAA3gMAABAAAAAAAAAAAAAAAAAA/DMAAGRvY1Byb3BzL2FwcC54bWxQSwECLQAUAAYACAAAACEAiD+lv+EAAABVAQAAGAAAAAAAAAAAAAAAAAAHNwAAY3VzdG9tWG1sL2l0ZW1Qcm9wczEueG1sUEsBAi0AFAAGAAgAAAAhAMEnywi2AAAAIQEAABMAAAAAAAAAAAAAAAAARjgAAGN1c3RvbVhtbC9pdGVtMS54bWxQSwECLQAUAAYACAAAACEAdD85esIAAAAoAQAAHgAAAAAAAAAAAAAAAABVOQAAY3VzdG9tWG1sL19yZWxzL2l0ZW0xLnhtbC5yZWxzUEsBAi0AFAAGAAgAAAAhAOuAYExTAwAAjw4AABIAAAAAAAAAAAAAAAAAWzsAAHdvcmQvZm9udFRhYmxlLnhtbFBLBQYAAAAADwAPANQDAADePgAAAAA=",Ytt=()=>Kg(Xtt);async function Qtt(n){return new Promise((t,e)=>{const r=new Image;r.onload=()=>{t({width:r.naturalWidth,height:r.naturalHeight})},r.onerror=e,r.src=n})}async function FS(n,t){if(n.width&&n.height)return{width:n.width,height:n.height,buffer:t};const e=await da(new File([t],"",{})),r=await Qtt(e);return r.width===void 0||r.height===void 0?{width:345,height:230,buffer:t}:n.width||n.height?{width:n.width||r.width*n.height/r.height,height:n.height||r.height*n.width/r.width,buffer:t}:{width:r.width,height:r.height,buffer:t}}function Jtt(n,t){let e=n.filter(s=>s!=null);const r=t-(e.length-1)*20,i=.87,o=e.reduce((s,l)=>s+l.width,0);return o>r&&(e=e.map(s=>({width:s.width*r/o,height:s.height*r/o,buffer:s.buffer}))),e.map(s=>({width:s.width*i,height:s.height*i,buffer:s.buffer}))}function Ztt(n,t,e){if(!e||typeof e!="object")return;const r=e,i=n.filter(s=>s!=null),o=t-(i.length-1)*20;i.forEach((s,l)=>{if(i.length===1&&r.widthPercent){const d=r.widthPercent,h=s.width;s.width=o*(d/100),s.height*=s.width/h;return}const c=`${l}_flex`;if(r[c]){const d=r[c],h=s.width;s.width=o*d,s.height*=s.width/h}})}function KS(n=[0,1,2,3,4,5,6,7],t=1){return n.map(e=>{let r;switch(e%3){case 0:r=pt.LevelFormat.DECIMAL;break;case 1:r=pt.LevelFormat.LOWER_LETTER;break;default:r=pt.LevelFormat.LOWER_ROMAN;break}return{level:e,format:r,text:`%${e+1}. `,alignment:pt.AlignmentType.START,start:t,style:{paragraph:{indent:{left:pt.convertInchesToTwip(.3*(e+1)),hanging:pt.convertInchesToTwip(.2)}}}}})}function tet(){return[0,1,2,3,4,5,6,7].map(n=>{let t;switch(n%3){case 0:t="\u2022";break;case 1:t="\u25E6";break;default:t="\u25AA";break}return{level:n,format:pt.LevelFormat.BULLET,text:t,alignment:pt.AlignmentType.START,style:{paragraph:{indent:{left:pt.convertInchesToTwip(.3*(n+1)),hanging:pt.convertInchesToTwip(.2)}}}}})}function eet(){return[0,1,2,3,4,5,6,7].map(n=>({level:n,format:pt.LevelFormat.BULLET,text:"\u2611",alignment:pt.AlignmentType.START,style:{paragraph:{indent:{left:pt.convertInchesToTwip(.3*(n+1)),hanging:pt.convertInchesToTwip(.2)}}}}))}function net(){return[0,1,2,3,4,5,6,7].map(n=>({level:n,format:pt.LevelFormat.BULLET,text:"\u2610",alignment:pt.AlignmentType.START,style:{paragraph:{indent:{left:pt.convertInchesToTwip(.3*(n+1)),hanging:pt.convertInchesToTwip(.2)}}}}))}var If=(n=>(n.NUMBERING="number-numbering-reference",n.BULLET="number-bullet-reference",n.CHECKED="checked-bullet-reference",n.UNCHECKED="unchecked-bullet-reference",n))(If||{});const ret=[{levels:KS(),reference:"number-numbering-reference"},{levels:tet(),reference:"number-bullet-reference"},{levels:eet(),reference:"checked-bullet-reference"},{levels:net(),reference:"unchecked-bullet-reference"}];function iet(n){switch(n){case"style-color-0":return"d83931";case"style-color-1":return"de7802";case"style-color-2":return"dc9b04";case"style-color-3":return"2ea121";case"style-color-4":return"245bdb";case"style-color-5":return"6425d0";case"style-color-6":return"8f959e";default:return}}function oet(n){switch(n){case"style-bg-color-1":case"style-bg-color-2":case"style-bg-color-8":case"style-bg-color-9":return"yellow";case"style-bg-color-0":case"style-bg-color-5":return"magenta";case"style-bg-color-3":return"green";case"style-bg-color-4":case"style-bg-color-11":return"blue";case"style-bg-color-6":return"lightGray";case"style-bg-color-7":return"red";case"style-bg-color-10":return"darkGreen";case"style-bg-color-12":return"darkMagenta";case"style-bg-color-13":return"darkGray";default:return}}function set(n){switch(n){case"style-bg-color-0":return"fbbab6";case"style-bg-color-1":return"ffdcb0";case"style-bg-color-2":return"fff7a0";case"style-bg-color-3":return"ceefc5";case"style-bg-color-4":return"d1ddfb";case"style-bg-color-5":return"d9cbf8";case"style-bg-color-6":return"eaeaea";case"style-bg-color-7":return"fe837c";case"style-bg-color-8":return"ffbd6a";case"style-bg-color-9":return"ffe662";case"style-bg-color-10":return"a8f393";case"style-bg-color-11":return"98b5ff";case"style-bg-color-12":return"b394f8";case"style-bg-color-13":return"b1b1b1";default:return}}const aet=/rgb\((\d+),\s*(\d+),\s*(\d+)\)/;function VS(n){if(typeof n=="string"&&n.length>0){if(n[0]==="#")return n.substring(1);const t=n.match(aet);if(t){const e=s=>{let l=Number(s).toString(16);return l.length<2&&(l=`0${l}`),l},r=e(t[1]),i=e(t[2]),o=e(t[3]);return`${r}${i}${o}`}if(n==="red")return"FF0000";if(n==="green")return"00FF00";if(n==="blue")return"0000FF"}}function ln(n,t){if(n&&n.attributes&&n.attributes[t])return n.attributes[t];if(n&&n.attributes&&n.attributes.box&&n.attributes.inputType&&t==="style-underline")return!0}function $S(n,t,e){for(let r=0;r<=e;++r){const i=`${t}${r}`;if(ln(n,i))return i}}function pm(n,t,e){n.attributes=n.attributes||{},n.attributes[t]=e}function kA(n){return n==="image"||n==="drawio"||n==="plantuml"||n==="mermaid"||n==="flowchart"}function HS(n){return n&&n.startsWith("//")?`https:${n}`:n&&!n.startsWith("http://")&&!n.startsWith("https://")?`https://${n}`:n}function cet(n){const t=ln(n,"inlineStyle");if(t==null)return;const e=t.split(";");for(const r of e){const i=r.split(":");if(i.length!==2)continue;const o=i[0].trim().toLowerCase(),s=i[1].trim().toLowerCase();o==="font-size"&&pm(n,"inline-style-font-size",s),o==="color"&&pm(n,"inline-style-color",s),o==="background-color"&&pm(n,"inline-style-background-color",s),o==="font-family"&&pm(n,"inline-style-font-family",s)}}function uet(n,t){if(t==null)return n==null?void 0:n.normal;if(n)return n[`heading${t}`]}function fet(n){const t=`${ln(n,"inline-style-font-size")}`;if(t&&t.indexOf("px")>0)return+t.replace(/px/g,"")}function det(n){if(n.attributes&&n.attributes.box&&n.attributes.text)return` ${n.attributes.text} `;if(n.attributes&&n.attributes.box&&n.attributes.inputType)return n.attributes.value?`${n.attributes.value}`:" "}function het(n){if(n.attributes&&n.attributes.box&&n.attributes.text)return` @${n.attributes.text} `}function met(n){return ln(n,"inline-style-font-family")}function get(n){const t=ln(n,"inline-style-background-color");return VS(t)}function pet(n){const t=ln(n,"inline-style-color");return VS(t)}function Cet(n){cet(n);const t=ln(n,"type")==="mention";return{box:n.attributes&&n.attributes.box?n.attributes:void 0,inlineCode:!!ln(n,"style-code"),link:HS(ln(n,"link")),size:fet(n),text:t?het(n):det(n)||n.insert,bold:!!ln(n,"style-bold"),underline:!!ln(n,"style-underline"),italics:!!ln(n,"style-italic"),strike:!!ln(n,"style-strikethrough"),superScript:!!ln(n,"style-super"),subScript:!!ln(n,"style-sub"),math:ln(n,"type")==="math"?ln(n,"src"):void 0,mention:t,fontFamily:met(n),background:get(n),color:t?"338fe5":iet($S(n,"style-color-",6))||pet(n),highlight:$S(n,"style-bg-color-",13)}}function Eet(){return[new pt.Paragraph({border:{top:{color:"auto",style:pt.BorderStyle.DASHED,size:4,space:1}},spacing:{before:300}}),new pt.Paragraph({spacing:{line:0}})]}function Aet(){return new pt.Paragraph({children:[new pt.TextRun({text:"[\u89C6\u9891\u6682\u4E0D\u652F\u6301\u5BFC\u51FA]",shading:{type:pt.ShadingType.CLEAR,color:"FFFFFF",fill:"CCCCCC"}})]})}function xet(){return new pt.Paragraph({children:[new pt.TextRun({text:"[\u97F3\u9891\u6682\u4E0D\u652F\u6301\u5BFC\u51FA]",shading:{type:pt.ShadingType.CLEAR,color:"FFFFFF",fill:"CCCCCC"}})]})}function bet(n,t){return new pt.Paragraph({children:[new pt.ExternalHyperlink({children:[new pt.TextRun({style:"Hyperlink",text:t||n})],link:n})]})}function jS(n){if(n.heading!=null)return`Heading${n.heading}`}function zS(n){if(n.alignment!=null){if(n.alignment==="center")return pt.AlignmentType.CENTER;if(n.alignment==="right")return pt.AlignmentType.RIGHT;if(n.alignment==="left")return pt.AlignmentType.LEFT}}function vet(n){if(n.indent)return{left:pt.convertInchesToTwip(.3*n.indent-.2)};if(n.padding)return{left:pt.convertInchesToTwip(.3*n.padding)}}function Bet(n){return{type:pt.ShadingType.CLEAR,color:"FFFFFF",fill:n}}function Tet(n){const t=n.split(",");if(t.length!==0)return t[0].trim()}function GS(n,t){let e;e=n.inlineCode?"InlineCode":void 0,e=n.link?"Hyperlink":e;const r=n.size||t,i=r!=null?Math.floor(r*1.5+.5):void 0;return new pt.TextRun({text:n.text,bold:n.bold||void 0,underline:n.underline?{type:pt.UnderlineType.SINGLE}:void 0,italics:n.italics||void 0,strike:n.strike||void 0,superScript:n.superScript||void 0,subScript:n.subScript||void 0,size:i,style:e,font:n.fontFamily?Tet(n.fontFamily):void 0,shading:n.background?Bet(n.background):void 0,color:n.color,highlight:oet(n.highlight)})}function yet(n,t){if(n.link)return new pt.ExternalHyperlink({children:[GS(n,t)],link:n.link})}async function WS(n,t,e,r,i){const o=await i(n,t,e);if(o==null)return;const s=await FS({width:r||0,height:0,src:e},o);return new pt.ImageRun({data:o,transformation:{width:s.width||100,height:s.height||20}})}function ket(n){if(n.heading||n.heading)return n.heading}function Ret(n){if(n.align&&(n.align==="center"||n.align==="right"||n.align==="left"))return n.align}function wet(n){if(n.textOnly===!0&&n.level!=null)return n.level}async function Let(n,t){var r;const e=[];if(n.text&&Array.isArray(n.text)){for(let i=0;i<n.text.length;i++){const o=n.text[i];if(((r=o.attributes)==null?void 0:r.box)===!0&&t){const s=await t(o);if(s){n.text.splice(i+1,0,...s);continue}}e.push(Cet(o))}return e}}function Iet(n){if(n.type==="list"&&n.textOnly!==!0)return{checkbox:n.checkbox,groupId:n.groupId,ordered:!!n.ordered,level:n.level||1,start:n.start||0}}function Det(n,t){if(n.type==="embed"&&n.embedType&&kA(n.embedType)&&n.embedData&&n.embedData.src)return n.embedData.src.split("|").map(r=>{const i=t(r),o=n.embedData[`${i}_width`],s=n.embedData[`${i}_height`];return{src:r,width:o,height:s}})}function _et(n){if(n.padding)return n.padding}function Met(n){return!!(n.type==="embed"&&n.embedType&&kA(n.embedType)&&n.embedData&&n.embedData.src)}async function Cm(n,t,e){return{quoted:!!n.quoted,heading:ket(n),alignment:Ret(n),indent:wet(n),padding:_et(n),texts:await Let(n,e),list:Iet(n),images:Det(n,t),border:Met(n)}}async function Uet(n,t,e,r){const i=[];if(!n.children)return[];for(const o of n.children){const s=[];for(const l of t.blocks[o])s.push(await Cm(l,e,r));i.push(s)}return i}const Oet=I("to-docx");function Net(n,t){return Array(n).fill(0).map(()=>Array(t).fill(0).map(()=>({cellId:void 0,color:void 0,from:void 0,rowSpan:1,colSpan:1,width:0,originalWidth:void 0,align:void 0})))}function Pet(n,t,e,r){const i=!!n.hasColTitle,o=!!n.hasRowTitle,s=!!n.isStripeStyle,l="F5F8FB";for(let c=0;c<t;c++)for(let d=0;d<e;d++)(i&&d===0||o&&c===0||s&&c%2===1)&&(r[c][d].color=l)}function Fet(n){p(Oet,n.children,"no table children");const t=n.rows,e=n.cols,r=n.colsWidth;if(r)for(let s=0;s<r.length;s++)r[s]===0&&(r[s]=100);const i=Net(t,e);let o=0;for(let s=0;s<t;++s)for(let l=0;l<e;++l){if(i[s][l].originalWidth=r?r[l]:void 0,i[s][l].from!==void 0)continue;const c=n.children[o];o+=1,i[s][l].cellId=c,i[s][l].color=set(n[`${c}_background`]),i[s][l].width=r?r[l]:100,i[s][l].align=n[`${c}_align`];const d=n[`${c}_rowSpan`]||1,h=n[`${c}_colSpan`]||1;if(i[s][l].rowSpan=d,i[s][l].colSpan=h,d>1||h>1){let C=0;for(let E=0;E<d;E++)for(let x=0;x<h;x++)E===0&&(C+=r?r[l+x]:80),!(E===0&&x===0)&&(i[s+E][l+x].from=[s,l]);i[s][l].width=C}}return Pet(n,t,e,i),i}async function Ket(n,t,e,r,i,o,s,l,c,d){async function h(x){if(l){const v=await l(i,o,x);if(v){await r.addDoc(n,v,d);return}}if(x.type==="text"||x.textOnly===!0){const v=await Cm(x,s,c);await r.addTextBlock(v);return}if(x.type==="code"){const v=await Uet(x,e,s,c);await r.addCodeBlockObject(v);return}if(x.type==="list"&&x.textOnly!==!0){const v=await Cm(x,s,c);await r.addListBlockObject(n,v);return}if(x.type==="embed"&&x.embedType){const v=x,R=v.embedData,L=v.embedType;if(kA(L)){const M=await Cm(x,s,c);await r.addImagesBlockObject(x,M,d)}else x.embedType==="hr"?r.addSeparatorBlock():x.embedType==="video"?r.addVideoPlaceholder():x.embedType==="audio"?r.addAudioPlaceholder():x.embedType==="webpage"?r.addHyperlinkParagraph(HS(R.src),R.title):r.addOtherEmbedBlock(L,x.embedData);return}if(x.type==="table"){let v=[];if(x.colsWidth)v=x.colsWidth;else{const L=x.cols;v=new Array(L);for(let M=0;M<v.length;M++)v[M]=100;x.colsWidth=v}const R=Fet(x);await r.addTableMatrix(v,R,e),r.addEmptyParagraph()}}function C(x){const v=[];for(const{type:R,data:L}of x.embedData.exportSpec){if(R==="text"){const M={id:tt(),text:[{insert:L}],type:"text"};v.push(M);continue}if(R==="image"){const M={id:tt(),type:"embed",embedType:"image",align:"left",embedData:{src:L}};v.push(M);continue}if(R==="link"){const M={id:tt(),type:"embed",embedType:"webpage",embedData:{src:L.url,title:L.title}};v.push(M);continue}}return v}function E(x){var v;return(v=x==null?void 0:x.embedData)!=null&&v.exportSpec?C(x):[x]}for(const x of t)for(const v of E(x))await h(v)}function Vet(){return{listMaxInst:1,listInstMap:{},listRefMap:{},levelConfigs:[]}}const $et=I("to-docx");class Het{constructor(t,e,r,i,o,s){m(this,"paragraphs");this.appId=t,this.docId=e,this.state=r,this.readImageFunc=i,this.convertBlocksFunc=o,this.defaultFontSize=s,this.paragraphs=[]}async addTextBlock(t){this.paragraphs.push(new pt.Paragraph({heading:jS(t),alignment:zS(t),children:await this.paragraphsFromBlockTexts(t),indent:vet(t)}))}async addEmptyImagePlaceHolder(){this.paragraphs.push(new pt.Paragraph({text:`[${D.t("docx.imageExportFailed")}]`,shading:{type:pt.ShadingType.CLEAR,color:"FFFFFF",fill:"CCCCCC"}}))}async paragraphsFromBlockTexts(t){if(t.texts==null)return;const e=uet(this.defaultFontSize,t.heading),r=[];for(const i of t.texts){if(i.link){const o=yet(i,e);o&&r.push(o);continue}if(i.box&&i.box.type&&i.box.type==="br"){r.push(new pt.TextRun({text:"",break:1}));continue}if(i.box&&i.box.type&&i.box.type==="image"){const o=await WS(this.appId,this.docId,i.box.src,i.box.width,this.readImageFunc);o&&r.push(o);continue}if(i.math){const o=await WS(this.appId,this.docId,i.math,0,this.readImageFunc);o&&r.push(o);continue}r.push(GS(i,e))}return r}async addCodeBlockObject(t){for(const e of t)for(const r of e){const i={style:pt.BorderStyle.SINGLE,color:"#DEDEDE"};this.paragraphs.push(new pt.Paragraph({style:"Code",border:{left:{...i},right:{...i},top:{...i},bottom:{...i}},children:await this.paragraphsFromBlockTexts(r)}))}}async addListBlockObject(t,e){if(e.list==null)return;let r;const i=e.list.checkbox?`${t}-${e.list.groupId}-${e.list.checkbox}`:`${t}-${e.list.groupId}`;if(this.state.listInstMap[i])r=this.state.listInstMap[i];else if(r=this.state.listMaxInst,this.state.listMaxInst+=1,this.state.listInstMap[i]=r,e.list.start>0&&e.list.ordered){const s=`number-numbering-reference-${r}`,l=KS([e.list.level-1],e.list.start);this.state.levelConfigs.push({levels:l,reference:s,inst:r}),this.state.listRefMap[i]=s}else e.list.ordered?this.state.listRefMap[i]=If.NUMBERING:e.list.checkbox&&e.list.checkbox==="checked"?this.state.listRefMap[i]=If.CHECKED:e.list.checkbox&&e.list.checkbox==="unchecked"?this.state.listRefMap[i]=If.UNCHECKED:this.state.listRefMap[i]=If.BULLET;const o=jS(e);e.texts&&this.paragraphs.push(new pt.Paragraph({heading:o,children:await this.paragraphsFromBlockTexts(e),numbering:{reference:this.state.listRefMap[i],level:e.list.level-1,instance:r}}))}imageDimWithBufferToImageRun(t){return new pt.ImageRun({data:t.buffer,transformation:{width:t.width,height:t.height}})}async addImagesBlockObject(t,e,r){if(e.images==null){if(t.type==="embed"&&t.embedType==="image"){const{src:c}=t.embedData;c||this.addEmptyImagePlaceHolder()}return}const i=[],o=await Promise.all(e.images.map(async c=>{const d=await this.readImageFunc(this.appId,this.docId,c.src);if(d)return FS(c,d);i.push(c.src)}));Ztt(o,r,t.embedData);const s=Jtt(o,r),l={style:pt.BorderStyle.SINGLE,color:"#DEDEDE"};s.length&&this.paragraphs.push(new pt.Paragraph({border:e.border?{left:{...l},right:{...l},top:{...l},bottom:{...l}}:void 0,alignment:zS(e)||pt.AlignmentType.CENTER,children:s.map(c=>this.imageDimWithBufferToImageRun(c)).flatMap((c,d,h)=>c==null?[]:h.length-1!==d?[c,new pt.TextRun({text:" "})]:c)})),i.forEach(c=>{this.addHyperlinkParagraph(c)})}addSeparatorBlock(){Eet().forEach(t=>this.paragraphs.push(t))}addEmptyParagraph(){this.paragraphs.push(new pt.Paragraph(""))}addVideoPlaceholder(){this.paragraphs.push(Aet())}addAudioPlaceholder(){this.paragraphs.push(xet())}addHyperlinkParagraph(t,e){t!=null&&this.paragraphs.push(bet(t,e))}async addTableMatrix(t,e,r){const i=t.map(o=>o!==0?o*15:1500);this.paragraphs.push(new pt.Table({rows:await this.generateTableRows(e,r),columnWidths:i}))}async generateRowCells(t,e){const r=[];for(const i of t){const o=i.cellId;if(o===void 0)continue;const s=i.width*.9;r.push(new pt.TableCell({children:await this.convertBlocksFunc(o,e.blocks[o],e,this.appId,this.docId,this.state,s),columnSpan:i.colSpan,rowSpan:i.rowSpan,width:{type:pt.WidthType.DXA,size:i.width*15},shading:i.color?{fill:i.color,type:pt.ShadingType.CLEAR,color:"auto"}:void 0}))}return r}async generateTableRows(t,e){const r=[];for(const i of t)r.push(new pt.TableRow({children:await this.generateRowCells(i,e)}));return r}async addDoc(t,e,r){const i=await this.convertBlocksFunc(t,e.blocks.root,e,this.appId,this.docId,this.state,r);i&&(this.paragraphs=this.paragraphs.concat(i))}async addOtherEmbedBlock(){}}class jet{constructor(t,e,r,i,o,s,l,c){m(this,"convertBlocks",async(t,e,r,i,o,s,l=720)=>{const c=new Het(i,o,s,this.readImage,this.convertBlocks,this.defaultFontSize);return await Ket(t,e,r,c,i,o,this.md5HexFunc,this.getDocByBlock,this.getTextsByBox,l||720),c.paragraphs});this.templateData=t,this.docData=e,this.md5HexFunc=r,this.readImage=i,this.defaultFontSize=o,this.getDocByBlock=s,this.getTextsByBox=l,this.backgroundImageOptions=c}async convert(t,e){return this.snapshot2docx(this.docData,t,e)}async snapshot2docx(t,e,r){const i=new pt.ImportDotx,o=this.templateData?await i.extract(this.templateData):void 0,s=t.blocks.root;p($et,s,"data must have blocks");const l=Vet(),c=await this.convertBlocks("blocks",s,t,e,r,l),d=this.backgroundImageOptions?{default:new pt.Header({children:[new pt.Paragraph({children:[new pt.ImageRun(this.backgroundImageOptions)]})]})}:{},h=new pt.Document({numbering:{config:[...ret,...l.levelConfigs]},sections:[{headers:d,children:c,properties:{page:{size:{width:12240,height:15840},margin:{top:1440,bottom:1440,left:1440,right:1440}}}}]},{template:o});return pt.Packer.toBlob(h)}}async function zet(n,t,e,r){const i=n.doc.buildResourceUrl(r,{withToken:!0});let o=await fS(i);if(!o)return;if(o.type.indexOf("/svg")!==-1){const l=await aS(o);l&&(o=new File([l],o.name))}return await o.arrayBuffer()}async function Get(n,t,e){const r=n.editorBlocks.getBlockClass(e.type);if(r.toStandardDoc)return r.toStandardDoc(n,e,t)}async function Wet(n,t){const e=t.attributes,r=n.editorBoxes.getBoxClass(e.type);if(r.toStandardText)return r.toStandardText(n,e)}async function qet(n,t){let{template:e,download:r,backgroundImageOptions:i}=t!=null?t:{};e||(e=Ytt());const o=n.doc.toJSON(),s=(C,E,x)=>zet(n,C,E,x),l=async(C,E,x)=>Get(n,o,x),c=async C=>Wet(n,C),h=await new jet(e,o,wd.default,s,void 0,l,c,i).convert("_appId","_docId");if(r){const C=URL.createObjectURL(h),E=document.createElement("a");E.setAttribute("download",`${uS(n)}.docx`),E.setAttribute("href",`${C}`),E.click(),E.remove()}return h}const RA=I("create-editor");async function Xet(n,t){var s,l,c,d,h,C,E,x,v,R,L,M,U,F;p(RA,n,"app does not exists"),t.lang&&D.setLang(t.lang),ai.level=(s=t.logLevel)!=null?s:Ms.DEBUG;const e=t.onReauth?async()=>{var st;const G=t.user.userId,W=t.docId,rt=await((st=t.onReauth)==null?void 0:st.call(t,G,W,t.permission));return{userId:G,docId:W,permission:t.permission,appId:t.appId,token:rt,displayName:t.user.displayName,avatarUrl:t.user.avatarUrl}}:void 0,r={auth:{appId:t.appId,docId:t.docId,userId:t.user.userId,permission:t.permission,token:t.token,displayName:t.user.displayName,avatarUrl:t.user.avatarUrl},serverUrl:t.serverUrl,reauthFunc:e,disableLogout:t.disableLogout},i=await Pu.load(r),o=ku(n,i,{id:t.id,scrollContainer:t==null?void 0:t.scrollContainer,enableComments:t==null?void 0:t.enableComments,components:{blocks:[...US,...((l=t==null?void 0:t.components)==null?void 0:l.blocks)||[]],embeds:[...yA,...((c=t.components)==null?void 0:c.embeds)||[]],boxes:[...OS,...((d=t.components)==null?void 0:d.boxes)||[]],commandProviders:[new m0,...((h=t.components)==null?void 0:h.commandProviders)||[]],decorators:[new V0,new Gp],insertions:[q1],blockHooks:[new _E,new rw,...((C=t.components)==null?void 0:C.blockHooks)||[]],textRenders:[new x4,new GC],options:{...t.componentsOptions}},shortcuts:[rY,Dj,jG,dE,zw,KK,sE,VY,Uh,_K,...t.shortcuts||[]],colors:["#0064FF","#EB3723","#F59300","#00A865","#F25A0A","#70A310","#009CAD","#0990D9","#8851ED","#D62069"]});if(o.editorCommandProviders.registerCommandProvider(new wi(o)),o.input.addHandler(new LQ),o.input.addHandler(new H0),o.input.addHandler(new o$),o.input.addHandler(new OG),o.input.addHandler(new bE(o,{hideTitle:t.hideTitle,headingLevel:1,titlePlaceholder:D.t("placeholder.common.title"),contentPlaceholder:D.t("placeholder.common.content"),readonlyTitlePlaceholder:D.t("placeholder.common.readonlyTitle"),addPlaceholderToAllCurrentEmptyBlock:!0})),o.input.addHandler(new M0(o,(E=t.componentsOptions)==null?void 0:E.quickMenu)),o.input.addHandler(new FE(o)),o.input.addHandler(new zE(o)),o.input.addHandler(new W0),o.doc.registerCallback(new IQ(o)),o.addCustom("remote-cursor",()=>new uT(o)),o.addCustom("block-menu",G=>new sw(G)),ue.isMobile||o.addCustom("editor-tooltip",()=>new tf(o)),t!=null&&t.enableComments&&o.addCustom("editor-comments",G=>new A4(G,new jtt(G))),t.enableContextMenu!==!1&&o.addCustom("editor-context-menu",G=>new Xw(G)),o.addCustom("create-options",()=>new Lb(o,t)),o.addCustom("drop-target",()=>new Af(o)),o.addCustom("list-to-mindmap",()=>new R0(o)),o.addCustom("list-to-mention",()=>new QQ(o)),o.addCustom("mobile-helper",()=>new xJ(o)),o.addCustom("code-caret",()=>new wj(o)),o.addCustom("image-paste-handler",()=>new PE(o)),(x=t.componentsOptions)!=null&&x.mention){const G=t.componentsOptions.mention;o.addCustom("mention",()=>new rS(o,G))}if(o.addCustom("heading-collapse",()=>new uA(o)),o.addCustom(mm,G=>new pA(G)),nc.register(o),Af.register(o),Cs.register(o),fs.register(o),o.addListener("clickLink",(G,W,rt)=>{var Et;if((Et=t==null?void 0:t.events)!=null&&Et.onClickLink){t.events.onClickLink(G,W,rt);return}const st=rt.getAttribute("link");st&&(G.readonly||W.ctrlKey||W.metaKey)&&window.open(st,"_blank")}),(R=(v=t.componentsOptions)==null?void 0:v.remoteCarets)!=null&&R.onUserChanged){const G=(M=(L=t.componentsOptions)==null?void 0:L.remoteCarets)==null?void 0:M.onUserChanged;o.doc.getRemoteUsers().on("change",W=>{G(o,W)})}return(F=(U=t.componentsOptions)==null?void 0:U.templates)!=null&&F.templates.length&&(o.addListener("docChanged",()=>{hm(o)}),o.addListener("resize",()=>{hm(o,{reset:!0})}),setTimeout(()=>{hm(o)},100)),o.doc.registerCallback({onError:async G=>{if(G.code==="ResetDoc"){RA.error(`reset doc: ${G.message}`);const W=await Pu.load(r);o.doc.reset(W)}}}),o.version="1.1.8-beta.13",o}function Yet(n){return n.toJSON!==void 0}async function Qet(n,t,e){var o,s,l,c,d,h;p(RA,n,"app does not exists");const r=Yet(t)?t:new yp(t,{serverUrl:e.serverUrl||""});e.lang&&D.setLang(e.lang),ai.level=(o=e.logLevel)!=null?o:Ms.DEBUG;const i=ku(n,r,{id:e.id,scrollContainer:e==null?void 0:e.scrollContainer,components:{blocks:[fE,AE,xE,Ik],commandProviders:[new m0],decorators:[new V0,new Gp],embeds:[...yA,...((s=e.components)==null?void 0:s.embeds)||[]],boxes:[Hk,iS,w4,qk,...((l=e.components)==null?void 0:l.boxes)||[]],insertions:[q1],blockHooks:[new _E,...((c=e.components)==null?void 0:c.blockHooks)||[]],textRenders:[new x4,new GC,...((d=e.components)==null?void 0:d.textRenders)||[]],options:{...e.componentsOptions}},shortcuts:[dE,zw,sE,Uh]});return i.editorCommandProviders.registerCommandProvider(new wi(i)),i.input.addHandler(new H0),i.input.addHandler(new bE(i,{hideTitle:e.hideTitle,headingLevel:1,titlePlaceholder:D.t("placeholder.common.title"),contentPlaceholder:D.t("placeholder.common.content"),readonlyTitlePlaceholder:D.t("placeholder.local.readonlyTitle"),addPlaceholderToAllCurrentEmptyBlock:!0})),i.input.addHandler(new M0(i,(h=e.componentsOptions)==null?void 0:h.quickMenu)),i.input.addHandler(new FE(i)),i.input.addHandler(new zE(i)),i.input.addHandler(new W0),i.addCustom("block-menu",C=>new sw(C)),ue.isMobile||i.addCustom("editor-tooltip",()=>new tf(i)),i.addCustom("image-paste-handler",()=>new PE(i)),e!=null&&e.enableComments&&i.addCustom("editor-comments",C=>new A4(C,new ztt(C,r))),e.enableContextMenu!==!1&&i.addCustom("editor-context-menu",C=>new Xw(C)),i.addCustom("heading-collapse",()=>new uA(i)),i.addListener("clickLink",(C,E,x)=>{var R;if((R=e==null?void 0:e.events)!=null&&R.onClickLink){e.events.onClickLink(C,E,x);return}const v=x.getAttribute("link");v&&(C.readonly||E.ctrlKey||E.metaKey)&&window.open(v,"_blank")}),i.addCustom(mm,C=>new pA(C)),nc.register(i),i.version="1.1.8-beta.13",i}async function Jet(n,t,e){var h;const r=n.doc.externalDoc.client.auth,i=await Wh.load({auth:r,serverUrl:e});if(!((h=i.getVersionHelper)==null?void 0:h.call(i)))throw new Error("the editor does not support to show versions");const s=n.getCustom("create-options");if(!s)throw new Error("the editor does not support to show versions");const l=s.getData(),c=new NS(l),d=n.addCustom("version-dialog",()=>new j4(i,c));return d.show(t),d}b.tippy=r9,b.AnchorBox=_B,b.AuthError=Ou,b.AuthHeader=sl,b.AutoScroll=Hd,b.BaseURLHeader=Pa,b.BasicCommands=RV,b.BlockExclusiveHook=rw,b.BlockLockerHook=_E,b.BlockLockerPasteHandler=W0,b.BlockResizer=cf,b.BrBox=SB,b.CodeBlock=AE,b.CodeLineBlock=xE,b.CodeTextDecorator=V0,b.DOC_RE_AUTH_KEYS=mm,b.DefaultShortcuts=Uh,b.DocIdError=BN,b.DocReAuthCallbacks=pA,b.DragDrop=Xb,b.DrawioEmbed=TS,b.EditorBlocks=r3,b.EditorBoxes=IB,b.EditorCommandProviders=T2,b.EditorComplexBlockPosition=Ur,b.EditorComplexSelectionRange=di,b.EditorDecorators=NB,b.EditorEmbeds=o3,b.EditorInsertions=OB,b.EditorSimpleBlockPosition=qe,b.EditorSimpleSelectionRange=en,b.EmbedBlock=l3,b.EmbedBlockResizer=Rf,b.EnforceWithDocumentTitleHandler=bE,b.EventCallbacks=aa,b.FILL_CHAR=Z_,b.FileExtError=TN,b.GroupOrder=Uk,b.HeadingBlockScrollListener=zQ,b.ImageBox=DB,b.InlineBoxCommandProvider=Xk,b.InputtingInsertion=MB,b.LocalDoc=yp,b.LogLevel=Ms,b.Logger=ai,b.MIN_DISTANCE_THRESHOLD=Wb,b.ManualCloseDialog=Ku,b.ManualMenu=es,b.ManualToolbar=Fu,b.MarkdownInputHandler=H0,b.MaxUserError=Np,b.Mindmap=k0,b.OnesEditorAutoSuggest=hC,b.OnesEditorCustomDataWrapper=Lb,b.OnesEditorExclusiveBlock=fs,b.OnesEditorHoveringBlock=Te,b.OnesEditorIcons=cP,b.OnesEditorQuickMenu=M0,b.OnesEditorToc=Sf,b.OnesEditorTocProvider=Cs,b.OnesEditorToolbar=nc,b.OnesEditorTooltip=tf,b.OnesEditorVersionsDialog=j4,b.PermissionError=Gh,b.Popup=$a,b.ReAuthToolbar=dS,b.RemoteCarets=uT,b.RemoteCaretsDecorator=Gp,b.RemoteCaretsInsertion=q1,b.RemoteUsers=Ru,b.RequestReloadError=Nu,b.RichText=hn,b.ShareDBDoc=Pu,b.ShareDBDocVersionsProvider=NS,b.ShareDBServer=Wh,b.SimpleCache=Pb,b.StandardEmbedBlockCommands=rA,b.TEXT_STYLE_BACKGROUND_COLOR_PREFIX=k1,b.TEXT_STYLE_COLOR_PREFIX=y1,b.TableBlock=fE,b.TableBlockCommandProvider=m0,b.TableShortcuts=dE,b.TextBlock=Un,b.TextBox=wB,b.TextColorItem=wy,b.TextStyleShortcuts=sE,b.TocEmbed=eS,b.ZERO_WIDTH_SPACE_CHAR=Yc,b.abbreviation=jd,b.addAttribute=oh,b.addClass=z,b.addCommentToBlock=kf,b.addDays=fI,b.addMetaToDoc=Da,b.addMonths=uI,b.animateScrollTo=$o,b.applyPlaceholderToBlock=lf,b.assert=p,b.autoShowHideTemplates=hm,b.blockToDoc=xp,b.blockToHtml=Q1,b.blockToMarkdown=vh,b.blockToText=bh,b.blocksToDoc=xU,b.clearAllSelection=Kv,b.clientType=ue,b.cloneBlock=Yo,b.cloneChildContainer=lp,b.cloneDoc=ap,b.cloneText=EB,b.commentToShareDbComment=zp,b.compareElement=Ud,b.comparePosition=c1,b.complexBlockAdjustSelectionPos=Qd,b.complexBlockFindNearestChildBlock=c7,b.complexBlockGeFirstSimpleChild=f1,b.complexBlockGetAllChildContainers=vn,b.complexBlockGetBottomChildContainers=u3,b.complexBlockGetLastSimpleChild=Ca,b.complexBlockGetSelectedContainers=pa,b.complexBlockGetTopChildContainers=c3,b.containerToDoc=Y5,b.continuousScroll=uv,b.convertBlockFrom=qd,b.convertImageFileToPng=aS,b.convertImageSrcToPng=mJ,b.converterIntercept=$0,b.copyBlockAttributes=XB,b.copyResourcesFromDoc=Tp,b.createBlockAnchor=Yi,b.createBlockCaretAnchor=h3,b.createBlockContentElement=zs,b.createBlockElement=Iv,b.createBlockSimpleDocRange=gh,b.createBlockSimpleRange=ye,b.createBoxContentElement=Mv,b.createBoxElement=Dv,b.createBoxOp=CB,b.createChildContainer=e3,b.createComplexBlockPosition=Ee,b.createComplexDocPos=TB,b.createComplexDocRange=nM,b.createContainer=bB,b.createContainerElement=Yg,b.createDeleteOps=hB,b.createEditor=ku,b.createEditorSelectionRange=Xe,b.createElement=B,b.createEmptyContainer=no,b.createEmptyDoc=eo,b.createEmptyTextBlockData=hh,b.createExpandedRange=_d,b.createIconButton=Os,b.createImage=Sg,b.createInsertOps=fh,b.createInsertionContentElement=Nv,b.createInsertionElement=Uv,b.createLocalEditor=Qet,b.createOnesEditor=Xet,b.createRange=Fb,b.createRichText=el,b.createRootContainer=t3,b.createSimpleBlockPosition=at,b.createSimpleDocPos=BB,b.createTextBlockData=pi,b.createTextButton=gl,b.createTextOp=gr,b.createTextWithReplaceSoftReturn=P1,b.daysAfter=zg,b.deleteText=K1,b.diffDays=dI,b.disablePageScroll=$g,b.docToHtml=jB,b.docToHtmlFragment=Ta,b.docToMarkdown=zB,b.docToText=ro,b.downloadImageToFile=fS,b.downloadObjectToFile=AA,b.downloadSvgToString=gS,b.editLink=Qu,b.editorAddComment=qX,b.editorAddTextAttribute=s5,b.editorAutoInsertBlock=YB,b.editorBreakTextBlock=wa,b.editorClearCompositionText=ep,b.editorClearSelectedContents=Rh,b.editorCopyBlock=Mh,b.editorDeleteBlock=ip,b.editorDeleteBlockText=np,b.editorDeleteBlockWithoutChildren=yh,b.editorDeleteChildContainer=ZM,b.editorDeleteChildContainers=QB,b.editorFocusToBlock=sp,b.editorFocusToEnd=EU,b.editorGetBlockData=Xo,b.editorGetBlockText=Bn,b.editorGetBlockTextEx=Ch,b.editorGetBoxData=kB,b.editorHandleKeyboardEvent=l2,b.editorInsertBlock=Ra,b.editorInsertBoxToBlock=WB,b.editorInsertDoc=i5,b.editorInsertDocAt=cp,b.editorInsertText=tp,b.editorInsertTextToBlock=GB,b.editorInsertTextToBlockEx=Z1,b.editorMergeTextBlock=JB,b.editorMoveDown=A5,b.editorMoveEnd=pp,b.editorMoveHome=S5,b.editorMoveLeft=p5,b.editorMoveLineEnd=N5,b.editorMoveLineHome=O5,b.editorMovePageDown=H5,b.editorMovePageUp=$5,b.editorMoveRight=C5,b.editorMoveUp=E5,b.editorMoveWordEnd=k5,b.editorMoveWordLeft=y5,b.editorRangeClearColor=a5,b.editorRangeGetColor=c5,b.editorRangeSetColor=l5,b.editorRemoveTextAttribute=rU,b.editorReplaceBlockText=wh,b.editorReplaceContainer=o5,b.editorRunOnce=kp,b.editorSelectAll=Ep,b.editorSelectContainer=Ih,b.editorSelectDown=x5,b.editorSelectEnd=Cp,b.editorSelectHome=L5,b.editorSelectLeft=b5,b.editorSelectLineEnd=U5,b.editorSelectLineHome=M5,b.editorSelectPageDown=G5,b.editorSelectPageUp=z5,b.editorSelectRight=v5,b.editorSelectUp=B5,b.editorSelectWordEnd=w5,b.editorSelectWordLeft=R5,b.editorSetTextColor=Sa,b.editorShowFindDialog=Kq,b.editorToDocx=qet,b.editorUpdateBlockData=Sh,b.editorUpdateCompositionText=qB,b.editorUpdateEmbedData=n5,b.enablePageScroll=Hg,b.escapeHtmlText=Nd,b.escapeRegExp=Xg,b.escapeSpace=q9,b.exclusiveBlock=LE,b.executeBlockCommand=Xv,b.executeEmbedBlockCommand=qv,b.executeRangeCommand=B2,b.fileToDataUrl=da,b.findAfterOffsetNotType=z1,b.findAllText=$1,b.findBlockByIndex=bv,b.findEventTargetBlock=Hb,b.findInsertionById=Ov,b.findNextOffset=vM,b.findNextVisibleSimpleBlock=w2,b.findPrevOffset=bM,b.findPrevOffsetNotType=j1,b.findPrevSimpleBlockBeforeChildContainer=a3,b.findPrevVisibleSimpleBlock=R2,b.findTarget=ua,b.findWordEnd=W1,b.findWordLeft=G1,b.format=nu,b.formatBytes=fv,b.formatDate=Wg,b.fragmentToHtml=sv,b.fromBase64=Zc,b.fromBase64ToBlob=Kg,b.fromBase64ToUint8Array=oI,b.fromDocRange=zo,b.fromNowString=qg,b.genId=tt,b.getAllChildBlocks=m1,b.getAllQuickMenuItems=oE,b.getAllSelectedBlocks=hi,b.getAttributesAt=ba,b.getBlockBackground=Lv,b.getBlockByIndex=ji,b.getBlockCaretRect=Ho,b.getBlockClass=Qt,b.getBlockClassByType=$s,b.getBlockClientRects=Wi,b.getBlockCommandsWithHook=i1,b.getBlockContent=Ot,b.getBlockId=lt,b.getBlockIndex=Bt,b.getBlockInfo=mf,b.getBlockKind=Dr,b.getBlockMinWidth=$v,b.getBlockNearestRangeFromPoint=d1,b.getBlockOptions=yI,b.getBlockPath=jo,b.getBlockProperties=zv,b.getBlockRangeFromPoint=Jd,b.getBlockStyles=TI,b.getBlockTextLength=dt,b.getBlockTools=ie,b.getBlockType=Dt,b.getBoxContent=Zg,b.getBoxId=_v,b.getBoxTypeFromElement=lu,b.getChildBlockCount=Ir,b.getChildBlocks=fe,b.getChildOffset=Wo,b.getColorFromAttributes=w1,b.getColorFromContent=zd,b.getComplexBlockClass=fr,b.getContainerBlockPath=Qv,b.getContainerBlocks=Fv,b.getContainerBlocksElement=iu,b.getContainerById=Lr,b.getContainerId=ut,b.getContainerMinWidth=l1,b.getContainerToolsElement=bI,b.getContainerWidth=n3,b.getDistanceSquare=Vo,b.getElementOffset=Xc,b.getElementScale=ur,b.getEmbedType=We,b.getExistsBlockTools=Gd,b.getExistsContainerById=ru,b.getFileExt=eu,b.getFirstChildBlock=we,b.getFirstClientRect=Md,b.getHeadingMenuOptions=ZC,b.getHorizontalPadding=Ig,b.getInsertionContent=t1,b.getLastChildBlock=tn,b.getLastClientRect=Ns,b.getListAllNextBrothers=Qa,b.getLogger=I,b.getNextBlock=Zt,b.getNextValidOffset=Zs,b.getNextVisibleBlock=Ws,b.getOffsetFromPoint=Lg,b.getOffsetInfoAfter=Eu,b.getOffsetInfoBefore=Eh,b.getOpAt=W3,b.getOpLength=ih,b.getParentBlock=J,b.getParentBlockExcludeSelf=js,b.getParentBox=Jg,b.getParentContainer=it,b.getPrevBlock=Ae,b.getPrevValidOffset=qo,b.getPrevVisibleBlock=Gs,b.getRangeCommands=b2,b.getReferenceClientRect=lk,b.getRootBlock=r1,b.getScrollContainer=Ge,b.getSpecialBlockCommands=Gv,b.getStandardEmbedBlockProperties=iA,b.getTextAfterOffset=AM,b.getTextAttributes=J1,b.getTextBeforeOffset=xM,b.getTextBlockChild=Xd,b.getTextBlockClass=Bv,b.getTextBlockContentChildTextLength=mr,b.getTextBlockContentChildType=Yv,b.getTextBlockContentChildren=fi,b.getTextLength=dn,b.getTextOpLength=T1,b.getTextWidth=Kd,b.getToolbar=x0,b.handleBlockElementUpdated=Hv,b.hasAltOnly=tI,b.hasClass=wt,b.hasCtrlOrCmd=ev,b.hasCtrlOrCmdOnly=Z9,b.hashCode=Ev,b.hideBlock=wv,b.htmlToFragment=Fd,b.i18n=D,b.injectDocToHtmlFragment=Ia,b.injectStyle=Gb,b.inputActions=NU,b.insertEmptyBlock=wI,b.insertEmptyEmbedBlock=o1,b.insertText=to,b.intersectionCommands=pO,b.isBackspace=rv,b.isBlock=Hs,b.isBlockLocked=G0,b.isBlockLockedByOthers=DE,b.isBlockLockedBySelf=gf,b.isBlockTools=Rv,b.isBox=Wd,b.isBoxOp=Qi,b.isCJK=Zb,b.isChildContainer=Mr,b.isChildNode=re,b.isCodeBlock=Xr,b.isCollapsedRange=eM,b.isComplexBlockPosition=ga,b.isComplexKindBlock=Mt,b.isContainer=Gi,b.isContainerSelectedAllChildBlocks=W5,b.isControlEvent=Ks,b.isDelete=nI,b.isDraggingFiles=Vd,b.isElementVisible=Mg,b.isEmbedBlock=ge,b.isEmptyContainer=uu,b.isEmptyDoc=H1,b.isEmptyTextBlock=oe,b.isEmptyTextBlockWithoutCompositionText=sf,b.isEnterOnly=nv,b.isEscape=Pg,b.isExclusiveBlock=hf,b.isFirefox=Jc,b.isFirstChildBlockInComplexBlock=a7,b.isHighSurrogate=j9,b.isInBlock=e1,b.isInBlockTools=qs,b.isLetter=Jb,b.isLowSurrogate=z9,b.isMatchShortcut=ci,b.isMoveForward=Q9,b.isNavigationEvent=Y9,b.isNavigationKey=tv,b.isNodeRemoved=Vb,b.isNumber=Qb,b.isPrintableKey=Ng,b.isRootBlock=dr,b.isRootContainer=Xt,b.isSafari=fa,b.isSameDay=Gg,b.isSelectBoxOnly=qr,b.isShiftEnter=eI,b.isShiftTab=iI,b.isShortcutEvent=J9,b.isSimpleBlock=BI,b.isSimpleBlockPosition=Or,b.isSimplePos=vB,b.isSimpleRange=mh,b.isSpace=Pd,b.isTab=rI,b.isTextBlockContentBoxChild=hr,b.isTextBlockContentChild=au,b.isTextBlockContentInsertionChild=Xi,b.isTextBlockContentTextChild=cu,b.isTextKindBlock=nt,b.isTextKindBlockType=ou,b.isTitleBlock=zi,b.isToday=dv,b.isValidOffset=Mn,b.isVisibleBlock=su,b.isYesterday=hv,b.loadJs=$b,b.loadJsPromise=Ps,b.lockers=Sr,b.mergeCommands=A0,b.mergeDocs=nl,b.mergeOps=F1,b.mergeText=Q_,b.multiSplitText=X3,b.overflowText=mv,b.parseShortcut=iv,b.patchNode=tu,b.pointInRect=Fs,b.rangeAddAttribute=gu,b.rangeGetTextColor=nB,b.rangeRemoveAttribute=xa,b.rangeSetTextColor=Z3,b.rangeTransformText=Q3,b.registerDragDrop=Ug,b.removeAttribute=R1,b.removeClass=ot,b.removeLastBr=W_,b.removePlaceholderFromBlock=SR,b.removeStyle=zb,b.replaceAll=hI,b.replaceAllCaseInsensitive=mI,b.replaceAllText=xB,b.replaceText=dh,b.requestDownload=$d,b.resetListStart=Za,b.scrollable=cv,b.selectFile=ma,b.selectedBlockToDoc=Dh,b.selectionToDoc=La,b.setAttributes=Od,b.setClipboardData=ha,b.setClipboardDataByEvent=cI,b.setColorToAttributes=tB,b.setDataset=Dg,b.setDefaultCursor=Qc,b.setStyles=_g,b.shareDBCommentToDocObject=jp,b.shareDBDocCommentToComment=aT,b.shortcutToDisplayText=ze,b.showBlock=Sv,b.showDocVersions=Jet,b.splitText=Dn,b.splitToThree=Ye,b.stringToDataUrl=Vg,b.stringToObjectUrl=jg,b.subText=Y3,b.textNodeOffsetFromPoint=Kb,b.titleFromEditor=uS,b.toBase64URL=ui,b.toMindmap=y0,b.toPlainText=de,b.toPlainTextKeepLength=V1,b.trimChar=Og,b.unexclusiveBlock=IE,b.unicodeLength=G9,b.unicodeSubstr=W9,b.updateBlockSelection=Vv,b.updateOpAttributes=AB,b.updateTextBlockContent=EM,b.updateUrl=Fg;for(const n in Be)n!=="default"&&!b.hasOwnProperty(n)&&Object.defineProperty(b,n,{enumerable:!0,get:()=>Be[n]});Object.defineProperties(b,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
962
|
+
\`\`\`\`\`\``}return""}const htt={embedType:"plantuml",convertFrom:utt,handleUpdateBlock:ctt,createEmbedContent:att,getBlockProperties:ftt,convertTo:dtt},Cut="",mtt="hr",gtt={dividingLine:{type:"\u5206\u5272\u7EBF",abstract:"\u5206\u5272\u7EBF"}},ptt={dividingLine:{type:"Dividing-Line",abstract:"Dividing-Line"}},Ctt={dividingLine:{type:"\u533A\u5207\u308A\u7DDA",abstract:"\u533A\u5207\u308A\u7DDA"}};D.mergeLang({"zh-CN":gtt,"en-US":ptt,"ja-JP":Ctt});function Ett(n,t){const e=B("div",["editor-embed-container"],t);B("hr",["editor-embed-hr"],e)}function Att(n,t,e,r){return r==="html"?"<hr />":r==="markdown"?"---":"------------"}function xtt(){return{name:"hr",insertEmbedCommandItems:[{id:"insert-hr",name:D.t("dividingLine.type"),icon:jT,order:500,group:"common",subText:Tn("insert-hr")}],handleInsertEmptyEmbed:async(n,t)=>{const{containerId:e,blockIndex:r}=t;return n.insertEmbed(e,r,mtt,{})}}}function btt(n,t,e){const{data:r}=e;if(!r||r.embedType!=="dividing-line"||!nt(n,t))return null;const i={};return{blockData:{id:tt(),type:"embed",embedType:"hr",embedData:i}}}function vtt(){return{abstract:D.t("dividingLine.abstract")}}const Btt={embedType:"hr",createEmbedContent:Ett,convertTo:Att,getOptions:xtt,convertFrom:btt,getBlockProperties:vtt},Eut="",Aut="",Ttt={media:{upload:{failed:'<div class="line-1">{name}\u4E0A\u4F20\u5931\u8D25</div><div class="line-2">\u7F51\u7EDC\u670D\u52A1\u5F02\u5E38\uFF0C\u4F60\u53EF\u4EE5 <span class="retry-upload">\u91CD\u8BD5</span></div>',maxSizeFailed:'<div class="line-1">{name}\u4E0A\u4F20\u5931\u8D25</div><div class="line-2">\u6587\u4EF6\u5927\u5C0F\u8D85\u8FC7\u9650\u5236\uFF0C\u8BF7\u91CD\u65B0\u9009\u62E9\u6587\u4EF6</div>'},load:{failed:'<div class="line-1">{name}\u52A0\u8F7D\u5931\u8D25</div><div class="line-2">\u7F51\u7EDC\u670D\u52A1\u5F02\u5E38\uFF0C\u4F60\u53EF\u4EE5 <span class="retry-upload">\u91CD\u8BD5</span></div>'},audio:{menuItem:"\u97F3\u9891",abstract:"\u97F3\u9891"},video:{menuItem:"\u89C6\u9891",abstract:"\u89C6\u9891"}}},ytt={media:{upload:{failed:'<div class="line-1">{name} upload failed</div><div class="line-2">Network error, you can <span class="retry-upload">Retry</span></div>',maxSizeFailed:'<div class="line-1">{name} upload failed</div><div class="line-2">The file size exceeds limit. Please choose another file.</div>'},load:{failed:'<div class="line-1">{name} loading failed</div><div class="line-2">Network error, you can <span class="retry-upload">Retry</span></div>'},audio:{menuItem:"Audio",abstract:"Audio"},video:{menuItem:"Video",abstract:"Video"}}},ktt={media:{upload:{failed:'<div class="line-1">{name}\u306E\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u306B\u5931\u6557\u3057\u307E\u3057\u305F</div><div class="line-2">\u304A\u4F7F\u3044\u306E\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF\u63A5\u7D9A\u306B\u554F\u984C\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002\u6B21\u306E\u64CD\u4F5C\u3092\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002 <span class="retry-upload">\u518D\u8A66\u884C</span></div>',maxSizeFailed:'<div class="line-1">{name}\u306E\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u306B\u5931\u6557\u3057\u307E\u3057\u305F</div><div class="line-2">\u30D5\u30A1\u30A4\u30EB\u306E\u30B5\u30A4\u30BA\u304C\u4E0A\u9650\u3092\u8D85\u3048\u3066\u3044\u308B\u305F\u3081\u3001\u4ED6\u306E\u30D5\u30A1\u30A4\u30EB\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044</div>'},load:{failed:'<div class="line-1">{name}\u3092\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093\u3067\u3057\u305F</div><div class="line-2">\u304A\u4F7F\u3044\u306E\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF\u63A5\u7D9A\u306B\u554F\u984C\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002\u6B21\u306E\u64CD\u4F5C\u3092\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002 <span class="retry-upload">\u518D\u8A66\u884C</span></div>'},audio:{menuItem:"\u97F3\u58F0",abstract:"\u97F3\u58F0"},video:{menuItem:"\u52D5\u753B",abstract:"\u52D5\u753B"}}};D.mergeLang({"zh-CN":Ttt,"en-US":ytt,"ja-JP":ktt});var Jr=(n=>(n.AUDIO="audio",n.VIDEO="video",n))(Jr||{}),Lf=(n=>(n.Empty="empty",n.Progress="progress",n.Error="error",n))(Lf||{});const SS=10*1024*1024,Rtt=["wav","mp3","aac","ogg","webm","flac"],wtt=["ogg","mp4","webm"],Stt=()=>{};function LS(n){var h,C,E,x,v,R;const t=(h=n.getComponentOptions("media"))!=null?h:{},{allowedMedias:e,maxSize:r,callbacks:i}=t,o=(C=e==null?void 0:e.audio)!=null?C:Rtt,s=(E=e==null?void 0:e.video)!=null?E:wtt,l=(x=r==null?void 0:r.audio)!=null?x:SS,c=(v=r==null?void 0:r.video)!=null?v:SS,d=(R=i==null?void 0:i.onError)!=null?R:Stt;return{allowedMedias:{audio:o,video:s},maxSize:{audio:l,video:c},callbacks:{onError:d}}}function Ltt(n,t){const e=o=>o.map(s=>`.${s}`).join(","),{allowedMedias:r}=LS(n),i=r[t];return i?e(i):"*"}function Itt(n,t,e){const{maxSize:r,callbacks:i,allowedMedias:o}=LS(t),{[e]:s}=r,{[e]:l}=o;if(s&&n.size>s){const d=new Error("media is too large");throw d.code=`MaxMediaSize-${e}`,i!=null&&i.onError&&(i==null||i.onError(t,d)),d}const c=eu(n.name);if(l&&!l.includes(c.toLowerCase())){const d=new Error(`media file is not allowed: ${c}`);throw d.code="NotAllowedFile",i!=null&&i.onError&&(i==null||i.onError(t,d)),d}}function Dtt(n){return n===Lf.Empty||n===Lf.Error}const Je=I("media");class _tt extends Be.TypedEmitter{constructor(e){super();m(this,"mediaContainer",null);m(this,"media",null);m(this,"abstract",null);m(this,"handleMediaLoadError",(e,r)=>{if(!r.target||!(r.target instanceof Node)||!(r.target instanceof Element?r.target:r.target.parentElement))return;const o=J(r.target);if(!o||!o.contains(this.mediaContainer))return;const s=this.renderError();this.updateMediaContent(s),this.emit("mediaError",e,"load_error",lt(o))});m(this,"handleUploadFile",async e=>{p(Je,this.abstract,"no abstract"),p(Je,this.mediaContainer,"The media element not exist");const{editor:r}=this.options,i=J(this.mediaContainer);p(Je,i,"The block element not exist");const o=r.getBlockData(i);try{const{resourceId:s}=await r.doc.uploadResource(e,{onProgress:C=>{this.renderProgress(C,e)}}),{name:l,type:c,size:d}=e,h={...o,embedData:{...o.embedData,src:s,fileName:l,fileSize:d,fileType:c}};r.updateBlockData(i,h)}catch(s){Je.error(s),this.emit("mediaError",r,"upload_error",o.id),this.renderRetry(e,s)}ot(i,"media-block-uploading")});m(this,"destroy",()=>{this.mediaContainer=null});this.options=e}bindMediaEvent(){const{editor:e}=this.options;this.media&&e.domEvents.addEventListener(this.media,"error",this.handleMediaLoadError)}unbindMediaEvent(){const{editor:e}=this.options;this.media&&e.domEvents.removeEventListener(this.media,"error",this.handleMediaLoadError)}updateMediaContent(e){p(Je,this.mediaContainer,"The media element not exist"),this.mediaContainer.innerHTML="",this.mediaContainer.append(e)}renderError(){p(Je,this.abstract,"no abstract");const{editor:e,createMediaElement:r}=this.options,{mediaIcon:i,mediaName:o}=this.abstract;p(Je,this.mediaContainer,"The media element not exist");const s=J(this.mediaContainer);p(Je,s,"The block element not exist");const l=e.getBlockData(s),c=B("div",["media-error","embed-selected-content","embed-hover-content"],null),d=B("span",["media-error-icon"],c);d.innerHTML=i;const h=B("div",[],c);h.innerHTML=D.t("media.load.failed",{name:o}),c.appendChild(h);const C=h.querySelector(".retry-upload");return p(Je,C,"The element not exist"),e.domEvents.addEventListener(C,"click",(E,x)=>{const v=B("div",["media-element"],null),R=this.getResourceUrl(l),L=r(E,v,l,R);this.unbindMediaEvent(),this.media=L,this.bindMediaEvent(),this.updateMediaContent(v)}),this.setFullScreen(),c}renderRetry(e,r){var E,x;p(Je,this.abstract,"no abstract");const{editor:i}=this.options,{mediaIcon:o,mediaName:s}=this.abstract,l=B("div",["media-error","embed-selected-content","embed-hover-content"],null),c=B("span",["media-error-icon"],l);c.innerHTML=o;const d=B("div",[],l);let h=D.t("media.upload.failed",{name:s});(((E=r.response)==null?void 0:E.status)===420||((x=r.response)==null?void 0:x.status)===413)&&(h=D.t("media.upload.maxSizeFailed",{name:s})),d.innerHTML=h,l.appendChild(d);const C=d.querySelector(".retry-upload");C&&i.domEvents.addEventListener(C,"click",()=>{i.readonly||(p(Je,this.abstract,"no abstract"),this.handleUploadFile(e))}),this.updateMediaContent(l),this.setFullScreen()}renderProgress(e,r){p(Je,this.mediaContainer,"The media element not exist");const i=this.mediaContainer.querySelector(":scope .media-progress"),o=e===-1||e===100?100:e;if(i){const{updateProgressElement:s}=this.options;s(i,o)}else{const{createProgressElement:s}=this.options,l=J(this.mediaContainer);p(Je,l,"The element not exist"),z(l,"media-block-uploading");const c=B("div",["media-progress"],null);s(c,o,r),this.updateMediaContent(c)}this.setFullScreen()}renderMediaElement(e,r){p(Je,this.mediaContainer,"The media element not exist");const i=this.mediaContainer.querySelector(":scope > .media-element"),{createMediaElement:o,updateMediaElement:s,editor:l}=this.options,c=this.getResourceUrl(e,r);if(i){const d=s(l,i,e,c);this.unbindMediaEvent(),this.media=d,this.bindMediaEvent()}else{const d=B("div",["media-element"],null),h=o(l,d,e,c);this.unbindMediaEvent(),this.media=h,this.bindMediaEvent(),this.updateMediaContent(d)}}renderEmpty(e){p(Je,this.abstract,"no abstract"),p(Je,this.mediaContainer,"The media element not exist");const r=B("div",["media-empty","embed-selected-content","embed-hover-content"],this.mediaContainer);r.innerHTML=this.abstract.mediaIcon,this.updateMediaContent(r);const{editor:i}=this.options;i.findBlockById(e.id)&&this.emit("mediaError",i,"empty",e.id),this.setFullScreen()}getResourceUrl(e,r){const{src:i}=e.embedData,{editor:o}=this.options;return o.doc.buildResourceUrl(i,{syncNewResources:async(s,l)=>{var d,h;if(!r)return;await o.doc.addResources([s]);const c=(h=(d=o.doc).getServerMeta)==null?void 0:h.call(d).appId;if(l!==e.embedData.src&&c&&e.embedData.src.includes(c)){const C=J(r);if(C&&!o.readonly&&o.isBlockWritable(C)){const E=mt.default(e);E.embedData.src=s,o.updateBlockData(C,E)}}}})}setFullScreen(){p(Je,this.mediaContainer,"The media element not exist"),z(this.mediaContainer,"full-screen")}removeFullScreen(){p(Je,this.mediaContainer,"The media element not exist"),ot(this.mediaContainer,"full-screen")}updateBlockAlign(e,r){const i=J(r);p(Je,i,"The block element not exist");const{align:o}=e;e.embedType==="video"&&(i.hasAttribute("data-style-align")&&i.removeAttribute("data-style-align"),i.setAttribute("data-style-align",o))}render(e,r){const{src:i}=e.embedData;(!this.mediaContainer||!r.contains(this.mediaContainer))&&(this.mediaContainer=B("div",["media"],r)),this.updateBlockAlign(e,r),Dtt(i)?i===Lf.Empty&&this.renderEmpty(e):this.renderMediaElement(e,r)}setAbstract(e){this.abstract=e}}I("media-embed");const Mtt="left";class IS{constructor(){m(this,"handleInsertEmptyEmbed",async(t,e)=>{var C;const{containerId:r,blockIndex:i}=e;let o;(C=e.data)!=null&&C.file&&(o=e.data.file);const s=Ltt(t,this.embedType);if(o=o!=null?o:await ma(s,{}),!o)return null;const{mediaType:l}=this.getAbstract();try{Itt(o,t,l)}catch{return null}const c={id:tt(),type:"embed",embedType:this.embedType,embedData:{src:Lf.Empty}};l==="video"&&(c.align=Mtt);const d=t.insertBlock(r,i,c);return await this.getMedia(t,c.id).handleUploadFile(o),d})}getMedia(t,e){const r=t.addCustom(`media-${e}`,()=>new _tt({editor:t,createMediaElement:this.createMediaElement,updateMediaElement:this.updateMediaElement,createProgressElement:this.createProgressElement,updateProgressElement:this.updateProgressElement}));return r.setAbstract({...this.getAbstract()}),r}getOptions(){const{menuItem:t,mediaIcon:e,mediaName:r,order:i,group:o}=this.getAbstract();return{name:r,insertEmbedCommandItems:[{id:`insert-${this.embedType}`,name:t,icon:e,order:i,group:o,subText:Tn(`insert-${this.embedType}`)}],handleInsertEmptyEmbed:this.handleInsertEmptyEmbed}}createEmbedContent(t,e,r){const{id:i}=r;this.getMedia(t,i).render(r,e)}handleUpdateBlock(t,e,r){const{id:i}=r,o=this.getMedia(t,i),s=Ot(e);return o.render(r,s),!0}handleDeleteBlock(t,e){const r=e.id,i=this.getMedia(t,r);i.removeAllListeners(),i.destroy()}convertTo(t,e,r,i){const o=e.embedData,s=t.doc.buildResourceUrl(o.src,{withToken:!0});return i==="html"?`<${o.type} src="${s}" />`:i==="markdown"?``:s}}function DS(n,t){const e=B("div",["uploading-progress-mask"],n),r=B("div",["uploading-progress-bar"],e),i=B("div",["uploading-progress-bar-value"],r);i.style.width=`${t}%`}function _S(n,t){const e=n.querySelector(".uploading-progress-bar-value");e&&(e.style.width=`${t}%`)}const Utt=I("media-audio");class Ott extends IS{constructor(){super(...arguments);m(this,"embedType",Jr.AUDIO);m(this,"updateProgressElement",_S);m(this,"createMediaElement",(e,r,i,o)=>{const s=B("div",["audio-container","embed-hover-content","embed-selected-content"],r),l=B("audio",[],s);return l.innerHTML="Your browser does not support the <code>audio</code> element.",l.controls=!0,l.src=o,setTimeout(()=>{this.getMedia(e,i.id).setFullScreen()}),l})}getAbstract(){return{mediaIcon:VT,mediaName:D.t(`media.${Jr.AUDIO}.menuItem`),menuItem:D.t(`media.${Jr.AUDIO}.menuItem`),order:800,mediaType:Jr.AUDIO,group:"common"}}getBlockProperties(){return{abstract:`${D.t(`media.${Jr.AUDIO}.abstract`)}`}}updateMediaElement(e,r,i,o){const s=r.querySelector(":scope .audio-container > audio");return p(Utt,s,"The media element not exist"),s.src!==o&&(s.src=o),s}createProgressElement(e,r){const i=B("audio",[],e);i.innerHTML="Your browser does not support the <code>audio</code> element.",i.controls=!0,i.src="about:blank",DS(e,r)}}const Ntt=new Ott;I("video-resizer");function MS(n){return n&&ge(n)&&We(n)==="video"}const Ptt=50;class TA{constructor(t){m(this,"currentResizableElement",null);m(this,"resizing",!1);m(this,"handleHoveringBlockChange",(t,e)=>{if(!this.resizing&&!window.isDragging&&(e&&MS(e)&&this.disableBlockResize(e),t&&MS(t)&&this.editor.isBlockWritable(t))){const r=this.getVideoElement(t);if(!r)return;this.enableBlockResize(t,r)}});m(this,"handleResizing",(t,e)=>{if(this.resizing=!0,!this.currentResizableElement)return;const r=t.getBlock();if(!r)return;const i=r.getBoundingClientRect().width,o=Math.min(Math.max(e.width,Ptt),i);this.currentResizableElement.style.width=`${o}px`,this.currentResizableElement.style.pointerEvents="none"});m(this,"handleResized",t=>{this.resizing=!1;const e=t.getBlock();if(!this.currentResizableElement||!e)return;const r=this.editor.getBlockData(e),{width:i}=this.currentResizableElement.getBoundingClientRect();this.currentResizableElement.style.pointerEvents="auto",this.editor.updateBlockData(e,{...r,width:i})});this.editor=t,Te.get(t).addListener("change",this.handleHoveringBlockChange)}destroy(){this.currentResizableElement=null,Te.get(this.editor).removeListener("change",this.handleHoveringBlockChange)}getVideoElement(t){return Ot(t).querySelector(":scope .video-container > video")}updateResizer(t){const e=this.editor.findCustom(`${lt(t)}-resizer`);e&&e.updateResizer()}disableBlockResize(t){const e=this.editor.findCustom(`${lt(t)}-resizer`);e&&e.disableResize()}enableBlockResize(t,e){const r=this.editor.addCustom(`${lt(t)}-resizer`,()=>new cf(this.editor,{resize:["top-left","top-right","bottom-left","bottom-right"]}));r.enableResize(t,e),r.removeListener("resizing",this.handleResizing),r.removeListener("resized",this.handleResized),r.addListener("resizing",this.handleResizing),r.addListener("resized",this.handleResized),this.currentResizableElement=e}}const Ftt=I("video");class Ktt extends IS{constructor(){super(...arguments);m(this,"embedType",Jr.VIDEO);m(this,"updateProgressElement",_S);m(this,"createMediaElement",(e,r,i,o)=>{const s=B("div",["video-container","embed-selected-content","drag-preview-element"],r),l=B("video",[],s);return l.innerHTML="Your browser does not support the <code>video</code> element.",l.controls=!0,l.src=o,l.addEventListener("canplay",()=>{e.addCustom("video-resizer",()=>new TA(e)),this.getMedia(e,i.id).removeListener("mediaError",this.handleMediaError),this.getMedia(e,i.id).addListener("mediaError",this.handleMediaError),this.getMedia(e,i.id).removeFullScreen()}),i.width&&(l.style.width=`${i.width}px`),l});m(this,"createProgressElement",(e,r,i)=>{const o=B("video",["progress-video"],e);o.innerHTML="Your browser does not support the <code>audio</code> element.",o.controls=!0,DS(e,r),da(i).then(s=>{const l=e.querySelector(".progress-video");l&&e1(e)&&(l.src=s)})})}getAbstract(){return{mediaName:D.t(`media.${Jr.VIDEO}.menuItem`),mediaIcon:$T,menuItem:D.t(`media.${Jr.VIDEO}.menuItem`),order:700,mediaType:Jr.VIDEO,group:"common"}}getBlockProperties(){return{abstract:`${D.t(`media.${Jr.VIDEO}.abstract`)}`}}handleMediaError(e,r,i){const o=e.addCustom("video-resizer",()=>new TA(e)),s=e.getBlockById(i);o.disableBlockResize(s)}updateMediaElement(e,r,i,o){const s=r.querySelector(":scope .video-container > video");p(Ftt,s,"The media element not exist"),s.src!==o&&(s.src=o),i.width?s.style.width=`${i.width}px`:s.style.width="";const l=e.getBlockById(i.id);return setTimeout(()=>{e.addCustom("video-resizer",()=>new TA(e)).updateResizer(l)}),s}}const Vtt=new Ktt,US=[fE,AE,xE,Ik],yA=[TS,$J,YZ,ott,htt,t$,Btt,Vtt,Ntt,tW,eS,UY],OS=[Hk,iS,w4,qk];function $tt(n,t,e){var i,o,s,l;ai.level=(i=e.logLevel)!=null?i:Ms.DEBUG;const r=ku(n,t,{components:{blocks:[...US,...((o=e==null?void 0:e.components)==null?void 0:o.blocks)||[]],embeds:[...yA,...((s=e.components)==null?void 0:s.embeds)||[]],boxes:[...OS,...((l=e.components)==null?void 0:l.boxes)||[]],textRenders:[new GC],options:{...e.componentsOptions}}});return r.readonly=!0,r.addCustom("heading-collapse",()=>new uA(r)),r.addCustom("editor-tooltip",()=>new tf(r)),r.addListener("clickLink",(c,d,h)=>{var E;if((E=e==null?void 0:e.events)!=null&&E.onClickLink){e.events.onClickLink(c,d,h);return}const C=h.getAttribute("link");C&&(c.readonly||d.ctrlKey||d.metaKey)&&window.open(C,"_blank")}),r}class NS{constructor(t){this.createOptions=t,t.lang&&D.setLang(t.lang)}createHistoryEditor(t,e){return $tt(t,e,this.createOptions)}}I("create-editor");function PS(n,{root:t,childDoc:e,doc:r}){var h,C;e.uploadResource=r.uploadResource.bind(r),e.buildResourceUrl=r.buildResourceUrl.bind(r);const i=n.getComponentOptions("comment"),o={image:{defaultAlign:"left"},table:{locatingContainer:t,hideCellMenu:!0,hideToolbar:!0},...i==null?void 0:i.componentsOptions},s=[];n.editorBlocks.forEach(E=>{E.blockType==="text"||E.blockType==="embed"||s.push(E)});const l=[];n.editorEmbeds.forEach(E=>{l.push(E)});const c=[];n.editorBoxes.forEach(E=>{E.boxType==="text"||E.boxType==="br"||E.boxType==="image"||E.boxType==="anchor"||c.push(E)});const d=ku(t,e,{shortcuts:[Uh],components:{blocks:s,commandProviders:[new m0],decorators:[new V0],embeds:l,boxes:c,options:o}});if(d.input.addHandler(new H0),d.input.addHandler(new FE(d)),d.input.addHandler(new zE(d)),d.input.addHandler(new zX(d)),d.input.addHandler(new W0),d.addCustom("image-paste-handler",()=>new PE(d)),ue.isMobile||d.addCustom("editor-tooltip",()=>new tf(d)),(h=n.options.componentsOptions)!=null&&h.mention){const E=n.options.componentsOptions.mention;d.addCustom("mention",()=>new rS(d,{...E}))}if((C=n.options.componentsOptions)!=null&&C.comment){const E=n.options.componentsOptions.comment;E.onCommentEditorClick&&d.addListener("click",E.onCommentEditorClick)}return d}function Htt(n,t){const e=Array.from(n.rootContainer.querySelectorAll(`[comment-${t.toLocaleLowerCase()}="${t}"]`)),r=new Set;e.forEach(i=>{const o=J(i);o&&r.add(o)}),r.forEach(i=>{GX(n,i,t)})}class jtt{constructor(t){m(this,"listeners",new Set);m(this,"doc");this.editor=t,this.doc=this.editor.doc.externalDoc,this.doc.registerCallback(this)}getComments(){return this.doc.getComments()}getComment(t){return this.doc.getComment(t)}getCommentDoc(t){return this.doc.getCommentDoc(t)}localCreateComment(t,e){this.doc.localCreateComment(t,e)}localDeleteComment(t){const e=this.getComment(t);this.doc.localDeleteComment(t);const r=e.groupId;this.getComments().filter(o=>o.groupId===r).length===0&&Htt(this.editor,r)}localUpdateComment(t,e){this.doc.localUpdateComment(t,e)}onCreateComment(t,e){Array.from(this.listeners.values()).forEach(r=>r.onCreateComment(t,e))}onDeleteComment(t,e){Array.from(this.listeners.values()).forEach(r=>r.onDeleteComment(t,e))}onUpdateComment(t,e){Array.from(this.listeners.values()).forEach(r=>r.onUpdateComment(t,e))}addListener(t){this.listeners.add(t)}removeListener(t){this.listeners.delete(t)}createCommentEditor(t,e){return PS(this.editor,{root:t,childDoc:e,doc:this.doc})}allowEdit(t){return t.userId===this.doc.getUser().userId}}class ztt{constructor(t,e){m(this,"listeners",new Set);this.editor=t,this.localDoc=e}get doc(){return this.localDoc.toJSON()}getComments(){return Object.values(this.doc.comments)}getComment(t){return this.doc.comments[t]}getCommentDoc(t){const e=this.doc.comments[t];return jp(e)}addListener(t){this.listeners.add(t)}removeListener(t){this.listeners.delete(t)}localCreateComment(t,e){}localDeleteComment(t){}localUpdateComment(t,e){}createCommentEditor(t,e){return PS(this.editor,{root:t,childDoc:e,doc:this.localDoc})}allowEdit(t){return t.userId===this.localDoc.getUser().userId}}const Gtt={placeholder:{common:{title:"\u8BF7\u8F93\u5165\u6807\u9898",readonlyTitle:"\u8BF7\u8F93\u5165\u6807\u9898",content:"\u70B9\u51FB + \uFF0C\u6216\u8F93\u5165 / \u5FEB\u6377\u63D2\u5165\u7EC4\u4EF6",contentInTable:"\u8F93\u5165 / \u5FEB\u6377\u63D2\u5165\u7EC4\u4EF6"},local:{readonlyTitle:"\u672A\u547D\u540D"}},copyCutProperty:{copy:"\u590D\u5236",cut:"\u526A\u5207",unsafeEnvTips:"\u7531\u4E8E\u5F53\u524D http \u8BBF\u95EE\u73AF\u5883\u4E0B\u7684\u9650\u5236\uFF0C\u8BF7\u4F7F\u7528\u5FEB\u6377\u952E({shortCut}) {operation}"}},Wtt={placeholder:{common:{title:"Enter a title",readonlyTitle:"Enter a title",content:'Click "+", or enter "/" to insert components quickly',contentInTable:'Enter "/" to insert components quickly'},local:{readonlyTitle:"Untitled"}},copyCutProperty:{copy:"Copy",cut:"Cut",unsafeEnvTips:"Due to the limitations of the current http access environment, please use the shortcut ({shortCut}) {operation}"}},qtt={placeholder:{common:{title:"\u30BF\u30A4\u30C8\u30EB\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044",readonlyTitle:"\u30BF\u30A4\u30C8\u30EB\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044",content:"\u300C+\u300D\u3092\u30AF\u30EA\u30C3\u30AF\u3059\u308B\u304B\u3001\u300C/\u300D\u3092\u5165\u529B\u3059\u308B\u3068\u3001\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u304C\u7D20\u65E9\u304F\u633F\u5165\u3067\u304D\u307E\u3059",contentInTable:"\u300C/\u300D\u3092\u5165\u529B\u3059\u308B\u3068\u3001\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u304C\u7D20\u65E9\u304F\u633F\u5165\u3067\u304D\u307E\u3059"},local:{readonlyTitle:"\u7121\u984C"}},copyCutProperty:{copy:"\u8907\u88FD",cut:"\u5207\u308B",unsafeEnvTips:"HTTP\u74B0\u5883\u306E\u5236\u7D04\u306B\u3088\u308A\u3001{operation}\u3059\u308B\u306B\u306F\u3001\u30B7\u30E7\u30FC\u30C8\u30AB\u30C3\u30C8({shortCut}) \u3092\u3054\u4F7F\u7528\u304F\u3060\u3055\u3044"}};D.mergeLang({"zh-CN":Gtt,"en-US":Wtt,"ja-JP":qt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AAAAAAAAAAAAAAAABVOQAAY3VzdG9tWG1sL19yZWxzL2l0ZW0xLnhtbC5yZWxzUEsBAi0AFAAGAAgAAAAhAOuAYExTAwAAjw4AABIAAAAAAAAAAAAAAAAAWzsAAHdvcmQvZm9udFRhYmxlLnhtbFBLBQYAAAAADwAPANQDAADePgAAAAA=",Ytt=()=>Kg(Xtt);async function Qtt(n){return new Promise((t,e)=>{const r=new Image;r.onload=()=>{t({width:r.naturalWidth,height:r.naturalHeight})},r.onerror=e,r.src=n})}async function FS(n,t){if(n.width&&n.height)return{width:n.width,height:n.height,buffer:t};const e=await da(new File([t],"",{})),r=await Qtt(e);return r.width===void 0||r.height===void 0?{width:345,height:230,buffer:t}:n.width||n.height?{width:n.width||r.width*n.height/r.height,height:n.height||r.height*n.width/r.width,buffer:t}:{width:r.width,height:r.height,buffer:t}}function Jtt(n,t){let e=n.filter(s=>s!=null);const r=t-(e.length-1)*20,i=.87,o=e.reduce((s,l)=>s+l.width,0);return o>r&&(e=e.map(s=>({width:s.width*r/o,height:s.height*r/o,buffer:s.buffer}))),e.map(s=>({width:s.width*i,height:s.height*i,buffer:s.buffer}))}function Ztt(n,t,e){if(!e||typeof e!="object")return;const r=e,i=n.filter(s=>s!=null),o=t-(i.length-1)*20;i.forEach((s,l)=>{if(i.length===1&&r.widthPercent){const d=r.widthPercent,h=s.width;s.width=o*(d/100),s.height*=s.width/h;return}const c=`${l}_flex`;if(r[c]){const d=r[c],h=s.width;s.width=o*d,s.height*=s.width/h}})}function KS(n=[0,1,2,3,4,5,6,7],t=1){return n.map(e=>{let r;switch(e%3){case 0:r=pt.LevelFormat.DECIMAL;break;case 1:r=pt.LevelFormat.LOWER_LETTER;break;default:r=pt.LevelFormat.LOWER_ROMAN;break}return{level:e,format:r,text:`%${e+1}. `,alignment:pt.AlignmentType.START,start:t,style:{paragraph:{indent:{left:pt.convertInchesToTwip(.3*(e+1)),hanging:pt.convertInchesToTwip(.2)}}}}})}function tet(){return[0,1,2,3,4,5,6,7].map(n=>{let t;switch(n%3){case 0:t="\u2022";break;case 1:t="\u25E6";break;default:t="\u25AA";break}return{level:n,format:pt.LevelFormat.BULLET,text:t,alignment:pt.AlignmentType.START,style:{paragraph:{indent:{left:pt.convertInchesToTwip(.3*(n+1)),hanging:pt.convertInchesToTwip(.2)}}}}})}function eet(){return[0,1,2,3,4,5,6,7].map(n=>({level:n,format:pt.LevelFormat.BULLET,text:"\u2611",alignment:pt.AlignmentType.START,style:{paragraph:{indent:{left:pt.convertInchesToTwip(.3*(n+1)),hanging:pt.convertInchesToTwip(.2)}}}}))}function net(){return[0,1,2,3,4,5,6,7].map(n=>({level:n,format:pt.LevelFormat.BULLET,text:"\u2610",alignment:pt.AlignmentType.START,style:{paragraph:{indent:{left:pt.convertInchesToTwip(.3*(n+1)),hanging:pt.convertInchesToTwip(.2)}}}}))}var If=(n=>(n.NUMBERING="number-numbering-reference",n.BULLET="number-bullet-reference",n.CHECKED="checked-bullet-reference",n.UNCHECKED="unchecked-bullet-reference",n))(If||{});const ret=[{levels:KS(),reference:"number-numbering-reference"},{levels:tet(),reference:"number-bullet-reference"},{levels:eet(),reference:"checked-bullet-reference"},{levels:net(),reference:"unchecked-bullet-reference"}];function iet(n){switch(n){case"style-color-0":return"d83931";case"style-color-1":return"de7802";case"style-color-2":return"dc9b04";case"style-color-3":return"2ea121";case"style-color-4":return"245bdb";case"style-color-5":return"6425d0";case"style-color-6":return"8f959e";default:return}}function oet(n){switch(n){case"style-bg-color-1":case"style-bg-color-2":case"style-bg-color-8":case"style-bg-color-9":return"yellow";case"style-bg-color-0":case"style-bg-color-5":return"magenta";case"style-bg-color-3":return"green";case"style-bg-color-4":case"style-bg-color-11":return"blue";case"style-bg-color-6":return"lightGray";case"style-bg-color-7":return"red";case"style-bg-color-10":return"darkGreen";case"style-bg-color-12":return"darkMagenta";case"style-bg-color-13":return"darkGray";default:return}}function set(n){switch(n){case"style-bg-color-0":return"fbbab6";case"style-bg-color-1":return"ffdcb0";case"style-bg-color-2":return"fff7a0";case"style-bg-color-3":return"ceefc5";case"style-bg-color-4":return"d1ddfb";case"style-bg-color-5":return"d9cbf8";case"style-bg-color-6":return"eaeaea";case"style-bg-color-7":return"fe837c";case"style-bg-color-8":return"ffbd6a";case"style-bg-color-9":return"ffe662";case"style-bg-color-10":return"a8f393";case"style-bg-color-11":return"98b5ff";case"style-bg-color-12":return"b394f8";case"style-bg-color-13":return"b1b1b1";default:return}}const aet=/rgb\((\d+),\s*(\d+),\s*(\d+)\)/;function VS(n){if(typeof n=="string"&&n.length>0){if(n[0]==="#")return n.substring(1);const t=n.match(aet);if(t){const e=s=>{let l=Number(s).toString(16);return l.length<2&&(l=`0${l}`),l},r=e(t[1]),i=e(t[2]),o=e(t[3]);return`${r}${i}${o}`}if(n==="red")return"FF0000";if(n==="green")return"00FF00";if(n==="blue")return"0000FF"}}function ln(n,t){if(n&&n.attributes&&n.attributes[t])return n.attributes[t];if(n&&n.attributes&&n.attributes.box&&n.attributes.inputType&&t==="style-underline")return!0}function $S(n,t,e){for(let r=0;r<=e;++r){const i=`${t}${r}`;if(ln(n,i))return i}}function pm(n,t,e){n.attributes=n.attributes||{},n.attributes[t]=e}function kA(n){return n==="image"||n==="drawio"||n==="plantuml"||n==="mermaid"||n==="flowchart"}function HS(n){return n&&n.startsWith("//")?`https:${n}`:n&&!n.startsWith("http://")&&!n.startsWith("https://")?`https://${n}`:n}function cet(n){const t=ln(n,"inlineStyle");if(t==null)return;const e=t.split(";");for(const r of e){const i=r.split(":");if(i.length!==2)continue;const o=i[0].trim().toLowerCase(),s=i[1].trim().toLowerCase();o==="font-size"&&pm(n,"inline-style-font-size",s),o==="color"&&pm(n,"inline-style-color",s),o==="background-color"&&pm(n,"inline-style-background-color",s),o==="font-family"&&pm(n,"inline-style-font-family",s)}}function uet(n,t){if(t==null)return n==null?void 0:n.normal;if(n)return n[`heading${t}`]}function fet(n){const t=`${ln(n,"inline-style-font-size")}`;if(t&&t.indexOf("px")>0)return+t.replace(/px/g,"")}function det(n){if(n.attributes&&n.attributes.box&&n.attributes.text)return` ${n.attributes.text} `;if(n.attributes&&n.attributes.box&&n.attributes.inputType)return n.attributes.value?`${n.attributes.value}`:" "}function het(n){if(n.attributes&&n.attributes.box&&n.attributes.text)return` @${n.attributes.text} `}function met(n){return ln(n,"inline-style-font-family")}function get(n){const t=ln(n,"inline-style-background-color");return VS(t)}function pet(n){const t=ln(n,"inline-style-color");return VS(t)}function Cet(n){cet(n);const t=ln(n,"type")==="mention";return{box:n.attributes&&n.attributes.box?n.attributes:void 0,inlineCode:!!ln(n,"style-code"),link:HS(ln(n,"link")),size:fet(n),text:t?het(n):det(n)||n.insert,bold:!!ln(n,"style-bold"),underline:!!ln(n,"style-underline"),italics:!!ln(n,"style-italic"),strike:!!ln(n,"style-strikethrough"),superScript:!!ln(n,"style-super"),subScript:!!ln(n,"style-sub"),math:ln(n,"type")==="math"?ln(n,"src"):void 0,mention:t,fontFamily:met(n),background:get(n),color:t?"338fe5":iet($S(n,"style-color-",6))||pet(n),highlight:$S(n,"style-bg-color-",13)}}function Eet(){return[new pt.Paragraph({border:{top:{color:"auto",style:pt.BorderStyle.DASHED,size:4,space:1}},spacing:{before:300}}),new pt.Paragraph({spacing:{line:0}})]}function Aet(){return new pt.Paragraph({children:[new pt.TextRun({text:"[\u89C6\u9891\u6682\u4E0D\u652F\u6301\u5BFC\u51FA]",shading:{type:pt.ShadingType.CLEAR,color:"FFFFFF",fill:"CCCCCC"}})]})}function xet(){return new pt.Paragraph({children:[new pt.TextRun({text:"[\u97F3\u9891\u6682\u4E0D\u652F\u6301\u5BFC\u51FA]",shading:{type:pt.ShadingType.CLEAR,color:"FFFFFF",fill:"CCCCCC"}})]})}function bet(n,t){return new pt.Paragraph({children:[new pt.ExternalHyperlink({children:[new pt.TextRun({style:"Hyperlink",text:t||n})],link:n})]})}function jS(n){if(n.heading!=null)return`Heading${n.heading}`}function zS(n){if(n.alignment!=null){if(n.alignment==="center")return pt.AlignmentType.CENTER;if(n.alignment==="right")return pt.AlignmentType.RIGHT;if(n.alignment==="left")return pt.AlignmentType.LEFT}}function vet(n){if(n.indent)return{left:pt.convertInchesToTwip(.3*n.indent-.2)};if(n.padding)return{left:pt.convertInchesToTwip(.3*n.padding)}}function Bet(n){return{type:pt.ShadingType.CLEAR,color:"FFFFFF",fill:n}}function Tet(n){const t=n.split(",");if(t.length!==0)return t[0].trim()}function GS(n,t){let e;e=n.inlineCode?"InlineCode":void 0,e=n.link?"Hyperlink":e;const r=n.size||t,i=r!=null?Math.floor(r*1.5+.5):void 0;return new pt.TextRun({text:n.text,bold:n.bold||void 0,underline:n.underline?{type:pt.UnderlineType.SINGLE}:void 0,italics:n.italics||void 0,strike:n.strike||void 0,superScript:n.superScript||void 0,subScript:n.subScript||void 0,size:i,style:e,font:n.fontFamily?Tet(n.fontFamily):void 0,shading:n.background?Bet(n.background):void 0,color:n.color,highlight:oet(n.highlight)})}function yet(n,t){if(n.link)return new pt.ExternalHyperlink({children:[GS(n,t)],link:n.link})}async function WS(n,t,e,r,i){const o=await i(n,t,e);if(o==null)return;const s=await FS({width:r||0,height:0,src:e},o);return new pt.ImageRun({data:o,transformation:{width:s.width||100,height:s.height||20}})}function ket(n){if(n.heading||n.heading)return n.heading}function Ret(n){if(n.align&&(n.align==="center"||n.align==="right"||n.align==="left"))return n.align}function wet(n){if(n.textOnly===!0&&n.level!=null)return n.level}async function Let(n,t){var r;const e=[];if(n.text&&Array.isArray(n.text)){for(let i=0;i<n.text.length;i++){const o=n.text[i];if(((r=o.attributes)==null?void 0:r.box)===!0&&t){const s=await t(o);if(s){n.text.splice(i+1,0,...s);continue}}e.push(Cet(o))}return e}}function Iet(n){if(n.type==="list"&&n.textOnly!==!0)return{checkbox:n.checkbox,groupId:n.groupId,ordered:!!n.ordered,level:n.level||1,start:n.start||0}}function Det(n,t){if(n.type==="embed"&&n.embedType&&kA(n.embedType)&&n.embedData&&n.embedData.src)return n.embedData.src.split("|").map(r=>{const i=t(r),o=n.embedData[`${i}_width`],s=n.embedData[`${i}_height`];return{src:r,width:o,height:s}})}function _et(n){if(n.padding)return n.padding}function Met(n){return!!(n.type==="embed"&&n.embedType&&kA(n.embedType)&&n.embedData&&n.embedData.src)}async function Cm(n,t,e){return{quoted:!!n.quoted,heading:ket(n),alignment:Ret(n),indent:wet(n),padding:_et(n),texts:await Let(n,e),list:Iet(n),images:Det(n,t),border:Met(n)}}async function Uet(n,t,e,r){const i=[];if(!n.children)return[];for(const o of n.children){const s=[];for(const l of t.blocks[o])s.push(await Cm(l,e,r));i.push(s)}return i}const Oet=I("to-docx");function Net(n,t){return Array(n).fill(0).map(()=>Array(t).fill(0).map(()=>({cellId:void 0,color:void 0,from:void 0,rowSpan:1,colSpan:1,width:0,originalWidth:void 0,align:void 0})))}function Pet(n,t,e,r){const i=!!n.hasColTitle,o=!!n.hasRowTitle,s=!!n.isStripeStyle,l="F5F8FB";for(let c=0;c<t;c++)for(let d=0;d<e;d++)(i&&d===0||o&&c===0||s&&c%2===1)&&(r[c][d].color=l)}function Fet(n){p(Oet,n.children,"no table children");const t=n.rows,e=n.cols,r=n.colsWidth;if(r)for(let s=0;s<r.length;s++)r[s]===0&&(r[s]=100);const i=Net(t,e);let o=0;for(let s=0;s<t;++s)for(let l=0;l<e;++l){if(i[s][l].originalWidth=r?r[l]:void 0,i[s][l].from!==void 0)continue;const c=n.children[o];o+=1,i[s][l].cellId=c,i[s][l].color=set(n[`${c}_background`]),i[s][l].width=r?r[l]:100,i[s][l].align=n[`${c}_align`];const d=n[`${c}_rowSpan`]||1,h=n[`${c}_colSpan`]||1;if(i[s][l].rowSpan=d,i[s][l].colSpan=h,d>1||h>1){let C=0;for(let E=0;E<d;E++)for(let x=0;x<h;x++)E===0&&(C+=r?r[l+x]:80),!(E===0&&x===0)&&(i[s+E][l+x].from=[s,l]);i[s][l].width=C}}return Pet(n,t,e,i),i}async function Ket(n,t,e,r,i,o,s,l,c,d){async function h(x){if(l){const v=await l(i,o,x);if(v){await r.addDoc(n,v,d);return}}if(x.type==="text"||x.textOnly===!0){const v=await Cm(x,s,c);await r.addTextBlock(v);return}if(x.type==="code"){const v=await Uet(x,e,s,c);await r.addCodeBlockObject(v);return}if(x.type==="list"&&x.textOnly!==!0){const v=await Cm(x,s,c);await r.addListBlockObject(n,v);return}if(x.type==="embed"&&x.embedType){const v=x,R=v.embedData,L=v.embedType;if(kA(L)){const M=await Cm(x,s,c);await r.addImagesBlockObject(x,M,d)}else x.embedType==="hr"?r.addSeparatorBlock():x.embedType==="video"?r.addVideoPlaceholder():x.embedType==="audio"?r.addAudioPlaceholder():x.embedType==="webpage"?r.addHyperlinkParagraph(HS(R.src),R.title):r.addOtherEmbedBlock(L,x.embedData);return}if(x.type==="table"){let v=[];if(x.colsWidth)v=x.colsWidth;else{const L=x.cols;v=new Array(L);for(let M=0;M<v.length;M++)v[M]=100;x.colsWidth=v}const R=Fet(x);await r.addTableMatrix(v,R,e),r.addEmptyParagraph()}}function C(x){const v=[];for(const{type:R,data:L}of x.embedData.exportSpec){if(R==="text"){const M={id:tt(),text:[{insert:L}],type:"text"};v.push(M);continue}if(R==="image"){const M={id:tt(),type:"embed",embedType:"image",align:"left",embedData:{src:L}};v.push(M);continue}if(R==="link"){const M={id:tt(),type:"embed",embedType:"webpage",embedData:{src:L.url,title:L.title}};v.push(M);continue}}return v}function E(x){var v;return(v=x==null?void 0:x.embedData)!=null&&v.exportSpec?C(x):[x]}for(const x of t)for(const v of E(x))await h(v)}function Vet(){return{listMaxInst:1,listInstMap:{},listRefMap:{},levelConfigs:[]}}const $et=I("to-docx");class Het{constructor(t,e,r,i,o,s){m(this,"paragraphs");this.appId=t,this.docId=e,this.state=r,this.readImageFunc=i,this.convertBlocksFunc=o,this.defaultFontSize=s,this.paragraphs=[]}async addTextBlock(t){this.paragraphs.push(new pt.Paragraph({heading:jS(t),alignment:zS(t),children:await this.paragraphsFromBlockTexts(t),indent:vet(t)}))}async addEmptyImagePlaceHolder(){this.paragraphs.push(new pt.Paragraph({text:`[${D.t("docx.imageExportFailed")}]`,shading:{type:pt.ShadingType.CLEAR,color:"FFFFFF",fill:"CCCCCC"}}))}async paragraphsFromBlockTexts(t){if(t.texts==null)return;const e=uet(this.defaultFontSize,t.heading),r=[];for(const i of t.texts){if(i.link){const o=yet(i,e);o&&r.push(o);continue}if(i.box&&i.box.type&&i.box.type==="br"){r.push(new pt.TextRun({text:"",break:1}));continue}if(i.box&&i.box.type&&i.box.type==="image"){const o=await WS(this.appId,this.docId,i.box.src,i.box.width,this.readImageFunc);o&&r.push(o);continue}if(i.math){const o=await WS(this.appId,this.docId,i.math,0,this.readImageFunc);o&&r.push(o);continue}r.push(GS(i,e))}return r}async addCodeBlockObject(t){for(const e of t)for(const r of e){const i={style:pt.BorderStyle.SINGLE,color:"#DEDEDE"};this.paragraphs.push(new pt.Paragraph({style:"Code",border:{left:{...i},right:{...i},top:{...i},bottom:{...i}},children:await this.paragraphsFromBlockTexts(r)}))}}async addListBlockObject(t,e){if(e.list==null)return;let r;const i=e.list.checkbox?`${t}-${e.list.groupId}-${e.list.checkbox}`:`${t}-${e.list.groupId}`;if(this.state.listInstMap[i])r=this.state.listInstMap[i];else if(r=this.state.listMaxInst,this.state.listMaxInst+=1,this.state.listInstMap[i]=r,e.list.start>0&&e.list.ordered){const s=`number-numbering-reference-${r}`,l=KS([e.list.level-1],e.list.start);this.state.levelConfigs.push({levels:l,reference:s,inst:r}),this.state.listRefMap[i]=s}else e.list.ordered?this.state.listRefMap[i]=If.NUMBERING:e.list.checkbox&&e.list.checkbox==="checked"?this.state.listRefMap[i]=If.CHECKED:e.list.checkbox&&e.list.checkbox==="unchecked"?this.state.listRefMap[i]=If.UNCHECKED:this.state.listRefMap[i]=If.BULLET;const o=jS(e);e.texts&&this.paragraphs.push(new pt.Paragraph({heading:o,children:await this.paragraphsFromBlockTexts(e),numbering:{reference:this.state.listRefMap[i],level:e.list.level-1,instance:r}}))}imageDimWithBufferToImageRun(t){return new pt.ImageRun({data:t.buffer,transformation:{width:t.width,height:t.height}})}async addImagesBlockObject(t,e,r){if(e.images==null){if(t.type==="embed"&&t.embedType==="image"){const{src:c}=t.embedData;c||this.addEmptyImagePlaceHolder()}return}const i=[],o=await Promise.all(e.images.map(async c=>{const d=await this.readImageFunc(this.appId,this.docId,c.src);if(d)return FS(c,d);i.push(c.src)}));Ztt(o,r,t.embedData);const s=Jtt(o,r),l={style:pt.BorderStyle.SINGLE,color:"#DEDEDE"};s.length&&this.paragraphs.push(new pt.Paragraph({border:e.border?{left:{...l},right:{...l},top:{...l},bottom:{...l}}:void 0,alignment:zS(e)||pt.AlignmentType.CENTER,children:s.map(c=>this.imageDimWithBufferToImageRun(c)).flatMap((c,d,h)=>c==null?[]:h.length-1!==d?[c,new pt.TextRun({text:" "})]:c)})),i.forEach(c=>{this.addHyperlinkParagraph(c)})}addSeparatorBlock(){Eet().forEach(t=>this.paragraphs.push(t))}addEmptyParagraph(){this.paragraphs.push(new pt.Paragraph(""))}addVideoPlaceholder(){this.paragraphs.push(Aet())}addAudioPlaceholder(){this.paragraphs.push(xet())}addHyperlinkParagraph(t,e){t!=null&&this.paragraphs.push(bet(t,e))}async addTableMatrix(t,e,r){const i=t.map(o=>o!==0?o*15:1500);this.paragraphs.push(new pt.Table({rows:await this.generateTableRows(e,r),columnWidths:i}))}async generateRowCells(t,e){const r=[];for(const i of t){const o=i.cellId;if(o===void 0)continue;const s=i.width*.9;r.push(new pt.TableCell({children:await this.convertBlocksFunc(o,e.blocks[o],e,this.appId,this.docId,this.state,s),columnSpan:i.colSpan,rowSpan:i.rowSpan,width:{type:pt.WidthType.DXA,size:i.width*15},shading:i.color?{fill:i.color,type:pt.ShadingType.CLEAR,color:"auto"}:void 0}))}return r}async generateTableRows(t,e){const r=[];for(const i of t)r.push(new pt.TableRow({children:await this.generateRowCells(i,e)}));return r}async addDoc(t,e,r){const i=await this.convertBlocksFunc(t,e.blocks.root,e,this.appId,this.docId,this.state,r);i&&(this.paragraphs=this.paragraphs.concat(i))}async addOtherEmbedBlock(){}}class jet{constructor(t,e,r,i,o,s,l,c){m(this,"convertBlocks",async(t,e,r,i,o,s,l=720)=>{const c=new Het(i,o,s,this.readImage,this.convertBlocks,this.defaultFontSize);return await Ket(t,e,r,c,i,o,this.md5HexFunc,this.getDocByBlock,this.getTextsByBox,l||720),c.paragraphs});this.templateData=t,this.docData=e,this.md5HexFunc=r,this.readImage=i,this.defaultFontSize=o,this.getDocByBlock=s,this.getTextsByBox=l,this.backgroundImageOptions=c}async convert(t,e){return this.snapshot2docx(this.docData,t,e)}async snapshot2docx(t,e,r){const i=new pt.ImportDotx,o=this.templateData?await i.extract(this.templateData):void 0,s=t.blocks.root;p($et,s,"data must have blocks");const l=Vet(),c=await this.convertBlocks("blocks",s,t,e,r,l),d=this.backgroundImageOptions?{default:new pt.Header({children:[new pt.Paragraph({children:[new pt.ImageRun(this.backgroundImageOptions)]})]})}:{},h=new pt.Document({numbering:{config:[...ret,...l.levelConfigs]},sections:[{headers:d,children:c,properties:{page:{size:{width:12240,height:15840},margin:{top:1440,bottom:1440,left:1440,right:1440}}}}]},{template:o});return pt.Packer.toBlob(h)}}async function zet(n,t,e,r){const i=n.doc.buildResourceUrl(r,{withToken:!0});let o=await fS(i);if(!o)return;if(o.type.indexOf("/svg")!==-1){const l=await aS(o);l&&(o=new File([l],o.name))}return await o.arrayBuffer()}async function Get(n,t,e){const r=n.editorBlocks.getBlockClass(e.type);if(r.toStandardDoc)return r.toStandardDoc(n,e,t)}async function Wet(n,t){const e=t.attributes,r=n.editorBoxes.getBoxClass(e.type);if(r.toStandardText)return r.toStandardText(n,e)}async function qet(n,t){let{template:e,download:r,backgroundImageOptions:i}=t!=null?t:{};e||(e=Ytt());const o=n.doc.toJSON(),s=(C,E,x)=>zet(n,C,E,x),l=async(C,E,x)=>Get(n,o,x),c=async C=>Wet(n,C),h=await new jet(e,o,wd.default,s,void 0,l,c,i).convert("_appId","_docId");if(r){const C=URL.createObjectURL(h),E=document.createElement("a");E.setAttribute("download",`${uS(n)}.docx`),E.setAttribute("href",`${C}`),E.click(),E.remove()}return h}const RA=I("create-editor");async function Xet(n,t){var s,l,c,d,h,C,E,x,v,R,L,M,U,F;p(RA,n,"app does not exists"),t.lang&&D.setLang(t.lang),ai.level=(s=t.logLevel)!=null?s:Ms.DEBUG;const e=t.onReauth?async()=>{var st;const G=t.user.userId,W=t.docId,rt=await((st=t.onReauth)==null?void 0:st.call(t,G,W,t.permission));return{userId:G,docId:W,permission:t.permission,appId:t.appId,token:rt,displayName:t.user.displayName,avatarUrl:t.user.avatarUrl}}:void 0,r={auth:{appId:t.appId,docId:t.docId,userId:t.user.userId,permission:t.permission,token:t.token,displayName:t.user.displayName,avatarUrl:t.user.avatarUrl},serverUrl:t.serverUrl,reauthFunc:e,disableLogout:t.disableLogout},i=await Pu.load(r),o=ku(n,i,{id:t.id,scrollContainer:t==null?void 0:t.scrollContainer,enableComments:t==null?void 0:t.enableComments,components:{blocks:[...US,...((l=t==null?void 0:t.components)==null?void 0:l.blocks)||[]],embeds:[...yA,...((c=t.components)==null?void 0:c.embeds)||[]],boxes:[...OS,...((d=t.components)==null?void 0:d.boxes)||[]],commandProviders:[new m0,...((h=t.components)==null?void 0:h.commandProviders)||[]],decorators:[new V0,new Gp],insertions:[q1],blockHooks:[new _E,new rw,...((C=t.components)==null?void 0:C.blockHooks)||[]],textRenders:[new x4,new GC],options:{...t.componentsOptions}},shortcuts:[rY,Dj,jG,dE,zw,KK,sE,VY,Uh,_K,...t.shortcuts||[]],colors:["#0064FF","#EB3723","#F59300","#00A865","#F25A0A","#70A310","#009CAD","#0990D9","#8851ED","#D62069"]});if(o.editorCommandProviders.registerCommandProvider(new wi(o)),o.input.addHandler(new LQ),o.input.addHandler(new H0),o.input.addHandler(new o$),o.input.addHandler(new OG),o.input.addHandler(new bE(o,{hideTitle:t.hideTitle,headingLevel:1,titlePlaceholder:D.t("placeholder.common.title"),contentPlaceholder:D.t("placeholder.common.content"),readonlyTitlePlaceholder:D.t("placeholder.common.readonlyTitle"),addPlaceholderToAllCurrentEmptyBlock:!0})),o.input.addHandler(new M0(o,(E=t.componentsOptions)==null?void 0:E.quickMenu)),o.input.addHandler(new FE(o)),o.input.addHandler(new zE(o)),o.input.addHandler(new W0),o.doc.registerCallback(new IQ(o)),o.addCustom("remote-cursor",()=>new uT(o)),o.addCustom("block-menu",G=>new sw(G)),ue.isMobile||o.addCustom("editor-tooltip",()=>new tf(o)),t!=null&&t.enableComments&&o.addCustom("editor-comments",G=>new A4(G,new jtt(G))),t.enableContextMenu!==!1&&o.addCustom("editor-context-menu",G=>new Xw(G)),o.addCustom("create-options",()=>new Lb(o,t)),o.addCustom("drop-target",()=>new Af(o)),o.addCustom("list-to-mindmap",()=>new R0(o)),o.addCustom("list-to-mention",()=>new QQ(o)),o.addCustom("mobile-helper",()=>new xJ(o)),o.addCustom("code-caret",()=>new wj(o)),o.addCustom("image-paste-handler",()=>new PE(o)),(x=t.componentsOptions)!=null&&x.mention){const G=t.componentsOptions.mention;o.addCustom("mention",()=>new rS(o,G))}if(o.addCustom("heading-collapse",()=>new uA(o)),o.addCustom(mm,G=>new pA(G)),nc.register(o),Af.register(o),Cs.register(o),fs.register(o),o.addListener("clickLink",(G,W,rt)=>{var Et;if((Et=t==null?void 0:t.events)!=null&&Et.onClickLink){t.events.onClickLink(G,W,rt);return}const st=rt.getAttribute("link");st&&(G.readonly||W.ctrlKey||W.metaKey)&&window.open(st,"_blank")}),(R=(v=t.componentsOptions)==null?void 0:v.remoteCarets)!=null&&R.onUserChanged){const G=(M=(L=t.componentsOptions)==null?void 0:L.remoteCarets)==null?void 0:M.onUserChanged;o.doc.getRemoteUsers().on("change",W=>{G(o,W)})}return(F=(U=t.componentsOptions)==null?void 0:U.templates)!=null&&F.templates.length&&(o.addListener("docChanged",()=>{hm(o)}),o.addListener("resize",()=>{hm(o,{reset:!0})}),setTimeout(()=>{hm(o)},100)),o.doc.registerCallback({onError:async G=>{if(G.code==="ResetDoc"){RA.error(`reset doc: ${G.message}`);const W=await Pu.load(r);o.doc.reset(W)}}}),o.version="1.1.8-beta.14",o}function Yet(n){return n.toJSON!==void 0}async function Qet(n,t,e){var o,s,l,c,d,h;p(RA,n,"app does not exists");const r=Yet(t)?t:new yp(t,{serverUrl:e.serverUrl||""});e.lang&&D.setLang(e.lang),ai.level=(o=e.logLevel)!=null?o:Ms.DEBUG;const i=ku(n,r,{id:e.id,scrollContainer:e==null?void 0:e.scrollContainer,components:{blocks:[fE,AE,xE,Ik],commandProviders:[new m0],decorators:[new V0,new Gp],embeds:[...yA,...((s=e.components)==null?void 0:s.embeds)||[]],boxes:[Hk,iS,w4,qk,...((l=e.components)==null?void 0:l.boxes)||[]],insertions:[q1],blockHooks:[new _E,...((c=e.components)==null?void 0:c.blockHooks)||[]],textRenders:[new x4,new GC,...((d=e.components)==null?void 0:d.textRenders)||[]],options:{...e.componentsOptions}},shortcuts:[dE,zw,sE,Uh]});return i.editorCommandProviders.registerCommandProvider(new wi(i)),i.input.addHandler(new H0),i.input.addHandler(new bE(i,{hideTitle:e.hideTitle,headingLevel:1,titlePlaceholder:D.t("placeholder.common.title"),contentPlaceholder:D.t("placeholder.common.content"),readonlyTitlePlaceholder:D.t("placeholder.local.readonlyTitle"),addPlaceholderToAllCurrentEmptyBlock:!0})),i.input.addHandler(new M0(i,(h=e.componentsOptions)==null?void 0:h.quickMenu)),i.input.addHandler(new FE(i)),i.input.addHandler(new zE(i)),i.input.addHandler(new W0),i.addCustom("block-menu",C=>new sw(C)),ue.isMobile||i.addCustom("editor-tooltip",()=>new tf(i)),i.addCustom("image-paste-handler",()=>new PE(i)),e!=null&&e.enableComments&&i.addCustom("editor-comments",C=>new A4(C,new ztt(C,r))),e.enableContextMenu!==!1&&i.addCustom("editor-context-menu",C=>new Xw(C)),i.addCustom("heading-collapse",()=>new uA(i)),i.addListener("clickLink",(C,E,x)=>{var R;if((R=e==null?void 0:e.events)!=null&&R.onClickLink){e.events.onClickLink(C,E,x);return}const v=x.getAttribute("link");v&&(C.readonly||E.ctrlKey||E.metaKey)&&window.open(v,"_blank")}),i.addCustom(mm,C=>new pA(C)),nc.register(i),i.version="1.1.8-beta.14",i}async function Jet(n,t,e){var h;const r=n.doc.externalDoc.client.auth,i=await Wh.load({auth:r,serverUrl:e});if(!((h=i.getVersionHelper)==null?void 0:h.call(i)))throw new Error("the editor does not support to show versions");const s=n.getCustom("create-options");if(!s)throw new Error("the editor does not support to show versions");const l=s.getData(),c=new NS(l),d=n.addCustom("version-dialog",()=>new j4(i,c));return d.show(t),d}b.tippy=r9,b.AnchorBox=_B,b.AuthError=Ou,b.AuthHeader=sl,b.AutoScroll=Hd,b.BaseURLHeader=Pa,b.BasicCommands=RV,b.BlockExclusiveHook=rw,b.BlockLockerHook=_E,b.BlockLockerPasteHandler=W0,b.BlockResizer=cf,b.BrBox=SB,b.CodeBlock=AE,b.CodeLineBlock=xE,b.CodeTextDecorator=V0,b.DOC_RE_AUTH_KEYS=mm,b.DefaultShortcuts=Uh,b.DocIdError=BN,b.DocReAuthCallbacks=pA,b.DragDrop=Xb,b.DrawioEmbed=TS,b.EditorBlocks=r3,b.EditorBoxes=IB,b.EditorCommandProviders=T2,b.EditorComplexBlockPosition=Ur,b.EditorComplexSelectionRange=di,b.EditorDecorators=NB,b.EditorEmbeds=o3,b.EditorInsertions=OB,b.EditorSimpleBlockPosition=qe,b.EditorSimpleSelectionRange=en,b.EmbedBlock=l3,b.EmbedBlockResizer=Rf,b.EnforceWithDocumentTitleHandler=bE,b.EventCallbacks=aa,b.FILL_CHAR=Z_,b.FileExtError=TN,b.GroupOrder=Uk,b.HeadingBlockScrollListener=zQ,b.ImageBox=DB,b.InlineBoxCommandProvider=Xk,b.InputtingInsertion=MB,b.LocalDoc=yp,b.LogLevel=Ms,b.Logger=ai,b.MIN_DISTANCE_THRESHOLD=Wb,b.ManualCloseDialog=Ku,b.ManualMenu=es,b.ManualToolbar=Fu,b.MarkdownInputHandler=H0,b.MaxUserError=Np,b.Mindmap=k0,b.OnesEditorAutoSuggest=hC,b.OnesEditorCustomDataWrapper=Lb,b.OnesEditorExclusiveBlock=fs,b.OnesEditorHoveringBlock=Te,b.OnesEditorIcons=cP,b.OnesEditorQuickMenu=M0,b.OnesEditorToc=Sf,b.OnesEditorTocProvider=Cs,b.OnesEditorToolbar=nc,b.OnesEditorTooltip=tf,b.OnesEditorVersionsDialog=j4,b.PermissionError=Gh,b.Popup=$a,b.ReAuthToolbar=dS,b.RemoteCarets=uT,b.RemoteCaretsDecorator=Gp,b.RemoteCaretsInsertion=q1,b.RemoteUsers=Ru,b.RequestReloadError=Nu,b.RichText=hn,b.ShareDBDoc=Pu,b.ShareDBDocVersionsProvider=NS,b.ShareDBServer=Wh,b.SimpleCache=Pb,b.StandardEmbedBlockCommands=rA,b.TEXT_STYLE_BACKGROUND_COLOR_PREFIX=k1,b.TEXT_STYLE_COLOR_PREFIX=y1,b.TableBlock=fE,b.TableBlockCommandProvider=m0,b.TableShortcuts=dE,b.TextBlock=Un,b.TextBox=wB,b.TextColorItem=wy,b.TextStyleShortcuts=sE,b.TocEmbed=eS,b.ZERO_WIDTH_SPACE_CHAR=Yc,b.abbreviation=jd,b.addAttribute=oh,b.addClass=z,b.addCommentToBlock=kf,b.addDays=fI,b.addMetaToDoc=Da,b.addMonths=uI,b.animateScrollTo=$o,b.applyPlaceholderToBlock=lf,b.assert=p,b.autoShowHideTemplates=hm,b.blockToDoc=xp,b.blockToHtml=Q1,b.blockToMarkdown=vh,b.blockToText=bh,b.blocksToDoc=xU,b.clearAllSelection=Kv,b.clientType=ue,b.cloneBlock=Yo,b.cloneChildContainer=lp,b.cloneDoc=ap,b.cloneText=EB,b.commentToShareDbComment=zp,b.compareElement=Ud,b.comparePosition=c1,b.complexBlockAdjustSelectionPos=Qd,b.complexBlockFindNearestChildBlock=c7,b.complexBlockGeFirstSimpleChild=f1,b.complexBlockGetAllChildContainers=vn,b.complexBlockGetBottomChildContainers=u3,b.complexBlockGetLastSimpleChild=Ca,b.complexBlockGetSelectedContainers=pa,b.complexBlockGetTopChildContainers=c3,b.containerToDoc=Y5,b.continuousScroll=uv,b.convertBlockFrom=qd,b.convertImageFileToPng=aS,b.convertImageSrcToPng=mJ,b.converterIntercept=$0,b.copyBlockAttributes=XB,b.copyResourcesFromDoc=Tp,b.createBlockAnchor=Yi,b.createBlockCaretAnchor=h3,b.createBlockContentElement=zs,b.createBlockElement=Iv,b.createBlockSimpleDocRange=gh,b.createBlockSimpleRange=ye,b.createBoxContentElement=Mv,b.createBoxElement=Dv,b.createBoxOp=CB,b.createChildContainer=e3,b.createComplexBlockPosition=Ee,b.createComplexDocPos=TB,b.createComplexDocRange=nM,b.createContainer=bB,b.createContainerElement=Yg,b.createDeleteOps=hB,b.createEditor=ku,b.createEditorSelectionRange=Xe,b.createElement=B,b.createEmptyContainer=no,b.createEmptyDoc=eo,b.createEmptyTextBlockData=hh,b.createExpandedRange=_d,b.createIconButton=Os,b.createImage=Sg,b.createInsertOps=fh,b.createInsertionContentElement=Nv,b.createInsertionElement=Uv,b.createLocalEditor=Qet,b.createOnesEditor=Xet,b.createRange=Fb,b.createRichText=el,b.createRootContainer=t3,b.createSimpleBlockPosition=at,b.createSimpleDocPos=BB,b.createTextBlockData=pi,b.createTextButton=gl,b.createTextOp=gr,b.createTextWithReplaceSoftReturn=P1,b.daysAfter=zg,b.deleteText=K1,b.diffDays=dI,b.disablePageScroll=$g,b.docToHtml=jB,b.docToHtmlFragment=Ta,b.docToMarkdown=zB,b.docToText=ro,b.downloadImageToFile=fS,b.downloadObjectToFile=AA,b.downloadSvgToString=gS,b.editLink=Qu,b.editorAddComment=qX,b.editorAddTextAttribute=s5,b.editorAutoInsertBlock=YB,b.editorBreakTextBlock=wa,b.editorClearCompositionText=ep,b.editorClearSelectedContents=Rh,b.editorCopyBlock=Mh,b.editorDeleteBlock=ip,b.editorDeleteBlockText=np,b.editorDeleteBlockWithoutChildren=yh,b.editorDeleteChildContainer=ZM,b.editorDeleteChildContainers=QB,b.editorFocusToBlock=sp,b.editorFocusToEnd=EU,b.editorGetBlockData=Xo,b.editorGetBlockText=Bn,b.editorGetBlockTextEx=Ch,b.editorGetBoxData=kB,b.editorHandleKeyboardEvent=l2,b.editorInsertBlock=Ra,b.editorInsertBoxToBlock=WB,b.editorInsertDoc=i5,b.editorInsertDocAt=cp,b.editorInsertText=tp,b.editorInsertTextToBlock=GB,b.editorInsertTextToBlockEx=Z1,b.editorMergeTextBlock=JB,b.editorMoveDown=A5,b.editorMoveEnd=pp,b.editorMoveHome=S5,b.editorMoveLeft=p5,b.editorMoveLineEnd=N5,b.editorMoveLineHome=O5,b.editorMovePageDown=H5,b.editorMovePageUp=$5,b.editorMoveRight=C5,b.editorMoveUp=E5,b.editorMoveWordEnd=k5,b.editorMoveWordLeft=y5,b.editorRangeClearColor=a5,b.editorRangeGetColor=c5,b.editorRangeSetColor=l5,b.editorRemoveTextAttribute=rU,b.editorReplaceBlockText=wh,b.editorReplaceContainer=o5,b.editorRunOnce=kp,b.editorSelectAll=Ep,b.editorSelectContainer=Ih,b.editorSelectDown=x5,b.editorSelectEnd=Cp,b.editorSelectHome=L5,b.editorSelectLeft=b5,b.editorSelectLineEnd=U5,b.editorSelectLineHome=M5,b.editorSelectPageDown=G5,b.editorSelectPageUp=z5,b.editorSelectRight=v5,b.editorSelectUp=B5,b.editorSelectWordEnd=w5,b.editorSelectWordLeft=R5,b.editorSetTextColor=Sa,b.editorShowFindDialog=Kq,b.editorToDocx=qet,b.editorUpdateBlockData=Sh,b.editorUpdateCompositionText=qB,b.editorUpdateEmbedData=n5,b.enablePageScroll=Hg,b.escapeHtmlText=Nd,b.escapeRegExp=Xg,b.escapeSpace=q9,b.exclusiveBlock=LE,b.executeBlockCommand=Xv,b.executeEmbedBlockCommand=qv,b.executeRangeCommand=B2,b.fileToDataUrl=da,b.findAfterOffsetNotType=z1,b.findAllText=$1,b.findBlockByIndex=bv,b.findEventTargetBlock=Hb,b.findInsertionById=Ov,b.findNextOffset=vM,b.findNextVisibleSimpleBlock=w2,b.findPrevOffset=bM,b.findPrevOffsetNotType=j1,b.findPrevSimpleBlockBeforeChildContainer=a3,b.findPrevVisibleSimpleBlock=R2,b.findTarget=ua,b.findWordEnd=W1,b.findWordLeft=G1,b.format=nu,b.formatBytes=fv,b.formatDate=Wg,b.fragmentToHtml=sv,b.fromBase64=Zc,b.fromBase64ToBlob=Kg,b.fromBase64ToUint8Array=oI,b.fromDocRange=zo,b.fromNowString=qg,b.genId=tt,b.getAllChildBlocks=m1,b.getAllQuickMenuItems=oE,b.getAllSelectedBlocks=hi,b.getAttributesAt=ba,b.getBlockBackground=Lv,b.getBlockByIndex=ji,b.getBlockCaretRect=Ho,b.getBlockClass=Qt,b.getBlockClassByType=$s,b.getBlockClientRects=Wi,b.getBlockCommandsWithHook=i1,b.getBlockContent=Ot,b.getBlockId=lt,b.getBlockIndex=Bt,b.getBlockInfo=mf,b.getBlockKind=Dr,b.getBlockMinWidth=$v,b.getBlockNearestRangeFromPoint=d1,b.getBlockOptions=yI,b.getBlockPath=jo,b.getBlockProperties=zv,b.getBlockRangeFromPoint=Jd,b.getBlockStyles=TI,b.getBlockTextLength=dt,b.getBlockTools=ie,b.getBlockType=Dt,b.getBoxContent=Zg,b.getBoxId=_v,b.getBoxTypeFromElement=lu,b.getChildBlockCount=Ir,b.getChildBlocks=fe,b.getChildOffset=Wo,b.getColorFromAttributes=w1,b.getColorFromContent=zd,b.getComplexBlockClass=fr,b.getContainerBlockPath=Qv,b.getContainerBlocks=Fv,b.getContainerBlocksElement=iu,b.getContainerById=Lr,b.getContainerId=ut,b.getContainerMinWidth=l1,b.getContainerToolsElement=bI,b.getContainerWidth=n3,b.getDistanceSquare=Vo,b.getElementOffset=Xc,b.getElementScale=ur,b.getEmbedType=We,b.getExistsBlockTools=Gd,b.getExistsContainerById=ru,b.getFileExt=eu,b.getFirstChildBlock=we,b.getFirstClientRect=Md,b.getHeadingMenuOptions=ZC,b.getHorizontalPadding=Ig,b.getInsertionContent=t1,b.getLastChildBlock=tn,b.getLastClientRect=Ns,b.getListAllNextBrothers=Qa,b.getLogger=I,b.getNextBlock=Zt,b.getNextValidOffset=Zs,b.getNextVisibleBlock=Ws,b.getOffsetFromPoint=Lg,b.getOffsetInfoAfter=Eu,b.getOffsetInfoBefore=Eh,b.getOpAt=W3,b.getOpLength=ih,b.getParentBlock=J,b.getParentBlockExcludeSelf=js,b.getParentBox=Jg,b.getParentContainer=it,b.getPrevBlock=Ae,b.getPrevValidOffset=qo,b.getPrevVisibleBlock=Gs,b.getRangeCommands=b2,b.getReferenceClientRect=lk,b.getRootBlock=r1,b.getScrollContainer=Ge,b.getSpecialBlockCommands=Gv,b.getStandardEmbedBlockProperties=iA,b.getTextAfterOffset=AM,b.getTextAttributes=J1,b.getTextBeforeOffset=xM,b.getTextBlockChild=Xd,b.getTextBlockClass=Bv,b.getTextBlockContentChildTextLength=mr,b.getTextBlockContentChildType=Yv,b.getTextBlockContentChildren=fi,b.getTextLength=dn,b.getTextOpLength=T1,b.getTextWidth=Kd,b.getToolbar=x0,b.handleBlockElementUpdated=Hv,b.hasAltOnly=tI,b.hasClass=wt,b.hasCtrlOrCmd=ev,b.hasCtrlOrCmdOnly=Z9,b.hashCode=Ev,b.hideBlock=wv,b.htmlToFragment=Fd,b.i18n=D,b.injectDocToHtmlFragment=Ia,b.injectStyle=Gb,b.inputActions=NU,b.insertEmptyBlock=wI,b.insertEmptyEmbedBlock=o1,b.insertText=to,b.intersectionCommands=pO,b.isBackspace=rv,b.isBlock=Hs,b.isBlockLocked=G0,b.isBlockLockedByOthers=DE,b.isBlockLockedBySelf=gf,b.isBlockTools=Rv,b.isBox=Wd,b.isBoxOp=Qi,b.isCJK=Zb,b.isChildContainer=Mr,b.isChildNode=re,b.isCodeBlock=Xr,b.isCollapsedRange=eM,b.isComplexBlockPosition=ga,b.isComplexKindBlock=Mt,b.isContainer=Gi,b.isContainerSelectedAllChildBlocks=W5,b.isControlEvent=Ks,b.isDelete=nI,b.isDraggingFiles=Vd,b.isElementVisible=Mg,b.isEmbedBlock=ge,b.isEmptyContainer=uu,b.isEmptyDoc=H1,b.isEmptyTextBlock=oe,b.isEmptyTextBlockWithoutCompositionText=sf,b.isEnterOnly=nv,b.isEscape=Pg,b.isExclusiveBlock=hf,b.isFirefox=Jc,b.isFirstChildBlockInComplexBlock=a7,b.isHighSurrogate=j9,b.isInBlock=e1,b.isInBlockTools=qs,b.isLetter=Jb,b.isLowSurrogate=z9,b.isMatchShortcut=ci,b.isMoveForward=Q9,b.isNavigationEvent=Y9,b.isNavigationKey=tv,b.isNodeRemoved=Vb,b.isNumber=Qb,b.isPrintableKey=Ng,b.isRootBlock=dr,b.isRootContainer=Xt,b.isSafari=fa,b.isSameDay=Gg,b.isSelectBoxOnly=qr,b.isShiftEnter=eI,b.isShiftTab=iI,b.isShortcutEvent=J9,b.isSimpleBlock=BI,b.isSimpleBlockPosition=Or,b.isSimplePos=vB,b.isSimpleRange=mh,b.isSpace=Pd,b.isTab=rI,b.isTextBlockContentBoxChild=hr,b.isTextBlockContentChild=au,b.isTextBlockContentInsertionChild=Xi,b.isTextBlockContentTextChild=cu,b.isTextKindBlock=nt,b.isTextKindBlockType=ou,b.isTitleBlock=zi,b.isToday=dv,b.isValidOffset=Mn,b.isVisibleBlock=su,b.isYesterday=hv,b.loadJs=$b,b.loadJsPromise=Ps,b.lockers=Sr,b.mergeCommands=A0,b.mergeDocs=nl,b.mergeOps=F1,b.mergeText=Q_,b.multiSplitText=X3,b.overflowText=mv,b.parseShortcut=iv,b.patchNode=tu,b.pointInRect=Fs,b.rangeAddAttribute=gu,b.rangeGetTextColor=nB,b.rangeRemoveAttribute=xa,b.rangeSetTextColor=Z3,b.rangeTransformText=Q3,b.registerDragDrop=Ug,b.removeAttribute=R1,b.removeClass=ot,b.removeLastBr=W_,b.removePlaceholderFromBlock=SR,b.removeStyle=zb,b.replaceAll=hI,b.replaceAllCaseInsensitive=mI,b.replaceAllText=xB,b.replaceText=dh,b.requestDownload=$d,b.resetListStart=Za,b.scrollable=cv,b.selectFile=ma,b.selectedBlockToDoc=Dh,b.selectionToDoc=La,b.setAttributes=Od,b.setClipboardData=ha,b.setClipboardDataByEvent=cI,b.setColorToAttributes=tB,b.setDataset=Dg,b.setDefaultCursor=Qc,b.setStyles=_g,b.shareDBCommentToDocObject=jp,b.shareDBDocCommentToComment=aT,b.shortcutToDisplayText=ze,b.showBlock=Sv,b.showDocVersions=Jet,b.splitText=Dn,b.splitToThree=Ye,b.stringToDataUrl=Vg,b.stringToObjectUrl=jg,b.subText=Y3,b.textNodeOffsetFromPoint=Kb,b.titleFromEditor=uS,b.toBase64URL=ui,b.toMindmap=y0,b.toPlainText=de,b.toPlainTextKeepLength=V1,b.trimChar=Og,b.unexclusiveBlock=IE,b.unicodeLength=G9,b.unicodeSubstr=W9,b.updateBlockSelection=Vv,b.updateOpAttributes=AB,b.updateTextBlockContent=EM,b.updateUrl=Fg;for(const n in Be)n!=="default"&&!b.hasOwnProperty(n)&&Object.defineProperty(b,n,{enumerable:!0,get:()=>Be[n]});Object.defineProperties(b,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|