@ones-editor/editor 1.1.34 → 1.1.36-beta.1
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/@ones-editor/tsconfig.tsbuildinfo +1 -1
- package/@ones-editor/ui-base/src/auto-suggest/auto-suggest-menu.d.ts +1 -1
- package/@ones-editor/ui-base/src/command-bar/command-bar.d.ts +1 -1
- package/@ones-editor/ui-base/src/command-bar/types.d.ts +1 -1
- package/dist/index.js +3 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -610,7 +610,7 @@ ${t}
|
|
|
610
610
|
</clipPath>
|
|
611
611
|
</defs>
|
|
612
612
|
</svg>
|
|
613
|
-
`,GO=Object.freeze(Object.defineProperty({__proto__:null,ClearIcon:i2,CloseIcon:A0,PrevIcon:xT,NextIcon:bT,MoreIcon:QC,TextColorIcon:JC,ArrowDownIcon:x0,ArrowUpIcon:SO,ArrowLeftIcon:LO,ArrowRightIcon:ZC,DeleteRowIcon:vT,DeleteColIcon:BT,MergeCellIcon:yT,SplitCellIcon:TT,DeleteTableIcon:kT,Heading1Icon:b0,Heading2Icon:v0,Heading3Icon:B0,Heading4Icon:y0,Heading5Icon:T0,Heading6Icon:k0,Heading7Icon:R0,Heading8Icon:w0,HeadingNIcon:IO,OrderedListIcon:RT,UnorderedListIcon:wT,CheckListIcon:ST,BlockquoteIcon:LT,AlignCenterIcon:L0,AlignLeftIcon:ru,AlignRightIcon:S0,ImageIcon:IT,ImageMenuIcon:DT,ImageErrorIcon:eE,ImageEmptyIcon:MT,LinkIcon:oE,LinkOffIcon:UT,WarningIcon:tE,PasteSpecialIcon:_T,LaunchIcon:nE,CodeIcon:XT,AudioIcon:zT,GraphIcon:DO,VideoIcon:GT,FileIcon:_O,MathIcon:UO,MathMenuIcon:OT,TableIcon:OO,TableMenuIcon:NT,BilibiliIcon:FT,YoukuIcon:KT,ModaoIcon:$T,FigmaIcon:VT,EditIcon:I0,CommentIcon:Ba,RefreshIcon:PT,HelpIcon:rE,CheckMarkIcon:iE,TextIcon:iu,RightArrowIcon:MO,TencentVideoIcon:HT,WebPageIcon:jT,UmlIcon:WT,DividingLineIcon:qT,HeadingH1Icon:NO,HeadingH2Icon:PO,HeadingH3Icon:FO,HeadingH4Icon:KO,HeadingH5Icon:VO,HeadingH6Icon:$O,HeadingH7Icon:HO,HeadingH8Icon:jO,CheckboxIcon:sE,QuoteIcon:lE,LinkHrefIcon:zO,OrderedIcon:cE,UnorderedIcon:aE,CopyIcon:YT,CutIcon:QT,DeleteIcon:JT,LockBlockIcon:ZT,UnLockBlockIcon:t2,InsertBeforeIcon:e2,InsertAfterIcon:n2,MentionIcon:r2,CircleAddIcon:o2,LoadingIcon:s2,DragIcon:uE,UmlBrandIcon:D0,OnesLoadingIcon:l2,BoldIcon:a2,ItalicIcon:c2,UnderlineIcon:u2,LineThroughIcon:f2,SubscriptIcon:h2,SuperscriptIcon:m2,InlineCodeIcon:d2,ToMindMapIcon:g2,FitIcon:p2,FullScreenIcon:fE,ExitFullScreenIcon:C2,CaretDownIcon:E2,StatusIcon:A2},Symbol.toStringTag,{value:"Module"}));function x2(){const n=B("span",["editor-loading-icon"],null);return n.innerHTML=l2,n}const eat="";function WO(n,t){const e=B("button",["editor-checkbox-wrapper"],null);e.setAttribute("data-button-id",n),t!=null&&t.includes("checked")&&q(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 nat="",ou=D("ui-command-bar-base"),qO={itemElementTag:"div",tippyArrow:!1},_x=class extends He.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=>{var r,i;if(!!this.isVisible&&!e.isComposing&&!Oc(e.target)){if(this.subBar){this.subBar.handleDocumentKeydown(e);return}if(this.items.length!==0){if(e.key==="Escape"){if((i=(r=this.options).beforeClose)!=null&&i.call(r))return;this.close("cancelBar");return}if(e.key==="ArrowUp"){const o=this.getPrevItemIndex(this.getSelectedItemIndex());this.startPauseMouseEnter(),this.selectItem(this.items[o].id),e.preventDefault(),e.stopPropagation()}else if(e.key==="ArrowDown"){const o=this.getNextItemIndex(this.getSelectedItemIndex());this.startPauseMouseEnter(),this.selectItem(this.items[o].id),e.preventDefault(),e.stopPropagation()}else if(e.key==="ArrowRight"){const o=this.getSelectedItem();o&&o.children&&this.showSubCommandBar(o.childrenMenuId)}else if(e.key==="ArrowLeft")this.parentItem&&this.close("switchItem");else if(e.key==="Enter"){const o=this.getSelectedItemIndex();if(o===-1)return;const s=this.items[o],l=this.getItemElementById(s.id);l&&this.emit("click",this,s,l)}}}});m(this,"handleDocumentMouseDown",e=>{var r,i;if(e.target instanceof Element){if((i=(r=this.options).beforeClose)!=null&&i.call(r,e))return;if(!this.isInCommandBar(e.target)){const o=this.listeners("closing");for(let s=0;s<o.length;s++)if(o[s](this,e)===!1)return;this.close("clickBackground")}}});m(this,"handleHidden",()=>{this.closeReason!=="fromHover"&&this.emit("close",this),this.close(null),Gp(this.id)});m(this,"handleShow",()=>{this.popper&&(this.popper.setAttribute("data-command-bar-id",this.id),this.options.classes&&q(this.popper,...this.options.classes),this.options.refuseOverflow&&this.popper.classList.add("reference-hidden")),this.emit("show",this),this.options.disablePageScroll&&zp(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)&&(ut(r,"selected"),this.emit("selectionChange",this,""))});m(this,"handleItemClick",e=>{var s,l;const r=this.getParentCommandItemElement(e.target);if(!r)return;const i=this.getItemElementId(r),o=this.items.find(c=>c.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}if(!o.element&&(this.emit("click",this,o,r),this.options.autoClose)){if((l=(s=this.options).beforeClose)!=null&&l.call(s,e))return;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=pn(i);if(!Ae(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:it(),this.options={...qO,...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&&ut(r,"selected")}selectItem(e,r="event"){const i=this.getSelectedItem();if(i){if(i.id===e)return;const s=i.id,l=this.getItemElementById(s);l&&ut(l,"selected")}const o=this.getItemElementById(e);o?(q(o,"selected"),this.emit("selectionChange",this,o.getAttribute("data-id")||""),!this.options.disableSelectedScroll&&r==="event"&&o.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=_x.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,ut(i,"active")}),r.beforePopup&&r.beforePopup(o),this.subBar.manualShow(i,this.getSubBarOptions(r)),q(i,"active")}isInCommandBar(e){if(!e||!(e instanceof Node))return!1;const r=this.getCommandBarRoot();return r&&Ae(r,e)||Ae(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(ou,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(ou,i,`can not find command item for id: ${r}`),i}return null}getItemElementId(e){const r=e.getAttribute("data-id");return p(ou,r,"no data-id attribute"),r}getItemElementById(e){const r=this.content.querySelector(`:scope >.editor-command-bar > .command-item[data-id="${e}"]`);return p(ou,r,`no exists command item, id=${e}`),r}getParentCommandItemElement(e){if(!e||!(e instanceof Element))return null;if(Mt(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)&&q(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(ou,e.children&&e.children.length>0,"no item children");const o=(l=e.childrenType)!=null?l:"menu",s=this.commandBarCreators.get(o);return p(ou,s,`no creator for command type: ${o}`),s(e,r,i)}static hasExistsCommandBar(){return!!document.querySelector("[data-command-bar-id]")}};let ya=_x;m(ya,"commandBarCreators",new Map),D("ui-command-bar");class _0 extends ya{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=m9.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 b2=D("ui-base");class su extends _0{constructor(t,e){var o;const r=(o=e==null?void 0:e.id)!=null?o:`popup-${it()}`,i=[{id:r,name:"",element:t}];super(i,void 0,{disablePageScroll:!0,id:r,beforeClose:e==null?void 0:e.beforeClose})}initCommandBarElement(t){q(t,"popper")}initItemElement(t,e){}get popupContent(){const t=this.items[0];p(b2,t,"no dialog item");const e=typeof t.element=="function"?t.element(t):t.element;return p(b2,e,"no item element"),e}}const rs=D("filterable-list");function v2(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")&&(q(t,"selected"),na(iE,["list-item-selected-icon"],t)),(r=n.states)!=null&&r.includes("disabled")&&q(t,"disabled"),t}function B2(n){const t=B("div",["list-root"],null);return n.forEach(e=>{t.appendChild(v2(e))}),n.length||t.appendChild(v2({id:"placeholder",states:["disabled"],name:_.t("search.emptyTips")})),t}function y2(n,t){return n.map(e=>({...e,states:t===e.id?["selected"]:[]}))}function XO(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=B2(y2(n,t==null?void 0:t.initialSelectedId));return s.appendChild(l),e}function T2(n,t,e){const r=n.querySelector(".list");p(rs,r,"no list root");const i=B2(y2(t,e)),o=r.querySelector(".list-root");if(p(rs,o,"no exists menu"),yf(o,i),e){const s=r.querySelector(".list-item.selected");s&&(p(rs,s,"no selected menu item"),s.scrollIntoView({block:"nearest"}))}}class YO{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(rs,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=XO(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(rs,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(rs,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,T2(this.root,this.visibleItems,t)}focus(){const t=this.root.querySelector(".filter-input");p(rs,t,"no input"),t.focus()}moveSelectedItemIntoView(){const t=this.root.querySelector(".list-item.selected");t&&(p(rs,t,"no selected menu item"),t.scrollIntoView({block:"nearest"}))}reset(){this.setFilter("");const t=this.root.querySelector(".filter-input");p(rs,t,"no input"),t.value=""}setFilter(t){this.filter!==t&&(this.filter=t,this.visibleItems=this.items.filter(e=>e.name.toLocaleLowerCase().includes(t)),T2(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 QO extends YO{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 su(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 rat="",iat="";function JO(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 ZO(n,t){var e,r;if(q(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-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=ZC,t.appendChild(o)}if((r=n.states)!=null&&r.includes("checked")){const o=B("div",["menu-item-checked-icon"],null);o.innerHTML=iE,t.appendChild(o)}}}}class hl extends _0{constructor(t,e,r){super(t,e,{autoClose:!0,disablePageScroll:!0,beforeClose:r==null?void 0:r.beforeClose,...r})}manualShow(t,e){const r={theme:"menu",...e};super.manualShow(t,r)}initCommandBarElement(t){q(t,"menu")}initItemElement(t,e){ZO(t,e)}}function tN(n,t,e){var r;return new hl((r=n.children)!=null?r:[],t,{...e,parentItem:n})}function k2(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=x0}n.states&&(n.states.indexOf("checked")!==-1&&q(r,"checked"),n.states.indexOf("disabled")!==-1&&(r.disabled=!0))}class gd extends _0{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){q(t,"toolbar")}initItemElement(t,e){k2(t,e,this.options)}}function eN(n,t,e){var r;return new gd((r=n.children)!=null?r:[],t,{...e,parentItem:n})}class nN extends ya{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){q(t,"toolbar","fixed")}initItemElement(t,e){k2(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 oat="";ya.registerManualCommandBar("menu",tN),ya.registerManualCommandBar("toolbar",eN);const sat="",R2=D("ui-base");class pd extends _0{constructor(e,r){super(pd.getCommandItems(e,r),void 0,{disablePageScroll:!0,...r});m(this,"handleDocumentMouseDown",e=>{})}initCommandBarElement(e){q(e,"dialog","manual")}initItemElement(e,r){}show(e,r){this.manualShow(e,{...r,theme:"light"})}get dialogContent(){const e=this.items[0];p(R2,e,"no dialog item");const r=e.element;return p(R2,r,"no item element"),r}static getCommandItems(e,r){var s;return[{id:(s=r==null?void 0:r.id)!=null?s:`manual-dialog-${it()}`,name:"",element:e}]}}const lat="",rN=D("ui-base");class w2{constructor(t){m(this,"menu");m(this,"currentText","");m(this,"handleSearchText");m(this,"handleClick",Pe.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 hl([],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=Pe.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,"manual")}}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||_.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 gi.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{gi.release(e)}}highlightText(t,e){rN.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 A=s.charAt(C);let v=!1;E.endsWith(" ")&&(v=!0,E=E.trimEnd()),c+=`<span class="highlight">${E}${A===" "||v?" ":""}</span>`}else c+=s.charAt(C),C++}return C<s.length&&(c+=s.substring(C)),c},o=s=>{if(Mt(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 dE{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",()=>{q(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),ut(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}=dE.createDropdown(t,this.labels);this.root=r,this.input=i,this.text=o,this.clearIcon=s,this.dropdownIcon=l,this.autoSuggest=new w2({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=i2;const c=B("div",["dropdown-icon"],r);return c.innerHTML=x0,{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),q(this.root,"empty")}else ut(this.root,"empty")}}const iN=[-1,6,0,1,2,3,4,5],oN=[-1,6,0,1,2,3,4,5,14,13,7,8,9,10,11,12],S2=D("color-palette");function L2(n,t,e,r){p(S2,n>0,"no color in palette");const i=t||1;p(S2,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 sN(n){const t=B("button",["color-button"],null),e=iN[n];return t.setAttribute("data-color-index",`${e}`),t.innerHTML=JC,t}function lN(n){const t=B("button",["background-color-button"],null),e=oN[n];return t.setAttribute("data-color-index",`${e}`),t}function aN(){const n=B("div",["clear-button-container"],null),t=B("button",["clear-button"],n);return t.innerText=_.t("colorPalette.reset"),n}function cN(n){const t=B("div",["color-palette"],null);return n.color!==!1&&(B("div",["bar-desc"],t,_.t("colorPalette.colorDesc")),t.appendChild(L2(8,1,sN,"color"))),n.backgroundColor!==!1&&(B("div",["bar-desc"],t,_.t("colorPalette.backgroundDesc")),t.appendChild(L2(16,2,lN,"background-color"))),n.clearColorButton!==!1&&t.appendChild(aN()),t}function uN(n,t,e){const r=t==="color"?"color":"background-color",i=n.querySelector(`.${r} button.selected`);i&&ut(i,"selected"),e===null&&(e=-1);const o=n.querySelector(`.${r} button[data-color-index="${e}"]`);o&&q(o,"selected")}const aat="",fN={};class dN extends He.TypedEmitter{constructor(e=fN){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(Mt(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)||(Mt(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=cN(e),this.root.addEventListener("click",this.handleClick)}destroy(){this.removeAllListeners(),this.root.removeEventListener("click",this.handleClick)}setColor(e,r){uN(this.root,e,r)}}class I2{constructor(t,e){m(this,"name","Color Palette");m(this,"element");m(this,"palette");m(this,"closeable",null);this.id=t,this.palette=new dN(e),this.element=this.palette.root}setCloseable(t){this.closeable=t}destroy(){this.palette.destroy(),this.closeable=null}}function hN(){const n=B("button",["color-button"],null);return n.innerHTML=JC,n}function hE(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 D2 extends He.TypedEmitter{constructor(e){super();m(this,"id","text-color-item");m(this,"name",_.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],hE(this.element,this.latestColors)});m(this,"beforePopup",()=>{this.updatePaletteColor(this.latestColors),this.emit("beforePopup")});this.editor=e,this.colorPaletteItem=new I2("text-color-palette-item"),this.colorPaletteItem.palette.addListener("onClick",this.handlePaletteClick),this.children.push(this.colorPaletteItem),this.element=hN()}destroy(){this.colorPaletteItem.destroy()}updatePaletteColor(e){this.colorPaletteItem.palette.setColor("color",e[0]),this.colorPaletteItem.palette.setColor("backgroundColor",e[1]),this.latestColors=e,hE(this.element,this.latestColors)}updateButtonColor(e){this.latestColors=e,hE(this.element,this.latestColors)}}const cat="";function M0(n,t){const e=B("div",["editor-input-wrap"],n);if(t!=null&&t.className&&q(e,t==null?void 0:t.className),t.label){const s=B("div",["editor-input-label"],e);B("span",[],s,t.label),t.required&&q(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),ut(e,"error")}),hm(i,(s,l)=>{var c;(c=t.onKeyDown)==null||c.call(t,s,l)}),{getField:()=>i,getInputValue:()=>i.value,setFieldError:s=>{q(e,"error"),o.innerText=s},focus:()=>{setTimeout(()=>{i.focus()})}}}function mE(n){if(!document.hasFocus())return!1;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 mN extends w2{constructor(e,r){super(r);m(this,"handleClose",()=>{var e,r;mE(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(!Ae(this.editor.rootContainer,o)||At(this.editor,o)<i)return;const s=Vo(this.editor,o,Ie(this.editor,o,i));if(s.length===0)return;const l=s[0],c=jo(this.editor,o,"editor-auto-suggest-menu",l);super.popup(c,{noEvent:!0})}}const gE=D("auto-suggest-menu");class pE{constructor(t,e){m(this,"order",100);m(this,"menu");m(this,"anchor",null);m(this,"close",()=>{this.menu.close()});m(this,"oldCompositingText","");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(Re(ar(Jn(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=Re(Hm(t,o,i));if(p(gE,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 mN(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)||Vp(e.key)?!1:lv(e)&&!la(e)?(setTimeout(()=>{this.resetItems()}),!1):pm(e)?(this.menu.close(),!0):(this.menu.handleKeydown(e),!0)}popup(t,e,r,i){this.anchor={blockId:dt(t),offset:e,leftText:r,trigger:i};const o=Et(at(t)),s=Rt(t);this.menu.popupInEditor(o,s,e)}triggerPopup(t,e,r,i,o){var l;const s=t.selection.range.start;if(!s.isSimple())return!1;if(this.options.trigger.indexOf(o)!==-1){const c=t.getBlockByIndex(e,r);if(i>0&&this.options.needSpaceBeforeTrigger&&(((l=t.getBlockData(c).text)==null?void 0:l.reduce((A,v)=>A+v.insert,""))||"")[i-1].trim().length!==0||this.hasExistsMenuThemeCommandBar())return!1;const{offset:d}=s,h=Re(Hm(t,c,d));this.popup(c,d,h,o)}return!1}handleAfterInsertText(t,e,r,i,o){var h;const s=t.selection.range.start;if(!s.isSimple())return!1;const l=t.getBlockByIndex(e,r);if(Ko(l))return!1;const{blockId:c,offset:d}=s;return dt(l)!==c?!1:(h=this.menu)!=null&&h.isVisible?(this.resetItems(),!1):this.triggerPopup(t,e,r,i,o)}handleUpdateCompositionText(t,e,r,i,o){var h;const s=t.selection.range.start;if(!s.isSimple())return!1;const{blockId:l}=s,c=t.getBlockByIndex(e,r);if(dt(c)!==l)return!1;if((h=this.menu)!=null&&h.isVisible&&this.resetItems(),!o)return this.oldCompositingText=t.compositingText,!1;const d=this.triggerPopup(t,e,r,i,this.oldCompositingText);return this.oldCompositingText="",d}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=Re(Hm(t,o,i));if(p(gE,this.anchor,"no anchor"),s.startsWith(this.anchor.leftText)){const c=s.substring(this.anchor.leftText.length);gE.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 gN(){const n={};for(let t=1;t<=8;t++)n[`heading-${t}`]={shortcut:`/h${t}`};return n}const pN={"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"},...gN()};function tr(n){var t;return(t=pN[n])==null?void 0:t.shortcut}function CN(n){var t;return(t=n.subText)!=null?t:""}const lo=D("table-dom");function ao(n){return`${dt(n)}_scroll`}function fn(n){const t=n.querySelector("div[data-type=table-content] >table");return p(lo,t instanceof HTMLTableElement,"invalid table"),t}function co(n,t){const r=n.getCustom(ao(t)).contentElement.firstElementChild;p(lo,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(lo,i,"no table tools"),i}function EN(n,t){return n.findCustom(ao(t))?co(n,t):null}function _2(n){const t=[];return Array.from(n.rows).forEach(e=>{t.push(...Array.from(e.cells))}),t}function Cd(n){const t=n.querySelector(":scope div[data-type=editor-container]");return p(lo,t,"no child container in cell"),t}function AN(n){const r=_2(n).map(i=>{const o=Cd(i),s=Et(o),l=i.colSpan,c=i.rowSpan;return`${s}/${l}/${c}`}).join();return kv(r)}function dn(n){return Ot(n)==="table"}function CE(n){const t=at(n);if(ie(t))return null;const e=et(t);return p(lo,e,"no parent block"),dn(e)?t:CE(e)}function is(n){if(dn(n))return n;const t=at(n);if(ie(t))return null;const e=et(t);return p(lo,e,"no parent block"),dn(e)?e:is(e)}function xN(n,t){const e=n.querySelector("colgroup");p(lo,e,"no colgroup");const r=e.children[t];return p(lo,r,"no col"),p(lo,r instanceof HTMLTableColElement,`invalid col: ${r.tagName}`),r}function M2(n){try{return fn(n),!0}catch{return!1}}function bN(n){return ve(n).querySelector(":scope > .block-helper")}function U2(n){const t=et(n.contentElement);p(lo,t,"no block");const e=bN(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`}}function vN(n){const t=n.getComponentOptions("table"),e=t==null?void 0:t.bigTableBoundary;if(!e)return!1;const r=n.rootContainer.querySelectorAll("div[data-type=table-content] >table");let i=!1;return r.forEach(o=>{o.getBoundingClientRect().width>e&&(i=!0)}),i}var EE={exports:{}};(function(n,t){var e=200,r="Expected a function",i="__lodash_hash_undefined__",o=1,s=2,l=1/0,c=9007199254740991,d="[object Arguments]",h="[object Array]",C="[object Boolean]",E="[object Date]",A="[object Error]",v="[object Function]",w="[object GeneratorFunction]",S="[object Map]",U="[object Number]",M="[object Object]",V="[object Promise]",rt="[object RegExp]",Y="[object Set]",X="[object String]",ft="[object Symbol]",pt="[object WeakMap]",ct="[object ArrayBuffer]",wt="[object DataView]",vt="[object Float32Array]",Gt="[object Float64Array]",ce="[object Int8Array]",Oe="[object Int16Array]",pe="[object Int32Array]",ni="[object Uint8Array]",Ve="[object Uint8ClampedArray]",bn="[object Uint16Array]",Ir="[object Uint32Array]",nr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Nn=/^\w*$/,uh=/^\./,fh=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,dh=/[\\^$.*+?()[\]{}|]/g,Ao=/\\(\\)?/g,cs=/^\[object .+?Constructor\]$/,us=/^(?:0|[1-9]\d*)$/,ee={};ee[vt]=ee[Gt]=ee[ce]=ee[Oe]=ee[pe]=ee[ni]=ee[Ve]=ee[bn]=ee[Ir]=!0,ee[d]=ee[h]=ee[ct]=ee[C]=ee[wt]=ee[E]=ee[A]=ee[v]=ee[S]=ee[U]=ee[M]=ee[rt]=ee[Y]=ee[X]=ee[pt]=!1;var Wt=typeof kn=="object"&&kn&&kn.Object===Object&&kn,ri=typeof self=="object"&&self&&self.Object===Object&&self,Pn=Wt||ri||Function("return this")(),fs=t&&!t.nodeType&&t,Oa=fs&&!0&&n&&!n.nodeType&&n,Rn=Oa&&Oa.exports===fs,xo=Rn&&Wt.process,Na=function(){try{return xo&&xo.binding("util")}catch{}}(),rr=Na&&Na.isTypedArray;function Fu(k,N){var W=k?k.length:0;return!!W&&hs(k,N,0)>-1}function hh(k,N,W){for(var lt=-1,St=k?k.length:0;++lt<St;)if(W(N,k[lt]))return!0;return!1}function ds(k,N){for(var W=-1,lt=k?k.length:0;++W<lt;)if(N(k[W],W,k))return!0;return!1}function Ne(k,N,W,lt){for(var St=k.length,ht=W+(lt?1:-1);lt?ht--:++ht<St;)if(N(k[ht],ht,k))return ht;return-1}function hs(k,N,W){if(N!==N)return Ne(k,ms,W);for(var lt=W-1,St=k.length;++lt<St;)if(k[lt]===N)return lt;return-1}function ms(k){return k!==k}function Ku(k){return function(N){return N==null?void 0:N[k]}}function gs(k,N){for(var W=-1,lt=Array(k);++W<k;)lt[W]=N(W);return lt}function Vu(k){return function(N){return k(N)}}function ps(k,N){return k.has(N)}function bo(k,N){return k==null?void 0:k[N]}function Cs(k){var N=!1;if(k!=null&&typeof k.toString!="function")try{N=!!(k+"")}catch{}return N}function Pa(k){var N=-1,W=Array(k.size);return k.forEach(function(lt,St){W[++N]=[St,lt]}),W}function Fa(k,N){return function(W){return k(N(W))}}function Es(k){var N=-1,W=Array(k.size);return k.forEach(function(lt){W[++N]=lt}),W}var Ka=Array.prototype,Va=Function.prototype,vo=Object.prototype,As=Pn["__core-js_shared__"],_l=function(){var k=/[^.]+$/.exec(As&&As.keys&&As.keys.IE_PROTO||"");return k?"Symbol(src)_1."+k:""}(),$u=Va.toString,Dr=vo.hasOwnProperty,Bo=vo.toString,Hu=RegExp("^"+$u.call(Dr).replace(dh,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),$a=Pn.Symbol,ju=Pn.Uint8Array,mh=vo.propertyIsEnumerable,gh=Ka.splice,ph=Fa(Object.keys,Object),Ml=Lo(Pn,"DataView"),xs=Lo(Pn,"Map"),Ha=Lo(Pn,"Promise"),yo=Lo(Pn,"Set"),bs=Lo(Pn,"WeakMap"),vs=Lo(Object,"create"),ja=Pi(Ml),Ch=Pi(xs),Eh=Pi(Ha),be=Pi(yo),Ah=Pi(bs),Ul=$a?$a.prototype:void 0,Ol=Ul?Ul.valueOf:void 0,To=Ul?Ul.toString:void 0;function Oi(k){var N=-1,W=k?k.length:0;for(this.clear();++N<W;){var lt=k[N];this.set(lt[0],lt[1])}}function Nl(){this.__data__=vs?vs(null):{}}function zu(k){return this.has(k)&&delete this.__data__[k]}function Gu(k){var N=this.__data__;if(vs){var W=N[k];return W===i?void 0:W}return Dr.call(N,k)?N[k]:void 0}function xh(k){var N=this.__data__;return vs?N[k]!==void 0:Dr.call(N,k)}function bh(k,N){var W=this.__data__;return W[k]=vs&&N===void 0?i:N,this}Oi.prototype.clear=Nl,Oi.prototype.delete=zu,Oi.prototype.get=Gu,Oi.prototype.has=xh,Oi.prototype.set=bh;function _r(k){var N=-1,W=k?k.length:0;for(this.clear();++N<W;){var lt=k[N];this.set(lt[0],lt[1])}}function vh(){this.__data__=[]}function Pl(k){var N=this.__data__,W=ko(N,k);if(W<0)return!1;var lt=N.length-1;return W==lt?N.pop():gh.call(N,W,1),!0}function Bh(k){var N=this.__data__,W=ko(N,k);return W<0?void 0:N[W][1]}function Fl(k){return ko(this.__data__,k)>-1}function yh(k,N){var W=this.__data__,lt=ko(W,k);return lt<0?W.push([k,N]):W[lt][1]=N,this}_r.prototype.clear=vh,_r.prototype.delete=Pl,_r.prototype.get=Bh,_r.prototype.has=Fl,_r.prototype.set=yh;function Mr(k){var N=-1,W=k?k.length:0;for(this.clear();++N<W;){var lt=k[N];this.set(lt[0],lt[1])}}function Th(){this.__data__={hash:new Oi,map:new(xs||_r),string:new Oi}}function Wu(k){return ks(this,k).delete(k)}function Kl(k){return ks(this,k).get(k)}function qu(k){return ks(this,k).has(k)}function kh(k,N){return ks(this,k).set(k,N),this}Mr.prototype.clear=Th,Mr.prototype.delete=Wu,Mr.prototype.get=Kl,Mr.prototype.has=qu,Mr.prototype.set=kh;function Bs(k){var N=-1,W=k?k.length:0;for(this.__data__=new Mr;++N<W;)this.add(k[N])}function Rh(k){return this.__data__.set(k,i),this}function mr(k){return this.__data__.has(k)}Bs.prototype.add=Bs.prototype.push=Rh,Bs.prototype.has=mr;function Fn(k){this.__data__=new _r(k)}function ii(){this.__data__=new _r}function Ye(k){return this.__data__.delete(k)}function za(k){return this.__data__.get(k)}function wh(k){return this.__data__.has(k)}function Ur(k,N){var W=this.__data__;if(W instanceof _r){var lt=W.__data__;if(!xs||lt.length<e-1)return lt.push([k,N]),this;W=this.__data__=new Mr(lt)}return W.set(k,N),this}Fn.prototype.clear=ii,Fn.prototype.delete=Ye,Fn.prototype.get=za,Fn.prototype.has=wh,Fn.prototype.set=Ur;function Or(k,N){var W=Fi(k)||Za(k)?gs(k.length,String):[],lt=W.length,St=!!lt;for(var ht in k)(N||Dr.call(k,ht))&&!(St&&(ht=="length"||Ju(ht,lt)))&&W.push(ht);return W}function ko(k,N){for(var W=k.length;W--;)if(Zu(k[W][0],N))return W;return-1}function ys(k,N){N=$l(N,k)?[N]:oi(N);for(var W=0,lt=N.length;k!=null&&W<lt;)k=k[Hl(N[W++])];return W&&W==lt?k:void 0}function Ga(k){return Bo.call(k)}function Ni(k,N){return k!=null&&N in Object(k)}function gr(k,N,W,lt,St){return k===N?!0:k==null||N==null||!ai(k)&&!vn(N)?k!==k&&N!==N:Wa(k,N,gr,W,lt,St)}function Wa(k,N,W,lt,St,ht){var $t=Fi(k),te=Fi(N),ue=h,we=h;$t||(ue=si(k),ue=ue==d?M:ue),te||(we=si(N),we=we==d?M:we);var Se=ue==M&&!Cs(k),De=we==M&&!Cs(N),ne=ue==we;if(ne&&!Se)return ht||(ht=new Fn),$t||ec(k)?Qu(k,N,W,lt,St,ht):Ih(k,N,ue,W,lt,St,ht);if(!(St&s)){var wn=Se&&Dr.call(k,"__wrapped__"),mn=De&&Dr.call(N,"__wrapped__");if(wn||mn){var Sn=wn?k.value():k,Ln=mn?N.value():N;return ht||(ht=new Fn),W(Sn,Ln,lt,St,ht)}}return ne?(ht||(ht=new Fn),Ya(k,N,W,lt,St,ht)):!1}function qa(k,N,W,lt){var St=W.length,ht=St,$t=!lt;if(k==null)return!ht;for(k=Object(k);St--;){var te=W[St];if($t&&te[2]?te[1]!==k[te[0]]:!(te[0]in k))return!1}for(;++St<ht;){te=W[St];var ue=te[0],we=k[ue],Se=te[1];if($t&&te[2]){if(we===void 0&&!(ue in k))return!1}else{var De=new Fn;if(lt)var ne=lt(we,Se,ue,k,N,De);if(!(ne===void 0?gr(Se,we,lt,o|s,De):ne))return!1}}return!0}function Ro(k){if(!ai(k)||_h(k))return!1;var N=li(k)||Cs(k)?Hu:cs;return N.test(Pi(k))}function Xa(k){return vn(k)&&Io(k.length)&&!!ee[Bo.call(k)]}function wo(k){return typeof k=="function"?k:k==null?Kn:typeof k=="object"?Fi(k)?Sh(k[0],k[1]):Xu(k):qn(k)}function So(k){if(!Mh(k))return ph(k);var N=[];for(var W in Object(k))Dr.call(k,W)&&W!="constructor"&&N.push(W);return N}function Xu(k){var N=Qa(k);return N.length==1&&N[0][2]?he(N[0][0],N[0][1]):function(W){return W===k||qa(W,k,N)}}function Sh(k,N){return $l(k)&&Ce(N)?he(Hl(k),N):function(W){var lt=tf(W,k);return lt===void 0&<===N?rc(W,k):gr(N,lt,void 0,o|s)}}function Yu(k){return function(N){return ys(N,k)}}function Ts(k){if(typeof k=="string")return k;if(Rs(k))return To?To.call(k):"";var N=k+"";return N=="0"&&1/k==-l?"-0":N}function Vl(k,N,W){var lt=-1,St=Fu,ht=k.length,$t=!0,te=[],ue=te;if(W)$t=!1,St=hh;else if(ht>=e){var we=N?null:Lh(k);if(we)return Es(we);$t=!1,St=ps,ue=new Bs}else ue=N?[]:te;t:for(;++lt<ht;){var Se=k[lt],De=N?N(Se):Se;if(Se=W||Se!==0?Se:0,$t&&De===De){for(var ne=ue.length;ne--;)if(ue[ne]===De)continue t;N&&ue.push(De),te.push(Se)}else St(ue,De,W)||(ue!==te&&ue.push(De),te.push(Se))}return te}function oi(k){return Fi(k)?k:Uh(k)}var Lh=yo&&1/Es(new yo([,-0]))[1]==l?function(k){return new yo(k)}:Nh;function Qu(k,N,W,lt,St,ht){var $t=St&s,te=k.length,ue=N.length;if(te!=ue&&!($t&&ue>te))return!1;var we=ht.get(k);if(we&&ht.get(N))return we==N;var Se=-1,De=!0,ne=St&o?new Bs:void 0;for(ht.set(k,N),ht.set(N,k);++Se<te;){var wn=k[Se],mn=N[Se];if(lt)var Sn=$t?lt(mn,wn,Se,N,k,ht):lt(wn,mn,Se,k,N,ht);if(Sn!==void 0){if(Sn)continue;De=!1;break}if(ne){if(!ds(N,function(Ln,Bn){if(!ne.has(Bn)&&(wn===Ln||W(wn,Ln,lt,St,ht)))return ne.add(Bn)})){De=!1;break}}else if(!(wn===mn||W(wn,mn,lt,St,ht))){De=!1;break}}return ht.delete(k),ht.delete(N),De}function Ih(k,N,W,lt,St,ht,$t){switch(W){case wt:if(k.byteLength!=N.byteLength||k.byteOffset!=N.byteOffset)return!1;k=k.buffer,N=N.buffer;case ct:return!(k.byteLength!=N.byteLength||!lt(new ju(k),new ju(N)));case C:case E:case U:return Zu(+k,+N);case A:return k.name==N.name&&k.message==N.message;case rt:case X:return k==N+"";case S:var te=Pa;case Y:var ue=ht&s;if(te||(te=Es),k.size!=N.size&&!ue)return!1;var we=$t.get(k);if(we)return we==N;ht|=o,$t.set(k,N);var Se=Qu(te(k),te(N),lt,St,ht,$t);return $t.delete(k),Se;case ft:if(Ol)return Ol.call(k)==Ol.call(N)}return!1}function Ya(k,N,W,lt,St,ht){var $t=St&s,te=ws(k),ue=te.length,we=ws(N),Se=we.length;if(ue!=Se&&!$t)return!1;for(var De=ue;De--;){var ne=te[De];if(!($t?ne in N:Dr.call(N,ne)))return!1}var wn=ht.get(k);if(wn&&ht.get(N))return wn==N;var mn=!0;ht.set(k,N),ht.set(N,k);for(var Sn=$t;++De<ue;){ne=te[De];var Ln=k[ne],Bn=N[ne];if(lt)var Ss=$t?lt(Bn,Ln,ne,N,k,ht):lt(Ln,Bn,ne,k,N,ht);if(!(Ss===void 0?Ln===Bn||W(Ln,Bn,lt,St,ht):Ss)){mn=!1;break}Sn||(Sn=ne=="constructor")}if(mn&&!Sn){var Ki=k.constructor,Do=N.constructor;Ki!=Do&&"constructor"in k&&"constructor"in N&&!(typeof Ki=="function"&&Ki instanceof Ki&&typeof Do=="function"&&Do instanceof Do)&&(mn=!1)}return ht.delete(k),ht.delete(N),mn}function ks(k,N){var W=k.__data__;return Dh(N)?W[typeof N=="string"?"string":"hash"]:W.map}function Qa(k){for(var N=ws(k),W=N.length;W--;){var lt=N[W],St=k[lt];N[W]=[lt,St,Ce(St)]}return N}function Lo(k,N){var W=bo(k,N);return Ro(W)?W:void 0}var si=Ga;(Ml&&si(new Ml(new ArrayBuffer(1)))!=wt||xs&&si(new xs)!=S||Ha&&si(Ha.resolve())!=V||yo&&si(new yo)!=Y||bs&&si(new bs)!=pt)&&(si=function(k){var N=Bo.call(k),W=N==M?k.constructor:void 0,lt=W?Pi(W):void 0;if(lt)switch(lt){case ja:return wt;case Ch:return S;case Eh:return V;case be:return Y;case Ah:return pt}return N});function Ja(k,N,W){N=$l(N,k)?[N]:oi(N);for(var lt,St=-1,$t=N.length;++St<$t;){var ht=Hl(N[St]);if(!(lt=k!=null&&W(k,ht)))break;k=k[ht]}if(lt)return lt;var $t=k?k.length:0;return!!$t&&Io($t)&&Ju(ht,$t)&&(Fi(k)||Za(k))}function Ju(k,N){return N=N==null?c:N,!!N&&(typeof k=="number"||us.test(k))&&k>-1&&k%1==0&&k<N}function $l(k,N){if(Fi(k))return!1;var W=typeof k;return W=="number"||W=="symbol"||W=="boolean"||k==null||Rs(k)?!0:Nn.test(k)||!nr.test(k)||N!=null&&k in Object(N)}function Dh(k){var N=typeof k;return N=="string"||N=="number"||N=="symbol"||N=="boolean"?k!=="__proto__":k===null}function _h(k){return!!_l&&_l in k}function Mh(k){var N=k&&k.constructor,W=typeof N=="function"&&N.prototype||vo;return k===W}function Ce(k){return k===k&&!ai(k)}function he(k,N){return function(W){return W==null?!1:W[k]===N&&(N!==void 0||k in Object(W))}}var Uh=jl(function(k){k=nc(k);var N=[];return uh.test(k)&&N.push(""),k.replace(fh,function(W,lt,St,ht){N.push(St?ht.replace(Ao,"$1"):lt||W)}),N});function Hl(k){if(typeof k=="string"||Rs(k))return k;var N=k+"";return N=="0"&&1/k==-l?"-0":N}function Pi(k){if(k!=null){try{return $u.call(k)}catch{}try{return k+""}catch{}}return""}function Oh(k,N){return k&&k.length?Vl(k,wo(N)):[]}function jl(k,N){if(typeof k!="function"||N&&typeof N!="function")throw new TypeError(r);var W=function(){var lt=arguments,St=N?N.apply(this,lt):lt[0],ht=W.cache;if(ht.has(St))return ht.get(St);var $t=k.apply(this,lt);return W.cache=ht.set(St,$t),$t};return W.cache=new(jl.Cache||Mr),W}jl.Cache=Mr;function Zu(k,N){return k===N||k!==k&&N!==N}function Za(k){return tc(k)&&Dr.call(k,"callee")&&(!mh.call(k,"callee")||Bo.call(k)==d)}var Fi=Array.isArray;function Qe(k){return k!=null&&Io(k.length)&&!li(k)}function tc(k){return vn(k)&&Qe(k)}function li(k){var N=ai(k)?Bo.call(k):"";return N==v||N==w}function Io(k){return typeof k=="number"&&k>-1&&k%1==0&&k<=c}function ai(k){var N=typeof k;return!!k&&(N=="object"||N=="function")}function vn(k){return!!k&&typeof k=="object"}function Rs(k){return typeof k=="symbol"||vn(k)&&Bo.call(k)==ft}var ec=rr?Vu(rr):Xa;function nc(k){return k==null?"":Ts(k)}function tf(k,N,W){var lt=k==null?void 0:ys(k,N);return lt===void 0?W:lt}function rc(k,N){return k!=null&&Ja(k,N,Ni)}function ws(k){return Qe(k)?Or(k):So(k)}function Kn(k){return k}function Nh(){}function qn(k){return $l(k)?Ku(Hl(k)):Yu(k)}n.exports=Oh})(EE,EE.exports);const BN=EE.exports,wi=D("doc-table-grid");class yN{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(wi,t>=0&&t<this.cols(),`set cell, invalid col: ${t}`),this._cells[t]=e}getCell(t){p(wi,t>=0&&t<this.cols(),`get cell, invalid col: ${t}`);const e=this._cells[t];return p(wi,e,"get cell, no cell"),e}getCellAllowEmpty(t){return p(wi,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 yN(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(wi,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,c=this._data[`${i}_background`]||"";for(let h=0;h<l;h++)for(let C=0;C<s;C++){const E={col:e,row:r,containerId:i,virtual:C!==0||h!==0,colSpan:s,rowSpan:l};c&&(E.background=c),this._rows[r+h].setCell(e+C,E)}const d=this.getNextEmptyCell(e,r);d?(e=d.col,r=d.row):p(wi,o===t.length-1,`invalid table data, no next empty cell: ${JSON.stringify(this._data)}`)}),this._rows.forEach(i=>{i.forEach(o=>{p(wi,o,"no cell"),p(wi,o.containerId,"no containerId")})})}getCell(t){const{col:e,row:r}=t,i=this._rows[r];p(wi,i,`get cell, no row: ${r}`);const o=i.getCell(e);return p(wi,o,`get cell, no cell: ${e}`),o}getRow(t){const e=this._rows[t];return p(wi,e,`get row, no row: ${t}`),e}forEach(t){this._rows.forEach(t)}}const O0=D("table-data");function TN(n){for(const t of Array.from(n.classList))if(t.startsWith("style-bg-color-"))return t;return""}function kN(n){const t=n.firstElementChild;return p(O0,t,"no child element for cell"),p(O0,Qs(t),"cell first child is not a container"),p(O0,pi(t),"cell first child is not a container"),t}function RN(n){const t=et(n);p(O0,t,"no parent block for table");const e=[],r={},i={};Array.from(n.rows).forEach(c=>{Array.from(c.cells).forEach(d=>{const h=kN(d),C=Et(h);e.push(C),(d.colSpan>1||d.rowSpan>1)&&(r[`${C}_colSpan`]=d.colSpan,r[`${C}_rowSpan`]=d.rowSpan);const E=TN(d);E&&(i[`${C}_background`]=E)})});const o=n.rows.length,s=Array.from(n.rows[0].cells).map(c=>c.colSpan).reduce((c,d)=>c+d,0);return{id:dt(t),type:Ot(t),rows:o,cols:s,children:e,colsWidth:Array(s).fill(100),...r,...i}}function ml(n){return new U0(n)}function wN(n){return ml(RN(n))}const en=D("table-grid"),SN=60;class LN{constructor(t,e){m(this,"containerId");m(this,"row");m(this,"col");m(this,"colSpan");m(this,"rowSpan");m(this,"background");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,e.background&&(this.background=e.background)}get cell(){const e=this.container.closest("td");return p(en,e,"no parent cell for child container"),e}get container(){const t=e1(this.containerId),e=this.table.querySelectorAll(`#${t}`);p(en,e.length===1,"containers !== 1"),p(en,Qs(e[0]),"not a container");const r=e[0];return p(en,pi(r),"not a child container"),r}}class IN{constructor(t,e){m(this,"_cells",[]);e.forEach(r=>{this._cells.push(new LN(t,r))})}get cells(){return this._cells}getCell(t){return p(en,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 Mx=class{constructor(t){m(this,"_rows",[]);this.table=t,wN(t).forEach(i=>{this._rows.push(new IN(t,i))});const r=this.colCount;this._rows.forEach(i=>{p(en,i.cells.length===r,"row.cells.length !== colCount")})}get rowCount(){return this._rows.length}get colCount(){return this._rows.length===0?0:(p(en,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(en,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(en,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(en,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(en,!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(en,r<=i,"min > max"),p(en,r>=0,"min < 0"),p(en,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(en,r<=i,"min > max"),p(en,r>=0,"min < 0"),p(en,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 A=r;A<=i;A++)for(let v=o;v<=s;v++)l.push(this.getCell({row:A,col:v}));const c=this.toRealCells(l);let d=1e4,h=1e4,C=-1,E=-1;return c.forEach(A=>{h=Math.min(A.col,h),d=Math.min(A.row,d),E=Math.max(A.col+A.colSpan-1,E),C=Math.max(A.row+A.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 A=this.getCell({row:C,col:E});A.virtual||r.push(A)}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)}getLeftCell(t){const e=this.uniqueCells,r=e.findIndex(i=>i.containerId===t.containerId);return p(en,r>=0,"not a valid child container"),r===0?null:e[r-1]}getRightCell(t){const e=this.uniqueCells,r=e.findIndex(i=>i.containerId===t.containerId);return p(en,r>=0,"not a valid child container"),r===e.length-1?null:e[r+1]}get uniqueCells(){return BN(this.cells,"containerId")}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(en,r,"cell not found"),r}getCellByCellElement(t){const e=Cd(t);return this.getCellByContainerId(Et(e))}getCellByContainerId(t){return this.getCellById(t)}static fromTable(t){const e=AN(t),r=this.caches.getSync(e,()=>(en.debug("create table grid"),new Mx(t)));return r.table!==t?(this.caches.delete(e),this.fromTable(t)):r}static fromBlock(t){return this.fromTable(fn(t))}};let Kt=Mx;m(Kt,"caches",new Hb(SN));function N0(n,t){Object.entries(n).forEach(([e])=>{e.startsWith(`${t}/`)&&delete n[e]})}const DN=D("table-selection-range");function Si(n,t,e){var M,V,rt,Y;const r=Kt.fromBlock(n),i=t,o=e,s=r.getCellByContainerId(i.childContainerId),l=r.getCellByContainerId(o.childContainerId),c=i.custom,d=o.custom,h=(M=c==null?void 0:c.rowIndex)!=null?M:s.row,C=(V=c==null?void 0:c.colIndex)!=null?V:s.col,E=(rt=d==null?void 0:d.rowIndex)!=null?rt:l.row+l.rowSpan-1,A=(Y=d==null?void 0:d.colIndex)!=null?Y:l.col+l.colSpan-1,v=Math.min(h,E),w=Math.max(h,E),S=Math.min(C,A),U=Math.max(C,A);return{fromRow:v,toRow:w,fromCol:S,toCol:U}}function AE(n,t){const e=new Set,r=new Set,i=n.selection.range;if(!i.isSimple()&&i.start.blockId===dt(t)){const o=Kt.fromBlock(t),{start:s,end:l}=i;p(DN,!s.isSimple()&&!l.isSimple(),"invalid range");const{fromCol:c,toCol:d,fromRow:h,toRow:C}=Si(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 Ed(n,t){let e=null;if(t.isCollapsed()&&t.isSimple()){const r=n.getBlockById(t.start.blockId);if(dn(r)){const i=at(r),o=et(i);o&&(e=is(o))}else e=is(r)}else{const r=n.getBlockById(t.start.blockId),i=is(r),o=n.getBlockById(t.end.blockId),s=is(o);i===s&&(e=i)}return e}const lu=D("delete-columns");function O2(n,t,e){const{start:r,end:i}=e;if(r.blockId!==i.blockId||e.isSimple()||n.getBlockById(r.blockId)!==t||Ot(t)!=="table")return!1;const{fromRow:s,toRow:l}=Si(t,e.start,e.end),c=Kt.fromBlock(t);return s===0&&l===c.rowCount-1}function xE(n){const t=n.getEditor();t.undoManager.runInGroup(()=>{var V,rt;const e=t.getBlockById(n.start.blockId);if(!O2(t,e,n))return;if(n.isSimple()){t.deleteBlock(e);return}const{fromCol:r,toCol:i}=Si(e,n.start,n.end),o=Kt.fromBlock(e);if(r===0&&i===o.colCount-1){t.deleteBlock(e);return}const s=new Set,l=o.map(Y=>Y.containerId);for(let Y=0;Y<l.length;Y++){const X=l[Y];for(let ft=r;ft<=i;ft++){const pt=X[ft];s.add(pt)}X.splice(r,i-r+1)}const c=new Set(l.flat()),d=new Set(Array.from(s).filter(Y=>!c.has(Y))),h=i-r+1,C=new Map,E=new Map;s.forEach(Y=>{if(d.has(Y))return;const X=o.getCellByContainerId(Y);if(p(lu,X.colSpan>1,"invalid effected cell, colSpan === 1"),X.col<r){p(lu,c.has(Y),"invalid effected cell, not exists");let Gt=X.col+X.colSpan-1;Gt>i&&(Gt=i);const ce=Gt-r+1,Oe=X.colSpan-ce;C.set(Y,Oe);return}p(lu,X.col<=i,"invalid effected cell, col > endCol");const ft=X.col,pt=X.col+X.colSpan-1,ct=X.col-r,wt=pt-ft+1-h+ct;p(lu,wt>0,"invalid effected cell, newSpanned <= 0");const vt=Yo(t.doc);E.set(Y,{newContainerId:vt,colSpan:wt})});for(let Y=0;Y<l.length;Y++){const X=l[Y];for(let ft=r;ft<X.length;ft++){const pt=X[ft],ct=E.get(pt);ct&&(X[ft]=ct.newContainerId)}}const A=xt.default(t.getBlockData(e));((V=A.colsWidth)!=null?V:new Array(A.cols).fill(0)).splice(r,i-r+1),d.forEach(Y=>{N0(A,Y)}),C.forEach((Y,X)=>{p(lu,Y>=1,"invalid modified colSpan, colSpan < 1"),Y===1?A[`${X}_colSpan`]=void 0:A[`${X}_colSpan`]=Y}),E.forEach((Y,X)=>{N0(A,X);const{newContainerId:ft,colSpan:pt}=Y;p(lu,pt>=1,"invalid newContainerData, colSpan < 1"),pt>1&&(A[`${ft}_colSpan`]=pt);const ct=o.getCellByContainerId(X).rowSpan;ct>1&&(A[`${ft}_rowSpan`]=ct)});const w=(rt=l[0][r])!=null?rt:l[0][r-1],S=t.getChildContainerData(w)[0],U=Kt.virtualCellContainersGridToChildren(l),M={...A,cols:A.cols-h,children:U};ml(M),t.updateBlockData(e,M,Ie(t,S.id,0)),t.deleteChildContainers(Array.from(d)),t.deleteChildContainers(Array.from(E.keys()))})}const au=D("delete-rows");function N2(n,t,e){const{start:r,end:i}=e;if(r.blockId!==i.blockId||e.isSimple()||n.getBlockById(r.blockId)!==t||Ot(t)!=="table")return!1;const{fromCol:s,toCol:l}=Si(t,e.start,e.end),c=Kt.fromBlock(t);return s===0&&l===c.colCount-1}function bE(n){const t=n.getEditor();t.undoManager.runInGroup(()=>{const e=t.getBlockById(n.start.blockId);if(!N2(t,e,n))return;if(n.isSimple()){t.deleteBlock(e);return}const{fromRow:r,toRow:i}=Si(e,n.start,n.end),o=Kt.fromBlock(e);if(r===0&&i===o.rowCount-1){t.deleteBlock(e);return}const s=new Set,l=o.map(M=>M.containerId);for(let M=i;M>=r;M--)l[M].forEach(rt=>s.add(rt)),l.splice(M,1);const c=new Set(l.flat()),d=new Set(Array.from(s).filter(M=>!c.has(M))),h=i-r+1,C=new Map,E=new Map;s.forEach(M=>{if(d.has(M))return;const V=o.getCellByContainerId(M);if(p(au,V.rowSpan>1,"invalid effected cell, rowSpan === 1"),V.row<r){p(au,c.has(M),"invalid effected cell, not exists");let ct=V.row+V.rowSpan-1;ct>i&&(ct=i);const wt=ct-r+1,vt=V.rowSpan-wt;C.set(M,vt);return}p(au,V.row<=i,"invalid effected cell, col > endCol");const rt=V.row,Y=V.row+V.rowSpan-1,X=V.row-r,ft=Y-rt+1-h+X;p(au,ft>0,"invalid effected cell, newSpanned <= 0");const pt=Yo(t.doc);E.set(M,{newContainerId:pt,rowSpan:ft})});for(let M=r;M<l.length;M++){const V=l[M];for(let rt=0;rt<V.length;rt++){const Y=V[rt],X=E.get(Y);X&&(V[rt]=X.newContainerId)}}const A=xt.default(t.getBlockData(e));d.forEach(M=>{N0(A,M)}),C.forEach((M,V)=>{p(au,M>=1,"invalid modified rowSpan, rowSpan < 1"),M===1?A[`${V}_rowSpan`]=void 0:A[`${V}_rowSpan`]=M}),E.forEach((M,V)=>{N0(A,V);const{newContainerId:rt,rowSpan:Y}=M;p(au,Y>=1,"invalid newContainerData, rowSpan < 1"),Y>1&&(A[`${rt}_rowSpan`]=Y);const X=o.getCellByContainerId(V).colSpan;X>1&&(A[`${rt}_colSpan`]=X)});const v=l[r]?l[r][0]:l[r-1][0],w=t.getChildContainerData(v)[0],S=Kt.virtualCellContainersGridToChildren(l),U={...A,rows:A.rows-h,children:S};ml(U),t.updateBlockData(e,U,Ie(t,w.id,0)),t.deleteChildContainers(Array.from(d)),t.deleteChildContainers(Array.from(E.keys()))})}const Ad=D("table-range");function P0(n){p(Ad,!n.isSimple(),"must be complex selection range");const{anchor:t,focus:e}=n;p(Ad,!t.isSimple(),"invalid start pos type"),p(Ad,!e.isSimple(),"invalid end pos type");const r=n.getEditor();p(Ad,t.blockId===e.blockId,"invalid range, not same block");const i=r.getBlockById(t.blockId);p(Ad,Ot(i)==="table","invalid block type, not a table block");const o=fn(i),s=Kt.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),A=s.getCell({row:d,col:C}),v=s.getCell({row:h,col:E});return{editor:r,block:i,table:o,startCell:A,endCell:v,startRow:d,startCol:C,endRow:h,endCol:E}}const vE=D("split-cell");function BE(n,t,e){n.undoManager.runInGroup(()=>{const r=Kt.fromBlock(t),i=r.getRealCell(e);p(vE,!i.virtual,"should not split virtual cell"),p(vE,i.colSpan>1||i.rowSpan>1,"cell does not has span data");const o=r.getVirtualCellContainersGrid(),s=[];for(let A=0;A<i.rowSpan;A++)for(let v=0;v<i.colSpan;v++){if(A===0&&v===0)continue;const w=A+i.row,S=v+i.col,U=Yo(n.doc);o[w][S]=U,s.push(U)}const l=n.getBlockData(t),c=xt.default(l);c[`${i.containerId}_colSpan`]=null,c[`${i.containerId}_rowSpan`]=null;const d=i.background;d&&s.length>0&&s.forEach(A=>{c[`${A}_background`]=d}),c.children=Kt.virtualCellContainersGridToChildren(o);const C=n.getChildContainerData(i.containerId)[0];p(vE,C,"no child block");const E=Ie(n,C.id,0);ml(c),n.updateBlockData(t,c,E)})}function _N(n,t,e){e.forEach(r=>{const i=Kt.fromBlock(t).getCell(r);(i.virtual||i.colSpan>1||i.rowSpan>1)&&BE(n,t,r)})}function P2(n,t,e){if(e.isSimple())return!1;const{start:r,end:i}=e;if(r.blockId!==i.blockId||n.getBlockById(r.blockId)!==t||Ot(t)!=="table")return!1;const{startCell:s,endCell:l}=P0(e);return!(s.cell!==l.cell||s.colSpan===1&&s.rowSpan===1)}function yE(n){const{editor:t,block:e,startRow:r,startCol:i,endRow:o,endCol:s}=P0(n),l=[];for(let c=r;c<=o;c++)for(let d=i;d<=s;d++)l.push({row:c,col:d});return _N(t,e,l),!0}const cu=D("merge-cells");function F2(n,t,e){if(e.isSimple())return!1;const{start:r,end:i}=e;if(r.blockId!==i.blockId||n.getBlockById(r.blockId)!==t||Ot(t)!=="table")return!1;const{startCell:s,endCell:l}=P0(e);return s.cell!==l.cell}function K2(n){const t=P0(n),e=t.editor;e.undoManager.runInGroup(()=>{const r=t.endCell,i=r.row+r.rowSpan-1,o=r.col+r.colSpan-1,s=dt(t.block);yE(n);const l=e.getBlockById(s),c=fn(l),{startRow:d,startCol:h}=t,C=xt.default(e.getBlockData(l));p(cu,C.children,"no table children");const E=Kt.fromTable(c),A=[];for(let ct=d;ct<=i;ct++)for(let wt=h;wt<=o;wt++){const vt=E.getCell({row:ct,col:wt});p(cu,!vt.virtual,"cell is virtual"),A.push(vt)}p(cu,A.length>0,"no selected cells");const v=A[0],w=A.slice(1),S=E.getCellByContainerId(v.containerId).container,U=[];w.forEach(ct=>{const wt=E.getCellByContainerId(ct.containerId).container,vt=Et(wt);if(!Of(e,wt)){const Gt=J5(e,vt);if(Of(e,S)){const ce=ke(S)[0];e.insertDocAt(S,0,Gt),e.deleteBlock(ce)}else e.insertDocAt(S,Xi(S),Gt)}U.push(vt)});const M=Et(S),V=o-h+1,rt=i-d+1;C[`${M}_colSpan`]=V,C[`${M}_rowSpan`]=rt,U.forEach(ct=>{p(cu,C.children,"no table children");const wt=C.children.indexOf(ct);p(cu,wt>0,"no deleted container"),C.children.splice(wt,1)});const Y=C,ft=e.getChildContainerData(M)[0];p(cu,ft,"no child block");const pt=Ie(e,ft.id,0);ml(Y),e.updateBlockData(l,Y,pt),e.deleteChildContainers(U)})}const TE=10,MN=["table/merge-cells","table/split-cell","table/insert-column","table/insert-row","table/delete-rows","table/delete-columns","table/delete"];class F0{constructor(){m(this,"id","TableBlockCommandProvider")}getAvailableCommands(t,e,r){if(Ot(e)!=="table")return[];const i={blockId:dt(e),blockKind:Ei(t,e),blockType:Ot(e)},o=[];F2(t,e,r)&&o.push({id:"table/merge-cells",name:_.t("table.mergeCell"),icon:yT,groupIndex:TE,...i}),P2(t,e,r)&&o.push({id:"table/split-cell",name:_.t("table.splitCell"),icon:TT,groupIndex:TE,...i});const s=O2(t,e,r),l=N2(t,e,r);return s&&l&&o.push({id:"table/delete",name:_.t("table.deleteTable"),icon:kT,groupIndex:TE,...i}),o}executeCommand(t,e,r,i,o,s){return Ot(e)!=="table"||!new Set(MN).has(i.id)?!1:i.id==="table/merge-cells"?(K2(r),!0):i.id==="table/split-cell"?(yE(r),!0):i.id==="table/delete-columns"?(xE(r),!0):i.id==="table/delete-rows"?(bE(r),!0):i.id==="table/delete"?(t.deleteBlock(e),!0):!1}}var V2=(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))(V2||{});const uu=6,xd=20,kE="table-cell-menu-btn";function UN(n,t){if(!n.isBlockWritable(t))return;const r={...xt.default(n.getBlockData(t)),hasColTitle:!0};n.updateBlockData(t,r)}function ON(n,t){if(!n.isBlockWritable(t))return;const r={...xt.default(n.getBlockData(t)),hasColTitle:!1};n.updateBlockData(t,r)}function NN(n,t){if(!n.isBlockWritable(t))return;const r={...xt.default(n.getBlockData(t)),hasRowTitle:!0};n.updateBlockData(t,r)}function PN(n,t){if(!n.isBlockWritable(t))return;const r={...xt.default(n.getBlockData(t)),hasRowTitle:!1};n.updateBlockData(t,r)}function FN(n,t){if(!n.isBlockWritable(t))return;const r={...xt.default(n.getBlockData(t)),isStripeStyle:!0};n.updateBlockData(t,r)}function KN(n,t){if(!n.isBlockWritable(t))return;const r={...xt.default(n.getBlockData(t)),isStripeStyle:!1};n.updateBlockData(t,r)}function VN(n,t,e){if(!n.isBlockWritable(t))return;const i={...xt.default(n.getBlockData(t)),noBorder:!e};n.updateBlockData(t,i)}const os=D("table-cell-dom");function $N(n,t,e){let r=n.getBlockById(e);for(;r;){const i=r.closest("td");p(os,i,"no parent cell");const o=et(i);if(p(os,o,"no parent block"),o===t)return i;r=o}return p(os,!1,"filed to get cell by child block id"),null}function gl(n,t,e){if(n.getBlockById(e.blockId)===t&&!e.isSimple())return p(os,e.childContainerId,"block position must have childContainerId attribute"),e;const i=$N(n,t,e.blockId),o=Et(Cd(i));return Ue(t,o)}function RE(n,t){const e=n.selection.range,r=gl(n,t,e.start),i=gl(n,t,e.end);return Si(t,r,i)}function $2(n,t,e,r){p(os,dn(t),"invalid table block");const i=co(n,t),o=ve(t),s=()=>{const c=i.querySelector(".table-border-bar-container.top");p(os,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)?q(h,"danger"):ut(h,"danger")})},l=()=>{const c=o.querySelector(".table-border-bar-container.left");p(os,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)?q(h,"danger"):ut(h,"danger")})};s(),l()}function pl(n,t,e=!0,r){try{const o=Kt.fromBlock(t).map(h=>h),{fromCol:s,toCol:l,fromRow:c,toRow:d}=RE(n,t);for(let h=0;h<o.length;h++){const C=o[h];for(let E=0;E<C.length;E++){const A=C[E],v=r?E>=s&&E+A.colSpan-1<=l:h>=c&&h+A.rowSpan-1<=d;e&&v?A.virtual||q(A.cell,"danger"):A.virtual||ut(A.cell,"danger")}}}catch(i){os.error("update cells danger status failed: ",i.message)}}function Cl(n,t,e=!0,r){try{const i=new Set,o=new Set;if(!e){$2(n,t,Array.from(i),Array.from(o));return}const{fromCol:s,toCol:l,fromRow:c,toRow:d}=RE(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);$2(n,t,Array.from(i),Array.from(o))}catch(i){os.error("update cell bars danger status failed: ",i.message)}}function H2(n,t,e){const{fromCol:r,toCol:i,fromRow:o,toRow:s}=RE(n,t),l=Kt.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}),En(n,{anchor:Ue(t,c.containerId,{colIndex:r,rowIndex:0}),focus:Ue(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}),En(n,{anchor:Ue(t,c.containerId,{colIndex:0,rowIndex:o}),focus:Ue(t,d.containerId,{colIndex:l.colCount-1,rowIndex:s})}))}const j2=["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 z2(n){return`style-bg-color-${n}`}function fu(n){return`${n}_background`}function HN(n,t,e){const r=fn(n),s=(e!=null?e:Kt.fromTable(r)).getCell(t).cell;for(let l=0;l<j2.length;l++){const c=j2[l];if(Mt(s,c))return c}}function G2(n,t,e){if(!n.isBlockWritable(t))return;const r=n.selection.range,o={...xt.default(n.getBlockData(t))},s=gl(n,t,r.start),l=gl(n,t,r.end);if(r.isSimple()){const c=s.childContainerId;e===-1?o[fu(c)]=void 0:o[fu(c)]=z2(e)}else{const c=Kt.fromBlock(t),d=Si(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 A=c.getCell({row:C,col:E});!h.has(A.containerId)&&A.col>=d.fromCol&&A.row>=d.fromRow&&A.col+A.colSpan-1<=d.toCol&&A.row+A.rowSpan-1<=d.toRow&&(h.add(A.containerId),e===-1?o[fu(A.containerId)]=void 0:o[fu(A.containerId)]=z2(e))}}n.updateBlockData(t,o)}function jN(n,t,e){if(!n.isBlockWritable(t))return;const i={...xt.default(n.getBlockData(t)),chart:e};n.updateBlockData(t,i)}const W2=D("table-chart");function zN(n,t){const e=EN(n,t);if(e){const r=e.querySelector(".editor-table-chart");if(r){const i=r.chartObject;i&&i.destroy(),r.remove()}}}function K0(n){var t;return(t=n.textContent)!=null?t:""}async function GN(n,t){if(!n.contains(t)||!n.isBlockWritable(t))return;if(!!!n.getBlockData(t).chart){zN(n,t);return}const i=[],o=Kt.fromBlock(t),s=["line","bar","pie","radar"],l=o.getCell({row:0,col:0}).container;let c=K0(l).trim().toLowerCase();new Set(s).has(c)||(c=s[0]);const d=[];for(let S=1;S<o.colCount;S++)d.push(K0(o.getCell({row:0,col:S}).container));for(let S=1;S<o.rowCount;S++){const U=o.getCell({row:S,col:0}),M=U.container,V=K0(M),rt=[];for(let ce=1;ce<o.colCount;ce++){const Oe=K0(o.getCell({row:S,col:ce}).container),pe=Number.parseFloat(Oe)||0;rt.push(pe)}let Y;const X=HN(t,U,o);X?Y=window.getComputedStyle(n.rootElement).getPropertyValue(`--${X}`).trim():Y=window.getComputedStyle(n.rootElement).getPropertyValue("--background-color").trim();let[ft,pt,ct,wt]=Y?Rp.fromString(Y).toRgbaArray():[];if(!ft&&!pt&&!ct&&!wt){const ce=(S-1)%n.options.colors.length;Y=n.options.colors[ce],[ft,pt,ct,wt]=Rp.fromString(Y).toRgbaArray()}const vt=Y,Gt=Rp.fromRgba([ft,pt,ct,wt/3]).toHexString();i.push({label:V,data:rt,borderColor:vt,backgroundColor:Gt,borderWidth:2})}const h=co(n,t);let C=null,E=h.querySelector(".editor-table-chart");E?C=E.chartObject:E=B("div",["editor-table-chart"],h);const A=E;p(W2,A,"no chart container");const v=n.getComponentOptions("table"),w=(v==null?void 0:v.chartCdn)||"https://cdn.jsdelivr.net/npm/chart.js@2.9.4/dist/Chart.min.js";try{await ia(w,"editor-chartjs");let S=!1;(C&&C.config.data.datasets.length>i.length||C&&C.config.data.datasets[0].data.length>i[0].data.length)&&(S=!0),C&&(c!==C.config.type||S)&&(C.destroy(),C=null,Array.from(E.querySelectorAll(".editor-chartjs-canvas")).forEach(V=>{V.remove()}));const U=Sp.default({},{type:c,data:{datasets:i,labels:d},options:{onClick:()=>{n.selection.selectBlock(t,0,0)}}});if(C)Sp.default(C.config,U),C.update();else{const V=B("canvas",["editor-chartjs-canvas"],A).getContext("2d");C=new window.Chart(V,U),E.chartObject=C}}catch(S){W2.error(`failed to resolve chart cdn: ${JSON.stringify(S)}`)}}async function q2(n,t){await gi.lock("updateTableChart");try{await GN(n,t)}finally{gi.release("updateTableChart")}}const X2=Pe.default(q2,1e3);let Y2=null;function wE(n,t,e){if(Y2!==t&&(X2.flush(),Y2=t),e.updateNow){q2(n,t);return}X2(n,t)}function SE(n,t,e){e&&dn(e)&&wE(n,e,{updateNow:!1})}function WN(n,t){dn(t)&&wE(n,t,{updateNow:!0})}const Zr={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"},V0={SCROLL_BAR:"container-scrollbar",FIXED:"fixed"},El={SCROLL_CONTAINER:"scroll-container",TOOL:"container-scroll-tool",CONTAINER:"scroll-container-root",MAC:"mac",SCROLL_AREA:"scroll-area"};function bd(n,t){return n.containers.get(t)}function Q2(n){return n.closest(`.${El.SCROLL_CONTAINER}`)}function Li(n){return n.firstElementChild}function er(n){return n.closest(`.${El.CONTAINER}`)}function vd(n){const t=er(n);let e=t.querySelector(`:scope >.${El.TOOL}`);return e||(e=B("div",[El.TOOL],t)),e}function qN(n){return er(n).firstElementChild}function XN(n,t){const e=bd(n,er(t));return e!=null&&e.barFloatWindowBottom?typeof e.barFloatWindowBottom=="function"?e.barFloatWindowBottom():e.barFloatWindowBottom:0}function ti(n,t){const e=Hr(n);return t/e}function Bd(n){const t=window.getComputedStyle(n),e=Hr(n);return{paddingBottom:parseFloat(t.paddingBottom)*e,paddingTop:parseFloat(t.paddingTop)*e,paddingLeft:parseFloat(t.paddingLeft)*e,paddingRight:parseFloat(t.paddingRight)*e}}function du(n){const t=Hr(n);return{scrollLeft:n.scrollLeft*t,scrollWidth:n.scrollWidth*t,clientWidth:n.clientWidth*t,clientHeight:n.clientHeight*t}}function YN(n,t){const e=Hr(n);return n[t]*e}function LE(n,t){const e=er(t),r=bd(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 QN(n,t){const e=LE(n,t),{maxLeft:r}=e;t.style.marginLeft=`${ti(t,0-r)}px`,t.style.paddingLeft=`${ti(t,r)}px`}function JN(n,t){const e=LE(n,t);t.style.marginRight=`${ti(t,0-e.maxRight)}px`}function ZN(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 J2=D("scroll-bar-handle"),tP=2;function hu(n){const t=vd(n);let e=t.querySelector(`.${V0.SCROLL_BAR}`);return e||(e=B("div",[V0.SCROLL_BAR],t),de.isWindows&&de.isFirefox&&(e.style.minHeight="10px")),p(J2,e instanceof HTMLDivElement,"invalid child for container tools"),e.firstElementChild||B("div",[],e),e}function $0(n,t){const e=Q2(t),r=hu(e),{scrollWidth:i,clientWidth:o}=du(e),{paddingLeft:s,paddingRight:l}=Bd(t),c=LE(n,e),{originWidth:d,maxRight:h}=c;JN(n,e),QN(n,e);const C=i-o;p(J2,r.firstElementChild instanceof HTMLDivElement,"invalid child for scroll bar"),r.style.width=`${ti(e,d+h-s-l)}px`,r.firstElementChild.style.width=`${ti(e,d+h+C-s-l)}px`}function eP(n,t){const e=Li(n),{paddingLeft:r}=Bd(e);if(Mt(t,"fixed")){const o=er(n).getBoundingClientRect();t.style.left=`${ti(n,o.left+r)}px`}else t.style.left=`${ti(n,r)}px`}function mu(n,t){var M;const e=n.getParentScrollContainer(),r=ZN(e),i=t.getBoundingClientRect(),o=hu(t),s=o.getBoundingClientRect(),l=bd(n,er(t)),c=XN(n,t),d=Li(t),{paddingTop:h,paddingBottom:C}=Bd(d),{scrollWidth:E,clientWidth:A}=du(t),v=document.documentElement.clientHeight-c,w=r.top+du(e).clientHeight-v,S=v+Math.min(0,w);if(E>A&&i.top+h<S-s.height&&i.bottom>S-s.height+C&&!((M=l==null?void 0:l.isSetScale)!=null&&M.call(l))){l!=null&&l.allowScrollBarFixed&&q(o,V0.FIXED);const V=w>0?c:0;o.style.bottom=`${Math.max(document.documentElement.clientHeight-r.bottom,0)+tP+V}px`}else ut(o,V0.FIXED),o.style.bottom=`${ti(t,C-s.height)}px`;eP(t,o)}class nP{constructor(t,e){m(this,"intersectionObserver");m(this,"handleIntersection",t=>{t.forEach(e=>{this.containers.get(er(e.target))?(this.handleIntersectionEntry(e),this.callback(e)):this.intersectionObserver.unobserve(e.target)})});m(this,"handleIntersectionEntry",t=>{const e=t.target;mu(this.scrollCore,e);const r=Li(e);$0(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 Ta=D("container-scroll-shadow");function Z2(n,t,e){const r=n,i=t.getBoundingClientRect(),o=e.getBoundingClientRect(),{paddingTop:s,paddingBottom:l}=Bd(e);r.style.top=`${ti(t,o.top-i.top+s)}px`,r.style.bottom=`${ti(t,i.bottom-o.bottom+l)}px`}function tk(n,t){const e=n;t<24?e.style.width=`${(t/3).toFixed(2)}px`:e.style.width=""}function rP(n){const t=vd(n);p(Ta,t,"no container tools");let e=t.querySelector(`.${Zr.LEFT}`);if(!e){const l=Li(n),c=[Zr.COMMON,Zr.LEFT];e=B("div",c,t),p(Ta,e instanceof HTMLDivElement,"invalid child for container tools"),Z2(e,n,l)}p(Ta,e instanceof HTMLElement,"invalid child for container tools");const i=er(n).getBoundingClientRect(),o=n.getBoundingClientRect();e.style.left=`${ti(n,o.left-i.left)}px`;const s=du(n).scrollLeft;p(Ta,e instanceof HTMLDivElement,"invalid child for container tools"),tk(e,s),q(e,Zr.ACTIVE)}function iP(n){const t=vd(n);let e=t.querySelector(`.${Zr.RIGHT}`);if(!e){const h=Li(n),C=[Zr.COMMON,Zr.RIGHT];e=B("div",C,t),p(Ta,e instanceof HTMLDivElement,"no div, create shadow failed"),Z2(e,n,h)}p(Ta,e instanceof HTMLElement,"");const i=er(n).getBoundingClientRect(),o=n.getBoundingClientRect();e.style.right=`${ti(n,i.right-o.right)}px`;const{scrollWidth:s,scrollLeft:l,clientWidth:c}=du(n),d=s-l-c;p(Ta,e instanceof HTMLDivElement,"no shadow element"),tk(e,d),q(e,Zr.ACTIVE)}function oP(n){const e=vd(n).querySelector(`.${Zr.LEFT}`);e&&ut(e,Zr.ACTIVE)}function sP(n){const e=vd(n).querySelector(`.${Zr.RIGHT}`);e&&ut(e,Zr.ACTIVE)}function yd(n){const{scrollLeft:t,scrollWidth:e,clientWidth:r}=du(n),i=Li(n),{paddingLeft:o,paddingRight:s}=Bd(i),l=YN(i,"offsetLeft");e-o<=r-s||e-o<=t+r-s?sP(n):iP(n),i&&t>=l+o?rP(n):oP(n)}class lP{constructor(t,e){m(this,"resizeObserver");m(this,"handleResizeEntry",t=>{const e=t.target,r=Li(e);yd(e),$0(this.scrollCore,r),mu(this.scrollCore,e),this.callback(e)});m(this,"handleContentResize",t=>{t.forEach(e=>{this.containers.get(er(e.target))?this.handleResizeEntry(e):this.unbind(e.target)})});this.scrollCore=t,this.callback=e,this.resizeObserver=new ta(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 ek=D("container-scroll-observer");class aP{constructor(t,e){m(this,"handleContentScroll",t=>{const e=t.target;p(ek,e instanceof Element,"invalid target for scroll event");const r=hu(e);r.removeEventListener("scroll",this.handleScroll);const i=!0;this.fixScrollXPos(e,e.scrollLeft,i),this.bind(r),yd(e),this.callback(e)});m(this,"handleScroll",t=>{const e=t.target;p(ek,e instanceof HTMLElement,"");const r=e.scrollLeft,i=!1,o=qN(e);this.unbindContentScroll(o),this.fixScrollXPos(o,r,i),this.bindContentScroll(o),yd(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",Pe.default(this.bindContentScrollCore,300));m(this,"bind",Pe.default(this.bindCore,200));this.scrollCore=t,this.callback=e}fixScrollXPos(t,e,r){const i=hu(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 cP{constructor(t){m(this,"scrollContainers",new Set);m(this,"handleParentContainerScroll",()=>{this.scrollContainers.forEach(t=>{mu(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 uP=D("scroll-wrap-resize-observer");class fP{constructor(t){m(this,"resizeObserver");m(this,"handleScrollWrapResize",t=>{t.forEach(e=>{this.containers.get(er(e.target))?this.handleScrollWrapResizeEntry(e):this.unbind(e.target)})});m(this,"handleScrollWrapResizeEntry",t=>{const e=t.target;p(uP,e instanceof HTMLElement,"invalid target for observer entry");const r=Q2(e);$0(this.scrollCore,e),yd(r),mu(this.scrollCore,r)});this.scrollCore=t,this.resizeObserver=new ta(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 dP{constructor(t,e){m(this,"resizeObserver");m(this,"scrollContainersMap",new Map);m(this,"handleResizeEntry",t=>{t==null||t.forEach(e=>{const r=Li(e);yd(e),$0(this.scrollCore,r),mu(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 ta(this.handleResize)}bind(t){var i,o;const e=er(t),r=(i=bd(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=er(t),r=(o=bd(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 uat="";class hP extends He.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=Li(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=>{mu(this,r)})});this.parentContainer=e}load(){this.containerResizeObserver||(this.containerResizeObserver=new lP(this,this.handleResize)),this.containerScrollObserver||(this.containerScrollObserver=new aP(this,this.handleScrollContainerScroll)),this.parentContainerScrollObserver||(this.parentContainerScrollObserver=new cP(this)),this.scrollWrapResizeObserve||(this.scrollWrapResizeObserve=new fP(this)),this.locatingContainerResizeObserver||(this.locatingContainerResizeObserver=new dP(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=hu(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=hu(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(er(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 nP(this,this.handleIntersection)),this.containerIntersectionObserver.bind(i)}unbind(e){var o;const r=e.firstElementChild,i=Li(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 nk=D("scroll-container"),H0=new Map;class mP extends He.TypedEmitter{constructor(){super(...arguments);m(this,"scrollListener");m(this,"options");m(this,"scrollContainerElement");m(this,"init",e=>{this.options=e;const r=B("div",[El.CONTAINER],e.parentElement);de.isMac&&q(r,El.MAC);const i=B("div",[El.SCROLL_CONTAINER],r),o=B("div",[El.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=H0.get(s),this.scrollListener||(this.scrollListener=new hP(s),H0.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(nk,this.scrollContainerElement,"scrollContainerElement cannot be undefined"),Li(this.scrollContainerElement)}get scrollOptions(){return p(nk,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=er(this.contentElement);e&&H0.forEach((i,o)=>{i.unbind(e),i.containers.size===0&&(this.handleBaseListenerDestroy(i),H0.delete(o))})}}function gP(){return new mP}const IE=D("column-width");function pP(n,t,e){const r=xN(n,t);r.style.width=`${e}px`,r.style.minWidth=`${e}px`}function CP(n){const e=Array.from(n.querySelector("colgroup").children).map(c=>c.getBoundingClientRect().width);if(e[0]!==0)return e;const r=Kt.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)}),IE.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],A=(d-C)/(c-h);for(let v=h+1;v<c;v++)i[v]=C+A*(v-h)}IE.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 IE.debug(`widths: ${s.join()}`),s}function Td(n){return Array.from(n.querySelector("colgroup").children).map(r=>r.getBoundingClientRect().width||Number.parseInt(r.style.width,10))}const DE=200,EP=40,AP=D("table-resize-gripper"),rk=7,_E=(rk-1)/2,xP=3;function bP(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)<=_E&&d.top<=e&&e<=d.bottom)return c}}return null}function vP(n){return!!n.rootContainer.querySelector(".table-resize-gripper")}function ME(n,t){return co(n,t).querySelector(".table-resize-gripper")}function ik(n,t){const e=ME(n,t);p(AP,!e,"resize gripper has already exists");const r=co(n,t),i=B("div",["table-resize-gripper","table-indicator"],r);return B("div",["table-resize-gripper-indicator"],i),i}function ok(n,t,e){let r=ME(n,t);r||(r=ik(n,t));const o=fn(t).getBoundingClientRect(),s=e.getBoundingClientRect(),l=0,c=o.height,d=n.getCustom(ao(t)).contentElement.getBoundingClientRect(),h=s.right-d.left;r.style.left=`${h-_E-uu-xd}px`,r.style.top=`${l}px`,r.style.height=`${c}px`,r.style.width=`${rk}px`}function UE(n){n.rootContainer.querySelectorAll(".table-resize-gripper").forEach(t=>{t.remove()})}function BP(n,t,e){const i={...n.getBlockData(t),colsWidth:e};n.updateBlockData(t,i,void 0,{noScroll:!0})}function yP(n,t,e,r){const i=t,o=Kt.fromTable(e),s=o.getCellByCellElement(i),l=s.col+s.colSpan-1,c=Td(e);let d=r;const h=(E,A)=>{const v=A+1,w=E.col+E.colSpan;return c.slice(v,w).reduce((U,M)=>U+M,0)},C=new Set;for(let E=0;E<o.rowCount;E++){const A=o.getCell({row:E,col:l});if(C.has(A.cell))continue;C.add(A.cell);const v=A.cell,w=v.getBoundingClientRect();let S=r-w.left+_E-xP;const U=Cd(v),M=p1(n,U)||EP*A.colSpan,V=h(A,l),rt=M-V;S<rt&&(S=rt);const Y=w.left+S;d=Math.max(d,Y)}return d}const TP=D("table-resize-drag-drop");class kP{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=yP(this.editor,c,s,e.x-t.dragOffsetX)-s.getBoundingClientRect().left;p(TP,c,"no dragging cell");const E=Kt.fromTable(s).getCellByCellElement(c),A=E.col+E.colSpan-1,v=Td(s),w=v.slice(0,A).reduce((U,M)=>U+M,0),S=h-w;if(pP(s,A,S),S){const U=parseFloat(s.style.minWidth);s.style.minWidth=`${U+(S-v[A])}px`}ok(this.editor,l,c),this.editor.selection.caret.update()}onDragEnd(t,e,r,i,o){const s=Td(t.data.table);BP(this.editor,t.data.block,s),UE(this.editor),this.onEnd&&(this.onEnd(e),this.onEnd=null)}}function RP(n,t){const e=Fe(t.x,t.y);if(!e)return null;const r=et(e);return!r||!n.contains(r)||!dn(r)?null:r}D("table-resize");class wP{constructor(t){m(this,"draggingRefCell",null);m(this,"handleMouseMove",(t,e)=>{if(t.readonly||window.isDragging||t.selectionHandler.isSelecting()&&!this.draggingRefCell||this.draggingRefCell)return;const r=e.target;if(!(r instanceof Element))return;const i=et(r);if(!i||Ot(i)!=="table"||r.closest(".table-indicator"))return;const s=e,l=RP(t,s);if(!l||!M2(l)||!t.isBlockWritable(l)){UE(t);return}this.updateGripper(l,s.x,s.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=fn(t),o=bP(i,e,r);if(o){if(!ME(this.editor,t)){if(vP(this.editor))return;const l=ik(this.editor,t),c={block:t,table:i,draggingRefCell:o};Fp(new kP(this.editor,l,c,d=>{this.updateGripper(t,d.x,d.y)}))}ok(this.editor,t,o)}else UE(this.editor)}}function sk(n){n.addCustom("table-mouse-event-handler",t=>new wP(t))}const lk=D("table-insert-column");function ak(n,t,e){n.undoManager.runInGroup(()=>{var E;const r=fn(t),i=Kt.fromTable(r),o=i.colCount;p(lk,e>=0&&e<=o,`insert index ${e} is out of range [0, ${o}]`);const s=i.map(A=>A.containerId),l=new Set;n.doc.beginBatchUpdate();for(let A=0;A<s.length;A++){const v=s[A],w=v[e-1],S=v[e];if(e===0||e===v.length||w!==S){const U=Yo(n.doc);v.splice(e,0,U)}else v.splice(e,0,w),l.add(w)}n.doc.endBatchUpdate();const c=xt.default(n.getBlockData(t));l.forEach(A=>{const v=`${A}_colSpan`,w=c[v];p(lk,typeof w=="number"&&w>1,`no colSpan for containerId ${A}, ${w}`),c[v]=w+1});const d=((E=c.colsWidth)==null?void 0:E.concat())||new Array(c.cols).fill(0);d.splice(e,0,DE);const h=Kt.virtualCellContainersGridToChildren(s),C={...c,cols:c.cols+1,children:h,colsWidth:d};ml(C),n.updateBlockData(t,C)})}const j0=D("table-insert-row");function OE(n,t,e){n.undoManager.runInGroup(()=>{const r=fn(t),i=Kt.fromTable(r),o=i.rowCount;p(j0,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 A=e>0&&s[e-1][E],v=e<i.rowCount&&s[e][E];if(p(j0,A||v,"no top and bottom cell"),e===0||e===i.rowCount||A!==v){const w=Yo(n.doc);c.push(w)}else p(j0,A,"no top cell"),c.push(A),l.add(A)}n.doc.endBatchUpdate(),s.splice(e,0,c);const d=xt.default(n.getBlockData(t));l.forEach(E=>{const A=`${E}_rowSpan`,v=d[A];p(j0,typeof v=="number"&&v>1,`no rowSpan for containerId ${E}, ${v}`),d[A]=v+1});const h=Kt.virtualCellContainersGridToChildren(s),C={...d,rows:d.rows+1,children:h};ml(C),n.updateBlockData(t,C)})}const NE=D("paste-table-in-table-block");function SP(n,t,e,r,i){let o=Kt.fromBlock(e);const s=t.blocks.root[0];p(NE,s,"no table data"),p(NE,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,A=C+d,v=E+h,w=[];for(let S=C;S<A&&S<o.colCount;S++)for(let U=E;U<v&&U<o.rowCount;U++){const M=o.getCell({col:S,row:U});M.virtual?M.virtual&&w.push({col:S,row:U}):(M.colSpan>1||M.rowSpan>1)&&w.push({col:S,row:U})}n.undoManager.runInGroup(()=>{if(n.doc.beginBatchUpdate(),w.forEach(pt=>{const ct=Kt.fromBlock(e).getCell(pt);(ct.colSpan>1||ct.rowSpan>1)&&BE(n,e,pt)}),A>o.colCount)for(let pt=o.colCount;pt<A;pt++)ak(n,e,pt);if(v>o.rowCount)for(let pt=o.rowCount;pt<v;pt++)OE(n,e,pt);o=Kt.fromBlock(e);const S=new U0(l);let U;for(let pt=0;pt<S.colCount;pt++)for(let ct=0;ct<S.rowCount;ct++){const wt=S.getCell({col:pt,row:ct});if(!wt.virtual){const vt=lC(n.editorBlocks,t,wt.containerId,i),Gt=C+pt,ce=E+ct,Oe={col:Gt,row:ce},pe=o.getCellContainer(Oe);o5(n,pe,vt,i),U=pe}}const M={},V=[];for(let pt=0;pt<S.colCount;pt++)for(let ct=0;ct<S.rowCount;ct++){const wt=S.getCell({col:pt,row:ct}),vt=C+pt,Gt=E+ct,ce={col:vt,row:Gt},pe=o.getCell(ce).containerId;wt.virtual?V.push(pe):(wt.colSpan!==1&&(M[`${pe}_colSpan`]=wt.colSpan),wt.rowSpan!==1&&(M[`${pe}_rowSpan`]=wt.rowSpan),wt.background&&(M[`${pe}_background`]=wt.background))}const rt=n.getBlockData(e);V.length>0&&V.forEach(pt=>{rt.children=rt.children.filter(ct=>ct!==pt)});const Y={...rt,...M};ml(Y),p(NE,U,"no last container");const X=We(U);n.selection.selectBlock(X,At(n,X));const ft=Y;n.updateBlockData(e,ft),n.doc.endBatchUpdate()})}const PE=D("paste-in-table-block");class LP{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,A,v,w;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=at(i);if(ie(o))return this.pasteData=void 0,!1;if(!Of(t,o))return this.pasteData=void 0,!1;const s=et(o);if(p(PE,s,"no parent block"),!dn(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;PE.debug("paste child table in table");const d=Kt.fromBlock(s).getCellByContainerId(Et(o)).cell;kC(t,e);const h={blockIdMap:new Map,containerIdMap:new Map,boxIdMap:new Map};SP(t,e,s,d,h),p(PE,this.pasteData,"invalid paste data");const C=[];t.input.forEach(S=>{C.push(S)});for(let S=0;S<C.length&&!await((A=(E=C[S]).handleAfterPasteDoc)==null?void 0:A.call(E,t,e,h));S++);for(let S=0;S<C.length&&!await((w=(v=C[S]).handleAfterPaste)==null?void 0:w.call(v,t,this.pasteData.event,this.pasteData.doc));S++);return this.pasteData=void 0,!0}}function ck(n){n.addCustom("table-block-paste-event",t=>new LP(t))}const FE=D("table-select-columns");function IP(n,t,e,r,i){p(FE,dn(t),"is not a table block");const o=Kt.fromBlock(t);p(FE,e>=0&&e<o.colCount,"invalid from"),p(FE,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=Ue(t,s.containerId,{colIndex:e,rowIndex:0}),d=Ue(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 KE=D("table-select-columns");function DP(n,t,e,r,i){p(KE,dn(t),"is not a table block");const o=Kt.fromBlock(t);p(KE,e>=0&&e<o.rowCount,"invalid from"),p(KE,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=Ue(t,s.containerId,{rowIndex:e,colIndex:0}),d=Ue(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 fat="",uk=D("get-toolbar-reference-client");function fk(n,t){const e=n.selection.range;if(!e.isSimple()){p(uk,e.start.blockId===e.end.blockId,"invalid selection range");const s=n.getBlockById(e.start.blockId);p(uk,Pt(n,s),"not a complex block");const l=le(n,s);if(l.getTextToolbarReferenceClient){const c=l.getTextToolbarReferenceClient(n,s);if(c)return c}}const r=e.isReverse()?t.start:t.end,i=En(n,{anchor:r,focus:r}),o=Vo(n,t.block,i);if(o.length!==0)return o[0]}function _P(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 z0(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=Ip.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=z0(i),_P(s))}),e}function G0(n){return n.findCustom("toolbar-handler")}const dat="";class MP{constructor(){m(this,"linkPopup",null);m(this,"form",{});m(this,"onFinished",null);m(this,"onClose",null);m(this,"onBeforeFormatUrl",null);m(this,"handleOk",async()=>{var t;try{await this.checkValue();const{linkText:e,linkUrl:r}=this.form,i=r.getInputValue();let o="";this.onBeforeFormatUrl&&this.onBeforeFormatUrl(i)!==!1?o=this.onBeforeFormatUrl(i):o=this.formatUrl(i),(t=this.onFinished)==null||t.call(this,e.getInputValue()||o,o),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,e)=>{var r;if(!e){if(t.key==="Enter"){(r=this.form.linkUrl)==null||r.getField().focus(),t.stopPropagation();return}t.key==="Escape"&&this.handleClose()}});m(this,"handleUrlKeyboard",(t,e)=>{if(!e){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(_.t("link.urlPlaceholder")),new Error(_.t("link.urlPlaceholder"))}formatUrl(t){if(!t)return"";try{new URL(t)}catch{return`${window.location.protocol}//${t}`}return t}editLink(t){var C,E;const{target:e,linkText:r,linkUrl:i,onFinished:o,onClose:s,onBeforeFormatUrl:l,placement:c="bottom-start"}=t;this.linkPopup=new su(this.createPopupContent(r,i)),this.linkPopup.addListener("show",this.onShow),this.linkPopup.manualShow(e,{theme:"light",placement:c}),this.onFinished=o,s&&(this.onClose=s),l&&(this.onBeforeFormatUrl=l);const d=(C=this.linkPopup)==null?void 0:C.content.querySelector('[data-button-id="submit-button"]'),h=(E=this.linkPopup)==null?void 0:E.content.querySelector('[data-button-id="cancel-button"]');d==null||d.addEventListener("click",this.handleOk),h==null||h.addEventListener("click",this.handleClose)}createPopupContent(t,e){const r=B("div",["link-popup-content"],null);this.form.linkText=M0(r,{label:_.t("link.textLabel"),required:!1,placeholder:_.t("link.textPlaceholder"),defaultValue:t,onChange:this.onChange,onKeyDown:this.handleTextKeyboard}),this.form.linkUrl=M0(r,{className:"link-popup-gap",label:_.t("link.urlLabel"),required:!0,placeholder:_.t("link.urlPlaceholder"),defaultValue:e,onChange:this.onChange,onKeyDown:this.handleUrlKeyboard});const i=B("div",["link-popup-footer"],r),o=Jr("cancel-button",_.t("link.cancelText"));i.appendChild(o);const s=Jr("submit-button",_.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 kd(n,t){const e=n.addCustom("link-editor",()=>new MP),r=n.getComponentOptions("link"),i={...t,...r};e.editLink(i)}const UP=D("link-popup");function OP(n){return Mt(n,"link")}function Rd(n){var t,e;return(e=(t=n.getAttribute("link"))!=null?t:n.textContent)!=null?e:""}function NP(n,t,e){var i,o,s,l;if(n.isBlockWritable(t)&&e&&yr(e)){const c=e,d=(o=(i=n.editorBoxes.getBoxClass(If(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&&st(n,t)&&OP(e)){const c=B("a",["link-href-button"],null,Rd(e));c.href=Rd(e),c.target="_blank",c.rel="noopener noreferrer";const d=[{id:"link-text",name:Rd(e),disableTooltip:!0,element:c},{id:"edit-link",name:_.t("link.edit"),icon:I0},{id:"remove-link",name:_.t("link.remove"),icon:UT}];return{element:e,commands:d}}return Qv(n,t,"hovering-toolbar")}function dk(n,t,e){var l;const r=rl(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 PP(n,t,e){const[r,i]=dk(n,t,e);n.selection.selectBlock(t,r.start,r.end);const o=Rd(e),s=(h,C)=>{try{const E=n.getBlockText(t),A=V1(E,r.start,r.end-r.start),v=qo(A,r.start,h,{link:C});n.setBlockText(t,v),n.selection.selectBlock(t,r.start+h.length),n.focus()}catch(E){UP.error(E)}},l=()=>{n.selection.selectBlock(t,r.end),n.focus()},c=Vo(n,t,n.selection.range)[0];if(!c)return;const d=jo(n,t,"link-button-anchor",c);kd(n,{target:d,linkText:i,linkUrl:o,onFinished:s,onClose:l})}function FP(n,t,e){const[r]=dk(n,t,e),i=n.getBlockText(t),o=Rd(e),s=$c(r.start,r.end-r.start,i,"link",o);n.setBlockText(t,s),n.selection.selectBlock(t,r.end)}function KP(n,t,e,r){var s,l,c;if(e){if(n.isBlockWritable(t)&&yr(e)){const h=e,C=(l=(s=n.editorBoxes.getBoxClass(If(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=G0(n);d==null||d.disableTextToolbar(),d==null||d.hide(),setTimeout(()=>{d==null||d.enableTextToolbar()},400),r.id==="edit-link"?PP(n,t,e):r.id==="remove-link"&&FP(n,t,e);return}const i=Yv(n,t);if(!i)return;const o=(c=i.blockCommands)==null?void 0:c["hovering-toolbar"];!o||o.executeCommand(n,t,r)}function W0(){let n=8;for(;n>0&&!document.querySelector(`div[data-style-heading='${n}']`);)n--;return n}function ei(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!(!st(n,r)||$f(n,r,e.start.offset).charType!=="box")}const VP=[b0,v0,B0,y0,T0,k0,R0,w0];class $P{constructor(t){m(this,"id","BlockTurnIntoCommandProvider");this.editor=t}getHeadingIndex(){let t=W0();return t<=4?t=5:t<8&&(t+=1),t}getAvailableCommands(t,e,r){if(!st(t,e))return[];if(ei(t))return[];const i=dt(e),o=Ot(e),s=Ei(t,e),c=t.getBlockData(e).heading,d=[];for(let C=0;C<this.getHeadingIndex();C++)d.push({id:`heading-${C+1}`,name:_.t("commands.heading",{name:`${C+1}`}),icon:VP[C],states:c===C+1?["checked"]:[],value:`${C+1}`});const h=C=>{var A;const E=B("span",["toolbar-item-name-container"],null);for(const v of C.children)if((A=v.states)!=null&&A.includes("checked"))return E.innerHTML=v.icon||iu,E;return E.innerHTML=iu,E};return[{id:"turn-into",name:_.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:_.t("commands.text"),icon:iu,states:c?[]:["checked"]},...d],childrenType:"menu"}]}applyHeadingStyle(t,e,r){t.updateBlockData(e,{heading:r})}executeCommand(t,e,r,i){if(ei(t))return!1;if(st(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 HP=8,qe=D("list-block"),q0=D("list-block");function Ht(n){return Ot(n)==="list"}function nn(n){p(q0,Ht(n),"not a list block")}function wr(n){nn(n);const t=n.getAttribute("data-list-type");return p(q0,t,"no list type"),t}function X0(n){return Ht(n)&&wr(n)==="text-only"}function Sr(n){var t,e;return nn(n),(e=Number.parseInt((t=n.getAttribute("data-list-start"))!=null?t:"1",10))!=null?e:1}function Un(n){var t,e;return nn(n),(e=Number.parseInt((t=n.getAttribute("data-list-level"))!=null?t:"1",10))!=null?e:1}function gu(n){nn(n);const t=n.getAttribute("data-list-group-id");return p(q0,t,"no group id"),t}function uo(n){var o,s,l,c,d;nn(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(q0,i,"no group id"),{type:t,start:e,level:r,groupId:i}}function Y0(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 jP(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 zP="abcdefghijklmnopqrstuvwxyz";function hk(n){if(n<=0)return`${n}`;const t=(n-1)%26,e=Math.floor((n-1)/26),r=zP[t];return e?hk(e)+r:r}function GP(n){return`${n}`}const mk=[GP,hk,jP];function WP(n,t){const e=mk[(n-1)%mk.length];return e(t)}function qP(n){return["\u2022","\u25E6","\u25AA"][(n-1)%3]}function Al(n,t){nn(n);const{level:e,groupId:r,type:i}=uo(n);let o=ze(n);for(;o;){if(!Ht(o)){o=ze(o);continue}const{level:s,groupId:l,type:c}=uo(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=ze(o)}return null}function gk(n){return Al(n,{ignoreGroupId:!0})}function ka(n){nn(n);const{level:t,groupId:e,type:r}=uo(n);let i=ae(n);for(;i;){if(Ht(i)){const{level:o,groupId:s,type:l}=uo(i);if(t===o&&e===s&&(l==="text-only"||r==="text-only"||r===l))return i;if(o<t)return null}i=ae(i)}return null}function pk(n){nn(n);const t=[];let e=Al(n);for(;e;)t.unshift(e),e=Al(e);return t}function pu(n){nn(n);const t=[];let e=ka(n);for(;e;)t.push(e),e=ka(e);return t}function wd(n){nn(n);let t=Al(n);for(;t;){const e=Al(t);if(!e)return t;t=e}return n}function XP(n){nn(n);let t=ka(n);for(;t;){const e=ka(t);if(!e)return t;t=e}return null}function Ck(n,t){const e=pk(n),r=pu(n);return t.withSelf?[...e,n,...r]:[...e,...r]}function Q0(n){nn(n);let t=n;const e=pk(n);e.length>0&&(t=e[0]);const r=ze(t);return!r||!Ht(r)?null:Un(r)<Un(t)?r:null}function YP(n,t){nn(n);let e=n;for(;e;){const r=Un(e);if(r===t)return e;if(r>t)e=Q0(e);else if(r<t)return null}return null}function QP(n){let t=wd(n);for(;;){const e=Q0(t);if(!e)return t;t=wd(e)}}class JP{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(qe,i,"no parent node"),i.children.push(r)}else this.rootNodes.push(r)}}function Ek(n,t){const e=QP(t),r=new JP;r.addNode(null,e);let i=ae(e);for(;i&&Ht(i);){if(X0(i)){r.addNode(null,i),i=ae(i);continue}if(Un(i)===0&&wr(i)!==wr(e))break;const s=Q0(i);r.addNode(s,i),i=ae(i)}return r.rootNodes}function ZP(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 Ak(){const e=(document.exitFullscreen||document.webkitExitFullscreen).bind(document)();try{document.fullscreenElement=null}catch{}return e}function VE(n){return Mt(n,"editor-in-mindmap-first")}function $E(n){if(p(qe,Ht(n),"not a list block"),Mt(n,"editor-in-mindmap-first")||!Zs(n))return!0;const t=n.classList,e="editor-mindmap-root-";return!!Array.from(t).find(i=>{if(i.startsWith(e))return i})}function tF(n,t,e){const r=at(n);if(t){const s=at(t);p(qe,r===s,"invalid block container")}const i=Rt(n);if(t){const s=Rt(t);p(qe,i<=s,"invalid block index")}if(q(n,...e),!t||t===n)return;let o=ae(n);for(;o!==t;)p(qe,o,"no next button"),q(o,...e),o=ae(o);o&&q(o,...e)}function eF(n){const t=`editor-mindmap-root-${n.id}`,r=at(n).querySelectorAll(`.${t}`);return r[r.length-1]}async function nF(n,t,e){const r=ve(t),i=r.querySelector('[data-button-id="mindmap-fullscreen"]');p(qe,i,"no full screen button");const o=()=>{setTimeout(()=>{e.toMindmap(n,t,{},{reset:!0,mindmapTools:e})},300)},s=()=>{ut(r,"fullscreen"),i.innerHTML=fE,i.setAttribute(`data-editor-tooltip-${n.clientId}-dynamic`,_.t("mindmap.fullScreen")),$E(t)&&setTimeout(()=>{o()},300)};if(document.fullscreenElement===r){try{await Ak()}catch(l){qe.error(l)}s()}else{try{q(r,"fullscreen"),await ZP(r),o()}catch(l){qe.error(l)}i.innerHTML=C2,i.setAttribute(`data-editor-tooltip-${n.clientId}-dynamic`,_.t("mindmap.exitFullscreen"))}r.onfullscreenchange=()=>{document.fullscreenElement||s()}}function HE(n,t,e,r,i){if(t.querySelector(`[data-button-id="${e}"]`))return null;const s=Jr(e,r,i,[]);return s.setAttribute(`data-editor-tooltip-${n.clientId}-dynamic`,r),q(s,"mindmap-button"),t.appendChild(s),s}function jE(n,t){return n.querySelector(`[data-button-id="${t}"]`)}function rF(n){return jE(n,"mindmap-fullscreen")}function iF(n){return jE(n,"mindmap-fit")}function oF(n){return jE(n,"mindmap-close")}function sF(n,t,e,r){const i=HE(n,t,"mindmap-close",_.t("mindmap.close"),A0);!i||n.domEvents.addEventListener(i,"click",()=>{r.closeMindmap(n,e)})}function lF(n,t,e,r){const i=HE(n,t,"mindmap-fit",_.t("mindmap.autoFit"),p2);!i||n.domEvents.addEventListener(i,"click",()=>{r.fitMindmap(n,e)})}function aF(n,t,e,r){if(navigator.userAgent.includes("Mobile")&&!navigator.userAgent.includes("iPad"))return;const o=HE(n,t,"mindmap-fullscreen",_.t("mindmap.fullScreen"),fE);!o||n.domEvents.addEventListener(o,"click",()=>{nF(n,e,r)})}function cF(n,t){const e=ym(t);if(!e)return;const r=iF(e);r&&(r.remove(),n.domEvents.removeAllListeners(r));const i=oF(e);i&&(i.remove(),n.domEvents.removeAllListeners(i));const o=rF(e);o&&(o.remove(),n.domEvents.removeAllListeners(o))}const Cu=new Map;function zE(n,t,e){const r=(s,l)=>{s.forEach(c=>{l?q(c.block,"to-mindmap-highlight"):ut(c.block,"to-mindmap-highlight"),r(c.children,l)})},i=Ek(n,t);if(i.length===0)return;const o=i[0].block;if(e){const s=Cu.get(o);s&&(s.forEach(l=>l.cancel()),Cu.delete(o)),r(i,!0)}else{const s=setTimeout(()=>{r(i,!1),Cu.delete(o)},300),l=()=>{clearTimeout(s),Cu.delete(o)},c=Cu.get(o);c?c.push({cancel:l}):Cu.set(o,[{cancel:l}])}}const{Markmap:uF}=p9;function fF(n,t){nn(t);const e=Ek(n,t),r=e[0].block,i=d=>({type:"text",content:zt(d.block).textContent,depth:1,children:d.children.length>0?d.children.map(C=>i(C)):void 0});let o=null;e.length>1?o={type:"root",content:"root",depth:0,children: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 J0(n,t,e,r){const{root:i,block:o,last:s}=fF(n,t);r.selectBlock&&n.selection.selectBlock(o,0,0),zE(n,o,!1),r.saveData&&n.updateBlockData(o,{viewAsMindmap:!0});const l=ve(o);let c=l.querySelector(".editor-mindmap-svg");if(r.reset&&(c&&c.remove(),c=null),c)c.innerHTML="";else{const U="http://www.w3.org/2000/svg",M=l.getBoundingClientRect(),V=document.fullscreenElement===l,rt=V?`${M.width}`:`${t.getBoundingClientRect().width}`,Y=V?`${M.height}`:"600",X=document.createElementNS(U,"svg");X.setAttributeNS(null,"viewBox",`0 0 ${rt} ${Y}`),X.setAttributeNS(null,"width","100%"),X.setAttributeNS(null,"height",Y),X.style.display="block",X.style.width="100%",X.style.height=`${Y}px`,X.classList.add("editor-mindmap-svg"),l.appendChild(X),c=X}const d=o,C=`editor-mindmap-root-${dt(o)}`;q(d,"editor-in-mindmap-first",C,"readonly"),d.contentEditable="false";const E=ae(o);E&&Rt(E)<=Rt(s.block)&&tF(E,s.block,["block-hidden",C]);const A=(U,M)=>{if(M.length>0){const V=M[0].parentElement;V&&(V.style.width="100vw",V.style.maxWidth="200px")}M.forEach(V=>{q(V,"editor-mindmap-node")})},v=new uF(c,{...e,autoFit:!0});v.viewHooks.transformHtml.tap(A),v.setData(i),v.fit();const w=ve(o);let S=w.querySelector(".mindmap-toolbar");S||(S=B("div",["mindmap-toolbar"],w)),lF(n,S,d,r.mindmapTools),aF(n,S,d,r.mindmapTools),sF(n,S,d,r.mindmapTools),n.domEvents.addEventListener(c,"click",()=>{n.selection.selectBlock(o,0),n.input.focus()}),d.mindMap=v}function dF(n){const t=B("div",["list-to-mindmap-wrap"],null),e=Jr("list-to-mindmap",_.t("mindmap.viewAsMindMap"),g2,[],n.clientId);return t.appendChild(e),t}async function xk(n,t){const e=`editor-mindmap-root-${t.id}`,r=at(t);ke(r).forEach(l=>{Mt(l,e)&&ut(l,e,"editor-in-mindmap-first","block-hidden")});const o=ve(t);document.fullscreenElement===o&&await Ak();const s=o.querySelector(".editor-mindmap-svg");!s||(p(qe,s,"no mindmap svg"),s.remove(),n.domEvents.removeAllListeners(s),cF(n,t))}function hF(n){const t=n.classList,e="editor-mindmap-root-";return Array.from(t).find(i=>{if(i.startsWith(e))return i})}async function bk(n,t){!hF(t)||(n.updateBlockData(t,{viewAsMindmap:null}),xk(n,t),n.selection.selectBlock(t,0))}function mF(n,t){const e=t.mindMap;e&&e.fit()}const Z0={toMindmap:J0,closeMindmap:bk,fitMindmap:mF},hat="";class tg{constructor(t){m(this,"toMindmapButton");m(this,"currentBlock",null);m(this,"handleHoveringBlock",t=>{t&&Ht(t)&&wr(t)!=="unchecked"&&wr(t)!=="checked"&&this.editor.isWritable()?ve(t).appendChild(this.toMindmapButton):this.toMindmapButton.remove()});m(this,"handleMouseEnter",()=>{const t=et(this.toMindmapButton);p(qe,t&&Ht(t),"no parent list"),zE(this.editor,t,!0),this.currentBlock=t});m(this,"handleMouseLeave",()=>{this.currentBlock&&(zE(this.editor,this.currentBlock,!1),this.currentBlock=null)});m(this,"handleClick",()=>{const t=et(this.toMindmapButton);p(qe,t&&Ht(t),"no parent list"),J0(this.editor,t,{},{saveData:!0,selectBlock:!0,mindmapTools:Z0})});this.editor=t,je.get(this.editor).addListener("change",this.handleHoveringBlock),this.toMindmapButton=dF(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(tg)}destroy(){je.get(this.editor).removeListener("change",this.handleHoveringBlock)}hide(){this.currentBlock&&(this.currentBlock=null),this.toMindmapButton.remove()}}function gF(n,t,e){var r;t==="beginDrag"&&((r=tg.get(n))==null||r.hide())}function Eu(n,t,e,r){var o;const i=(o=r==null?void 0:r.groupId)!=null?o:it();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 GE(n,t,e,r){const i=Ck(t,{withSelf:!0});i.length!==0&&Eu(n,i,e,r)}class Au{constructor(t,e){m(this,"listStart",0);m(this,"listBrother",null);if(this.editor=t,X0(e))return;const r=wd(e),i=Sr(r);this.listStart=i,r===e?this.listBrother=ka(r):this.listBrother=r}fix(){if(!!this.listBrother){if(xf(this.listBrother)){this.listBrother=null;return}GE(this.editor,this.listBrother,this.listStart)}}}class Ra{constructor(t,e,r){m(this,"listStart");m(this,"listBrother",null);this.editor=t,this.options=r;const i=wd(e),o=Sr(i);this.listStart=o,this.listBrother=i,r!=null&&r.resetStart&&(this.listStart=1)}fix(){!this.listBrother||GE(this.editor,this.listBrother,this.listStart,this.options)}}class vk{constructor(t,e,r){m(this,"listStart");m(this,"listNextBrothers",[]);this.editor=t,this.listNextBrothers=pu(e);const{start:i,resetStart:o}=r||{};this.listStart=o?1:i!=null?i:1}fix(){!this.listNextBrothers.length||Eu(this.editor,this.listNextBrothers,this.listStart)}}function pF(n,t,e){n.getBlockData(t).quoted&&(e.quoted=!0)}function WE(n,t,e,r){if(qe.debug("drag a block on a list block"),!st(n,t))return!1;p(qe,Ht(e),"target is not a list block");const{type:i,start:o,level:s,groupId:l}=uo(e),c=r==="after"?o+1:o,d=n.getBlockData(t),h={id:it(),type:"list",groupId:l,level:s,start:c,text:d.text,...Y0(i)};pF(n,e,h);let C=Rt(e);const E=at(e);r==="after"&&(C+=1);let A=null;Ht(t)&&(A=new Au(n,t));const v=n.insertBlock(Et(E),C,h,Vm(h.id,0));return n.deleteBlock(t),l!==d.groupId&&new Ra(n,v).fix(),A==null||A.fix(),!0}function CF(n,t,e,r){if(qe.debug("drag a list between text blocks"),r==="after"){const d=ae(e);if(d&&Ht(d))return WE(n,t,d,"before")}if(r==="before"){const d=ze(e);if(d&&Ht(d))return WE(n,t,d,"after")}const o={...n.getBlockData(t),groupId:it(),start:1,level:1};let s=Rt(e);const l=at(e);r==="after"&&(s+=1),n.insertBlock(Et(l),s,o,Vm(o.id,0));const c=new Au(n,t);return n.deleteBlock(t),c.fix(),!0}function EF(n,t,e,r,i){if(Am(e))return!1;const{blockId:o}=e,s=n.getBlockById(o);p(qe,s,"no dragged block");const{isSourceBlock:l,targetBlock:c}=i;return!l&&c?(p(qe,t===c,"block !== target block"),p(qe,Ht(c),"target is not a list block"),WE(n,s,c,r)):CF(n,s,c,r)}function Bk(n,t){if(!n.isWritable())return!1;const e=n.selection.range,i=n.editorCommandProviders.getCommands(e,"shortcut").find(o=>o.id===t);return i?(n.editorCommandProviders.executeCommand(e,i,{}),!0):!1}const AF={"Shift+CtrlOrCmd+L":n=>Bk(n,"ordered-list"),"Shift+CtrlOrCmd+U":n=>Bk(n,"unordered-list")};function eg(n){const t=n.getAttribute("block-padding-level");return t?Number(t):null}function xF(n,t){let e;const r=eg(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 yk(n,t){const e=eg(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 qE(n){return n.readonly||!n.isWritable()}function bF(n){return n.selection.range.getSelectedBlocks().forEach(e=>{const r=e.block;st(n,r)&&xF(n,r)}),!0}function vF(n){return n.selection.range.getSelectedBlocks().forEach(e=>{const r=e.block;st(n,r)&&yk(n,r)}),!0}function BF(n){return qE(n)?!1:n.undoManager.runInGroup(()=>(bF(n),!0))}function yF(n){return qE(n)?!1:n.undoManager.runInGroup(()=>(vF(n),!0))}function TF(n){if(qE(n))return!1;if(!n.selection.range.isCollapsed())return;const t=n.selection.focusedBlock;if(!st(n,t))return;const e=n.selection.range.focus;if(!(!e.isSimple()||e.offset!==0||!eg(t)))return yk(n,t),!0}class XE{renderBlock(t,e,r){const{padding:i}=r;return i?{attributes:{"block-padding-level":i}}:{}}}const mat="",kF={Tab:BF,"Shift+Tab":yF,Backspace:TF};function RF(n,t,e=1){if(!t)return null;let r=ze(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 Ht(r)?r:null}r=ze(r)}return null}function wF(n,t){const e=n.getAttribute("data-style-heading"),r=RF(n,e);if(r)return r;const i=ze(n);if(i&&Ht(i)&&wr(i)===t)return i;const o=ae(n);return o&&Ht(o)&&wr(o)===t?o:null}function SF(n,t,e){var w,S,U;const r=(w=e.data)!=null?w:{};let i=1;if(Ht(t))i=Un(t);else{const M=eg(t);M&&(i=M+1),i>8&&(i=8)}const o=(S=r.listType)!=null?S:"ordered";if(o==="text-only")return null;const s=n.getBlockData(t);let l=(U=s.text)!=null?U:[],d=Re(l);const h=e.offset||0;h<=jn(l)&&(l=ar(l,h).right,d=d.substring(0,h));let C=1;o==="ordered"&&(C=Number.parseInt(d,10)||1);let E=it();const A=wF(t,o);if(A)if(Un(A)===i){if(Rt(t)>Rt(A))C=Sr(A)+1;else{const M=Sr(A);M>1&&(C=M-1),new vk(n,A,{start:C+1}).fix()}E=gu(A)}else{const M=YP(A,i);M&&(C=Sr(M)+1)}else Ht(t)&&new vk(n,t,{start:1}).fix();const v={id:it(),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:(M,V)=>{new Ra(M,V).fix()}}}function xl(n){return n.textOnly?"text-only":n.checkbox?n.checkbox:n.ordered?"ordered":"unordered"}function LF(n){var e,r;if(n.checkbox)return"";const t=(e=n.level)!=null?e:1;return n.ordered?`${WP(t,(r=n.start)!=null?r:1)}.`:qP(t)}function ng(n){return n==="checked"||n==="unchecked"}function Tk(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=xl(i),d=xl(l);return c!==d&&(!ng(c)||!ng(d))||(i.level||1)>(l.level||1)}function kk(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=xl(i),d=xl(l);return c!==d&&(!ng(c)||!ng(d))||(i.level||1)>(l.level||1)}function IF(n,t,e,r,i){var s,l,c;const o=t;if(r==="text")return((s=ur.convertTo)==null?void 0:s.call(ur,n,t,e,"text",i))||"";if(r==="markdown"){let d=((l=ur.convertTo)==null?void 0:l.call(ur,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,Tk(n,t,e,i)&&(d=`${d}`),kk(n,t,e,i)&&(d=`${d}`,h<=1&&(d+=`
|
|
613
|
+
`,GO=Object.freeze(Object.defineProperty({__proto__:null,ClearIcon:i2,CloseIcon:A0,PrevIcon:xT,NextIcon:bT,MoreIcon:QC,TextColorIcon:JC,ArrowDownIcon:x0,ArrowUpIcon:SO,ArrowLeftIcon:LO,ArrowRightIcon:ZC,DeleteRowIcon:vT,DeleteColIcon:BT,MergeCellIcon:yT,SplitCellIcon:TT,DeleteTableIcon:kT,Heading1Icon:b0,Heading2Icon:v0,Heading3Icon:B0,Heading4Icon:y0,Heading5Icon:T0,Heading6Icon:k0,Heading7Icon:R0,Heading8Icon:w0,HeadingNIcon:IO,OrderedListIcon:RT,UnorderedListIcon:wT,CheckListIcon:ST,BlockquoteIcon:LT,AlignCenterIcon:L0,AlignLeftIcon:ru,AlignRightIcon:S0,ImageIcon:IT,ImageMenuIcon:DT,ImageErrorIcon:eE,ImageEmptyIcon:MT,LinkIcon:oE,LinkOffIcon:UT,WarningIcon:tE,PasteSpecialIcon:_T,LaunchIcon:nE,CodeIcon:XT,AudioIcon:zT,GraphIcon:DO,VideoIcon:GT,FileIcon:_O,MathIcon:UO,MathMenuIcon:OT,TableIcon:OO,TableMenuIcon:NT,BilibiliIcon:FT,YoukuIcon:KT,ModaoIcon:$T,FigmaIcon:VT,EditIcon:I0,CommentIcon:Ba,RefreshIcon:PT,HelpIcon:rE,CheckMarkIcon:iE,TextIcon:iu,RightArrowIcon:MO,TencentVideoIcon:HT,WebPageIcon:jT,UmlIcon:WT,DividingLineIcon:qT,HeadingH1Icon:NO,HeadingH2Icon:PO,HeadingH3Icon:FO,HeadingH4Icon:KO,HeadingH5Icon:VO,HeadingH6Icon:$O,HeadingH7Icon:HO,HeadingH8Icon:jO,CheckboxIcon:sE,QuoteIcon:lE,LinkHrefIcon:zO,OrderedIcon:cE,UnorderedIcon:aE,CopyIcon:YT,CutIcon:QT,DeleteIcon:JT,LockBlockIcon:ZT,UnLockBlockIcon:t2,InsertBeforeIcon:e2,InsertAfterIcon:n2,MentionIcon:r2,CircleAddIcon:o2,LoadingIcon:s2,DragIcon:uE,UmlBrandIcon:D0,OnesLoadingIcon:l2,BoldIcon:a2,ItalicIcon:c2,UnderlineIcon:u2,LineThroughIcon:f2,SubscriptIcon:h2,SuperscriptIcon:m2,InlineCodeIcon:d2,ToMindMapIcon:g2,FitIcon:p2,FullScreenIcon:fE,ExitFullScreenIcon:C2,CaretDownIcon:E2,StatusIcon:A2},Symbol.toStringTag,{value:"Module"}));function x2(){const n=B("span",["editor-loading-icon"],null);return n.innerHTML=l2,n}const eat="";function WO(n,t){const e=B("button",["editor-checkbox-wrapper"],null);e.setAttribute("data-button-id",n),t!=null&&t.includes("checked")&&q(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 nat="",ou=D("ui-command-bar-base"),qO={itemElementTag:"div",tippyArrow:!1},_x=class extends He.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=>{var r,i;if(!this.isVisible||e.isComposing||Oc(e.target))return!0;if(this.subBar)return this.subBar.handleDocumentKeydown(e);if(this.items.length===0)return!0;if(e.key==="Escape")return(i=(r=this.options).beforeClose)!=null&&i.call(r)||this.close("cancelBar"),!0;if(e.key==="ArrowUp"){const o=this.getPrevItemIndex(this.getSelectedItemIndex());this.startPauseMouseEnter(),this.selectItem(this.items[o].id),e.preventDefault(),e.stopPropagation()}else if(e.key==="ArrowDown"){const o=this.getNextItemIndex(this.getSelectedItemIndex());this.startPauseMouseEnter(),this.selectItem(this.items[o].id),e.preventDefault(),e.stopPropagation()}else if(e.key==="ArrowRight"){const o=this.getSelectedItem();o&&o.children&&this.showSubCommandBar(o.childrenMenuId)}else if(e.key==="ArrowLeft")this.parentItem&&this.close("switchItem");else if(e.key==="Enter"){const o=this.getSelectedItemIndex();if(o===-1)return!1;const s=this.items[o],l=this.getItemElementById(s.id);l&&this.emit("click",this,s,l)}return!0});m(this,"handleDocumentMouseDown",e=>{var r,i;if(e.target instanceof Element){if((i=(r=this.options).beforeClose)!=null&&i.call(r,e))return;if(!this.isInCommandBar(e.target)){const o=this.listeners("closing");for(let s=0;s<o.length;s++)if(o[s](this,e)===!1)return;this.close("clickBackground")}}});m(this,"handleHidden",()=>{this.closeReason!=="fromHover"&&this.emit("close",this),this.close(null),Gp(this.id)});m(this,"handleShow",()=>{this.popper&&(this.popper.setAttribute("data-command-bar-id",this.id),this.options.classes&&q(this.popper,...this.options.classes),this.options.refuseOverflow&&this.popper.classList.add("reference-hidden")),this.emit("show",this),this.options.disablePageScroll&&zp(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(o.states&&o.states.indexOf("disabled")!==-1||(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)&&(ut(r,"selected"),this.emit("selectionChange",this,""))});m(this,"handleItemClick",e=>{var s,l;const r=this.getParentCommandItemElement(e.target);if(!r)return;const i=this.getItemElementId(r),o=this.items.find(c=>c.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}if(!o.element&&(this.emit("click",this,o,r),this.options.autoClose)){if((l=(s=this.options).beforeClose)!=null&&l.call(s,e))return;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=pn(i);if(!Ae(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:it(),this.options={...qO,...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&&ut(r,"selected")}selectItem(e,r="event"){const i=this.getSelectedItem();if(i){if(i.id===e)return;const s=i.id,l=this.getItemElementById(s);l&&ut(l,"selected")}const o=this.getItemElementById(e);o?(q(o,"selected"),this.emit("selectionChange",this,o.getAttribute("data-id")||""),!this.options.disableSelectedScroll&&r==="event"&&o.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=_x.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,ut(i,"active")}),r.beforePopup&&r.beforePopup(o),this.subBar.manualShow(i,this.getSubBarOptions(r)),q(i,"active")}isInCommandBar(e){if(!e||!(e instanceof Node))return!1;const r=this.getCommandBarRoot();return r&&Ae(r,e)||Ae(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(ou,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(ou,i,`can not find command item for id: ${r}`),i}return null}getItemElementId(e){const r=e.getAttribute("data-id");return p(ou,r,"no data-id attribute"),r}getItemElementById(e){const r=this.content.querySelector(`:scope >.editor-command-bar > .command-item[data-id="${e}"]`);return p(ou,r,`no exists command item, id=${e}`),r}getParentCommandItemElement(e){if(!e||!(e instanceof Element))return null;if(Mt(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)&&q(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(ou,e.children&&e.children.length>0,"no item children");const o=(l=e.childrenType)!=null?l:"menu",s=this.commandBarCreators.get(o);return p(ou,s,`no creator for command type: ${o}`),s(e,r,i)}static hasExistsCommandBar(){return!!document.querySelector("[data-command-bar-id]")}};let ya=_x;m(ya,"commandBarCreators",new Map),D("ui-command-bar");class _0 extends ya{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=m9.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 b2=D("ui-base");class su extends _0{constructor(t,e){var o;const r=(o=e==null?void 0:e.id)!=null?o:`popup-${it()}`,i=[{id:r,name:"",element:t}];super(i,void 0,{disablePageScroll:!0,id:r,beforeClose:e==null?void 0:e.beforeClose})}initCommandBarElement(t){q(t,"popper")}initItemElement(t,e){}get popupContent(){const t=this.items[0];p(b2,t,"no dialog item");const e=typeof t.element=="function"?t.element(t):t.element;return p(b2,e,"no item element"),e}}const rs=D("filterable-list");function v2(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")&&(q(t,"selected"),na(iE,["list-item-selected-icon"],t)),(r=n.states)!=null&&r.includes("disabled")&&q(t,"disabled"),t}function B2(n){const t=B("div",["list-root"],null);return n.forEach(e=>{t.appendChild(v2(e))}),n.length||t.appendChild(v2({id:"placeholder",states:["disabled"],name:_.t("search.emptyTips")})),t}function y2(n,t){return n.map(e=>({...e,states:t===e.id?["selected"]:[]}))}function XO(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=B2(y2(n,t==null?void 0:t.initialSelectedId));return s.appendChild(l),e}function T2(n,t,e){const r=n.querySelector(".list");p(rs,r,"no list root");const i=B2(y2(t,e)),o=r.querySelector(".list-root");if(p(rs,o,"no exists menu"),yf(o,i),e){const s=r.querySelector(".list-item.selected");s&&(p(rs,s,"no selected menu item"),s.scrollIntoView({block:"nearest"}))}}class YO{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(rs,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=XO(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(rs,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(rs,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,T2(this.root,this.visibleItems,t)}focus(){const t=this.root.querySelector(".filter-input");p(rs,t,"no input"),t.focus()}moveSelectedItemIntoView(){const t=this.root.querySelector(".list-item.selected");t&&(p(rs,t,"no selected menu item"),t.scrollIntoView({block:"nearest"}))}reset(){this.setFilter("");const t=this.root.querySelector(".filter-input");p(rs,t,"no input"),t.value=""}setFilter(t){this.filter!==t&&(this.filter=t,this.visibleItems=this.items.filter(e=>e.name.toLocaleLowerCase().includes(t)),T2(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 QO extends YO{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 su(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 rat="",iat="";function JO(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 ZO(n,t){var e,r;if(q(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-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=ZC,t.appendChild(o)}if((r=n.states)!=null&&r.includes("checked")){const o=B("div",["menu-item-checked-icon"],null);o.innerHTML=iE,t.appendChild(o)}}}}class hl extends _0{constructor(t,e,r){super(t,e,{autoClose:!0,disablePageScroll:!0,beforeClose:r==null?void 0:r.beforeClose,...r})}manualShow(t,e){const r={theme:"menu",...e};super.manualShow(t,r)}initCommandBarElement(t){q(t,"menu")}initItemElement(t,e){ZO(t,e)}}function tN(n,t,e){var r;return new hl((r=n.children)!=null?r:[],t,{...e,parentItem:n})}function k2(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=x0}n.states&&(n.states.indexOf("checked")!==-1&&q(r,"checked"),n.states.indexOf("disabled")!==-1&&(r.disabled=!0))}class gd extends _0{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){q(t,"toolbar")}initItemElement(t,e){k2(t,e,this.options)}}function eN(n,t,e){var r;return new gd((r=n.children)!=null?r:[],t,{...e,parentItem:n})}class nN extends ya{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){q(t,"toolbar","fixed")}initItemElement(t,e){k2(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 oat="";ya.registerManualCommandBar("menu",tN),ya.registerManualCommandBar("toolbar",eN);const sat="",R2=D("ui-base");class pd extends _0{constructor(e,r){super(pd.getCommandItems(e,r),void 0,{disablePageScroll:!0,...r});m(this,"handleDocumentMouseDown",e=>{})}initCommandBarElement(e){q(e,"dialog","manual")}initItemElement(e,r){}show(e,r){this.manualShow(e,{...r,theme:"light"})}get dialogContent(){const e=this.items[0];p(R2,e,"no dialog item");const r=e.element;return p(R2,r,"no item element"),r}static getCommandItems(e,r){var s;return[{id:(s=r==null?void 0:r.id)!=null?s:`manual-dialog-${it()}`,name:"",element:e}]}}const lat="",rN=D("ui-base");class w2{constructor(t){m(this,"menu");m(this,"currentText","");m(this,"handleSearchText");m(this,"handleClick",Pe.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 hl([],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=Pe.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=i=>i.states&&i.states.indexOf("disabled")!==-1?!1:i.type!=="section"&&i.type!=="separator",r=t.find(e);r&&this.menu.selectItem(r.id,"manual")}}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||_.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 gi.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{gi.release(e)}}highlightText(t,e){rN.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 A=s.charAt(C);let v=!1;E.endsWith(" ")&&(v=!0,E=E.trimEnd()),c+=`<span class="highlight">${E}${A===" "||v?" ":""}</span>`}else c+=s.charAt(C),C++}return C<s.length&&(c+=s.substring(C)),c},o=s=>{if(Mt(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 dE{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",()=>{q(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),ut(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}=dE.createDropdown(t,this.labels);this.root=r,this.input=i,this.text=o,this.clearIcon=s,this.dropdownIcon=l,this.autoSuggest=new w2({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=i2;const c=B("div",["dropdown-icon"],r);return c.innerHTML=x0,{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),q(this.root,"empty")}else ut(this.root,"empty")}}const iN=[-1,6,0,1,2,3,4,5],oN=[-1,6,0,1,2,3,4,5,14,13,7,8,9,10,11,12],S2=D("color-palette");function L2(n,t,e,r){p(S2,n>0,"no color in palette");const i=t||1;p(S2,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 sN(n){const t=B("button",["color-button"],null),e=iN[n];return t.setAttribute("data-color-index",`${e}`),t.innerHTML=JC,t}function lN(n){const t=B("button",["background-color-button"],null),e=oN[n];return t.setAttribute("data-color-index",`${e}`),t}function aN(){const n=B("div",["clear-button-container"],null),t=B("button",["clear-button"],n);return t.innerText=_.t("colorPalette.reset"),n}function cN(n){const t=B("div",["color-palette"],null);return n.color!==!1&&(B("div",["bar-desc"],t,_.t("colorPalette.colorDesc")),t.appendChild(L2(8,1,sN,"color"))),n.backgroundColor!==!1&&(B("div",["bar-desc"],t,_.t("colorPalette.backgroundDesc")),t.appendChild(L2(16,2,lN,"background-color"))),n.clearColorButton!==!1&&t.appendChild(aN()),t}function uN(n,t,e){const r=t==="color"?"color":"background-color",i=n.querySelector(`.${r} button.selected`);i&&ut(i,"selected"),e===null&&(e=-1);const o=n.querySelector(`.${r} button[data-color-index="${e}"]`);o&&q(o,"selected")}const aat="",fN={};class dN extends He.TypedEmitter{constructor(e=fN){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(Mt(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)||(Mt(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=cN(e),this.root.addEventListener("click",this.handleClick)}destroy(){this.removeAllListeners(),this.root.removeEventListener("click",this.handleClick)}setColor(e,r){uN(this.root,e,r)}}class I2{constructor(t,e){m(this,"name","Color Palette");m(this,"element");m(this,"palette");m(this,"closeable",null);this.id=t,this.palette=new dN(e),this.element=this.palette.root}setCloseable(t){this.closeable=t}destroy(){this.palette.destroy(),this.closeable=null}}function hN(){const n=B("button",["color-button"],null);return n.innerHTML=JC,n}function hE(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 D2 extends He.TypedEmitter{constructor(e){super();m(this,"id","text-color-item");m(this,"name",_.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],hE(this.element,this.latestColors)});m(this,"beforePopup",()=>{this.updatePaletteColor(this.latestColors),this.emit("beforePopup")});this.editor=e,this.colorPaletteItem=new I2("text-color-palette-item"),this.colorPaletteItem.palette.addListener("onClick",this.handlePaletteClick),this.children.push(this.colorPaletteItem),this.element=hN()}destroy(){this.colorPaletteItem.destroy()}updatePaletteColor(e){this.colorPaletteItem.palette.setColor("color",e[0]),this.colorPaletteItem.palette.setColor("backgroundColor",e[1]),this.latestColors=e,hE(this.element,this.latestColors)}updateButtonColor(e){this.latestColors=e,hE(this.element,this.latestColors)}}const cat="";function M0(n,t){const e=B("div",["editor-input-wrap"],n);if(t!=null&&t.className&&q(e,t==null?void 0:t.className),t.label){const s=B("div",["editor-input-label"],e);B("span",[],s,t.label),t.required&&q(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),ut(e,"error")}),hm(i,(s,l)=>{var c;(c=t.onKeyDown)==null||c.call(t,s,l)}),{getField:()=>i,getInputValue:()=>i.value,setFieldError:s=>{q(e,"error"),o.innerText=s},focus:()=>{setTimeout(()=>{i.focus()})}}}function mE(n){if(!document.hasFocus())return!1;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 mN extends w2{constructor(e,r){super(r);m(this,"handleClose",()=>{var e,r;mE(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(!Ae(this.editor.rootContainer,o)||At(this.editor,o)<i)return;const s=Vo(this.editor,o,Ie(this.editor,o,i));if(s.length===0)return;const l=s[0],c=jo(this.editor,o,"editor-auto-suggest-menu",l);super.popup(c,{noEvent:!0})}}const gE=D("auto-suggest-menu");class pE{constructor(t,e){m(this,"order",100);m(this,"menu");m(this,"anchor",null);m(this,"close",()=>{this.menu.close()});m(this,"oldCompositingText","");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(Re(ar(Jn(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=Re(Hm(t,o,i));if(p(gE,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 mN(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)||Vp(e.key)?!1:lv(e)&&!la(e)?(setTimeout(()=>{this.resetItems()}),!1):pm(e)?(this.menu.close(),!0):this.menu.handleKeydown(e)}popup(t,e,r,i){this.anchor={blockId:dt(t),offset:e,leftText:r,trigger:i};const o=Et(at(t)),s=Rt(t);this.menu.popupInEditor(o,s,e)}triggerPopup(t,e,r,i,o){var l;const s=t.selection.range.start;if(!s.isSimple())return!1;if(this.options.trigger.indexOf(o)!==-1){const c=t.getBlockByIndex(e,r);if(i>0&&this.options.needSpaceBeforeTrigger&&(((l=t.getBlockData(c).text)==null?void 0:l.reduce((A,v)=>A+v.insert,""))||"")[i-1].trim().length!==0||this.hasExistsMenuThemeCommandBar())return!1;const{offset:d}=s,h=Re(Hm(t,c,d));this.popup(c,d,h,o)}return!1}handleAfterInsertText(t,e,r,i,o){var h;const s=t.selection.range.start;if(!s.isSimple())return!1;const l=t.getBlockByIndex(e,r);if(Ko(l))return!1;const{blockId:c,offset:d}=s;return dt(l)!==c?!1:(h=this.menu)!=null&&h.isVisible?(this.resetItems(),!1):this.triggerPopup(t,e,r,i,o)}handleUpdateCompositionText(t,e,r,i,o){var h;const s=t.selection.range.start;if(!s.isSimple())return!1;const{blockId:l}=s,c=t.getBlockByIndex(e,r);if(dt(c)!==l)return!1;if((h=this.menu)!=null&&h.isVisible&&this.resetItems(),!o)return this.oldCompositingText=t.compositingText,!1;const d=this.triggerPopup(t,e,r,i,this.oldCompositingText);return this.oldCompositingText="",d}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=Re(Hm(t,o,i));if(p(gE,this.anchor,"no anchor"),s.startsWith(this.anchor.leftText)){const c=s.substring(this.anchor.leftText.length);gE.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 gN(){const n={};for(let t=1;t<=8;t++)n[`heading-${t}`]={shortcut:`/h${t}`};return n}const pN={"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"},...gN()};function tr(n){var t;return(t=pN[n])==null?void 0:t.shortcut}function CN(n){var t;return(t=n.subText)!=null?t:""}const lo=D("table-dom");function ao(n){return`${dt(n)}_scroll`}function fn(n){const t=n.querySelector("div[data-type=table-content] >table");return p(lo,t instanceof HTMLTableElement,"invalid table"),t}function co(n,t){const r=n.getCustom(ao(t)).contentElement.firstElementChild;p(lo,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(lo,i,"no table tools"),i}function EN(n,t){return n.findCustom(ao(t))?co(n,t):null}function _2(n){const t=[];return Array.from(n.rows).forEach(e=>{t.push(...Array.from(e.cells))}),t}function Cd(n){const t=n.querySelector(":scope div[data-type=editor-container]");return p(lo,t,"no child container in cell"),t}function AN(n){const r=_2(n).map(i=>{const o=Cd(i),s=Et(o),l=i.colSpan,c=i.rowSpan;return`${s}/${l}/${c}`}).join();return kv(r)}function dn(n){return Ot(n)==="table"}function CE(n){const t=at(n);if(ie(t))return null;const e=et(t);return p(lo,e,"no parent block"),dn(e)?t:CE(e)}function is(n){if(dn(n))return n;const t=at(n);if(ie(t))return null;const e=et(t);return p(lo,e,"no parent block"),dn(e)?e:is(e)}function xN(n,t){const e=n.querySelector("colgroup");p(lo,e,"no colgroup");const r=e.children[t];return p(lo,r,"no col"),p(lo,r instanceof HTMLTableColElement,`invalid col: ${r.tagName}`),r}function M2(n){try{return fn(n),!0}catch{return!1}}function bN(n){return ve(n).querySelector(":scope > .block-helper")}function U2(n){const t=et(n.contentElement);p(lo,t,"no block");const e=bN(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`}}function vN(n){const t=n.getComponentOptions("table"),e=t==null?void 0:t.bigTableBoundary;if(!e)return!1;const r=n.rootContainer.querySelectorAll("div[data-type=table-content] >table");let i=!1;return r.forEach(o=>{o.getBoundingClientRect().width>e&&(i=!0)}),i}var EE={exports:{}};(function(n,t){var e=200,r="Expected a function",i="__lodash_hash_undefined__",o=1,s=2,l=1/0,c=9007199254740991,d="[object Arguments]",h="[object Array]",C="[object Boolean]",E="[object Date]",A="[object Error]",v="[object Function]",w="[object GeneratorFunction]",S="[object Map]",U="[object Number]",M="[object Object]",V="[object Promise]",rt="[object RegExp]",Y="[object Set]",X="[object String]",ft="[object Symbol]",pt="[object WeakMap]",ct="[object ArrayBuffer]",wt="[object DataView]",vt="[object Float32Array]",Gt="[object Float64Array]",ce="[object Int8Array]",Oe="[object Int16Array]",pe="[object Int32Array]",ni="[object Uint8Array]",Ve="[object Uint8ClampedArray]",bn="[object Uint16Array]",Ir="[object Uint32Array]",nr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Nn=/^\w*$/,uh=/^\./,fh=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,dh=/[\\^$.*+?()[\]{}|]/g,Ao=/\\(\\)?/g,cs=/^\[object .+?Constructor\]$/,us=/^(?:0|[1-9]\d*)$/,ee={};ee[vt]=ee[Gt]=ee[ce]=ee[Oe]=ee[pe]=ee[ni]=ee[Ve]=ee[bn]=ee[Ir]=!0,ee[d]=ee[h]=ee[ct]=ee[C]=ee[wt]=ee[E]=ee[A]=ee[v]=ee[S]=ee[U]=ee[M]=ee[rt]=ee[Y]=ee[X]=ee[pt]=!1;var Wt=typeof kn=="object"&&kn&&kn.Object===Object&&kn,ri=typeof self=="object"&&self&&self.Object===Object&&self,Pn=Wt||ri||Function("return this")(),fs=t&&!t.nodeType&&t,Oa=fs&&!0&&n&&!n.nodeType&&n,Rn=Oa&&Oa.exports===fs,xo=Rn&&Wt.process,Na=function(){try{return xo&&xo.binding("util")}catch{}}(),rr=Na&&Na.isTypedArray;function Fu(k,N){var W=k?k.length:0;return!!W&&hs(k,N,0)>-1}function hh(k,N,W){for(var lt=-1,St=k?k.length:0;++lt<St;)if(W(N,k[lt]))return!0;return!1}function ds(k,N){for(var W=-1,lt=k?k.length:0;++W<lt;)if(N(k[W],W,k))return!0;return!1}function Ne(k,N,W,lt){for(var St=k.length,ht=W+(lt?1:-1);lt?ht--:++ht<St;)if(N(k[ht],ht,k))return ht;return-1}function hs(k,N,W){if(N!==N)return Ne(k,ms,W);for(var lt=W-1,St=k.length;++lt<St;)if(k[lt]===N)return lt;return-1}function ms(k){return k!==k}function Ku(k){return function(N){return N==null?void 0:N[k]}}function gs(k,N){for(var W=-1,lt=Array(k);++W<k;)lt[W]=N(W);return lt}function Vu(k){return function(N){return k(N)}}function ps(k,N){return k.has(N)}function bo(k,N){return k==null?void 0:k[N]}function Cs(k){var N=!1;if(k!=null&&typeof k.toString!="function")try{N=!!(k+"")}catch{}return N}function Pa(k){var N=-1,W=Array(k.size);return k.forEach(function(lt,St){W[++N]=[St,lt]}),W}function Fa(k,N){return function(W){return k(N(W))}}function Es(k){var N=-1,W=Array(k.size);return k.forEach(function(lt){W[++N]=lt}),W}var Ka=Array.prototype,Va=Function.prototype,vo=Object.prototype,As=Pn["__core-js_shared__"],_l=function(){var k=/[^.]+$/.exec(As&&As.keys&&As.keys.IE_PROTO||"");return k?"Symbol(src)_1."+k:""}(),$u=Va.toString,Dr=vo.hasOwnProperty,Bo=vo.toString,Hu=RegExp("^"+$u.call(Dr).replace(dh,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),$a=Pn.Symbol,ju=Pn.Uint8Array,mh=vo.propertyIsEnumerable,gh=Ka.splice,ph=Fa(Object.keys,Object),Ml=Lo(Pn,"DataView"),xs=Lo(Pn,"Map"),Ha=Lo(Pn,"Promise"),yo=Lo(Pn,"Set"),bs=Lo(Pn,"WeakMap"),vs=Lo(Object,"create"),ja=Pi(Ml),Ch=Pi(xs),Eh=Pi(Ha),be=Pi(yo),Ah=Pi(bs),Ul=$a?$a.prototype:void 0,Ol=Ul?Ul.valueOf:void 0,To=Ul?Ul.toString:void 0;function Oi(k){var N=-1,W=k?k.length:0;for(this.clear();++N<W;){var lt=k[N];this.set(lt[0],lt[1])}}function Nl(){this.__data__=vs?vs(null):{}}function zu(k){return this.has(k)&&delete this.__data__[k]}function Gu(k){var N=this.__data__;if(vs){var W=N[k];return W===i?void 0:W}return Dr.call(N,k)?N[k]:void 0}function xh(k){var N=this.__data__;return vs?N[k]!==void 0:Dr.call(N,k)}function bh(k,N){var W=this.__data__;return W[k]=vs&&N===void 0?i:N,this}Oi.prototype.clear=Nl,Oi.prototype.delete=zu,Oi.prototype.get=Gu,Oi.prototype.has=xh,Oi.prototype.set=bh;function _r(k){var N=-1,W=k?k.length:0;for(this.clear();++N<W;){var lt=k[N];this.set(lt[0],lt[1])}}function vh(){this.__data__=[]}function Pl(k){var N=this.__data__,W=ko(N,k);if(W<0)return!1;var lt=N.length-1;return W==lt?N.pop():gh.call(N,W,1),!0}function Bh(k){var N=this.__data__,W=ko(N,k);return W<0?void 0:N[W][1]}function Fl(k){return ko(this.__data__,k)>-1}function yh(k,N){var W=this.__data__,lt=ko(W,k);return lt<0?W.push([k,N]):W[lt][1]=N,this}_r.prototype.clear=vh,_r.prototype.delete=Pl,_r.prototype.get=Bh,_r.prototype.has=Fl,_r.prototype.set=yh;function Mr(k){var N=-1,W=k?k.length:0;for(this.clear();++N<W;){var lt=k[N];this.set(lt[0],lt[1])}}function Th(){this.__data__={hash:new Oi,map:new(xs||_r),string:new Oi}}function Wu(k){return ks(this,k).delete(k)}function Kl(k){return ks(this,k).get(k)}function qu(k){return ks(this,k).has(k)}function kh(k,N){return ks(this,k).set(k,N),this}Mr.prototype.clear=Th,Mr.prototype.delete=Wu,Mr.prototype.get=Kl,Mr.prototype.has=qu,Mr.prototype.set=kh;function Bs(k){var N=-1,W=k?k.length:0;for(this.__data__=new Mr;++N<W;)this.add(k[N])}function Rh(k){return this.__data__.set(k,i),this}function mr(k){return this.__data__.has(k)}Bs.prototype.add=Bs.prototype.push=Rh,Bs.prototype.has=mr;function Fn(k){this.__data__=new _r(k)}function ii(){this.__data__=new _r}function Ye(k){return this.__data__.delete(k)}function za(k){return this.__data__.get(k)}function wh(k){return this.__data__.has(k)}function Ur(k,N){var W=this.__data__;if(W instanceof _r){var lt=W.__data__;if(!xs||lt.length<e-1)return lt.push([k,N]),this;W=this.__data__=new Mr(lt)}return W.set(k,N),this}Fn.prototype.clear=ii,Fn.prototype.delete=Ye,Fn.prototype.get=za,Fn.prototype.has=wh,Fn.prototype.set=Ur;function Or(k,N){var W=Fi(k)||Za(k)?gs(k.length,String):[],lt=W.length,St=!!lt;for(var ht in k)(N||Dr.call(k,ht))&&!(St&&(ht=="length"||Ju(ht,lt)))&&W.push(ht);return W}function ko(k,N){for(var W=k.length;W--;)if(Zu(k[W][0],N))return W;return-1}function ys(k,N){N=$l(N,k)?[N]:oi(N);for(var W=0,lt=N.length;k!=null&&W<lt;)k=k[Hl(N[W++])];return W&&W==lt?k:void 0}function Ga(k){return Bo.call(k)}function Ni(k,N){return k!=null&&N in Object(k)}function gr(k,N,W,lt,St){return k===N?!0:k==null||N==null||!ai(k)&&!vn(N)?k!==k&&N!==N:Wa(k,N,gr,W,lt,St)}function Wa(k,N,W,lt,St,ht){var $t=Fi(k),te=Fi(N),ue=h,we=h;$t||(ue=si(k),ue=ue==d?M:ue),te||(we=si(N),we=we==d?M:we);var Se=ue==M&&!Cs(k),De=we==M&&!Cs(N),ne=ue==we;if(ne&&!Se)return ht||(ht=new Fn),$t||ec(k)?Qu(k,N,W,lt,St,ht):Ih(k,N,ue,W,lt,St,ht);if(!(St&s)){var wn=Se&&Dr.call(k,"__wrapped__"),mn=De&&Dr.call(N,"__wrapped__");if(wn||mn){var Sn=wn?k.value():k,Ln=mn?N.value():N;return ht||(ht=new Fn),W(Sn,Ln,lt,St,ht)}}return ne?(ht||(ht=new Fn),Ya(k,N,W,lt,St,ht)):!1}function qa(k,N,W,lt){var St=W.length,ht=St,$t=!lt;if(k==null)return!ht;for(k=Object(k);St--;){var te=W[St];if($t&&te[2]?te[1]!==k[te[0]]:!(te[0]in k))return!1}for(;++St<ht;){te=W[St];var ue=te[0],we=k[ue],Se=te[1];if($t&&te[2]){if(we===void 0&&!(ue in k))return!1}else{var De=new Fn;if(lt)var ne=lt(we,Se,ue,k,N,De);if(!(ne===void 0?gr(Se,we,lt,o|s,De):ne))return!1}}return!0}function Ro(k){if(!ai(k)||_h(k))return!1;var N=li(k)||Cs(k)?Hu:cs;return N.test(Pi(k))}function Xa(k){return vn(k)&&Io(k.length)&&!!ee[Bo.call(k)]}function wo(k){return typeof k=="function"?k:k==null?Kn:typeof k=="object"?Fi(k)?Sh(k[0],k[1]):Xu(k):qn(k)}function So(k){if(!Mh(k))return ph(k);var N=[];for(var W in Object(k))Dr.call(k,W)&&W!="constructor"&&N.push(W);return N}function Xu(k){var N=Qa(k);return N.length==1&&N[0][2]?he(N[0][0],N[0][1]):function(W){return W===k||qa(W,k,N)}}function Sh(k,N){return $l(k)&&Ce(N)?he(Hl(k),N):function(W){var lt=tf(W,k);return lt===void 0&<===N?rc(W,k):gr(N,lt,void 0,o|s)}}function Yu(k){return function(N){return ys(N,k)}}function Ts(k){if(typeof k=="string")return k;if(Rs(k))return To?To.call(k):"";var N=k+"";return N=="0"&&1/k==-l?"-0":N}function Vl(k,N,W){var lt=-1,St=Fu,ht=k.length,$t=!0,te=[],ue=te;if(W)$t=!1,St=hh;else if(ht>=e){var we=N?null:Lh(k);if(we)return Es(we);$t=!1,St=ps,ue=new Bs}else ue=N?[]:te;t:for(;++lt<ht;){var Se=k[lt],De=N?N(Se):Se;if(Se=W||Se!==0?Se:0,$t&&De===De){for(var ne=ue.length;ne--;)if(ue[ne]===De)continue t;N&&ue.push(De),te.push(Se)}else St(ue,De,W)||(ue!==te&&ue.push(De),te.push(Se))}return te}function oi(k){return Fi(k)?k:Uh(k)}var Lh=yo&&1/Es(new yo([,-0]))[1]==l?function(k){return new yo(k)}:Nh;function Qu(k,N,W,lt,St,ht){var $t=St&s,te=k.length,ue=N.length;if(te!=ue&&!($t&&ue>te))return!1;var we=ht.get(k);if(we&&ht.get(N))return we==N;var Se=-1,De=!0,ne=St&o?new Bs:void 0;for(ht.set(k,N),ht.set(N,k);++Se<te;){var wn=k[Se],mn=N[Se];if(lt)var Sn=$t?lt(mn,wn,Se,N,k,ht):lt(wn,mn,Se,k,N,ht);if(Sn!==void 0){if(Sn)continue;De=!1;break}if(ne){if(!ds(N,function(Ln,Bn){if(!ne.has(Bn)&&(wn===Ln||W(wn,Ln,lt,St,ht)))return ne.add(Bn)})){De=!1;break}}else if(!(wn===mn||W(wn,mn,lt,St,ht))){De=!1;break}}return ht.delete(k),ht.delete(N),De}function Ih(k,N,W,lt,St,ht,$t){switch(W){case wt:if(k.byteLength!=N.byteLength||k.byteOffset!=N.byteOffset)return!1;k=k.buffer,N=N.buffer;case ct:return!(k.byteLength!=N.byteLength||!lt(new ju(k),new ju(N)));case C:case E:case U:return Zu(+k,+N);case A:return k.name==N.name&&k.message==N.message;case rt:case X:return k==N+"";case S:var te=Pa;case Y:var ue=ht&s;if(te||(te=Es),k.size!=N.size&&!ue)return!1;var we=$t.get(k);if(we)return we==N;ht|=o,$t.set(k,N);var Se=Qu(te(k),te(N),lt,St,ht,$t);return $t.delete(k),Se;case ft:if(Ol)return Ol.call(k)==Ol.call(N)}return!1}function Ya(k,N,W,lt,St,ht){var $t=St&s,te=ws(k),ue=te.length,we=ws(N),Se=we.length;if(ue!=Se&&!$t)return!1;for(var De=ue;De--;){var ne=te[De];if(!($t?ne in N:Dr.call(N,ne)))return!1}var wn=ht.get(k);if(wn&&ht.get(N))return wn==N;var mn=!0;ht.set(k,N),ht.set(N,k);for(var Sn=$t;++De<ue;){ne=te[De];var Ln=k[ne],Bn=N[ne];if(lt)var Ss=$t?lt(Bn,Ln,ne,N,k,ht):lt(Ln,Bn,ne,k,N,ht);if(!(Ss===void 0?Ln===Bn||W(Ln,Bn,lt,St,ht):Ss)){mn=!1;break}Sn||(Sn=ne=="constructor")}if(mn&&!Sn){var Ki=k.constructor,Do=N.constructor;Ki!=Do&&"constructor"in k&&"constructor"in N&&!(typeof Ki=="function"&&Ki instanceof Ki&&typeof Do=="function"&&Do instanceof Do)&&(mn=!1)}return ht.delete(k),ht.delete(N),mn}function ks(k,N){var W=k.__data__;return Dh(N)?W[typeof N=="string"?"string":"hash"]:W.map}function Qa(k){for(var N=ws(k),W=N.length;W--;){var lt=N[W],St=k[lt];N[W]=[lt,St,Ce(St)]}return N}function Lo(k,N){var W=bo(k,N);return Ro(W)?W:void 0}var si=Ga;(Ml&&si(new Ml(new ArrayBuffer(1)))!=wt||xs&&si(new xs)!=S||Ha&&si(Ha.resolve())!=V||yo&&si(new yo)!=Y||bs&&si(new bs)!=pt)&&(si=function(k){var N=Bo.call(k),W=N==M?k.constructor:void 0,lt=W?Pi(W):void 0;if(lt)switch(lt){case ja:return wt;case Ch:return S;case Eh:return V;case be:return Y;case Ah:return pt}return N});function Ja(k,N,W){N=$l(N,k)?[N]:oi(N);for(var lt,St=-1,$t=N.length;++St<$t;){var ht=Hl(N[St]);if(!(lt=k!=null&&W(k,ht)))break;k=k[ht]}if(lt)return lt;var $t=k?k.length:0;return!!$t&&Io($t)&&Ju(ht,$t)&&(Fi(k)||Za(k))}function Ju(k,N){return N=N==null?c:N,!!N&&(typeof k=="number"||us.test(k))&&k>-1&&k%1==0&&k<N}function $l(k,N){if(Fi(k))return!1;var W=typeof k;return W=="number"||W=="symbol"||W=="boolean"||k==null||Rs(k)?!0:Nn.test(k)||!nr.test(k)||N!=null&&k in Object(N)}function Dh(k){var N=typeof k;return N=="string"||N=="number"||N=="symbol"||N=="boolean"?k!=="__proto__":k===null}function _h(k){return!!_l&&_l in k}function Mh(k){var N=k&&k.constructor,W=typeof N=="function"&&N.prototype||vo;return k===W}function Ce(k){return k===k&&!ai(k)}function he(k,N){return function(W){return W==null?!1:W[k]===N&&(N!==void 0||k in Object(W))}}var Uh=jl(function(k){k=nc(k);var N=[];return uh.test(k)&&N.push(""),k.replace(fh,function(W,lt,St,ht){N.push(St?ht.replace(Ao,"$1"):lt||W)}),N});function Hl(k){if(typeof k=="string"||Rs(k))return k;var N=k+"";return N=="0"&&1/k==-l?"-0":N}function Pi(k){if(k!=null){try{return $u.call(k)}catch{}try{return k+""}catch{}}return""}function Oh(k,N){return k&&k.length?Vl(k,wo(N)):[]}function jl(k,N){if(typeof k!="function"||N&&typeof N!="function")throw new TypeError(r);var W=function(){var lt=arguments,St=N?N.apply(this,lt):lt[0],ht=W.cache;if(ht.has(St))return ht.get(St);var $t=k.apply(this,lt);return W.cache=ht.set(St,$t),$t};return W.cache=new(jl.Cache||Mr),W}jl.Cache=Mr;function Zu(k,N){return k===N||k!==k&&N!==N}function Za(k){return tc(k)&&Dr.call(k,"callee")&&(!mh.call(k,"callee")||Bo.call(k)==d)}var Fi=Array.isArray;function Qe(k){return k!=null&&Io(k.length)&&!li(k)}function tc(k){return vn(k)&&Qe(k)}function li(k){var N=ai(k)?Bo.call(k):"";return N==v||N==w}function Io(k){return typeof k=="number"&&k>-1&&k%1==0&&k<=c}function ai(k){var N=typeof k;return!!k&&(N=="object"||N=="function")}function vn(k){return!!k&&typeof k=="object"}function Rs(k){return typeof k=="symbol"||vn(k)&&Bo.call(k)==ft}var ec=rr?Vu(rr):Xa;function nc(k){return k==null?"":Ts(k)}function tf(k,N,W){var lt=k==null?void 0:ys(k,N);return lt===void 0?W:lt}function rc(k,N){return k!=null&&Ja(k,N,Ni)}function ws(k){return Qe(k)?Or(k):So(k)}function Kn(k){return k}function Nh(){}function qn(k){return $l(k)?Ku(Hl(k)):Yu(k)}n.exports=Oh})(EE,EE.exports);const BN=EE.exports,wi=D("doc-table-grid");class yN{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(wi,t>=0&&t<this.cols(),`set cell, invalid col: ${t}`),this._cells[t]=e}getCell(t){p(wi,t>=0&&t<this.cols(),`get cell, invalid col: ${t}`);const e=this._cells[t];return p(wi,e,"get cell, no cell"),e}getCellAllowEmpty(t){return p(wi,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 yN(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(wi,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,c=this._data[`${i}_background`]||"";for(let h=0;h<l;h++)for(let C=0;C<s;C++){const E={col:e,row:r,containerId:i,virtual:C!==0||h!==0,colSpan:s,rowSpan:l};c&&(E.background=c),this._rows[r+h].setCell(e+C,E)}const d=this.getNextEmptyCell(e,r);d?(e=d.col,r=d.row):p(wi,o===t.length-1,`invalid table data, no next empty cell: ${JSON.stringify(this._data)}`)}),this._rows.forEach(i=>{i.forEach(o=>{p(wi,o,"no cell"),p(wi,o.containerId,"no containerId")})})}getCell(t){const{col:e,row:r}=t,i=this._rows[r];p(wi,i,`get cell, no row: ${r}`);const o=i.getCell(e);return p(wi,o,`get cell, no cell: ${e}`),o}getRow(t){const e=this._rows[t];return p(wi,e,`get row, no row: ${t}`),e}forEach(t){this._rows.forEach(t)}}const O0=D("table-data");function TN(n){for(const t of Array.from(n.classList))if(t.startsWith("style-bg-color-"))return t;return""}function kN(n){const t=n.firstElementChild;return p(O0,t,"no child element for cell"),p(O0,Qs(t),"cell first child is not a container"),p(O0,pi(t),"cell first child is not a container"),t}function RN(n){const t=et(n);p(O0,t,"no parent block for table");const e=[],r={},i={};Array.from(n.rows).forEach(c=>{Array.from(c.cells).forEach(d=>{const h=kN(d),C=Et(h);e.push(C),(d.colSpan>1||d.rowSpan>1)&&(r[`${C}_colSpan`]=d.colSpan,r[`${C}_rowSpan`]=d.rowSpan);const E=TN(d);E&&(i[`${C}_background`]=E)})});const o=n.rows.length,s=Array.from(n.rows[0].cells).map(c=>c.colSpan).reduce((c,d)=>c+d,0);return{id:dt(t),type:Ot(t),rows:o,cols:s,children:e,colsWidth:Array(s).fill(100),...r,...i}}function ml(n){return new U0(n)}function wN(n){return ml(RN(n))}const en=D("table-grid"),SN=60;class LN{constructor(t,e){m(this,"containerId");m(this,"row");m(this,"col");m(this,"colSpan");m(this,"rowSpan");m(this,"background");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,e.background&&(this.background=e.background)}get cell(){const e=this.container.closest("td");return p(en,e,"no parent cell for child container"),e}get container(){const t=e1(this.containerId),e=this.table.querySelectorAll(`#${t}`);p(en,e.length===1,"containers !== 1"),p(en,Qs(e[0]),"not a container");const r=e[0];return p(en,pi(r),"not a child container"),r}}class IN{constructor(t,e){m(this,"_cells",[]);e.forEach(r=>{this._cells.push(new LN(t,r))})}get cells(){return this._cells}getCell(t){return p(en,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 Mx=class{constructor(t){m(this,"_rows",[]);this.table=t,wN(t).forEach(i=>{this._rows.push(new IN(t,i))});const r=this.colCount;this._rows.forEach(i=>{p(en,i.cells.length===r,"row.cells.length !== colCount")})}get rowCount(){return this._rows.length}get colCount(){return this._rows.length===0?0:(p(en,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(en,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(en,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(en,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(en,!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(en,r<=i,"min > max"),p(en,r>=0,"min < 0"),p(en,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(en,r<=i,"min > max"),p(en,r>=0,"min < 0"),p(en,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 A=r;A<=i;A++)for(let v=o;v<=s;v++)l.push(this.getCell({row:A,col:v}));const c=this.toRealCells(l);let d=1e4,h=1e4,C=-1,E=-1;return c.forEach(A=>{h=Math.min(A.col,h),d=Math.min(A.row,d),E=Math.max(A.col+A.colSpan-1,E),C=Math.max(A.row+A.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 A=this.getCell({row:C,col:E});A.virtual||r.push(A)}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)}getLeftCell(t){const e=this.uniqueCells,r=e.findIndex(i=>i.containerId===t.containerId);return p(en,r>=0,"not a valid child container"),r===0?null:e[r-1]}getRightCell(t){const e=this.uniqueCells,r=e.findIndex(i=>i.containerId===t.containerId);return p(en,r>=0,"not a valid child container"),r===e.length-1?null:e[r+1]}get uniqueCells(){return BN(this.cells,"containerId")}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(en,r,"cell not found"),r}getCellByCellElement(t){const e=Cd(t);return this.getCellByContainerId(Et(e))}getCellByContainerId(t){return this.getCellById(t)}static fromTable(t){const e=AN(t),r=this.caches.getSync(e,()=>(en.debug("create table grid"),new Mx(t)));return r.table!==t?(this.caches.delete(e),this.fromTable(t)):r}static fromBlock(t){return this.fromTable(fn(t))}};let Kt=Mx;m(Kt,"caches",new Hb(SN));function N0(n,t){Object.entries(n).forEach(([e])=>{e.startsWith(`${t}/`)&&delete n[e]})}const DN=D("table-selection-range");function Si(n,t,e){var M,V,rt,Y;const r=Kt.fromBlock(n),i=t,o=e,s=r.getCellByContainerId(i.childContainerId),l=r.getCellByContainerId(o.childContainerId),c=i.custom,d=o.custom,h=(M=c==null?void 0:c.rowIndex)!=null?M:s.row,C=(V=c==null?void 0:c.colIndex)!=null?V:s.col,E=(rt=d==null?void 0:d.rowIndex)!=null?rt:l.row+l.rowSpan-1,A=(Y=d==null?void 0:d.colIndex)!=null?Y:l.col+l.colSpan-1,v=Math.min(h,E),w=Math.max(h,E),S=Math.min(C,A),U=Math.max(C,A);return{fromRow:v,toRow:w,fromCol:S,toCol:U}}function AE(n,t){const e=new Set,r=new Set,i=n.selection.range;if(!i.isSimple()&&i.start.blockId===dt(t)){const o=Kt.fromBlock(t),{start:s,end:l}=i;p(DN,!s.isSimple()&&!l.isSimple(),"invalid range");const{fromCol:c,toCol:d,fromRow:h,toRow:C}=Si(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 Ed(n,t){let e=null;if(t.isCollapsed()&&t.isSimple()){const r=n.getBlockById(t.start.blockId);if(dn(r)){const i=at(r),o=et(i);o&&(e=is(o))}else e=is(r)}else{const r=n.getBlockById(t.start.blockId),i=is(r),o=n.getBlockById(t.end.blockId),s=is(o);i===s&&(e=i)}return e}const lu=D("delete-columns");function O2(n,t,e){const{start:r,end:i}=e;if(r.blockId!==i.blockId||e.isSimple()||n.getBlockById(r.blockId)!==t||Ot(t)!=="table")return!1;const{fromRow:s,toRow:l}=Si(t,e.start,e.end),c=Kt.fromBlock(t);return s===0&&l===c.rowCount-1}function xE(n){const t=n.getEditor();t.undoManager.runInGroup(()=>{var V,rt;const e=t.getBlockById(n.start.blockId);if(!O2(t,e,n))return;if(n.isSimple()){t.deleteBlock(e);return}const{fromCol:r,toCol:i}=Si(e,n.start,n.end),o=Kt.fromBlock(e);if(r===0&&i===o.colCount-1){t.deleteBlock(e);return}const s=new Set,l=o.map(Y=>Y.containerId);for(let Y=0;Y<l.length;Y++){const X=l[Y];for(let ft=r;ft<=i;ft++){const pt=X[ft];s.add(pt)}X.splice(r,i-r+1)}const c=new Set(l.flat()),d=new Set(Array.from(s).filter(Y=>!c.has(Y))),h=i-r+1,C=new Map,E=new Map;s.forEach(Y=>{if(d.has(Y))return;const X=o.getCellByContainerId(Y);if(p(lu,X.colSpan>1,"invalid effected cell, colSpan === 1"),X.col<r){p(lu,c.has(Y),"invalid effected cell, not exists");let Gt=X.col+X.colSpan-1;Gt>i&&(Gt=i);const ce=Gt-r+1,Oe=X.colSpan-ce;C.set(Y,Oe);return}p(lu,X.col<=i,"invalid effected cell, col > endCol");const ft=X.col,pt=X.col+X.colSpan-1,ct=X.col-r,wt=pt-ft+1-h+ct;p(lu,wt>0,"invalid effected cell, newSpanned <= 0");const vt=Yo(t.doc);E.set(Y,{newContainerId:vt,colSpan:wt})});for(let Y=0;Y<l.length;Y++){const X=l[Y];for(let ft=r;ft<X.length;ft++){const pt=X[ft],ct=E.get(pt);ct&&(X[ft]=ct.newContainerId)}}const A=xt.default(t.getBlockData(e));((V=A.colsWidth)!=null?V:new Array(A.cols).fill(0)).splice(r,i-r+1),d.forEach(Y=>{N0(A,Y)}),C.forEach((Y,X)=>{p(lu,Y>=1,"invalid modified colSpan, colSpan < 1"),Y===1?A[`${X}_colSpan`]=void 0:A[`${X}_colSpan`]=Y}),E.forEach((Y,X)=>{N0(A,X);const{newContainerId:ft,colSpan:pt}=Y;p(lu,pt>=1,"invalid newContainerData, colSpan < 1"),pt>1&&(A[`${ft}_colSpan`]=pt);const ct=o.getCellByContainerId(X).rowSpan;ct>1&&(A[`${ft}_rowSpan`]=ct)});const w=(rt=l[0][r])!=null?rt:l[0][r-1],S=t.getChildContainerData(w)[0],U=Kt.virtualCellContainersGridToChildren(l),M={...A,cols:A.cols-h,children:U};ml(M),t.updateBlockData(e,M,Ie(t,S.id,0)),t.deleteChildContainers(Array.from(d)),t.deleteChildContainers(Array.from(E.keys()))})}const au=D("delete-rows");function N2(n,t,e){const{start:r,end:i}=e;if(r.blockId!==i.blockId||e.isSimple()||n.getBlockById(r.blockId)!==t||Ot(t)!=="table")return!1;const{fromCol:s,toCol:l}=Si(t,e.start,e.end),c=Kt.fromBlock(t);return s===0&&l===c.colCount-1}function bE(n){const t=n.getEditor();t.undoManager.runInGroup(()=>{const e=t.getBlockById(n.start.blockId);if(!N2(t,e,n))return;if(n.isSimple()){t.deleteBlock(e);return}const{fromRow:r,toRow:i}=Si(e,n.start,n.end),o=Kt.fromBlock(e);if(r===0&&i===o.rowCount-1){t.deleteBlock(e);return}const s=new Set,l=o.map(M=>M.containerId);for(let M=i;M>=r;M--)l[M].forEach(rt=>s.add(rt)),l.splice(M,1);const c=new Set(l.flat()),d=new Set(Array.from(s).filter(M=>!c.has(M))),h=i-r+1,C=new Map,E=new Map;s.forEach(M=>{if(d.has(M))return;const V=o.getCellByContainerId(M);if(p(au,V.rowSpan>1,"invalid effected cell, rowSpan === 1"),V.row<r){p(au,c.has(M),"invalid effected cell, not exists");let ct=V.row+V.rowSpan-1;ct>i&&(ct=i);const wt=ct-r+1,vt=V.rowSpan-wt;C.set(M,vt);return}p(au,V.row<=i,"invalid effected cell, col > endCol");const rt=V.row,Y=V.row+V.rowSpan-1,X=V.row-r,ft=Y-rt+1-h+X;p(au,ft>0,"invalid effected cell, newSpanned <= 0");const pt=Yo(t.doc);E.set(M,{newContainerId:pt,rowSpan:ft})});for(let M=r;M<l.length;M++){const V=l[M];for(let rt=0;rt<V.length;rt++){const Y=V[rt],X=E.get(Y);X&&(V[rt]=X.newContainerId)}}const A=xt.default(t.getBlockData(e));d.forEach(M=>{N0(A,M)}),C.forEach((M,V)=>{p(au,M>=1,"invalid modified rowSpan, rowSpan < 1"),M===1?A[`${V}_rowSpan`]=void 0:A[`${V}_rowSpan`]=M}),E.forEach((M,V)=>{N0(A,V);const{newContainerId:rt,rowSpan:Y}=M;p(au,Y>=1,"invalid newContainerData, rowSpan < 1"),Y>1&&(A[`${rt}_rowSpan`]=Y);const X=o.getCellByContainerId(V).colSpan;X>1&&(A[`${rt}_colSpan`]=X)});const v=l[r]?l[r][0]:l[r-1][0],w=t.getChildContainerData(v)[0],S=Kt.virtualCellContainersGridToChildren(l),U={...A,rows:A.rows-h,children:S};ml(U),t.updateBlockData(e,U,Ie(t,w.id,0)),t.deleteChildContainers(Array.from(d)),t.deleteChildContainers(Array.from(E.keys()))})}const Ad=D("table-range");function P0(n){p(Ad,!n.isSimple(),"must be complex selection range");const{anchor:t,focus:e}=n;p(Ad,!t.isSimple(),"invalid start pos type"),p(Ad,!e.isSimple(),"invalid end pos type");const r=n.getEditor();p(Ad,t.blockId===e.blockId,"invalid range, not same block");const i=r.getBlockById(t.blockId);p(Ad,Ot(i)==="table","invalid block type, not a table block");const o=fn(i),s=Kt.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),A=s.getCell({row:d,col:C}),v=s.getCell({row:h,col:E});return{editor:r,block:i,table:o,startCell:A,endCell:v,startRow:d,startCol:C,endRow:h,endCol:E}}const vE=D("split-cell");function BE(n,t,e){n.undoManager.runInGroup(()=>{const r=Kt.fromBlock(t),i=r.getRealCell(e);p(vE,!i.virtual,"should not split virtual cell"),p(vE,i.colSpan>1||i.rowSpan>1,"cell does not has span data");const o=r.getVirtualCellContainersGrid(),s=[];for(let A=0;A<i.rowSpan;A++)for(let v=0;v<i.colSpan;v++){if(A===0&&v===0)continue;const w=A+i.row,S=v+i.col,U=Yo(n.doc);o[w][S]=U,s.push(U)}const l=n.getBlockData(t),c=xt.default(l);c[`${i.containerId}_colSpan`]=null,c[`${i.containerId}_rowSpan`]=null;const d=i.background;d&&s.length>0&&s.forEach(A=>{c[`${A}_background`]=d}),c.children=Kt.virtualCellContainersGridToChildren(o);const C=n.getChildContainerData(i.containerId)[0];p(vE,C,"no child block");const E=Ie(n,C.id,0);ml(c),n.updateBlockData(t,c,E)})}function _N(n,t,e){e.forEach(r=>{const i=Kt.fromBlock(t).getCell(r);(i.virtual||i.colSpan>1||i.rowSpan>1)&&BE(n,t,r)})}function P2(n,t,e){if(e.isSimple())return!1;const{start:r,end:i}=e;if(r.blockId!==i.blockId||n.getBlockById(r.blockId)!==t||Ot(t)!=="table")return!1;const{startCell:s,endCell:l}=P0(e);return!(s.cell!==l.cell||s.colSpan===1&&s.rowSpan===1)}function yE(n){const{editor:t,block:e,startRow:r,startCol:i,endRow:o,endCol:s}=P0(n),l=[];for(let c=r;c<=o;c++)for(let d=i;d<=s;d++)l.push({row:c,col:d});return _N(t,e,l),!0}const cu=D("merge-cells");function F2(n,t,e){if(e.isSimple())return!1;const{start:r,end:i}=e;if(r.blockId!==i.blockId||n.getBlockById(r.blockId)!==t||Ot(t)!=="table")return!1;const{startCell:s,endCell:l}=P0(e);return s.cell!==l.cell}function K2(n){const t=P0(n),e=t.editor;e.undoManager.runInGroup(()=>{const r=t.endCell,i=r.row+r.rowSpan-1,o=r.col+r.colSpan-1,s=dt(t.block);yE(n);const l=e.getBlockById(s),c=fn(l),{startRow:d,startCol:h}=t,C=xt.default(e.getBlockData(l));p(cu,C.children,"no table children");const E=Kt.fromTable(c),A=[];for(let ct=d;ct<=i;ct++)for(let wt=h;wt<=o;wt++){const vt=E.getCell({row:ct,col:wt});p(cu,!vt.virtual,"cell is virtual"),A.push(vt)}p(cu,A.length>0,"no selected cells");const v=A[0],w=A.slice(1),S=E.getCellByContainerId(v.containerId).container,U=[];w.forEach(ct=>{const wt=E.getCellByContainerId(ct.containerId).container,vt=Et(wt);if(!Of(e,wt)){const Gt=J5(e,vt);if(Of(e,S)){const ce=ke(S)[0];e.insertDocAt(S,0,Gt),e.deleteBlock(ce)}else e.insertDocAt(S,Xi(S),Gt)}U.push(vt)});const M=Et(S),V=o-h+1,rt=i-d+1;C[`${M}_colSpan`]=V,C[`${M}_rowSpan`]=rt,U.forEach(ct=>{p(cu,C.children,"no table children");const wt=C.children.indexOf(ct);p(cu,wt>0,"no deleted container"),C.children.splice(wt,1)});const Y=C,ft=e.getChildContainerData(M)[0];p(cu,ft,"no child block");const pt=Ie(e,ft.id,0);ml(Y),e.updateBlockData(l,Y,pt),e.deleteChildContainers(U)})}const TE=10,MN=["table/merge-cells","table/split-cell","table/insert-column","table/insert-row","table/delete-rows","table/delete-columns","table/delete"];class F0{constructor(){m(this,"id","TableBlockCommandProvider")}getAvailableCommands(t,e,r){if(Ot(e)!=="table")return[];const i={blockId:dt(e),blockKind:Ei(t,e),blockType:Ot(e)},o=[];F2(t,e,r)&&o.push({id:"table/merge-cells",name:_.t("table.mergeCell"),icon:yT,groupIndex:TE,...i}),P2(t,e,r)&&o.push({id:"table/split-cell",name:_.t("table.splitCell"),icon:TT,groupIndex:TE,...i});const s=O2(t,e,r),l=N2(t,e,r);return s&&l&&o.push({id:"table/delete",name:_.t("table.deleteTable"),icon:kT,groupIndex:TE,...i}),o}executeCommand(t,e,r,i,o,s){return Ot(e)!=="table"||!new Set(MN).has(i.id)?!1:i.id==="table/merge-cells"?(K2(r),!0):i.id==="table/split-cell"?(yE(r),!0):i.id==="table/delete-columns"?(xE(r),!0):i.id==="table/delete-rows"?(bE(r),!0):i.id==="table/delete"?(t.deleteBlock(e),!0):!1}}var V2=(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))(V2||{});const uu=6,xd=20,kE="table-cell-menu-btn";function UN(n,t){if(!n.isBlockWritable(t))return;const r={...xt.default(n.getBlockData(t)),hasColTitle:!0};n.updateBlockData(t,r)}function ON(n,t){if(!n.isBlockWritable(t))return;const r={...xt.default(n.getBlockData(t)),hasColTitle:!1};n.updateBlockData(t,r)}function NN(n,t){if(!n.isBlockWritable(t))return;const r={...xt.default(n.getBlockData(t)),hasRowTitle:!0};n.updateBlockData(t,r)}function PN(n,t){if(!n.isBlockWritable(t))return;const r={...xt.default(n.getBlockData(t)),hasRowTitle:!1};n.updateBlockData(t,r)}function FN(n,t){if(!n.isBlockWritable(t))return;const r={...xt.default(n.getBlockData(t)),isStripeStyle:!0};n.updateBlockData(t,r)}function KN(n,t){if(!n.isBlockWritable(t))return;const r={...xt.default(n.getBlockData(t)),isStripeStyle:!1};n.updateBlockData(t,r)}function VN(n,t,e){if(!n.isBlockWritable(t))return;const i={...xt.default(n.getBlockData(t)),noBorder:!e};n.updateBlockData(t,i)}const os=D("table-cell-dom");function $N(n,t,e){let r=n.getBlockById(e);for(;r;){const i=r.closest("td");p(os,i,"no parent cell");const o=et(i);if(p(os,o,"no parent block"),o===t)return i;r=o}return p(os,!1,"filed to get cell by child block id"),null}function gl(n,t,e){if(n.getBlockById(e.blockId)===t&&!e.isSimple())return p(os,e.childContainerId,"block position must have childContainerId attribute"),e;const i=$N(n,t,e.blockId),o=Et(Cd(i));return Ue(t,o)}function RE(n,t){const e=n.selection.range,r=gl(n,t,e.start),i=gl(n,t,e.end);return Si(t,r,i)}function $2(n,t,e,r){p(os,dn(t),"invalid table block");const i=co(n,t),o=ve(t),s=()=>{const c=i.querySelector(".table-border-bar-container.top");p(os,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)?q(h,"danger"):ut(h,"danger")})},l=()=>{const c=o.querySelector(".table-border-bar-container.left");p(os,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)?q(h,"danger"):ut(h,"danger")})};s(),l()}function pl(n,t,e=!0,r){try{const o=Kt.fromBlock(t).map(h=>h),{fromCol:s,toCol:l,fromRow:c,toRow:d}=RE(n,t);for(let h=0;h<o.length;h++){const C=o[h];for(let E=0;E<C.length;E++){const A=C[E],v=r?E>=s&&E+A.colSpan-1<=l:h>=c&&h+A.rowSpan-1<=d;e&&v?A.virtual||q(A.cell,"danger"):A.virtual||ut(A.cell,"danger")}}}catch(i){os.error("update cells danger status failed: ",i.message)}}function Cl(n,t,e=!0,r){try{const i=new Set,o=new Set;if(!e){$2(n,t,Array.from(i),Array.from(o));return}const{fromCol:s,toCol:l,fromRow:c,toRow:d}=RE(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);$2(n,t,Array.from(i),Array.from(o))}catch(i){os.error("update cell bars danger status failed: ",i.message)}}function H2(n,t,e){const{fromCol:r,toCol:i,fromRow:o,toRow:s}=RE(n,t),l=Kt.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}),En(n,{anchor:Ue(t,c.containerId,{colIndex:r,rowIndex:0}),focus:Ue(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}),En(n,{anchor:Ue(t,c.containerId,{colIndex:0,rowIndex:o}),focus:Ue(t,d.containerId,{colIndex:l.colCount-1,rowIndex:s})}))}const j2=["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 z2(n){return`style-bg-color-${n}`}function fu(n){return`${n}_background`}function HN(n,t,e){const r=fn(n),s=(e!=null?e:Kt.fromTable(r)).getCell(t).cell;for(let l=0;l<j2.length;l++){const c=j2[l];if(Mt(s,c))return c}}function G2(n,t,e){if(!n.isBlockWritable(t))return;const r=n.selection.range,o={...xt.default(n.getBlockData(t))},s=gl(n,t,r.start),l=gl(n,t,r.end);if(r.isSimple()){const c=s.childContainerId;e===-1?o[fu(c)]=void 0:o[fu(c)]=z2(e)}else{const c=Kt.fromBlock(t),d=Si(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 A=c.getCell({row:C,col:E});!h.has(A.containerId)&&A.col>=d.fromCol&&A.row>=d.fromRow&&A.col+A.colSpan-1<=d.toCol&&A.row+A.rowSpan-1<=d.toRow&&(h.add(A.containerId),e===-1?o[fu(A.containerId)]=void 0:o[fu(A.containerId)]=z2(e))}}n.updateBlockData(t,o)}function jN(n,t,e){if(!n.isBlockWritable(t))return;const i={...xt.default(n.getBlockData(t)),chart:e};n.updateBlockData(t,i)}const W2=D("table-chart");function zN(n,t){const e=EN(n,t);if(e){const r=e.querySelector(".editor-table-chart");if(r){const i=r.chartObject;i&&i.destroy(),r.remove()}}}function K0(n){var t;return(t=n.textContent)!=null?t:""}async function GN(n,t){if(!n.contains(t)||!n.isBlockWritable(t))return;if(!!!n.getBlockData(t).chart){zN(n,t);return}const i=[],o=Kt.fromBlock(t),s=["line","bar","pie","radar"],l=o.getCell({row:0,col:0}).container;let c=K0(l).trim().toLowerCase();new Set(s).has(c)||(c=s[0]);const d=[];for(let S=1;S<o.colCount;S++)d.push(K0(o.getCell({row:0,col:S}).container));for(let S=1;S<o.rowCount;S++){const U=o.getCell({row:S,col:0}),M=U.container,V=K0(M),rt=[];for(let ce=1;ce<o.colCount;ce++){const Oe=K0(o.getCell({row:S,col:ce}).container),pe=Number.parseFloat(Oe)||0;rt.push(pe)}let Y;const X=HN(t,U,o);X?Y=window.getComputedStyle(n.rootElement).getPropertyValue(`--${X}`).trim():Y=window.getComputedStyle(n.rootElement).getPropertyValue("--background-color").trim();let[ft,pt,ct,wt]=Y?Rp.fromString(Y).toRgbaArray():[];if(!ft&&!pt&&!ct&&!wt){const ce=(S-1)%n.options.colors.length;Y=n.options.colors[ce],[ft,pt,ct,wt]=Rp.fromString(Y).toRgbaArray()}const vt=Y,Gt=Rp.fromRgba([ft,pt,ct,wt/3]).toHexString();i.push({label:V,data:rt,borderColor:vt,backgroundColor:Gt,borderWidth:2})}const h=co(n,t);let C=null,E=h.querySelector(".editor-table-chart");E?C=E.chartObject:E=B("div",["editor-table-chart"],h);const A=E;p(W2,A,"no chart container");const v=n.getComponentOptions("table"),w=(v==null?void 0:v.chartCdn)||"https://cdn.jsdelivr.net/npm/chart.js@2.9.4/dist/Chart.min.js";try{await ia(w,"editor-chartjs");let S=!1;(C&&C.config.data.datasets.length>i.length||C&&C.config.data.datasets[0].data.length>i[0].data.length)&&(S=!0),C&&(c!==C.config.type||S)&&(C.destroy(),C=null,Array.from(E.querySelectorAll(".editor-chartjs-canvas")).forEach(V=>{V.remove()}));const U=Sp.default({},{type:c,data:{datasets:i,labels:d},options:{onClick:()=>{n.selection.selectBlock(t,0,0)}}});if(C)Sp.default(C.config,U),C.update();else{const V=B("canvas",["editor-chartjs-canvas"],A).getContext("2d");C=new window.Chart(V,U),E.chartObject=C}}catch(S){W2.error(`failed to resolve chart cdn: ${JSON.stringify(S)}`)}}async function q2(n,t){await gi.lock("updateTableChart");try{await GN(n,t)}finally{gi.release("updateTableChart")}}const X2=Pe.default(q2,1e3);let Y2=null;function wE(n,t,e){if(Y2!==t&&(X2.flush(),Y2=t),e.updateNow){q2(n,t);return}X2(n,t)}function SE(n,t,e){e&&dn(e)&&wE(n,e,{updateNow:!1})}function WN(n,t){dn(t)&&wE(n,t,{updateNow:!0})}const Zr={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"},V0={SCROLL_BAR:"container-scrollbar",FIXED:"fixed"},El={SCROLL_CONTAINER:"scroll-container",TOOL:"container-scroll-tool",CONTAINER:"scroll-container-root",MAC:"mac",SCROLL_AREA:"scroll-area"};function bd(n,t){return n.containers.get(t)}function Q2(n){return n.closest(`.${El.SCROLL_CONTAINER}`)}function Li(n){return n.firstElementChild}function er(n){return n.closest(`.${El.CONTAINER}`)}function vd(n){const t=er(n);let e=t.querySelector(`:scope >.${El.TOOL}`);return e||(e=B("div",[El.TOOL],t)),e}function qN(n){return er(n).firstElementChild}function XN(n,t){const e=bd(n,er(t));return e!=null&&e.barFloatWindowBottom?typeof e.barFloatWindowBottom=="function"?e.barFloatWindowBottom():e.barFloatWindowBottom:0}function ti(n,t){const e=Hr(n);return t/e}function Bd(n){const t=window.getComputedStyle(n),e=Hr(n);return{paddingBottom:parseFloat(t.paddingBottom)*e,paddingTop:parseFloat(t.paddingTop)*e,paddingLeft:parseFloat(t.paddingLeft)*e,paddingRight:parseFloat(t.paddingRight)*e}}function du(n){const t=Hr(n);return{scrollLeft:n.scrollLeft*t,scrollWidth:n.scrollWidth*t,clientWidth:n.clientWidth*t,clientHeight:n.clientHeight*t}}function YN(n,t){const e=Hr(n);return n[t]*e}function LE(n,t){const e=er(t),r=bd(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 QN(n,t){const e=LE(n,t),{maxLeft:r}=e;t.style.marginLeft=`${ti(t,0-r)}px`,t.style.paddingLeft=`${ti(t,r)}px`}function JN(n,t){const e=LE(n,t);t.style.marginRight=`${ti(t,0-e.maxRight)}px`}function ZN(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 J2=D("scroll-bar-handle"),tP=2;function hu(n){const t=vd(n);let e=t.querySelector(`.${V0.SCROLL_BAR}`);return e||(e=B("div",[V0.SCROLL_BAR],t),de.isWindows&&de.isFirefox&&(e.style.minHeight="10px")),p(J2,e instanceof HTMLDivElement,"invalid child for container tools"),e.firstElementChild||B("div",[],e),e}function $0(n,t){const e=Q2(t),r=hu(e),{scrollWidth:i,clientWidth:o}=du(e),{paddingLeft:s,paddingRight:l}=Bd(t),c=LE(n,e),{originWidth:d,maxRight:h}=c;JN(n,e),QN(n,e);const C=i-o;p(J2,r.firstElementChild instanceof HTMLDivElement,"invalid child for scroll bar"),r.style.width=`${ti(e,d+h-s-l)}px`,r.firstElementChild.style.width=`${ti(e,d+h+C-s-l)}px`}function eP(n,t){const e=Li(n),{paddingLeft:r}=Bd(e);if(Mt(t,"fixed")){const o=er(n).getBoundingClientRect();t.style.left=`${ti(n,o.left+r)}px`}else t.style.left=`${ti(n,r)}px`}function mu(n,t){var M;const e=n.getParentScrollContainer(),r=ZN(e),i=t.getBoundingClientRect(),o=hu(t),s=o.getBoundingClientRect(),l=bd(n,er(t)),c=XN(n,t),d=Li(t),{paddingTop:h,paddingBottom:C}=Bd(d),{scrollWidth:E,clientWidth:A}=du(t),v=document.documentElement.clientHeight-c,w=r.top+du(e).clientHeight-v,S=v+Math.min(0,w);if(E>A&&i.top+h<S-s.height&&i.bottom>S-s.height+C&&!((M=l==null?void 0:l.isSetScale)!=null&&M.call(l))){l!=null&&l.allowScrollBarFixed&&q(o,V0.FIXED);const V=w>0?c:0;o.style.bottom=`${Math.max(document.documentElement.clientHeight-r.bottom,0)+tP+V}px`}else ut(o,V0.FIXED),o.style.bottom=`${ti(t,C-s.height)}px`;eP(t,o)}class nP{constructor(t,e){m(this,"intersectionObserver");m(this,"handleIntersection",t=>{t.forEach(e=>{this.containers.get(er(e.target))?(this.handleIntersectionEntry(e),this.callback(e)):this.intersectionObserver.unobserve(e.target)})});m(this,"handleIntersectionEntry",t=>{const e=t.target;mu(this.scrollCore,e);const r=Li(e);$0(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 Ta=D("container-scroll-shadow");function Z2(n,t,e){const r=n,i=t.getBoundingClientRect(),o=e.getBoundingClientRect(),{paddingTop:s,paddingBottom:l}=Bd(e);r.style.top=`${ti(t,o.top-i.top+s)}px`,r.style.bottom=`${ti(t,i.bottom-o.bottom+l)}px`}function tk(n,t){const e=n;t<24?e.style.width=`${(t/3).toFixed(2)}px`:e.style.width=""}function rP(n){const t=vd(n);p(Ta,t,"no container tools");let e=t.querySelector(`.${Zr.LEFT}`);if(!e){const l=Li(n),c=[Zr.COMMON,Zr.LEFT];e=B("div",c,t),p(Ta,e instanceof HTMLDivElement,"invalid child for container tools"),Z2(e,n,l)}p(Ta,e instanceof HTMLElement,"invalid child for container tools");const i=er(n).getBoundingClientRect(),o=n.getBoundingClientRect();e.style.left=`${ti(n,o.left-i.left)}px`;const s=du(n).scrollLeft;p(Ta,e instanceof HTMLDivElement,"invalid child for container tools"),tk(e,s),q(e,Zr.ACTIVE)}function iP(n){const t=vd(n);let e=t.querySelector(`.${Zr.RIGHT}`);if(!e){const h=Li(n),C=[Zr.COMMON,Zr.RIGHT];e=B("div",C,t),p(Ta,e instanceof HTMLDivElement,"no div, create shadow failed"),Z2(e,n,h)}p(Ta,e instanceof HTMLElement,"");const i=er(n).getBoundingClientRect(),o=n.getBoundingClientRect();e.style.right=`${ti(n,i.right-o.right)}px`;const{scrollWidth:s,scrollLeft:l,clientWidth:c}=du(n),d=s-l-c;p(Ta,e instanceof HTMLDivElement,"no shadow element"),tk(e,d),q(e,Zr.ACTIVE)}function oP(n){const e=vd(n).querySelector(`.${Zr.LEFT}`);e&&ut(e,Zr.ACTIVE)}function sP(n){const e=vd(n).querySelector(`.${Zr.RIGHT}`);e&&ut(e,Zr.ACTIVE)}function yd(n){const{scrollLeft:t,scrollWidth:e,clientWidth:r}=du(n),i=Li(n),{paddingLeft:o,paddingRight:s}=Bd(i),l=YN(i,"offsetLeft");e-o<=r-s||e-o<=t+r-s?sP(n):iP(n),i&&t>=l+o?rP(n):oP(n)}class lP{constructor(t,e){m(this,"resizeObserver");m(this,"handleResizeEntry",t=>{const e=t.target,r=Li(e);yd(e),$0(this.scrollCore,r),mu(this.scrollCore,e),this.callback(e)});m(this,"handleContentResize",t=>{t.forEach(e=>{this.containers.get(er(e.target))?this.handleResizeEntry(e):this.unbind(e.target)})});this.scrollCore=t,this.callback=e,this.resizeObserver=new ta(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 ek=D("container-scroll-observer");class aP{constructor(t,e){m(this,"handleContentScroll",t=>{const e=t.target;p(ek,e instanceof Element,"invalid target for scroll event");const r=hu(e);r.removeEventListener("scroll",this.handleScroll);const i=!0;this.fixScrollXPos(e,e.scrollLeft,i),this.bind(r),yd(e),this.callback(e)});m(this,"handleScroll",t=>{const e=t.target;p(ek,e instanceof HTMLElement,"");const r=e.scrollLeft,i=!1,o=qN(e);this.unbindContentScroll(o),this.fixScrollXPos(o,r,i),this.bindContentScroll(o),yd(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",Pe.default(this.bindContentScrollCore,300));m(this,"bind",Pe.default(this.bindCore,200));this.scrollCore=t,this.callback=e}fixScrollXPos(t,e,r){const i=hu(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 cP{constructor(t){m(this,"scrollContainers",new Set);m(this,"handleParentContainerScroll",()=>{this.scrollContainers.forEach(t=>{mu(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 uP=D("scroll-wrap-resize-observer");class fP{constructor(t){m(this,"resizeObserver");m(this,"handleScrollWrapResize",t=>{t.forEach(e=>{this.containers.get(er(e.target))?this.handleScrollWrapResizeEntry(e):this.unbind(e.target)})});m(this,"handleScrollWrapResizeEntry",t=>{const e=t.target;p(uP,e instanceof HTMLElement,"invalid target for observer entry");const r=Q2(e);$0(this.scrollCore,e),yd(r),mu(this.scrollCore,r)});this.scrollCore=t,this.resizeObserver=new ta(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 dP{constructor(t,e){m(this,"resizeObserver");m(this,"scrollContainersMap",new Map);m(this,"handleResizeEntry",t=>{t==null||t.forEach(e=>{const r=Li(e);yd(e),$0(this.scrollCore,r),mu(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 ta(this.handleResize)}bind(t){var i,o;const e=er(t),r=(i=bd(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=er(t),r=(o=bd(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 uat="";class hP extends He.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=Li(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=>{mu(this,r)})});this.parentContainer=e}load(){this.containerResizeObserver||(this.containerResizeObserver=new lP(this,this.handleResize)),this.containerScrollObserver||(this.containerScrollObserver=new aP(this,this.handleScrollContainerScroll)),this.parentContainerScrollObserver||(this.parentContainerScrollObserver=new cP(this)),this.scrollWrapResizeObserve||(this.scrollWrapResizeObserve=new fP(this)),this.locatingContainerResizeObserver||(this.locatingContainerResizeObserver=new dP(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=hu(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=hu(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(er(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 nP(this,this.handleIntersection)),this.containerIntersectionObserver.bind(i)}unbind(e){var o;const r=e.firstElementChild,i=Li(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 nk=D("scroll-container"),H0=new Map;class mP extends He.TypedEmitter{constructor(){super(...arguments);m(this,"scrollListener");m(this,"options");m(this,"scrollContainerElement");m(this,"init",e=>{this.options=e;const r=B("div",[El.CONTAINER],e.parentElement);de.isMac&&q(r,El.MAC);const i=B("div",[El.SCROLL_CONTAINER],r),o=B("div",[El.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=H0.get(s),this.scrollListener||(this.scrollListener=new hP(s),H0.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(nk,this.scrollContainerElement,"scrollContainerElement cannot be undefined"),Li(this.scrollContainerElement)}get scrollOptions(){return p(nk,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=er(this.contentElement);e&&H0.forEach((i,o)=>{i.unbind(e),i.containers.size===0&&(this.handleBaseListenerDestroy(i),H0.delete(o))})}}function gP(){return new mP}const IE=D("column-width");function pP(n,t,e){const r=xN(n,t);r.style.width=`${e}px`,r.style.minWidth=`${e}px`}function CP(n){const e=Array.from(n.querySelector("colgroup").children).map(c=>c.getBoundingClientRect().width);if(e[0]!==0)return e;const r=Kt.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)}),IE.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],A=(d-C)/(c-h);for(let v=h+1;v<c;v++)i[v]=C+A*(v-h)}IE.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 IE.debug(`widths: ${s.join()}`),s}function Td(n){return Array.from(n.querySelector("colgroup").children).map(r=>r.getBoundingClientRect().width||Number.parseInt(r.style.width,10))}const DE=200,EP=40,AP=D("table-resize-gripper"),rk=7,_E=(rk-1)/2,xP=3;function bP(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)<=_E&&d.top<=e&&e<=d.bottom)return c}}return null}function vP(n){return!!n.rootContainer.querySelector(".table-resize-gripper")}function ME(n,t){return co(n,t).querySelector(".table-resize-gripper")}function ik(n,t){const e=ME(n,t);p(AP,!e,"resize gripper has already exists");const r=co(n,t),i=B("div",["table-resize-gripper","table-indicator"],r);return B("div",["table-resize-gripper-indicator"],i),i}function ok(n,t,e){let r=ME(n,t);r||(r=ik(n,t));const o=fn(t).getBoundingClientRect(),s=e.getBoundingClientRect(),l=0,c=o.height,d=n.getCustom(ao(t)).contentElement.getBoundingClientRect(),h=s.right-d.left;r.style.left=`${h-_E-uu-xd}px`,r.style.top=`${l}px`,r.style.height=`${c}px`,r.style.width=`${rk}px`}function UE(n){n.rootContainer.querySelectorAll(".table-resize-gripper").forEach(t=>{t.remove()})}function BP(n,t,e){const i={...n.getBlockData(t),colsWidth:e};n.updateBlockData(t,i,void 0,{noScroll:!0})}function yP(n,t,e,r){const i=t,o=Kt.fromTable(e),s=o.getCellByCellElement(i),l=s.col+s.colSpan-1,c=Td(e);let d=r;const h=(E,A)=>{const v=A+1,w=E.col+E.colSpan;return c.slice(v,w).reduce((U,M)=>U+M,0)},C=new Set;for(let E=0;E<o.rowCount;E++){const A=o.getCell({row:E,col:l});if(C.has(A.cell))continue;C.add(A.cell);const v=A.cell,w=v.getBoundingClientRect();let S=r-w.left+_E-xP;const U=Cd(v),M=p1(n,U)||EP*A.colSpan,V=h(A,l),rt=M-V;S<rt&&(S=rt);const Y=w.left+S;d=Math.max(d,Y)}return d}const TP=D("table-resize-drag-drop");class kP{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=yP(this.editor,c,s,e.x-t.dragOffsetX)-s.getBoundingClientRect().left;p(TP,c,"no dragging cell");const E=Kt.fromTable(s).getCellByCellElement(c),A=E.col+E.colSpan-1,v=Td(s),w=v.slice(0,A).reduce((U,M)=>U+M,0),S=h-w;if(pP(s,A,S),S){const U=parseFloat(s.style.minWidth);s.style.minWidth=`${U+(S-v[A])}px`}ok(this.editor,l,c),this.editor.selection.caret.update()}onDragEnd(t,e,r,i,o){const s=Td(t.data.table);BP(this.editor,t.data.block,s),UE(this.editor),this.onEnd&&(this.onEnd(e),this.onEnd=null)}}function RP(n,t){const e=Fe(t.x,t.y);if(!e)return null;const r=et(e);return!r||!n.contains(r)||!dn(r)?null:r}D("table-resize");class wP{constructor(t){m(this,"draggingRefCell",null);m(this,"handleMouseMove",(t,e)=>{if(t.readonly||window.isDragging||t.selectionHandler.isSelecting()&&!this.draggingRefCell||this.draggingRefCell)return;const r=e.target;if(!(r instanceof Element))return;const i=et(r);if(!i||Ot(i)!=="table"||r.closest(".table-indicator"))return;const s=e,l=RP(t,s);if(!l||!M2(l)||!t.isBlockWritable(l)){UE(t);return}this.updateGripper(l,s.x,s.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=fn(t),o=bP(i,e,r);if(o){if(!ME(this.editor,t)){if(vP(this.editor))return;const l=ik(this.editor,t),c={block:t,table:i,draggingRefCell:o};Fp(new kP(this.editor,l,c,d=>{this.updateGripper(t,d.x,d.y)}))}ok(this.editor,t,o)}else UE(this.editor)}}function sk(n){n.addCustom("table-mouse-event-handler",t=>new wP(t))}const lk=D("table-insert-column");function ak(n,t,e){n.undoManager.runInGroup(()=>{var E;const r=fn(t),i=Kt.fromTable(r),o=i.colCount;p(lk,e>=0&&e<=o,`insert index ${e} is out of range [0, ${o}]`);const s=i.map(A=>A.containerId),l=new Set;n.doc.beginBatchUpdate();for(let A=0;A<s.length;A++){const v=s[A],w=v[e-1],S=v[e];if(e===0||e===v.length||w!==S){const U=Yo(n.doc);v.splice(e,0,U)}else v.splice(e,0,w),l.add(w)}n.doc.endBatchUpdate();const c=xt.default(n.getBlockData(t));l.forEach(A=>{const v=`${A}_colSpan`,w=c[v];p(lk,typeof w=="number"&&w>1,`no colSpan for containerId ${A}, ${w}`),c[v]=w+1});const d=((E=c.colsWidth)==null?void 0:E.concat())||new Array(c.cols).fill(0);d.splice(e,0,DE);const h=Kt.virtualCellContainersGridToChildren(s),C={...c,cols:c.cols+1,children:h,colsWidth:d};ml(C),n.updateBlockData(t,C)})}const j0=D("table-insert-row");function OE(n,t,e){n.undoManager.runInGroup(()=>{const r=fn(t),i=Kt.fromTable(r),o=i.rowCount;p(j0,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 A=e>0&&s[e-1][E],v=e<i.rowCount&&s[e][E];if(p(j0,A||v,"no top and bottom cell"),e===0||e===i.rowCount||A!==v){const w=Yo(n.doc);c.push(w)}else p(j0,A,"no top cell"),c.push(A),l.add(A)}n.doc.endBatchUpdate(),s.splice(e,0,c);const d=xt.default(n.getBlockData(t));l.forEach(E=>{const A=`${E}_rowSpan`,v=d[A];p(j0,typeof v=="number"&&v>1,`no rowSpan for containerId ${E}, ${v}`),d[A]=v+1});const h=Kt.virtualCellContainersGridToChildren(s),C={...d,rows:d.rows+1,children:h};ml(C),n.updateBlockData(t,C)})}const NE=D("paste-table-in-table-block");function SP(n,t,e,r,i){let o=Kt.fromBlock(e);const s=t.blocks.root[0];p(NE,s,"no table data"),p(NE,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,A=C+d,v=E+h,w=[];for(let S=C;S<A&&S<o.colCount;S++)for(let U=E;U<v&&U<o.rowCount;U++){const M=o.getCell({col:S,row:U});M.virtual?M.virtual&&w.push({col:S,row:U}):(M.colSpan>1||M.rowSpan>1)&&w.push({col:S,row:U})}n.undoManager.runInGroup(()=>{if(n.doc.beginBatchUpdate(),w.forEach(pt=>{const ct=Kt.fromBlock(e).getCell(pt);(ct.colSpan>1||ct.rowSpan>1)&&BE(n,e,pt)}),A>o.colCount)for(let pt=o.colCount;pt<A;pt++)ak(n,e,pt);if(v>o.rowCount)for(let pt=o.rowCount;pt<v;pt++)OE(n,e,pt);o=Kt.fromBlock(e);const S=new U0(l);let U;for(let pt=0;pt<S.colCount;pt++)for(let ct=0;ct<S.rowCount;ct++){const wt=S.getCell({col:pt,row:ct});if(!wt.virtual){const vt=lC(n.editorBlocks,t,wt.containerId,i),Gt=C+pt,ce=E+ct,Oe={col:Gt,row:ce},pe=o.getCellContainer(Oe);o5(n,pe,vt,i),U=pe}}const M={},V=[];for(let pt=0;pt<S.colCount;pt++)for(let ct=0;ct<S.rowCount;ct++){const wt=S.getCell({col:pt,row:ct}),vt=C+pt,Gt=E+ct,ce={col:vt,row:Gt},pe=o.getCell(ce).containerId;wt.virtual?V.push(pe):(wt.colSpan!==1&&(M[`${pe}_colSpan`]=wt.colSpan),wt.rowSpan!==1&&(M[`${pe}_rowSpan`]=wt.rowSpan),wt.background&&(M[`${pe}_background`]=wt.background))}const rt=n.getBlockData(e);V.length>0&&V.forEach(pt=>{rt.children=rt.children.filter(ct=>ct!==pt)});const Y={...rt,...M};ml(Y),p(NE,U,"no last container");const X=We(U);n.selection.selectBlock(X,At(n,X));const ft=Y;n.updateBlockData(e,ft),n.doc.endBatchUpdate()})}const PE=D("paste-in-table-block");class LP{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,A,v,w;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=at(i);if(ie(o))return this.pasteData=void 0,!1;if(!Of(t,o))return this.pasteData=void 0,!1;const s=et(o);if(p(PE,s,"no parent block"),!dn(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;PE.debug("paste child table in table");const d=Kt.fromBlock(s).getCellByContainerId(Et(o)).cell;kC(t,e);const h={blockIdMap:new Map,containerIdMap:new Map,boxIdMap:new Map};SP(t,e,s,d,h),p(PE,this.pasteData,"invalid paste data");const C=[];t.input.forEach(S=>{C.push(S)});for(let S=0;S<C.length&&!await((A=(E=C[S]).handleAfterPasteDoc)==null?void 0:A.call(E,t,e,h));S++);for(let S=0;S<C.length&&!await((w=(v=C[S]).handleAfterPaste)==null?void 0:w.call(v,t,this.pasteData.event,this.pasteData.doc));S++);return this.pasteData=void 0,!0}}function ck(n){n.addCustom("table-block-paste-event",t=>new LP(t))}const FE=D("table-select-columns");function IP(n,t,e,r,i){p(FE,dn(t),"is not a table block");const o=Kt.fromBlock(t);p(FE,e>=0&&e<o.colCount,"invalid from"),p(FE,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=Ue(t,s.containerId,{colIndex:e,rowIndex:0}),d=Ue(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 KE=D("table-select-columns");function DP(n,t,e,r,i){p(KE,dn(t),"is not a table block");const o=Kt.fromBlock(t);p(KE,e>=0&&e<o.rowCount,"invalid from"),p(KE,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=Ue(t,s.containerId,{rowIndex:e,colIndex:0}),d=Ue(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 fat="",uk=D("get-toolbar-reference-client");function fk(n,t){const e=n.selection.range;if(!e.isSimple()){p(uk,e.start.blockId===e.end.blockId,"invalid selection range");const s=n.getBlockById(e.start.blockId);p(uk,Pt(n,s),"not a complex block");const l=le(n,s);if(l.getTextToolbarReferenceClient){const c=l.getTextToolbarReferenceClient(n,s);if(c)return c}}const r=e.isReverse()?t.start:t.end,i=En(n,{anchor:r,focus:r}),o=Vo(n,t.block,i);if(o.length!==0)return o[0]}function _P(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 z0(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=Ip.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=z0(i),_P(s))}),e}function G0(n){return n.findCustom("toolbar-handler")}const dat="";class MP{constructor(){m(this,"linkPopup",null);m(this,"form",{});m(this,"onFinished",null);m(this,"onClose",null);m(this,"onBeforeFormatUrl",null);m(this,"handleOk",async()=>{var t;try{await this.checkValue();const{linkText:e,linkUrl:r}=this.form,i=r.getInputValue();let o="";this.onBeforeFormatUrl&&this.onBeforeFormatUrl(i)!==!1?o=this.onBeforeFormatUrl(i):o=this.formatUrl(i),(t=this.onFinished)==null||t.call(this,e.getInputValue()||o,o),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,e)=>{var r;if(!e){if(t.key==="Enter"){(r=this.form.linkUrl)==null||r.getField().focus(),t.stopPropagation();return}t.key==="Escape"&&this.handleClose()}});m(this,"handleUrlKeyboard",(t,e)=>{if(!e){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(_.t("link.urlPlaceholder")),new Error(_.t("link.urlPlaceholder"))}formatUrl(t){if(!t)return"";try{new URL(t)}catch{return`${window.location.protocol}//${t}`}return t}editLink(t){var C,E;const{target:e,linkText:r,linkUrl:i,onFinished:o,onClose:s,onBeforeFormatUrl:l,placement:c="bottom-start"}=t;this.linkPopup=new su(this.createPopupContent(r,i)),this.linkPopup.addListener("show",this.onShow),this.linkPopup.manualShow(e,{theme:"light",placement:c}),this.onFinished=o,s&&(this.onClose=s),l&&(this.onBeforeFormatUrl=l);const d=(C=this.linkPopup)==null?void 0:C.content.querySelector('[data-button-id="submit-button"]'),h=(E=this.linkPopup)==null?void 0:E.content.querySelector('[data-button-id="cancel-button"]');d==null||d.addEventListener("click",this.handleOk),h==null||h.addEventListener("click",this.handleClose)}createPopupContent(t,e){const r=B("div",["link-popup-content"],null);this.form.linkText=M0(r,{label:_.t("link.textLabel"),required:!1,placeholder:_.t("link.textPlaceholder"),defaultValue:t,onChange:this.onChange,onKeyDown:this.handleTextKeyboard}),this.form.linkUrl=M0(r,{className:"link-popup-gap",label:_.t("link.urlLabel"),required:!0,placeholder:_.t("link.urlPlaceholder"),defaultValue:e,onChange:this.onChange,onKeyDown:this.handleUrlKeyboard});const i=B("div",["link-popup-footer"],r),o=Jr("cancel-button",_.t("link.cancelText"));i.appendChild(o);const s=Jr("submit-button",_.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 kd(n,t){const e=n.addCustom("link-editor",()=>new MP),r=n.getComponentOptions("link"),i={...t,...r};e.editLink(i)}const UP=D("link-popup");function OP(n){return Mt(n,"link")}function Rd(n){var t,e;return(e=(t=n.getAttribute("link"))!=null?t:n.textContent)!=null?e:""}function NP(n,t,e){var i,o,s,l;if(n.isBlockWritable(t)&&e&&yr(e)){const c=e,d=(o=(i=n.editorBoxes.getBoxClass(If(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&&st(n,t)&&OP(e)){const c=B("a",["link-href-button"],null,Rd(e));c.href=Rd(e),c.target="_blank",c.rel="noopener noreferrer";const d=[{id:"link-text",name:Rd(e),disableTooltip:!0,element:c},{id:"edit-link",name:_.t("link.edit"),icon:I0},{id:"remove-link",name:_.t("link.remove"),icon:UT}];return{element:e,commands:d}}return Qv(n,t,"hovering-toolbar")}function dk(n,t,e){var l;const r=rl(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 PP(n,t,e){const[r,i]=dk(n,t,e);n.selection.selectBlock(t,r.start,r.end);const o=Rd(e),s=(h,C)=>{try{const E=n.getBlockText(t),A=V1(E,r.start,r.end-r.start),v=qo(A,r.start,h,{link:C});n.setBlockText(t,v),n.selection.selectBlock(t,r.start+h.length),n.focus()}catch(E){UP.error(E)}},l=()=>{n.selection.selectBlock(t,r.end),n.focus()},c=Vo(n,t,n.selection.range)[0];if(!c)return;const d=jo(n,t,"link-button-anchor",c);kd(n,{target:d,linkText:i,linkUrl:o,onFinished:s,onClose:l})}function FP(n,t,e){const[r]=dk(n,t,e),i=n.getBlockText(t),o=Rd(e),s=$c(r.start,r.end-r.start,i,"link",o);n.setBlockText(t,s),n.selection.selectBlock(t,r.end)}function KP(n,t,e,r){var s,l,c;if(e){if(n.isBlockWritable(t)&&yr(e)){const h=e,C=(l=(s=n.editorBoxes.getBoxClass(If(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=G0(n);d==null||d.disableTextToolbar(),d==null||d.hide(),setTimeout(()=>{d==null||d.enableTextToolbar()},400),r.id==="edit-link"?PP(n,t,e):r.id==="remove-link"&&FP(n,t,e);return}const i=Yv(n,t);if(!i)return;const o=(c=i.blockCommands)==null?void 0:c["hovering-toolbar"];!o||o.executeCommand(n,t,r)}function W0(){let n=8;for(;n>0&&!document.querySelector(`div[data-style-heading='${n}']`);)n--;return n}function ei(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!(!st(n,r)||$f(n,r,e.start.offset).charType!=="box")}const VP=[b0,v0,B0,y0,T0,k0,R0,w0];class $P{constructor(t){m(this,"id","BlockTurnIntoCommandProvider");this.editor=t}getHeadingIndex(){let t=W0();return t<=4?t=5:t<8&&(t+=1),t}getAvailableCommands(t,e,r){if(!st(t,e))return[];if(ei(t))return[];const i=dt(e),o=Ot(e),s=Ei(t,e),c=t.getBlockData(e).heading,d=[];for(let C=0;C<this.getHeadingIndex();C++)d.push({id:`heading-${C+1}`,name:_.t("commands.heading",{name:`${C+1}`}),icon:VP[C],states:c===C+1?["checked"]:[],value:`${C+1}`});const h=C=>{var A;const E=B("span",["toolbar-item-name-container"],null);for(const v of C.children)if((A=v.states)!=null&&A.includes("checked"))return E.innerHTML=v.icon||iu,E;return E.innerHTML=iu,E};return[{id:"turn-into",name:_.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:_.t("commands.text"),icon:iu,states:c?[]:["checked"]},...d],childrenType:"menu"}]}applyHeadingStyle(t,e,r){t.updateBlockData(e,{heading:r})}executeCommand(t,e,r,i){if(ei(t))return!1;if(st(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 HP=8,qe=D("list-block"),q0=D("list-block");function Ht(n){return Ot(n)==="list"}function nn(n){p(q0,Ht(n),"not a list block")}function wr(n){nn(n);const t=n.getAttribute("data-list-type");return p(q0,t,"no list type"),t}function X0(n){return Ht(n)&&wr(n)==="text-only"}function Sr(n){var t,e;return nn(n),(e=Number.parseInt((t=n.getAttribute("data-list-start"))!=null?t:"1",10))!=null?e:1}function Un(n){var t,e;return nn(n),(e=Number.parseInt((t=n.getAttribute("data-list-level"))!=null?t:"1",10))!=null?e:1}function gu(n){nn(n);const t=n.getAttribute("data-list-group-id");return p(q0,t,"no group id"),t}function uo(n){var o,s,l,c,d;nn(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(q0,i,"no group id"),{type:t,start:e,level:r,groupId:i}}function Y0(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 jP(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 zP="abcdefghijklmnopqrstuvwxyz";function hk(n){if(n<=0)return`${n}`;const t=(n-1)%26,e=Math.floor((n-1)/26),r=zP[t];return e?hk(e)+r:r}function GP(n){return`${n}`}const mk=[GP,hk,jP];function WP(n,t){const e=mk[(n-1)%mk.length];return e(t)}function qP(n){return["\u2022","\u25E6","\u25AA"][(n-1)%3]}function Al(n,t){nn(n);const{level:e,groupId:r,type:i}=uo(n);let o=ze(n);for(;o;){if(!Ht(o)){o=ze(o);continue}const{level:s,groupId:l,type:c}=uo(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=ze(o)}return null}function gk(n){return Al(n,{ignoreGroupId:!0})}function ka(n){nn(n);const{level:t,groupId:e,type:r}=uo(n);let i=ae(n);for(;i;){if(Ht(i)){const{level:o,groupId:s,type:l}=uo(i);if(t===o&&e===s&&(l==="text-only"||r==="text-only"||r===l))return i;if(o<t)return null}i=ae(i)}return null}function pk(n){nn(n);const t=[];let e=Al(n);for(;e;)t.unshift(e),e=Al(e);return t}function pu(n){nn(n);const t=[];let e=ka(n);for(;e;)t.push(e),e=ka(e);return t}function wd(n){nn(n);let t=Al(n);for(;t;){const e=Al(t);if(!e)return t;t=e}return n}function XP(n){nn(n);let t=ka(n);for(;t;){const e=ka(t);if(!e)return t;t=e}return null}function Ck(n,t){const e=pk(n),r=pu(n);return t.withSelf?[...e,n,...r]:[...e,...r]}function Q0(n){nn(n);let t=n;const e=pk(n);e.length>0&&(t=e[0]);const r=ze(t);return!r||!Ht(r)?null:Un(r)<Un(t)?r:null}function YP(n,t){nn(n);let e=n;for(;e;){const r=Un(e);if(r===t)return e;if(r>t)e=Q0(e);else if(r<t)return null}return null}function QP(n){let t=wd(n);for(;;){const e=Q0(t);if(!e)return t;t=wd(e)}}class JP{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(qe,i,"no parent node"),i.children.push(r)}else this.rootNodes.push(r)}}function Ek(n,t){const e=QP(t),r=new JP;r.addNode(null,e);let i=ae(e);for(;i&&Ht(i);){if(X0(i)){r.addNode(null,i),i=ae(i);continue}if(Un(i)===0&&wr(i)!==wr(e))break;const s=Q0(i);r.addNode(s,i),i=ae(i)}return r.rootNodes}function ZP(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 Ak(){const e=(document.exitFullscreen||document.webkitExitFullscreen).bind(document)();try{document.fullscreenElement=null}catch{}return e}function VE(n){return Mt(n,"editor-in-mindmap-first")}function $E(n){if(p(qe,Ht(n),"not a list block"),Mt(n,"editor-in-mindmap-first")||!Zs(n))return!0;const t=n.classList,e="editor-mindmap-root-";return!!Array.from(t).find(i=>{if(i.startsWith(e))return i})}function tF(n,t,e){const r=at(n);if(t){const s=at(t);p(qe,r===s,"invalid block container")}const i=Rt(n);if(t){const s=Rt(t);p(qe,i<=s,"invalid block index")}if(q(n,...e),!t||t===n)return;let o=ae(n);for(;o!==t;)p(qe,o,"no next button"),q(o,...e),o=ae(o);o&&q(o,...e)}function eF(n){const t=`editor-mindmap-root-${n.id}`,r=at(n).querySelectorAll(`.${t}`);return r[r.length-1]}async function nF(n,t,e){const r=ve(t),i=r.querySelector('[data-button-id="mindmap-fullscreen"]');p(qe,i,"no full screen button");const o=()=>{setTimeout(()=>{e.toMindmap(n,t,{},{reset:!0,mindmapTools:e})},300)},s=()=>{ut(r,"fullscreen"),i.innerHTML=fE,i.setAttribute(`data-editor-tooltip-${n.clientId}-dynamic`,_.t("mindmap.fullScreen")),$E(t)&&setTimeout(()=>{o()},300)};if(document.fullscreenElement===r){try{await Ak()}catch(l){qe.error(l)}s()}else{try{q(r,"fullscreen"),await ZP(r),o()}catch(l){qe.error(l)}i.innerHTML=C2,i.setAttribute(`data-editor-tooltip-${n.clientId}-dynamic`,_.t("mindmap.exitFullscreen"))}r.onfullscreenchange=()=>{document.fullscreenElement||s()}}function HE(n,t,e,r,i){if(t.querySelector(`[data-button-id="${e}"]`))return null;const s=Jr(e,r,i,[]);return s.setAttribute(`data-editor-tooltip-${n.clientId}-dynamic`,r),q(s,"mindmap-button"),t.appendChild(s),s}function jE(n,t){return n.querySelector(`[data-button-id="${t}"]`)}function rF(n){return jE(n,"mindmap-fullscreen")}function iF(n){return jE(n,"mindmap-fit")}function oF(n){return jE(n,"mindmap-close")}function sF(n,t,e,r){const i=HE(n,t,"mindmap-close",_.t("mindmap.close"),A0);!i||n.domEvents.addEventListener(i,"click",()=>{r.closeMindmap(n,e)})}function lF(n,t,e,r){const i=HE(n,t,"mindmap-fit",_.t("mindmap.autoFit"),p2);!i||n.domEvents.addEventListener(i,"click",()=>{r.fitMindmap(n,e)})}function aF(n,t,e,r){if(navigator.userAgent.includes("Mobile")&&!navigator.userAgent.includes("iPad"))return;const o=HE(n,t,"mindmap-fullscreen",_.t("mindmap.fullScreen"),fE);!o||n.domEvents.addEventListener(o,"click",()=>{nF(n,e,r)})}function cF(n,t){const e=ym(t);if(!e)return;const r=iF(e);r&&(r.remove(),n.domEvents.removeAllListeners(r));const i=oF(e);i&&(i.remove(),n.domEvents.removeAllListeners(i));const o=rF(e);o&&(o.remove(),n.domEvents.removeAllListeners(o))}const Cu=new Map;function zE(n,t,e){const r=(s,l)=>{s.forEach(c=>{l?q(c.block,"to-mindmap-highlight"):ut(c.block,"to-mindmap-highlight"),r(c.children,l)})},i=Ek(n,t);if(i.length===0)return;const o=i[0].block;if(e){const s=Cu.get(o);s&&(s.forEach(l=>l.cancel()),Cu.delete(o)),r(i,!0)}else{const s=setTimeout(()=>{r(i,!1),Cu.delete(o)},300),l=()=>{clearTimeout(s),Cu.delete(o)},c=Cu.get(o);c?c.push({cancel:l}):Cu.set(o,[{cancel:l}])}}const{Markmap:uF}=p9;function fF(n,t){nn(t);const e=Ek(n,t),r=e[0].block,i=d=>({type:"text",content:zt(d.block).textContent,depth:1,children:d.children.length>0?d.children.map(C=>i(C)):void 0});let o=null;e.length>1?o={type:"root",content:"root",depth:0,children: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 J0(n,t,e,r){const{root:i,block:o,last:s}=fF(n,t);r.selectBlock&&n.selection.selectBlock(o,0,0),zE(n,o,!1),r.saveData&&n.updateBlockData(o,{viewAsMindmap:!0});const l=ve(o);let c=l.querySelector(".editor-mindmap-svg");if(r.reset&&(c&&c.remove(),c=null),c)c.innerHTML="";else{const U="http://www.w3.org/2000/svg",M=l.getBoundingClientRect(),V=document.fullscreenElement===l,rt=V?`${M.width}`:`${t.getBoundingClientRect().width}`,Y=V?`${M.height}`:"600",X=document.createElementNS(U,"svg");X.setAttributeNS(null,"viewBox",`0 0 ${rt} ${Y}`),X.setAttributeNS(null,"width","100%"),X.setAttributeNS(null,"height",Y),X.style.display="block",X.style.width="100%",X.style.height=`${Y}px`,X.classList.add("editor-mindmap-svg"),l.appendChild(X),c=X}const d=o,C=`editor-mindmap-root-${dt(o)}`;q(d,"editor-in-mindmap-first",C,"readonly"),d.contentEditable="false";const E=ae(o);E&&Rt(E)<=Rt(s.block)&&tF(E,s.block,["block-hidden",C]);const A=(U,M)=>{if(M.length>0){const V=M[0].parentElement;V&&(V.style.width="100vw",V.style.maxWidth="200px")}M.forEach(V=>{q(V,"editor-mindmap-node")})},v=new uF(c,{...e,autoFit:!0});v.viewHooks.transformHtml.tap(A),v.setData(i),v.fit();const w=ve(o);let S=w.querySelector(".mindmap-toolbar");S||(S=B("div",["mindmap-toolbar"],w)),lF(n,S,d,r.mindmapTools),aF(n,S,d,r.mindmapTools),sF(n,S,d,r.mindmapTools),n.domEvents.addEventListener(c,"click",()=>{n.selection.selectBlock(o,0),n.input.focus()}),d.mindMap=v}function dF(n){const t=B("div",["list-to-mindmap-wrap"],null),e=Jr("list-to-mindmap",_.t("mindmap.viewAsMindMap"),g2,[],n.clientId);return t.appendChild(e),t}async function xk(n,t){const e=`editor-mindmap-root-${t.id}`,r=at(t);ke(r).forEach(l=>{Mt(l,e)&&ut(l,e,"editor-in-mindmap-first","block-hidden")});const o=ve(t);document.fullscreenElement===o&&await Ak();const s=o.querySelector(".editor-mindmap-svg");!s||(p(qe,s,"no mindmap svg"),s.remove(),n.domEvents.removeAllListeners(s),cF(n,t))}function hF(n){const t=n.classList,e="editor-mindmap-root-";return Array.from(t).find(i=>{if(i.startsWith(e))return i})}async function bk(n,t){!hF(t)||(n.updateBlockData(t,{viewAsMindmap:null}),xk(n,t),n.selection.selectBlock(t,0))}function mF(n,t){const e=t.mindMap;e&&e.fit()}const Z0={toMindmap:J0,closeMindmap:bk,fitMindmap:mF},hat="";class tg{constructor(t){m(this,"toMindmapButton");m(this,"currentBlock",null);m(this,"handleHoveringBlock",t=>{t&&Ht(t)&&wr(t)!=="unchecked"&&wr(t)!=="checked"&&this.editor.isWritable()?ve(t).appendChild(this.toMindmapButton):this.toMindmapButton.remove()});m(this,"handleMouseEnter",()=>{const t=et(this.toMindmapButton);p(qe,t&&Ht(t),"no parent list"),zE(this.editor,t,!0),this.currentBlock=t});m(this,"handleMouseLeave",()=>{this.currentBlock&&(zE(this.editor,this.currentBlock,!1),this.currentBlock=null)});m(this,"handleClick",()=>{const t=et(this.toMindmapButton);p(qe,t&&Ht(t),"no parent list"),J0(this.editor,t,{},{saveData:!0,selectBlock:!0,mindmapTools:Z0})});this.editor=t,je.get(this.editor).addListener("change",this.handleHoveringBlock),this.toMindmapButton=dF(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(tg)}destroy(){je.get(this.editor).removeListener("change",this.handleHoveringBlock)}hide(){this.currentBlock&&(this.currentBlock=null),this.toMindmapButton.remove()}}function gF(n,t,e){var r;t==="beginDrag"&&((r=tg.get(n))==null||r.hide())}function Eu(n,t,e,r){var o;const i=(o=r==null?void 0:r.groupId)!=null?o:it();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 GE(n,t,e,r){const i=Ck(t,{withSelf:!0});i.length!==0&&Eu(n,i,e,r)}class Au{constructor(t,e){m(this,"listStart",0);m(this,"listBrother",null);if(this.editor=t,X0(e))return;const r=wd(e),i=Sr(r);this.listStart=i,r===e?this.listBrother=ka(r):this.listBrother=r}fix(){if(!!this.listBrother){if(xf(this.listBrother)){this.listBrother=null;return}GE(this.editor,this.listBrother,this.listStart)}}}class Ra{constructor(t,e,r){m(this,"listStart");m(this,"listBrother",null);this.editor=t,this.options=r;const i=wd(e),o=Sr(i);this.listStart=o,this.listBrother=i,r!=null&&r.resetStart&&(this.listStart=1)}fix(){!this.listBrother||GE(this.editor,this.listBrother,this.listStart,this.options)}}class vk{constructor(t,e,r){m(this,"listStart");m(this,"listNextBrothers",[]);this.editor=t,this.listNextBrothers=pu(e);const{start:i,resetStart:o}=r||{};this.listStart=o?1:i!=null?i:1}fix(){!this.listNextBrothers.length||Eu(this.editor,this.listNextBrothers,this.listStart)}}function pF(n,t,e){n.getBlockData(t).quoted&&(e.quoted=!0)}function WE(n,t,e,r){if(qe.debug("drag a block on a list block"),!st(n,t))return!1;p(qe,Ht(e),"target is not a list block");const{type:i,start:o,level:s,groupId:l}=uo(e),c=r==="after"?o+1:o,d=n.getBlockData(t),h={id:it(),type:"list",groupId:l,level:s,start:c,text:d.text,...Y0(i)};pF(n,e,h);let C=Rt(e);const E=at(e);r==="after"&&(C+=1);let A=null;Ht(t)&&(A=new Au(n,t));const v=n.insertBlock(Et(E),C,h,Vm(h.id,0));return n.deleteBlock(t),l!==d.groupId&&new Ra(n,v).fix(),A==null||A.fix(),!0}function CF(n,t,e,r){if(qe.debug("drag a list between text blocks"),r==="after"){const d=ae(e);if(d&&Ht(d))return WE(n,t,d,"before")}if(r==="before"){const d=ze(e);if(d&&Ht(d))return WE(n,t,d,"after")}const o={...n.getBlockData(t),groupId:it(),start:1,level:1};let s=Rt(e);const l=at(e);r==="after"&&(s+=1),n.insertBlock(Et(l),s,o,Vm(o.id,0));const c=new Au(n,t);return n.deleteBlock(t),c.fix(),!0}function EF(n,t,e,r,i){if(Am(e))return!1;const{blockId:o}=e,s=n.getBlockById(o);p(qe,s,"no dragged block");const{isSourceBlock:l,targetBlock:c}=i;return!l&&c?(p(qe,t===c,"block !== target block"),p(qe,Ht(c),"target is not a list block"),WE(n,s,c,r)):CF(n,s,c,r)}function Bk(n,t){if(!n.isWritable())return!1;const e=n.selection.range,i=n.editorCommandProviders.getCommands(e,"shortcut").find(o=>o.id===t);return i?(n.editorCommandProviders.executeCommand(e,i,{}),!0):!1}const AF={"Shift+CtrlOrCmd+L":n=>Bk(n,"ordered-list"),"Shift+CtrlOrCmd+U":n=>Bk(n,"unordered-list")};function eg(n){const t=n.getAttribute("block-padding-level");return t?Number(t):null}function xF(n,t){let e;const r=eg(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 yk(n,t){const e=eg(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 qE(n){return n.readonly||!n.isWritable()}function bF(n){return n.selection.range.getSelectedBlocks().forEach(e=>{const r=e.block;st(n,r)&&xF(n,r)}),!0}function vF(n){return n.selection.range.getSelectedBlocks().forEach(e=>{const r=e.block;st(n,r)&&yk(n,r)}),!0}function BF(n){return qE(n)?!1:n.undoManager.runInGroup(()=>(bF(n),!0))}function yF(n){return qE(n)?!1:n.undoManager.runInGroup(()=>(vF(n),!0))}function TF(n){if(qE(n))return!1;if(!n.selection.range.isCollapsed())return;const t=n.selection.focusedBlock;if(!st(n,t))return;const e=n.selection.range.focus;if(!(!e.isSimple()||e.offset!==0||!eg(t)))return yk(n,t),!0}class XE{renderBlock(t,e,r){const{padding:i}=r;return i?{attributes:{"block-padding-level":i}}:{}}}const mat="",kF={Tab:BF,"Shift+Tab":yF,Backspace:TF};function RF(n,t,e=1){if(!t)return null;let r=ze(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 Ht(r)?r:null}r=ze(r)}return null}function wF(n,t){const e=n.getAttribute("data-style-heading"),r=RF(n,e);if(r)return r;const i=ze(n);if(i&&Ht(i)&&wr(i)===t)return i;const o=ae(n);return o&&Ht(o)&&wr(o)===t?o:null}function SF(n,t,e){var w,S,U;const r=(w=e.data)!=null?w:{};let i=1;if(Ht(t))i=Un(t);else{const M=eg(t);M&&(i=M+1),i>8&&(i=8)}const o=(S=r.listType)!=null?S:"ordered";if(o==="text-only")return null;const s=n.getBlockData(t);let l=(U=s.text)!=null?U:[],d=Re(l);const h=e.offset||0;h<=jn(l)&&(l=ar(l,h).right,d=d.substring(0,h));let C=1;o==="ordered"&&(C=Number.parseInt(d,10)||1);let E=it();const A=wF(t,o);if(A)if(Un(A)===i){if(Rt(t)>Rt(A))C=Sr(A)+1;else{const M=Sr(A);M>1&&(C=M-1),new vk(n,A,{start:C+1}).fix()}E=gu(A)}else{const M=YP(A,i);M&&(C=Sr(M)+1)}else Ht(t)&&new vk(n,t,{start:1}).fix();const v={id:it(),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:(M,V)=>{new Ra(M,V).fix()}}}function xl(n){return n.textOnly?"text-only":n.checkbox?n.checkbox:n.ordered?"ordered":"unordered"}function LF(n){var e,r;if(n.checkbox)return"";const t=(e=n.level)!=null?e:1;return n.ordered?`${WP(t,(r=n.start)!=null?r:1)}.`:qP(t)}function ng(n){return n==="checked"||n==="unchecked"}function Tk(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=xl(i),d=xl(l);return c!==d&&(!ng(c)||!ng(d))||(i.level||1)>(l.level||1)}function kk(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=xl(i),d=xl(l);return c!==d&&(!ng(c)||!ng(d))||(i.level||1)>(l.level||1)}function IF(n,t,e,r,i){var s,l,c;const o=t;if(r==="text")return((s=ur.convertTo)==null?void 0:s.call(ur,n,t,e,"text",i))||"";if(r==="markdown"){let d=((l=ur.convertTo)==null?void 0:l.call(ur,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,Tk(n,t,e,i)&&(d=`${d}`),kk(n,t,e,i)&&(d=`${d}`,h<=1&&(d+=`
|
|
614
614
|
`)),d}if(r==="html"){let d=((c=ur.convertTo)==null?void 0:c.call(ur,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 Tk(n,t,e,i)&&(d=`<${h}${C?` style="${C}"`:""}>${d}`),kk(n,t,e,i)&&(d=`${d}</${h}>`),d}return""}function Rk(n){const t=B("label",["editor-check-list-wrapper"],null);n&&q(t,"editor-check-list-wrapper-checked");const e=B("span",["editor-check-box"],t);return B("span",["editor-check-box-inner"],e),t}function DF(n,t){const e=xl(t);if(e!=="text-only"){if(e==="checked"){n.append(Rk(!0));return}if(e==="unchecked"){n.append(Rk(!1));return}n.innerText=LF(t)}}function _F(n){const t=B("div",["list-container"],null),e=B("button",["list-marker"],t);return DF(e,n),t}function xu(n,t){nn(t);const e=n.getBlockData(t),r={id:it(),type:"text",text:e.text};e.heading&&(r.heading=e.heading),e.heading&&(r.heading=e.heading);const i=at(t),o=Rt(t);n.deleteBlock(t);const s=Vm(r.id,0);if(Of(n,i)&&!ie(i)){const l=Me(i);n.insertBlock(Et(i),o,r,s),n.deleteBlock(l)}else n.insertBlock(Et(i),o,r,s)}function MF(n){if(!n.selection.range.isCollapsed())return!1;const t=n.selection.focusedBlock;if(!Ht(t))return!1;const e=n.selection.range.focus;return!e.isSimple()||e.offset!==0?!1:(xu(n,t),!0)}function wk(n){let t=ae(n);if(!t)return null;const e=ka(n);for(;t!==e;){if(p(qe,t,"no next block"),Ht(t))return Un(t)>Un(n)?t:null;if(t=ae(t),!t)return null}return null}function YE(n){const t=[];let e=wk(n);if(!e)return t;for(;e;){const r=ka(e);t.push({block:e,children:YE(e)}),e=r}return t}function UF(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 Sk(n,t){return Un(t)!==1}function Lk(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&&Lk(n,r.children,i.groupId)})}function QE(n,t){if(!Sk(n,t))return!1;const e=Un(t);if(e===1)return!1;let r=it(),i=1,o=wr(t);const s=e-1,l=Q0(t);l&&(r=gu(l),i=Sr(l)+1,o!=="text-only"&&(o=wr(l)));const c=YE(t),d=n.getBlockData(t),h={...d,groupId:r,level:s,start:i,...Y0(o)};n.updateBlockData(t,h),n.doc.beginBatchUpdate(),Lk(n,c,d.groupId),n.doc.endBatchUpdate(),new Ra(n,t).fix();const E=wk(t);return E&&new Ra(n,E,{resetStart:!0,resetGroupId:!0}).fix(),!0}const OF=D("list-block");function NF(n,t,e){p(OF,Ht(t),"not a list block");const r={...n.getBlockData(t),id:it()};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 PF(n){if(nn(n),!X0(n))return n;let t=Al(n);for(;t;){if(!X0(t))return t;t=Al(t)}return null}function FF(n,t,e,r){const i=new Ra(n,r),o=Sr(r)+1;Xc(n,t,e,{forceInsertAfter:!0,newBlockData:NF(n,r,{start:o})}),i.fix()}function KF(n){var s;if(n.selection.range.isCollapsed()){const l=n.selection.focusedBlock;if(Ht(l)&&At(n,l)===0)return Un(l)===1?xu(n,l):QE(n,l),!0}n.clearSelectedContents();const t=n.selection.focusedBlock;if(!Ht(t))return!1;const e=n.selection.range.focus;if(!e.isSimple())return!1;const r=e.offset,o=(s=r===At(n,t)?PF(t):t)!=null?s:t;return FF(n,t,r,o),!0}function Ik(n){p(qe,Ht(n),"not a list block");const{level:t}=uo(n);let e=ze(n);for(;e;){if(Ht(e)){const{level:r}=uo(e);if(t===r)return e;if(r<t)return null}e=ze(e)}return null}function Dk(n,t){return nn(t),Ik(t)?Un(t)<HP:!1}function VF(n,t,e){let r=ze(t);p(qe,r,"no prev brother");const i=Un(e);for(;r;){if(r===e)return null;if(Ht(r)&&Un(r)===i+1)return r;r=ze(r)}return null}function _k(n,t){if(!Dk(n,t))return!1;nn(t);const e=Ik(t);p(qe,e,"no list prev brother");const r=e,i=VF(n,t,r),o=Un(r)+1;let s=it(),l=1,c=wr(t);i&&(s=gu(i),l=Sr(i)+1,c=wr(i));const d=YE(t),C={...n.getBlockData(t),groupId:s,level:o,start:l,...Y0(c)};return n.updateBlockData(t,C),n.doc.beginBatchUpdate(),UF(d).forEach(A=>{const v=n.getBlockData(A);n.updateBlockData(A,{...v,level:(v.level||1)+1})}),n.doc.endBatchUpdate(),!0}function $F(n,t,e){return t.length===0||!t.every(r=>Ht(r.block))?!1:e==="increase"?Dk(n,t[0].block):Sk(n,t[0].block)}function Mk(n,t,e){if(!$F(n,t,e))return!1;const r=t[0].block,i=Un(r),o=t.filter(d=>Un(d.block)<=i),s=Ck(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 Ra(n,c[0])),o.forEach(h=>{e==="increase"?_k(n,h.block):QE(n,h.block)}),d==null||d.fix()}),!0}function HF(n,t){return _k(n,t)}function jF(n,t){return QE(n,t)}function zF(n){const t=n.selection.range.getSelectedBlocks();if(t.length>1)return Mk(n,t,"increase"),!0;const e=t[0].block;if(!Ht(e))return!1;const r=new Au(n,e);return HF(n,e)&&(r.fix(),new Ra(n,e).fix()),!0}function GF(n){const t=n.selection.range.getSelectedBlocks();if(t.length>1)return Mk(n,t,"decrease"),!0;const e=t[0].block;return Ht(e)?(jF(n,e),!0):!1}class WF{constructor(t){this.editor=t}handleBeforeKeyDown(t,e){const r=t.selection.range.getSelectedBlocks();if(r.length===0||!r.some(o=>Ht(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||!Ht(e.block)||Wi(t,"Shift+Enter")?!1:this.editor.undoManager.runInGroup(()=>KF(this.editor))}handleBackspace(){return this.editor.undoManager.runInGroup(()=>MF(this.editor))}handleTab(t){return Wi(t,"Shift+Tab")?this.editor.undoManager.runInGroup(()=>GF(this.editor)):this.editor.undoManager.runInGroup(()=>zF(this.editor))}}class qF{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;Ht(o)&&e.add(o)});const r=new Map;Array.from(e.values()).forEach(i=>{var c;const o=wd(i),{start:s}=uo(o);r.set(dt(o),s);const l=(c=XP(i))!=null?c:i;r.set(dt(l),s)}),this.effectedBlockIds=r});m(this,"handleAfterClearSelection",()=>{Array.from(this.effectedBlockIds.entries()).forEach(([t,e])=>{const r=this.editor.findBlockById(t);!r||GE(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 XF=D("customize-list-start-menu");class YF{constructor(t){m(this,"popup");m(this,"block",null);m(this,"show",(t,e)=>{const r=e.querySelector("div.list-container");p(XF,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,_.t("list.numberLabel"));const e=this.createNumericInput();t.appendChild(e);const r=B("button",["customize-start-panel-button"],t,_.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=Sr(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(()=>{Eu(this.editor,[r,...pu(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 su(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 QF(n,t){return gu(n)===gu(t)}function JF(n,t){const e=gk(t);return e?QF(e,t)?Sr(e)!==Sr(t)-1:!0:!1}function ZF(n,t){return Al(t)?!0:Sr(t)!==1}function tK(n,t){return nn(t),[{id:"continue-numbering",name:_.t("list.continueList"),states:JF(n,t)?[]:["disabled"]},{id:"start-new-list",name:_.t("list.restartList"),states:ZF(n,t)?[]:["disabled"]},{id:"set-numbering-value",name:_.t("list.changeNumber")}]}function eK(n,t,e){var r,i;if(nn(t),e.id==="continue-numbering"){const o=gk(t);o&&Eu(n,[t,...pu(t)],Sr(o)+1,{resetGroupId:!0,groupId:gu(o)})}if(e.id==="start-new-list"&&n.undoManager.runInGroup(()=>{Eu(n,[t,...pu(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 YF(n)).show(n,t)}}class nK{constructor(t){m(this,"menu");m(this,"handleClick",(t,e)=>{const r=Dc(e,"div.list-container");if(r&&this.editor.isWritable()){const i=et(r);p(qe,i,"no parent block"),nn(i);const o=t.getBlockData(i);if(o&&o.checkbox){t.updateBlockData(i,{...o,checkbox:o.checkbox==="checked"?"unchecked":"checked"});return}if(wr(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=et(r);o&&eK(this.editor,o,e)}});this.editor=t,this.editor.addListener("click",this.handleClick),this.menu=new hl([]),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 tK(this.editor,t)}activeList(t,e){const r=et(t);!r||(e?(q(t,"active"),q(r,"active")):(ut(t,"active"),ut(r,"active")))}}class rK{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(!Ht(i)||!$E(i))return!1;if(e.key==="ArrowUp"||e.key==="ArrowLeft"){const o=zr(i);return o&&t.selection.selectBlock(o,At(t,o)),!0}if(e.key==="ArrowDown"||e.key==="ArrowRight"){const o=Gr(i);return o&&t.selection.selectBlock(o,0),!0}return(e.key==="Delete"||e.key==="Backspace"||e.key==="Escape")&&bk(t,i),!0}}function iK(n,t,e,r,i){wC(n,"list-block-init",()=>{setTimeout(()=>{n.input.addHandler(new rK(n)),n.input.addHandler(new WF(n)),n.addCustom("list-clear-selection-handler",()=>new qF(n)),n.addCustom("list-marker-menu",()=>new nK(n))})});const o=ur.createBlockContent(n,t,e,r,i),s=i,{level:l,start:c,groupId:d}=s,h=xl(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=_F(s);return r.insertBefore(C,o),s.viewAsMindmap?setTimeout(()=>{const E=n.findBlockById(i.id);E&&J0(n,E,{},{mindmapTools:Z0,saveData:!1})}):setTimeout(()=>{const E=n.findBlockById(i.id);E&&xk(n,E)}),o}const oK={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"}},sK={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"}},lK={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"}};_.mergeLang({"zh-CN":oK,"en-US":sK,"ja-JP":lK});const gat="",aK=D("list-block:paste-handler");class Uk{constructor(){m(this,"fixStartByList",null)}async handleBeforePasteDoc(t,e){const r=new Map,i=new Map;return Object.values(e.blocks).forEach(o=>{o.forEach((s,l)=>{if(s.type==="list"){if(l===0){const d=t.selection.startBlock;if(Ht(d)){const{start:C,groupId:E,level:A,type:v}=uo(d),w=xl(s),S=s.groupId;s.groupId=E,s.start=C,s.level=A;const U=Y0(v);Object.assign(s,U),A===s.level&&v===w&&(r.set(S,E),i.set(E,C)),this.fixStartByList=new Au(t,d);return}const h=ze(d);if(h&&Ht(h)){const{start:C,groupId:E,level:A,type:v}=uo(h),w=xl(s);if(A===s.level&&v===w){const S=s.groupId;s.groupId=E,s.start=C+1,s.level=A,r.set(S,E),i.set(E,C+1),this.fixStartByList=new Au(t,h);return}}}const c=r.get(s.groupId);if(c){const d=i.get(c);p(aK,d,"start is null"),s.start=d+1,s.groupId=c,i.set(c,d+1)}else{const d=it();r.set(s.groupId,d),s.groupId=d,s.start=1,i.set(d,1)}}})}),!1}async handleAfterPaste(t){return t.undoManager.runInGroup(()=>{this.fixStartByList&&(this.fixStartByList.fix(),this.fixStartByList=null)}),!1}}const cK=D("list selection to doc");function uK(n){const t={type:"text"};return Object.entries(n).forEach(([e,r])=>{["ordered","unordered","checked","unchecked","text-only","start","level","groupId","type"].includes(e)||(t[e]=r)}),t}function fK(n,t){const e=xt.default(Qo(n,t.block)),r=t.start,i=t.end;p(cK,e.text,"no block text");const o=At(n,t.block);if(i.offset-r.offset===o)return{blocks:{root:[{...e}]},meta:{},comments:{}};const s=uK(e);if(r.offset===i.offset)return{blocks:{root:[{...s,text:[]}]},meta:{},comments:{}};const{middle:l}=an(e.text,r.offset,i.offset-r.offset);return{blocks:{root:[{...s,text:l}]},meta:{},comments:{}}}const Ok={...ur,blockType:"list",createBlockContent:iK,convertFrom:SF,convertTo:IF,handleDrop:EF,notify:gF,handleDeleteBlock:(n,t)=>{if(Ht(t)){const e=new Au(n,t);setTimeout(()=>{e.fix()})}},selectionToDoc:fK},JE=D("paragraph");class dK{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(!st(t,e))return[];if(ei(t))return[];const r=[],i={"unordered-list":[_.t("commands.unordered"),gn("CtrlOrCmd+Shift+U"),wT],"ordered-list":[_.t("commands.ordered"),gn("CtrlOrCmd+Shift+L"),RT],"check-list":[_.t("commands.check"),void 0,ST],link:[_.t("commands.link"),gn("CtrlOrCmd+K"),oE],quoted:[_.t("commands.quote"),void 0,LT]},o=dt(e),s=Ot(e),l=Ei(t,e),c=t.getBlockData(e);return Object.entries(i).forEach(([d,[h,C,E]])=>{const A=[];if(this.isChecked(c,d)&&A.push("checked"),d==="link"){if(!t.selection.range.isSimple())return;t.selection.range.getSelectedBlocks().length!==1&&A.push("disabled")}r.push({blockId:o,blockType:s,blockKind:l,id:d,name:h,desc:C,states:A,icon:E,groupIndex:600})}),r}convertLink(t,e,r){p(JE,bi(e.start),""),p(JE,bi(e.start),"");const i="bottom-start",o=e.start.offset,s=e.end.offset,l=(A,v)=>{t.undoManager.runInGroup(()=>{try{const w=t.selection.range.isCollapsed();let S;if(w){S=qo(t.getBlockText(r),s,A,{link:v}),t.setBlockText(r,S);return}S=Pm(t.getBlockText(r),o,s,A),S=Ff(o,A.length,S,"link",v),t.setBlockText(r,S),t.selection.selectBlock(r,o+A.length),t.focus()}catch(w){JE.error(w)}})},c=()=>{t.selection.selectBlock(r,s),t.focus()},d=Vo(t,r,e)[0];if(!d)return;const h=jo(t,r,"link-button-anchor",d),C=t.getBlockText(r),E=Hc(C,o);kd(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=km(t,e,"list",{offset:0,data:{listType:r}});i&&t.undoManager.runInGroup(()=>{const o=Rt(e),s=at(e);t.insertBlock(Et(s),o,i.blockData),t.deleteBlock(e)})}executeCommand(t,e,r,i){var c;if(!st(t,e)||ei(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?xu(t,e):this.convertToList(t,e,"unordered"),l=!0),o==="ordered-list"&&(s?xu(t,e):this.convertToList(t,e,"ordered"),l=!0),o==="check-list"&&(s?xu(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=G0(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 hK={left:ru,right:S0,center:L0};class mK{constructor(t){m(this,"id","BlockAlignProvider");this.editor=t}applyAlignStyle(t,e,r){Object.keys(hK).includes(r)?t.updateBlockData(e,{align:r}):t.updateBlockData(e,{align:null})}isChecked(t,e){return t.align===e}getAvailableCommands(t,e,r){if(!st(t,e))return[];if(ei(t))return[];const i=dt(e),o=Ot(e),s=Ei(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||ru,h;return h.innerHTML=ru,h};return[{id:"align",name:_.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:_.t("commands.alignLeft"),icon:ru,states:this.isChecked(l,"left")?["checked"]:[]},{id:"align-center",name:_.t("commands.alignCenter"),icon:L0,states:this.isChecked(l,"center")?["checked"]:[]},{id:"align-right",name:_.t("commands.alignRight"),icon:S0,states:this.isChecked(l,"right")?["checked"]:[]}],childrenType:"menu"}]}executeCommand(t,e,r,i){if(!st(t,e)||ei(t))return!1;if(i.id.startsWith("align")){const o=i.id.replace(/^align-/,"");return this.applyAlignStyle(t,e,o),!0}return!1}}const gK=D("toolbar-handler"),pK={id:"",name:"",type:"separator"};class bu{constructor(t){m(this,"id","editor-toolbar");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,"_lastClickTime",0);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")):Date.now()-this._lastClickTime>200&&(this.toolbar.close("clickItem"),this.hoveringBlock&&KP(this.editor,this.hoveringBlock,this.hoveringTextChild,e)),this._lastClickTime=Date.now()});m(this,"handleClose",()=>{mE(this.editor)&&this.editor.focus({preventScroll:!0})});m(this,"handleClosing",(t,e)=>{if(this.toolbarType==="object"){const r=Wb(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",Pe.default(t=>{var r;if(p(gK,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&&Ae(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 gd([],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),je.get(t).addListener("childChange",this.handleHoveringBlockChildChange),je.get(t).addFilter(this),t.editorCommandProviders.registerCommandProvider(new $P(t)),t.editorCommandProviders.registerCommandProvider(new dK(t)),t.editorCommandProviders.registerCommandProvider(new mK(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),je.get(this.editor).removeListener("childChange",this.handleHoveringBlockChildChange)}isInBlock(t,e){return t!==this.hoveringBlock?!1:!!(e.target&&e.target instanceof Node&&this.toolbar.popper&&Ae(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 w,S;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(Le(i.block)){t==="click"&&this.showObjectToolbar(null);return}if(Pt(this.editor,i.block)&&e.isSimple())return}if(Ko(i.block)){this.toolbar.close("selectionChange");return}const o=this.editor.editorCommandProviders.getCommands(this.editor.selection.range,this.id),s=new Map;o.forEach(U=>{const M=U.groupIndex,V=s.get(M);V?V.push(U):s.set(M,[U])});const l=[[]],c=Array.from(s.entries()).sort((U,M)=>U[0]-M[0]);for(let U=0;U<c.length;U++){const[,M]=c[U];if(M.length===0)continue;let V=l[l.length-1];V.length>0&&V[V.length-1].groupIndex!==M[M.length-1].groupIndex&&(V=[],l.push(V)),V.push(...z0(M))}if(l.length===0){this.toolbar.close("selectionChange");return}this.toolbarType="text";const d=[];if(l.forEach((U,M)=>{const V=U.sort((rt,Y)=>{var X,ft;return((X=rt.order)!=null?X:0)-((ft=Y.order)!=null?ft:0)});d.push(...V),M!==l.length-1&&d.push(pK)}),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,A=fk(this.editor,E),v=jo(this.editor,E.block,"editor-quick-menu",A);this.toolbar.manualShow(v,{placement:C?"bottom":"top",offset:[0,C?5:10]}),(S=(w=this.toolbar.tippyInstance)==null?void 0:w.popperInstance)==null||S.update()}showObjectToolbar(t){var l,c,d;if(!this.hoveringBlock||this.mouseDown)return;const e=this.hoveringBlock,r=this.hoveringTextChild,{commands:i,element:o}=NP(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(A=>{const{y:v}=A;E.includes(v)||E.push(v)}),E.length>1){if(h=r?C[C.length-1]:C[0],t)for(let A=0;A<C.length;A++){const v=C[A],w=new DOMRect(v.x-4,v.y-4,v.width+8,v.height+8);if(w.x<t.clientX&&t.clientX<w.right&&w.y<t.clientY&&t.clientY<w.bottom){h=v;break}}}else{if(h=o.getBoundingClientRect(),r){const A=r.getBoundingClientRect();return new DOMRect(A.x,A.y,A.width,A.height)}return new DOMRect(C[0].x,C[0].y,C[0].width,C[0].height)}if(t){const A=h.y,v=t.clientX;return new DOMRect(v,A,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 bu(e))}static get(t){return t.getCustom("toolbar-handler")}}function rg(n,t,e){n.getBlockData(t).heading===e?n.updateBlockData(t,{heading:null}):n.updateBlockData(t,{heading:e})}function Nk(n,t,e){["left","center","right"].includes(e)?n.updateBlockData(t,{align:e}):n.updateBlockData(t,{align:null})}function ZE(n,t){const r=n.getBlockData(t).quoted;n.updateBlockData(t,{quoted:r?void 0:!0})}function tA(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 eA(n,t,e){if(!n.selection.range.focus.isSimple())return;const i=n.getBlockData(t);let o;switch(e){case"unordered-list":o=tA(i,"unordered-list")?void 0:"unordered";break;case"ordered-list":o=tA(i,"ordered-list")?void 0:"ordered";break;case"check-list":o=tA(i,"check-list")?void 0:"unchecked";break}if(o){const s=km(n,t,"list",{offset:0,data:{listType:o}});s&&n.undoManager.runInGroup(()=>{const l=Rt(t),c=at(t);n.deleteBlock(t);const d=n.insertBlock(Et(c),l,s.blockData);s.onConverted&&s.onConverted(n,d)})}else xu(n,t)}const CK=Object.freeze(Object.defineProperty({__proto__:null,applyHeadingStyle:rg,applyAlignStyle:Nk,applyQuoteStyle:ZE,applyList:eA},Symbol.toStringTag,{value:"Module"})),EK=[b0,v0,B0,y0,T0,k0,R0,w0],AK={Unordered:aE,Ordered:cE,Checkbox:sE,Quote:lE};function Pk(n,t){const e=n;e.blockOptions=t,e.itemType="insert-block",n.children&&n.children.forEach(r=>Pk(r,t))}function xK(){return{name:"basic",insertBlockCommandItems:[{id:"text",icon:iu,name:_.t("commands.text"),order:0,group:"basics",value:"text"}]}}function nA(n=1){var i;const t={name:"basic",insertBlockCommandItems:[]};let e=W0();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:EK[r-1],name:_.t("quickMenu.basic.heading.title",{heading:String(r)}),order:r,group:"basics",value:String(r),subText:tr(o)}),r++}return t}function bK(){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:_.t(`quickMenu.basic.${e.toLocaleLowerCase()}`),icon:AK[e],value:e.toLocaleLowerCase(),group:"basics",order:10+r,subText:tr(i)})}),n}class Fk{constructor(t){this.withPlainText=t}getCommands(){const t=xK(),e=nA(),r=bK();return[...this.withPlainText?t.insertBlockCommandItems||[]:[],...e.insertBlockCommandItems||[],...r.insertBlockCommandItems||[]]}updateBlock(t,e,r,i){const{value:o,id:s}=i;return s.startsWith("heading-")?rg(t,r,Number.parseInt(o!=null?o:"1",10)||1):o==="ordered"||o==="unordered"||o==="checkbox"?eA(t,r,{ordered:"ordered-list",unordered:"unordered-list",checkbox:"check-list"}[o]):o==="quote"&&ZE(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"||r.from==="add-block-menu"){const i=t.getBlockById(r.blockId),o=t.getParentContainer(i),s=Et(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 Kk={basics:100,system:200,common:300,thirdParty:400};class rA{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 vK=D("mathjax-converter"),BK="MathJax-script",yK=30,Vk=8;async function TK(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 ia(e,BK)}function kK(){try{window.MathJax&&window.MathJax.texReset()}catch{}}async function iA(n,t){const e="mathjax2Svg";try{await gi.lock(e),kK(),await TK(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 vK.error(r),r}finally{gi.release(e)}}function RK(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)*Vk+yK,e.height=parseInt(i,10)*Vk)}return e}async function $k(n,t){const e=await iA(n,t);return e?await jp(e,"image/svg+xml"):""}async function Hk(n,t){const r=await iA(n,t),i=new File([r],"math.svg");return(await n.doc.uploadResource(i)).resourceId}async function wK(n,t){const e=await iA(n,t),r=RK(e),i=e,o=new File([i],"math.svg");return{resourceId:(await n.doc.uploadResource(o)).resourceId,...r}}const jk=D("edit-mathjax");class SK{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",Pe.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 su(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(jk,this.editMathjaxPopup,"no exists mathjax editor popup");const t=this.editMathjaxPopup.content.querySelector("textarea");return p(jk,t,"no textarea"),t}destroy(){var t,e;this.onChange=null,(t=this.observer)==null||t.disconnect(),(e=this.editMathjaxPopup)==null||e.removeAllListeners()}}function zk(n,t,e,r,i){n.addCustom("mathjax-editor",()=>new SK).editMathjax(t,e.trim(),r,i)}function Gk(){return{insert:" ",attributes:{id:it(),box:!0,type:"math",tex:" ",src:"",created:Date.now()}}}function ig(n,t){const e=n.getBoxData(t),r=et(t);if(!r)return;const i=rl(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 gi.lock("convertAndUploadMathjax");const c=await Hk(n,s);n.updateBoxData({...e,tex:s,src:c})}catch(c){const d=n.getBoxData(t);n.addCustom(`mathjax-box-${d.id}`,()=>new rA).setError(c),n.updateBoxData({...e,tex:s,src:""})}finally{gi.release("convertAndUploadMathjax"),l&&n.focus()}};zk(n,t,e.tex,o)}const Wk=D("mathjax-box");function oA(n,t){n.selection.updateSelection(null);const e=t.target;!e||!(e instanceof HTMLElement)||n.domEvents.removeEventListener(e,null,oA)}async function LK(n,t,e){try{if(!t.tex.trim())return;const r=await $k(n,t.tex),i=n.findBoxById(t.id);if(!i)return;const o=l1(i);o.innerHTML="";const s=B("img",["mathjax"],o);s.src=r,e.setDataUrl(r),n.domEvents.addEventListener(s,"load",oA)}catch(r){e.setError(r);const i=n.findBoxById(t.id);if(!i)return;const o=i.querySelector(".mathjax-tex-text");q(o,"mathjax-error"),o.innerText=r.message,n.selection.updateSelection(null)}}function IK(n,t,e,r){const i=r,o=n.addCustom(`mathjax-box-${i.id}`,()=>new rA);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,A;await n.doc.addResources([d]);const C=(A=(E=n.doc).getServerMeta)==null?void 0:A.call(E).appId;if(i.src&&i.src!==h&&C&&i.src.includes(C)){const v=et(e),w=xt.default(i);v&&n.isBlockWritable(v)&&!n.readonly&&(w.src=d,n.updateBoxData(w))}}}),n.domEvents.addEventListener(c,"load",oA);return}const s=["mathjax-tex-text"];let l=i.tex;l.trim()?o.error&&(l=o.error.message,s.push("mathjax-error")):l=_.t("mathjax.emptyText"),B("span",s,e,l),LK(n,i,o)}function DK(n,t){const e={id:it(),box:!0,type:"math",tex:t,src:"",created:Date.now()};return Hk(n,t).then(r=>{if(!n.findBoxById(e.id))return;const o={...e,src:r};n.updateBoxData(o)}).catch(r=>{Wk.error(`failed to convert and upload mathjax: ${JSON.stringify(r)}`)}),e}function _K(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 MK(n,t,e){const r=et(t);p(Wk,r,"failed to get block"),!(n.readonly||!n.isBlockWritable(r))&&ig(n,t)}function UK(){return{abstract:`[${_.t("mathjax.abstract")}]`}}const qk={boxType:"math",updateBoxContent:IK,convertFrom:DK,convertTo:_K,handleClickBox:MK,getBoxProperties:UK};async function OK(n,t,e){try{const r=t.embedData,i=await $k(n,r.mathjaxText),o=n.findBlockById(t.id);if(!o)return;const s=zt(o);s.innerHTML="";const l=B("img",["mathjax"],s);l.src=i,e.setDataUrl(i)}catch(r){e.setError(r)}}function NK(n,t){if(n.readonly||!t.target||!(t.target instanceof Node))return;const e=et(t.target);if(!e||!Le(e)||ln(e)!=="math")return;const r=zt(e),i=r.querySelector("img")||r.querySelector("span.mathjax-tex-text");if(!i||!Ae(i,t.target))return;const s=n.getBlockData(e).embedData;zk(n,i,s.mathjaxText,async l=>{const{resourceId:c,width:d,height:h}=await wK(n,l),C={mathjaxText:l,src:c,width:d,height:h};n.updateEmbedData(e,C)},{placement:"bottom"})}function PK(n,t,e){const r=e.embedData,{src:i,width:o}=r,s=n.addCustom(`mathjax-block-${e.id}`,()=>new rA);if(n.domEvents.addEventListener(t,"click",NK),!r.mathjaxText.trim()){B("span",["mathjax-tex-text"],t,_.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 A=et(t);setTimeout(()=>{if(A&&!n.readonly&&n.isBlockWritable(A)){const v=xt.default(e);v.embedData.src=c,n.updateBlockData(A,v)}})}}}}),o&&(l.style.minWidth=`${o}px`,setTimeout(()=>{const c=t.getBoundingClientRect().width;o>c?(q(t,"mathjax-overflow"),t.style.overflow="auto",t.style.setProperty("--mathjax-width",`${o}px`)):(ut(t,"mathjax-overflow"),t.removeAttribute("data-mathjax-width"),t.style.removeProperty("--mathjax-width"))}));return}s.error,B("span",["mathjax-tex-text"],t,r.mathjaxText),OK(n,e,s)}function FK(n,t,e){if(!st(n,t))return null;const r=n.getBlockString(t).trim();if(!r||!r.startsWith("$$")||!r.endsWith("$$"))return null;const i=Kp(r,"$");if(!i)return null;const o={mathjaxText:i,src:""};return{blockData:{id:it(),type:"embed",embedType:"math",embedData:o}}}function KK(n){return{name:"Mathjax"}}function VK(n,t){var r;const e=zt(t);n.domEvents.removeAllListeners(e),n.findCustom("mathjax-editor")&&((r=n.getCustom("mathjax-editor").editMathjaxPopup)==null||r.close("cancelBar"))}function $K(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 HK(){return{abstract:_.t("mathjax.abstract")}}const jK={embedType:"math",createEmbedContent:PK,getOptions:KK,convertFrom:FK,handleDeleteBlock:VK,convertTo:$K,getBlockProperties:HK},pat="",zK={mathjax:{emptyText:"\u7A7A\u7684\u516C\u5F0F",abstract:"\u516C\u5F0F"}},GK={mathjax:{emptyText:"Empty formula",abstract:"Formula"}},WK={mathjax:{emptyText:"\u6570\u5F0F\u306A\u3057",abstract:"\u6570\u5F0F"}};_.mergeLang({"zh-CN":zK,"en-US":GK,"ja-JP":WK});function qK(n,t,e,r){const i=n.getBlockByIndex(t,e),o=n.getBlockText(i),{left:s}=ar(o,r);if(!Re(s).endsWith("$$$$"))return!1;const c=r-4,d=r,h={id:it(),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);ig(n,C)})}),!0}class XK{handleAfterInsertText(t,e,r,i,o){return!!(o===" "&&qK(t,e,r,i))}}var Ii={exports:{}};/**
|
|
@@ -666,7 +666,7 @@ ${s}
|
|
|
666
666
|
Click to open the menu`,insertTips:"Click to add block"}}},Qj={blockMenu:{section:{basics:"\u4E00\u822C",system:"\u30B7\u30B9\u30C6\u30E0",styles:"\u30B9\u30BF\u30A4\u30EB",common:"\u4E00\u822C",actions:"\u64CD\u4F5C",thirdParty:"\u5916\u90E8\u30B3\u30F3\u30C6\u30F3\u30C4"},command:{insertAbove:"\u4E0A\u306B\u633F\u5165",insertAfter:"\u4E0B\u306B\u633F\u5165",copy:"\u8907\u88FD",cut:"\u5207\u308B",delete:"\u524A\u9664"},button:{searchPlaceholder:"\u30AD\u30FC\u30EF\u30FC\u30C9\u3067\u691C\u7D22",tips:`\u30DE\u30A6\u30B9\u306E\u30DC\u30BF\u30F3\u3092\u62BC\u3057\u306A\u304C\u3089\u30C9\u30E9\u30C3\u30B0\u3059\u308B
|
|
667
667
|
\u30AF\u30EA\u30C3\u30AF\u3057\u3066\u30E1\u30CB\u30E5\u30FC\u3092\u8868\u793A\u3059\u308B`,insertTips:"\u30AF\u30EA\u30C3\u30AF\u3057\u3066\u30D6\u30ED\u30C3\u30AF\u3092\u8FFD\u52A0"}}};_.mergeLang({"zh-CN":Xj,"en-US":Yj,"ja-JP":Qj});const Uat="";class Jj{constructor(){m(this,"dragObject",null)}setData(t){this.dragObject=t}getData(){return this.dragObject}clearData(){this.dragObject=null}destroy(){}}function xg(n){return n.addCustom("drag-data",()=>new Jj)}function OA(n,t){if(!t)return null;const e=xg(n).getData();return!e||e.editorId!==n.id?null:e}function gw(n,t){const e=OA(n,t);return e?n.findBlockById(e.blockId):null}function Zj(n,t,e){if(!t.dataTransfer)return;const i=at(e),o=Et(i),s=dt(e),l={type:"block",editorId:n.id,containerId:o,blockId:s};xg(n).setData(l)}function tz(n,t,e,r,i){if(!t.dataTransfer)return;const s=at(e),l=Et(s),c=dt(e),d={type:"custom",customType:r,editorId:n.id,containerId:l,blockId:c,data:i};xg(n).setData(d)}function Gd(n){xg(n).clearData()}const ez=D("drop-indicator"),Wd=2;class nz{constructor(t){m(this,"indicator");m(this,"target",null);this.editor=t,this.indicator=B("div",["editor-drop-indicator"],this.editor.contentElement)}show(t,e){const r=this.getIndicatorRect(t,e),i=this.editor.rootElement.getBoundingClientRect(),o=r.top-i.top,s=r.left-i.left;this.indicator.style.top=`${o}px`,this.indicator.style.left=`${s}px`,this.indicator.style.width=`${r.width}px`,this.indicator.style.height=`${r.height}px`,this.indicator.style.display="",this.target={block:t,insertPos:e}}hide(){this.indicator.style.display="none",this.target=null}getIndicatorRect(t,e){if(typeof e!="string")return e.rect;if(e==="before"){const l=zr(t);if(!l){p(ez,pi(at(t)),"block does not in a child container");const C=t.getBoundingClientRect(),E=this.getViewRect(t);return new DOMRect(E.x,C.y,E.width,Wd)}const c=l.getBoundingClientRect(),d=t.getBoundingClientRect(),h=this.getViewRect(t);return new DOMRect(h.x,(c.bottom+d.top)/2,h.width,Wd)}const r=Gr(t);if(!r){const l=t.getBoundingClientRect(),c=this.getViewRect(t);return new DOMRect(c.x,l.bottom,c.width,Wd)}const i=t.getBoundingClientRect(),o=r.getBoundingClientRect(),s=this.getViewRect(t);return new DOMRect(s.x,(i.bottom+o.top)/2,s.width,Wd)}getViewRect(t){const e=pn(t,{horizontal:!0}),r=t.getBoundingClientRect(),i=e.getBoundingClientRect(),o=Math.max(i.x-r.x,0),s=Math.max(r.right-i.right,0);return new DOMRect(r.x+o,r.y,Math.max(r.width-o-s,0),Wd)}}const rz=D("find-drop-target");function iz(n,t){const e=Fe(n,t);if(!e)return null;if(Qs(e)&&pi(e))return e;const r=e.firstElementChild;return r&&Qs(r)&&pi(r)?r:null}function oz(n,t,e){const c=e,d=t;for(let h=0;h<2;h++){const C=d+h*50;for(let E=0;E<5;E++){const A=c+E*8,v=Fe(C,A);if(v){const U=et(v);if(U){if(!Pt(n,U))return U;const M=U.getBoundingClientRect();if(e-M.top<40||M.bottom-e<40)return U}}if(E===0)continue;const w=c-E*8,S=Fe(C,w);if(S){const U=et(S);if(U){if(!Pt(n,U))return U;const M=U.getBoundingClientRect();if(e-M.top<40||M.bottom-e<40)return U}}}}return null}function sz(n,t,e){const r=Fe(t,e);if(r){const h=et(r);if(h&&!Pt(n,h))return h}const i=new Set,o=iz(t,e);if(o){const h=o.getBoundingClientRect();e<h.top+h.height/2?i.add(Me(o)):i.add(We(o))}const s=oz(n,t,e);s&&i.add(s);const l=Array.from(i),c=h=>{for(let C=0;C<l.length;C++){const E=l[C];if(h!==E&&Ae(h,E))return!0}return!1},d=l.filter(h=>!c(h));return d.length>0?d[0]:null}function NA(n,t){if(n.readonly)return!1;const e=at(t);if(ie(e))return!0;const r=et(e);return p(rz,r,"no parent block"),n.isBlockWritable(r)?NA(n,r):!1}const lz=D("drop-target");function az(n,t){let e={};return/image/.test(t.type)?e=n.editorEmbeds.getEmbedClass("image"):/audio/.test(t.type)?e=n.editorEmbeds.getEmbedClass("audio"):/video/.test(t.type)&&(e=n.editorEmbeds.getEmbedClass("video")),p(lz,e,`unSupport file type ${t.type}`),e}async function pw(n,t,e,r){var o,s;let i=r;for(const l of t){const c=az(n,l);c.getOptions&&await((s=(o=c.getOptions(n)).handleInsertEmptyEmbed)==null?void 0:s.call(o,n,{containerId:e,blockIndex:i,data:{file:l}}))&&(i+=1)}}class cz{constructor(t){m(this,"handleDrop",(t,e,r,i)=>{if(Array.isArray(e)){const o=e;if(o.length>0){const s=Et(r);return pw(t,o,s,i),!0}}return!1});this.editor=t}}class qd{constructor(t){m(this,"indicator");m(this,"lastDropOverResult");m(this,"handlers",[]);m(this,"handleDragOver",t=>{if(!this.editor.isWritable())return;const e=o=>{var d,h,C,E;const s=OA(this.editor,o.dataTransfer),l=gw(this.editor,o.dataTransfer);if(((d=o.dataTransfer)==null?void 0:d.types.length)&&!((h=o.dataTransfer)!=null&&h.types.includes("Files")))return"none";const c=this.findTargetBlock(l,o.x,o.y);if(c&&Ae(this.editor.rootContainer,c)){const A=this.findInsertPos(l,c,o.x,o.y,(E=s!=null?s:(C=o.dataTransfer)==null?void 0:C.items)!=null?E:null);if(A)return this.indicator.show(c,A),"move"}return this.indicator.hide(),"none"},r=(o,s)=>{o.dataTransfer&&(o.dataTransfer.dropEffect=s),s==="move"&&o.preventDefault()};if(this.lastDropOverResult&&t.x===this.lastDropOverResult.x&&t.y===this.lastDropOverResult.y){const o=this.lastDropOverResult.dropEffect;r(t,o);return}const i=e(t);r(t,i),this.lastDropOverResult={x:t.x,y:t.y,dropEffect:i}});m(this,"handleDrop",t=>{var o,s;t.stopPropagation(),setTimeout(()=>{this.indicator.hide()});const e=OA(this.editor,t.dataTransfer),r=Array.from((s=(o=t.dataTransfer)==null?void 0:o.files)!=null?s:[]);if(!e&&r.length===0){t.dataTransfer&&(t.dataTransfer.dropEffect="none"),Gd(this.editor);return}const i=this.indicator.target;if(i){const{block:l,insertPos:c}=i,d=gw(this.editor,t.dataTransfer);this.editor.undoManager.runInGroup(()=>{const h=le(this.editor,l);if(h.handleDrop&&h.handleDrop(this.editor,l,e!=null?e:r,c,{isSourceBlock:!1,targetBlock:l})){t.preventDefault(),this.editor.focus(),Gd(this.editor);return}if(d){const C=le(this.editor,d);if(C.handleDrop&&C.handleDrop(this.editor,d,e!=null?e:r,c,{isSourceBlock:!0,targetBlock:l})){t.preventDefault(),this.editor.focus(),Gd(this.editor);return}}if(typeof c=="string"){const C=at(l);let E=Rt(l);if(c==="after"){E+=1;let A=ae(l);for(;A&&!Zs(A);)E+=1,A=ae(A)}t.preventDefault();for(let A=0;A<this.handlers.length;A++)if(this.handlers[A].handleDrop(this.editor,d!=null?d:r,C,E)){this.editor.focus(),Gd(this.editor);return}if(d){const A=this.editor.getBlockData(d),v=sl(this.editor.editorBlocks,this.editor.doc.toJSON(),A),[w]=this.editor.insertDocAt(C,E,v);this.editor.selection.selectBlock(w,0),zd.get(this.editor).highlightBlock(w),this.editor.deleteBlock(d),this.editor.focus()}}})}Gd(this.editor)});m(this,"handleDragLeave",()=>{this.indicator.hide()});this.editor=t,this.indicator=new nz(this.editor),this.handlers.push(new cz(this.editor)),this.editor.contentElement.addEventListener("dragover",this.handleDragOver),this.editor.contentElement.addEventListener("dragleave",this.handleDragLeave),this.editor.contentElement.addEventListener("drop",this.handleDrop)}destroy(){this.editor.contentElement.removeEventListener("dragover",this.handleDragOver),this.editor.contentElement.removeEventListener("dragleave",this.handleDragLeave),this.editor.contentElement.removeEventListener("drop",this.handleDrop),this.handlers=[]}addHandler(t){this.handlers.push(t)}static register(t){return t.addCustom("drop-target",()=>new qd(t))}static get(t){return t.getCustom("drop-target")}static find(t){return t.findCustom("drop-target")}canInsertAfter(t,e){return!(this.editor.readonly||Gr(e)===t&&t||!NA(this.editor,e))}canInsertBefore(t,e){return!(this.editor.readonly||zr(e)===t&&t||!NA(this.editor,e)||ie(at(e))&&Rt(e)===0)}canDrop(t,e){return t===null||t===e?!0:!Ae(t,e)}findTargetBlock(t,e,r){let i=sz(this.editor,e,r);if(!i||!Ae(this.editor.rootContainer,i))return null;const o=at(i),s=et(o);return s&&Ot(s)==="code"&&(i=s),this.canDrop(t,i)?i:null}findInsertPos(t,e,r,i,o){let s=e;for(;s;){const c=le(this.editor,s);if(c.handleDropOver){const d=c.handleDropOver(this.editor,s,o,r,i);if(d)return d;if(d===!1)return null}s=fa(s)}if(t===e)return"";const l=e.getBoundingClientRect();if(l.top<=i&&i<=l.bottom){if(i<l.top+l.height/2){if(this.canInsertBefore(t,e))return"before";if(this.canInsertAfter(t,e))return"after"}else{if(this.canInsertAfter(t,e))return"after";if(this.canInsertBefore(t,e))return"before"}return""}return i<l.top&&this.canInsertBefore(t,e)?"before":l.bottom<i&&this.canInsertAfter(t,e)?"after":""}}function Cw(n,t,e){const r=Xe.getImageObject(n,t),i=xt.default(r.getImages());if(i.length===1){n.deleteBlock(t);return}if(e===-1||e>=i.length)return;const o=XH(i);if(i.splice(e,1),i.length===1){const l=i[0],c=100*(l.flex/o);l.flex=1;const d=Gn([l],c);n.updateEmbedData(t,d);return}i[0].flex=NaN,Tu(i);const s=Gn(i,r.getWidthPercent());n.updateEmbedData(t,s)}function uz(n,t,e,r){if(t.length===0||r==="after"||r==="before")return!1;let i=r.data;const o=Xe.getImageObject(n,e),s=xt.default(o.getImages()),l=[],c=[];t.forEach(C=>{rw(C.type)&&s.length+l.length<6?l.push(C):c.push(C)}),l.forEach(C=>{try{nw(n,C)}catch{return}const E={src:"",flex:1,width:0,height:0,virtualSize:!0};s.splice(i,0,E);const A=Gn(s,o.getWidthPercent());n.updateEmbedData(e,A),o.replaceImage(i,C),i+=1});const d=n.getBlockIndex(e)+1,h=Et(at(e));return pw(n,c,h,d),!0}function fz(n,t,e,r,i){var s,l,c;if(Am(e))return uz(n,e,t,r);if(e.type!=="custom"||e.customType!=="image"||!e.data)return;const o=e.data;if(i.isSourceBlock){const d=i.targetBlock,h=at(d);let C=Rt(d);r==="after"&&(C+=1);const A=100*(o.boundingRect.width/n.rootContainer.getBoundingClientRect().width),v=Gn([o.image],A),w={id:it(),type:"embed",embedType:"image",embedData:v},S=(l=(s=n.options.componentsOptions)==null?void 0:s.image)==null?void 0:l.defaultAlign;S&&(w.align=S),n.insertBlock(Et(h),C,w),Cw(n,t,o.index),(c=n.findCustom("drag-handler"))==null||c.handleDragEnd()}else{if(typeof r=="string")return;const d=t;let h=r.data;const C=Xe.getImageObject(n,d),E=xt.default(C.getImages());h>E.length&&(h=E.length),n.undoManager.runInGroup(()=>{var v,w;C.setAutoFix(!0);const A=n.getBlockById(e.blockId);if(A===d){const S=o.index,U=h,M=o.image;if(S===U||U===S+1)return;let V=U;S<U?(E.splice(U,0,M),E.splice(S,1),V-=1):(E.splice(S,1),E.splice(U,0,M));const rt=Gn(E,C.getWidthPercent());n.updateEmbedData(d,rt),C.setSelectedIndex(V),(v=n.findCustom("drag-handler"))==null||v.handleDragEnd()}else{E.splice(h,0,o.image),E[0].flex=NaN,Tu(E);const S=Gn(E,C.getWidthPercent());n.updateEmbedData(d,S),Cw(n,A,o.index),(w=n.findCustom("drag-handler"))==null||w.handleDragEnd(),C.setSelectedIndex(h),n.selection.selectBlock(d,0)}})}return!0}const dz=2;function bg(n,t,e){const r=mo(t);if(e<=0){const s=r[0].getBoundingClientRect();return new DOMRect(s.left-4,s.top,2,s.height)}if(e===r.length){const s=r[e-1].getBoundingClientRect();return new DOMRect(s.right+2,s.top,2,s.height)}const i=r[e-1].getBoundingClientRect(),o=r[e].getBoundingClientRect();return new DOMRect((o.left+i.right)/2-1,i.top,dz,i.height)}function hz(n,t,e,r,i){for(let o=0;o<e.length;o++){const l=e[o].getBoundingClientRect();if(r<=l.right)return r<=l.left+l.width/2?{rect:bg(n,t,o),data:o}:{rect:bg(n,t,o+1),data:o+1}}return r>e[e.length-1].getBoundingClientRect().right?{rect:bg(n,t,e.length),data:e.length}:{rect:bg(n,t,e.length),data:0}}function mz(n,t,e,r,i){const o=mo(t);if(e instanceof DataTransferItemList){if(!Array.from(e).some(s=>rw(s.type))||o.length>=6)return}else{if((e==null?void 0:e.type)==="block"||o.length>=6&&(e==null?void 0:e.blockId)!==dt(t))return;const s=dt(t);if(o.length===1&&s===(e==null?void 0:e.blockId))return}return hz(n,t,o,r)}async function gz(n){return await Ib.default.toSvg(n)}function PA(n,t){return new DragEvent(t,{bubbles:!0,cancelable:!0,view:window,screenX:n.screenX,screenY:n.screenY,dataTransfer:new DataTransfer,clientX:n.clientX,clientY:n.clientY})}class pz{constructor(t){m(this,"img");m(this,"dragContainer",null);m(this,"autoScroll",null);m(this,"imageContainer",null);m(this,"startPosition",null);m(this,"handleMouseDown",t=>{const e=t.target;if(!e||!(e instanceof HTMLImageElement)||t.button!==0)return;const r=et(e);if(!r||!_i(r)||!this.editor.isBlockWritable(r)||this.editor.readonly)return;const i=Xe.getImageObject(this.editor,r);if(this.imageContainer=kA(t.target),!this.imageContainer)return;const s=QR(t.target).indexOf(this.imageContainer);if(s===-1)return;const l=i.getImages()[s];if(!l)return;const{x:c,y:d}=t;this.startPosition={x:c,y:d};const h={image:l,index:s,boundingRect:this.imageContainer.getBoundingClientRect()},C=PA(t,"dragstart");tz(this.editor,C,r,"image",h),document.addEventListener("mouseup",this.handleDragEnd),this.editor.contentElement.addEventListener("mousemove",this.handleDrag),t.preventDefault()});m(this,"handleDragStart",async t=>{if(!this.imageContainer)return;const e=et(this.imageContainer);if(!e)return;const{x:r,y:i}=t,{width:o,height:s}=t.target.getBoundingClientRect(),l=ve(e),c=B("div",["drag-container"],l);c.style.left=`${r-o/4}px`,c.style.top=`${i-s/4}px`,c.style.width=`${Math.max(o/2,16)}px`,c.style.height=`${s/2}px`,this.dragContainer=c,q(this.editor.contentElement,"dragging");const d=pn(e);this.autoScroll=new bm({scrollElement:d,trackMouseEvent:"mousemove",edge:{top:50,bottom:50}}),this.autoScroll.active();const h=B("img",["drag-target"],c),E=await gz(this.imageContainer);E&&(h.src=E)});m(this,"handleDrag",t=>{var o;const{x:e,y:r}=t;if(((o=this.startPosition)==null?void 0:o.x)===e&&this.startPosition.y===r)return;if(window.isDragging||(window.isDragging=!0,this.handleDragStart(t)),this.startPosition&&this.dragContainer){const{x:s,y:l}=t;if(s===0&&l===0){this.dragContainer.style.transform="",this.dragContainer.style.opacity="0";return}const{x:c,y:d}=this.startPosition,h=s-c,C=l-d;this.dragContainer.style.transform=`translate(${h}px, ${C}px)`,this.dragContainer.style.opacity="0.5"}const i=PA(t,"dragover");this.editor.contentElement.dispatchEvent(i)});m(this,"handleDragEnd",t=>{var e;if(window.isDragging=!1,this.dragContainer&&this.dragContainer.remove(),this.dragContainer=null,this.startPosition=null,this.imageContainer=null,(e=this.autoScroll)==null||e.inactive(),ut(this.editor.contentElement,"dragging"),document.removeEventListener("mouseup",this.handleDragEnd),this.editor.contentElement.removeEventListener("mousemove",this.handleDrag),t){const r=PA(t,"drop");this.editor.contentElement.dispatchEvent(r)}});this.editor=t,this.editor.rootContainer.addEventListener("mousedown",this.handleMouseDown),this.img=new Image,this.img.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"}destroy(){this.editor.rootContainer.removeEventListener("mousedown",this.handleMouseDown)}}class Cz{constructor(t){m(this,"handleFocusBlockChanged",(t,e,r)=>{const o=this.editor.getFocusedBlock();if(o&&_i(o)){const s=Xe.getImageObject(this.editor,o);s.getImages().length>0&&s.getSelectedIndex()===-1&&s.setSelectedIndex(0)}r&&_i(r)&&t.findCustom(`image-${r.id}`)&&Xe.getImageObject(this.editor,r).blockResizer.disableResize()});this.editor=t,this.editor.addListener("focusBlockChanged",this.handleFocusBlockChanged)}destroy(){this.editor.removeListener("focusBlockChanged",this.handleFocusBlockChanged)}}class Ez{constructor(t){m(this,"currentResizer",null);m(this,"handleHoveringBlockChange",(t,e)=>{window.isDragging||(e&&this.disable(e),t&&(this.currentResizer=t,this.enable(t)))});this.editor=t,je.get(t).addListener("change",this.handleHoveringBlockChange)}destroy(){je.get(this.editor).removeListener("change",this.handleHoveringBlockChange)}disable(t){_i(t)&&Xe.getImageObject(this.editor,t).disableResizer()}enable(t){if(_i(t)){const e=Xe.getImageObject(this.editor,t);this.editor.isBlockWritable(t)&&e.tryEnableResizer()}}}const Az={image:{title:"\u56FE\u7247",upload:{failed:'<div class="line-1">\u56FE\u7247\u4E0A\u4F20\u5931\u8D25</div><div class="line-2">\u7F51\u7EDC\u670D\u52A1\u5F02\u5E38\uFF0C\u4F60\u53EF\u4EE5 <a href="" class="retry-upload">\u91CD\u8BD5</a></div>'},load:{failed:'<div class="line-1">\u56FE\u7247\u52A0\u8F7D\u5931\u8D25</div><div class="line-2">\u7F51\u7EDC\u670D\u52A1\u5F02\u5E38\uFF0C\u4F60\u53EF\u4EE5 <a href="" class="retry-upload">\u91CD\u8BD5</a></div>',remote:{failed:'<div class="line-1">\u56FE\u7247\u52A0\u8F7D\u5931\u8D25</div><div class="line-2">\u8BE5\u56FE\u7247\u6765\u81EA\u5916\u90E8\u94FE\u63A5\uFF0C\u5916\u90E8\u94FE\u63A5\u5DF2\u5931\u6548</div><div class="line-3">\u8BF7\u5C06\u539F\u56FE\u4FDD\u5B58\u5230\u672C\u5730\u540E\u4E0A\u4F20\uFF0C <a href="" class="retry-upload">\u6253\u5F00\u56FE\u7247\u94FE\u63A5</a></div>',tooltip:"\u8BE5\u56FE\u7247\u6765\u81EA\u5916\u90E8\u94FE\u63A5\uFF0C\u5982\u679C\u94FE\u63A5\u5931\u6548\u56FE\u7247\u5C06\u65E0\u6CD5\u67E5\u770B\uFF0C\u5EFA\u8BAE\u4FDD\u5B58\u5230\u672C\u5730\u540E\u6DFB\u52A0\u5230\u9875\u9762\u4E2D"}},abstract:"\u56FE\u7247"}},xz={image:{title:"Image",upload:{failed:'<div class="line-1">Image upload failed</div><div class="line-2">Network error, you can <a href="" class="retry-upload">Retry</a></div>'},load:{failed:'<div class="line-1">Image failed to load</div><div class="line-2">Network error, you can <a href="" class="retry-upload">Retry</a></div>',remote:{failed:'<div class="line-1">Failed to load image</div><div class="line-2">This picture is from an expired external link</div><div class="line-3">Please save the original image to local drives and upload it. <a href="" class="retry-upload">Open image link</a></div>',tooltip:"This picture is from an external link. If the link expires, the picture will not be available. It's recommended to save it to local drives and add it to the page."}},abstract:"Image"}},bz={image:{title:"\u753B\u50CF",upload:{failed:'<div class="line-1">\u753B\u50CF\u3092\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u3067\u304D\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 <a href="" class="retry-upload">\u518D\u8A66\u884C</a></div>'},load:{failed:'<div class="line-1">\u753B\u50CF\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 <a href="" class="retry-upload">\u518D\u8A66\u884C</a></div>',remote:{failed:'<div class="line-1">\u753B\u50CF\u3092\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093\u3067\u3057\u305F</div><div class="line-2">\u3053\u306E\u753B\u50CF\u306B\u30EA\u30F3\u30AF\u3057\u3066\u3044\u308B URL \u304C\u7121\u52B9\u306B\u306A\u3063\u3066\u3044\u307E\u3059\u306E\u3067\u3001\u8868\u793A\u3067\u304D\u307E\u305B\u3093</div><div class="line-3">\u753B\u50CF\u3092\u30ED\u30FC\u30AB\u30EB\u306B\u4FDD\u5B58\u3057\u3066\u30A2\u30C3\u30D7\u30ED\u30FC\u30C0\u3057\u3066\u304F\u3060\u3055\u3044 <a href="" class="retry-upload">\u753B\u50CF\u30EA\u30F3\u30AF\u3092\u958B\u304F</a></div>',tooltip:"\u3053\u306E\u753B\u50CF\u306F\u5916\u90E8\u306B\u30EA\u30F3\u30AF\u3057\u3066\u3044\u308B\u305F\u3081\u3001\u30EA\u30F3\u30AF\u304C\u7121\u52B9\u306B\u306A\u308B\u3068\u3001\u8868\u793A\u3067\u304D\u306A\u304F\u306A\u308A\u307E\u3059\u306E\u3067\u3001\u30ED\u30FC\u30AB\u30EB\u306B\u4FDD\u5B58\u3057\u3001\u30DA\u30FC\u30B8\u306B\u633F\u5165\u3059\u308B\u3053\u3068\u3092\u304A\u52E7\u3081\u3057\u307E\u3059"}},abstract:"\u753B\u50CF"}};_.mergeLang({"zh-CN":Az,"en-US":xz,"ja-JP":bz});function vz(n,t,e,r){const i=n.getBlockByIndex(t,e),o=n.getBlockText(i),{left:s}=ar(o,r),l=Re(s);let c=r;if(l.endsWith("![]()"))c-=5;else if(l.endsWith("![]"))c-=3;else return!1;const d=r;return Uc("image/*").then(h=>{!h||n.undoManager.runInGroup(()=>{n.deleteTextFromBlock(i,c,d-c);let C=e+1;Re(n.getBlockText(i)).trim()?(Xc(n,i,c,{forceInsertAfter:!0}),c===0&&(n.deleteBlock(i),C--)):(n.deleteBlock(i),C--),h1(n,"image",t,C,{file:h})})}),!0}class Bz{handleAfterInsertText(t,e,r,i,o){if(o===" "){if(hg(t,e))return!1;if(vz(t,e,r,i))return!0}return!1}}const yz=D("copy-image");function Tz(n,t,e,r){const i=e.getImages()[r],o=e.getImages().length===1?e.getWidthPercent():i.flex*100,s=Gn([i],o),l={id:it(),type:"embed",embedType:"image",embedData:s},c=n.options.componentsOptions.image;c!=null&&c.defaultAlign&&(l.align=c.defaultAlign);const d={blocks:{root:[l]},comments:{},meta:{}},h=document.createElement("canvas");h.width=t.naturalWidth,h.height=t.naturalHeight;const C=h.getContext("2d");if(!C)return;const E={},A={};try{C.drawImage(t,0,0,h.width,h.height);const V=h.toDataURL("image/png").replace(/^data:image\/(png|jpg);base64,/,""),rt=Hp(V),Y=new File([rt],`${Date.now()}.png`,{type:"image/png"});E["image/png"]=Y}catch(M){yz.error(M)}Jf(n,d);const w=`<img src="${n.doc.buildResourceUrl(i.src,{withToken:!0})}" />`,S=Qf(w,d),U=new Blob([S],{type:"text/html"});return E["text/html"]=U,A["text/html"]=S,[E,A]}function kz(n,t,e,r,i){const o=Tz(n,t,e,r);if(!o)return;const[s,l]=o;if(s){const c=Object.entries(s).map(([d,h])=>({type:d,data:h}));return Tf(c).then(d=>{if(!d&&i){const h=i.clipboardData;h&&(h.setData("text/plain",l["text/plain"]),h.setData("text/html",l["text/html"]))}}),!0}}function vg(n,t){const e=n.selection.range;if(e.start.blockId!==e.end.blockId)return;const i=n.getFocusedBlock();if(i&&_i(i)){const o=Xe.getImageObject(n,i);if(o.getImages().length>0){const l=o.getSelectedIndex();if(l!==-1){const d=mo(i)[l].querySelector("img");if(d)return kz(n,d,o,l,t)}}}}function Rz(n){const t=n.getFocusedBlock(),e=Gr(t);if(e&&_i(e)){n.selection.selectBlock(e,0);const r=Xe.getImageObject(n,e);return r.getImages().length>0&&r.setSelectedIndex(0),!0}}function wz(n){const t=n.getFocusedBlock(),e=zr(t);if(e&&_i(e)){n.selection.selectBlock(e,0);const r=Xe.getImageObject(n,e);return r.getImages().length>0&&r.setSelectedIndex(0),!0}}function Sz(n){const e=n.getFocusedBlock();if(e&&_i(e)){const r=Xe.getImageObject(n,e),i=r.getImages();if(i.length>0){const o=r.getSelectedIndex();if(o===-1)return r.setSelectedIndex(i.length-1),!0;if(o>0)return r.setSelectedIndex(o-1),!0}}}function Lz(n){const e=n.getFocusedBlock();if(e&&_i(e)){const r=Xe.getImageObject(n,e),i=r.getImages();if(i.length>0){const o=r.getSelectedIndex();if(o===-1)return r.setSelectedIndex(0),!0;if(o<i.length-1)return r.setSelectedIndex(o+1),!0}}}function Bg(n){const e=n.getFocusedBlock();if(e&&_i(e)){const r=Xe.getImageObject(n,e);if(r.getImages().length>0){const o=r.getSelectedIndex();if(o!==-1)return r.removeImage(o),!0}}}const Iz={ArrowLeft:Sz,ArrowRight:Lz,ArrowUp:wz,ArrowDown:Rz,Delete:Bg,Backspace:Bg};class Dz{constructor(t){this.editor=t,setTimeout(()=>{this.editor.input.addHandler(this)})}handleBeforeCopy(t,e,r){if(!window.isSecureContext)return;if(vg(t,e))return!0}handleBeforeCut(t,e){if(vg(t,e))return Bg(t),!0}destroy(){}}class FA{constructor(t){this.editor=t,setTimeout(()=>{this.editor.input.addHandler(this)})}async handleAfterPasteDoc(t,e,r){return Object.values(e.blocks).forEach(i=>{i.forEach(o=>{if(o.type==="embed"&&o.embedType==="image"){const s=o.embedData;if(Array.isArray(s.src))return;let l=r.blockIdMap.get(o.id);for(;l&&r.blockIdMap.get(l);)l=r.blockIdMap.get(l);l&&Tl(t,l).setAutoFix(!0)}})}),!1}destroy(){}}const _z=D("image-embed");function Mz(n,t,e,r,i,o){Xe.create(n,e).createContent(i,o,t),n.addCustom("image-select-handler",()=>new Cz(n)),n.addCustom("image-copy-handler",()=>new Dz(n)),setTimeout(()=>{n.addCustom("drag-handler",()=>new pz(n));const l=n.addCustom("image-resizer",()=>new Ez(n)),c=e.embedData;yu(c)?l.disable(o):l.currentResizer===o&&l.enable(o)})}function Uz(n,t,e,r){const i=t.embedData,o=ku(i);return r==="html"?o.map(s=>`<img src="${n.doc.buildResourceUrl(s.src,{withToken:!0})}">`).join(""):r==="markdown"?`${o.map(l=>`})`).join(`
|
|
668
668
|
`)}
|
|
669
|
-
`:""}class Oz{constructor(){m(this,"group","image");m(this,"commands",[])}executeCommand(t,e,r){if(r.id==="replace-image"){const{block:i,image:o}=r.data;Xe.getImageObject(t,i).replaceImage(0,o)}}}function Nz(){return{blockCommands:{image:new Oz},abstract:`${_.t("image.abstract")}`}}function Pz(){return{name:"Image",insertEmbedCommandItems:[{id:"insert-image",name:_.t("image.abstract"),icon:DT,group:"common",subText:"/image",order:100}],handleInsertEmptyEmbed:async(n,t)=>{var A;let e;(A=t.data)!=null&&A.file&&(e=t.data.file);const r=ew(n);if(e=e!=null?e:await Uc(r),!e)return null;try{nw(n,e)}catch{return null}let i={width:Nd,height:VR};try{i=await HH(e)}catch(v){_z.error(v)}const o=n.rootContainer.clientWidth,s=i.width<o?Math.min(100,i.width/o*100):100,l={src:"",width:i.width,height:i.height,flex:1,virtualSize:!1},c=Gn([l],s),d={id:it(),type:"embed",embedType:"image",embedData:c},h=n.options.componentsOptions.image;h!=null&&h.defaultAlign&&(d.align=h.defaultAlign);const C=n.insertBlock(t.containerId,t.blockIndex,d);return Xe.getImageObject(n,C).replaceImage(0,e),C}}}function Fz(n,t,e){var h;const{data:r}=e,i=n.getBlockString(t).trim();if(!r||r.embedType!=="image"||!st(n,t))return null;const o=i.match(/^!\[[^\]]*\]\((?<filename>.*?)(?="|\))(?<optionalPart>".*")?\)/),s=(h=o==null?void 0:o.groups)==null?void 0:h.filename;if(!s)return null;const l={src:s},c={id:it(),type:"embed",embedType:"image",embedData:l};Xe.create(n,c).setAutoFix(!0);const d=n.options.componentsOptions.image.defaultAlign;return d&&(c.align=d),{blockData:c}}function Kz(n,t){const e=dt(t);n.destroyCustom(`image-${e}`)}const Vz={embedType:"image",createEmbedContent:Mz,convertTo:Uz,convertFrom:Fz,getBlockProperties:Nz,getOptions:Pz,handleDrop:fz,handleDropOver:mz,handleDeleteBlock:Kz};class $z{constructor(t,e){m(this,"toolbar");m(this,"anchor",null);m(this,"item");m(this,"docs",null);m(this,"checkedId");m(this,"handlePasteSpecial",(t,e)=>{!e.data||(this.checkedId===e.id?this.checkedId=void 0:this.checkedId=e.id,this.onPasteSpecial(this.cleaningDoc(e)),setTimeout(()=>{this.docs&&this.show(this.docs),this.editor.focus()}))});m(this,"handleClose",()=>{this.editor.focus()});m(this,"handleSelectionChange",()=>{this.toolbar.isVisible&&this.handleClose()});this.editor=t,this.onPasteSpecial=e,this.item={id:"paste-special",name:"",icon:_T,dropdown:!0,manualShowChildren:!0,childrenPlacement:"bottom-start",childrenOffset:[-4,4],children:[]},this.toolbar=new gd([this.item],void 0,{id:"paste-special-button",tooltipId:this.editor.clientId,refuseOverflow:!0}),this.toolbar.addListener("click",this.handlePasteSpecial),this.toolbar.addListener("close",this.handleClose)}show(t){this.docs=t;const e=this.editor,r=e.selection.range;if(!r.isCollapsed())return;const i=e.getBlockById(r.start.blockId);if(!st(e,i))return;const o=Vo(e,i,r)[0];if(!o)return;this.anchor&&this.anchor.remove(),this.anchor=jo(e,i,"paste-special-button-anchor",o);const s=this.getCommandItems(t);this.item.children=s,this.toolbar.manualShow(this.anchor)}cleaningDoc(t){const e=t.id,r=t.data;return e!=="text/plain"||Object.values(r.blocks).forEach(i=>{i.forEach(o=>{o.text&&o.text.forEach(s=>{if(s.attributes){const l=s.attributes;Object.keys(l).forEach(c=>{c==="link"&&delete l[c]})}})})}),r}hide(){this.toolbar.close("selectionChange")}clearCheckedState(){this.checkedId=void 0}destroy(){this.toolbar.destroy()}getCommandItems(t){const e=o=>({id:o,states:this.checkedId===o?["checked"]:void 0,name:_.t("pasteSpecial.originFormats"),data:t[o]}),r=[];let i=!0;return t["text/x-ones-editor-doc"]?r.push(e("text/x-ones-editor-doc")):t["text/office-html"]?r.push(e("text/office-html")):t["text/html"]?r.push(e("text/html")):t["text/plain"]&&(r.push(e("text/plain")),i=!1),t["text/plain"]&&(i&&r.push({id:"text/plain",states:this.checkedId==="text/plain"?["checked"]:void 0,name:_.t("pasteSpecial.plainText"),data:t["text/plain"]}),r.push({id:"text/markdown",states:this.checkedId==="text/markdown"?["checked"]:void 0,name:_.t("pasteSpecial.markdown"),data:t["text/markdown"]})),r}}const Hz=D("paste-special");class KA{constructor(t){m(this,"button");m(this,"lastUndoAction",null);m(this,"lastPos",null);m(this,"event",null);m(this,"handlePasteSpecial",t=>{this.editor.undoManager.runInGroup(()=>{this.editor.undoManager.undoTo(this.lastUndoAction),this.editor.pasteDoc(t)})});this.editor=t,this.button=new $z(t,this.handlePasteSpecial)}destroy(){this.event=null,this.button.destroy()}handleChanged(t,e){this.event=null,this.button.hide()}async handleBeforePaste(t,e){return Hz.debug("before paste"),this.lastUndoAction=t.undoManager.lastAction(),this.lastPos=t.selection.range.start,!1}async handleAfterPaste(t,e,r){if(Object.keys(r).length<=1)return!1;const i=t.selection.range;if(i.isCollapsed()){const o=t.getBlockById(i.start.blockId);if(!st(t,o))return!1;if(this.lastPos&&bi(this.lastPos)){const s=t.findBlockById(this.lastPos.blockId);if(s&&Ko(s))return!1}this.button.clearCheckedState(),this.button.show(r),this.event=e}return!1}}const jz={pasteSpecial:{originFormats:"\u4FDD\u6301\u539F\u6837\u5F0F",plainText:"\u7C98\u8D34\u7EAF\u6587\u672C",markdown:"\u7C98\u8D34\u4E3A Markdown"}},zz={pasteSpecial:{originFormats:"Keep origin formats",plainText:"Paste as plain text",markdown:"Paste as markdown"}},Gz={pasteSpecial:{originFormats:"\u5143\u306E\u30B9\u30BF\u30A4\u30EB\u3092\u7DAD\u6301\u3059\u308B",plainText:"\u30D7\u30EC\u30FC\u30F3\u30C6\u30AD\u30B9\u30C8\u3092\u8CBC\u308A\u4ED8\u3051\u308B",markdown:"Markdown \u3068\u3057\u3066\u8CBC\u308A\u4ED8\u3051"}};_.mergeLang({"zh-CN":jz,"en-US":zz,"ja-JP":Gz});const Oat="",Wz=D("html-to-doc");function qz(n){const t=/(<span data-editor-doc=")[\s\S]*( id="ones-editor-doc"\s?>)/g;let e=n;ea()&&(e=n.replace(/style="(.*)"/,""));let r=e.match(t);if(!r||!r.length)return null;r=r.map(l=>l.replace(/(<span data-editor-doc=")/g,"").replace(/(" id="ones-editor-doc"\s?>)/g,""));const i=r[0],o=Bf(i);return JSON.parse(o)}function Xz(n){const t="ones-editor-doc::",e="::ones-editor-doc";let r=n.indexOf(t);if(r!==-1){r+=t.length;const o=n.indexOf(e,r);if(o!==-1){const s=n.substr(r,o-r);try{const l=Bf(s);return JSON.parse(l)}catch(l){Wz.error(`invalid doc data: ${l}, ${s}`)}}}const i=qz(n);return i||null}const Ew="latex-b172fea480b",Yz=n=>({name:"latex-block",level:"block",start(t){var e,r;return(r=(e=t.match(/\$\$[^\$]/))==null?void 0:e.index)!=null?r:-1},tokenizer(t,e){const r=/^\$\$([^\$]+)\$\$/.exec(t);return r?{type:"latex-block",raw:r[0],formula:r[1]}:void 0},renderer(t){return n.lazy?`<span class="${Ew}" block>${t.formula}</span>`:n.render(t.formula,!0)}}),Qz=n=>({name:"latex",level:"inline",start(t){var e,r;return(r=(e=t.match(/\$[^\$]/))==null?void 0:e.index)!=null?r:-1},tokenizer(t,e){const r=/^\$([^\$]+)\$/.exec(t);return r?{type:"latex",raw:r[0],formula:r[1]}:void 0},renderer(t){return n.lazy?`<span class="${Ew}">${t.formula}</span>`:n.render(t.formula,!1)}});var Jz=(n={})=>(n.lazy&&n.env!=="test"&&new IntersectionObserver((t,e)=>{for(const r of t){if(!r.isIntersecting)continue;const i=r.target;e.unobserve(i),Promise.resolve(n.render(i.innerText,i.hasAttribute("block"))).then(o=>{i.innerHTML=o}),i.classList.add("latex-rendered")}},{threshold:1}),{extensions:[Yz(n),Qz(n)]});function Ru(n){const t=n.type;if(t==="link")return!!n.tokens.some(Ru);switch(t){case"code":case"table":case"hr":case"blockquote":case"list":case"list_item":case"image":case"paragraph":return!0;default:return!1}}function Zz(n){return!Ru(n)}function tG(n){if(n.length===0)return[];if(n.length===1)return[n];const t=[];let e=[n[0]],r=Ru(n[0]);for(let i=1;i<n.length;i++){const o=n[i];r===Ru(o)?e.push(o):(t.push(e),e=[o],r=Ru(o))}return t.push(e),t}const Aw=D("token-to-text"),eG=n=>{p(Aw,n.blocks.root.length>0,"doc.blocks.root.length > 0");const t=n.blocks.root[0];return p(Aw,Array.isArray(t.text)&&t.text.length!==0,"first block text is not empty"),t.text.map(e=>e.insert).join("")},xw=n=>{var o,s;let t=n;const e=(o=t.match(/^(http|https):\/\//))==null?void 0:o[0],r=t.substring((s=e==null?void 0:e.length)!=null?s:0);if(!e)return n;const i=jA(r);return i&&(t=e+eG(i)),t};function nG(n,t,e){let r=xw(n.href);r.startsWith("mailto:")&&(r=r.substring(7));let i=e.tokensToText(n.tokens,t,e);return i.forEach(o=>{o.insert=xw(o.insert)}),i.length===0&&(i=Ea(r,t)),i=Im(i,"link",r),i}let Xd;function VA(n){Xd||(Xd=document.createElement("textarea")),Xd.innerHTML=n;const t=Xd.childNodes.length===0?"":Xd.childNodes[0].nodeValue;return t!=null?t:""}function rG(n,t){const e=VA(n.text);return[Xr(e,{...t,"style-code":!0})]}function iG(n,t,e){const i=n.tokens;return i?e.tokensToText(i,t,e):F1(VA(n.text),t)}const oG=D("token-to-text");function $A(n,t,e){return n.map(i=>i.type==="text"?iG(i,t,e):i.type==="strong"?e.tokensToText(i.tokens,{...t,"style-bold":!0},e):i.type==="em"?e.tokensToText(i.tokens,{...t,"style-italic":!0},e):i.type==="del"?e.tokensToText(i.tokens,{...t,"style-strikethrough":!0},e):i.type==="link"?nG(i,t,e):i.type==="codespan"?rG(i,t):i.type==="br"?[{insert:" ",attributes:{id:it(),created:Date.now(),box:!0,type:"br"}}]:i.type==="escape"?F1(VA(i.text),t):i.type==="latex"?[{insert:" ",attributes:{id:it(),created:Date.now(),box:!0,type:"math",tex:i.formula}}]:(oG.warn(`unknown token in text: ${JSON.stringify(i)}`),[])).flat()}function sG(n,t){const e=$A(n.tokens,{},t);return[{id:it(),type:"text",text:e,heading:n.depth}]}function lG(n,t){const{text:e,children:r}=t.tokensToTextWithChildren(n.tokens,t),i=[];return e.length>0&&i.push({id:it(),type:"text",text:e}),i.push(...r),i}function aG(n,t){const{text:e,children:r}=t.tokensToTextWithChildren([n],t),i=[];return e.length>0&&i.push({id:it(),type:"text",text:e}),i.push(...r),i}function cG(n,t){const e=typeof n.start=="number"?n.start:1,r=n.ordered,i=it(),o=[];return n.items.forEach((l,c)=>{const d={...t,listLevel:t.listLevel+1},{text:h,children:C}=t.tokensToTextWithChildren(l.tokens,d);let E;typeof l.checked=="boolean"&&(E=l.checked?"checked":"unchecked");const A={id:it(),type:"list",groupId:i,ordered:r,checkbox:E,start:e+c,text:h,level:t.listLevel};o.push(A),o.push(...C)}),o}function uG(n,t){const e=t.tokensToBlocks(n.tokens,t);return e.forEach(r=>{r.quoted=!0}),e}const bw=100,fG=20,dG=600;function hG(n,t){const e=t.text;if(e){const r=Re(e);return Math.min(Em(r,n)+fG,dG)}return bw}function vw(n,t){let e=bw;return t.forEach(r=>{e=Math.max(e,hG(n,r))}),e}function mG(n,t){var l,c;const e=n.header.length,r=n.rows.length+1,i=[],o=Array(e).fill(100);for(let d=0;d<r;d++){let h;d===0?h=n.header:h=n.rows[d-1];for(let C=0;C<e;C++){const E=h[C],A=(l=E==null?void 0:E.tokens)!=null?l:[],v=it();i.push(v);let w;if(A.length===0)w=[Fm()];else if(Ru(A[0]))w=t.tokensToBlocks(E.tokens,t),w.length===0&&w.push(Fm());else{const{text:S,children:U}=t.tokensToTextWithChildren(E.tokens,t);w=[{id:it(),type:"text",text:S},...U]}t.doc.blocks[v]=w,o[C]=Math.max(o[C],vw((c=t.font)!=null?c:"",w))}}return[{id:it(),type:"table",cols:e,rows:r,colsWidth:o,children:i}]}function gG(n){return[{id:it(),type:"embed",embedType:"hr",embedData:{}}]}function pG(n,t){const e=n.text;if(!e)return[];try{const c=n.text,d=Bf(c),h=JSON.parse(d);if(h){const{root:C,...E}=h.blocks;return t.doc.blocks={...t.doc.blocks,...E},C}}catch{}const r=_.t("code.plainText");if(r==="mermaid")return[{id:it(),type:"embed",embedType:"mermaid",embedData:{mermaidText:e}}];if(r==="plantuml")return[{id:it(),type:"embed",embedType:"plantuml",embedData:{plantumlText:e}}];if(r==="flow"||r==="flowchart")return[{id:it(),type:"embed",embedType:"flowchart",embedData:{flowchartText:e}}];const o=e.split(`
|
|
669
|
+
`:""}class Oz{constructor(){m(this,"group","image");m(this,"commands",[])}executeCommand(t,e,r){if(r.id==="replace-image"){const{block:i,image:o}=r.data;Xe.getImageObject(t,i).replaceImage(0,o)}}}function Nz(){return{blockCommands:{image:new Oz},abstract:`${_.t("image.abstract")}`}}function Pz(){return{name:"Image",insertEmbedCommandItems:[{id:"insert-image",name:_.t("image.abstract"),icon:DT,group:"common",subText:"/image",order:100}],handleInsertEmptyEmbed:async(n,t)=>{var A;let e;(A=t.data)!=null&&A.file&&(e=t.data.file);const r=ew(n);if(e=e!=null?e:await Uc(r),!e)return null;try{nw(n,e)}catch{return null}let i={width:Nd,height:VR};try{i=await HH(e)}catch(v){_z.error(v)}const o=n.rootContainer.clientWidth,s=i.width<o?Math.min(100,i.width/o*100):100,l={src:"",width:i.width,height:i.height,flex:1,virtualSize:!1},c=Gn([l],s),d={id:it(),type:"embed",embedType:"image",embedData:c},h=n.options.componentsOptions.image;h!=null&&h.defaultAlign&&(d.align=h.defaultAlign);const C=n.insertBlock(t.containerId,t.blockIndex,d);return Xe.getImageObject(n,C).replaceImage(0,e),C}}}function Fz(n,t,e){var h;const{data:r}=e,i=n.getBlockString(t).trim();if(!r||r.embedType!=="image"||!st(n,t))return null;const o=i.match(/^!\[[^\]]*\]\((?<filename>.*?)(?="|\))(?<optionalPart>".*")?\)/),s=(h=o==null?void 0:o.groups)==null?void 0:h.filename;if(!s)return null;const l={src:s},c={id:it(),type:"embed",embedType:"image",embedData:l};Xe.create(n,c).setAutoFix(!0);const d=n.options.componentsOptions.image.defaultAlign;return d&&(c.align=d),{blockData:c}}function Kz(n,t){const e=dt(t);n.destroyCustom(`image-${e}`)}const Vz={embedType:"image",createEmbedContent:Mz,convertTo:Uz,convertFrom:Fz,getBlockProperties:Nz,getOptions:Pz,handleDrop:fz,handleDropOver:mz,handleDeleteBlock:Kz};class $z{constructor(t,e){m(this,"toolbar");m(this,"anchor",null);m(this,"item");m(this,"docs",null);m(this,"checkedId");m(this,"handlePasteSpecial",(t,e)=>{!e.data||(this.checkedId===e.id?this.checkedId=void 0:this.checkedId=e.id,this.onPasteSpecial(this.cleaningDoc(e)),setTimeout(()=>{this.docs&&this.show(this.docs),this.editor.focus()}))});m(this,"handleClose",()=>{this.editor.focus()});m(this,"handleSelectionChange",()=>{this.toolbar.isVisible&&this.handleClose()});this.editor=t,this.onPasteSpecial=e,this.item={id:"paste-special",name:"",icon:_T,dropdown:!0,manualShowChildren:!0,childrenPlacement:"bottom-start",childrenOffset:[-4,4],children:[]},this.toolbar=new gd([this.item],void 0,{id:"paste-special-button",tooltipId:this.editor.clientId,refuseOverflow:!0}),this.toolbar.addListener("click",this.handlePasteSpecial),this.toolbar.addListener("close",this.handleClose)}show(t){this.docs=t;const e=this.editor,r=e.selection.range;if(!r.isCollapsed())return;const i=e.getBlockById(r.start.blockId);if(!st(e,i))return;const o=Vo(e,i,r)[0];if(!o)return;this.anchor&&this.anchor.remove(),this.anchor=jo(e,i,"paste-special-button-anchor",o);const s=this.getCommandItems(t);this.item.children=s,this.toolbar.manualShow(this.anchor)}cleaningDoc(t){const e=t.id,r=t.data;return e!=="text/plain"||Object.values(r.blocks).forEach(i=>{i.forEach(o=>{o.text&&o.text.forEach(s=>{if(s.attributes){const l=s.attributes;Object.keys(l).forEach(c=>{c==="link"&&delete l[c]})}})})}),r}hide(){this.toolbar.close("selectionChange")}clearCheckedState(){this.checkedId=void 0}destroy(){this.toolbar.destroy()}getCommandItems(t){const e=o=>({id:o,states:this.checkedId===o?["checked"]:void 0,name:_.t("pasteSpecial.originFormats"),data:t[o]}),r=[];let i=!0;return t["text/x-ones-editor-doc"]?r.push(e("text/x-ones-editor-doc")):t["text/office-html"]?r.push(e("text/office-html")):t["text/html"]?r.push(e("text/html")):t["text/plain"]&&(r.push(e("text/plain")),i=!1),t["text/plain"]&&(i&&r.push({id:"text/plain",states:this.checkedId==="text/plain"?["checked"]:void 0,name:_.t("pasteSpecial.plainText"),data:t["text/plain"]}),r.push({id:"text/markdown",states:this.checkedId==="text/markdown"?["checked"]:void 0,name:_.t("pasteSpecial.markdown"),data:t["text/markdown"]})),r}}const Hz=D("paste-special");class KA{constructor(t){m(this,"button");m(this,"lastUndoAction",null);m(this,"lastPos",null);m(this,"event",null);m(this,"handlePasteSpecial",t=>{this.editor.undoManager.runInGroup(()=>{this.editor.undoManager.undoTo(this.lastUndoAction),this.editor.pasteDoc(t)})});this.editor=t,this.button=new $z(t,this.handlePasteSpecial)}destroy(){this.event=null,this.button.destroy()}handleChanged(t,e){this.event=null,this.button.hide()}async handleBeforePaste(t,e){return Hz.debug("before paste"),this.lastUndoAction=t.undoManager.lastAction(),this.lastPos=t.selection.range.start,!1}async handleAfterPaste(t,e,r){if(Object.keys(r).length<=1)return!1;const i=t.selection.range;if(i.isCollapsed()){const o=t.getBlockById(i.start.blockId);if(!st(t,o))return!1;if(this.lastPos&&bi(this.lastPos)){const s=t.findBlockById(this.lastPos.blockId);if(s&&Ko(s))return!1}this.button.clearCheckedState(),this.button.show(r),this.event=e}return!1}}const jz={pasteSpecial:{originFormats:"\u4FDD\u6301\u539F\u6837\u5F0F",plainText:"\u7C98\u8D34\u7EAF\u6587\u672C",markdown:"\u7C98\u8D34\u4E3A Markdown"}},zz={pasteSpecial:{originFormats:"Keep origin formats",plainText:"Paste as plain text",markdown:"Paste as markdown"}},Gz={pasteSpecial:{originFormats:"\u5143\u306E\u30B9\u30BF\u30A4\u30EB\u3092\u7DAD\u6301\u3059\u308B",plainText:"\u30D7\u30EC\u30FC\u30F3\u30C6\u30AD\u30B9\u30C8\u3092\u8CBC\u308A\u4ED8\u3051\u308B",markdown:"Markdown \u3068\u3057\u3066\u8CBC\u308A\u4ED8\u3051"}};_.mergeLang({"zh-CN":jz,"en-US":zz,"ja-JP":Gz});const Oat="",Wz=D("html-to-doc");function qz(n){const t=/(<span data-editor-doc=")[\s\S]*( id="ones-editor-doc"\s?>)/g;let e=n;ea()&&(e=n.replace(/style="(.*)"/,""));let r=e.match(t);if(!r||!r.length)return null;r=r.map(l=>l.replace(/(<span data-editor-doc=")/g,"").replace(/(" id="ones-editor-doc"\s?>)/g,""));const i=r[0],o=Bf(i);return JSON.parse(o)}function Xz(n){const t="ones-editor-doc::",e="::ones-editor-doc";let r=n.indexOf(t);if(r!==-1){r+=t.length;const o=n.indexOf(e,r);if(o!==-1){const s=n.substr(r,o-r);try{const l=Bf(s);return JSON.parse(l)}catch(l){Wz.error(`invalid doc data: ${l}, ${s}`)}}}const i=qz(n);return i||null}const Ew="latex-b172fea480b",Yz=n=>({name:"latex-block",level:"block",start(t){var e,r;return(r=(e=t.match(/\$\$[^\$]/))==null?void 0:e.index)!=null?r:-1},tokenizer(t,e){const r=/^\$\$([^\$]+)\$\$/.exec(t);return r?{type:"latex-block",raw:r[0],formula:r[1]}:void 0},renderer(t){return n.lazy?`<span class="${Ew}" block>${t.formula}</span>`:n.render(t.formula,!0)}}),Qz=n=>({name:"latex",level:"inline",start(t){var e,r;return(r=(e=t.match(/\$[^\$]/))==null?void 0:e.index)!=null?r:-1},tokenizer(t,e){const r=/^\$([^\$]+)\$/.exec(t);return r?{type:"latex",raw:r[0],formula:r[1]}:void 0},renderer(t){return n.lazy?`<span class="${Ew}">${t.formula}</span>`:n.render(t.formula,!1)}});var Jz=(n={})=>(n.lazy&&n.env!=="test"&&new IntersectionObserver((t,e)=>{for(const r of t){if(!r.isIntersecting)continue;const i=r.target;e.unobserve(i),Promise.resolve(n.render(i.innerText,i.hasAttribute("block"))).then(o=>{i.innerHTML=o}),i.classList.add("latex-rendered")}},{threshold:1}),{extensions:[Yz(n),Qz(n)]});function Ru(n){const t=n.type;if(t==="link")return!!n.tokens.some(Ru);switch(t){case"code":case"table":case"hr":case"blockquote":case"list":case"list_item":case"image":case"paragraph":return!0;default:return!1}}function Zz(n){return!Ru(n)}function tG(n){if(n.length===0)return[];if(n.length===1)return[n];const t=[];let e=[n[0]],r=Ru(n[0]);for(let i=1;i<n.length;i++){const o=n[i];r===Ru(o)?e.push(o):(t.push(e),e=[o],r=Ru(o))}return t.push(e),t}const Aw=D("token-to-text"),eG=n=>{p(Aw,n.blocks.root.length>0,"doc.blocks.root.length > 0");const t=n.blocks.root[0];return p(Aw,Array.isArray(t.text)&&t.text.length!==0,"first block text is not empty"),t.text.map(e=>e.insert).join("")},xw=n=>{var o,s;let t=n;const e=(o=t==null?void 0:t.match(/^(http|https):\/\/[^/]+/))==null?void 0:o[0],r=t.substring((s=e==null?void 0:e.length)!=null?s:0);if(!e||!r)return n;const i=jA(r);return i&&(t=e+eG(i)),t};function nG(n,t,e){let r=xw(n.href);r.startsWith("mailto:")&&(r=r.substring(7));let i=e.tokensToText(n.tokens,t,e);return i.forEach(o=>{o.insert=xw(o.insert)}),i.length===0&&(i=Ea(r,t)),i=Im(i,"link",r),i}let Xd;function VA(n){Xd||(Xd=document.createElement("textarea")),Xd.innerHTML=n;const t=Xd.childNodes.length===0?"":Xd.childNodes[0].nodeValue;return t!=null?t:""}function rG(n,t){const e=VA(n.text);return[Xr(e,{...t,"style-code":!0})]}function iG(n,t,e){const i=n.tokens;return i?e.tokensToText(i,t,e):F1(VA(n.text),t)}const oG=D("token-to-text");function $A(n,t,e){return n.map(i=>i.type==="text"?iG(i,t,e):i.type==="strong"?e.tokensToText(i.tokens,{...t,"style-bold":!0},e):i.type==="em"?e.tokensToText(i.tokens,{...t,"style-italic":!0},e):i.type==="del"?e.tokensToText(i.tokens,{...t,"style-strikethrough":!0},e):i.type==="link"?nG(i,t,e):i.type==="codespan"?rG(i,t):i.type==="br"?[{insert:" ",attributes:{id:it(),created:Date.now(),box:!0,type:"br"}}]:i.type==="escape"?F1(VA(i.text),t):i.type==="latex"?[{insert:" ",attributes:{id:it(),created:Date.now(),box:!0,type:"math",tex:i.formula}}]:(oG.warn(`unknown token in text: ${JSON.stringify(i)}`),[])).flat()}function sG(n,t){const e=$A(n.tokens,{},t);return[{id:it(),type:"text",text:e,heading:n.depth}]}function lG(n,t){const{text:e,children:r}=t.tokensToTextWithChildren(n.tokens,t),i=[];return e.length>0&&i.push({id:it(),type:"text",text:e}),i.push(...r),i}function aG(n,t){const{text:e,children:r}=t.tokensToTextWithChildren([n],t),i=[];return e.length>0&&i.push({id:it(),type:"text",text:e}),i.push(...r),i}function cG(n,t){const e=typeof n.start=="number"?n.start:1,r=n.ordered,i=it(),o=[];return n.items.forEach((l,c)=>{const d={...t,listLevel:t.listLevel+1},{text:h,children:C}=t.tokensToTextWithChildren(l.tokens,d);let E;typeof l.checked=="boolean"&&(E=l.checked?"checked":"unchecked");const A={id:it(),type:"list",groupId:i,ordered:r,checkbox:E,start:e+c,text:h,level:t.listLevel};o.push(A),o.push(...C)}),o}function uG(n,t){const e=t.tokensToBlocks(n.tokens,t);return e.forEach(r=>{r.quoted=!0}),e}const bw=100,fG=20,dG=600;function hG(n,t){const e=t.text;if(e){const r=Re(e);return Math.min(Em(r,n)+fG,dG)}return bw}function vw(n,t){let e=bw;return t.forEach(r=>{e=Math.max(e,hG(n,r))}),e}function mG(n,t){var l,c;const e=n.header.length,r=n.rows.length+1,i=[],o=Array(e).fill(100);for(let d=0;d<r;d++){let h;d===0?h=n.header:h=n.rows[d-1];for(let C=0;C<e;C++){const E=h[C],A=(l=E==null?void 0:E.tokens)!=null?l:[],v=it();i.push(v);let w;if(A.length===0)w=[Fm()];else if(Ru(A[0]))w=t.tokensToBlocks(E.tokens,t),w.length===0&&w.push(Fm());else{const{text:S,children:U}=t.tokensToTextWithChildren(E.tokens,t);w=[{id:it(),type:"text",text:S},...U]}t.doc.blocks[v]=w,o[C]=Math.max(o[C],vw((c=t.font)!=null?c:"",w))}}return[{id:it(),type:"table",cols:e,rows:r,colsWidth:o,children:i}]}function gG(n){return[{id:it(),type:"embed",embedType:"hr",embedData:{}}]}function pG(n,t){const e=n.text;if(!e)return[];try{const c=n.text,d=Bf(c),h=JSON.parse(d);if(h){const{root:C,...E}=h.blocks;return t.doc.blocks={...t.doc.blocks,...E},C}}catch{}const r=_.t("code.plainText");if(r==="mermaid")return[{id:it(),type:"embed",embedType:"mermaid",embedData:{mermaidText:e}}];if(r==="plantuml")return[{id:it(),type:"embed",embedType:"plantuml",embedData:{plantumlText:e}}];if(r==="flow"||r==="flowchart")return[{id:it(),type:"embed",embedType:"flowchart",embedData:{flowchartText:e}}];const o=e.split(`
|
|
670
670
|
`).map(c=>({id:it(),type:"text",text:Ea(c)})),s=t.doc,l=it();return s.blocks[l]=o,[{id:it(),type:"code",language:r,children:[l]}]}function CG(n){return[{id:it(),type:"embed",embedType:"image",embedData:{src:n.href,title:n.title}}]}function EG(n,t){const{text:e,children:r}=t.tokensToTextWithChildren(n.tokens,t),i=[];return e.length>0&&i.push({id:it(),type:"text",text:e}),i.push(...r),i}function AG(n){const t=n.formula;return t?[{id:it(),type:"embed",embedType:"math",embedData:{mathjaxText:t}}]:[]}const Bw=D("markdown-to-doc");function xG(n,t){var e;if(n.type==="heading")return sG(n,t);if(n.type==="paragraph")return lG(n,t);if(n.type==="list")return cG(n,t);if(n.type==="blockquote")return uG(n,t);if(n.type==="table")return mG(n,t);if(n.type==="hr")return gG();if(n.type==="code")return pG(n,t);if(n.type==="image")return CG(n);if(n.type==="link")return EG(n,t);if(n.type==="latex-block")return AG(n);if(n.type==="text")return aG(n,t);if(n.type==="space"){const r=n.raw.replaceAll(" ",""),i=Math.floor(r.split(`
|
|
671
671
|
`).length/2)-1;return i>0?new Array(i).fill("").map(()=>({type:"text",id:it(),text:[]})):[]}if(n.type==="html"){const r=(e=t.htmlToDoc)==null?void 0:e.call(t,n.text);if(!r)return Bw.warn(`failed to convert html to doc: ${JSON.stringify(n)}`),[];const{root:i,...o}=r.blocks;return t.doc.blocks={...t.doc.blocks,...o},i}return Bw.warn(`unknown block token: ${JSON.stringify(n)}`),[]}function HA(n,t){const e=[];return n.forEach(r=>{const i=xG(r,t);e.push(...i)}),e}D("markdown-to-doc");function bG(n,t){const e={text:[],children:[]};return tG(n).forEach((i,o)=>{const s=i[0];if(o===0&&Zz(s)){e.text=$A(i,{},t);return}e.children.push(...HA(i,t))}),e}const vG={render:(n,t)=>""};wp.marked.use(Jz(vG)),wp.marked.use({mangle:!1});function jA(n,t){const r=new wp.marked.Lexer().lex(n),i={blocks:{root:[]},meta:{},comments:{}},o={font:t==null?void 0:t.font,doc:i,tokensToText:$A,tokensToBlocks:HA,tokensToTextWithChildren:bG,htmlToDoc:t==null?void 0:t.htmlToDoc,listLevel:1},s=HA(r,o);return s.length===0?null:(i.blocks.root.push(...s),i)}function BG(n){if(n.nodeName!=="DIV")return!1;const t=n;return Array.from(t.childNodes).every(e=>e.nodeName==="SPAN"||e instanceof Text)?!!t.querySelector(":scope > .hljs-function, :scope > .hljs-params, :scope > .hljs-string, :scope > .hljs-keyword, :scope > .hljs-attr"):!1}function yw(n){if(BG(n)){const t=n,e=t.parentNode,r=document.createElement("pre");Array.from(t.childNodes).forEach(i=>r.appendChild(i)),e==null||e.insertBefore(r,t);return}n.childNodes.forEach(t=>yw(t))}function Yd(n){var t;if(n instanceof HTMLBRElement){const e=document.createTextNode(`
|
|
672
672
|
`);(t=n.parentNode)==null||t.insertBefore(e,n),n.remove();return}n.childNodes.forEach(Yd)}function yG(n){n.addRule("codeListToCode",{filter:t=>t.nodeName!=="OL"?!1:Array.from(t.childNodes).every(e=>e.nodeName==="LI"&&e.childNodes.length===1&&e.childNodes[0].nodeName==="CODE"),replacement:(t,e,r)=>{Yd(e);const i=Array.from(e.children).map(o=>o.textContent).join(`
|
|
@@ -960,4 +960,4 @@ ${o.mermaidText}
|
|
|
960
960
|
${o.flowchartText}
|
|
961
961
|
\`\`\`\`\`\``}return""}const YJ={embedType:"flowchart",convertFrom:WJ,handleUpdateBlock:GJ,createEmbedContent:zJ,getBlockProperties:qJ,convertTo:XJ},QJ=D("plantuml-helper");function KS(n,t){var l;let r=((l=(n.getComponentOptions("plantuml")||{}).cdn)==null?void 0:l.plantuml)||wJ;r.endsWith("/")||(r+="/");const i=A9.default.encode(t);p(QJ,i,i),r+=i;const s=new URLSearchParams(document.location.search).get("doc");return $p(r,{id:`${s}-${it()}`})}async function JJ(n,t){try{const e=await yx(n,t);return(await n.doc.uploadResource(e)).resourceId}catch{return Promise.resolve(t)}}class Nu extends wx{constructor(t){super(t,"plantuml","plantumlText")}static get(t,e){return t.addCustom(`plantuml-${e.id}`,()=>new Nu(t))}code2ObjectUrl(t){return Promise.resolve(KS(this.editor,t))}code2ResourceId(t){const e=KS(this.editor,t);return JJ(this.editor,e)}destroy(){}}function ZJ(n,t,e){Nu.get(n,e).createEmbedContent(t,e)}function tZ(n,t,e){const r=Nu.get(n,e),i=zt(t);return r.updateEmbedContent(i,e),!0}function eZ(n,t,e){const{data:r}=e,i=n.getBlockString(t).trim();if(!r||r.embedType!=="plantuml"||i!=="```plantuml"||!st(n,t))return null;const o={src:"",plantumlText:""};return{blockData:{id:it(),type:"embed",embedType:"plantuml",embedData:o},onConverted:(c,d)=>{Nu.get(c,c.getBlockData(d)).editGraph(zt(d))}}}function nZ(n,t){return Nu.get(n,n.getBlockData(t)).getBlockProperties(t)}function rZ(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\`\`\`
|
|
962
962
|
${o.flowchartText}
|
|
963
|
-
\`\`\`\`\`\``}return""}const iZ={embedType:"plantuml",convertFrom:eZ,handleUpdateBlock:tZ,createEmbedContent:ZJ,getBlockProperties:nZ,convertTo:rZ},uct="",oZ="hr",sZ={dividingLine:{type:"\u5206\u5272\u7EBF",abstract:"\u5206\u5272\u7EBF"}},lZ={dividingLine:{type:"Dividing-Line",abstract:"Dividing-Line"}},aZ={dividingLine:{type:"\u533A\u5207\u308A\u7DDA",abstract:"\u533A\u5207\u308A\u7DDA"}};_.mergeLang({"zh-CN":sZ,"en-US":lZ,"ja-JP":aZ});function cZ(n,t){const e=B("div",["editor-embed-container"],t);B("hr",["editor-embed-hr"],e)}function uZ(n,t,e,r){return r==="html"?"<hr />":r==="markdown"?"---":"------------"}function fZ(){return{name:"hr",insertEmbedCommandItems:[{id:"insert-hr",name:_.t("dividingLine.type"),icon:qT,order:500,group:"common",subText:tr("insert-hr")}],handleInsertEmptyEmbed:async(n,t)=>{const{containerId:e,blockIndex:r}=t;return n.insertEmbed(e,r,oZ,{})}}}function dZ(n,t,e){const{data:r}=e;if(!r||r.embedType!=="dividing-line"||!st(n,t))return null;const i={};return{blockData:{id:it(),type:"embed",embedType:"hr",embedData:i}}}function hZ(){return{abstract:_.t("dividingLine.abstract")}}const mZ={embedType:"hr",createEmbedContent:cZ,convertTo:uZ,getOptions:fZ,convertFrom:dZ,getBlockProperties:hZ},fct="",dct="",gZ={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"}}},pZ={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"}}},CZ={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"}}};_.mergeLang({"zh-CN":gZ,"en-US":pZ,"ja-JP":CZ});var Ui=(n=>(n.AUDIO="audio",n.VIDEO="video",n))(Ui||{}),ah=(n=>(n.Empty="empty",n.Progress="progress",n.Error="error",n))(ah||{});const VS=10*1024*1024,EZ=["wav","mp3","aac","ogg","webm","flac"],AZ=["ogg","mp4","webm"],xZ=()=>{};function $S(n){var h,C,E,A,v,w;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:EZ,s=(E=e==null?void 0:e.video)!=null?E:AZ,l=(A=r==null?void 0:r.audio)!=null?A:VS,c=(v=r==null?void 0:r.video)!=null?v:VS,d=(w=i==null?void 0:i.onError)!=null?w:xZ;return{allowedMedias:{audio:o,video:s},maxSize:{audio:l,video:c},callbacks:{onError:d}}}function bZ(n,t){const e=o=>o.map(s=>`.${s}`).join(","),{allowedMedias:r}=$S(n),i=r[t];return i?e(i):"*"}function vZ(n,t,e){const{maxSize:r,callbacks:i,allowedMedias:o}=$S(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=kf(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 BZ(n){return n===ah.Empty||n===ah.Error}const xn=D("media");class yZ extends He.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=et(r.target);if(!o||!o.contains(this.mediaContainer))return;const s=this.renderError();this.updateMediaContent(s),this.emit("mediaError",e,"load_error",dt(o))});m(this,"handleUploadFile",async e=>{p(xn,this.abstract,"no abstract"),p(xn,this.mediaContainer,"The media element not exist");const{editor:r}=this.options,i=et(this.mediaContainer);p(xn,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){xn.error(s),this.emit("mediaError",r,"upload_error",o.id),this.renderRetry(e,s)}ut(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(xn,this.mediaContainer,"The media element not exist"),this.mediaContainer.innerHTML="",this.mediaContainer.append(e)}renderError(){p(xn,this.abstract,"no abstract");const{editor:e,createMediaElement:r}=this.options,{mediaIcon:i,mediaName:o}=this.abstract;p(xn,this.mediaContainer,"The media element not exist");const s=et(this.mediaContainer);p(xn,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=_.t("media.load.failed",{name:o}),c.appendChild(h);const C=h.querySelector(".retry-upload");return p(xn,C,"The element not exist"),e.domEvents.addEventListener(C,"click",(E,A)=>{const v=B("div",["media-element"],null),w=this.getResourceUrl(l),S=r(E,v,l,w);this.unbindMediaEvent(),this.media=S,this.bindMediaEvent(),this.updateMediaContent(v)}),this.setFullScreen(),c}renderRetry(e,r){var E,A;p(xn,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=_.t("media.upload.failed",{name:s});(((E=r.response)==null?void 0:E.status)===420||((A=r.response)==null?void 0:A.status)===413)&&(h=_.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(xn,this.abstract,"no abstract"),this.handleUploadFile(e))}),this.updateMediaContent(l),this.setFullScreen()}renderProgress(e,r){p(xn,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=et(this.mediaContainer);p(xn,l,"The element not exist"),q(l,"media-block-uploading");const c=B("div",["media-progress"],null);s(c,o,r),this.updateMediaContent(c)}this.setFullScreen()}renderMediaElement(e,r){p(xn,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(xn,this.abstract,"no abstract"),p(xn,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=et(r);if(C&&!o.readonly&&o.isBlockWritable(C)){const E=xt.default(e);E.embedData.src=s,o.updateBlockData(C,E)}}}})}setFullScreen(){p(xn,this.mediaContainer,"The media element not exist"),q(this.mediaContainer,"full-screen")}removeFullScreen(){p(xn,this.mediaContainer,"The media element not exist"),ut(this.mediaContainer,"full-screen")}updateBlockAlign(e,r){const i=et(r);p(xn,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),BZ(i)?i===ah.Empty&&this.renderEmpty(e):this.renderMediaElement(e,r)}setAbstract(e){this.abstract=e}}D("media-embed");const TZ="left";class HS{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=bZ(t,this.embedType);if(o=o!=null?o:await Uc(s,{}),!o)return null;const{mediaType:l}=this.getAbstract();try{vZ(o,t,l)}catch{return null}const c={id:it(),type:"embed",embedType:this.embedType,embedData:{src:ah.Empty}};l==="video"&&(c.align=TZ);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 yZ({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:tr(`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=zt(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 jS(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 zS(n,t){const e=n.querySelector(".uploading-progress-bar-value");e&&(e.style.width=`${t}%`)}const kZ=D("media-audio");class RZ extends HS{constructor(){super(...arguments);m(this,"embedType",Ui.AUDIO);m(this,"updateProgressElement",zS);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:zT,mediaName:_.t(`media.${Ui.AUDIO}.menuItem`),menuItem:_.t(`media.${Ui.AUDIO}.menuItem`),order:800,mediaType:Ui.AUDIO,group:"common"}}getBlockProperties(){return{abstract:`${_.t(`media.${Ui.AUDIO}.abstract`)}`}}updateMediaElement(e,r,i,o){const s=r.querySelector(":scope .audio-container > audio");return p(kZ,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",jS(e,r)}}const wZ=new RZ;D("video-resizer");function GS(n){return n&&Le(n)&&ln(n)==="video"}const SZ=50;class Sx{constructor(t){m(this,"currentResizableElement",null);m(this,"resizing",!1);m(this,"handleHoveringBlockChange",(t,e)=>{if(!this.resizing&&!window.isDragging&&(e&&GS(e)&&this.disableBlockResize(e),t&&GS(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,SZ),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,je.get(t).addListener("change",this.handleHoveringBlockChange)}destroy(){this.currentResizableElement=null,je.get(this.editor).removeListener("change",this.handleHoveringBlockChange)}getVideoElement(t){return zt(t).querySelector(":scope .video-container > video")}updateResizer(t){const e=this.editor.findCustom(`${dt(t)}-resizer`);e&&e.updateResizer()}disableBlockResize(t){const e=this.editor.findCustom(`${dt(t)}-resizer`);e&&e.disableResize()}enableBlockResize(t,e){const r=this.editor.addCustom(`${dt(t)}-resizer`,()=>new Pd(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 LZ=D("video");class IZ extends HS{constructor(){super(...arguments);m(this,"embedType",Ui.VIDEO);m(this,"updateProgressElement",zS);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 Sx(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,jS(e,r),Mc(i).then(s=>{const l=e.querySelector(".progress-video");l&&c1(e)&&(l.src=s)})})}getAbstract(){return{mediaName:_.t(`media.${Ui.VIDEO}.menuItem`),mediaIcon:GT,menuItem:_.t(`media.${Ui.VIDEO}.menuItem`),order:700,mediaType:Ui.VIDEO,group:"common"}}getBlockProperties(){return{abstract:`${_.t(`media.${Ui.VIDEO}.abstract`)}`}}handleMediaError(e,r,i){const o=e.addCustom("video-resizer",()=>new Sx(e)),s=e.getBlockById(i);o.disableBlockResize(s)}updateMediaElement(e,r,i,o){const s=r.querySelector(":scope .video-container > video");p(LZ,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 Sx(e)).updateResizer(l)}),s}}const DZ=new IZ,WS=[dA,xA,bA,Ok],Lx=[OS,DQ,VJ,YJ,iZ,jK,mZ,DZ,wZ,Vz,dS,yX],qS=[qk,gS,P4];function _Z(n,t,e){var i,o,s,l;Br.level=(i=e.logLevel)!=null?i:Gi.DEBUG;const r=td(n,t,{components:{blocks:[...WS,...((o=e==null?void 0:e.components)==null?void 0:o.blocks)||[]],embeds:[...Lx,...((s=e.components)==null?void 0:s.embeds)||[]],boxes:[...qS,...((l=e.components)==null?void 0:l.boxes)||[]],textRenders:[new XE],options:{...e.componentsOptions}}});return r.readonly=!0,r.addCustom("heading-collapse",()=>new mx(r)),r.addCustom("editor-tooltip",()=>new Ld(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 XS{constructor(t){this.createOptions=t,t.lang&&_.setLang(t.lang)}createHistoryEditor(t,e){return _Z(t,e,this.createOptions)}}function YS(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=td(t,e,{shortcuts:[s0],components:{blocks:s,commandProviders:[new F0],decorators:[new dg],embeds:l,boxes:c,options:o}});if(d.input.addHandler(new mg),d.input.addHandler(new KA(d)),d.input.addHandler(new WA(d)),d.input.addHandler(new Mq(d)),d.input.addHandler(new Eg),d.addCustom("image-paste-handler",()=>new FA(d)),de.isMobile||d.addCustom("editor-tooltip",()=>new Ld(d)),n.options.enableContextMenu!==!1&&d.addCustom("editor-context-menu",E=>new YA(E)),(h=n.options.componentsOptions)!=null&&h.mention){const E=n.options.componentsOptions.mention;d.addCustom("mention",()=>new mS(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 MZ(n,t){const e=Array.from(n.rootContainer.querySelectorAll(`[comment-${t.toLocaleLowerCase()}="${t}"]`)),r=new Set;e.forEach(i=>{const o=et(i);o&&r.add(o)}),r.forEach(i=>{Uq(n,i,t)})}class UZ{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&&MZ(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 YS(this.editor,{root:t,childDoc:e,doc:this.doc})}allowEdit(t){return t.userId===this.doc.getUser().userId}}class OZ{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 WC(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 YS(this.editor,{root:t,childDoc:e,doc:this.localDoc})}allowEdit(t){return t.userId===this.localDoc.getUser().userId}}const NZ={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}",limitedEnvTips:"\u7531\u4E8E\u6D4F\u89C8\u5668\u9650\u5236\uFF0C\u8BF7\u4F7F\u7528 {shortCut} \u7C98\u8D34"}},PZ={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}",limitedEnvTips:"Press {shortCut} to paste due to browser restrictions"}},FZ={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",limitedEnvTips:"\u30D6\u30E9\u30A6\u30B6\u30FC\u306E\u5236\u9650\u306B\u3088\u308A\u3001\u300C{shortCut}\u300D\u3092\u4F7F\u7528\u3057\u3066\u8CBC\u308A\u4ED8\u3051\u3066\u304F\u3060\u3055\u3044"}};_.mergeLang({"zh-CN":NZ,"en-US":PZ,"ja-JP":FZ});const KZ="UEsDBBQABgAIAAAAIQBk9WPugQEAACkGAAATAAgCW0NvbnRlbnRfVHlwZXNdLnhtbCCiBAIooAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AhALb0Z5jSBgAAySAAABUAAAAAAAAAAAAAAAAAog8AAHdvcmQvdGhlbWUvdGhlbWUxLnhtbFBLAQItABQABgAIAAAAIQDlI7CA9QMAAKALAAARAAAAAAAAAAAAAAAAAKcWAAB3b3JkL3NldHRpbmdzLnhtbFBLAQItABQABgAIAAAAIQBAwf/xOQEAACMDAAAUAAAAAAAAAAAAAAAAAMsaAAB3b3JkL3dlYlNldHRpbmdzLnhtbFBLAQItABQABgAIAAAAIQA520VMuQUAACdaAAASAAAAAAAAAAAAAAAAADYcAAB3b3JkL251bWJlcmluZy54bWxQSwECLQAUAAYACAAAACEA+JXI7/wOAADzmQAADwAAAAAAAAAAAAAAAAAfIgAAd29yZC9zdHlsZXMueG1sUEsBAi0AFAAGAAgAAAAhAMySUFR9AQAA8QIAABEAAAAAAAAAAAAAAAAASDEAAGRvY1Byb3BzL2NvcmUueG1sUEsBAi0AFAAGAAgAAAAhACJREfHVAQAA3gMAABAAAAAAAAAAAAAAAAAA/DMAAGRvY1Byb3BzL2FwcC54bWxQSwECLQAUAAYACAAAACEAiD+lv+EAAABVAQAAGAAAAAAAAAAAAAAAAAAHNwAAY3VzdG9tWG1sL2l0ZW1Qcm9wczEueG1sUEsBAi0AFAAGAAgAAAAhAMEnywi2AAAAIQEAABMAAAAAAAAAAAAAAAAARjgAAGN1c3RvbVhtbC9pdGVtMS54bWxQSwECLQAUAAYACAAAACEAdD85esIAAAAoAQAAHgAAAAAAAAAAAAAAAABVOQAAY3VzdG9tWG1sL19yZWxzL2l0ZW0xLnhtbC5yZWxzUEsBAi0AFAAGAAgAAAAhAOuAYExTAwAAjw4AABIAAAAAAAAAAAAAAAAAWzsAAHdvcmQvZm9udFRhYmxlLnhtbFBLBQYAAAAADwAPANQDAADePgAAAAA=",VZ=()=>Hp(KZ),$Z=D("image-to-docx");async function HZ(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 QS(n,t){if(n.width&&n.height)return{width:n.width,height:n.height,buffer:t};try{const e=await Mc(new File([t],"",{})),r=await HZ(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}}catch(e){$Z.error(e);return}}function jZ(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 zZ(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 JS(n=[0,1,2,3,4,5,6,7],t=1){return n.map(e=>{let r;switch(e%3){case 0:r=yt.LevelFormat.DECIMAL;break;case 1:r=yt.LevelFormat.LOWER_LETTER;break;default:r=yt.LevelFormat.LOWER_ROMAN;break}return{level:e,format:r,text:`%${e+1}. `,alignment:yt.AlignmentType.START,start:t,style:{paragraph:{indent:{left:yt.convertInchesToTwip(.3*(e+1)),hanging:yt.convertInchesToTwip(.2)}}}}})}function GZ(){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:yt.LevelFormat.BULLET,text:t,alignment:yt.AlignmentType.START,style:{paragraph:{indent:{left:yt.convertInchesToTwip(.3*(n+1)),hanging:yt.convertInchesToTwip(.2)}}}}})}function WZ(){return[0,1,2,3,4,5,6,7].map(n=>({level:n,format:yt.LevelFormat.BULLET,text:"\u2611",alignment:yt.AlignmentType.START,style:{paragraph:{indent:{left:yt.convertInchesToTwip(.3*(n+1)),hanging:yt.convertInchesToTwip(.2)}}}}))}function qZ(){return[0,1,2,3,4,5,6,7].map(n=>({level:n,format:yt.LevelFormat.BULLET,text:"\u2610",alignment:yt.AlignmentType.START,style:{paragraph:{indent:{left:yt.convertInchesToTwip(.3*(n+1)),hanging:yt.convertInchesToTwip(.2)}}}}))}var ch=(n=>(n.NUMBERING="number-numbering-reference",n.BULLET="number-bullet-reference",n.CHECKED="checked-bullet-reference",n.UNCHECKED="unchecked-bullet-reference",n))(ch||{});const XZ=[{levels:JS(),reference:"number-numbering-reference"},{levels:GZ(),reference:"number-bullet-reference"},{levels:WZ(),reference:"checked-bullet-reference"},{levels:qZ(),reference:"unchecked-bullet-reference"}];function YZ(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 QZ(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 JZ(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 ZZ=/rgb\((\d+),\s*(\d+),\s*(\d+)\)/;function ZS(n){if(typeof n=="string"&&n.length>0){if(n[0]==="#")return n.substring(1);const t=n.match(ZZ);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 On(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 tL(n,t,e){for(let r=0;r<=e;++r){const i=`${t}${r}`;if(On(n,i))return i}}function Kg(n,t,e){n.attributes=n.attributes||{},n.attributes[t]=e}function Ix(n){return n==="image"||n==="drawio"||n==="plantuml"||n==="mermaid"||n==="flowchart"}function eL(n){return n&&n.startsWith("//")?`https:${n}`:n&&!n.startsWith("http://")&&!n.startsWith("https://")?`https://${n}`:n}function ttt(n){const t=On(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"&&Kg(n,"inline-style-font-size",s),o==="color"&&Kg(n,"inline-style-color",s),o==="background-color"&&Kg(n,"inline-style-background-color",s),o==="font-family"&&Kg(n,"inline-style-font-family",s)}}function ett(n,t){if(t==null)return n==null?void 0:n.normal;if(n)return n[`heading${t}`]}function ntt(n){const t=`${On(n,"inline-style-font-size")}`;if(t&&t.indexOf("px")>0)return+t.replace(/px/g,"")}function rtt(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 itt(n){if(n.attributes&&n.attributes.box&&n.attributes.text)return` @${n.attributes.text} `}function ott(n){return On(n,"inline-style-font-family")}function stt(n){const t=On(n,"inline-style-background-color");return ZS(t)}function ltt(n){const t=On(n,"inline-style-color");return ZS(t)}function att(n){ttt(n);const t=On(n,"type")==="mention";return{box:n.attributes&&n.attributes.box?n.attributes:void 0,inlineCode:!!On(n,"style-code"),link:eL(On(n,"link")),size:ntt(n),text:t?itt(n):rtt(n)||n.insert,bold:!!On(n,"style-bold"),underline:!!On(n,"style-underline"),italics:!!On(n,"style-italic"),strike:!!On(n,"style-strikethrough"),superScript:!!On(n,"style-super"),subScript:!!On(n,"style-sub"),math:On(n,"type")==="math"?On(n,"src"):void 0,mention:t,fontFamily:ott(n),background:stt(n),color:t?"338fe5":YZ(tL(n,"style-color-",6))||ltt(n),highlight:tL(n,"style-bg-color-",13)}}function ctt(){return[new yt.Paragraph({border:{top:{color:"auto",style:yt.BorderStyle.DASHED,size:4,space:1}},spacing:{before:300}}),new yt.Paragraph({spacing:{line:0}})]}function utt(){return new yt.Paragraph({children:[new yt.TextRun({text:"[\u89C6\u9891\u6682\u4E0D\u652F\u6301\u5BFC\u51FA]",shading:{type:yt.ShadingType.CLEAR,color:"FFFFFF",fill:"CCCCCC"}})]})}function ftt(){return new yt.Paragraph({children:[new yt.TextRun({text:"[\u97F3\u9891\u6682\u4E0D\u652F\u6301\u5BFC\u51FA]",shading:{type:yt.ShadingType.CLEAR,color:"FFFFFF",fill:"CCCCCC"}})]})}function dtt(n,t){return new yt.Paragraph({children:[new yt.ExternalHyperlink({children:[new yt.TextRun({style:"Hyperlink",text:t||n})],link:n})]})}function nL(n){if(n.heading!=null)return`Heading${n.heading}`}function rL(n){if(n.alignment!=null){if(n.alignment==="center")return yt.AlignmentType.CENTER;if(n.alignment==="right")return yt.AlignmentType.RIGHT;if(n.alignment==="left")return yt.AlignmentType.LEFT}}function htt(n){if(n.indent)return{left:yt.convertInchesToTwip(.3*n.indent-.2)};if(n.padding)return{left:yt.convertInchesToTwip(.3*n.padding)}}function mtt(n){return{type:yt.ShadingType.CLEAR,color:"FFFFFF",fill:n}}function gtt(n){const t=n.split(",");if(t.length!==0)return t[0].trim()}function iL(n,t){var o;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 n.text=(o=n.text)==null?void 0:o.replace(/\x00/g," "),new yt.TextRun({text:n.text,bold:n.bold||void 0,underline:n.underline?{type:yt.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?gtt(n.fontFamily):void 0,shading:n.background?mtt(n.background):void 0,color:n.color,highlight:QZ(n.highlight)})}function ptt(n,t){if(n.link)return n.link=n.link.replace(/\x00/g," "),new yt.ExternalHyperlink({children:[iL(n,t)],link:n.link})}async function oL(n,t,e,r,i){const[o]=await i(n,t,e);if(o==null)return;const s=await QS({width:r||0,height:0,src:e},o);return new yt.ImageRun({data:o,transformation:{width:(s==null?void 0:s.width)||100,height:(s==null?void 0:s.height)||20}})}function Ctt(n){if(n.heading||n.heading)return n.heading}function Ett(n){if(n.align&&(n.align==="center"||n.align==="right"||n.align==="left"))return n.align}function Att(n){if(n.textOnly===!0&&n.level!=null)return n.level}async function xtt(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(att(o))}return e}}function btt(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 vtt(n,t){if(n.type==="embed"&&n.embedType&&Ix(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 Btt(n){if(n.padding)return n.padding}function ytt(n){return!!(n.type==="embed"&&n.embedType&&Ix(n.embedType)&&n.embedData&&n.embedData.src)}async function Vg(n,t,e){return{quoted:!!n.quoted,heading:Ctt(n),alignment:Ett(n),indent:Att(n),padding:Btt(n),texts:await xtt(n,e),list:btt(n),images:vtt(n,t),border:ytt(n)}}async function Ttt(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 Vg(l,e,r));i.push(s)}return i}const ktt=D("to-docx"),$g=200;function Rtt(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 wtt(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 Stt(n){p(ktt,n.children,"no table children");const t=n.rows,e=n.cols,r=new Array(n.cols).fill($g).map((s,l)=>n.colsWidth[l]||s);if(r)for(let s=0;s<r.length;s++)r[s]===0&&(r[s]=$g);const i=Rtt(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=JZ(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 A=0;A<h;A++)E===0&&(C+=r?r[l+A]:80),!(E===0&&A===0)&&(i[s+E][l+A].from=[s,l]);i[s][l].width=C}}return wtt(n,t,e,i),i}async function Ltt(n,t,e,r,i,o,s,l,c,d){async function h(E){if(l&&E.type!=="_exportVirtualBlock"){const A=await l(i,o,E);if(A){await r.addDoc(n,A,d);return}}if(E.type==="text"||E.textOnly===!0){const A=await Vg(E,s,c);await r.addTextBlock(A);return}if(E.type==="code"){const A=await Ttt(E,e,s,c);await r.addCodeBlockObject(A);return}if(E.type==="list"&&E.textOnly!==!0){const A=await Vg(E,s,c);await r.addListBlockObject(n,A);return}if(E.type==="embed"&&E.embedType){const A=E,v=A.embedData,w=A.embedType;if(Ix(w)){const S=await Vg(E,s,c);await r.addImagesBlockObject(E,S,d)}else E.embedType==="hr"?r.addSeparatorBlock():E.embedType==="video"?r.addVideoPlaceholder():E.embedType==="audio"?r.addAudioPlaceholder():E.embedType==="webpage"?r.addHyperlinkParagraph(eL(v.src),v.title):r.addOtherEmbedBlock(w,E.embedData);return}if(E.type==="table"){let A=[];if(E.colsWidth)A=new Array(E.cols).fill($g).map((w,S)=>E.colsWidth[S]||w);else{const w=E.cols;A=new Array(w);for(let S=0;S<A.length;S++)A[S]=$g;E.colsWidth=A}const v=Stt(E);await r.addTableMatrix(A,v,e),r.addEmptyParagraph()}E.type==="_exportVirtualBlock"&&await r.addVirtualBlock(E.id,e,d)}function C(E){var w;const A=((w=E==null?void 0:E.embedData)==null?void 0:w.exportSpec)||(E==null?void 0:E.exportSpec);if(!A)return[E];const v=[];for(const{type:S,data:U}of A){if(S==="text"){const M={id:it(),text:[{insert:U}],type:"text"};v.push(M);continue}if(S==="image"){const M={id:it(),type:"embed",embedType:"image",align:"left",embedData:{src:U}};v.push(M);continue}if(S==="link"){const M={id:it(),type:"embed",embedType:"webpage",embedData:{src:U.url,title:U.title}};v.push(M);continue}if(S==="block")for(const M of U){if(!e.blocks[M])continue;const rt={id:M,type:"_exportVirtualBlock"};v.push(rt)}}return v}for(const E of t)for(const A of C(E))!A||await h(A)}function Itt(){return{listMaxInst:1,listInstMap:{},listRefMap:{},levelConfigs:[]}}const Dtt=D("to-docx");class _tt{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 yt.Paragraph({heading:nL(t),alignment:rL(t),children:await this.paragraphsFromBlockTexts(t),indent:htt(t)}))}async addEmptyImagePlaceHolder(){this.paragraphs.push(new yt.Paragraph({text:`[${_.t("docx.imageExportFailed")}]`,shading:{type:yt.ShadingType.CLEAR,color:"FFFFFF",fill:"CCCCCC"}}))}async paragraphsFromBlockTexts(t){if(t.texts==null)return;const e=ett(this.defaultFontSize,t.heading),r=[];for(const i of t.texts){if(i.link){const o=ptt(i,e);o&&r.push(o);continue}if(i.box&&i.box.type&&i.box.type==="br"){r.push(new yt.TextRun({text:"",break:1}));continue}if(i.box&&i.box.type&&i.box.type==="image"){const o=await oL(this.appId,this.docId,i.box.src,i.box.width,this.readImageFunc);o&&r.push(o);continue}if(i.math){const o=await oL(this.appId,this.docId,i.math,0,this.readImageFunc);o&&r.push(o);continue}r.push(iL(i,e))}return r}async addCodeBlockObject(t){for(const e of t)for(const r of e){const i={style:yt.BorderStyle.SINGLE,color:"#DEDEDE"};this.paragraphs.push(new yt.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=JS([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]=ch.NUMBERING:e.list.checkbox&&e.list.checkbox==="checked"?this.state.listRefMap[i]=ch.CHECKED:e.list.checkbox&&e.list.checkbox==="unchecked"?this.state.listRefMap[i]=ch.UNCHECKED:this.state.listRefMap[i]=ch.BULLET;const o=nL(e);e.texts&&this.paragraphs.push(new yt.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 yt.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,h]=await this.readImageFunc(this.appId,this.docId,c.src);if(d){const C=await QS(c,d);if(C)return C}i.push(h)}));zZ(o,r,t.embedData);const s=jZ(o,r),l={style:yt.BorderStyle.SINGLE,color:"#DEDEDE"};s.length&&this.paragraphs.push(new yt.Paragraph({border:e.border?{left:{...l},right:{...l},top:{...l},bottom:{...l}}:void 0,alignment:rL(e)||yt.AlignmentType.CENTER,children:s.map(c=>this.imageDimWithBufferToImageRun(c)).flatMap((c,d,h)=>c==null?[]:h.length-1!==d?[c,new yt.TextRun({text:" "})]:c)})),i.forEach(c=>{this.addHyperlinkParagraph(c)})}addSeparatorBlock(){ctt().forEach(t=>this.paragraphs.push(t))}addEmptyParagraph(){this.paragraphs.push(new yt.Paragraph(""))}addVideoPlaceholder(){this.paragraphs.push(utt())}addAudioPlaceholder(){this.paragraphs.push(ftt())}addHyperlinkParagraph(t,e){t!=null&&this.paragraphs.push(dtt(t,e))}async addTableMatrix(t,e,r){const i=t.map(o=>o!==0?o*15:1500);this.paragraphs.push(new yt.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 yt.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:yt.WidthType.DXA,size:i.width*15},shading:i.color?{fill:i.color,type:yt.ShadingType.CLEAR,color:"auto"}:void 0}))}return r}async generateTableRows(t,e){const r=[];for(const i of t)r.push(new yt.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 addVirtualBlock(t,e,r){const i=await this.convertBlocksFunc(t,e.blocks[t],e,this.appId,this.docId,this.state,r);this.paragraphs.push(...i)}async addOtherEmbedBlock(){}}class Mtt{constructor(t,e,r,i,o,s,l,c){m(this,"convertBlocks",async(t,e,r,i,o,s,l=720)=>{const c=new _tt(i,o,s,this.readImage,this.convertBlocks,this.defaultFontSize);return await Ltt(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 yt.ImportDotx,o=this.templateData?await i.extract(this.templateData):void 0,s=t.blocks.root;p(Dtt,s,"data must have blocks");const l=Itt(),c=await this.convertBlocks("blocks",s,t,e,r,l),d=this.backgroundImageOptions?{default:new yt.Header({children:[new yt.Paragraph({children:[new yt.ImageRun(this.backgroundImageOptions)]})]})}:{},h=new yt.Document({numbering:{config:[...XZ,...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 yt.Packer.toBlob(h)}}const Utt=D("editor-to-docx");async function Ott(n,t,e,r){const i=n.doc.buildResourceUrl(r,{withToken:!0});let o=await vS(i);if(!o)return[void 0,i];if(o.type.indexOf("/svg")!==-1){const l=await AS(o);l&&(o=new File([l],o.name))}return[await o.arrayBuffer(),i]}async function Ntt(n,t,e){const r=n.editorBlocks.getBlockClass(e.type);if(r.toStandardDoc)try{return await r.toStandardDoc(n,e,t)}catch(i){Utt.error(`toStandardDoc error: ${JSON.stringify(i)}`);return}}async function Ptt(n,t){const e=t.attributes,r=n.editorBoxes.getBoxClass(e.type);if(r.toStandardText)return r.toStandardText(n,e)}async function Ftt(n,t){let{template:e,download:r,backgroundImageOptions:i}=t!=null?t:{};e||(e=VZ());const o=n.doc.toJSON(),s=(C,E,A)=>Ott(n,C,E,A),l=async(C,E,A)=>Ntt(n,o,A),c=async C=>Ptt(n,C),h=await new Mtt(e,o,nm.default,s,void 0,l,c,i).convert("_appId","_docId");if(r){const C=URL.createObjectURL(h),E=document.createElement("a");E.setAttribute("download",`${bS(n)}.docx`),E.setAttribute("href",`${C}`),E.click(),E.remove()}return h}const Dx=D("create-editor");async function Ktt(n,t){var s,l,c,d,h,C,E,A,v,w,S,U,M,V,rt,Y;p(Dx,n,"app does not exists"),t.lang&&_.setLang(t.lang),Br.level=(s=t.logLevel)!=null?s:Gi.DEBUG;const e=t.onReauth?async()=>{var ct;const X=t.user.userId,ft=t.docId,pt=await((ct=t.onReauth)==null?void 0:ct.call(t,X,ft,t.permission));return{userId:X,docId:ft,permission:t.permission,appId:t.appId,token:pt,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,onMaxUsersError:t.onMaxUsersError},i=await md.load(r),o=td(n,i,{id:t.id,scrollContainer:t==null?void 0:t.scrollContainer,enableComments:t==null?void 0:t.enableComments,enableContextMenu:t==null?void 0:t.enableContextMenu,components:{blocks:[...WS,...((l=t==null?void 0:t.components)==null?void 0:l.blocks)||[]],embeds:[...Lx,...((c=t.components)==null?void 0:c.embeds)||[]],boxes:[...qS,...((d=t.components)==null?void 0:d.boxes)||[]],commandProviders:[new F0,...((h=t.components)==null?void 0:h.commandProviders)||[]],decorators:[new dg,new XC],insertions:[q1],blockHooks:[new MA,new fw,...((C=t.components)==null?void 0:C.blockHooks)||[]],textRenders:[new L4,new XE,...((E=t.components)==null?void 0:E.textRenders)||[]],options:{...t.componentsOptions}},shortcuts:[Gq,AH,Iz,hA,n4,kF,lA,LX,s0,AF,...t.shortcuts||[]],colors:["#0064FF","#EB3723","#F59300","#00A865","#F25A0A","#70A310","#009CAD","#0990D9","#8851ED","#D62069"]});if(o.editorCommandProviders.registerCommandProvider(new po(o)),o.input.addHandler(new AY),o.input.addHandler(new mg),o.input.addHandler(new XK),o.input.addHandler(new Bz),o.input.addHandler(new vA(o,{hideTitle:t.hideTitle,headingLevel:1,titlePlaceholder:_.t("placeholder.common.title"),contentPlaceholder:_.t("placeholder.common.content"),readonlyTitlePlaceholder:_.t("placeholder.common.readonlyTitle"),addPlaceholderToAllCurrentEmptyBlock:!0,applyContentPlaceholder:(A=t.placeholder)==null?void 0:A.applyContentPlaceholder})),o.input.addHandler(new sg(o,(v=t.componentsOptions)==null?void 0:v.quickMenu)),o.input.addHandler(new KA(o)),o.input.addHandler(new WA(o)),o.input.addHandler(new Eg),o.input.addHandler(new Uk),o.doc.registerCallback(new xY(o)),o.addCustom("remote-cursor",()=>new mT(o)),o.addCustom("block-menu",X=>new mw(X)),de.isMobile||o.addCustom("editor-tooltip",()=>new Ld(o)),t!=null&&t.enableComments&&o.addCustom("editor-comments",X=>new S4(X,new UZ(X))),t.enableContextMenu!==!1&&o.addCustom("editor-context-menu",X=>new YA(X)),o.addCustom("create-options",()=>new Ub(o,t)),o.addCustom("drop-target",()=>new qd(o)),o.addCustom("list-to-mindmap",()=>new tg(o)),o.addCustom("list-to-mention",()=>new VY(o)),o.addCustom("mobile-helper",()=>new uQ(o)),o.addCustom("code-caret",()=>new gH(o)),o.addCustom("image-paste-handler",()=>new FA(o)),(w=t.componentsOptions)!=null&&w.mention){const X=t.componentsOptions.mention;o.addCustom("mention",()=>new mS(o,X))}if(o.addCustom("heading-collapse",()=>new mx(o)),o.addCustom(lh,X=>new bx(X)),bu.register(o),qd.register(o),Dl.register(o),kl.register(o),o.addListener("clickLink",(X,ft,pt)=>{var wt;if((wt=t==null?void 0:t.events)!=null&&wt.onClickLink){t.events.onClickLink(X,ft,pt);return}const ct=pt.getAttribute("link");ct&&(X.readonly||ft.ctrlKey||ft.metaKey)&&window.open(ct,"_blank")}),(U=(S=t.componentsOptions)==null?void 0:S.remoteCarets)!=null&&U.onUserChanged){const X=(V=(M=t.componentsOptions)==null?void 0:M.remoteCarets)==null?void 0:V.onUserChanged;o.doc.getRemoteUsers().on("change",ft=>{X(o,ft)})}return(Y=(rt=t.componentsOptions)==null?void 0:rt.templates)!=null&&Y.templates.length&&(o.addListener("docChanged",()=>{Pg(o)}),o.addListener("resize",()=>{Pg(o,{reset:!0})}),setTimeout(()=>{Pg(o)},100)),o.doc.registerCallback({onError:async X=>{if(X.code==="ResetDoc"){Dx.error(`reset doc: ${X.message}`);const ft=await md.load(r);o.doc.reset(ft)}}}),o.version="1.1.34",Br.level===Gi.DEBUG&&(window.setReauthFail=X=>{window.isReauthError=X},window.reConnect=X=>o.doc.externalDoc.client.connection.reConnect(X)),o}function Vtt(n){return n.toJSON!==void 0}async function $tt(n,t,e){var o,s,l,c,d,h,C,E;p(Dx,n,"app does not exists");const r=Vtt(t)?t:new RC(t,{serverUrl:e.serverUrl||""});e.lang&&_.setLang(e.lang),Br.level=(o=e.logLevel)!=null?o:Gi.DEBUG;const i=td(n,r,{id:e.id,scrollContainer:e==null?void 0:e.scrollContainer,components:{blocks:[dA,xA,bA,Ok,...(l=(s=e.components)==null?void 0:s.blocks)!=null?l:[]],commandProviders:[new F0],decorators:[new dg,new XC],embeds:[...Lx,...((c=e.components)==null?void 0:c.embeds)||[]],boxes:[qk,gS,P4,...((d=e.components)==null?void 0:d.boxes)||[]],insertions:[q1],blockHooks:[new MA,...((h=e.components)==null?void 0:h.blockHooks)||[]],textRenders:[new L4,new XE,...((C=e.components)==null?void 0:C.textRenders)||[]],options:{...e.componentsOptions}},shortcuts:[hA,n4,lA,s0]});return i.editorCommandProviders.registerCommandProvider(new po(i)),i.input.addHandler(new mg),i.input.addHandler(new vA(i,{hideTitle:e.hideTitle,headingLevel:1,titlePlaceholder:_.t("placeholder.common.title"),contentPlaceholder:_.t("placeholder.common.content"),readonlyTitlePlaceholder:_.t("placeholder.local.readonlyTitle"),addPlaceholderToAllCurrentEmptyBlock:!0})),i.input.addHandler(new sg(i,(E=e.componentsOptions)==null?void 0:E.quickMenu)),i.input.addHandler(new KA(i)),i.input.addHandler(new WA(i)),i.input.addHandler(new Eg),i.input.addHandler(new Uk),i.addCustom("block-menu",A=>new mw(A)),de.isMobile||i.addCustom("editor-tooltip",()=>new Ld(i)),i.addCustom("image-paste-handler",()=>new FA(i)),e!=null&&e.enableComments&&i.addCustom("editor-comments",A=>new S4(A,new OZ(A,r))),e.enableContextMenu!==!1&&i.addCustom("editor-context-menu",A=>new YA(A)),i.addCustom("heading-collapse",()=>new mx(i)),i.addListener("clickLink",(A,v,w)=>{var U;if((U=e==null?void 0:e.events)!=null&&U.onClickLink){e.events.onClickLink(A,v,w);return}const S=w.getAttribute("link");S&&(A.readonly||v.ctrlKey||v.metaKey)&&window.open(S,"_blank")}),i.addCustom(lh,A=>new bx(A)),bu.register(i),i.version="1.1.34",i}async function Htt(n,t,e){var h;const r=n.doc.externalDoc.client.auth,i=await E0.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 XS(l),d=n.addCustom("version-dialog",()=>new tS(i,c));return d.show(t),d}b.tippy=g9,b.AnchorBox=DB,b.AuthError=dd,b.AuthHeader=va,b.AutoScroll=bm,b.BaseURLHeader=nu,b.BasicCommands=CK,b.BlockExclusiveHook=fw,b.BlockLockerHook=MA,b.BlockLockerPasteHandler=Eg,b.BlockResizer=Pd,b.BrBox=wB,b.CodeBlock=xA,b.CodeLineBlock=bA,b.CodeTextDecorator=dg,b.DOC_RE_AUTH_KEYS=lh,b.DefaultShortcuts=s0,b.DocIdError=sO,b.DocReAuthCallbacks=bx,b.DragDrop=Zb,b.DrawioEmbed=OS,b.EditorBlocks=f3,b.EditorBoxes=LB,b.EditorCommandProviders=wy,b.EditorComplexBlockPosition=xi,b.EditorComplexSelectionRange=Ji,b.EditorDecorators=OB,b.EditorEmbeds=h3,b.EditorInsertions=UB,b.EditorSimpleBlockPosition=Cn,b.EditorSimpleSelectionRange=yn,b.EmbedBlock=g3,b.EmbedBlockResizer=nh,b.EnforceWithDocumentTitleHandler=vA,b.EventCallbacks=Lc,b.FILL_CHAR=I8,b.FileExtError=lO,b.GroupOrder=Kk,b.HeadingBlockScrollListener=MY,b.ImageBox=IB,b.InlineBoxCommandProvider=tR,b.InputtingInsertion=_B,b.LocalDoc=RC,b.LogLevel=Gi,b.Logger=Br,b.MIN_DISTANCE_THRESHOLD=Qb,b.ManualCloseDialog=pd,b.ManualMenu=hl,b.ManualToolbar=gd,b.MarkdownInputHandler=mg,b.MaxUserError=KC,b.Mindmap=Z0,b.OnesEditorAutoSuggest=pE,b.OnesEditorCustomDataWrapper=Ub,b.OnesEditorExclusiveBlock=kl,b.OnesEditorHoveringBlock=je,b.OnesEditorIcons=GO,b.OnesEditorQuickMenu=sg,b.OnesEditorToc=sh,b.OnesEditorTocProvider=Dl,b.OnesEditorToolbar=bu,b.OnesEditorTooltip=Ld,b.OnesEditorVersionsDialog=tS,b.PermissionError=C0,b.Popup=su,b.ReAuthToolbar=BS,b.RemoteCarets=mT,b.RemoteCaretsDecorator=XC,b.RemoteCaretsInsertion=q1,b.RemoteUsers=ed,b.RequestReloadError=hd,b.RichText=zn,b.ShareDBDoc=md,b.ShareDBDocVersionsProvider=XS,b.ShareDBServer=E0,b.SimpleCache=Hb,b.StandardEmbedBlockCommands=sx,b.TEXT_STYLE_BACKGROUND_COLOR_PREFIX=R1,b.TEXT_STYLE_COLOR_PREFIX=k1,b.TableBlock=dA,b.TableBlockCommandProvider=F0,b.TableShortcuts=hA,b.TextBlock=ur,b.TextBox=RB,b.TextColorItem=D2,b.TextStyleShortcuts=lA,b.TocEmbed=dS,b.ZERO_WIDTH_SPACE_CHAR=_c,b.abbreviation=vm,b.addAttribute=Im,b.addClass=q,b.addCommentToBlock=eh,b.addDays=TI,b.addMetaToDoc=Jf,b.addMonths=yI,b.animateScrollTo=oa,b.applyPlaceholderToBlock=Od,b.assert=p,b.autoShowHideTemplates=Pg,b.bindKeyDownEvent=hm,b.blockToDoc=bC,b.blockToHtml=Q1,b.blockToMarkdown=Wm,b.blockToText=Gm,b.blocksToDoc=Q5,b.clearAllSelection=zv,b.clientType=de,b.cloneBlock=sl,b.cloneChildContainer=lC,b.cloneDoc=aC,b.cloneText=EB,b.commentToShareDbComment=qC,b.compareElement=um,b.comparePosition=E1,b.complexBlockAdjustSelectionPos=wm,b.complexBlockFindNearestChildBlock=B7,b.complexBlockGetAllChildContainers=_n,b.complexBlockGetBottomChildContainers=A3,b.complexBlockGetDeepFirstChild=p3,b.complexBlockGetFirstSimpleChild=x1,b.complexBlockGetLastSimpleChild=Fc,b.complexBlockGetSelectedContainers=Pc,b.complexBlockGetTopChildContainers=E3,b.containerToDoc=J5,b.continuousScroll=pv,b.convertBlockFrom=km,b.convertImageFileToPng=AS,b.convertImageSrcToPng=rQ,b.converterIntercept=hg,b.copyBlockAttributes=XB,b.copyResourcesFromDoc=kC,b.createBlockAnchor=jo,b.createBlockCaretAnchor=b3,b.createBlockContentElement=da,b.createBlockElement=Pv,b.createBlockSimpleDocRange=Vm,b.createBlockSimpleRange=Ie,b.createBoxContentElement=Vv,b.createBoxElement=Fv,b.createBoxOp=CB,b.createChildContainer=c3,b.createComplexBlockPosition=Ue,b.createComplexDocPos=BB,b.createComplexDocRange=M8,b.createContainer=xB,b.createContainerElement=n1,b.createDeleteOps=hB,b.createEditor=td,b.createEditorSelectionRange=En,b.createElement=B,b.createEmptyContainer=Yo,b.createEmptyDoc=Xo,b.createEmptyTextBlockData=Fm,b.createExpandedRange=am,b.createIconButton=na,b.createImage=Mp,b.createInsertOps=Nm,b.createInsertionContentElement=jv,b.createInsertionElement=$v,b.createLocalEditor=$tt,b.createOnesEditor=Ktt,b.createRange=jb,b.createRichText=Ea,b.createRootContainer=a3,b.createSimpleBlockPosition=mt,b.createSimpleDocPos=vB,b.createTextBlockData=no,b.createTextButton=Sa,b.createTextOp=Xr,b.createTextWithReplaceSoftReturn=F1,b.daysAfter=Xp,b.deleteText=V1,b.diffDays=kI,b.disablePageScroll=zp,b.docToHtml=jB,b.docToHtmlFragment=zf,b.docToMarkdown=zB,b.docToText=ol,b.downloadImageToFile=vS,b.downloadObjectToFile=yx,b.downloadSvgToString=RS,b.editLink=kd,b.editorAddComment=Nq,b.editorAddTextAttribute=s5,b.editorAutoInsertBlock=YB,b.editorBreakTextBlock=Xc,b.editorClearCompositionText=eC,b.editorClearSelectedContents=Jm,b.editorCopyBlock=yC,b.editorCopyDoc=o0,b.editorDeleteBlock=iC,b.editorDeleteBlockText=nC,b.editorDeleteBlockWithoutChildren=Ym,b.editorDeleteChildContainer=I_,b.editorDeleteChildContainers=QB,b.editorFocusToBlock=sC,b.editorFocusToEnd=Y_,b.editorGetBlockData=Qo,b.editorGetBlockText=Jn,b.editorGetBlockTextEx=Hm,b.editorGetBoxData=TB,b.editorHandleKeyboardEvent=uy,b.editorInsertBlock=qc,b.editorInsertBoxToBlock=WB,b.editorInsertDoc=i5,b.editorInsertDocAt=cC,b.editorInsertText=tC,b.editorInsertTextToBlock=GB,b.editorInsertTextToBlockEx=Z1,b.editorMergeTextBlock=JB,b.editorMoveDown=A5,b.editorMoveEnd=pC,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=T5,b.editorRangeClearColor=a5,b.editorRangeGetColor=c5,b.editorRangeSetColor=l5,b.editorRemoveTextAttribute=U_,b.editorReplaceBlockText=Zm,b.editorReplaceContainer=o5,b.editorRunOnce=wC,b.editorSelectAll=EC,b.editorSelectContainer=n0,b.editorSelectDown=x5,b.editorSelectEnd=CC,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=Yc,b.editorShowFindDialog=wW,b.editorToDocx=Ftt,b.editorUpdateBlockData=t0,b.editorUpdateCompositionText=qB,b.editorUpdateEmbedData=n5,b.enablePageScroll=Gp,b.escapeHtmlText=mm,b.escapeRegExp=Zp,b.escapeSpace=sI,b.exclusiveBlock=IA,b.executeBlockCommand=t3,b.executeEmbedBlockCommand=Zv,b.executeRangeCommand=Ry,b.fileToDataUrl=Mc,b.findAfterOffsetNotType=z1,b.findAllText=AC,b.findBlockByIndex=Lv,b.findEventTargetBlock=Wb,b.findInsertionById=Hv,b.findNextOffset=t_,b.findNextVisibleSimpleBlock=Dy,b.findPrevOffset=Z8,b.findPrevOffsetNotType=j1,b.findPrevSimpleBlockBeforeChildContainer=C3,b.findPrevVisibleSimpleBlock=Iy,b.findTarget=Dc,b.findWordEnd=W1,b.findWordLeft=G1,b.format=Rf,b.formatBytes=Cv,b.formatDate=Qp,b.fragmentToHtml=uv,b.fromBase64=Bf,b.fromBase64ToBlob=Hp,b.fromBase64ToUint8Array=CI,b.fromDocRange=nl,b.fromNowString=Jp,b.genId=it,b.generateEditorContainerId=e1,b.getAllChildBlocks=y1,b.getAllQuickMenuItems=sA,b.getAllSelectedBlocks=Zi,b.getAttributesAt=Hc,b.getBlockBackground=o1,b.getBlockByIndex=Js,b.getBlockCaretRect=tl,b.getBlockClass=le,b.getBlockClassByType=ca,b.getBlockClientRects=Vo,b.getBlockCommandsWithHook=d1,b.getBlockContent=zt,b.getBlockHeading=Df,b.getBlockId=dt,b.getBlockIndex=Rt,b.getBlockInfo=Hd,b.getBlockKind=Ei,b.getBlockMinWidth=Wv,b.getBlockNearestRangeFromPoint=v1,b.getBlockOptions=FI,b.getBlockPath=el,b.getBlockProperties=Yv,b.getBlockRangeFromPoint=Sm,b.getBlockStyles=PI,b.getBlockTextLength=At,b.getBlockTools=ve,b.getBlockType=Ot,b.getBoxContent=l1,b.getBoxId=Kv,b.getBoxTypeFromElement=If,b.getChildBlockCount=Xi,b.getChildBlocks=ke,b.getChildOffset=rl,b.getColorFromAttributes=S1,b.getColorFromContent=Bm,b.getComplexBlockClass=jr,b.getContainerBlockPath=o3,b.getContainerBlocks=wv,b.getContainerBlocksElement=Sf,b.getContainerById=Ci,b.getContainerId=Et,b.getContainerMinWidth=p1,b.getContainerToolsElement=UI,b.getContainerWidth=u3,b.getDistanceSquare=Ys,b.getElementFromPoint=Fe,b.getElementOffset=bf,b.getElementScale=Hr,b.getEmbedType=ln,b.getExistsBlockTools=ym,b.getExistsContainerById=wf,b.getFileExt=kf,b.getFirstChildBlock=Me,b.getFirstClientRect=cm,b.getHeadingBlockChildren=Nc,b.getHeadingMenuOptions=nA,b.getHorizontalPadding=Op,b.getInsertionContent=a1,b.getLastChildBlock=We,b.getLastClientRect=ra,b.getListAllNextBrothers=pu,b.getLogger=D,b.getNextBlock=ae,b.getNextHiddenBlocks=r3,b.getNextValidOffset=pa,b.getNextVisibleBlock=Gr,b.getOffsetFromPoint=Up,b.getOffsetInfoAfter=$f,b.getOffsetInfoBefore=jm,b.getOpAt=W3,b.getOpLength=Lm,b.getParentBlock=et,b.getParentBlockExcludeSelf=fa,b.getParentBox=s1,b.getParentContainer=at,b.getPrevBlock=ze,b.getPrevValidOffset=il,b.getPrevVisibleBlock=zr,b.getRangeCommands=Ty,b.getReferenceClientRect=fk,b.getRootBlock=f1,b.getScrollContainer=pn,b.getSpecialBlockCommands=Qv,b.getStandardEmbedBlockProperties=lx,b.getTextAfterOffset=Q8,b.getTextAttributes=J1,b.getTextBeforeOffset=J8,b.getTextBlockChild=Uf,b.getTextBlockClass=Dv,b.getTextBlockContentChildTextLength=qr,b.getTextBlockContentChildType=i3,b.getTextBlockContentChildren=Qi,b.getTextLength=jn,b.getTextOpLength=T1,b.getTextWidth=Em,b.getToolbar=G0,b.handleBlockElementUpdated=qv,b.hasAltOnly=dI,b.hasClass=Mt,b.hasCtrlOrCmd=ov,b.hasCtrlOrCmdOnly=fI,b.hashCode=yv,b.hideBlock=Nv,b.hideTemplates=ES,b.htmlToFragment=Cm,b.i18n=_,b.includeBigTable=vN,b.injectDocToHtmlFragment=Qf,b.injectStyle=Yb,b.inputActions=pM,b.insertEmptyBlock=$I,b.insertEmptyEmbedBlock=h1,b.insertText=qo,b.intersectionCommands=XM,b.isBackspace=lv,b.isBlock=ua,b.isBlockLocked=Cg,b.isBlockLockedByOthers=_A,b.isBlockLockedBySelf=jd,b.isBlockTools=Ov,b.isBox=Tm,b.isBoxOp=zo,b.isCJK=rv,b.isChildContainer=pi,b.isChildNode=Ae,b.isCodeBlock=Di,b.isCollapsedHeadingBlock=Yi,b.isCollapsedRange=_8,b.isComplexBlockPosition=ma,b.isComplexKindBlock=Pt,b.isContainer=Qs,b.isContainerSelectedAllChildBlocks=W5,b.isControlEvent=la,b.isDelete=mI,b.isDraggingFiles=Am,b.isElementVisible=dm,b.isEmbedBlock=Le,b.isEmptyContainer=Of,b.isEmptyDoc=$1,b.isEmptyTextBlock=Be,b.isEmptyTextBlockWithoutCompositionText=Ud,b.isEnterOnly=sv,b.isEscape=pm,b.isExclusiveBlock=$d,b.isExpandedHeadingBlock=n3,b.isFirefox=Af,b.isFirstChildBlockInComplexBlock=v7,b.isHeadingBlock=Dn,b.isHighSurrogate=nI,b.isInBlock=c1,b.isInBlockTools=Oc,b.isLetter=nv,b.isLowSurrogate=rI,b.isMatchShortcut=Wi,b.isMoveForward=cI,b.isNavigationEvent=aI,b.isNavigationKey=iv,b.isNodeRemoved=xf,b.isNumber=ev,b.isPrintableKey=Vp,b.isRootBlock=Wr,b.isRootContainer=ie,b.isSafari=ea,b.isSameDay=Yp,b.isSelectBoxOnly=ei,b.isShiftEnter=hI,b.isShiftTab=pI,b.isShortcutEvent=uI,b.isSimpleBlock=NI,b.isSimpleBlockPosition=bi,b.isSimplePos=bB,b.isSimpleRange=Km,b.isSpace=gm,b.isTab=gI,b.isTextBlockContentBoxChild=yr,b.isTextBlockContentChild=_f,b.isTextBlockContentInsertionChild=Ho,b.isTextBlockContentTextChild=Mf,b.isTextKindBlock=st,b.isTextKindBlockType=Lf,b.isTitleBlock=Ko,b.isToday=Ev,b.isValidOffset=cr,b.isVisibleBlock=Zs,b.isYesterday=Av,b.loadJs=Gb,b.loadJsPromise=ia,b.lockers=gi,b.md5=kv,b.mergeCommands=z0,b.mergeDocs=Aa,b.mergeOps=K1,b.mergeText=S8,b.multiSplitText=X3,b.overflowText=xv,b.parseShortcut=av,b.patchNode=yf,b.pointInRect=sa,b.rangeAddAttribute=Ff,b.rangeGetTextColor=nB,b.rangeRemoveAttribute=$c,b.rangeSetTextColor=Z3,b.rangeTransformText=Q3,b.registerDragDrop=Fp,b.removeAttribute=w1,b.removeClass=ut,b.removeLastBr=T8,b.removePlaceholderFromBlock=OR,b.removeStyle=Xb,b.replaceAll=RI,b.replaceAllCaseInsensitive=wI,b.replaceAllText=X5,b.replaceText=Pm,b.requestDownload=xm,b.resetListStart=Eu,b.scrollIntoView=jf,b.scrollable=gv,b.selectFile=Uc,b.selectedBlockToDoc=r0,b.selectionToDoc=Qc,b.setAttributes=fm,b.setClipboardData=Tf,b.setClipboardDataByEvent=xI,b.setColorToAttributes=tB,b.setDataset=Np,b.setDefaultCursor=vf,b.setStyles=Pp,b.shareDBCommentToDocObject=WC,b.shareDBDocCommentToComment=dT,b.shortcutToDisplayText=gn,b.showBlock=i1,b.showDocVersions=Htt,b.showTemplates=Ax,b.splitText=ar,b.splitToThree=an,b.stringToDataUrl=jp,b.stringToObjectUrl=Wp,b.subText=Y3,b.textNodeOffsetFromPoint=zb,b.titleFromEditor=bS,b.toBase64URL=qi,b.toMindmap=J0,b.toPlainText=Re,b.toPlainTextKeepLength=H1,b.trimChar=Kp,b.unexclusiveBlock=DA,b.unicodeLength=iI,b.unicodeSubstr=oI,b.updateBlockSelection=Gv,b.updateOpAttributes=AB,b.updateTextBlockContent=Y8,b.updateUrl=$p;for(const n in He)n!=="default"&&!b.hasOwnProperty(n)&&Object.defineProperty(b,n,{enumerable:!0,get:()=>He[n]});Object.defineProperties(b,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
963
|
+
\`\`\`\`\`\``}return""}const iZ={embedType:"plantuml",convertFrom:eZ,handleUpdateBlock:tZ,createEmbedContent:ZJ,getBlockProperties:nZ,convertTo:rZ},uct="",oZ="hr",sZ={dividingLine:{type:"\u5206\u5272\u7EBF",abstract:"\u5206\u5272\u7EBF"}},lZ={dividingLine:{type:"Dividing-Line",abstract:"Dividing-Line"}},aZ={dividingLine:{type:"\u533A\u5207\u308A\u7DDA",abstract:"\u533A\u5207\u308A\u7DDA"}};_.mergeLang({"zh-CN":sZ,"en-US":lZ,"ja-JP":aZ});function cZ(n,t){const e=B("div",["editor-embed-container"],t);B("hr",["editor-embed-hr"],e)}function uZ(n,t,e,r){return r==="html"?"<hr />":r==="markdown"?"---":"------------"}function fZ(){return{name:"hr",insertEmbedCommandItems:[{id:"insert-hr",name:_.t("dividingLine.type"),icon:qT,order:500,group:"common",subText:tr("insert-hr")}],handleInsertEmptyEmbed:async(n,t)=>{const{containerId:e,blockIndex:r}=t;return n.insertEmbed(e,r,oZ,{})}}}function dZ(n,t,e){const{data:r}=e;if(!r||r.embedType!=="dividing-line"||!st(n,t))return null;const i={};return{blockData:{id:it(),type:"embed",embedType:"hr",embedData:i}}}function hZ(){return{abstract:_.t("dividingLine.abstract")}}const mZ={embedType:"hr",createEmbedContent:cZ,convertTo:uZ,getOptions:fZ,convertFrom:dZ,getBlockProperties:hZ},fct="",dct="",gZ={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"}}},pZ={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"}}},CZ={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"}}};_.mergeLang({"zh-CN":gZ,"en-US":pZ,"ja-JP":CZ});var Ui=(n=>(n.AUDIO="audio",n.VIDEO="video",n))(Ui||{}),ah=(n=>(n.Empty="empty",n.Progress="progress",n.Error="error",n))(ah||{});const VS=10*1024*1024,EZ=["wav","mp3","aac","ogg","webm","flac"],AZ=["ogg","mp4","webm"],xZ=()=>{};function $S(n){var h,C,E,A,v,w;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:EZ,s=(E=e==null?void 0:e.video)!=null?E:AZ,l=(A=r==null?void 0:r.audio)!=null?A:VS,c=(v=r==null?void 0:r.video)!=null?v:VS,d=(w=i==null?void 0:i.onError)!=null?w:xZ;return{allowedMedias:{audio:o,video:s},maxSize:{audio:l,video:c},callbacks:{onError:d}}}function bZ(n,t){const e=o=>o.map(s=>`.${s}`).join(","),{allowedMedias:r}=$S(n),i=r[t];return i?e(i):"*"}function vZ(n,t,e){const{maxSize:r,callbacks:i,allowedMedias:o}=$S(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=kf(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 BZ(n){return n===ah.Empty||n===ah.Error}const xn=D("media");class yZ extends He.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=et(r.target);if(!o||!o.contains(this.mediaContainer))return;const s=this.renderError();this.updateMediaContent(s),this.emit("mediaError",e,"load_error",dt(o))});m(this,"handleUploadFile",async e=>{p(xn,this.abstract,"no abstract"),p(xn,this.mediaContainer,"The media element not exist");const{editor:r}=this.options,i=et(this.mediaContainer);p(xn,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){xn.error(s),this.emit("mediaError",r,"upload_error",o.id),this.renderRetry(e,s)}ut(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(xn,this.mediaContainer,"The media element not exist"),this.mediaContainer.innerHTML="",this.mediaContainer.append(e)}renderError(){p(xn,this.abstract,"no abstract");const{editor:e,createMediaElement:r}=this.options,{mediaIcon:i,mediaName:o}=this.abstract;p(xn,this.mediaContainer,"The media element not exist");const s=et(this.mediaContainer);p(xn,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=_.t("media.load.failed",{name:o}),c.appendChild(h);const C=h.querySelector(".retry-upload");return p(xn,C,"The element not exist"),e.domEvents.addEventListener(C,"click",(E,A)=>{const v=B("div",["media-element"],null),w=this.getResourceUrl(l),S=r(E,v,l,w);this.unbindMediaEvent(),this.media=S,this.bindMediaEvent(),this.updateMediaContent(v)}),this.setFullScreen(),c}renderRetry(e,r){var E,A;p(xn,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=_.t("media.upload.failed",{name:s});(((E=r.response)==null?void 0:E.status)===420||((A=r.response)==null?void 0:A.status)===413)&&(h=_.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(xn,this.abstract,"no abstract"),this.handleUploadFile(e))}),this.updateMediaContent(l),this.setFullScreen()}renderProgress(e,r){p(xn,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=et(this.mediaContainer);p(xn,l,"The element not exist"),q(l,"media-block-uploading");const c=B("div",["media-progress"],null);s(c,o,r),this.updateMediaContent(c)}this.setFullScreen()}renderMediaElement(e,r){p(xn,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(xn,this.abstract,"no abstract"),p(xn,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=et(r);if(C&&!o.readonly&&o.isBlockWritable(C)){const E=xt.default(e);E.embedData.src=s,o.updateBlockData(C,E)}}}})}setFullScreen(){p(xn,this.mediaContainer,"The media element not exist"),q(this.mediaContainer,"full-screen")}removeFullScreen(){p(xn,this.mediaContainer,"The media element not exist"),ut(this.mediaContainer,"full-screen")}updateBlockAlign(e,r){const i=et(r);p(xn,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),BZ(i)?i===ah.Empty&&this.renderEmpty(e):this.renderMediaElement(e,r)}setAbstract(e){this.abstract=e}}D("media-embed");const TZ="left";class HS{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=bZ(t,this.embedType);if(o=o!=null?o:await Uc(s,{}),!o)return null;const{mediaType:l}=this.getAbstract();try{vZ(o,t,l)}catch{return null}const c={id:it(),type:"embed",embedType:this.embedType,embedData:{src:ah.Empty}};l==="video"&&(c.align=TZ);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 yZ({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:tr(`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=zt(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 jS(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 zS(n,t){const e=n.querySelector(".uploading-progress-bar-value");e&&(e.style.width=`${t}%`)}const kZ=D("media-audio");class RZ extends HS{constructor(){super(...arguments);m(this,"embedType",Ui.AUDIO);m(this,"updateProgressElement",zS);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:zT,mediaName:_.t(`media.${Ui.AUDIO}.menuItem`),menuItem:_.t(`media.${Ui.AUDIO}.menuItem`),order:800,mediaType:Ui.AUDIO,group:"common"}}getBlockProperties(){return{abstract:`${_.t(`media.${Ui.AUDIO}.abstract`)}`}}updateMediaElement(e,r,i,o){const s=r.querySelector(":scope .audio-container > audio");return p(kZ,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",jS(e,r)}}const wZ=new RZ;D("video-resizer");function GS(n){return n&&Le(n)&&ln(n)==="video"}const SZ=50;class Sx{constructor(t){m(this,"currentResizableElement",null);m(this,"resizing",!1);m(this,"handleHoveringBlockChange",(t,e)=>{if(!this.resizing&&!window.isDragging&&(e&&GS(e)&&this.disableBlockResize(e),t&&GS(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,SZ),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,je.get(t).addListener("change",this.handleHoveringBlockChange)}destroy(){this.currentResizableElement=null,je.get(this.editor).removeListener("change",this.handleHoveringBlockChange)}getVideoElement(t){return zt(t).querySelector(":scope .video-container > video")}updateResizer(t){const e=this.editor.findCustom(`${dt(t)}-resizer`);e&&e.updateResizer()}disableBlockResize(t){const e=this.editor.findCustom(`${dt(t)}-resizer`);e&&e.disableResize()}enableBlockResize(t,e){const r=this.editor.addCustom(`${dt(t)}-resizer`,()=>new Pd(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 LZ=D("video");class IZ extends HS{constructor(){super(...arguments);m(this,"embedType",Ui.VIDEO);m(this,"updateProgressElement",zS);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 Sx(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,jS(e,r),Mc(i).then(s=>{const l=e.querySelector(".progress-video");l&&c1(e)&&(l.src=s)})})}getAbstract(){return{mediaName:_.t(`media.${Ui.VIDEO}.menuItem`),mediaIcon:GT,menuItem:_.t(`media.${Ui.VIDEO}.menuItem`),order:700,mediaType:Ui.VIDEO,group:"common"}}getBlockProperties(){return{abstract:`${_.t(`media.${Ui.VIDEO}.abstract`)}`}}handleMediaError(e,r,i){const o=e.addCustom("video-resizer",()=>new Sx(e)),s=e.getBlockById(i);o.disableBlockResize(s)}updateMediaElement(e,r,i,o){const s=r.querySelector(":scope .video-container > video");p(LZ,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 Sx(e)).updateResizer(l)}),s}}const DZ=new IZ,WS=[dA,xA,bA,Ok],Lx=[OS,DQ,VJ,YJ,iZ,jK,mZ,DZ,wZ,Vz,dS,yX],qS=[qk,gS,P4];function _Z(n,t,e){var i,o,s,l;Br.level=(i=e.logLevel)!=null?i:Gi.DEBUG;const r=td(n,t,{components:{blocks:[...WS,...((o=e==null?void 0:e.components)==null?void 0:o.blocks)||[]],embeds:[...Lx,...((s=e.components)==null?void 0:s.embeds)||[]],boxes:[...qS,...((l=e.components)==null?void 0:l.boxes)||[]],textRenders:[new XE],options:{...e.componentsOptions}}});return r.readonly=!0,r.addCustom("heading-collapse",()=>new mx(r)),r.addCustom("editor-tooltip",()=>new Ld(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 XS{constructor(t){this.createOptions=t,t.lang&&_.setLang(t.lang)}createHistoryEditor(t,e){return _Z(t,e,this.createOptions)}}function YS(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=td(t,e,{shortcuts:[s0],components:{blocks:s,commandProviders:[new F0],decorators:[new dg],embeds:l,boxes:c,options:o}});if(d.input.addHandler(new mg),d.input.addHandler(new KA(d)),d.input.addHandler(new WA(d)),d.input.addHandler(new Mq(d)),d.input.addHandler(new Eg),d.addCustom("image-paste-handler",()=>new FA(d)),de.isMobile||d.addCustom("editor-tooltip",()=>new Ld(d)),n.options.enableContextMenu!==!1&&d.addCustom("editor-context-menu",E=>new YA(E)),(h=n.options.componentsOptions)!=null&&h.mention){const E=n.options.componentsOptions.mention;d.addCustom("mention",()=>new mS(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 MZ(n,t){const e=Array.from(n.rootContainer.querySelectorAll(`[comment-${t.toLocaleLowerCase()}="${t}"]`)),r=new Set;e.forEach(i=>{const o=et(i);o&&r.add(o)}),r.forEach(i=>{Uq(n,i,t)})}class UZ{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&&MZ(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 YS(this.editor,{root:t,childDoc:e,doc:this.doc})}allowEdit(t){return t.userId===this.doc.getUser().userId}}class OZ{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 WC(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 YS(this.editor,{root:t,childDoc:e,doc:this.localDoc})}allowEdit(t){return t.userId===this.localDoc.getUser().userId}}const NZ={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}",limitedEnvTips:"\u7531\u4E8E\u6D4F\u89C8\u5668\u9650\u5236\uFF0C\u8BF7\u4F7F\u7528 {shortCut} \u7C98\u8D34"}},PZ={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}",limitedEnvTips:"Press {shortCut} to paste due to browser restrictions"}},FZ={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",limitedEnvTips:"\u30D6\u30E9\u30A6\u30B6\u30FC\u306E\u5236\u9650\u306B\u3088\u308A\u3001\u300C{shortCut}\u300D\u3092\u4F7F\u7528\u3057\u3066\u8CBC\u308A\u4ED8\u3051\u3066\u304F\u3060\u3055\u3044"}};_.mergeLang({"zh-CN":NZ,"en-US":PZ,"ja-JP":FZ});const KZ="UEsDBBQABgAIAAAAIQBk9WPugQEAACkGAAATAAgCW0NvbnRlbnRfVHlwZXNdLnhtbCCiBAIooAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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ItABQABgAIAAAAIQA520VMuQUAACdaAAASAAAAAAAAAAAAAAAAADYcAAB3b3JkL251bWJlcmluZy54bWxQSwECLQAUAAYACAAAACEA+JXI7/wOAADzmQAADwAAAAAAAAAAAAAAAAAfIgAAd29yZC9zdHlsZXMueG1sUEsBAi0AFAAGAAgAAAAhAMySUFR9AQAA8QIAABEAAAAAAAAAAAAAAAAASDEAAGRvY1Byb3BzL2NvcmUueG1sUEsBAi0AFAAGAAgAAAAhACJREfHVAQAA3gMAABAAAAAAAAAAAAAAAAAA/DMAAGRvY1Byb3BzL2FwcC54bWxQSwECLQAUAAYACAAAACEAiD+lv+EAAABVAQAAGAAAAAAAAAAAAAAAAAAHNwAAY3VzdG9tWG1sL2l0ZW1Qcm9wczEueG1sUEsBAi0AFAAGAAgAAAAhAMEnywi2AAAAIQEAABMAAAAAAAAAAAAAAAAARjgAAGN1c3RvbVhtbC9pdGVtMS54bWxQSwECLQAUAAYACAAAACEAdD85esIAAAAoAQAAHgAAAAAAAAAAAAAAAABVOQAAY3VzdG9tWG1sL19yZWxzL2l0ZW0xLnhtbC5yZWxzUEsBAi0AFAAGAAgAAAAhAOuAYExTAwAAjw4AABIAAAAAAAAAAAAAAAAAWzsAAHdvcmQvZm9udFRhYmxlLnhtbFBLBQYAAAAADwAPANQDAADePgAAAAA=",VZ=()=>Hp(KZ),$Z=D("image-to-docx");async function HZ(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 QS(n,t){if(n.width&&n.height)return{width:n.width,height:n.height,buffer:t};try{const e=await Mc(new File([t],"",{})),r=await HZ(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}}catch(e){$Z.error(e);return}}function jZ(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 zZ(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 JS(n=[0,1,2,3,4,5,6,7],t=1){return n.map(e=>{let r;switch(e%3){case 0:r=yt.LevelFormat.DECIMAL;break;case 1:r=yt.LevelFormat.LOWER_LETTER;break;default:r=yt.LevelFormat.LOWER_ROMAN;break}return{level:e,format:r,text:`%${e+1}. `,alignment:yt.AlignmentType.START,start:t,style:{paragraph:{indent:{left:yt.convertInchesToTwip(.3*(e+1)),hanging:yt.convertInchesToTwip(.2)}}}}})}function GZ(){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:yt.LevelFormat.BULLET,text:t,alignment:yt.AlignmentType.START,style:{paragraph:{indent:{left:yt.convertInchesToTwip(.3*(n+1)),hanging:yt.convertInchesToTwip(.2)}}}}})}function WZ(){return[0,1,2,3,4,5,6,7].map(n=>({level:n,format:yt.LevelFormat.BULLET,text:"\u2611",alignment:yt.AlignmentType.START,style:{paragraph:{indent:{left:yt.convertInchesToTwip(.3*(n+1)),hanging:yt.convertInchesToTwip(.2)}}}}))}function qZ(){return[0,1,2,3,4,5,6,7].map(n=>({level:n,format:yt.LevelFormat.BULLET,text:"\u2610",alignment:yt.AlignmentType.START,style:{paragraph:{indent:{left:yt.convertInchesToTwip(.3*(n+1)),hanging:yt.convertInchesToTwip(.2)}}}}))}var ch=(n=>(n.NUMBERING="number-numbering-reference",n.BULLET="number-bullet-reference",n.CHECKED="checked-bullet-reference",n.UNCHECKED="unchecked-bullet-reference",n))(ch||{});const XZ=[{levels:JS(),reference:"number-numbering-reference"},{levels:GZ(),reference:"number-bullet-reference"},{levels:WZ(),reference:"checked-bullet-reference"},{levels:qZ(),reference:"unchecked-bullet-reference"}];function YZ(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 QZ(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 JZ(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 ZZ=/rgb\((\d+),\s*(\d+),\s*(\d+)\)/;function ZS(n){if(typeof n=="string"&&n.length>0){if(n[0]==="#")return n.substring(1);const t=n.match(ZZ);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 On(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 tL(n,t,e){for(let r=0;r<=e;++r){const i=`${t}${r}`;if(On(n,i))return i}}function Kg(n,t,e){n.attributes=n.attributes||{},n.attributes[t]=e}function Ix(n){return n==="image"||n==="drawio"||n==="plantuml"||n==="mermaid"||n==="flowchart"}function eL(n){return n&&n.startsWith("//")?`https:${n}`:n&&!n.startsWith("http://")&&!n.startsWith("https://")?`https://${n}`:n}function ttt(n){const t=On(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"&&Kg(n,"inline-style-font-size",s),o==="color"&&Kg(n,"inline-style-color",s),o==="background-color"&&Kg(n,"inline-style-background-color",s),o==="font-family"&&Kg(n,"inline-style-font-family",s)}}function ett(n,t){if(t==null)return n==null?void 0:n.normal;if(n)return n[`heading${t}`]}function ntt(n){const t=`${On(n,"inline-style-font-size")}`;if(t&&t.indexOf("px")>0)return+t.replace(/px/g,"")}function rtt(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 itt(n){if(n.attributes&&n.attributes.box&&n.attributes.text)return` @${n.attributes.text} `}function ott(n){return On(n,"inline-style-font-family")}function stt(n){const t=On(n,"inline-style-background-color");return ZS(t)}function ltt(n){const t=On(n,"inline-style-color");return ZS(t)}function att(n){ttt(n);const t=On(n,"type")==="mention";return{box:n.attributes&&n.attributes.box?n.attributes:void 0,inlineCode:!!On(n,"style-code"),link:eL(On(n,"link")),size:ntt(n),text:t?itt(n):rtt(n)||n.insert,bold:!!On(n,"style-bold"),underline:!!On(n,"style-underline"),italics:!!On(n,"style-italic"),strike:!!On(n,"style-strikethrough"),superScript:!!On(n,"style-super"),subScript:!!On(n,"style-sub"),math:On(n,"type")==="math"?On(n,"src"):void 0,mention:t,fontFamily:ott(n),background:stt(n),color:t?"338fe5":YZ(tL(n,"style-color-",6))||ltt(n),highlight:tL(n,"style-bg-color-",13)}}function ctt(){return[new yt.Paragraph({border:{top:{color:"auto",style:yt.BorderStyle.DASHED,size:4,space:1}},spacing:{before:300}}),new yt.Paragraph({spacing:{line:0}})]}function utt(){return new yt.Paragraph({children:[new yt.TextRun({text:"[\u89C6\u9891\u6682\u4E0D\u652F\u6301\u5BFC\u51FA]",shading:{type:yt.ShadingType.CLEAR,color:"FFFFFF",fill:"CCCCCC"}})]})}function ftt(){return new yt.Paragraph({children:[new yt.TextRun({text:"[\u97F3\u9891\u6682\u4E0D\u652F\u6301\u5BFC\u51FA]",shading:{type:yt.ShadingType.CLEAR,color:"FFFFFF",fill:"CCCCCC"}})]})}function dtt(n,t){return new yt.Paragraph({children:[new yt.ExternalHyperlink({children:[new yt.TextRun({style:"Hyperlink",text:t||n})],link:n})]})}function nL(n){if(n.heading!=null)return`Heading${n.heading}`}function rL(n){if(n.alignment!=null){if(n.alignment==="center")return yt.AlignmentType.CENTER;if(n.alignment==="right")return yt.AlignmentType.RIGHT;if(n.alignment==="left")return yt.AlignmentType.LEFT}}function htt(n){if(n.indent)return{left:yt.convertInchesToTwip(.3*n.indent-.2)};if(n.padding)return{left:yt.convertInchesToTwip(.3*n.padding)}}function mtt(n){return{type:yt.ShadingType.CLEAR,color:"FFFFFF",fill:n}}function gtt(n){const t=n.split(",");if(t.length!==0)return t[0].trim()}function iL(n,t){var o;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 n.text=(o=n.text)==null?void 0:o.replace(/\x00/g," "),new yt.TextRun({text:n.text,bold:n.bold||void 0,underline:n.underline?{type:yt.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?gtt(n.fontFamily):void 0,shading:n.background?mtt(n.background):void 0,color:n.color,highlight:QZ(n.highlight)})}function ptt(n,t){if(n.link)return n.link=n.link.replace(/\x00/g," "),new yt.ExternalHyperlink({children:[iL(n,t)],link:n.link})}async function oL(n,t,e,r,i){const[o]=await i(n,t,e);if(o==null)return;const s=await QS({width:r||0,height:0,src:e},o);return new yt.ImageRun({data:o,transformation:{width:(s==null?void 0:s.width)||100,height:(s==null?void 0:s.height)||20}})}function Ctt(n){if(n.heading||n.heading)return n.heading}function Ett(n){if(n.align&&(n.align==="center"||n.align==="right"||n.align==="left"))return n.align}function Att(n){if(n.textOnly===!0&&n.level!=null)return n.level}async function xtt(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(att(o))}return e}}function btt(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 vtt(n,t){if(n.type==="embed"&&n.embedType&&Ix(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 Btt(n){if(n.padding)return n.padding}function ytt(n){return!!(n.type==="embed"&&n.embedType&&Ix(n.embedType)&&n.embedData&&n.embedData.src)}async function Vg(n,t,e){return{quoted:!!n.quoted,heading:Ctt(n),alignment:Ett(n),indent:Att(n),padding:Btt(n),texts:await xtt(n,e),list:btt(n),images:vtt(n,t),border:ytt(n)}}async function Ttt(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 Vg(l,e,r));i.push(s)}return i}const ktt=D("to-docx"),$g=200;function Rtt(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 wtt(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 Stt(n){p(ktt,n.children,"no table children");const t=n.rows,e=n.cols,r=new Array(n.cols).fill($g).map((s,l)=>n.colsWidth[l]||s);if(r)for(let s=0;s<r.length;s++)r[s]===0&&(r[s]=$g);const i=Rtt(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=JZ(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 A=0;A<h;A++)E===0&&(C+=r?r[l+A]:80),!(E===0&&A===0)&&(i[s+E][l+A].from=[s,l]);i[s][l].width=C}}return wtt(n,t,e,i),i}async function Ltt(n,t,e,r,i,o,s,l,c,d){async function h(E){if(l&&E.type!=="_exportVirtualBlock"){const A=await l(i,o,E);if(A){await r.addDoc(n,A,d);return}}if(E.type==="text"||E.textOnly===!0){const A=await Vg(E,s,c);await r.addTextBlock(A);return}if(E.type==="code"){const A=await Ttt(E,e,s,c);await r.addCodeBlockObject(A);return}if(E.type==="list"&&E.textOnly!==!0){const A=await Vg(E,s,c);await r.addListBlockObject(n,A);return}if(E.type==="embed"&&E.embedType){const A=E,v=A.embedData,w=A.embedType;if(Ix(w)){const S=await Vg(E,s,c);await r.addImagesBlockObject(E,S,d)}else E.embedType==="hr"?r.addSeparatorBlock():E.embedType==="video"?r.addVideoPlaceholder():E.embedType==="audio"?r.addAudioPlaceholder():E.embedType==="webpage"?r.addHyperlinkParagraph(eL(v.src),v.title):r.addOtherEmbedBlock(w,E.embedData);return}if(E.type==="table"){let A=[];if(E.colsWidth)A=new Array(E.cols).fill($g).map((w,S)=>E.colsWidth[S]||w);else{const w=E.cols;A=new Array(w);for(let S=0;S<A.length;S++)A[S]=$g;E.colsWidth=A}const v=Stt(E);await r.addTableMatrix(A,v,e),r.addEmptyParagraph()}E.type==="_exportVirtualBlock"&&await r.addVirtualBlock(E.id,e,d)}function C(E){var w;const A=((w=E==null?void 0:E.embedData)==null?void 0:w.exportSpec)||(E==null?void 0:E.exportSpec);if(!A)return[E];const v=[];for(const{type:S,data:U}of A){if(S==="text"){const M={id:it(),text:[{insert:U}],type:"text"};v.push(M);continue}if(S==="image"){const M={id:it(),type:"embed",embedType:"image",align:"left",embedData:{src:U}};v.push(M);continue}if(S==="link"){const M={id:it(),type:"embed",embedType:"webpage",embedData:{src:U.url,title:U.title}};v.push(M);continue}if(S==="block")for(const M of U){if(!e.blocks[M])continue;const rt={id:M,type:"_exportVirtualBlock"};v.push(rt)}}return v}for(const E of t)for(const A of C(E))!A||await h(A)}function Itt(){return{listMaxInst:1,listInstMap:{},listRefMap:{},levelConfigs:[]}}const Dtt=D("to-docx");class _tt{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 yt.Paragraph({heading:nL(t),alignment:rL(t),children:await this.paragraphsFromBlockTexts(t),indent:htt(t)}))}async addEmptyImagePlaceHolder(){this.paragraphs.push(new yt.Paragraph({text:`[${_.t("docx.imageExportFailed")}]`,shading:{type:yt.ShadingType.CLEAR,color:"FFFFFF",fill:"CCCCCC"}}))}async paragraphsFromBlockTexts(t){if(t.texts==null)return;const e=ett(this.defaultFontSize,t.heading),r=[];for(const i of t.texts){if(i.link){const o=ptt(i,e);o&&r.push(o);continue}if(i.box&&i.box.type&&i.box.type==="br"){r.push(new yt.TextRun({text:"",break:1}));continue}if(i.box&&i.box.type&&i.box.type==="image"){const o=await oL(this.appId,this.docId,i.box.src,i.box.width,this.readImageFunc);o&&r.push(o);continue}if(i.math){const o=await oL(this.appId,this.docId,i.math,0,this.readImageFunc);o&&r.push(o);continue}r.push(iL(i,e))}return r}async addCodeBlockObject(t){for(const e of t)for(const r of e){const i={style:yt.BorderStyle.SINGLE,color:"#DEDEDE"};this.paragraphs.push(new yt.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=JS([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]=ch.NUMBERING:e.list.checkbox&&e.list.checkbox==="checked"?this.state.listRefMap[i]=ch.CHECKED:e.list.checkbox&&e.list.checkbox==="unchecked"?this.state.listRefMap[i]=ch.UNCHECKED:this.state.listRefMap[i]=ch.BULLET;const o=nL(e);e.texts&&this.paragraphs.push(new yt.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 yt.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,h]=await this.readImageFunc(this.appId,this.docId,c.src);if(d){const C=await QS(c,d);if(C)return C}i.push(h)}));zZ(o,r,t.embedData);const s=jZ(o,r),l={style:yt.BorderStyle.SINGLE,color:"#DEDEDE"};s.length&&this.paragraphs.push(new yt.Paragraph({border:e.border?{left:{...l},right:{...l},top:{...l},bottom:{...l}}:void 0,alignment:rL(e)||yt.AlignmentType.CENTER,children:s.map(c=>this.imageDimWithBufferToImageRun(c)).flatMap((c,d,h)=>c==null?[]:h.length-1!==d?[c,new yt.TextRun({text:" "})]:c)})),i.forEach(c=>{this.addHyperlinkParagraph(c)})}addSeparatorBlock(){ctt().forEach(t=>this.paragraphs.push(t))}addEmptyParagraph(){this.paragraphs.push(new yt.Paragraph(""))}addVideoPlaceholder(){this.paragraphs.push(utt())}addAudioPlaceholder(){this.paragraphs.push(ftt())}addHyperlinkParagraph(t,e){t!=null&&this.paragraphs.push(dtt(t,e))}async addTableMatrix(t,e,r){const i=t.map(o=>o!==0?o*15:1500);this.paragraphs.push(new yt.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 yt.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:yt.WidthType.DXA,size:i.width*15},shading:i.color?{fill:i.color,type:yt.ShadingType.CLEAR,color:"auto"}:void 0}))}return r}async generateTableRows(t,e){const r=[];for(const i of t)r.push(new yt.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 addVirtualBlock(t,e,r){const i=await this.convertBlocksFunc(t,e.blocks[t],e,this.appId,this.docId,this.state,r);this.paragraphs.push(...i)}async addOtherEmbedBlock(){}}class Mtt{constructor(t,e,r,i,o,s,l,c){m(this,"convertBlocks",async(t,e,r,i,o,s,l=720)=>{const c=new _tt(i,o,s,this.readImage,this.convertBlocks,this.defaultFontSize);return await Ltt(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 yt.ImportDotx,o=this.templateData?await i.extract(this.templateData):void 0,s=t.blocks.root;p(Dtt,s,"data must have blocks");const l=Itt(),c=await this.convertBlocks("blocks",s,t,e,r,l),d=this.backgroundImageOptions?{default:new yt.Header({children:[new yt.Paragraph({children:[new yt.ImageRun(this.backgroundImageOptions)]})]})}:{},h=new yt.Document({numbering:{config:[...XZ,...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 yt.Packer.toBlob(h)}}const Utt=D("editor-to-docx");async function Ott(n,t,e,r){const i=n.doc.buildResourceUrl(r,{withToken:!0});let o=await vS(i);if(!o)return[void 0,i];if(o.type.indexOf("/svg")!==-1){const l=await AS(o);l&&(o=new File([l],o.name))}return[await o.arrayBuffer(),i]}async function Ntt(n,t,e){const r=n.editorBlocks.getBlockClass(e.type);if(r.toStandardDoc)try{return await r.toStandardDoc(n,e,t)}catch(i){Utt.error(`toStandardDoc error: ${JSON.stringify(i)}`);return}}async function Ptt(n,t){const e=t.attributes,r=n.editorBoxes.getBoxClass(e.type);if(r.toStandardText)return r.toStandardText(n,e)}async function Ftt(n,t){let{template:e,download:r,backgroundImageOptions:i}=t!=null?t:{};e||(e=VZ());const o=n.doc.toJSON(),s=(C,E,A)=>Ott(n,C,E,A),l=async(C,E,A)=>Ntt(n,o,A),c=async C=>Ptt(n,C),h=await new Mtt(e,o,nm.default,s,void 0,l,c,i).convert("_appId","_docId");if(r){const C=URL.createObjectURL(h),E=document.createElement("a");E.setAttribute("download",`${bS(n)}.docx`),E.setAttribute("href",`${C}`),E.click(),E.remove()}return h}const Dx=D("create-editor");async function Ktt(n,t){var s,l,c,d,h,C,E,A,v,w,S,U,M,V,rt,Y;p(Dx,n,"app does not exists"),t.lang&&_.setLang(t.lang),Br.level=(s=t.logLevel)!=null?s:Gi.DEBUG;const e=t.onReauth?async()=>{var ct;const X=t.user.userId,ft=t.docId,pt=await((ct=t.onReauth)==null?void 0:ct.call(t,X,ft,t.permission));return{userId:X,docId:ft,permission:t.permission,appId:t.appId,token:pt,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,onMaxUsersError:t.onMaxUsersError},i=await md.load(r),o=td(n,i,{id:t.id,scrollContainer:t==null?void 0:t.scrollContainer,enableComments:t==null?void 0:t.enableComments,enableContextMenu:t==null?void 0:t.enableContextMenu,components:{blocks:[...WS,...((l=t==null?void 0:t.components)==null?void 0:l.blocks)||[]],embeds:[...Lx,...((c=t.components)==null?void 0:c.embeds)||[]],boxes:[...qS,...((d=t.components)==null?void 0:d.boxes)||[]],commandProviders:[new F0,...((h=t.components)==null?void 0:h.commandProviders)||[]],decorators:[new dg,new XC],insertions:[q1],blockHooks:[new MA,new fw,...((C=t.components)==null?void 0:C.blockHooks)||[]],textRenders:[new L4,new XE,...((E=t.components)==null?void 0:E.textRenders)||[]],options:{...t.componentsOptions}},shortcuts:[Gq,AH,Iz,hA,n4,kF,lA,LX,s0,AF,...t.shortcuts||[]],colors:["#0064FF","#EB3723","#F59300","#00A865","#F25A0A","#70A310","#009CAD","#0990D9","#8851ED","#D62069"]});if(o.editorCommandProviders.registerCommandProvider(new po(o)),o.input.addHandler(new AY),o.input.addHandler(new mg),o.input.addHandler(new XK),o.input.addHandler(new Bz),o.input.addHandler(new vA(o,{hideTitle:t.hideTitle,headingLevel:1,titlePlaceholder:_.t("placeholder.common.title"),contentPlaceholder:_.t("placeholder.common.content"),readonlyTitlePlaceholder:_.t("placeholder.common.readonlyTitle"),addPlaceholderToAllCurrentEmptyBlock:!0,applyContentPlaceholder:(A=t.placeholder)==null?void 0:A.applyContentPlaceholder})),o.input.addHandler(new sg(o,(v=t.componentsOptions)==null?void 0:v.quickMenu)),o.input.addHandler(new KA(o)),o.input.addHandler(new WA(o)),o.input.addHandler(new Eg),o.input.addHandler(new Uk),o.doc.registerCallback(new xY(o)),o.addCustom("remote-cursor",()=>new mT(o)),o.addCustom("block-menu",X=>new mw(X)),de.isMobile||o.addCustom("editor-tooltip",()=>new Ld(o)),t!=null&&t.enableComments&&o.addCustom("editor-comments",X=>new S4(X,new UZ(X))),t.enableContextMenu!==!1&&o.addCustom("editor-context-menu",X=>new YA(X)),o.addCustom("create-options",()=>new Ub(o,t)),o.addCustom("drop-target",()=>new qd(o)),o.addCustom("list-to-mindmap",()=>new tg(o)),o.addCustom("list-to-mention",()=>new VY(o)),o.addCustom("mobile-helper",()=>new uQ(o)),o.addCustom("code-caret",()=>new gH(o)),o.addCustom("image-paste-handler",()=>new FA(o)),(w=t.componentsOptions)!=null&&w.mention){const X=t.componentsOptions.mention;o.addCustom("mention",()=>new mS(o,X))}if(o.addCustom("heading-collapse",()=>new mx(o)),o.addCustom(lh,X=>new bx(X)),bu.register(o),qd.register(o),Dl.register(o),kl.register(o),o.addListener("clickLink",(X,ft,pt)=>{var wt;if((wt=t==null?void 0:t.events)!=null&&wt.onClickLink){t.events.onClickLink(X,ft,pt);return}const ct=pt.getAttribute("link");ct&&(X.readonly||ft.ctrlKey||ft.metaKey)&&window.open(ct,"_blank")}),(U=(S=t.componentsOptions)==null?void 0:S.remoteCarets)!=null&&U.onUserChanged){const X=(V=(M=t.componentsOptions)==null?void 0:M.remoteCarets)==null?void 0:V.onUserChanged;o.doc.getRemoteUsers().on("change",ft=>{X(o,ft)})}return(Y=(rt=t.componentsOptions)==null?void 0:rt.templates)!=null&&Y.templates.length&&(o.addListener("docChanged",()=>{Pg(o)}),o.addListener("resize",()=>{Pg(o,{reset:!0})}),setTimeout(()=>{Pg(o)},100)),o.doc.registerCallback({onError:async X=>{if(X.code==="ResetDoc"){Dx.error(`reset doc: ${X.message}`);const ft=await md.load(r);o.doc.reset(ft)}}}),o.version="1.1.36-beta.1",Br.level===Gi.DEBUG&&(window.setReauthFail=X=>{window.isReauthError=X},window.reConnect=X=>o.doc.externalDoc.client.connection.reConnect(X)),o}function Vtt(n){return n.toJSON!==void 0}async function $tt(n,t,e){var o,s,l,c,d,h,C,E;p(Dx,n,"app does not exists");const r=Vtt(t)?t:new RC(t,{serverUrl:e.serverUrl||""});e.lang&&_.setLang(e.lang),Br.level=(o=e.logLevel)!=null?o:Gi.DEBUG;const i=td(n,r,{id:e.id,scrollContainer:e==null?void 0:e.scrollContainer,components:{blocks:[dA,xA,bA,Ok,...(l=(s=e.components)==null?void 0:s.blocks)!=null?l:[]],commandProviders:[new F0],decorators:[new dg,new XC],embeds:[...Lx,...((c=e.components)==null?void 0:c.embeds)||[]],boxes:[qk,gS,P4,...((d=e.components)==null?void 0:d.boxes)||[]],insertions:[q1],blockHooks:[new MA,...((h=e.components)==null?void 0:h.blockHooks)||[]],textRenders:[new L4,new XE,...((C=e.components)==null?void 0:C.textRenders)||[]],options:{...e.componentsOptions}},shortcuts:[hA,n4,lA,s0]});return i.editorCommandProviders.registerCommandProvider(new po(i)),i.input.addHandler(new mg),i.input.addHandler(new vA(i,{hideTitle:e.hideTitle,headingLevel:1,titlePlaceholder:_.t("placeholder.common.title"),contentPlaceholder:_.t("placeholder.common.content"),readonlyTitlePlaceholder:_.t("placeholder.local.readonlyTitle"),addPlaceholderToAllCurrentEmptyBlock:!0})),i.input.addHandler(new sg(i,(E=e.componentsOptions)==null?void 0:E.quickMenu)),i.input.addHandler(new KA(i)),i.input.addHandler(new WA(i)),i.input.addHandler(new Eg),i.input.addHandler(new Uk),i.addCustom("block-menu",A=>new mw(A)),de.isMobile||i.addCustom("editor-tooltip",()=>new Ld(i)),i.addCustom("image-paste-handler",()=>new FA(i)),e!=null&&e.enableComments&&i.addCustom("editor-comments",A=>new S4(A,new OZ(A,r))),e.enableContextMenu!==!1&&i.addCustom("editor-context-menu",A=>new YA(A)),i.addCustom("heading-collapse",()=>new mx(i)),i.addListener("clickLink",(A,v,w)=>{var U;if((U=e==null?void 0:e.events)!=null&&U.onClickLink){e.events.onClickLink(A,v,w);return}const S=w.getAttribute("link");S&&(A.readonly||v.ctrlKey||v.metaKey)&&window.open(S,"_blank")}),i.addCustom(lh,A=>new bx(A)),bu.register(i),i.version="1.1.36-beta.1",i}async function Htt(n,t,e){var h;const r=n.doc.externalDoc.client.auth,i=await E0.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 XS(l),d=n.addCustom("version-dialog",()=>new tS(i,c));return d.show(t),d}b.tippy=g9,b.AnchorBox=DB,b.AuthError=dd,b.AuthHeader=va,b.AutoScroll=bm,b.BaseURLHeader=nu,b.BasicCommands=CK,b.BlockExclusiveHook=fw,b.BlockLockerHook=MA,b.BlockLockerPasteHandler=Eg,b.BlockResizer=Pd,b.BrBox=wB,b.CodeBlock=xA,b.CodeLineBlock=bA,b.CodeTextDecorator=dg,b.DOC_RE_AUTH_KEYS=lh,b.DefaultShortcuts=s0,b.DocIdError=sO,b.DocReAuthCallbacks=bx,b.DragDrop=Zb,b.DrawioEmbed=OS,b.EditorBlocks=f3,b.EditorBoxes=LB,b.EditorCommandProviders=wy,b.EditorComplexBlockPosition=xi,b.EditorComplexSelectionRange=Ji,b.EditorDecorators=OB,b.EditorEmbeds=h3,b.EditorInsertions=UB,b.EditorSimpleBlockPosition=Cn,b.EditorSimpleSelectionRange=yn,b.EmbedBlock=g3,b.EmbedBlockResizer=nh,b.EnforceWithDocumentTitleHandler=vA,b.EventCallbacks=Lc,b.FILL_CHAR=I8,b.FileExtError=lO,b.GroupOrder=Kk,b.HeadingBlockScrollListener=MY,b.ImageBox=IB,b.InlineBoxCommandProvider=tR,b.InputtingInsertion=_B,b.LocalDoc=RC,b.LogLevel=Gi,b.Logger=Br,b.MIN_DISTANCE_THRESHOLD=Qb,b.ManualCloseDialog=pd,b.ManualMenu=hl,b.ManualToolbar=gd,b.MarkdownInputHandler=mg,b.MaxUserError=KC,b.Mindmap=Z0,b.OnesEditorAutoSuggest=pE,b.OnesEditorCustomDataWrapper=Ub,b.OnesEditorExclusiveBlock=kl,b.OnesEditorHoveringBlock=je,b.OnesEditorIcons=GO,b.OnesEditorQuickMenu=sg,b.OnesEditorToc=sh,b.OnesEditorTocProvider=Dl,b.OnesEditorToolbar=bu,b.OnesEditorTooltip=Ld,b.OnesEditorVersionsDialog=tS,b.PermissionError=C0,b.Popup=su,b.ReAuthToolbar=BS,b.RemoteCarets=mT,b.RemoteCaretsDecorator=XC,b.RemoteCaretsInsertion=q1,b.RemoteUsers=ed,b.RequestReloadError=hd,b.RichText=zn,b.ShareDBDoc=md,b.ShareDBDocVersionsProvider=XS,b.ShareDBServer=E0,b.SimpleCache=Hb,b.StandardEmbedBlockCommands=sx,b.TEXT_STYLE_BACKGROUND_COLOR_PREFIX=R1,b.TEXT_STYLE_COLOR_PREFIX=k1,b.TableBlock=dA,b.TableBlockCommandProvider=F0,b.TableShortcuts=hA,b.TextBlock=ur,b.TextBox=RB,b.TextColorItem=D2,b.TextStyleShortcuts=lA,b.TocEmbed=dS,b.ZERO_WIDTH_SPACE_CHAR=_c,b.abbreviation=vm,b.addAttribute=Im,b.addClass=q,b.addCommentToBlock=eh,b.addDays=TI,b.addMetaToDoc=Jf,b.addMonths=yI,b.animateScrollTo=oa,b.applyPlaceholderToBlock=Od,b.assert=p,b.autoShowHideTemplates=Pg,b.bindKeyDownEvent=hm,b.blockToDoc=bC,b.blockToHtml=Q1,b.blockToMarkdown=Wm,b.blockToText=Gm,b.blocksToDoc=Q5,b.clearAllSelection=zv,b.clientType=de,b.cloneBlock=sl,b.cloneChildContainer=lC,b.cloneDoc=aC,b.cloneText=EB,b.commentToShareDbComment=qC,b.compareElement=um,b.comparePosition=E1,b.complexBlockAdjustSelectionPos=wm,b.complexBlockFindNearestChildBlock=B7,b.complexBlockGetAllChildContainers=_n,b.complexBlockGetBottomChildContainers=A3,b.complexBlockGetDeepFirstChild=p3,b.complexBlockGetFirstSimpleChild=x1,b.complexBlockGetLastSimpleChild=Fc,b.complexBlockGetSelectedContainers=Pc,b.complexBlockGetTopChildContainers=E3,b.containerToDoc=J5,b.continuousScroll=pv,b.convertBlockFrom=km,b.convertImageFileToPng=AS,b.convertImageSrcToPng=rQ,b.converterIntercept=hg,b.copyBlockAttributes=XB,b.copyResourcesFromDoc=kC,b.createBlockAnchor=jo,b.createBlockCaretAnchor=b3,b.createBlockContentElement=da,b.createBlockElement=Pv,b.createBlockSimpleDocRange=Vm,b.createBlockSimpleRange=Ie,b.createBoxContentElement=Vv,b.createBoxElement=Fv,b.createBoxOp=CB,b.createChildContainer=c3,b.createComplexBlockPosition=Ue,b.createComplexDocPos=BB,b.createComplexDocRange=M8,b.createContainer=xB,b.createContainerElement=n1,b.createDeleteOps=hB,b.createEditor=td,b.createEditorSelectionRange=En,b.createElement=B,b.createEmptyContainer=Yo,b.createEmptyDoc=Xo,b.createEmptyTextBlockData=Fm,b.createExpandedRange=am,b.createIconButton=na,b.createImage=Mp,b.createInsertOps=Nm,b.createInsertionContentElement=jv,b.createInsertionElement=$v,b.createLocalEditor=$tt,b.createOnesEditor=Ktt,b.createRange=jb,b.createRichText=Ea,b.createRootContainer=a3,b.createSimpleBlockPosition=mt,b.createSimpleDocPos=vB,b.createTextBlockData=no,b.createTextButton=Sa,b.createTextOp=Xr,b.createTextWithReplaceSoftReturn=F1,b.daysAfter=Xp,b.deleteText=V1,b.diffDays=kI,b.disablePageScroll=zp,b.docToHtml=jB,b.docToHtmlFragment=zf,b.docToMarkdown=zB,b.docToText=ol,b.downloadImageToFile=vS,b.downloadObjectToFile=yx,b.downloadSvgToString=RS,b.editLink=kd,b.editorAddComment=Nq,b.editorAddTextAttribute=s5,b.editorAutoInsertBlock=YB,b.editorBreakTextBlock=Xc,b.editorClearCompositionText=eC,b.editorClearSelectedContents=Jm,b.editorCopyBlock=yC,b.editorCopyDoc=o0,b.editorDeleteBlock=iC,b.editorDeleteBlockText=nC,b.editorDeleteBlockWithoutChildren=Ym,b.editorDeleteChildContainer=I_,b.editorDeleteChildContainers=QB,b.editorFocusToBlock=sC,b.editorFocusToEnd=Y_,b.editorGetBlockData=Qo,b.editorGetBlockText=Jn,b.editorGetBlockTextEx=Hm,b.editorGetBoxData=TB,b.editorHandleKeyboardEvent=uy,b.editorInsertBlock=qc,b.editorInsertBoxToBlock=WB,b.editorInsertDoc=i5,b.editorInsertDocAt=cC,b.editorInsertText=tC,b.editorInsertTextToBlock=GB,b.editorInsertTextToBlockEx=Z1,b.editorMergeTextBlock=JB,b.editorMoveDown=A5,b.editorMoveEnd=pC,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=T5,b.editorRangeClearColor=a5,b.editorRangeGetColor=c5,b.editorRangeSetColor=l5,b.editorRemoveTextAttribute=U_,b.editorReplaceBlockText=Zm,b.editorReplaceContainer=o5,b.editorRunOnce=wC,b.editorSelectAll=EC,b.editorSelectContainer=n0,b.editorSelectDown=x5,b.editorSelectEnd=CC,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=Yc,b.editorShowFindDialog=wW,b.editorToDocx=Ftt,b.editorUpdateBlockData=t0,b.editorUpdateCompositionText=qB,b.editorUpdateEmbedData=n5,b.enablePageScroll=Gp,b.escapeHtmlText=mm,b.escapeRegExp=Zp,b.escapeSpace=sI,b.exclusiveBlock=IA,b.executeBlockCommand=t3,b.executeEmbedBlockCommand=Zv,b.executeRangeCommand=Ry,b.fileToDataUrl=Mc,b.findAfterOffsetNotType=z1,b.findAllText=AC,b.findBlockByIndex=Lv,b.findEventTargetBlock=Wb,b.findInsertionById=Hv,b.findNextOffset=t_,b.findNextVisibleSimpleBlock=Dy,b.findPrevOffset=Z8,b.findPrevOffsetNotType=j1,b.findPrevSimpleBlockBeforeChildContainer=C3,b.findPrevVisibleSimpleBlock=Iy,b.findTarget=Dc,b.findWordEnd=W1,b.findWordLeft=G1,b.format=Rf,b.formatBytes=Cv,b.formatDate=Qp,b.fragmentToHtml=uv,b.fromBase64=Bf,b.fromBase64ToBlob=Hp,b.fromBase64ToUint8Array=CI,b.fromDocRange=nl,b.fromNowString=Jp,b.genId=it,b.generateEditorContainerId=e1,b.getAllChildBlocks=y1,b.getAllQuickMenuItems=sA,b.getAllSelectedBlocks=Zi,b.getAttributesAt=Hc,b.getBlockBackground=o1,b.getBlockByIndex=Js,b.getBlockCaretRect=tl,b.getBlockClass=le,b.getBlockClassByType=ca,b.getBlockClientRects=Vo,b.getBlockCommandsWithHook=d1,b.getBlockContent=zt,b.getBlockHeading=Df,b.getBlockId=dt,b.getBlockIndex=Rt,b.getBlockInfo=Hd,b.getBlockKind=Ei,b.getBlockMinWidth=Wv,b.getBlockNearestRangeFromPoint=v1,b.getBlockOptions=FI,b.getBlockPath=el,b.getBlockProperties=Yv,b.getBlockRangeFromPoint=Sm,b.getBlockStyles=PI,b.getBlockTextLength=At,b.getBlockTools=ve,b.getBlockType=Ot,b.getBoxContent=l1,b.getBoxId=Kv,b.getBoxTypeFromElement=If,b.getChildBlockCount=Xi,b.getChildBlocks=ke,b.getChildOffset=rl,b.getColorFromAttributes=S1,b.getColorFromContent=Bm,b.getComplexBlockClass=jr,b.getContainerBlockPath=o3,b.getContainerBlocks=wv,b.getContainerBlocksElement=Sf,b.getContainerById=Ci,b.getContainerId=Et,b.getContainerMinWidth=p1,b.getContainerToolsElement=UI,b.getContainerWidth=u3,b.getDistanceSquare=Ys,b.getElementFromPoint=Fe,b.getElementOffset=bf,b.getElementScale=Hr,b.getEmbedType=ln,b.getExistsBlockTools=ym,b.getExistsContainerById=wf,b.getFileExt=kf,b.getFirstChildBlock=Me,b.getFirstClientRect=cm,b.getHeadingBlockChildren=Nc,b.getHeadingMenuOptions=nA,b.getHorizontalPadding=Op,b.getInsertionContent=a1,b.getLastChildBlock=We,b.getLastClientRect=ra,b.getListAllNextBrothers=pu,b.getLogger=D,b.getNextBlock=ae,b.getNextHiddenBlocks=r3,b.getNextValidOffset=pa,b.getNextVisibleBlock=Gr,b.getOffsetFromPoint=Up,b.getOffsetInfoAfter=$f,b.getOffsetInfoBefore=jm,b.getOpAt=W3,b.getOpLength=Lm,b.getParentBlock=et,b.getParentBlockExcludeSelf=fa,b.getParentBox=s1,b.getParentContainer=at,b.getPrevBlock=ze,b.getPrevValidOffset=il,b.getPrevVisibleBlock=zr,b.getRangeCommands=Ty,b.getReferenceClientRect=fk,b.getRootBlock=f1,b.getScrollContainer=pn,b.getSpecialBlockCommands=Qv,b.getStandardEmbedBlockProperties=lx,b.getTextAfterOffset=Q8,b.getTextAttributes=J1,b.getTextBeforeOffset=J8,b.getTextBlockChild=Uf,b.getTextBlockClass=Dv,b.getTextBlockContentChildTextLength=qr,b.getTextBlockContentChildType=i3,b.getTextBlockContentChildren=Qi,b.getTextLength=jn,b.getTextOpLength=T1,b.getTextWidth=Em,b.getToolbar=G0,b.handleBlockElementUpdated=qv,b.hasAltOnly=dI,b.hasClass=Mt,b.hasCtrlOrCmd=ov,b.hasCtrlOrCmdOnly=fI,b.hashCode=yv,b.hideBlock=Nv,b.hideTemplates=ES,b.htmlToFragment=Cm,b.i18n=_,b.includeBigTable=vN,b.injectDocToHtmlFragment=Qf,b.injectStyle=Yb,b.inputActions=pM,b.insertEmptyBlock=$I,b.insertEmptyEmbedBlock=h1,b.insertText=qo,b.intersectionCommands=XM,b.isBackspace=lv,b.isBlock=ua,b.isBlockLocked=Cg,b.isBlockLockedByOthers=_A,b.isBlockLockedBySelf=jd,b.isBlockTools=Ov,b.isBox=Tm,b.isBoxOp=zo,b.isCJK=rv,b.isChildContainer=pi,b.isChildNode=Ae,b.isCodeBlock=Di,b.isCollapsedHeadingBlock=Yi,b.isCollapsedRange=_8,b.isComplexBlockPosition=ma,b.isComplexKindBlock=Pt,b.isContainer=Qs,b.isContainerSelectedAllChildBlocks=W5,b.isControlEvent=la,b.isDelete=mI,b.isDraggingFiles=Am,b.isElementVisible=dm,b.isEmbedBlock=Le,b.isEmptyContainer=Of,b.isEmptyDoc=$1,b.isEmptyTextBlock=Be,b.isEmptyTextBlockWithoutCompositionText=Ud,b.isEnterOnly=sv,b.isEscape=pm,b.isExclusiveBlock=$d,b.isExpandedHeadingBlock=n3,b.isFirefox=Af,b.isFirstChildBlockInComplexBlock=v7,b.isHeadingBlock=Dn,b.isHighSurrogate=nI,b.isInBlock=c1,b.isInBlockTools=Oc,b.isLetter=nv,b.isLowSurrogate=rI,b.isMatchShortcut=Wi,b.isMoveForward=cI,b.isNavigationEvent=aI,b.isNavigationKey=iv,b.isNodeRemoved=xf,b.isNumber=ev,b.isPrintableKey=Vp,b.isRootBlock=Wr,b.isRootContainer=ie,b.isSafari=ea,b.isSameDay=Yp,b.isSelectBoxOnly=ei,b.isShiftEnter=hI,b.isShiftTab=pI,b.isShortcutEvent=uI,b.isSimpleBlock=NI,b.isSimpleBlockPosition=bi,b.isSimplePos=bB,b.isSimpleRange=Km,b.isSpace=gm,b.isTab=gI,b.isTextBlockContentBoxChild=yr,b.isTextBlockContentChild=_f,b.isTextBlockContentInsertionChild=Ho,b.isTextBlockContentTextChild=Mf,b.isTextKindBlock=st,b.isTextKindBlockType=Lf,b.isTitleBlock=Ko,b.isToday=Ev,b.isValidOffset=cr,b.isVisibleBlock=Zs,b.isYesterday=Av,b.loadJs=Gb,b.loadJsPromise=ia,b.lockers=gi,b.md5=kv,b.mergeCommands=z0,b.mergeDocs=Aa,b.mergeOps=K1,b.mergeText=S8,b.multiSplitText=X3,b.overflowText=xv,b.parseShortcut=av,b.patchNode=yf,b.pointInRect=sa,b.rangeAddAttribute=Ff,b.rangeGetTextColor=nB,b.rangeRemoveAttribute=$c,b.rangeSetTextColor=Z3,b.rangeTransformText=Q3,b.registerDragDrop=Fp,b.removeAttribute=w1,b.removeClass=ut,b.removeLastBr=T8,b.removePlaceholderFromBlock=OR,b.removeStyle=Xb,b.replaceAll=RI,b.replaceAllCaseInsensitive=wI,b.replaceAllText=X5,b.replaceText=Pm,b.requestDownload=xm,b.resetListStart=Eu,b.scrollIntoView=jf,b.scrollable=gv,b.selectFile=Uc,b.selectedBlockToDoc=r0,b.selectionToDoc=Qc,b.setAttributes=fm,b.setClipboardData=Tf,b.setClipboardDataByEvent=xI,b.setColorToAttributes=tB,b.setDataset=Np,b.setDefaultCursor=vf,b.setStyles=Pp,b.shareDBCommentToDocObject=WC,b.shareDBDocCommentToComment=dT,b.shortcutToDisplayText=gn,b.showBlock=i1,b.showDocVersions=Htt,b.showTemplates=Ax,b.splitText=ar,b.splitToThree=an,b.stringToDataUrl=jp,b.stringToObjectUrl=Wp,b.subText=Y3,b.textNodeOffsetFromPoint=zb,b.titleFromEditor=bS,b.toBase64URL=qi,b.toMindmap=J0,b.toPlainText=Re,b.toPlainTextKeepLength=H1,b.trimChar=Kp,b.unexclusiveBlock=DA,b.unicodeLength=iI,b.unicodeSubstr=oI,b.updateBlockSelection=Gv,b.updateOpAttributes=AB,b.updateTextBlockContent=Y8,b.updateUrl=$p;for(const n in He)n!=="default"&&!b.hasOwnProperty(n)&&Object.defineProperty(b,n,{enumerable:!0,get:()=>He[n]});Object.defineProperties(b,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|