@ones-editor/editor 0.0.3-beta.237 → 0.0.3-beta.238

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -407,7 +407,7 @@ xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24">
407
407
  </svg>`;async function ZO(n,e,t){const o=tt(e),r=o.querySelector('[data-button-id="mindmap-fullscreen"]');g(wt,r,"no full screen button");const i=()=>{setTimeout(()=>{t.toMindmap(n,e,{},{reset:!0,mindmapTools:t})},300)},s=()=>{re(o,"fullscreen"),r.innerHTML=T7,r.setAttribute(`data-editor-tooltip-${n.clientId}-dynamic`,L.t("mindmap.fullScreen")),D7(e)&&setTimeout(()=>{i()},300)};if(document.fullscreenElement===o){try{await S7()}catch(l){wt.error(l)}s()}else{try{W(o,"fullscreen"),await WO(o),i()}catch(l){wt.error(l)}r.innerHTML=GO,r.setAttribute(`data-editor-tooltip-${n.clientId}-dynamic`,L.t("mindmap.exitFullscreen"))}o.onfullscreenchange=()=>{document.fullscreenElement||s()}}function w0(n,e,t,o,r){if(e.querySelector(`[data-button-id="${t}"]`))return null;const s=mo(t,o,r,[]);return s.setAttribute(`data-editor-tooltip-${n.clientId}-dynamic`,o),W(s,"mindmap-button"),e.appendChild(s),s}function B0(n,e){return n.querySelector(`[data-button-id="${e}"]`)}function QO(n){return B0(n,"mindmap-fullscreen")}function YO(n){return B0(n,"mindmap-fit")}function JO(n){return B0(n,"mindmap-close")}function KO(n,e,t,o){const r=w0(n,e,"mindmap-close",L.t("mindmap.close"),zO);!r||n.domEvents.addEventListener(r,"click",()=>{o.closeMindmap(n,t)})}function XO(n,e,t,o){const r=w0(n,e,"mindmap-fit",L.t("mindmap.autoFit"),VO);!r||n.domEvents.addEventListener(r,"click",()=>{o.fitMindmap(n,t)})}function e_(n,e,t,o){if(navigator.userAgent.includes("Mobile")&&!navigator.userAgent.includes("iPad"))return;const i=w0(n,e,"mindmap-fullscreen",L.t("mindmap.fullScreen"),T7);!i||n.domEvents.addEventListener(i,"click",()=>{ZO(n,t,o)})}function t_(n,e){const t=ph(e);if(!t)return;const o=YO(t);o&&(o.remove(),n.domEvents.removeAllListeners(o));const r=JO(t);r&&(r.remove(),n.domEvents.removeAllListeners(r));const i=QO(t);i&&(i.remove(),n.domEvents.removeAllListeners(i))}const bc=new Map;function E0(n,e,t){const o=(s,l)=>{s.forEach(a=>{l?W(a.block,"to-mindmap-highlight"):re(a.block,"to-mindmap-highlight"),o(a.children,l)})},r=I7(n,e);if(r.length===0)return;const i=r[0].block;if(t){const s=bc.get(i);s&&(s.forEach(l=>l.cancel()),bc.delete(i)),o(r,!0)}else{const s=setTimeout(()=>{o(r,!1),bc.delete(i)},300),l=()=>{clearTimeout(s),bc.delete(i)},a=bc.get(i);a?a.push({cancel:l}):bc.set(i,[{cancel:l}])}}const{Markmap:n_}=sE;function o_(n,e){Pt(e);const t=I7(n,e),o=t[0].block,r=d=>({t:"text",v:Le(d.block).textContent,d:1,c:d.children.length>0?d.children.map(p=>r(p)):void 0});let i=null;t.length>1?i={t:"root",v:"root",d:0,c:t.length>0?t.map(d=>r(d)):void 0}:i=r(t[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},a=l(t);return{root:i,block:o,nodes:t,last:a}}function Sf(n,e,t,o){const{root:r,block:i,last:s}=o_(n,e);o.selectBlock&&n.selection.selectBlock(i,0,0),E0(n,i,!1),o.saveData&&n.updateBlockData(i,{viewAsMindmap:!0});const l=tt(i);let a=l.querySelector(".editor-mindmap-svg");if(o.reset&&(a&&a.remove(),a=null),a)a.innerHTML="";else{const _="http://www.w3.org/2000/svg",R=l.getBoundingClientRect(),H=document.fullscreenElement===l,z=H?`${R.width}`:`${e.getBoundingClientRect().width}`,Q=H?`${R.height}`:"600",ee=document.createElementNS(_,"svg");ee.setAttributeNS(null,"viewBox",`0 0 ${z} ${Q}`),ee.setAttributeNS(null,"width","100%"),ee.setAttributeNS(null,"height",Q),ee.style.display="block",ee.style.width="100%",ee.style.height=`${Q}px`,ee.classList.add("editor-mindmap-svg"),l.appendChild(ee),a=ee}const d=i,p=`editor-mindmap-root-${ie(i)}`;W(d,"editor-in-mindmap-first",p,"readonly"),d.contentEditable="false";const C=Qe(i);C&&be(C)<=be(s.block)&&qO(C,s.block,["block-hidden",p]);const v=(_,R)=>{if(R.length>0){const H=R[0].parentElement;H&&(H.style.width="100vw",H.style.maxWidth="200px")}R.forEach(H=>{W(H,"editor-mindmap-node")})},B=new n_(a,{...t,autoFit:!0});B.viewHooks.transformHtml.tap(v),B.setData(r),B.fit();const S=tt(i);let x=S.querySelector(".mindmap-toolbar");x||(x=k("div",["mindmap-toolbar"],S)),XO(n,x,d,o.mindmapTools),e_(n,x,d,o.mindmapTools),KO(n,x,d,o.mindmapTools),n.domEvents.addEventListener(a,"click",()=>{n.selection.selectBlock(i,0),n.input.focus()}),d.mindMap=B}function r_(n){const e=k("div",["list-to-mindmap-wrap"],null),t=mo("list-to-mindmap",L.t("mindmap.viewAsMindMap"),RO,[],n.clientId);return e.appendChild(t),e}async function L7(n,e){const t=`editor-mindmap-root-${e.id}`,o=oe(e);mt(o).forEach(l=>{xe(l,t)&&re(l,t,"editor-in-mindmap-first","block-hidden")});const i=tt(e);document.fullscreenElement===i&&await S7();const s=i.querySelector(".editor-mindmap-svg");!s||(g(wt,s,"no mindmap svg"),s.remove(),n.domEvents.removeAllListeners(s),t_(n,e))}function i_(n){const e=n.classList,t="editor-mindmap-root-";return Array.from(e).find(r=>{if(r.startsWith(t))return r})}async function M7(n,e){!i_(e)||(n.updateBlockData(e,{viewAsMindmap:null}),L7(n,e),n.selection.selectBlock(e,0))}function s_(n,e){const t=e.mindMap;t&&t.fit()}const x0={toMindmap:Sf,closeMindmap:M7,fitMindmap:s_},voe="";class Df{constructor(e){m(this,"toMindmapButton");m(this,"currentBlock",null);m(this,"handleHoveringBlock",e=>{e&&je(e)&&Zn(e)!=="unchecked"&&Zn(e)!=="checked"&&this.editor.isWritable()?tt(e).appendChild(this.toMindmapButton):this.toMindmapButton.remove()});m(this,"handleMouseEnter",()=>{const e=ne(this.toMindmapButton);g(wt,e&&je(e),"no parent list"),E0(this.editor,e,!0),this.currentBlock=e});m(this,"handleMouseLeave",()=>{this.currentBlock&&(E0(this.editor,this.currentBlock,!1),this.currentBlock=null)});m(this,"handleClick",()=>{const e=ne(this.toMindmapButton);g(wt,e&&je(e),"no parent list"),Sf(this.editor,e,{},{saveData:!0,selectBlock:!0,mindmapTools:x0})});this.editor=e,Ct.get(this.editor).addListener("change",this.handleHoveringBlock),this.toMindmapButton=r_(e),e.domEvents.addEventListener(this.toMindmapButton,"mouseenter",this.handleMouseEnter),e.domEvents.addEventListener(this.toMindmapButton,"mouseleave",this.handleMouseLeave),e.domEvents.addEventListener(this.toMindmapButton,"click",this.handleClick)}static get(e){return e.findCustomByType(Df)}destroy(){Ct.get(this.editor).removeListener("change",this.handleHoveringBlock)}hide(){this.currentBlock&&(this.currentBlock=null),this.toMindmapButton.remove()}}function l_(n,e,t){var o;e==="beginDrag"&&((o=Df.get(n))==null||o.hide())}function vc(n,e,t,o){var i;const r=(i=o==null?void 0:o.groupId)!=null?i:K();e.forEach(s=>{const l=n.getBlockData(s);if(l.start!==t||(o==null?void 0:o.resetGroupId)){const a={...l,start:t};o!=null&&o.resetGroupId&&(a.groupId=r),n.updateBlockData(s,a)}l.textOnly||(t+=1)})}function I0(n,e,t,o){const r=x7(e,{withSelf:!0});r.length!==0&&vc(n,r,t,o)}class Lf{constructor(e,t){m(this,"listStart",0);m(this,"listBrother",null);if(this.editor=e,Tf(t))return;const o=Tu(t),r=Co(o);this.listStart=r,o===t?this.listBrother=Zs(o):this.listBrother=o}fix(){!this.listBrother||I0(this.editor,this.listBrother,this.listStart)}}class Qs{constructor(e,t,o){m(this,"listStart");m(this,"listBrother",null);this.editor=e,this.options=o;const r=Tu(t),i=Co(r);this.listStart=i,this.listBrother=r,o!=null&&o.resetStart&&(this.listStart=1)}fix(){!this.listBrother||I0(this.editor,this.listBrother,this.listStart,this.options)}}class c_{constructor(e,t,o){m(this,"listStart");m(this,"listNextBrothers",[]);this.editor=e,this.listNextBrothers=Ac(t);const{start:r,resetStart:i}=o||{};this.listStart=i?1:r!=null?r:1}fix(){!this.listNextBrothers.length||vc(this.editor,this.listNextBrothers,this.listStart)}}function a_(n,e,t){n.getBlockData(e).quoted&&(t.quoted=!0)}function T0(n,e,t,o){if(wt.debug("drag a block on a list block"),!te(n,e))return!1;g(wt,je(t),"target is not a list block");const{type:r,start:i,level:s,groupId:l}=Yi(t),a=o==="after"?i+1:i,d=n.getBlockData(e),h={id:K(),type:"list",groupId:l,level:s,start:a,text:d.text,...y0(r)};a_(n,t,h);let p=be(t);const C=oe(t);o==="after"&&(p+=1);let v=null;je(e)&&(v=new Lf(n,e));const B=n.insertBlock(ce(C),p,h,Oh(h.id,0));return n.deleteBlock(e),new Qs(n,B).fix(),v==null||v.fix(),!0}function u_(n,e,t,o){if(wt.debug("drag a list between text blocks"),o==="after"){const d=Qe(t);if(d&&je(d))return T0(n,e,d,"before")}if(o==="before"){const d=at(t);if(d&&je(d))return T0(n,e,d,"after")}const i={...n.getBlockData(e),groupId:K(),start:1,level:1};let s=be(t);const l=oe(t);o==="after"&&(s+=1),n.insertBlock(ce(l),s,i,Oh(i.id,0));const a=new Lf(n,e);return n.deleteBlock(e),a.fix(),!0}function d_(n,e,t,o,r){if(uh(t))return!1;const{blockId:i}=t,s=n.getBlockById(i);g(wt,s,"no dragged block");const{isSourceBlock:l,targetBlock:a}=r;return!l&&a?(g(wt,e===a,"block !== target block"),g(wt,je(a),"target is not a list block"),T0(n,s,a,o)):u_(n,s,a,o)}function R7(n,e){if(!n.isWritable())return!1;const t=n.selection.range,r=n.editorCommandProviders.getCommands(t).find(i=>i.id===e);return r?(n.editorCommandProviders.executeCommand(t,r,{}),!0):!1}const h_={"Shift+CtrlOrCmd+L":n=>R7(n,"unordered-list"),"Shift+CtrlOrCmd+U":n=>R7(n,"ordered-list")};function Mf(n){const e=n.getAttribute("block-padding-level");return e?Number(e):null}function f_(n,e){let t;const o=Mf(e);if(!o)t=1;else{if(o>=12)return t=12,!1;t=o+1}return n.updateBlockData(e,{...n.getBlockData(e),padding:t}),!0}function O7(n,e){const t=Mf(e);if(!t)return!1;const o=n.getBlockData(e);return t>1?(n.updateBlockData(e,{...o,padding:t-1}),!0):(n.updateBlockData(e,{...o,padding:null}),!0)}function S0(n){return n.readonly||!n.isWritable()}function m_(n){return n.selection.range.getSelectedBlocks().forEach(t=>{const o=t.block;te(n,o)&&f_(n,o)}),!0}function g_(n){return n.selection.range.getSelectedBlocks().forEach(t=>{const o=t.block;te(n,o)&&O7(n,o)}),!0}function p_(n){return S0(n)?!1:n.undoManager.runInGroup(()=>(m_(n),!0))}function C_(n){return S0(n)?!1:n.undoManager.runInGroup(()=>(g_(n),!0))}function A_(n){if(S0(n))return!1;if(!n.selection.range.isCollapsed())return;const e=n.selection.focusedBlock;if(!te(n,e))return;const t=n.selection.range.focus;if(!(!t.isSimple()||t.offset!==0||!Mf(e)))return O7(n,e),!0}class D0{renderBlock(e,t,o){const{padding:r}=o;return r?{attributes:{"block-padding-level":r}}:{}}}const yoe="",b_={Tab:p_,"Shift+Tab":C_,Backspace:A_};function v_(n,e,t=1){if(!e)return null;let o=at(n);for(;o;){const r=o.getAttribute("data-style-heading"),i=Number(o.getAttribute("data-list-level"));if(r){if(r<e)return null;if(r===e&&i===t)return je(o)?o:null}o=at(o)}return null}function y_(n,e){const t=n.getAttribute("data-style-heading"),o=v_(n,t);if(o)return o;const r=at(n);if(r&&je(r)&&Zn(r)===e)return r;const i=Qe(n);return i&&je(i)&&Zn(i)===e?i:null}function k_(n,e,t){var S,x,_;const o=(S=t.data)!=null?S:{};let r=1;if(je(e))r=vn(e);else{const R=Mf(e);R&&(r=R+1),r>8&&(r=8)}const i=(x=o.listType)!=null?x:"ordered";if(i==="text-only")return null;const s=n.getBlockData(e);let l=(_=s.text)!=null?_:[],d=st(l);const h=t.offset||0;h<=rn(l)&&(l=Tn(l,h).right,d=d.substring(0,h));let p=1;i==="ordered"&&(p=Number.parseInt(d,10)||1);let C=K();const v=y_(e,i);if(v){if(be(e)>be(v))p=Co(v)+1;else{const H=Co(v);H>1&&(p=H-1)}C=Cc(v),new c_(n,v,{start:p+1}).fix()}const B={id:K(),type:"list",level:r,start:p,groupId:C,ordered:!1,text:l};return s.quoted&&(B.quoted=!0),s.heading&&(B.heading=s.heading),i==="ordered"?B.ordered=!0:(i==="checked"||i==="unchecked")&&(B.checkbox=i),{blockData:B,onConverted:(R,H)=>{new Qs(R,H).fix()}}}function yc(n){return n.textOnly?"text-only":n.checkbox?n.checkbox:n.ordered?"ordered":"unordered"}function w_(n){var t,o;if(n.checkbox||n.textOnly)return"";const e=(t=n.level)!=null?t:1;return n.ordered?`${NO(e,(o=n.start)!=null?o:1)}.`:$O(e)}function Rf(n){return n==="checked"||n==="unchecked"}function _7(n,e,t,o){const r=e,{containerId:i,blockIndex:s}=o[o.length-1];if(s===0)return!0;const l=t.blocks[i][s-1];if(l.type!=="list")return!0;const a=yc(r),d=yc(l);return a!==d&&(!Rf(a)||!Rf(d))||r.level>l.level}function F7(n,e,t,o){const r=e,{containerId:i,blockIndex:s}=o[o.length-1];if(s===t.blocks[i].length-1)return!0;const l=t.blocks[i][s+1];if(l.type!=="list")return!0;const a=yc(r),d=yc(l);return a!==d&&(!Rf(a)||!Rf(d))||r.level>l.level}function B_(n,e,t,o,r){var s,l,a;const i=e;if(o==="text")return((s=Sn.convertTo)==null?void 0:s.call(Sn,n,e,t,"text",r))||"";if(o==="markdown"){let d=((l=Sn.convertTo)==null?void 0:l.call(Sn,n,e,t,"markdown",r))||"";i.checkbox==="checked"?d=`[x] ${d}`:i.checkbox==="unchecked"&&(d=`[ ] ${d}`),i.ordered?d=`${i.start}. ${d}`:d=`- ${d}`;const h=i.level||0;return d=(h>0?" ".repeat(h-1):"")+d,_7(n,e,t,r)&&(d=`${d}`),F7(n,e,t,r)&&(d=`${d}`,h<=1&&(d+=`
408
408
  `)),d}if(o==="html"){let d=((a=Sn.convertTo)==null?void 0:a.call(Sn,n,e,t,"html",r))||"";d=d.replace("<p>","").replace("</p>",""),i.checkbox==="checked"?d=`<input type="checkbox" checked="checked" disabled="disabled" /> ${d}`:i.checkbox==="unchecked"&&(d=`<input type="checkbox" disabled="disabled" /> ${d}`);let h="ul";return i.ordered?(d=`<li value="${i.start}">${d}</li>`,h="ol"):d=`<li>${d}</li>`,_7(n,e,t,r)&&(d=`<${h}>${d}`),F7(n,e,t,r)&&(d=`${d}</${h}>`),d}return""}function P7(n){const e=k("label",["editor-check-list-wrapper"],null);n&&W(e,"editor-check-list-wrapper-checked");const t=k("span",["editor-check-box"],e);return k("span",["editor-check-box-inner"],t),e}function E_(n,e){const t=yc(e);if(t!=="text-only"){if(t==="checked"){n.append(P7(!0));return}if(t==="unchecked"){n.append(P7(!1));return}n.innerText=w_(e)}}function x_(n){const e=k("div",["list-container"],null),t=k("button",["list-marker"],e);return E_(t,n),e}function N7(n){let e=Qe(n);if(!e)return null;const t=Zs(n);for(;e!==t;){if(g(wt,e,"no next block"),je(e))return vn(e)>vn(n)?e:null;if(e=Qe(e),!e)return null}return null}function L0(n){const e=[];let t=N7(n);if(!t)return e;for(;t;){const o=Zs(t);e.push({block:t,children:L0(t)}),t=o}return e}function I_(n){const e=(o,r)=>{r.push(o.block),o.children.forEach(i=>e(i,r))},t=[];return n.forEach(o=>e(o,t)),t}function $7(n,e){return vn(e)!==1}function H7(n,e,t){e.forEach(o=>{const r=n.getBlockData(o.block);n.updateBlockData(o.block,{...r,groupId:t,level:r.level-1}),o.children.length&&H7(n,o.children,r.groupId)})}function M0(n,e){if(!$7(n,e))return!1;const t=vn(e);if(t===1)return!1;let o=K(),r=1,i=Zn(e);const s=t-1,l=k0(e);l&&(o=Cc(l),r=Co(l)+1,i!=="text-only"&&(i=Zn(l)));const a=L0(e),d=n.getBlockData(e),h={...d,groupId:o,level:s,start:r,...y0(i)};n.updateBlockData(e,h),n.doc.beginBatchUpdate(),H7(n,a,d.groupId),n.doc.endBatchUpdate(),new Qs(n,e).fix();const C=N7(e);return C&&new Qs(n,C,{resetStart:!0,resetGroupId:!0}).fix(),!0}function kc(n,e){Pt(e);const t=n.getBlockData(e),o={id:K(),type:"text",text:t.text};t.heading&&(o.heading=t.heading),t.heading&&(o.heading=t.heading);const r=new Lf(n,e),i=oe(e),s=be(e);n.deleteBlock(e);const l=Oh(o.id,0);if(Ra(n,i)&&!Ge(i)){const a=yt(i);n.insertBlock(ce(i),s,o,l),n.deleteBlock(a)}else n.insertBlock(ce(i),s,o,l);r.fix()}function T_(n){if(!n.selection.range.isCollapsed())return!1;const e=n.selection.focusedBlock;if(!je(e))return!1;const t=n.selection.range.focus;return!t.isSimple()||t.offset!==0?!1:vn(e)===1?(kc(n,e),!0):(M0(n,e),!0)}const S_=D("list-block");function D_(n,e,t){g(S_,je(e),"not a list block");const o={...n.getBlockData(e),id:K()};return t!=null&&t.level&&(o.level=t.level),t!=null&&t.start&&(o.start=t.start),t!=null&&t.keepText||delete o.text,(o==null?void 0:o.checkbox)==="checked"&&(o.checkbox="unchecked"),o}function L_(n){if(Pt(n),!Tf(n))return n;let e=Ji(n);for(;e;){if(!Tf(e))return e;e=Ji(e)}return null}function M_(n,e,t,o){const r=new Qs(n,o),i=Co(o)+1;tc(n,e,t,{forceInsertAfter:!0,newBlockData:D_(n,o,{start:i})}),r.fix()}function R_(n){var s;if(n.selection.range.isCollapsed()){const l=n.selection.focusedBlock;if(je(l)&&ue(n,l)===0)return kc(n,l),!0}n.clearSelectedContents();const e=n.selection.focusedBlock;if(!je(e))return!1;const t=n.selection.range.focus;if(!t.isSimple())return!1;const o=t.offset,i=(s=o===ue(n,e)?L_(e):e)!=null?s:e;return M_(n,e,o,i),!0}function j7(n){g(wt,je(n),"not a list block");const{level:e}=Yi(n);let t=at(n);for(;t;){if(je(t)){const{level:o}=Yi(t);if(e===o)return t;if(o<e)return null}t=at(t)}return null}function U7(n,e){return Pt(e),j7(e)?vn(e)<OO:!1}function O_(n,e,t){let o=at(e);g(wt,o,"no prev brother");const r=vn(t);for(;o;){if(o===t)return null;if(je(o)&&vn(o)===r+1)return o;o=at(o)}return null}function z7(n,e){if(!U7(n,e))return!1;Pt(e);const t=j7(e);g(wt,t,"no list prev brother");const o=t,r=O_(n,e,o),i=vn(o)+1;let s=K(),l=1,a=Zn(e);r&&(s=Cc(r),l=Co(r)+1,a=Zn(r));const d=L0(e),p={...n.getBlockData(e),groupId:s,level:i,start:l,...y0(a)};return n.updateBlockData(e,p),n.doc.beginBatchUpdate(),I_(d).forEach(v=>{const B=n.getBlockData(v);n.updateBlockData(v,{...B,level:B.level+1})}),n.doc.endBatchUpdate(),!0}function __(n,e,t){return e.length===0||!e.every(o=>je(o.block))?!1:t==="increase"?U7(n,e[0].block):$7(n,e[0].block)}function V7(n,e,t){if(!__(n,e,t))return!1;const o=e[0].block,r=vn(o),i=e.filter(d=>vn(d.block)<=r),s=x7(o,{withSelf:!1}),l=new Set(i.map(d=>d.block)),a=s.filter(d=>!l.has(d));return n.undoManager.runInGroup(()=>{let d=null;a.length>0&&(d=new Qs(n,a[0])),i.forEach(h=>{t==="increase"?z7(n,h.block):M0(n,h.block)}),d==null||d.fix()}),!0}function F_(n,e){return z7(n,e)}function P_(n,e){return M0(n,e)}function N_(n){const e=n.selection.range.getSelectedBlocks();if(e.length>1)return V7(n,e,"increase"),!0;const t=e[0].block;if(!je(t))return!1;const o=new Lf(n,t);return F_(n,t)&&(o.fix(),new Qs(n,t).fix()),!0}function $_(n){const e=n.selection.range.getSelectedBlocks();if(e.length>1)return V7(n,e,"decrease"),!0;const t=e[0].block;return je(t)?(P_(n,t),!0):!1}class H_{constructor(e){this.editor=e}handleBeforeKeyDown(e,t){const o=e.selection.range.getSelectedBlocks();if(o.length===0||!o.some(i=>je(i.block)))return!1;switch(t.key){case"Enter":return this.handleEnter(t);case"Backspace":return this.handleBackspace();case"Tab":return this.handleTab(t);default:return!1}}handleEnter(e){const t=this.editor.selection.range.getSelectedBlocks()[0];return!t.block||!je(t.block)||rr(e,"Shift+Enter")?!1:this.editor.undoManager.runInGroup(()=>R_(this.editor))}handleBackspace(){return this.editor.undoManager.runInGroup(()=>T_(this.editor))}handleTab(e){return rr(e,"Shift+Tab")?this.editor.undoManager.runInGroup(()=>$_(this.editor)):this.editor.undoManager.runInGroup(()=>N_(this.editor))}}class j_{constructor(e){m(this,"effectedBlockIds",new Map);m(this,"handleBeforeClearSelection",()=>{this.effectedBlockIds.clear();const e=this.editor.selection.range.getSelectedBlocks();if(e.length===0)return;const t=new Set;e.forEach(r=>{const i=r.block;je(i)&&t.add(i)});const o=new Map;Array.from(t.values()).forEach(r=>{var a;const i=Tu(r),{start:s}=Yi(i);o.set(ie(i),s);const l=(a=HO(r))!=null?a:r;o.set(ie(l),s)}),this.effectedBlockIds=o});m(this,"handleAfterClearSelection",()=>{Array.from(this.effectedBlockIds.entries()).forEach(([e,t])=>{const o=this.editor.findBlockById(e);!o||I0(this.editor,o,t)}),this.effectedBlockIds.clear()});this.editor=e,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 U_=D("customize-list-start-menu");class z_{constructor(e){m(this,"popup");m(this,"block",null);m(this,"show",(e,t)=>{const o=t.querySelector("div.list-container");g(U_,o,"list-block mark does not exist"),this.block=t,this.popup.manualShow(o,{theme:"light"})});m(this,"createDialogContent",()=>{const e=k("div",["customize-start-panel"],null);k("span",["customize-start-panel-title"],e,L.t("list.numberLabel"));const t=this.createNumericInput();e.appendChild(t);const o=k("button",["customize-start-panel-button"],e,L.t("list.confirm"));return this.editor.domEvents.addEventListener(e,"keydown",this.handleKeydown),this.editor.domEvents.addEventListener(o,"click",this.handleOk),e});m(this,"handleDialogShow",()=>{const e=this.block;if(!e)return;const t=this.popup.popupContent,o=t.querySelector("button.customize-start-panel-button"),r=t.querySelector("input.customize-start-panel-input"),i=Co(e);!o||!r||requestAnimationFrame(()=>{r.focus(),r.value=String(i)})});m(this,"handleOk",()=>{const t=this.popup.popupContent.querySelector("input.customize-start-panel-input"),o=this.block;if(!o)return;const r=Number(t.value);!r||(this.editor.undoManager.runInGroup(()=>{vc(this.editor,[o,...Ac(o)],r,{resetGroupId:!0})}),this.popup.close("clickItem"))});m(this,"handleKeydown",(e,t)=>{const o=t;o.isComposing||(o.key==="Escape"?this.popup.close("cancelBar"):o.key==="Enter"&&this.handleOk())});this.editor=e,this.popup=new fu(this.createDialogContent()),this.popup.on("show",this.handleDialogShow)}destroy(){this.popup.destroy()}createNumericInput(){const e=k("input",["customize-start-panel-input"],null);e.type="number",e.min="1";const t=()=>{const r=e.value.replace(/[^\d]/g,"").replace(/^0+/,""),i=parseInt(r,10);i<=0||Number.isNaN(i)?e.value="":e.value=r};return this.editor.domEvents.addEventListener(e,"input",t),e}}function V_(n,e){return Cc(n)===Cc(e)}function W_(n,e){const t=B7(e);return t?V_(t,e)?Co(t)!==Co(e)-1:!0:!1}function q_(n,e){return Ji(e)?!0:Co(e)!==1}function G_(n,e){return Pt(e),[{id:"continue-numbering",name:L.t("list.continueList"),states:W_(n,e)?[]:["disabled"]},{id:"start-new-list",name:L.t("list.restartList"),states:q_(n,e)?[]:["disabled"]},{id:"set-numbering-value",name:L.t("list.changeNumber")}]}function Z_(n,e,t){var o,r;if(Pt(e),t.id==="continue-numbering"){const i=B7(e);i&&vc(n,[e,...Ac(e)],Co(i)+1,{resetGroupId:!0,groupId:Cc(i)})}if(t.id==="start-new-list"&&n.undoManager.runInGroup(()=>{vc(n,[e,...Ac(e)],1,{resetGroupId:!0})}),t.id==="set-numbering-value"){const i=(o=n.options.componentsOptions)==null?void 0:o.list;if((r=i==null?void 0:i.onChangeStart)!=null&&r.call(i,n,e,t))return;n.addCustom("list-customize-start-dialog",()=>new z_(n)).show(n,e)}}class Q_{constructor(e){m(this,"menu");m(this,"handleClick",(e,t)=>{const o=zl(t,"div.list-container");if(o&&this.editor.isWritable()){const r=ne(o);g(wt,r,"no parent block"),Pt(r);const i=e.getBlockData(r);if(i&&i.checkbox){e.updateBlockData(r,{...i,checkbox:i.checkbox==="checked"?"unchecked":"checked"});return}if(Zn(r)==="unordered")return;this.menu.updateItems(this.getCommandItems(r)),this.menu.manualShow(o),this.activeList(o,!0)}});m(this,"handleMenuClose",()=>{var t;const e=(t=this.menu.tippyInstance)==null?void 0:t.reference;e&&this.activeList(e,!1)});m(this,"handleMenuClick",(e,t)=>{var r;const o=(r=this.menu.tippyInstance)==null?void 0:r.reference;if(o){const i=ne(o);i&&Z_(this.editor,i,t)}});this.editor=e,this.editor.addListener("click",this.handleClick),this.menu=new Vs([]),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(e){return G_(this.editor,e)}activeList(e,t){const o=ne(e);!o||(t?(W(e,"active"),W(o,"active")):(re(e,"active"),re(o,"active")))}}class Y_{constructor(e){this.editor=e}handleBeforeKeyDown(e,t){const o=e.selection.range.getSelectedBlocks();if(o.length===0)return!1;const r=o[0].block;if(!je(r)||!D7(r))return!1;if(t.key==="ArrowUp"||t.key==="ArrowLeft"){const i=Ds(r);return i&&e.selection.selectBlock(i,ue(e,i)),!0}if(t.key==="ArrowDown"||t.key==="ArrowRight"){const i=Ls(r);return i&&e.selection.selectBlock(i,0),!0}return(t.key==="Delete"||t.key==="Backspace"||t.key==="Escape")&&M7(e,r),!0}}function J_(n,e,t,o,r){fp(n,"list-block-init",()=>{setTimeout(()=>{n.input.addHandler(new Y_(n)),n.input.addHandler(new H_(n)),n.addCustom("list-clear-selection-handler",()=>new j_(n)),n.addCustom("list-marker-menu",()=>new Q_(n))})});const i=Sn.createBlockContent(n,e,t,o,r),s=r,{level:l,start:a,groupId:d}=s,h=yc(s);o.setAttribute("data-list-level",`${l}`),o.setAttribute("data-list-start",`${a||1}`),o.setAttribute("data-list-group-id",`${d}`),o.setAttribute("data-list-type",h);const p=x_(s);return o.insertBefore(p,i),s.viewAsMindmap?setTimeout(()=>{const C=n.getBlockById(r.id);C&&Sf(n,C,{},{mindmapTools:x0,saveData:!1})}):setTimeout(()=>{const C=n.getBlockById(r.id);C&&L7(n,C)}),i}const K_={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"}},X_={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"}},eF={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"}};L.mergeLang({"zh-CN":K_,"en-US":X_,"ja-JP":eF});const koe="",W7={...Sn,blockType:"list",createBlockContent:J_,convertFrom:k_,convertTo:B_,handleDrop:d_,notify:l_},R0=D("paragraph");class tF{constructor(e){m(this,"id","BlockParagraphProvider");this.editor=e}isChecked(e,t){return!!(e[t]||e.level&&(e.ordered===!0&&!e.checkbox&&t==="ordered-list"||e.ordered===!1&&!e.checkbox&&t==="unordered-list")||t==="check-list"&&e.checkbox)}getAvailableCommands(e,t){const o=[],r={"unordered-list":[L.t("commands.unordered"),io("CtrlOrCmd+Shift+L"),tM],"ordered-list":[L.t("commands.ordered"),io("CtrlOrCmd+Shift+U"),eM],"check-list":[L.t("commands.check"),void 0,nM],link:[L.t("commands.link"),io("CtrlOrCmd+K"),wv],quoted:[L.t("commands.quote"),void 0,oM]};if(te(e,t)){const i=ie(t),s=Se(t),l=Lo(e,t),a=e.getBlockData(t);Object.entries(r).forEach(([d,[h,p,C]])=>{const v=[];if(this.isChecked(a,d)&&v.push("checked"),d==="link"){if(!e.selection.range.isSimple())return;e.selection.range.getSelectedBlocks().length!==1&&v.push("disabled")}o.push({blockId:i,blockType:s,blockKind:l,id:d,name:h,desc:p,states:v,icon:C,groupIndex:600})})}return o}convertLink(e,t,o){g(R0,Gr(t.start),""),g(R0,Gr(t.start),"");const r="bottom-start",i=t.start.offset,s=t.end.offset,l=(v,B)=>{e.undoManager.runInGroup(()=>{try{const S=e.selection.range.isCollapsed();let x;if(S){x=Qr(e.getBlockText(o),s,v,{link:B}),e.setBlockText(o,x);return}x=Lh(e.getBlockText(o),i,s,v),x=Pa(i,v.length,x,"link",B),e.setBlockText(o,x),e.selection.selectBlock(o,i+v.length),e.focus()}catch(S){R0.error(S)}})},a=()=>{e.selection.selectBlock(o,s),e.focus()},d=Vr(e,o,t)[0];if(!d)return;const h=Zr(e,o,"link-button-anchor",d),p=e.getBlockText(o),C=Na(p,i);xu(e,{target:h,linkText:e.getSelectedText(),linkUrl:(C==null?void 0:C.link)||"",onFinished:l,onClose:a,placement:r})}convertToList(e,t,o){const r=Ch(e,t,"list",{offset:0,data:{listType:o}});r&&e.undoManager.runInGroup(()=>{const i=be(t),s=oe(t);e.insertBlock(ce(s),i,r.blockData),e.deleteBlock(t)})}executeCommand(e,t,o,r){var a;if(!te(e,t))return!1;const i=r.id,s=(a=r.states)==null?void 0:a.includes("checked");let l=!1;if(i==="unordered-list"&&(s?kc(e,t):this.convertToList(e,t,"unordered"),l=!0),i==="ordered-list"&&(s?kc(e,t):this.convertToList(e,t,"ordered"),l=!0),i==="check-list"&&(s?kc(e,t):this.convertToList(e,t,"unchecked"),l=!0),i==="quoted"){const h=e.getBlockData(t).quoted;e.updateBlockData(t,{quoted:h?void 0:!0}),l=!0}if(i==="link"){const d=Ef(e);d==null||d.disableTextToolbar(),d==null||d.hide(),setTimeout(()=>{d==null||d.enableTextToolbar()},1e3),this.convertLink(e,o,t),l=!0}return l}}const nF={left:du,right:Up,center:zp};class oF{constructor(e){m(this,"id","BlockAlignProvider");this.editor=e}applyAlignStyle(e,t,o){Object.keys(nF).includes(o)?e.updateBlockData(t,{align:o}):e.updateBlockData(t,{align:null})}isChecked(e,t){return e.align===t}getAvailableCommands(e,t,o){if(te(e,t)){const r=ie(t),i=Se(t),s=Lo(e,t),l=e.getBlockData(t),a=d=>{var p;const h=k("span",["toolbar-item-name-container"],null);for(const C of d.children)if((p=C.states)!=null&&p.includes("checked"))return h.innerHTML=C.icon||du,h;return h.innerHTML=du,h};return[{id:"align",name:L.t("commands.alignGroup"),blockId:r,blockType:i,blockKind:s,groupIndex:700,dropdown:!0,element:a,manualShowChildren:!0,childrenPlacement:"bottom-start",defaultCheckedChildren:["align-left"],children:[{id:"align-left",name:L.t("commands.alignLeft"),icon:du,states:this.isChecked(l,"left")?["checked"]:[]},{id:"align-center",name:L.t("commands.alignCenter"),icon:zp,states:this.isChecked(l,"center")?["checked"]:[]},{id:"align-right",name:L.t("commands.alignRight"),icon:Up,states:this.isChecked(l,"right")?["checked"]:[]}],childrenType:"menu"}]}return[]}executeCommand(e,t,o,r){if(!te(e,t))return!1;if(r.id.startsWith("align")){const i=r.id.replace(/^align-/,"");return this.applyAlignStyle(e,t,i),!0}return!1}}function rF(n){const t=n.selection.range;if(t.isCollapsed()||t.start.blockId!==t.end.blockId||!t.start.isSimple()||!t.end.isSimple()||t.end.offset-t.start.offset!==1)return!1;const o=n.getBlockById(t.start.blockId);return Ha(n,o,t.start.offset).charType==="box"}const iF=D("toolbar-handler"),sF={id:"",name:"",type:"separator"};class wc{constructor(e){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,"handleButtonClick",(e,t)=>{this.toolbarType==="text"?(this.editor.editorCommandProviders.executeCommand(this.editor.selection.range,t,{}),this.showTextToolbar("click")):this.hoveringBlock&&DO(this.editor,this.hoveringBlock,this.hoveringTextChild,t)});m(this,"handleClose",()=>{Qp(this.editor)&&this.editor.focus()});m(this,"handleClosing",(e,t)=>{if(this.toolbarType==="object"){const o=B5(t);if(this.hoveringBlock===o)return!1}return!0});m(this,"handleDocumentMouseDown",e=>{e.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",(e,t,o,r)=>{if(!(this.hoveringBlock===e&&this.hoveringTextChild===t)&&(this.hoveringBlock=e,this.hoveringTextChild=t,!(this.toolbar.isVisible&&this.toolbarType==="text"))){if(!e){this.toolbar.close("fromHover");return}this.showObjectToolbar(r)}});m(this,"handleSelectionChange",Mt.default(e=>{var o;if(g(iF,e===this.editor,"editor mismatch"),e.selection.range.isCollapsed()||this.mouseDown){if(this.toolbarType==="object"){const r=(o=this.toolbar.tippyInstance)==null?void 0:o.reference,i=this.editor.selection.focusedBlock;if(r&&et(r,i))return}this.toolbar.close("selectionChange"),this.oldRange=null;return}if(!this.editor.isWritable()){this.toolbar.close("selectionChange"),this.oldRange=null;return}if(e.selection.range.getSelectedBlocks().length===0){this.toolbar.close("selectionChange"),this.oldRange=null;return}this.oldRange&&this.oldRange.isEqual(e.selection.range)||(this.oldRange=e.selection.range,this.showTextToolbar("selectionChange"))},50));this.editor=e;const t=e.options.componentsOptions.popover;this.toolbar=new mu([],void 0,{tooltipId:e.clientId,id:"editor-toolbar",overflowBoundary:t==null?void 0:t.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(),e.addListener("selectionChanged",this.handleSelectionChange),Ct.get(e).addListener("childChange",this.handleHoveringBlockChildChange),Ct.get(e).addFilter(this),e.editorCommandProviders.registerCommandProvider(new MO(e)),e.editorCommandProviders.registerCommandProvider(new tF(e)),e.editorCommandProviders.registerCommandProvider(new oF(e))}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),Ct.get(this.editor).removeListener("childChange",this.handleHoveringBlockChildChange)}isInBlock(e,t){return e!==this.hoveringBlock?!1:!!(t.target&&t.target instanceof Node&&this.toolbar.popper&&et(this.toolbar.popper,t.target))}bindEvents(){document.addEventListener("mousedown",this.handleDocumentMouseDown)}unbindEvents(){document.removeEventListener("mousedown",this.handleDocumentMouseDown)}update(e){this.showTextToolbar(e)}showTextToolbar(e){var S,x;if(this._disableTextToolbar||!this.editor.isWritable())return;const o=this.editor.selection.range.getSelectedBlocks();if(o.length===0)return;const r=o[0];if(!r)return;if(o.length===1&&It(r.block)){e==="click"&&this.showObjectToolbar(null);return}if(rF(this.editor))return;if(oe(r.block)===this.editor.rootContainer&&be(r.block)===0){this.toolbar.close("selectionChange");return}const i=this.editor.editorCommandProviders.getCommands(this.editor.selection.range),s=new Map;i.forEach(_=>{const R=_.groupIndex,H=s.get(R);H?H.push(_):s.set(R,[_])});const l=[[]],a=Array.from(s.entries()).sort((_,R)=>_[0]-R[0]);for(let _=0;_<a.length;_++){const[,R]=a[_];if(R.length===0)continue;let H=l[l.length-1];H.length>0&&H[H.length-1].groupIndex!==R[R.length-1].groupIndex&&(H=[],l.push(H)),H.push(...Bf(R))}if(l.length===0){this.toolbar.close("selectionChange");return}this.toolbarType="text";const d=[];if(l.forEach((_,R)=>{const H=_.sort((z,Q)=>{var ee,fe;return((ee=z.order)!=null?ee:0)-((fe=Q.order)!=null?fe:0)});d.push(...H),R!==l.length-1&&d.push(sF)}),d.length===0){this.toolbar.close("selectionChange");return}this.toolbar.updateItems(d);const h=o[o.length-1],p=!this.editor.selection.range.isReverse()&&h!==r,C=p?h:r,v=kO(this.editor,C),B=Zr(this.editor,C.block,"editor-quick-menu",v);this.toolbar.manualShow(B,{placement:p?"bottom":"top",offset:[0,p?5:10]}),(x=(S=this.toolbar.tippyInstance)==null?void 0:S.popperInstance)==null||x.update()}showObjectToolbar(e){var l,a,d;if(!this.hoveringBlock||this.mouseDown)return;const t=this.hoveringBlock,o=this.hoveringTextChild,{commands:r,element:i}=IO(this.editor,t,o);if(!r.length||!i){this.toolbar.close("fromHover");return}this.toolbarType="object",this.toolbar.isVisible&&((a=(l=this.toolbar)==null?void 0:l.tippyInstance)==null?void 0:a.reference)!==i&&this.toolbar.close("fromHover");const s=()=>{let h;const p=i.getClientRects(),C=[];if(Array.from(p).forEach(v=>{const{y:B}=v;C.includes(B)||C.push(B)}),C.length>1){if(h=o?p[p.length-1]:p[0],e)for(let v=0;v<p.length;v++){const B=p[v],S=new DOMRect(B.x-4,B.y-4,B.width+8,B.height+8);if(S.x<e.clientX&&e.clientX<S.right&&S.y<e.clientY&&e.clientY<S.bottom){h=B;break}}}else{if(h=i.getBoundingClientRect(),o){const v=o.getBoundingClientRect();return new DOMRect(v.x,v.y,v.width,v.height)}return new DOMRect(p[0].x,p[0].y,p[0].width,p[0].height)}if(e){const v=h.y,B=e.clientX;return new DOMRect(B,v,10,h.height)}return h};this.toolbar.updateItems(r),this.toolbar.isVisible||(this.toolbar.manualShow(i,{placement:o?"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(e){return e.addCustom("toolbar-handler",t=>new wc(t))}static get(e){return e.getCustom("toolbar-handler")}}function Of(n,e,t){n.getBlockData(e).heading===t?n.updateBlockData(e,{heading:null}):n.updateBlockData(e,{heading:t})}function q7(n,e,t){["left","center","right"].includes(t)?n.updateBlockData(e,{align:t}):n.updateBlockData(e,{align:null})}function O0(n,e){const o=n.getBlockData(e).quoted;n.updateBlockData(e,{quoted:o?void 0:!0})}function _0(n,e){return!!(n[e]||n.level&&(n.ordered===!0&&!n.checkbox&&e==="ordered-list"||n.ordered===!1&&!n.checkbox&&e==="unordered-list")||e==="check-list"&&n.checkbox)}function F0(n,e,t){if(!n.selection.range.focus.isSimple())return;const r=n.getBlockData(e);let i;switch(t){case"unordered-list":i=_0(r,"unordered-list")?void 0:"unordered";break;case"ordered-list":i=_0(r,"ordered-list")?void 0:"ordered";break;case"check-list":i=_0(r,"check-list")?void 0:"unchecked";break}if(i){const s=Ch(n,e,"list",{offset:0,data:{listType:i}});s&&n.undoManager.runInGroup(()=>{const l=be(e),a=oe(e);n.deleteBlock(e),n.insertBlock(ce(a),l,s.blockData)})}else kc(n,e)}const lF=Object.freeze(Object.defineProperty({__proto__:null,applyHeadingStyle:Of,applyAlignStyle:q7,applyQuoteStyle:O0,applyList:F0},Symbol.toStringTag,{value:"Module"})),cF=[Op,_p,Fp,Pp,Np,$p,Hp,jp],aF={Unordered:xv,Ordered:Iv,Checkbox:Bv,Quote:Ev};function G7(n,e){const t=n;t.blockOptions=e,t.itemType="insert-block",n.children&&n.children.forEach(o=>G7(o,e))}function uF(){return{name:"basic",insertBlockCommandItems:[{id:"text",icon:hu,name:L.t("commands.text"),order:0,group:"basics",value:"text"}]}}function P0(n=1){var r;const e={name:"basic",insertBlockCommandItems:[]};let t=xf();t<=4?t=5:t<8&&(t+=1);let o=n;for(;o<=t;){const i=`heading-${o}`;(r=e.insertBlockCommandItems)==null||r.push({id:i,icon:cF[o-1],name:L.t("quickMenu.basic.heading.title",{heading:String(o)}),order:o,group:"basics",value:String(o),subText:An(i)}),o++}return e}function dF(){const n={name:"basic",insertBlockCommandItems:[]};return["Unordered","Ordered","Checkbox","Quote"].forEach((t,o)=>{var i;const r=`insert-${t.toLocaleLowerCase()}`;(i=n.insertBlockCommandItems)==null||i.push({id:r,name:L.t(`quickMenu.basic.${t.toLocaleLowerCase()}`),icon:aF[t],value:t.toLocaleLowerCase(),group:"basics",order:10+o,subText:An(r)})}),n}class Z7{constructor(e){this.withPlainText=e}getCommands(){const e=uF(),t=P0(),o=dF();return[...this.withPlainText?e.insertBlockCommandItems||[]:[],...t.insertBlockCommandItems||[],...o.insertBlockCommandItems||[]]}updateBlock(e,t,o,r){const{value:i,id:s}=r;return s.startsWith("heading-")?Of(e,o,Number.parseInt(i!=null?i:"1",10)||1):i==="ordered"||i==="unordered"||i==="checkbox"?F0(e,o,{ordered:"ordered-list",unordered:"unordered-list",checkbox:"check-list"}[i]):i==="quote"&&O0(e,o),null}async handleUpdateBlockCore(e,t){const o=e.getBlockByIndex(t.containerId,t.blockIndex);return this.updateBlock(e,t.containerId,o,t.item)}async handleInsertEmptyBlockCore(e,t){const{containerId:o,blockIndex:r}=t,i=e.insertTextBlock(void 0,o,r);return this.updateBlock(e,t.containerId,i,t.item)}async executeCommand(e,t,o){if(o.from==="quick-menu"){const r=e.getBlockById(o.blockId),i=e.getParentContainer(r),s=ce(i),l=e.getBlockIndex(r);e.undoManager.runInGroup(()=>this.handleUpdateBlockCore(e,{item:t,containerId:s,blockIndex:l})),e.focus()}else o.from==="block-menu"&&(e.undoManager.runInGroup(()=>this.handleInsertEmptyBlockCore(e,{item:t,containerId:o.containerId,blockIndex:o.blockIndex})),e.focus());return null}}const Q7={basics:100,system:200,common:300,thirdParty:400};class N0{constructor(){m(this,"dataUrl","");m(this,"error",null)}destroy(){}setDataUrl(e){this.error=null,this.dataUrl=e}setError(e){this.dataUrl="",this.error=e}}const hF=D("mathjax-converter"),fF="MathJax-script";async function mF(n){var o;window.MathJax||(window.MathJax={options:{skipHtmlTags:["script","noscript","style","textarea","pre","code","annotation","annotation-xml","body"]}});const e=n.getComponentOptions("mathjax"),t=((o=e==null?void 0:e.cdn)==null?void 0:o.mathjax)||"https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js";await ws(t,fF)}function gF(){try{window.MathJax&&window.MathJax.texReset()}catch{}}async function Y7(n,e){const t="mathjax2Svg";try{await To.lock(t),gF(),await mF(n);const o=await window.MathJax.tex2svgPromise(e),r=o.querySelector("merror");if(r)throw new Error(r.textContent);return o.querySelector("svg").outerHTML}catch(o){throw hF.error(o),o}finally{To.release(t)}}async function J7(n,e){const t=await Y7(n,e);return t?await Vm(t,"image/svg+xml"):""}async function $0(n,e){const o=await Y7(n,e),r=new File([o],"math.svg");return(await n.doc.uploadResource(r)).resourceId}const K7=D("edit-mathjax");class pF{constructor(){m(this,"editMathjaxPopup",null);m(this,"onChange",null);m(this,"tex","");m(this,"observer",null);m(this,"handleClose",e=>{var o;const t=e.content.querySelector("textarea");if(t){const r=t.value;r!==this.tex&&((o=this.onChange)==null||o.call(this,r,!0))}});m(this,"handleKeyup",e=>{var t;e.isComposing||(e.key==="Escape"&&((t=this.editMathjaxPopup)==null||t.close("cancelBar")),this.handleChange(e.target.value))});m(this,"handleChange",Mt.default(e=>{var t;(t=this.onChange)==null||t.call(this,e,!1)},300))}editMathjax(e,t,o){if(!this.editMathjaxPopup)this.editMathjaxPopup=new fu(this.createPopupContent(t));else{const r=this.getTextarea();r.value=t}this.tex=t,this.editMathjaxPopup.manualShow(e,{theme:"light"}),this.editMathjaxPopup.removeAllListeners("close"),this.editMathjaxPopup.addListener("close",this.handleClose),this.onChange=o}createPopupContent(e){const t=k("textarea",["mathjax-editor-textarea"],null);return t.value=e,t.addEventListener("keyup",this.handleKeyup),this.textareaWatcher(t),t}textareaWatcher(e){const t=e;t.onblur=()=>{var r;(r=this.editMathjaxPopup)!=null&&r.isVisible&&e.focus()};const o=()=>{setTimeout(()=>{e.focus()})};this.observer=new IntersectionObserver(o,{}),this.observer.observe(e)}getTextarea(){g(K7,this.editMathjaxPopup,"no exists mathjax editor popup");const e=this.editMathjaxPopup.content.querySelector("textarea");return g(K7,e,"no textarea"),e}destroy(){var e,t;this.onChange=null,(e=this.observer)==null||e.disconnect(),(t=this.editMathjaxPopup)==null||t.removeAllListeners()}}function X7(n,e,t,o){n.addCustom("mathjax-editor",()=>new pF).editMathjax(e,t.trim(),o)}function e9(){return{insert:" ",attributes:{id:K(),box:!0,type:"math",tex:" ",src:"",created:Date.now()}}}function _f(n,e){const t=n.getBoxData(e),o=ne(e);if(!o)return;const r=Fs(o,e);n.selection.selectBlock(o,r.start,r.end);const i=async(s,l)=>{if(!s.trim()){n.updateBoxData({...t,tex:s,src:null});return}try{await To.lock("convertAndUploadMathjax");const a=await $0(n,s);n.updateBoxData({...t,tex:s,src:a})}catch(a){const d=n.getBoxData(e);n.addCustom(`mathjax-box-${d.id}`,()=>new N0).setError(a),n.updateBoxData({...t,tex:s,src:""})}finally{To.release("convertAndUploadMathjax"),l&&n.focus()}};X7(n,e,t.tex,i)}const t9=D("mathjax-box");function H0(n,e){n.selection.updateSelection(null);const t=e.target;!t||!(t instanceof HTMLElement)||n.domEvents.removeEventListener(t,null,H0)}async function CF(n,e,t){try{if(!e.tex.trim())return;const o=await J7(n,e.tex),r=n.findBoxById(e.id);if(!r)return;const i=eg(r);i.innerHTML="";const s=k("img",["mathjax"],i);s.src=o,t.setDataUrl(o),n.domEvents.addEventListener(s,"load",H0)}catch(o){t.setError(o);const r=n.findBoxById(e.id);if(!r)return;const i=r.querySelector(".mathjax-tex-text");W(i,"mathjax-error"),i.innerText=o.message,n.selection.updateSelection(null)}}function AF(n,e,t,o){const r=o,i=n.addCustom(`mathjax-box-${r.id}`,()=>new N0);if(r.src||i.dataUrl){const a=k("img",["mathjax"],t);a.src=n.doc.buildResourceUrl(r.src||i.dataUrl),n.domEvents.addEventListener(a,"load",H0);return}const s=["mathjax-tex-text"];let l=r.tex;l.trim()?i.error&&(l=i.error.message,s.push("mathjax-error")):l=L.t("mathjax.emptyText"),k("span",s,t,l),CF(n,r,i)}function bF(n,e){const t={id:K(),box:!0,type:"math",tex:e,src:"",created:Date.now()};return $0(n,e).then(o=>{if(!n.findBoxById(t.id))return;const i={...t,src:o};n.updateBoxData(i)}).catch(o=>{t9.error(`failed to convert and upload mathjax: ${JSON.stringify(o)}`)}),t}function vF(n,e,t,o){const r=e;return o==="text"?r.tex:o==="markdown"?` $${r.tex}$ `:r.src?`<img src="${n.doc.buildResourceUrl(r.src,{withToken:!0})}" />`:`<code>$${r.tex}$</code>`}function yF(n,e,t){const o=ne(e);g(t9,o,"failed to get block"),!(n.readonly||!n.isBlockWritable(o))&&_f(n,e)}function kF(){return{abstract:L.t("mathjax.abstract")}}const n9={boxType:"math",updateBoxContent:AF,convertFrom:bF,convertTo:vF,handleClickBox:yF,getBoxProperties:kF};async function wF(n,e,t){try{const o=e.embedData,r=await J7(n,o.mathjaxText),i=n.findBlockById(e.id);if(!i)return;const s=Le(i);s.innerHTML="";const l=k("img",["mathjax"],s);l.src=r,t.setDataUrl(r)}catch(o){t.setError(o)}}function BF(n,e){if(n.readonly||!e.target||!(e.target instanceof Node))return;const t=ne(e.target);if(!t||!It(t)||fn(t)!=="math")return;const o=Le(t),r=o.querySelector("img")||o.querySelector("span.mathjax-tex-text");if(!r||!et(r,e.target))return;const s=n.getBlockData(t).embedData;X7(n,r,s.mathjaxText,async l=>{const a=await $0(n,l),d={mathjaxText:l,src:a};n.updateEmbedData(t,d)})}function EF(n,e,t){const o=t.embedData,r=n.addCustom(`mathjax-block-${t.id}`,()=>new N0);if(n.domEvents.addEventListener(e,"click",BF),!o.mathjaxText.trim()){k("span",["mathjax-tex-text"],e,L.t("mathjax.emptyText"));return}if(o.src||r.dataUrl){const i=k("img",["mathjax"],e);i.src=n.doc.buildResourceUrl(o.src||r.dataUrl);return}r.error,k("span",["mathjax-tex-text"],e,o.mathjaxText),wF(n,t,r)}function xF(n,e,t){if(!te(n,e))return null;const o=n.getBlockString(e).trim();if(!o||!o.startsWith("$$")||!o.endsWith("$$"))return null;const r=$m(o,"$");if(!r)return null;const i={mathjaxText:r,src:""};return{blockData:{id:K(),type:"embed",embedType:"math",embedData:i}}}function IF(n){return{name:"Mathjax"}}function TF(n,e){var o;const t=Le(e);n.domEvents.removeAllListeners(t),n.findCustom("mathjax-editor")&&((o=n.getCustom("mathjax-editor").editMathjaxPopup)==null||o.close("cancelBar"))}function SF(n,e,t,o){const r=e.embedData;return o==="html"?`<img src="${n.doc.buildResourceUrl(r.src,{withToken:!0})}" />`:o==="markdown"?`
409
409
  $$${r.mathjaxText}$$
410
- `:r.mathjaxText}function DF(){return{abstract:L.t("mathjax.abstract")}}const LF={embedType:"math",createEmbedContent:EF,getOptions:IF,convertFrom:xF,handleDeleteBlock:TF,convertTo:SF,getBlockProperties:DF},woe="",MF={mathjax:{emptyText:"\u7A7A\u7684\u516C\u5F0F",abstract:"\u516C\u5F0F"}},RF={mathjax:{emptyText:"Empty formula",abstract:"Formula"}},OF={mathjax:{emptyText:"\u6570\u5F0F\u306A\u3057",abstract:"\u6570\u5F0F"}};L.mergeLang({"zh-CN":MF,"en-US":RF,"ja-JP":OF});function _F(n,e,t,o){const r=n.getBlockByIndex(e,t),i=n.getBlockText(r),{left:s}=Tn(i,o);if(!st(s).endsWith("$$$$"))return!1;const a=o-4,d=o,h={id:K(),box:!0,type:"math",tex:" ",src:"",created:Date.now()};return n.undoManager.runInGroup(()=>{n.deleteTextFromBlock(r,a,d-a),n.insertBoxToBlock(r,a,h),setTimeout(()=>{const p=n.getBoxById(h.id);_f(n,p)})}),!0}class FF{handleAfterInsertText(e,t,o,r,i){return!!(i===" "&&_F(e,t,o,r))}}const Bc=D("inline-box-items");function PF(n,e,t){return n.undoManager.runInGroup(()=>{var s;let o=n.getBlockByIndex(e,t);ut(n,o)||(o=n.insertTextBlock([],e,t));const r=e9();n.setBlockText(o,[r]);const i=(s=r.attributes)==null?void 0:s.id;return g(Bc,i,"mathjax box id is empty"),setTimeout(()=>{const l=n.getBoxById(i);_f(n,l)},100),o})}function NF(n,e,t){let o=n.getBlockByIndex(e,t),r="bottom-start";return ut(n,o)||(r="top-start"),xu(n,{target:o,linkText:"",linkUrl:"",onFinished:(l,a)=>{n.undoManager.runInGroup(()=>{try{ut(n,o)||(o=n.insertTextBlock([],e,t));const d=uo(l,{link:a}),h=uo(" ",null),p=[d,h];n.insertTextToBlock(o,0,p),n.selection.selectBlock(o,rn(p)),n.focus()}catch(d){Bc.error(d)}})},onClose:()=>{n.focus()},placement:r}),o}function $F(n,e,t){return n.undoManager.runInGroup(()=>{var l;const o=n.getBlockByIndex(e,t),r=n.selection.range;g(Bc,Gr(r.start),"invalid block position");const i=e9();n.insertBoxToBlock(o,r.start.offset,i.attributes);const s=(l=i.attributes)==null?void 0:l.id;return g(Bc,s,"mathjax box id is empty"),setTimeout(()=>{const a=n.getBoxById(s);_f(n,a)},100),o})}function HF(n,e,t){const o=n.getBlockByIndex(e,t),r=n.selection.range;g(Bc,Gr(r.start),"invalid block position");const i=Vr(n,o,r);if(i.length===0)return;const s=i[0],l=Zr(n,o,"quick-menu-inline-link",s);xu(n,{target:l,linkText:"",linkUrl:"",onFinished:(h,p)=>{n.undoManager.runInGroup(()=>{try{const C=n.getBlockText(o),v=Qr(C,r.start.offset,h,{link:p});n.setBlockText(o,v),n.selection.selectBlock(o,r.start.offset+h.length),n.focus()}catch(C){Bc.error(C)}})},onClose:()=>{n.focus()},placement:"bottom-start"})}class o9{getCommands(){return[{id:"insert-math",name:L.t("quickMenu.inlineBox.math"),icon:aM,order:900,group:"common",subText:An("insert-math")},{id:"insert-link",name:L.t("quickMenu.inlineBox.link"),icon:wv,order:400,group:"common",subText:An("insert-link")}]}async handleUpdateBlockCore(e,t){switch(t.item.id){case"insert-math":return $F(e,t.containerId,t.blockIndex);case"insert-link":return HF(e,t.containerId,t.blockIndex);default:return null}}async handleInsertEmptyBlockCore(e,t){switch(t.item.id){case"insert-math":return PF(e,t.containerId,t.blockIndex);case"insert-link":return NF(e,t.containerId,t.blockIndex);default:return null}}async executeCommand(e,t,o){if(o.from==="quick-menu"){const r=e.getBlockById(o.blockId),i=e.getParentContainer(r),s=ce(i),l=e.getBlockIndex(r);e.undoManager.runInGroup(()=>this.handleUpdateBlockCore(e,{item:t,containerId:s,blockIndex:l}))}else o.from==="block-menu"&&e.undoManager.runInGroup(()=>this.handleInsertEmptyBlockCore(e,{item:t,containerId:o.containerId,blockIndex:o.blockIndex}));return null}}function jF(n,e={withPlainText:!1}){var i,s;const{withPlainText:t}=e,o=(s=(i=n.options.componentsOptions)==null?void 0:i.quickMenu)==null?void 0:s.commandProviders;if(!o)return[];const r=[];return[...o,new Z7(t),new o9].forEach(l=>{const a=l.getCommands(n);r.push(...a.map(d=>({...d,itemType:"insert-block",commandProvider:l})))}),r}function UF(n,e={withPlainText:!1}){const t=[];return n.editorBlocks.forEach(o=>{if(!o.getOptions)return;const r=o.getOptions(n);!r.insertBlockCommandItems||(r.insertBlockCommandItems.forEach(i=>{G7(i,r)}),t.push(...r.insertBlockCommandItems))}),t.push(...jF(n,e)),t}function j0(n,e={withPlainText:!1}){const t=UF(n,e),o=new Map;t.forEach(s=>{var d;const l=(d=s.group)!=null?d:"";let a=o.get(l);a?a.items.push(s):(a={group:l,order:s.groupOrder||Q7[l]||1e3,items:[s]},o.set(l,a))});const r=Array.from(o.values());r.sort((s,l)=>s.order-l.order),r.forEach(s=>{s.items.sort((l,a)=>{var d,h;return((d=l.order)!=null?d:0)-((h=a.order)!=null?h:0)})});const i=[];return r.forEach((s,l)=>{const a=`blockMenu.section.${s.group||"common"}`,d=L.t(a),h=d===a?s.group:d;i.push({id:`section-${l}`,name:h,type:"section",group:s.group,itemType:"insert-block"}),i.push(...s.items.map(p=>({...p})))}),i}function zF(n,e,t){const o=n.getFocusedBlock();if(!o)return;const r=n.getParentContainer(o),i=ce(r);let l=n.getBlockIndex(o);if(ut(n,o)||(l+=1),e.commandProvider){e.commandProvider.executeCommand(n,e,{from:"quick-menu",...t});return}!e.blockOptions||!e.blockOptions.handleInsertEmptyBlock||e.blockOptions.handleInsertEmptyBlock(n,{containerId:i,blockIndex:l,item:e})}const r9=D("quick-menu"),VF={id:"quick-menu",trigger:["/"]},WF=5;class Ff{constructor(e,t=VF){m(this,"suggest");m(this,"items");m(this,"maxHeading");m(this,"firstEmptyOffset",-1);m(this,"queryItems",async(e,t)=>{if(this.items.length===0?this.initMenuItems():this.refreshMenuItems(),t){const o=new Set,r=t.toLocaleLowerCase().replace(/^\s+|\s+$/g,""),i=this.items.filter(s=>{if(s.type==="section")return!0;if(s.name.toLocaleLowerCase().indexOf(r)!==-1||lR(s).toLocaleLowerCase().indexOf(r)!==-1)return o.add(s.group),!0;const l=`blockMenu.section.${s.group||"common"}`,a=L.t(l),d=a===l?s.group:a;return(d==null?void 0:d.toLocaleLowerCase().indexOf(r))!==-1?(o.add(s.group),!0):!1}).filter(s=>s.type==="section"?o.has(s.group):!0);return i.length?this.firstEmptyOffset=-1:this.handleEmptySearch(),i}return this.items});m(this,"onClose",()=>{this.firstEmptyOffset=-1});m(this,"onShow",(e,t,o,r)=>{const i=this.editor.getBlockByIndex(t,o);if(!lo(i)){const s=ne(oe(i));if(s&&Se(s)==="code")return!1}return!0});m(this,"onClickItem",(e,t)=>{const o=t;o.itemType==="insert-block"&&(g(r9,o.blockOptions||o.commandProvider,"invalid quick item, no block options or command provider"),g(r9,this.suggest.anchor,"invalid suggest, no anchor"),this.options.id==="empty-block-menu"&&this.editor.focus(),zF(this.editor,o,this.suggest.anchor))});this.editor=e,this.options=t,this.items=[],this.maxHeading=xf(),this.suggest=new Jp(e,{id:t.id||"quick-menu",trigger:t.trigger,needSpaceBeforeTrigger:!0,autoDeleteTrigger:!0,highlight:!0,onClose:this.onClose,onShow:this.onShow,onClickItem:this.onClickItem,queryItems:this.queryItems})}get menu(){return this.suggest.menu.menu}destroy(){this.suggest.destroy()}initMenuItems(){const e=j0(this.editor);this.items=e}refreshMenuItems(){let e=null,t=0;const o=xf();if(o!==this.maxHeading){const r=new Z7,s=r.getCommands().map(l=>({...l,itemType:"insert-block",commandProvider:r}));for(let l=0;l<this.items.length;l++)this.items[l].group==="basics"&&(e||(e=l),e&&t++);e&&t&&this.items.splice(e,t,...s),this.maxHeading=o}}handleEmptySearch(){const e=this.editor.selection.getFocusedPos();if(this.firstEmptyOffset===-1){if(e.isSimple()){const{offset:t}=e;this.firstEmptyOffset=t-1}}else if(e.isSimple()){const{offset:t}=e;t-this.firstEmptyOffset>WF&&(this.suggest.close(),this.firstEmptyOffset=-1)}}}class Pf{constructor(e){m(this,"instance");m(this,"mousedown",!1);m(this,"currentInstance",null);m(this,"attributeName",[]);m(this,"attributeDesc","");m(this,"observer",null);m(this,"observerCallback",null);m(this,"createContent",e=>{let t="",o=0;for(;o<this.attributeName.length&&!t;)e.hasAttribute(this.attributeName[o])&&(t=e.getAttribute(this.attributeName[o])||""),o++;const r=e.getAttribute(this.attributeDesc);if(!r)return t;const i=k("div",[],null);return k("span",[],i,t),r&&k("span",["editor-tooltip-desc"],i,r),i});m(this,"handleDocumentMouseDown",()=>{this.mousedown=!0,this.editor.domEvents.addEventListener(document,"mouseup",this.handleDocumentMouseUp)});m(this,"handleDocumentMouseUp",()=>{this.mousedown=!1,this.editor.domEvents.removeEventListener(document,"mouseup",this.handleDocumentMouseUp)});m(this,"handleShown",e=>{this.currentInstance&&this.hide(),this.currentInstance=e,this.createObserver()});m(this,"handleHidden",()=>{this.destroyObserver(),this.currentInstance=null});m(this,"handleShow",e=>{var r;const t=e.reference;if(!t||!et(document.body,t)||window.isDragging||this.mousedown)return!1;const o=Number.parseInt((r=t.getAttribute("data-tooltip-hide-at"))!=null?r:"",10);if(o&&Date.now()-o<1e3)return!1;if(e.reference){const i={};if(e.reference.hasAttribute("data-editor-tooltip-placement")&&(i.placement=e.reference.getAttribute("data-editor-tooltip-placement")||"top"),e.reference.hasAttribute("data-editor-tooltip-offset-x")||e.reference.hasAttribute("data-editor-tooltip-offset-y")){const l=e.reference.getAttribute("data-editor-tooltip-offset-x"),a=e.reference.getAttribute("data-editor-tooltip-offset-y");i.offset=[l?Number.parseInt(l,10):0,a?Number.parseInt(a,10):0]}e.reference.hasAttribute("data-editor-tooltip-maxwidth")&&(i.maxWidth=Number.parseInt(e.reference.getAttribute("data-editor-tooltip-maxwidth")||"350",10)),e.reference.hasAttribute("data-editor-tooltip-allow-markdown")&&(i.allowHTML=!0);const s=document.body;if(i.appendTo=this.fixContainerForFullscreen(s),Object.keys(i).length&&e.setProps(i),e.reference.hasAttribute(`data-editor-tooltip-${this.editor.clientId}-dynamic`)){const l=e.reference.getAttribute(`data-editor-tooltip-${this.editor.clientId}-dynamic`);e.setContent(l||"")}}return!0});this.editor=e;const t=e.clientId;this.attributeName=[`data-editor-tooltip-${t}`,`data-editor-tooltip-${t}-dynamic`,"data-editor-tooltip-common"],this.attributeDesc=`data-editor-tooltip-desc-${t}`,this.instance=Em.delegate(document.body,{theme:"editor-tooltip",maxWidth:400,delay:200,target:this.attributeName.map(o=>`[${o}]`).join(","),content:this.createContent,onShow:this.handleShow,onShown:this.handleShown,onHide:this.handleHidden}),e.domEvents.addEventListener(document,"mousedown",this.handleDocumentMouseDown)}visible(){var e;return(e=this.currentInstance)==null?void 0:e.state.isVisible}hide(){var e;(e=this.currentInstance)!=null&&e.state.isVisible&&this.currentInstance.hide()}destroy(){this.destroyObserver(),this.instance.destroy(),this.editor.domEvents.removeEventListener(document,"mousedown",this.handleDocumentMouseDown),this.editor.domEvents.removeEventListener(document,"mouseup",this.handleDocumentMouseUp)}createObserver(){this.destroyObserver();const e=this.currentInstance;if(!e||!e.reference)return;this.observerCallback=Mt.default(()=>{e.reference.closest("body")||(e.hide(),this.destroyObserver())},200),this.observer=new MutationObserver(this.observerCallback);const t=document.body,o={childList:!0,attributes:!1,subtree:!0};this.observer.observe(t,o)}destroyObserver(){this.observer&&(this.observer.disconnect(),this.observer=null),this.observerCallback&&(this.observerCallback.cancel(),this.observerCallback=null)}fixContainerForFullscreen(e){return e.closest("body")&&document.fullscreenElement&&!document.fullscreenElement.contains(e)?document.fullscreenElement:e}}const qF={"text/style-bold":"bold","text/style-italic":"italic","text/style-underline":"underline","text/style-strikethrough":"line-through","text/style-code":"code","text/style-sub":"subscript","text/style-super":"superscript"};function GF(n,e){const t=new Set(Object.keys(qF)),o=e.filter(i=>t.has(i.id));return Bf(o)}function Nf(n,e){if(!n.isWritable())return!1;const t=n.selection.range,o=n.editorCommandProviders.getCommands(t),i=GF(n,o).find(s=>s.id===`text/${e}`);return i?(n.editorCommandProviders.executeCommand(t,i,{}),wc.get(n).update("selectionChange"),!0):!1}const U0={"CtrlOrCmd+B":n=>Nf(n,"style-bold"),"CtrlOrCmd+I":n=>Nf(n,"style-italic"),"CtrlOrCmd+U":n=>Nf(n,"style-underline"),"CtrlOrCmd+D":n=>Nf(n,"style-strikethrough")},ZF={quickMenu:{basic:{heading:{title:"\u6807\u9898 {heading}",space:"{markdown}\u7A7A\u683C"},unordered:"\u65E0\u5E8F\u5217\u8868",ordered:"\u6709\u5E8F\u5217\u8868",checkbox:"\u5F85\u529E\u4E8B\u9879",quote:"\u5F15\u7528"},inlineBox:{math:"\u516C\u5F0F",link:"\u94FE\u63A5"}},link:{textLabel:"\u6587\u672C",urlLabel:"\u94FE\u63A5\u5730\u5740",textPlaceholder:"\u8BF7\u8F93\u5165\u6587\u672C",urlPlaceholder:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740",submitText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",edit:"\u7F16\u8F91",remove:"\u53D6\u6D88\u94FE\u63A5"},commands:{unordered:"\u65E0\u5E8F\u5217\u8868",ordered:"\u6709\u5E8F\u5217\u8868",check:"\u5F85\u529E\u5217\u8868",link:"\u94FE\u63A5",quote:"\u5F15\u7528",alignLeft:"\u5DE6\u5BF9\u9F50",alignRight:"\u53F3\u5BF9\u9F50",alignCenter:"\u5C45\u4E2D\u5BF9\u9F50",alignGroup:"\u5BF9\u9F50\u65B9\u5F0F",heading:"\u6807\u9898 {name}",headingGroup:"\u6807\u9898\u6837\u5F0F",text:"\u6B63\u6587"}},QF={quickMenu:{basic:{heading:{title:"Title {heading}",space:"{markdown}space"},unordered:"Bulleted list",ordered:"Numbered list",checkbox:"To-do list",quote:"Quote"},inlineBox:{math:"Formula",link:"Link"}},link:{textLabel:"Text",urlLabel:"Link address",textPlaceholder:"Please enter text",urlPlaceholder:"Please enter link",submitText:"Confirm",cancelText:"Cancel",edit:"Edit",remove:"Remove link"},commands:{unordered:"Bulleted list",ordered:"Numberer list",check:"To-do list",link:"Link",quote:"Quote",alignLeft:"Align left",alignRight:"Align right",alignCenter:"Center text",alignGroup:"Alignment",heading:"Title {name}",headingGroup:"Text style",text:"Text"}},YF={quickMenu:{basic:{heading:{title:"\u898B\u51FA\u3057{heading}",space:"{markdown}\u30B9\u30DA\u30FC\u30B9"},unordered:"\u7B87\u6761\u66F8\u304D\u30EA\u30B9\u30C8",ordered:"\u756A\u53F7\u4ED8\u304D\u30EA\u30B9\u30C8",checkbox:"\u30D0\u30C3\u30AF\u30ED\u30B0",quote:"\u5F15\u7528"},inlineBox:{math:"\u6570\u5F0F",link:"URL"}},link:{textLabel:"\u30C6\u30AD\u30B9\u30C8",urlLabel:"URL",textPlaceholder:"\u30C6\u30AD\u30B9\u30C8\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044",urlPlaceholder:"URL \u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044",submitText:"OK",cancelText:"\u30AD\u30E3\u30F3\u30BB\u30EB",edit:"\u7DE8\u96C6",remove:"\u30EA\u30F3\u30AF\u3092\u89E3\u9664"},commands:{unordered:"\u7B87\u6761\u66F8\u304D\u30EA\u30B9\u30C8",ordered:"\u756A\u53F7\u4ED8\u304D\u30EA\u30B9\u30C8",check:"\u30D0\u30C3\u30AF\u30ED\u30B0",link:"URL",quote:"\u5F15\u7528",alignLeft:"\u5DE6\u63C3\u3048",alignRight:"\u53F3\u63C3\u3048",alignCenter:"\u4E2D\u592E\u63C3\u3048",alignGroup:"\u5BF9\u9F50\u65B9\u5F0F",heading:"\u898B\u51FA\u3057{name}",headingGroup:"\u30BF\u30A4\u30C8\u30EB\u30B9\u30BF\u30A4\u30EB",text:"\u672C\u6587"}};L.mergeLang({"zh-CN":ZF,"en-US":QF,"ja-JP":YF});const Boe="";function Ys(n,...e){const t=mo(...e);return t.classList.remove("editor-button"),t.classList.add("editor-text-button"),n.append(t),t}function i9(n){const e=Ef(n);e==null||e.hide();const t=n.findCustom("table-border-bar");t==null||t.closeToolbar()}function JF(n){return k("div",["insert-column-button","drop-marker"],n)}const KF=D("row-height");function s9(n){const e=Te.fromTable(n),t=n.rows;g(KF,t.length===e.rowCount,"row count mismatch");const o=Array(e.rowCount).fill(0);for(let r=0;r<t.length;){let i=1,l=t[r].getBoundingClientRect().height,a=r+1;for(;a<t.length;){const d=t[a];if(d.cells.length!==0)break;i++,a++,l+=d.getBoundingClientRect().height}for(let d=0;d<i;d++)o[r+d]=l/i;r=a}return o}const XF=D("table-border-bar-dom");function l9(n){var a;const e=ne(n.contentElement);g(XF,e,"no block");const o=tt(e).querySelector(".table-border-bar-container.left"),i=Le(e).offsetLeft-fc,s=((a=n.scrollOptions.paddingLeft)!=null?a:0)+i,l=Math.min(n.contentElement.offsetLeft-i,n.rootElement.scrollLeft-s);o&&(o.style.left=`${-l}px`)}const Ki=D("table-border-bar-dom");function Ec(n,e){g(Ki,Ft(e),"invalid table block");const t=_t(e),o=br(n,e),r=tt(e),i=(p,C,v)=>{const B=k("div",["button-root",C],p),S=k("div",["button-container",C],B);B.setAttribute(`data-${C}-index`,`${v}`),S.setAttribute(`data-editor-tooltip-${n.clientId}`,C==="left"?L.t("table.insertRow"):L.t("table.insertCol")),k("span",["insert-indicator"],S),JF(S)},{selectedRows:s,selectedColumns:l}=Xp(n,e),a=()=>{const p=o.querySelector(".table-border-bar-container.top");g(Ki,p,"no top border bar container");const C=k("div",["table-border-bar-container","top"],null),v=k("div",["table-border-bar","top"],C),B=sO(t),x=Te.fromTable(t).colCount;n.selection.range.isSimple()&&i(v,"top",0);for(let _=0;_<x;_++){const R=_===x-1?B[_]+2:B[_],H=k("span",["table-border-bar-cell","top"],v);l.has(_)&&H.classList.add("selected"),H.setAttribute("data-top-index",`${_}`),H.style.width=`${R}px`,n.selection.range.isSimple()&&i(v,"top",_+1)}xa(p,C)},d=()=>{const p=r.querySelector(".table-border-bar-container.left");g(Ki,p,"no left border bar container");const C=k("div",["table-border-bar-container","left"],null),v=k("div",["table-border-bar","left"],C);k("span",["table-border-bar-cell","corner"],v);const B=s9(t);n.selection.range.isSimple()&&i(v,"left",0),Array.from(t.rows).forEach((S,x,_)=>{const R=k("span",["table-border-bar-cell","left"],v);s.has(x)&&R.classList.add("selected"),R.setAttribute("data-left-index",`${x}`);const H=x===_.length-1?B[x]+2:B[x];R.style.height=`${H}px`,n.selection.range.isSimple()&&i(v,"left",x+1)}),xa(p,C)};a(),d();const h=n.findCustom(Ar(e));h&&l9(h)}function c9(n,e){const t=e.target;if(!(t instanceof Element))return;const o=ne(t);g(Ki,o&&Ft(o),"invalid table block"),Ec(n,o),n.selection.caret.update()}function $f(n,e){const t=e.target;if(!(t instanceof Element))return;const o=ne(t);g(Ki,o&&Ft(o),"invalid table block");const r=t.closest(".button-root");if(r){if(r.classList.contains("top")){const i=parseInt(r.getAttribute("data-top-index")||"0",10);p7(n,o,i),Ec(n,o)}else if(r.classList.contains("left")){const i=parseInt(r.getAttribute("data-left-index")||"0",10);C7(n,o,i),Ec(n,o)}}}function Hf(n,e){var s;i9(n),e.preventDefault(),e.stopPropagation();let t=null,o,r;const i=l=>{var a;if(l.target instanceof HTMLElement&&o&&t&&r!==void 0){const d=ne(l.target),h=l.target.closest(".table-border-bar");if(d===t&&h){const p=parseInt((a=l.target.getAttribute(`data-${o}-index`))!=null?a:"0",10),C=Math.min(r,p),v=Math.abs(r-p)+1;xe(l.target,"top")&&o==="top"?vO(n,d,C,v,{reverse:!0}):xe(l.target,"left")&&o==="left"&&yO(n,d,C,v,{reverse:!0})}}l.type==="mouseup"&&(t=null,r=void 0,o=void 0,document.body.removeEventListener("mousemove",i),document.body.removeEventListener("mouseup",i))};e.target instanceof HTMLElement&&xe(e.target,"table-border-bar-cell")&&(t=ne(e.target),xe(e.target,"top")?o="top":xe(e.target,"left")&&(o="left"),o&&t&&(r=parseInt((s=e.target.getAttribute(`data-${o}-index`))!=null?s:"0",10),document.body.addEventListener("mousemove",i),document.body.addEventListener("mouseup",i)))}function a9(n){const e=n.selection.range,t=Cu(n,e);t&&Ec(n,t)}function eP(n,e){g(Ki,Ft(e),"invalid table block");const t=br(n,e),o=tt(e),r=k("div",["table-border-bar-container","top"],t),i=k("div",["table-border-bar-container","left"],o);Ec(n,e),n.domEvents.addEventListener(Le(e),"scroll",c9),n.domEvents.addEventListener(r,"click",$f),n.domEvents.addEventListener(i,"click",$f),n.domEvents.addEventListener(r,"mousedown",Hf),n.domEvents.addEventListener(i,"mousedown",Hf),n.addListener("afterClearSelection",a9)}function u9(n,e){if(!n.isWritable())return;if(br(n,e).querySelector(".table-border-bar-container")){Ec(n,e);return}eP(n,e)}function d9(n,e){g(Ki,Ft(e),"invalid table block");const t=br(n,e),o=tt(e),r=t.querySelectorAll(".table-border-bar-container"),i=o.querySelectorAll(".table-border-bar-container");r.forEach(s=>{n.domEvents.removeEventListener(s,"click",$f),n.domEvents.removeEventListener(s,"mousedown",Hf),s.remove()}),i.forEach(s=>{n.domEvents.removeEventListener(s,"click",$f),n.domEvents.removeEventListener(s,"mousedown",Hf),s.remove()}),n.domEvents.removeEventListener(Le(e),"scroll",c9),n.addListener("afterClearSelection",a9)}function tP(n,e){g(Ki,Ft(e),"invalid table block");const o=br(n,e).querySelector(".table-border-bar-container.top");return o?o.getBoundingClientRect().height:0}class nP{constructor(e,t){m(this,"toolbar");m(this,"handleSelectionChange",(e,t)=>{!e.isVisible||(t==="delete-columns"?(Gi(this.editor,this.tableBlock,!0,!0),Zi(this.editor,this.tableBlock,!0,!0)):t==="delete-rows"?(Gi(this.editor,this.tableBlock,!0,!1),Zi(this.editor,this.tableBlock,!0,!1)):(Gi(this.editor,this.tableBlock,!1),Zi(this.editor,this.tableBlock,!1)))});m(this,"handleClick",(e,t,o)=>{t.id==="delete-columns"?e0(this.editor.selection.range):t.id==="delete-rows"&&t0(this.editor.selection.range)});m(this,"handleToolbarClose",()=>{this.tableBlock&&Cu(this.editor,this.editor.selection.range)===this.tableBlock&&(Gi(this.editor,this.tableBlock,!1),Zi(this.editor,this.tableBlock,!1))});this.editor=e,this.tableBlock=t;const o=e.options.componentsOptions.popover;this.toolbar=new mu([],void 0,{id:"table-row-column-toolbar",overflowBoundary:o==null?void 0:o.overflowBoundary,refuseOverflow:!0,tooltipId:this.editor.clientId}),this.toolbar.addListener("selectionChange",this.handleSelectionChange),this.toolbar.addListener("click",this.handleClick),this.toolbar.addListener("close",this.handleToolbarClose)}close(){this.toolbar.close("cancelBar")}update(){var r,i,s;const{selectedColumns:e,selectedRows:t}=Xp(this.editor,this.tableBlock);if(!this.editor.isWritable())return;if(e.size>0&&t.size>0){this.toolbar.close("cancelBar");return}if(e.size===0&&t.size===0){this.toolbar.close("cancelBar");return}const o=Vr(this.editor,this.tableBlock,this.editor.selection.range)[0];if(!o){this.toolbar.close("cancelBar");return}if(e.size>0){const l={id:"delete-columns",name:L.t("table.deleteSelectCol"),icon:YL};this.toolbar.updateItems([l]);const a=Zr(this.editor,this.tableBlock,"table-row-column-delete",o);this.toolbar.manualShow(a,{placement:"top",offset:[0,5]})}else{const l={id:"delete-rows",name:L.t("table.deleteSelectRow"),icon:QL};this.toolbar.updateItems([l]);const h=tt(this.tableBlock).querySelector(".table-border-bar-container.left").getBoundingClientRect(),p=new DOMRect(Math.max(h.left,o.left-fc),o.top,fc,o.height),C=Zr(this.editor,this.tableBlock,"table-row-column-delete",p);this.toolbar.manualShow(C,{placement:"left",offset:[0,5]});const v=this.editor.options.componentsOptions.popover;(r=this.toolbar.tippyInstance)==null||r.setProps({popperOptions:{modifiers:[{name:"flip",options:{boundary:v==null?void 0:v.overflowBoundary,fallbackPlacements:["left","right"]}}]}})}(s=(i=this.toolbar.tippyInstance)==null?void 0:i.popperInstance)==null||s.update()}destroy(){this.toolbar.destroy(),this.toolbar.removeAllListeners()}}const z0=D("table-border-bar");class oP{constructor(e,t){m(this,"toolbar");m(this,"resizeObserver",null);m(this,"handleReadonlyChanged",e=>{e.isWritable()?this.update():d9(this.editor,this.tableBlock)});m(this,"handleBlockUpdated",()=>{var e;(e=this.resizeObserver)==null||e.disconnect(),setTimeout(()=>{var o;const t=this.editor.getBlockById(ie(this.tableBlock));(o=this.resizeObserver)==null||o.observe(_t(t))})});m(this,"handleScroll",()=>{var e;(e=this.toolbar)==null||e.update()});m(this,"handleTableResize",()=>{!this.editor.isWritable()||this.update()});this.editor=e,this.tableBlock=t,g(z0,this.tableBlock,"no table block"),z0.debug("create table border bar"),u9(this.editor,this.tableBlock),this.resizeObserver=new vs(this.handleTableResize),this.resizeObserver.observe(_t(this.tableBlock));const o=e.getComponentOptions("table");o!=null&&o.hideToolbar||(this.toolbar=new nP(this.editor,this.tableBlock)),this.editor.addListener("readonlyChanged",this.handleReadonlyChanged)}close(){var e;(e=this.toolbar)==null||e.close()}destroy(){var e,t;z0.debug("destroy table border bar"),(e=this.resizeObserver)==null||e.disconnect(),this.resizeObserver=null,d9(this.editor,this.tableBlock),(t=this.toolbar)==null||t.destroy(),this.editor.removeListener("readonlyChanged",this.handleReadonlyChanged)}update(){var e;u9(this.editor,this.tableBlock),(e=this.toolbar)==null||e.update()}}const rP=D("table-border-bar");class iP{constructor(e){m(this,"activeTableBar",null);m(this,"handleBlockDeleted",(e,t)=>{!this.activeTableBar||(t===this.activeTableBar.tableBlock||et(t,this.activeTableBar.tableBlock))&&(this.activeTableBar.destroy(),this.activeTableBar=null)});m(this,"handleSelectionChanged",e=>{setTimeout(()=>{var r;const t=e.selection.range,o=Cu(e,t);((r=this.activeTableBar)==null?void 0:r.tableBlock)!==o&&this.activeTableBar&&this.hide(),o&&this.show(o)})});m(this,"handleScroll",()=>{var e;(e=this.activeTableBar)==null||e.handleScroll()});this.editor=e,this.editor.addListener("blockDeleted",this.handleBlockDeleted),this.editor.addListener("selectionChanged",this.handleSelectionChanged)}destroy(){this.editor.removeListener("blockDeleted",this.handleBlockDeleted),this.editor.removeListener("selectionChanged",this.handleSelectionChanged)}show(e){this.activeTableBar?(this.activeTableBar.tableBlock!==e&&this.hide(),this.activeTableBar.update()):this.activeTableBar=new oP(this.editor,e)}update(){var e;(e=this.activeTableBar)==null||e.handleBlockUpdated()}closeToolbar(){var e;(e=this.activeTableBar)==null||e.close()}hide(){!this.activeTableBar||(g(rP,this.activeTableBar,"no active table bar"),this.activeTableBar.destroy(),this.activeTableBar=null)}}function h9(n,e){const t=n.addCustom("table-border-bar",o=>new iP(o));e==="update"&&t.update()}const Mn=D("table-cell-menu"),sP="style-bg-color-";class lP{constructor(e){m(this,"activeTableBlock",null);m(this,"targetButton",null);m(this,"manualMenu",null);m(this,"colorPaletteItem",null);m(this,"handlePrevent",(e,t)=>{t.stopPropagation()});m(this,"handleReadonlyChanged",e=>{e.isWritable()||this.hide()});m(this,"handleSelectionChanged",e=>{const t=e.selection.range,o=Cu(e,t);if(this.hide(),this.activeTableBlock!==o&&(this.activeTableBlock=o),this.activeTableBlock){const r=Te.fromBlock(this.activeTableBlock),i=t.isReverse()?t.start:t.end;let s=null;i instanceof Oo?e.getBlockById(i.blockId)===this.activeTableBlock?s=r.getCellByContainerId(i.childContainerId):s=this.getCellByChildBlockId(r,i.blockId):i.blockId!==this.activeTableBlock.id&&(s=this.getCellByChildBlockId(r,i.blockId)),s&&this.editor.isWritable()&&this.showCellMenuButton(s)}});m(this,"handleBeforePopupPalette",()=>{var t;const e=this.getSelectedBkgColorIndex();(t=this.colorPaletteItem)==null||t.palette.setColor("backgroundColor",e)});m(this,"createBkgColorItem",()=>{const e=k("div",["cell-background-color-item"],null);k("span",[],e,L.t("table.cellBackground"));const t=this.getSelectedBkgColorIndex();k("button",["item-button"],e).setAttribute("data-color-index",`${t}`);const r=k("span",["item-sub-indicator"],e);return r.innerHTML=Av,e});m(this,"handleCommand",e=>{var r;g(Mn,this.activeTableBlock,"no target table block");const t=((r=e.states)==null?void 0:r.includes("checked"))||!1,o=e.value;switch(e.id){case"delete-select-row":t0(Jv(this.editor,this.activeTableBlock,!1));break;case"delete-select-col":e0(Jv(this.editor,this.activeTableBlock,!0));break;case"merge-cell":Zv(this.editor.selection.range);break;case"split-cell":this.handleSplitCell();break;case"row-title":this.handleRowTitle(t);break;case"col-title":this.handleColTitle(t);break;case"stripe-style":this.handleStripeStyle(t);break;case"hide-border":TR(this.editor,this.activeTableBlock,o==="show-border");break;case"show-chart":RR(this.editor,this.activeTableBlock,o==="show-chart"),u0(this.editor,this.activeTableBlock,{updateNow:!0});break}});m(this,"handleToolbarClose",()=>{this.targetButton&&re(this.targetButton,"active"),this.activeTableBlock&&Cu(this.editor,this.editor.selection.range)===this.activeTableBlock&&(Gi(this.editor,this.activeTableBlock,!1),Zi(this.editor,this.activeTableBlock,!1)),this.editor.focus()});m(this,"handleSelectionChange",(e,t)=>{!e.isVisible||(g(Mn,this.activeTableBlock,"no target table block"),t==="cell-background-color"&&this.handleBeforePopupPalette(),t==="delete-select-row"?(Gi(this.editor,this.activeTableBlock,!0,!1),Zi(this.editor,this.activeTableBlock,!0,!1)):t==="delete-select-col"?(Gi(this.editor,this.activeTableBlock,!0,!0),Zi(this.editor,this.activeTableBlock,!0,!0)):(Gi(this.editor,this.activeTableBlock,!1),Zi(this.editor,this.activeTableBlock,!1)))});m(this,"handleClick",(e,t)=>{var o;g(Mn,this.activeTableBlock,"no target table block"),g(Mn,this.targetButton,"no target button"),i9(this.editor),xe(this.targetButton,"active")?(re(this.targetButton,"active"),(o=this.manualMenu)==null||o.close("clickItem")):(W(this.targetButton,"active"),this.manualMenu?this.manualMenu.updateItems(this.createCommandMenu()):(this.manualMenu=new Vs(this.createCommandMenu()),this.manualMenu.on("click",(r,i)=>{var s;this.handleCommand(i),(s=this.manualMenu)==null||s.close("clickItem")}),this.manualMenu.on("selectionChange",this.handleSelectionChange),this.manualMenu.on("close",this.handleToolbarClose)),this.manualMenu.manualShow(this.targetButton,{placement:"right-start"})),t.stopPropagation()});this.editor=e,this.editor.addListener("selectionChanged",this.handleSelectionChanged),this.editor.addListener("readonlyChanged",this.handleReadonlyChanged)}destroy(){var e,t;this.activeTableBlock=null,this.targetButton=null,this.editor.removeListener("selectionChanged",this.handleSelectionChanged),this.editor.removeListener("readonlyChanged",this.handleReadonlyChanged),(e=this.manualMenu)==null||e.destroy(),(t=this.colorPaletteItem)==null||t.destroy()}hide(){var e;(e=this.manualMenu)==null||e.close("cancelBar"),this.targetButton&&(re(this.targetButton,"active"),this.targetButton.style.display="none")}getCellByChildBlockId(e,t){let o=this.editor.getBlockById(t);for(;o;){const r=o.closest("td");g(Mn,r,"no parent cell");const i=ne(r);if(g(Mn,i,"no parent block"),_t(i)===e.table)return e.getCellByCellElement(r);o=i}return g(Mn,!1,"filed to get cell by child block id"),null}createTargetButton(e){this.targetButton?e.querySelector(`:scope > .${s0}`)||e.appendChild(this.targetButton):(this.targetButton=k("button",[s0],e),this.targetButton.innerHTML=ff,this.editor.domEvents.addEventListener(this.targetButton,"click",this.handleClick),this.editor.domEvents.addEventListener(this.targetButton,"mousedown",this.handlePrevent),this.editor.domEvents.addEventListener(this.targetButton,"dblclick",this.handlePrevent))}showCellMenuButton(e){this.createTargetButton(e.cell),g(Mn,this.targetButton,"no target button"),this.targetButton.style.display="inline-block"}handleSplitCell(){if(this.activeTableBlock){const e=Te.fromBlock(this.activeTableBlock),t=this.editor.selection.range;if(t.isSimple()){const{col:o,row:r}=this.getCellByChildBlockId(e,t.start.blockId);o0(this.editor,this.activeTableBlock,{col:o,row:r})}else r0(this.editor.selection.range)}}getSelectedBkgColorIndex(){var r;g(Mn,this.activeTableBlock,"no target table block");const e=LR(this.editor,this.activeTableBlock),t=this.editor.getBlockData(this.activeTableBlock),o=new Set;for(const i of e){if(o.size>1)break;const s=ce(i),l=t[`${s}_background`];if(l)o.add(Number.parseInt((r=l.substring(sP.length))!=null?r:"0",10));else{o.add(-1);break}}return o.size===1&&[...o][0]!==-1?[...o][0]:-1}createCommandMenu(){g(Mn,this.activeTableBlock,"no target table block");const e=this.editor.getBlockData(this.activeTableBlock),t=Gv(this.editor,this.activeTableBlock,this.editor.selection.range);let o=this.editor.selection.range;if(o.isSimple()){const h=ni(this.editor,this.activeTableBlock,o.start);o=zt(this.editor,{anchor:h,focus:h})}const r=qv(this.editor,this.activeTableBlock,o),i=e.hasRowTitle,s=e.hasColTitle,l=e.isStripeStyle,a=e.noBorder,d=e.chart;return this.colorPaletteItem=new Hv("cell-background-color",{color:!1}),this.colorPaletteItem.palette.on("onClick",(h,p)=>{var C;switch(g(Mn,this.activeTableBlock,"no target table block"),h){case"clearColor":e7(this.editor,this.activeTableBlock,-1);break;case"backgroundColor":e7(this.editor,this.activeTableBlock,p);break}(C=this.manualMenu)==null||C.close("clickItem")}),[{id:"cell-background-color",name:L.t("table.cellBackground"),element:this.createBkgColorItem(),children:[this.colorPaletteItem]},{id:"separator",name:"",type:"separator"},{id:"merge-cell",name:L.t("table.mergeCell"),states:t?[]:["disabled"]},{id:"split-cell",name:L.t("table.splitCell"),states:r?[]:["disabled"]},{id:"separator",name:"",type:"separator"},{id:"delete-select-row",name:L.t("table.deleteSelectRow")},{id:"delete-select-col",name:L.t("table.deleteSelectCol")},{id:"separator",name:"",type:"separator"},{id:"table-config",name:L.t("table.tableConfigKey"),children:[{id:"row-title",name:L.t("table.tableConfig.rowTitle"),states:i?["checked"]:[]},{id:"col-title",name:L.t("table.tableConfig.colTitle"),states:s?["checked"]:[]},{id:"stripe-style",name:L.t("table.tableConfig.stripeStyle"),states:l?["checked"]:[]},{id:"hide-border",name:a?L.t("table.tableConfig.showBorder"):L.t("table.tableConfig.hideBorder"),value:a?"show-border":"hide-border"},{id:"show-chart",name:d?L.t("table.tableConfig.hideChart"):L.t("table.tableConfig.showChart"),value:d?"hide-chart":"show-chart"}]}]}handleRowTitle(e){g(Mn,this.activeTableBlock,"no target table block"),e?ER(this.editor,this.activeTableBlock):BR(this.editor,this.activeTableBlock)}handleColTitle(e){g(Mn,this.activeTableBlock,"no target table block"),e?wR(this.editor,this.activeTableBlock):kR(this.editor,this.activeTableBlock)}handleStripeStyle(e){g(Mn,this.activeTableBlock,"no target table block"),e?IR(this.editor,this.activeTableBlock):xR(this.editor,this.activeTableBlock)}}function f9(n){n.addCustom("table-cell-menu",e=>new lP(e))}const jf=D("table-container");function V0(n){const e=n.closest("td");return g(jf,e,"no parent cell for a table cell container"),e}function m9(n){const e=_t(n);return Array.from(e.querySelectorAll(':scope > tbody > tr > td > [data-type="editor-container"].child'))}function W0(n,e,t,o){const r=Te.fromBlock(n),i=r.getCellByContainerId(ce(e));if(t==="ArrowDown"){const s=r.getBottomCell(i);return s?s.container:null}if(t==="ArrowUp"){const s=r.getTopCell(i);return s?s.container:null}if(t==="ArrowLeft"){const s=r.getAllContainers(),l=s.indexOf(e);if(g(jf,l>=0,"not a valid child container"),l===0)return null;const a=s[l-1];return o!=null&&o.noWrap&&r.getCellByContainerId(ce(a)).row!==i.row?null:a}if(t==="ArrowRight"){const s=r.getAllContainers(),l=s.indexOf(e);if(g(jf,l>=0,"not a valid child container"),l===s.length-1)return null;const a=s[l+1];return o!=null&&o.noWrap&&r.getCellByContainerId(ce(a)).row!==i.row?null:a}g(jf,!1,`invalid navigation type: ${t}`)}const cP=12,aP=90,Uf=23,g9=2;class uP{constructor(e){m(this,"scrollTableBlock",null);m(this,"autoScrollDir",null);m(this,"autoScrollTimer",null);m(this,"handleMouseDown",e=>{const t=document.elementFromPoint(e.clientX,e.clientY);if(t&&t instanceof HTMLElement){const o=ne(t);if(o&&et(this.editor.rootContainer,o)){const r=ti(o);r&&(this.scrollTableBlock=r,document.addEventListener("mousemove",this.handleAutoScroll))}}});m(this,"handleAutoScroll",lE.default(e=>{if(this.scrollTableBlock){const t=this.editor.getCustom(Ar(this.scrollTableBlock)),o=t.rootElement,r=t.scrollOptions.parentContainer,i=o.getBoundingClientRect(),s=window.innerHeight-this.getBarFloatWindowBottom(t),l=r.getBoundingClientRect(),a=Math.min(l.bottom,s),d=Math.max(l.top,0);i.bottom>a&&e.clientY>=a?this.setAutoScroll("bottom"):i.top<d&&e.clientY<=d?this.setAutoScroll("top"):o.scrollLeft>0&&e.clientX<i.left?this.setAutoScroll("left"):o.scrollLeft<o.scrollWidth-o.offsetWidth&&e.clientX>i.right?this.setAutoScroll("right"):this.clearAutoScroll()}},15));m(this,"handleMouseUp",()=>{document.removeEventListener("mousemove",this.handleAutoScroll),setTimeout(()=>{this.scrollTableBlock=null})});m(this,"handleSelectionChanged",e=>{const t=e.selection.range;if(t.isCollapsed()&&t.isSimple()){const o=e.getBlockById(t.start.blockId),r=ti(o);if(r){const i=e.getCustom(Ar(r)),s=i.rootElement.getBoundingClientRect(),l=Mo(e,o,t.start);if(s.left>l.left){const a=t.start.offset===0?cP:g9;i.rootElement.scrollLeft-=s.left-l.left+a}else if(l.right>s.right){const a=t.start.offset===0?aP:g9;i.rootElement.scrollLeft+=l.right-s.right+a}}}else{const o=e.getBlockById(t.start.blockId),r=ti(o),i=e.getBlockById(t.end.blockId),s=ti(i);if(r&&r===s){const l=e.getCustom(Ar(r)),a=l.rootElement.getBoundingClientRect();let d=null;if(t.isSimple())d=t.isReverse()?Mo(e,o,t.start):Mo(e,i,t.end);else{const h=V0(sr(e,t.start.childContainerId)),p=V0(sr(e,t.end.childContainerId));d=t.isReverse()?h.getBoundingClientRect():p.getBoundingClientRect()}a.left>d.left&&t.isReverse()?l.rootElement.scrollLeft-=a.left-d.left:a.right<d.right&&!t.isReverse()&&(l.rootElement.scrollLeft+=d.right-a.right)}}});m(this,"handleScroll",e=>{zv(e),this.editor.selection.caret.update()});m(this,"handleReset",e=>{zv(e),this.editor.selection.caret.update();const t=this.editor.findCustom("table-border-bar");t&&t.handleScroll(),l9(e)});this.editor=e,this.editor.addListener("selectionChanged",this.handleSelectionChanged),document.addEventListener("mousedown",this.handleMouseDown),document.addEventListener("mouseup",this.handleMouseUp)}getBarFloatWindowBottom(e){return e.scrollOptions.barFloatWindowBottom?typeof e.scrollOptions.barFloatWindowBottom=="number"?e.scrollOptions.barFloatWindowBottom:e.scrollOptions.barFloatWindowBottom():0}clearAutoScroll(){this.autoScrollTimer&&(clearInterval(this.autoScrollTimer),this.autoScrollTimer=null,this.autoScrollDir=null)}setAutoScroll(e){this.autoScrollDir&&this.autoScrollDir!==e&&this.clearAutoScroll(),this.autoScrollTimer||(this.autoScrollDir=e,this.autoScrollTimer=window.setInterval(()=>{if(this.scrollTableBlock){const t=this.editor.getCustom(Ar(this.scrollTableBlock)),o=t.rootElement,r=t.scrollOptions.parentContainer,i=o.getBoundingClientRect(),s=r===document.documentElement?window.innerHeight:r.offsetHeight,l=window.innerHeight-this.getBarFloatWindowBottom(t),a=r.getBoundingClientRect(),d=Math.min(a.bottom,l),h=Math.max(a.top,0);this.autoScrollDir==="left"&&(o.scrollLeft-=Uf,o.scrollLeft<=0&&this.clearAutoScroll()),this.autoScrollDir==="right"&&(o.scrollLeft+=Uf,o.scrollLeft>=o.scrollWidth-o.offsetWidth&&this.clearAutoScroll()),this.autoScrollDir==="bottom"&&(r.scrollTop+=Uf,(r.scrollTop>=r.scrollHeight-s||i.bottom<=d)&&this.clearAutoScroll()),this.autoScrollDir==="top"&&(r.scrollTop-=Uf,(r.scrollTop<=0||i.top>=h)&&this.clearAutoScroll())}},100))}destroy(){document.removeEventListener("mousedown",this.handleMouseDown),document.removeEventListener("mouseup",this.handleMouseUp),this.editor.removeListener("selectionChanged",this.handleSelectionChanged)}}function p9(n){return n.addCustom("table-scroll-events",e=>new uP(e))}const dP=D("table-doc-change-handler");class hP{constructor(e){this.editor=e,this.editor.addListener("docChanged",this.handleDocChanged)}handleDocChanged(e,t){if(!t){const{start:o,end:r}=e.selection.range;if(!e.findBlockById(o.blockId)||!e.findBlockById(r.blockId)){e.selection.selectBlock(e.getBlockByIndex("root",0),0);return}if(Gl(o)){const i=e.getBlockById(o.blockId);if(!Ft(i))return;if(g(dP,Gl(r),"invalid range"),!bh(e,o.childContainerId)||!bh(e,r.childContainerId)){e.selection.selectBlock(i,0);return}let s=null,l=null;const a=(d,h)=>{const p=h.getCellById(d.childContainerId),{colIndex:C=0,rowIndex:v=0}=d.custom;let B=-1,S=-1;return(p.col>C||p.col+p.colSpan-1<C)&&(B=p.col),(p.row>v||p.row+p.rowSpan-1<v)&&(S=p.row),B!==-1||S!==-1?ft(i,d.childContainerId,{colIndex:B===-1?C:B,rowIndex:S===-1?v:S}):null};if(o.custom){const d=Te.fromBlock(i);s=a(o,d),l=a(r,d)}(s!==null||l!==null)&&(e.selection.range.isReverse()?e.selection.setSelection(l!=null?l:r,s!=null?s:o):e.selection.setSelection(s!=null?s:o,l!=null?l:r))}}}destroy(){this.editor.removeListener("docChanged",this.handleDocChanged)}}function C9(n){n.addCustom("table-doc-change-handler",e=>new hP(e))}const vr=D("create-content");function A9(n,e,t){const o=new gf(t),r=t.rows,i=t.cols;g(vr,r>=1,`invalid rows: ${r}`),g(vr,i>=1,`invalid cols: ${i}`),g(vr,t.children,"no table children");const s=k("table",[],null),l=t.colsWidth,a=k("colgroup",[],s);for(let p=0;p<o.colCount;p++){const C=k("col",[],a);l[p]&&(C.style.width=`${l[p]}px`)}const d=k("tbody",[],s);let h=0;for(let p=0;p<r;p++){const C=k("tr",[],d);for(let v=0;v<i;v++){const B=o.getCell({col:v,row:p});if(B.virtual)g(vr,B.colSpan>1||B.rowSpan>1,"virtual cell should have colSpan or rowSpan");else{const S=t.children[h],x=k("td",[],C);B.colSpan>1&&(x.colSpan=B.colSpan),B.rowSpan>1&&(x.rowSpan=B.rowSpan);const _=t[vu(S)];_&&W(x,_),v===0&&t.hasColTitle&&W(x,Qv.COL_TITLE_ITEM),n.createChildContainer(e,x,S),h+=1}}}return g(vr,h===t.children.length,"container count mismatch"),t.noBorder&&W(s,"no-border"),t.chart&&W(s,"editor-table-chart"),t.isStripeStyle&&W(s,"stripe"),t.hasRowTitle&&W(s,"row-title"),t.hasColTitle&&W(s,"col-title"),s}function fP(n,e,t,o,r){g(vr,r.type==="table","not table data"),g(vr,ce(t)===e[e.length-1].containerId,"invalid path");const i=r,s=Ss(o,"div");try{const l=k("div",[],null);l.setAttribute("data-type","table-content");const a=A9(n,e,i);a.classList.add("drag-preview-element"),l.appendChild(a);const d=n.getComponentOptions("table");m7(n),b7(n),h9(n,"create"),C9(n),d!=null&&d.hideCellMenu||f9(n),UL(n,d0);const h=n.addCustom(Ar(o),()=>rO());h.init({parentElement:s,childElement:l,safeRightSpace:50,safeLeftSpace:40,parentContainer:Ge(t)?n.scrollContainer:t,locatingContainer:Ge(t)?(d==null?void 0:d.locatingContainer)||n.parent:t,paddingLeft:fc+bu,paddingTop:fc+bu,paddingBottom:bu/2,paddingRight:bu/2,barFloatWindowBottom:d==null?void 0:d.barFloatWindowBottom,allowScrollBarFixed:d==null?void 0:d.allowScrollBarFixed,isSetScale:d==null?void 0:d.isSetScale});const p=p9(n);h.on("scroll",p.handleReset),h.on("resize",p.handleReset),setTimeout(()=>{FR(n,o)})}catch{const a=`invalid table data: ${JSON.stringify(i)}`;vr.error(a);const d=k("div",["error"],s);d.innerText=a}return s}function mP(n,e,t){g(vr,t.type==="table","not table data");const o=t,r=Le(e);try{const i=_t(e),s=_i(e),l=A9(n,s,o);l.classList.add("drag-preview-element"),i.insertAdjacentElement("afterend",l),i.remove();const a=n.getComponentOptions("table");m7(n),b7(n),h9(n,"update"),C9(n),a!=null&&a.hideCellMenu||f9(n),d0(n,e)}catch{const s=`invalid table data: ${JSON.stringify(o)}`;vr.error(s);const l=k("div",["error"],r);l.innerText=s}}function gP(n,e){let t,o,r=!1;if([...e].every(C=>C==="|")?(o=e.length,t=Array(o).fill(""),r=!0):(t=$m(e,"|").split("|"),o=t.length),o<2)return null;const i=3,s=o,l=[];for(let C=0;C<3;C++)t.forEach(v=>{l.push(Jr(n.doc,C===0?v:""))});const a=Array(s).fill(m0),d=l[r?0:s],h=n.doc.getContainerBlocks(d)[0].id;return{blockData:{id:K(),type:"table",rows:i,cols:s,children:l,colsWidth:a},focusBlockId:h}}function pP(n,e){const t=e.rows,o=e.cols;if(t<1||o<1)return null;const r=[];for(let d=0;d<t;d++)for(let h=0;h<o;h++)r.push(Jr(n.doc));const i=Array(o).fill(m0),s=r[0],l=n.doc.getContainerBlocks(s)[0].id;return{blockData:{id:K(),type:"table",rows:t,cols:o,children:r,colsWidth:i},focusBlockId:l}}const b9=D("table-selection-to-doc");function CP(n,e){const{start:t,end:o,block:r}=e,i=Se(r);g(b9,i==="table",`invalid block type: ${i}`);const s=n.getBlockData(r);if(t.isSimple()&&o.isSimple())return Hi(n.editorBlocks,n.doc.toJSON(),s);g(b9,!t.isSimple()&&!o.isSimple(),"invalid block pos type");const l=Te.fromBlock(r),{fromCol:a,toCol:d,fromRow:h,toRow:p}=zo(r,t,o),C={},v=[],B=n.doc.toJSON();let S={};l.sub({row:h,col:a},{row:p,col:d}).forEach((ee,fe)=>{ee.forEach((ve,ze)=>{const He=ve.containerId;if(v.indexOf(He)!==-1)return;v.push(He);let Ke;if(ve.virtual){const Ht=l.getCellByContainerId(ve.containerId),Rn=a+ze;let Sr=Ht.col+Ht.colSpan-1;Sr>d&&(Sr=d);const kn=Sr-Rn+1;kn>1&&(C[`${He}_colSpan`]=kn);const an=h+fe;let Dr=Ht.row+Ht.rowSpan-1;Dr>p&&(Dr=p);const li=Dr-an+1;li>1&&(C[`${He}_rowSpan`]=li),Ke=Yr()}else{if(Ke=Yg(n.editorBlocks,B,He),ve.col+ve.colSpan>d+1){const Ht=d-ve.col+1;Ht>1&&(C[`${He}_colSpan`]=Ht)}else ve.colSpan>1&&(C[`${He}_colSpan`]=ve.colSpan);if(ve.row+ve.rowSpan>p+1){const Ht=p-ve.row+1;Ht>1&&(C[`${He}_rowSpan`]=Ht)}else ve.rowSpan>1&&(C[`${He}_rowSpan`]=ve.rowSpan)}const{root:qt,...Yn}=Ke.blocks;S={...S,...Yn,[He]:qt}})});const _=Eu(_t(r)).slice(a,d+1);return{blocks:{root:[{id:K(),type:i,children:v,colsWidth:_,rows:p-h+1,cols:d-a+1,...C}],...S},meta:{},comments:{}}}function AP(n,e){if(e.top===0)return!0;for(let t=e.left;t<=e.right;t++)if(n[e.top-1][t]===n[e.top][t])return!1;return!0}function bP(n,e){if(e.left===0)return!0;for(let t=e.top;t<=e.bottom;t++)if(n[t][e.left-1]===n[t][e.left])return!1;return!0}function vP(n,e){if(e.bottom===n.length-1)return!0;for(let t=e.left;t<=e.right;t++)if(n[e.bottom][t]===n[e.bottom+1][t])return!1;return!0}function yP(n,e){if(e.right===n[0].length-1)return!0;for(let t=e.top;t<=e.bottom;t++)if(n[t][e.right]===n[t][e.right+1])return!1;return!0}function kP(n,e,t){const o=e.col,r=e.row,i=t.col,s=t.row,l={left:o,top:r,right:i,bottom:s};let a=!1;do{if(a=!1,!AP(n,l)){l.top--,a=!0;continue}if(!bP(n,l)){l.left--,a=!0;continue}if(!vP(n,l)){l.bottom++,a=!0;continue}if(!yP(n,l)){l.right++,a=!0;continue}}while(a);return l}function wP(n,e,t,o){if(t.custom!==void 0||o.custom!==void 0)return{anchor:t,focus:o};const r=Te.fromBlock(e),i=r.map(H=>H.containerId),s=r.getCellByContainerId(t.childContainerId),l=r.getCellByContainerId(o.childContainerId),a=Math.min(s.row,l.row),d=Math.max(s.row,l.row),h=Math.min(s.col,l.col),p=Math.max(s.col,l.col),C=kP(i,{row:a,col:h},{row:d,col:p}),v=r.getCell({row:C.top,col:C.left}),B=r.getCell({row:C.bottom,col:C.right}),S=r.getCell({row:C.top,col:C.right}),x=r.getCell({row:C.bottom,col:C.left});let _,R;return s.row<=l.row?s.col<=l.col?(_=v,R=B):(_=S,R=x):s.col<l.col?(_=x,R=S):(_=B,R=v),console.log(`move ${_.col}, ${_.row}, -> ${R.col}, ${R.row}`),{anchor:ft(e,_.containerId),focus:ft(e,R.containerId)}}function v9(n,e,t){if(t.isSimple())return[_t(e).getBoundingClientRect()];const o=_t(e),r=o.getBoundingClientRect(),{fromCol:i,fromRow:s,toCol:l,toRow:a}=zo(e,t.start,t.end),d=Eu(o),h=d.slice(0,i).reduce((S,x)=>S+x,0),p=h+d.slice(i,l+1).reduce((S,x)=>S+x,0),C=s9(o);let v=C.slice(0,s).reduce((S,x)=>S+x,0);const B=v+C.slice(s,a+1).reduce((S,x)=>S+x,0);if(s===0){const S=tP(n,e);v-=S}return[new DOMRect(r.left+h,r.top+v,p-h,B-v)]}D("table-size");const BP=40;function zf(n){const e=n.querySelector("td");if(!e)return 0;const t=window.getComputedStyle(e),o=Number.parseInt(t.borderLeft,10),r=Number.parseInt(t.borderRight,10);return(o+r)/2}function EP(n,e,t){const o=ag(n,t.container);return o!==void 0?o+zf(e):BP*t.colSpan-zf(e)}function xP(n,e,t,o){let r=0;const i=t.colCount;for(let s=0;s<i;s++){const l=t.getCell({col:s,row:o});if(l.virtual)continue;let a=EP(n,e,l);const d=P4(l.container,{withPadding:!0});d&&d>a&&(a=d),r+=a+zf(e)}return r}function IP(n,e){const t=_t(e),o=Te.fromTable(t);let r=0;for(let s=0;s<o.rowCount;s++)r=Math.max(r,xP(n,t,o,s));const i=zf(t);return r+=i,r}const oi=D("table-creator");async function TP(n,e){return n.undoManager.runInGroup(()=>{var a,d;const t=e.item,o=(a=t.colCount)!=null?a:5,r=(d=t.rowCount)!=null?d:3,i=pP(n,{cols:o,rows:r});if(!i)return null;const{blockData:s,focusBlockId:l}=i;return n.insertBlock(e.containerId,e.blockIndex,s,kt(n,l,0))})}class SP{constructor(){m(this,"id","insert-table");m(this,"name","Create table");m(this,"element");m(this,"closeable",null);m(this,"colCount");m(this,"rowCount");m(this,"setCloseable",e=>{this.closeable=e});m(this,"destroy",()=>{this.closeable=null});m(this,"getTableCreatorCellId",(e,t)=>`table-creator-cell-${e}-${t}`);m(this,"handleTableCreatorClick",e=>{var C,v;e.preventDefault(),e.stopPropagation();const t=e.target;g(oi,t instanceof HTMLElement,"invalid event target");const o=t.closest(".table-creator");g(oi,o,"no table creator");const r=o.querySelectorAll(".active");if(r.length===0)return;const s=r[r.length-1].id;g(oi,s,"no cell id");const l="table-creator-cell-";if(!s.startsWith(l))return;const d=s.substring(l.length).split("-");g(oi,d.length===2,"invalid cell id");const h=Number.parseInt(d[0],10)+1,p=Number.parseInt(d[1],10)+1;oi.debug(`${h}, ${p}`),this.colCount=p,this.rowCount=h,(C=this.closeable)==null||C.click(this,this.element),(v=this.closeable)==null||v.close("clickItem"),this.handleTableCreatorLeave()});m(this,"handleTableCreatorLeave",()=>{for(let e=0;e<9;e++)for(let t=0;t<9;t++){const o=this.getTableCreatorCellId(e,t),r=document.getElementById(o);r&&re(r,"active")}});m(this,"handleTableCreatorCellEnter",e=>{const t=e.target;g(oi,t instanceof HTMLElement,"invalid event target");const o=t.id,r="table-creator-cell-";g(oi,o.startsWith(r),"invalid cell id");const s=o.substring(r.length).split("-");g(oi,s.length===2,"invalid cell id");let l=Number.parseInt(s[0],10),a=Number.parseInt(s[1],10);l===0&&a===0&&(l=-1,a=-1);for(let d=0;d<9;d++)for(let h=0;h<9;h++){const p=this.getTableCreatorCellId(d,h),C=document.getElementById(p);g(oi,C,"no cell"),d<=l&&h<=a?W(C,"active"):re(C,"active")}});this.element=this.createTableCreatorElement()}createTableCreatorElement(){const e=k("div",["table-creator"],null),t=(o,r,i)=>{const s=k("div",["table-creator-cell"],o);return s.id=this.getTableCreatorCellId(r,i),s};e.addEventListener("click",this.handleTableCreatorClick),e.addEventListener("mouseleave",this.handleTableCreatorLeave);for(let o=0;o<9;o++){const r=k("div",["table-creator-row"],e);for(let i=0;i<9;i++)t(r,o,i).addEventListener("mouseenter",this.handleTableCreatorCellEnter)}return e}}function DP(){return new SP}function LP(n){const e=/[\u4e00-\u9fff\u3040-\u309f\u30a0-\u30ff\uac00-\ud7af]/g,t=n.match(e);return t?t.length:0}function y9(n){const e=LP(n);return n.length+e}function MP(n,e){const t=y9(n),o=e-t;return o>0?n+" ".repeat(o):n}function RP(n,e,t,o,r){const i=e,s=new gf(i);if(o==="markdown"||o==="text"){const l=x=>t.blocks[x].map((H,z)=>o==="markdown"?Hg(n,H,t,[...r,{containerId:x,blockIndex:z}]):Nh(n,H,t,[...r,{containerId:x,blockIndex:z}])),a=x=>l(x).join(" ").replace(/\n/g," ").trim(),d=new Map,h=new Map;for(let x=0;x<s.colCount;x++){let _=0;for(let R=0;R<s.rowCount;R++){const H=s.getCell({row:R,col:x});let z="";H.virtual||(z=a(H.containerId)),d.set(`${R},${x}`,z),_=Math.max(_,y9(z))}h.set(x,_)}const p=x=>{const _=d.get(`${x.row},${x.col}`)||"",R=h.get(x.col)||0;return MP(_,R)},C=[];let v="|",B="|";for(let x=0;x<s.colCount;x++){const _=p({row:0,col:x});v+=` ${_} |`;const R="-".repeat((h.get(x)||0)+2);B+=`${R}|`}C.push(v),C.push(B);for(let x=1;x<s.rowCount;x++){let _="|";for(let R=0;R<s.colCount;R++){const H=p({row:x,col:R});_+=` ${H} |`}C.push(_)}return`${C.join(`
410
+ `:r.mathjaxText}function DF(){return{abstract:L.t("mathjax.abstract")}}const LF={embedType:"math",createEmbedContent:EF,getOptions:IF,convertFrom:xF,handleDeleteBlock:TF,convertTo:SF,getBlockProperties:DF},woe="",MF={mathjax:{emptyText:"\u7A7A\u7684\u516C\u5F0F",abstract:"\u516C\u5F0F"}},RF={mathjax:{emptyText:"Empty formula",abstract:"Formula"}},OF={mathjax:{emptyText:"\u6570\u5F0F\u306A\u3057",abstract:"\u6570\u5F0F"}};L.mergeLang({"zh-CN":MF,"en-US":RF,"ja-JP":OF});function _F(n,e,t,o){const r=n.getBlockByIndex(e,t),i=n.getBlockText(r),{left:s}=Tn(i,o);if(!st(s).endsWith("$$$$"))return!1;const a=o-4,d=o,h={id:K(),box:!0,type:"math",tex:" ",src:"",created:Date.now()};return n.undoManager.runInGroup(()=>{n.deleteTextFromBlock(r,a,d-a),n.insertBoxToBlock(r,a,h),setTimeout(()=>{const p=n.getBoxById(h.id);_f(n,p)})}),!0}class FF{handleAfterInsertText(e,t,o,r,i){return!!(i===" "&&_F(e,t,o,r))}}const Bc=D("inline-box-items");function PF(n,e,t){return n.undoManager.runInGroup(()=>{var s;let o=n.getBlockByIndex(e,t);ut(n,o)||(o=n.insertTextBlock([],e,t));const r=e9();n.setBlockText(o,[r]);const i=(s=r.attributes)==null?void 0:s.id;return g(Bc,i,"mathjax box id is empty"),setTimeout(()=>{const l=n.getBoxById(i);_f(n,l)},100),o})}function NF(n,e,t){let o=n.getBlockByIndex(e,t),r="bottom-start";return ut(n,o)||(r="top-start"),xu(n,{target:o,linkText:"",linkUrl:"",onFinished:(l,a)=>{n.undoManager.runInGroup(()=>{try{ut(n,o)||(o=n.insertTextBlock([],e,t));const d=uo(l,{link:a}),h=uo(" ",null),p=[d,h];n.insertTextToBlock(o,0,p),n.selection.selectBlock(o,rn(p)),n.focus()}catch(d){Bc.error(d)}})},onClose:()=>{n.focus()},placement:r}),o}function $F(n,e,t){return n.undoManager.runInGroup(()=>{var l;const o=n.getBlockByIndex(e,t),r=n.selection.range;g(Bc,Gr(r.start),"invalid block position");const i=e9();n.insertBoxToBlock(o,r.start.offset,i.attributes);const s=(l=i.attributes)==null?void 0:l.id;return g(Bc,s,"mathjax box id is empty"),setTimeout(()=>{const a=n.getBoxById(s);_f(n,a)},100),o})}function HF(n,e,t){const o=n.getBlockByIndex(e,t),r=n.selection.range;g(Bc,Gr(r.start),"invalid block position");const i=Vr(n,o,r);if(i.length===0)return;const s=i[0],l=Zr(n,o,"quick-menu-inline-link",s);xu(n,{target:l,linkText:"",linkUrl:"",onFinished:(h,p)=>{n.undoManager.runInGroup(()=>{try{const C=n.getBlockText(o),v=Qr(C,r.start.offset,h,{link:p});n.setBlockText(o,v),n.selection.selectBlock(o,r.start.offset+h.length),n.focus()}catch(C){Bc.error(C)}})},onClose:()=>{n.focus()},placement:"bottom-start"})}class o9{getCommands(){return[{id:"insert-math",name:L.t("quickMenu.inlineBox.math"),icon:aM,order:900,group:"common",subText:An("insert-math")},{id:"insert-link",name:L.t("quickMenu.inlineBox.link"),icon:wv,order:400,group:"common",subText:An("insert-link")}]}async handleUpdateBlockCore(e,t){switch(t.item.id){case"insert-math":return $F(e,t.containerId,t.blockIndex);case"insert-link":return HF(e,t.containerId,t.blockIndex);default:return null}}async handleInsertEmptyBlockCore(e,t){switch(t.item.id){case"insert-math":return PF(e,t.containerId,t.blockIndex);case"insert-link":return NF(e,t.containerId,t.blockIndex);default:return null}}async executeCommand(e,t,o){if(o.from==="quick-menu"){const r=e.getBlockById(o.blockId),i=e.getParentContainer(r),s=ce(i),l=e.getBlockIndex(r);e.undoManager.runInGroup(()=>this.handleUpdateBlockCore(e,{item:t,containerId:s,blockIndex:l}))}else o.from==="block-menu"&&e.undoManager.runInGroup(()=>this.handleInsertEmptyBlockCore(e,{item:t,containerId:o.containerId,blockIndex:o.blockIndex}));return null}}function jF(n,e={withPlainText:!1}){var i,s;const{withPlainText:t}=e,o=(s=(i=n.options.componentsOptions)==null?void 0:i.quickMenu)==null?void 0:s.commandProviders;if(!o)return[];const r=[];return[...o,new Z7(t),new o9].forEach(l=>{const a=l.getCommands(n);r.push(...a.map(d=>({...d,itemType:"insert-block",commandProvider:l})))}),r}function UF(n,e={withPlainText:!1}){const t=[];return n.editorBlocks.forEach(o=>{if(!o.getOptions)return;const r=o.getOptions(n);!r.insertBlockCommandItems||(r.insertBlockCommandItems.forEach(i=>{G7(i,r)}),t.push(...r.insertBlockCommandItems))}),t.push(...jF(n,e)),t}function j0(n,e={withPlainText:!1}){const t=UF(n,e),o=new Map;t.forEach(s=>{var d;const l=(d=s.group)!=null?d:"";let a=o.get(l);a?a.items.push(s):(a={group:l,order:s.groupOrder||Q7[l]||1e3,items:[s]},o.set(l,a))});const r=Array.from(o.values());r.sort((s,l)=>s.order-l.order),r.forEach(s=>{s.items.sort((l,a)=>{var d,h;return((d=l.order)!=null?d:0)-((h=a.order)!=null?h:0)})});const i=[];return r.forEach((s,l)=>{const a=`blockMenu.section.${s.group||"common"}`,d=L.t(a),h=d===a?s.group:d;i.push({id:`section-${l}`,name:h,type:"section",group:s.group,itemType:"insert-block"}),i.push(...s.items.map(p=>({...p})))}),i}function zF(n,e,t){const o=n.getFocusedBlock();if(!o)return;const r=n.getParentContainer(o),i=ce(r);let l=n.getBlockIndex(o);if(ut(n,o)||(l+=1),e.commandProvider){e.commandProvider.executeCommand(n,e,{from:"quick-menu",...t});return}!e.blockOptions||!e.blockOptions.handleInsertEmptyBlock||e.blockOptions.handleInsertEmptyBlock(n,{containerId:i,blockIndex:l,item:e})}const r9=D("quick-menu"),VF={id:"quick-menu",trigger:["/"]},WF=5;class Ff{constructor(e,t=VF){m(this,"suggest");m(this,"items");m(this,"maxHeading");m(this,"firstEmptyOffset",-1);m(this,"queryItems",async(e,t)=>{if(this.items.length===0?this.initMenuItems():this.refreshMenuItems(),t){const o=new Set,r=t.toLocaleLowerCase().replace(/^\s+|\s+$/g,""),i=this.items.filter(s=>{if(s.type==="section")return!0;if(s.name.toLocaleLowerCase().indexOf(r)!==-1||lR(s).toLocaleLowerCase().indexOf(r)!==-1)return o.add(s.group),!0;const l=`blockMenu.section.${s.group||"common"}`,a=L.t(l),d=a===l?s.group:a;return(d==null?void 0:d.toLocaleLowerCase().indexOf(r))!==-1?(o.add(s.group),!0):!1}).filter(s=>s.type==="section"?o.has(s.group):!0);return i.length?this.firstEmptyOffset=-1:this.handleEmptySearch(),i}return this.items});m(this,"onClose",()=>{this.firstEmptyOffset=-1});m(this,"onShow",(e,t,o,r)=>{const i=this.editor.getBlockByIndex(t,o);if(!lo(i)){const s=ne(oe(i));if(s&&Se(s)==="code")return!1}return!0});m(this,"onClickItem",(e,t)=>{const o=t;o.itemType==="insert-block"&&(g(r9,o.blockOptions||o.commandProvider,"invalid quick item, no block options or command provider"),g(r9,this.suggest.anchor,"invalid suggest, no anchor"),this.options.id==="empty-block-menu"&&this.editor.focus(),zF(this.editor,o,this.suggest.anchor))});this.editor=e,this.options=t,this.items=[],this.maxHeading=xf(),this.suggest=new Jp(e,{id:t.id||"quick-menu",trigger:t.trigger,needSpaceBeforeTrigger:!0,autoDeleteTrigger:!0,highlight:!0,onClose:this.onClose,onShow:this.onShow,onClickItem:this.onClickItem,queryItems:this.queryItems})}get menu(){return this.suggest.menu.menu}destroy(){this.suggest.destroy()}initMenuItems(){const e=j0(this.editor);this.items=e}refreshMenuItems(){let e=null,t=0;const o=xf();if(o!==this.maxHeading){const r=new Z7,s=r.getCommands().map(l=>({...l,itemType:"insert-block",commandProvider:r}));for(let l=0;l<this.items.length;l++)this.items[l].group==="basics"&&(e||(e=l),e&&t++);e&&t&&this.items.splice(e,t,...s),this.maxHeading=o}}handleEmptySearch(){const e=this.editor.selection.getFocusedPos();if(this.firstEmptyOffset===-1){if(e.isSimple()){const{offset:t}=e;this.firstEmptyOffset=t-1}}else if(e.isSimple()){const{offset:t}=e;t-this.firstEmptyOffset>WF&&(this.suggest.close(),this.firstEmptyOffset=-1)}}}class Pf{constructor(e){m(this,"instance");m(this,"mousedown",!1);m(this,"currentInstance",null);m(this,"attributeName",[]);m(this,"attributeDesc","");m(this,"observer",null);m(this,"observerCallback",null);m(this,"createContent",e=>{let t="",o=0;for(;o<this.attributeName.length&&!t;)e.hasAttribute(this.attributeName[o])&&(t=e.getAttribute(this.attributeName[o])||""),o++;const r=e.getAttribute(this.attributeDesc);if(!r)return t;const i=k("div",[],null);return k("span",[],i,t),r&&k("span",["editor-tooltip-desc"],i,r),i});m(this,"handleDocumentMouseDown",()=>{this.mousedown=!0,this.editor.domEvents.addEventListener(document,"mouseup",this.handleDocumentMouseUp)});m(this,"handleDocumentMouseUp",()=>{this.mousedown=!1,this.editor.domEvents.removeEventListener(document,"mouseup",this.handleDocumentMouseUp)});m(this,"handleShown",e=>{this.currentInstance&&this.hide(),this.currentInstance=e,this.createObserver()});m(this,"handleHidden",()=>{this.destroyObserver(),this.currentInstance=null});m(this,"handleShow",e=>{var r;const t=e.reference;if(!t||!et(document.body,t)||window.isDragging||this.mousedown)return!1;const o=Number.parseInt((r=t.getAttribute("data-tooltip-hide-at"))!=null?r:"",10);if(o&&Date.now()-o<1e3)return!1;if(e.reference){const i={};if(e.reference.hasAttribute("data-editor-tooltip-placement")&&(i.placement=e.reference.getAttribute("data-editor-tooltip-placement")||"top"),e.reference.hasAttribute("data-editor-tooltip-offset-x")||e.reference.hasAttribute("data-editor-tooltip-offset-y")){const l=e.reference.getAttribute("data-editor-tooltip-offset-x"),a=e.reference.getAttribute("data-editor-tooltip-offset-y");i.offset=[l?Number.parseInt(l,10):0,a?Number.parseInt(a,10):0]}e.reference.hasAttribute("data-editor-tooltip-maxwidth")&&(i.maxWidth=Number.parseInt(e.reference.getAttribute("data-editor-tooltip-maxwidth")||"350",10)),e.reference.hasAttribute("data-editor-tooltip-allow-markdown")&&(i.allowHTML=!0);const s=document.body;if(i.appendTo=this.fixContainerForFullscreen(s),Object.keys(i).length&&e.setProps(i),e.reference.hasAttribute(`data-editor-tooltip-${this.editor.clientId}-dynamic`)){const l=e.reference.getAttribute(`data-editor-tooltip-${this.editor.clientId}-dynamic`);e.setContent(l||"")}}return!0});this.editor=e;const t=e.clientId;this.attributeName=[`data-editor-tooltip-${t}`,`data-editor-tooltip-${t}-dynamic`,"data-editor-tooltip-common"],this.attributeDesc=`data-editor-tooltip-desc-${t}`,this.instance=Em.delegate(document.body,{theme:"editor-tooltip",maxWidth:400,delay:200,target:this.attributeName.map(o=>`[${o}]`).join(","),content:this.createContent,onShow:this.handleShow,onShown:this.handleShown,onHide:this.handleHidden}),e.domEvents.addEventListener(document,"mousedown",this.handleDocumentMouseDown)}visible(){var e;return(e=this.currentInstance)==null?void 0:e.state.isVisible}hide(){var e;(e=this.currentInstance)!=null&&e.state.isVisible&&this.currentInstance.hide()}destroy(){this.destroyObserver(),this.instance.destroy(),this.editor.domEvents.removeEventListener(document,"mousedown",this.handleDocumentMouseDown),this.editor.domEvents.removeEventListener(document,"mouseup",this.handleDocumentMouseUp)}createObserver(){this.destroyObserver();const e=this.currentInstance;if(!e||!e.reference)return;this.observerCallback=Mt.default(()=>{e.reference.closest("body")||(e.hide(),this.destroyObserver())},200),this.observer=new MutationObserver(this.observerCallback);const t=document.body,o={childList:!0,attributes:!1,subtree:!0};this.observer.observe(t,o)}destroyObserver(){this.observer&&(this.observer.disconnect(),this.observer=null),this.observerCallback&&(this.observerCallback.cancel(),this.observerCallback=null)}fixContainerForFullscreen(e){return e.closest("body")&&document.fullscreenElement&&!document.fullscreenElement.contains(e)?document.fullscreenElement:e}}const qF={"text/style-bold":"bold","text/style-italic":"italic","text/style-underline":"underline","text/style-strikethrough":"line-through","text/style-code":"code","text/style-sub":"subscript","text/style-super":"superscript"};function GF(n,e){const t=new Set(Object.keys(qF)),o=e.filter(i=>t.has(i.id));return Bf(o)}function Nf(n,e){if(!n.isWritable())return!1;const t=n.selection.range,o=n.editorCommandProviders.getCommands(t),i=GF(n,o).find(s=>s.id===`text/${e}`);return i?(n.editorCommandProviders.executeCommand(t,i,{}),wc.get(n).update("selectionChange"),!0):!1}const U0={"CtrlOrCmd+B":n=>Nf(n,"style-bold"),"CtrlOrCmd+I":n=>Nf(n,"style-italic"),"CtrlOrCmd+U":n=>Nf(n,"style-underline"),"CtrlOrCmd+D":n=>Nf(n,"style-strikethrough")},ZF={quickMenu:{basic:{heading:{title:"\u6807\u9898 {heading}",space:"{markdown}\u7A7A\u683C"},unordered:"\u65E0\u5E8F\u5217\u8868",ordered:"\u6709\u5E8F\u5217\u8868",checkbox:"\u5F85\u529E\u4E8B\u9879",quote:"\u5F15\u7528"},inlineBox:{math:"\u516C\u5F0F",link:"\u94FE\u63A5"}},link:{textLabel:"\u6587\u672C",urlLabel:"\u94FE\u63A5\u5730\u5740",textPlaceholder:"\u8BF7\u8F93\u5165\u6587\u672C",urlPlaceholder:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740",submitText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",edit:"\u7F16\u8F91",remove:"\u53D6\u6D88\u94FE\u63A5"},commands:{unordered:"\u65E0\u5E8F\u5217\u8868",ordered:"\u6709\u5E8F\u5217\u8868",check:"\u5F85\u529E\u5217\u8868",link:"\u94FE\u63A5",quote:"\u5F15\u7528",alignLeft:"\u5DE6\u5BF9\u9F50",alignRight:"\u53F3\u5BF9\u9F50",alignCenter:"\u5C45\u4E2D\u5BF9\u9F50",alignGroup:"\u5BF9\u9F50\u65B9\u5F0F",heading:"\u6807\u9898 {name}",headingGroup:"\u6807\u9898\u6837\u5F0F",text:"\u6B63\u6587"}},QF={quickMenu:{basic:{heading:{title:"Heading {heading}",space:"{markdown}space"},unordered:"Bulleted list",ordered:"Numbered list",checkbox:"To-do list",quote:"Quote"},inlineBox:{math:"Formula",link:"Link"}},link:{textLabel:"Text",urlLabel:"Link address",textPlaceholder:"Please enter text",urlPlaceholder:"Please enter link",submitText:"Confirm",cancelText:"Cancel",edit:"Edit",remove:"Remove link"},commands:{unordered:"Bulleted list",ordered:"Numberer list",check:"To-do list",link:"Link",quote:"Quote",alignLeft:"Align left",alignRight:"Align right",alignCenter:"Center text",alignGroup:"Alignment",heading:"Heading {name}",headingGroup:"Text style",text:"Text"}},YF={quickMenu:{basic:{heading:{title:"\u898B\u51FA\u3057{heading}",space:"{markdown}\u30B9\u30DA\u30FC\u30B9"},unordered:"\u7B87\u6761\u66F8\u304D\u30EA\u30B9\u30C8",ordered:"\u756A\u53F7\u4ED8\u304D\u30EA\u30B9\u30C8",checkbox:"\u30D0\u30C3\u30AF\u30ED\u30B0",quote:"\u5F15\u7528"},inlineBox:{math:"\u6570\u5F0F",link:"URL"}},link:{textLabel:"\u30C6\u30AD\u30B9\u30C8",urlLabel:"URL",textPlaceholder:"\u30C6\u30AD\u30B9\u30C8\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044",urlPlaceholder:"URL \u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044",submitText:"OK",cancelText:"\u30AD\u30E3\u30F3\u30BB\u30EB",edit:"\u7DE8\u96C6",remove:"\u30EA\u30F3\u30AF\u3092\u89E3\u9664"},commands:{unordered:"\u7B87\u6761\u66F8\u304D\u30EA\u30B9\u30C8",ordered:"\u756A\u53F7\u4ED8\u304D\u30EA\u30B9\u30C8",check:"\u30D0\u30C3\u30AF\u30ED\u30B0",link:"URL",quote:"\u5F15\u7528",alignLeft:"\u5DE6\u63C3\u3048",alignRight:"\u53F3\u63C3\u3048",alignCenter:"\u4E2D\u592E\u63C3\u3048",alignGroup:"\u5BF9\u9F50\u65B9\u5F0F",heading:"\u898B\u51FA\u3057{name}",headingGroup:"\u30BF\u30A4\u30C8\u30EB\u30B9\u30BF\u30A4\u30EB",text:"\u672C\u6587"}};L.mergeLang({"zh-CN":ZF,"en-US":QF,"ja-JP":YF});const Boe="";function Ys(n,...e){const t=mo(...e);return t.classList.remove("editor-button"),t.classList.add("editor-text-button"),n.append(t),t}function i9(n){const e=Ef(n);e==null||e.hide();const t=n.findCustom("table-border-bar");t==null||t.closeToolbar()}function JF(n){return k("div",["insert-column-button","drop-marker"],n)}const KF=D("row-height");function s9(n){const e=Te.fromTable(n),t=n.rows;g(KF,t.length===e.rowCount,"row count mismatch");const o=Array(e.rowCount).fill(0);for(let r=0;r<t.length;){let i=1,l=t[r].getBoundingClientRect().height,a=r+1;for(;a<t.length;){const d=t[a];if(d.cells.length!==0)break;i++,a++,l+=d.getBoundingClientRect().height}for(let d=0;d<i;d++)o[r+d]=l/i;r=a}return o}const XF=D("table-border-bar-dom");function l9(n){var a;const e=ne(n.contentElement);g(XF,e,"no block");const o=tt(e).querySelector(".table-border-bar-container.left"),i=Le(e).offsetLeft-fc,s=((a=n.scrollOptions.paddingLeft)!=null?a:0)+i,l=Math.min(n.contentElement.offsetLeft-i,n.rootElement.scrollLeft-s);o&&(o.style.left=`${-l}px`)}const Ki=D("table-border-bar-dom");function Ec(n,e){g(Ki,Ft(e),"invalid table block");const t=_t(e),o=br(n,e),r=tt(e),i=(p,C,v)=>{const B=k("div",["button-root",C],p),S=k("div",["button-container",C],B);B.setAttribute(`data-${C}-index`,`${v}`),S.setAttribute(`data-editor-tooltip-${n.clientId}`,C==="left"?L.t("table.insertRow"):L.t("table.insertCol")),k("span",["insert-indicator"],S),JF(S)},{selectedRows:s,selectedColumns:l}=Xp(n,e),a=()=>{const p=o.querySelector(".table-border-bar-container.top");g(Ki,p,"no top border bar container");const C=k("div",["table-border-bar-container","top"],null),v=k("div",["table-border-bar","top"],C),B=sO(t),x=Te.fromTable(t).colCount;n.selection.range.isSimple()&&i(v,"top",0);for(let _=0;_<x;_++){const R=_===x-1?B[_]+2:B[_],H=k("span",["table-border-bar-cell","top"],v);l.has(_)&&H.classList.add("selected"),H.setAttribute("data-top-index",`${_}`),H.style.width=`${R}px`,n.selection.range.isSimple()&&i(v,"top",_+1)}xa(p,C)},d=()=>{const p=r.querySelector(".table-border-bar-container.left");g(Ki,p,"no left border bar container");const C=k("div",["table-border-bar-container","left"],null),v=k("div",["table-border-bar","left"],C);k("span",["table-border-bar-cell","corner"],v);const B=s9(t);n.selection.range.isSimple()&&i(v,"left",0),Array.from(t.rows).forEach((S,x,_)=>{const R=k("span",["table-border-bar-cell","left"],v);s.has(x)&&R.classList.add("selected"),R.setAttribute("data-left-index",`${x}`);const H=x===_.length-1?B[x]+2:B[x];R.style.height=`${H}px`,n.selection.range.isSimple()&&i(v,"left",x+1)}),xa(p,C)};a(),d();const h=n.findCustom(Ar(e));h&&l9(h)}function c9(n,e){const t=e.target;if(!(t instanceof Element))return;const o=ne(t);g(Ki,o&&Ft(o),"invalid table block"),Ec(n,o),n.selection.caret.update()}function $f(n,e){const t=e.target;if(!(t instanceof Element))return;const o=ne(t);g(Ki,o&&Ft(o),"invalid table block");const r=t.closest(".button-root");if(r){if(r.classList.contains("top")){const i=parseInt(r.getAttribute("data-top-index")||"0",10);p7(n,o,i),Ec(n,o)}else if(r.classList.contains("left")){const i=parseInt(r.getAttribute("data-left-index")||"0",10);C7(n,o,i),Ec(n,o)}}}function Hf(n,e){var s;i9(n),e.preventDefault(),e.stopPropagation();let t=null,o,r;const i=l=>{var a;if(l.target instanceof HTMLElement&&o&&t&&r!==void 0){const d=ne(l.target),h=l.target.closest(".table-border-bar");if(d===t&&h){const p=parseInt((a=l.target.getAttribute(`data-${o}-index`))!=null?a:"0",10),C=Math.min(r,p),v=Math.abs(r-p)+1;xe(l.target,"top")&&o==="top"?vO(n,d,C,v,{reverse:!0}):xe(l.target,"left")&&o==="left"&&yO(n,d,C,v,{reverse:!0})}}l.type==="mouseup"&&(t=null,r=void 0,o=void 0,document.body.removeEventListener("mousemove",i),document.body.removeEventListener("mouseup",i))};e.target instanceof HTMLElement&&xe(e.target,"table-border-bar-cell")&&(t=ne(e.target),xe(e.target,"top")?o="top":xe(e.target,"left")&&(o="left"),o&&t&&(r=parseInt((s=e.target.getAttribute(`data-${o}-index`))!=null?s:"0",10),document.body.addEventListener("mousemove",i),document.body.addEventListener("mouseup",i)))}function a9(n){const e=n.selection.range,t=Cu(n,e);t&&Ec(n,t)}function eP(n,e){g(Ki,Ft(e),"invalid table block");const t=br(n,e),o=tt(e),r=k("div",["table-border-bar-container","top"],t),i=k("div",["table-border-bar-container","left"],o);Ec(n,e),n.domEvents.addEventListener(Le(e),"scroll",c9),n.domEvents.addEventListener(r,"click",$f),n.domEvents.addEventListener(i,"click",$f),n.domEvents.addEventListener(r,"mousedown",Hf),n.domEvents.addEventListener(i,"mousedown",Hf),n.addListener("afterClearSelection",a9)}function u9(n,e){if(!n.isWritable())return;if(br(n,e).querySelector(".table-border-bar-container")){Ec(n,e);return}eP(n,e)}function d9(n,e){g(Ki,Ft(e),"invalid table block");const t=br(n,e),o=tt(e),r=t.querySelectorAll(".table-border-bar-container"),i=o.querySelectorAll(".table-border-bar-container");r.forEach(s=>{n.domEvents.removeEventListener(s,"click",$f),n.domEvents.removeEventListener(s,"mousedown",Hf),s.remove()}),i.forEach(s=>{n.domEvents.removeEventListener(s,"click",$f),n.domEvents.removeEventListener(s,"mousedown",Hf),s.remove()}),n.domEvents.removeEventListener(Le(e),"scroll",c9),n.addListener("afterClearSelection",a9)}function tP(n,e){g(Ki,Ft(e),"invalid table block");const o=br(n,e).querySelector(".table-border-bar-container.top");return o?o.getBoundingClientRect().height:0}class nP{constructor(e,t){m(this,"toolbar");m(this,"handleSelectionChange",(e,t)=>{!e.isVisible||(t==="delete-columns"?(Gi(this.editor,this.tableBlock,!0,!0),Zi(this.editor,this.tableBlock,!0,!0)):t==="delete-rows"?(Gi(this.editor,this.tableBlock,!0,!1),Zi(this.editor,this.tableBlock,!0,!1)):(Gi(this.editor,this.tableBlock,!1),Zi(this.editor,this.tableBlock,!1)))});m(this,"handleClick",(e,t,o)=>{t.id==="delete-columns"?e0(this.editor.selection.range):t.id==="delete-rows"&&t0(this.editor.selection.range)});m(this,"handleToolbarClose",()=>{this.tableBlock&&Cu(this.editor,this.editor.selection.range)===this.tableBlock&&(Gi(this.editor,this.tableBlock,!1),Zi(this.editor,this.tableBlock,!1))});this.editor=e,this.tableBlock=t;const o=e.options.componentsOptions.popover;this.toolbar=new mu([],void 0,{id:"table-row-column-toolbar",overflowBoundary:o==null?void 0:o.overflowBoundary,refuseOverflow:!0,tooltipId:this.editor.clientId}),this.toolbar.addListener("selectionChange",this.handleSelectionChange),this.toolbar.addListener("click",this.handleClick),this.toolbar.addListener("close",this.handleToolbarClose)}close(){this.toolbar.close("cancelBar")}update(){var r,i,s;const{selectedColumns:e,selectedRows:t}=Xp(this.editor,this.tableBlock);if(!this.editor.isWritable())return;if(e.size>0&&t.size>0){this.toolbar.close("cancelBar");return}if(e.size===0&&t.size===0){this.toolbar.close("cancelBar");return}const o=Vr(this.editor,this.tableBlock,this.editor.selection.range)[0];if(!o){this.toolbar.close("cancelBar");return}if(e.size>0){const l={id:"delete-columns",name:L.t("table.deleteSelectCol"),icon:YL};this.toolbar.updateItems([l]);const a=Zr(this.editor,this.tableBlock,"table-row-column-delete",o);this.toolbar.manualShow(a,{placement:"top",offset:[0,5]})}else{const l={id:"delete-rows",name:L.t("table.deleteSelectRow"),icon:QL};this.toolbar.updateItems([l]);const h=tt(this.tableBlock).querySelector(".table-border-bar-container.left").getBoundingClientRect(),p=new DOMRect(Math.max(h.left,o.left-fc),o.top,fc,o.height),C=Zr(this.editor,this.tableBlock,"table-row-column-delete",p);this.toolbar.manualShow(C,{placement:"left",offset:[0,5]});const v=this.editor.options.componentsOptions.popover;(r=this.toolbar.tippyInstance)==null||r.setProps({popperOptions:{modifiers:[{name:"flip",options:{boundary:v==null?void 0:v.overflowBoundary,fallbackPlacements:["left","right"]}}]}})}(s=(i=this.toolbar.tippyInstance)==null?void 0:i.popperInstance)==null||s.update()}destroy(){this.toolbar.destroy(),this.toolbar.removeAllListeners()}}const z0=D("table-border-bar");class oP{constructor(e,t){m(this,"toolbar");m(this,"resizeObserver",null);m(this,"handleReadonlyChanged",e=>{e.isWritable()?this.update():d9(this.editor,this.tableBlock)});m(this,"handleBlockUpdated",()=>{var e;(e=this.resizeObserver)==null||e.disconnect(),setTimeout(()=>{var o;const t=this.editor.getBlockById(ie(this.tableBlock));(o=this.resizeObserver)==null||o.observe(_t(t))})});m(this,"handleScroll",()=>{var e;(e=this.toolbar)==null||e.update()});m(this,"handleTableResize",()=>{!this.editor.isWritable()||this.update()});this.editor=e,this.tableBlock=t,g(z0,this.tableBlock,"no table block"),z0.debug("create table border bar"),u9(this.editor,this.tableBlock),this.resizeObserver=new vs(this.handleTableResize),this.resizeObserver.observe(_t(this.tableBlock));const o=e.getComponentOptions("table");o!=null&&o.hideToolbar||(this.toolbar=new nP(this.editor,this.tableBlock)),this.editor.addListener("readonlyChanged",this.handleReadonlyChanged)}close(){var e;(e=this.toolbar)==null||e.close()}destroy(){var e,t;z0.debug("destroy table border bar"),(e=this.resizeObserver)==null||e.disconnect(),this.resizeObserver=null,d9(this.editor,this.tableBlock),(t=this.toolbar)==null||t.destroy(),this.editor.removeListener("readonlyChanged",this.handleReadonlyChanged)}update(){var e;u9(this.editor,this.tableBlock),(e=this.toolbar)==null||e.update()}}const rP=D("table-border-bar");class iP{constructor(e){m(this,"activeTableBar",null);m(this,"handleBlockDeleted",(e,t)=>{!this.activeTableBar||(t===this.activeTableBar.tableBlock||et(t,this.activeTableBar.tableBlock))&&(this.activeTableBar.destroy(),this.activeTableBar=null)});m(this,"handleSelectionChanged",e=>{setTimeout(()=>{var r;const t=e.selection.range,o=Cu(e,t);((r=this.activeTableBar)==null?void 0:r.tableBlock)!==o&&this.activeTableBar&&this.hide(),o&&this.show(o)})});m(this,"handleScroll",()=>{var e;(e=this.activeTableBar)==null||e.handleScroll()});this.editor=e,this.editor.addListener("blockDeleted",this.handleBlockDeleted),this.editor.addListener("selectionChanged",this.handleSelectionChanged)}destroy(){this.editor.removeListener("blockDeleted",this.handleBlockDeleted),this.editor.removeListener("selectionChanged",this.handleSelectionChanged)}show(e){this.activeTableBar?(this.activeTableBar.tableBlock!==e&&this.hide(),this.activeTableBar.update()):this.activeTableBar=new oP(this.editor,e)}update(){var e;(e=this.activeTableBar)==null||e.handleBlockUpdated()}closeToolbar(){var e;(e=this.activeTableBar)==null||e.close()}hide(){!this.activeTableBar||(g(rP,this.activeTableBar,"no active table bar"),this.activeTableBar.destroy(),this.activeTableBar=null)}}function h9(n,e){const t=n.addCustom("table-border-bar",o=>new iP(o));e==="update"&&t.update()}const Mn=D("table-cell-menu"),sP="style-bg-color-";class lP{constructor(e){m(this,"activeTableBlock",null);m(this,"targetButton",null);m(this,"manualMenu",null);m(this,"colorPaletteItem",null);m(this,"handlePrevent",(e,t)=>{t.stopPropagation()});m(this,"handleReadonlyChanged",e=>{e.isWritable()||this.hide()});m(this,"handleSelectionChanged",e=>{const t=e.selection.range,o=Cu(e,t);if(this.hide(),this.activeTableBlock!==o&&(this.activeTableBlock=o),this.activeTableBlock){const r=Te.fromBlock(this.activeTableBlock),i=t.isReverse()?t.start:t.end;let s=null;i instanceof Oo?e.getBlockById(i.blockId)===this.activeTableBlock?s=r.getCellByContainerId(i.childContainerId):s=this.getCellByChildBlockId(r,i.blockId):i.blockId!==this.activeTableBlock.id&&(s=this.getCellByChildBlockId(r,i.blockId)),s&&this.editor.isWritable()&&this.showCellMenuButton(s)}});m(this,"handleBeforePopupPalette",()=>{var t;const e=this.getSelectedBkgColorIndex();(t=this.colorPaletteItem)==null||t.palette.setColor("backgroundColor",e)});m(this,"createBkgColorItem",()=>{const e=k("div",["cell-background-color-item"],null);k("span",[],e,L.t("table.cellBackground"));const t=this.getSelectedBkgColorIndex();k("button",["item-button"],e).setAttribute("data-color-index",`${t}`);const r=k("span",["item-sub-indicator"],e);return r.innerHTML=Av,e});m(this,"handleCommand",e=>{var r;g(Mn,this.activeTableBlock,"no target table block");const t=((r=e.states)==null?void 0:r.includes("checked"))||!1,o=e.value;switch(e.id){case"delete-select-row":t0(Jv(this.editor,this.activeTableBlock,!1));break;case"delete-select-col":e0(Jv(this.editor,this.activeTableBlock,!0));break;case"merge-cell":Zv(this.editor.selection.range);break;case"split-cell":this.handleSplitCell();break;case"row-title":this.handleRowTitle(t);break;case"col-title":this.handleColTitle(t);break;case"stripe-style":this.handleStripeStyle(t);break;case"hide-border":TR(this.editor,this.activeTableBlock,o==="show-border");break;case"show-chart":RR(this.editor,this.activeTableBlock,o==="show-chart"),u0(this.editor,this.activeTableBlock,{updateNow:!0});break}});m(this,"handleToolbarClose",()=>{this.targetButton&&re(this.targetButton,"active"),this.activeTableBlock&&Cu(this.editor,this.editor.selection.range)===this.activeTableBlock&&(Gi(this.editor,this.activeTableBlock,!1),Zi(this.editor,this.activeTableBlock,!1)),this.editor.focus()});m(this,"handleSelectionChange",(e,t)=>{!e.isVisible||(g(Mn,this.activeTableBlock,"no target table block"),t==="cell-background-color"&&this.handleBeforePopupPalette(),t==="delete-select-row"?(Gi(this.editor,this.activeTableBlock,!0,!1),Zi(this.editor,this.activeTableBlock,!0,!1)):t==="delete-select-col"?(Gi(this.editor,this.activeTableBlock,!0,!0),Zi(this.editor,this.activeTableBlock,!0,!0)):(Gi(this.editor,this.activeTableBlock,!1),Zi(this.editor,this.activeTableBlock,!1)))});m(this,"handleClick",(e,t)=>{var o;g(Mn,this.activeTableBlock,"no target table block"),g(Mn,this.targetButton,"no target button"),i9(this.editor),xe(this.targetButton,"active")?(re(this.targetButton,"active"),(o=this.manualMenu)==null||o.close("clickItem")):(W(this.targetButton,"active"),this.manualMenu?this.manualMenu.updateItems(this.createCommandMenu()):(this.manualMenu=new Vs(this.createCommandMenu()),this.manualMenu.on("click",(r,i)=>{var s;this.handleCommand(i),(s=this.manualMenu)==null||s.close("clickItem")}),this.manualMenu.on("selectionChange",this.handleSelectionChange),this.manualMenu.on("close",this.handleToolbarClose)),this.manualMenu.manualShow(this.targetButton,{placement:"right-start"})),t.stopPropagation()});this.editor=e,this.editor.addListener("selectionChanged",this.handleSelectionChanged),this.editor.addListener("readonlyChanged",this.handleReadonlyChanged)}destroy(){var e,t;this.activeTableBlock=null,this.targetButton=null,this.editor.removeListener("selectionChanged",this.handleSelectionChanged),this.editor.removeListener("readonlyChanged",this.handleReadonlyChanged),(e=this.manualMenu)==null||e.destroy(),(t=this.colorPaletteItem)==null||t.destroy()}hide(){var e;(e=this.manualMenu)==null||e.close("cancelBar"),this.targetButton&&(re(this.targetButton,"active"),this.targetButton.style.display="none")}getCellByChildBlockId(e,t){let o=this.editor.getBlockById(t);for(;o;){const r=o.closest("td");g(Mn,r,"no parent cell");const i=ne(r);if(g(Mn,i,"no parent block"),_t(i)===e.table)return e.getCellByCellElement(r);o=i}return g(Mn,!1,"filed to get cell by child block id"),null}createTargetButton(e){this.targetButton?e.querySelector(`:scope > .${s0}`)||e.appendChild(this.targetButton):(this.targetButton=k("button",[s0],e),this.targetButton.innerHTML=ff,this.editor.domEvents.addEventListener(this.targetButton,"click",this.handleClick),this.editor.domEvents.addEventListener(this.targetButton,"mousedown",this.handlePrevent),this.editor.domEvents.addEventListener(this.targetButton,"dblclick",this.handlePrevent))}showCellMenuButton(e){this.createTargetButton(e.cell),g(Mn,this.targetButton,"no target button"),this.targetButton.style.display="inline-block"}handleSplitCell(){if(this.activeTableBlock){const e=Te.fromBlock(this.activeTableBlock),t=this.editor.selection.range;if(t.isSimple()){const{col:o,row:r}=this.getCellByChildBlockId(e,t.start.blockId);o0(this.editor,this.activeTableBlock,{col:o,row:r})}else r0(this.editor.selection.range)}}getSelectedBkgColorIndex(){var r;g(Mn,this.activeTableBlock,"no target table block");const e=LR(this.editor,this.activeTableBlock),t=this.editor.getBlockData(this.activeTableBlock),o=new Set;for(const i of e){if(o.size>1)break;const s=ce(i),l=t[`${s}_background`];if(l)o.add(Number.parseInt((r=l.substring(sP.length))!=null?r:"0",10));else{o.add(-1);break}}return o.size===1&&[...o][0]!==-1?[...o][0]:-1}createCommandMenu(){g(Mn,this.activeTableBlock,"no target table block");const e=this.editor.getBlockData(this.activeTableBlock),t=Gv(this.editor,this.activeTableBlock,this.editor.selection.range);let o=this.editor.selection.range;if(o.isSimple()){const h=ni(this.editor,this.activeTableBlock,o.start);o=zt(this.editor,{anchor:h,focus:h})}const r=qv(this.editor,this.activeTableBlock,o),i=e.hasRowTitle,s=e.hasColTitle,l=e.isStripeStyle,a=e.noBorder,d=e.chart;return this.colorPaletteItem=new Hv("cell-background-color",{color:!1}),this.colorPaletteItem.palette.on("onClick",(h,p)=>{var C;switch(g(Mn,this.activeTableBlock,"no target table block"),h){case"clearColor":e7(this.editor,this.activeTableBlock,-1);break;case"backgroundColor":e7(this.editor,this.activeTableBlock,p);break}(C=this.manualMenu)==null||C.close("clickItem")}),[{id:"cell-background-color",name:L.t("table.cellBackground"),element:this.createBkgColorItem(),children:[this.colorPaletteItem]},{id:"separator",name:"",type:"separator"},{id:"merge-cell",name:L.t("table.mergeCell"),states:t?[]:["disabled"]},{id:"split-cell",name:L.t("table.splitCell"),states:r?[]:["disabled"]},{id:"separator",name:"",type:"separator"},{id:"delete-select-row",name:L.t("table.deleteSelectRow")},{id:"delete-select-col",name:L.t("table.deleteSelectCol")},{id:"separator",name:"",type:"separator"},{id:"table-config",name:L.t("table.tableConfigKey"),children:[{id:"row-title",name:L.t("table.tableConfig.rowTitle"),states:i?["checked"]:[]},{id:"col-title",name:L.t("table.tableConfig.colTitle"),states:s?["checked"]:[]},{id:"stripe-style",name:L.t("table.tableConfig.stripeStyle"),states:l?["checked"]:[]},{id:"hide-border",name:a?L.t("table.tableConfig.showBorder"):L.t("table.tableConfig.hideBorder"),value:a?"show-border":"hide-border"},{id:"show-chart",name:d?L.t("table.tableConfig.hideChart"):L.t("table.tableConfig.showChart"),value:d?"hide-chart":"show-chart"}]}]}handleRowTitle(e){g(Mn,this.activeTableBlock,"no target table block"),e?ER(this.editor,this.activeTableBlock):BR(this.editor,this.activeTableBlock)}handleColTitle(e){g(Mn,this.activeTableBlock,"no target table block"),e?wR(this.editor,this.activeTableBlock):kR(this.editor,this.activeTableBlock)}handleStripeStyle(e){g(Mn,this.activeTableBlock,"no target table block"),e?IR(this.editor,this.activeTableBlock):xR(this.editor,this.activeTableBlock)}}function f9(n){n.addCustom("table-cell-menu",e=>new lP(e))}const jf=D("table-container");function V0(n){const e=n.closest("td");return g(jf,e,"no parent cell for a table cell container"),e}function m9(n){const e=_t(n);return Array.from(e.querySelectorAll(':scope > tbody > tr > td > [data-type="editor-container"].child'))}function W0(n,e,t,o){const r=Te.fromBlock(n),i=r.getCellByContainerId(ce(e));if(t==="ArrowDown"){const s=r.getBottomCell(i);return s?s.container:null}if(t==="ArrowUp"){const s=r.getTopCell(i);return s?s.container:null}if(t==="ArrowLeft"){const s=r.getAllContainers(),l=s.indexOf(e);if(g(jf,l>=0,"not a valid child container"),l===0)return null;const a=s[l-1];return o!=null&&o.noWrap&&r.getCellByContainerId(ce(a)).row!==i.row?null:a}if(t==="ArrowRight"){const s=r.getAllContainers(),l=s.indexOf(e);if(g(jf,l>=0,"not a valid child container"),l===s.length-1)return null;const a=s[l+1];return o!=null&&o.noWrap&&r.getCellByContainerId(ce(a)).row!==i.row?null:a}g(jf,!1,`invalid navigation type: ${t}`)}const cP=12,aP=90,Uf=23,g9=2;class uP{constructor(e){m(this,"scrollTableBlock",null);m(this,"autoScrollDir",null);m(this,"autoScrollTimer",null);m(this,"handleMouseDown",e=>{const t=document.elementFromPoint(e.clientX,e.clientY);if(t&&t instanceof HTMLElement){const o=ne(t);if(o&&et(this.editor.rootContainer,o)){const r=ti(o);r&&(this.scrollTableBlock=r,document.addEventListener("mousemove",this.handleAutoScroll))}}});m(this,"handleAutoScroll",lE.default(e=>{if(this.scrollTableBlock){const t=this.editor.getCustom(Ar(this.scrollTableBlock)),o=t.rootElement,r=t.scrollOptions.parentContainer,i=o.getBoundingClientRect(),s=window.innerHeight-this.getBarFloatWindowBottom(t),l=r.getBoundingClientRect(),a=Math.min(l.bottom,s),d=Math.max(l.top,0);i.bottom>a&&e.clientY>=a?this.setAutoScroll("bottom"):i.top<d&&e.clientY<=d?this.setAutoScroll("top"):o.scrollLeft>0&&e.clientX<i.left?this.setAutoScroll("left"):o.scrollLeft<o.scrollWidth-o.offsetWidth&&e.clientX>i.right?this.setAutoScroll("right"):this.clearAutoScroll()}},15));m(this,"handleMouseUp",()=>{document.removeEventListener("mousemove",this.handleAutoScroll),setTimeout(()=>{this.scrollTableBlock=null})});m(this,"handleSelectionChanged",e=>{const t=e.selection.range;if(t.isCollapsed()&&t.isSimple()){const o=e.getBlockById(t.start.blockId),r=ti(o);if(r){const i=e.getCustom(Ar(r)),s=i.rootElement.getBoundingClientRect(),l=Mo(e,o,t.start);if(s.left>l.left){const a=t.start.offset===0?cP:g9;i.rootElement.scrollLeft-=s.left-l.left+a}else if(l.right>s.right){const a=t.start.offset===0?aP:g9;i.rootElement.scrollLeft+=l.right-s.right+a}}}else{const o=e.getBlockById(t.start.blockId),r=ti(o),i=e.getBlockById(t.end.blockId),s=ti(i);if(r&&r===s){const l=e.getCustom(Ar(r)),a=l.rootElement.getBoundingClientRect();let d=null;if(t.isSimple())d=t.isReverse()?Mo(e,o,t.start):Mo(e,i,t.end);else{const h=V0(sr(e,t.start.childContainerId)),p=V0(sr(e,t.end.childContainerId));d=t.isReverse()?h.getBoundingClientRect():p.getBoundingClientRect()}a.left>d.left&&t.isReverse()?l.rootElement.scrollLeft-=a.left-d.left:a.right<d.right&&!t.isReverse()&&(l.rootElement.scrollLeft+=d.right-a.right)}}});m(this,"handleScroll",e=>{zv(e),this.editor.selection.caret.update()});m(this,"handleReset",e=>{zv(e),this.editor.selection.caret.update();const t=this.editor.findCustom("table-border-bar");t&&t.handleScroll(),l9(e)});this.editor=e,this.editor.addListener("selectionChanged",this.handleSelectionChanged),document.addEventListener("mousedown",this.handleMouseDown),document.addEventListener("mouseup",this.handleMouseUp)}getBarFloatWindowBottom(e){return e.scrollOptions.barFloatWindowBottom?typeof e.scrollOptions.barFloatWindowBottom=="number"?e.scrollOptions.barFloatWindowBottom:e.scrollOptions.barFloatWindowBottom():0}clearAutoScroll(){this.autoScrollTimer&&(clearInterval(this.autoScrollTimer),this.autoScrollTimer=null,this.autoScrollDir=null)}setAutoScroll(e){this.autoScrollDir&&this.autoScrollDir!==e&&this.clearAutoScroll(),this.autoScrollTimer||(this.autoScrollDir=e,this.autoScrollTimer=window.setInterval(()=>{if(this.scrollTableBlock){const t=this.editor.getCustom(Ar(this.scrollTableBlock)),o=t.rootElement,r=t.scrollOptions.parentContainer,i=o.getBoundingClientRect(),s=r===document.documentElement?window.innerHeight:r.offsetHeight,l=window.innerHeight-this.getBarFloatWindowBottom(t),a=r.getBoundingClientRect(),d=Math.min(a.bottom,l),h=Math.max(a.top,0);this.autoScrollDir==="left"&&(o.scrollLeft-=Uf,o.scrollLeft<=0&&this.clearAutoScroll()),this.autoScrollDir==="right"&&(o.scrollLeft+=Uf,o.scrollLeft>=o.scrollWidth-o.offsetWidth&&this.clearAutoScroll()),this.autoScrollDir==="bottom"&&(r.scrollTop+=Uf,(r.scrollTop>=r.scrollHeight-s||i.bottom<=d)&&this.clearAutoScroll()),this.autoScrollDir==="top"&&(r.scrollTop-=Uf,(r.scrollTop<=0||i.top>=h)&&this.clearAutoScroll())}},100))}destroy(){document.removeEventListener("mousedown",this.handleMouseDown),document.removeEventListener("mouseup",this.handleMouseUp),this.editor.removeListener("selectionChanged",this.handleSelectionChanged)}}function p9(n){return n.addCustom("table-scroll-events",e=>new uP(e))}const dP=D("table-doc-change-handler");class hP{constructor(e){this.editor=e,this.editor.addListener("docChanged",this.handleDocChanged)}handleDocChanged(e,t){if(!t){const{start:o,end:r}=e.selection.range;if(!e.findBlockById(o.blockId)||!e.findBlockById(r.blockId)){e.selection.selectBlock(e.getBlockByIndex("root",0),0);return}if(Gl(o)){const i=e.getBlockById(o.blockId);if(!Ft(i))return;if(g(dP,Gl(r),"invalid range"),!bh(e,o.childContainerId)||!bh(e,r.childContainerId)){e.selection.selectBlock(i,0);return}let s=null,l=null;const a=(d,h)=>{const p=h.getCellById(d.childContainerId),{colIndex:C=0,rowIndex:v=0}=d.custom;let B=-1,S=-1;return(p.col>C||p.col+p.colSpan-1<C)&&(B=p.col),(p.row>v||p.row+p.rowSpan-1<v)&&(S=p.row),B!==-1||S!==-1?ft(i,d.childContainerId,{colIndex:B===-1?C:B,rowIndex:S===-1?v:S}):null};if(o.custom){const d=Te.fromBlock(i);s=a(o,d),l=a(r,d)}(s!==null||l!==null)&&(e.selection.range.isReverse()?e.selection.setSelection(l!=null?l:r,s!=null?s:o):e.selection.setSelection(s!=null?s:o,l!=null?l:r))}}}destroy(){this.editor.removeListener("docChanged",this.handleDocChanged)}}function C9(n){n.addCustom("table-doc-change-handler",e=>new hP(e))}const vr=D("create-content");function A9(n,e,t){const o=new gf(t),r=t.rows,i=t.cols;g(vr,r>=1,`invalid rows: ${r}`),g(vr,i>=1,`invalid cols: ${i}`),g(vr,t.children,"no table children");const s=k("table",[],null),l=t.colsWidth,a=k("colgroup",[],s);for(let p=0;p<o.colCount;p++){const C=k("col",[],a);l[p]&&(C.style.width=`${l[p]}px`)}const d=k("tbody",[],s);let h=0;for(let p=0;p<r;p++){const C=k("tr",[],d);for(let v=0;v<i;v++){const B=o.getCell({col:v,row:p});if(B.virtual)g(vr,B.colSpan>1||B.rowSpan>1,"virtual cell should have colSpan or rowSpan");else{const S=t.children[h],x=k("td",[],C);B.colSpan>1&&(x.colSpan=B.colSpan),B.rowSpan>1&&(x.rowSpan=B.rowSpan);const _=t[vu(S)];_&&W(x,_),v===0&&t.hasColTitle&&W(x,Qv.COL_TITLE_ITEM),n.createChildContainer(e,x,S),h+=1}}}return g(vr,h===t.children.length,"container count mismatch"),t.noBorder&&W(s,"no-border"),t.chart&&W(s,"editor-table-chart"),t.isStripeStyle&&W(s,"stripe"),t.hasRowTitle&&W(s,"row-title"),t.hasColTitle&&W(s,"col-title"),s}function fP(n,e,t,o,r){g(vr,r.type==="table","not table data"),g(vr,ce(t)===e[e.length-1].containerId,"invalid path");const i=r,s=Ss(o,"div");try{const l=k("div",[],null);l.setAttribute("data-type","table-content");const a=A9(n,e,i);a.classList.add("drag-preview-element"),l.appendChild(a);const d=n.getComponentOptions("table");m7(n),b7(n),h9(n,"create"),C9(n),d!=null&&d.hideCellMenu||f9(n),UL(n,d0);const h=n.addCustom(Ar(o),()=>rO());h.init({parentElement:s,childElement:l,safeRightSpace:50,safeLeftSpace:40,parentContainer:Ge(t)?n.scrollContainer:t,locatingContainer:Ge(t)?(d==null?void 0:d.locatingContainer)||n.parent:t,paddingLeft:fc+bu,paddingTop:fc+bu,paddingBottom:bu/2,paddingRight:bu/2,barFloatWindowBottom:d==null?void 0:d.barFloatWindowBottom,allowScrollBarFixed:d==null?void 0:d.allowScrollBarFixed,isSetScale:d==null?void 0:d.isSetScale});const p=p9(n);h.on("scroll",p.handleReset),h.on("resize",p.handleReset),setTimeout(()=>{FR(n,o)})}catch{const a=`invalid table data: ${JSON.stringify(i)}`;vr.error(a);const d=k("div",["error"],s);d.innerText=a}return s}function mP(n,e,t){g(vr,t.type==="table","not table data");const o=t,r=Le(e);try{const i=_t(e),s=_i(e),l=A9(n,s,o);l.classList.add("drag-preview-element"),i.insertAdjacentElement("afterend",l),i.remove();const a=n.getComponentOptions("table");m7(n),b7(n),h9(n,"update"),C9(n),a!=null&&a.hideCellMenu||f9(n),d0(n,e)}catch{const s=`invalid table data: ${JSON.stringify(o)}`;vr.error(s);const l=k("div",["error"],r);l.innerText=s}}function gP(n,e){let t,o,r=!1;if([...e].every(C=>C==="|")?(o=e.length,t=Array(o).fill(""),r=!0):(t=$m(e,"|").split("|"),o=t.length),o<2)return null;const i=3,s=o,l=[];for(let C=0;C<3;C++)t.forEach(v=>{l.push(Jr(n.doc,C===0?v:""))});const a=Array(s).fill(m0),d=l[r?0:s],h=n.doc.getContainerBlocks(d)[0].id;return{blockData:{id:K(),type:"table",rows:i,cols:s,children:l,colsWidth:a},focusBlockId:h}}function pP(n,e){const t=e.rows,o=e.cols;if(t<1||o<1)return null;const r=[];for(let d=0;d<t;d++)for(let h=0;h<o;h++)r.push(Jr(n.doc));const i=Array(o).fill(m0),s=r[0],l=n.doc.getContainerBlocks(s)[0].id;return{blockData:{id:K(),type:"table",rows:t,cols:o,children:r,colsWidth:i},focusBlockId:l}}const b9=D("table-selection-to-doc");function CP(n,e){const{start:t,end:o,block:r}=e,i=Se(r);g(b9,i==="table",`invalid block type: ${i}`);const s=n.getBlockData(r);if(t.isSimple()&&o.isSimple())return Hi(n.editorBlocks,n.doc.toJSON(),s);g(b9,!t.isSimple()&&!o.isSimple(),"invalid block pos type");const l=Te.fromBlock(r),{fromCol:a,toCol:d,fromRow:h,toRow:p}=zo(r,t,o),C={},v=[],B=n.doc.toJSON();let S={};l.sub({row:h,col:a},{row:p,col:d}).forEach((ee,fe)=>{ee.forEach((ve,ze)=>{const He=ve.containerId;if(v.indexOf(He)!==-1)return;v.push(He);let Ke;if(ve.virtual){const Ht=l.getCellByContainerId(ve.containerId),Rn=a+ze;let Sr=Ht.col+Ht.colSpan-1;Sr>d&&(Sr=d);const kn=Sr-Rn+1;kn>1&&(C[`${He}_colSpan`]=kn);const an=h+fe;let Dr=Ht.row+Ht.rowSpan-1;Dr>p&&(Dr=p);const li=Dr-an+1;li>1&&(C[`${He}_rowSpan`]=li),Ke=Yr()}else{if(Ke=Yg(n.editorBlocks,B,He),ve.col+ve.colSpan>d+1){const Ht=d-ve.col+1;Ht>1&&(C[`${He}_colSpan`]=Ht)}else ve.colSpan>1&&(C[`${He}_colSpan`]=ve.colSpan);if(ve.row+ve.rowSpan>p+1){const Ht=p-ve.row+1;Ht>1&&(C[`${He}_rowSpan`]=Ht)}else ve.rowSpan>1&&(C[`${He}_rowSpan`]=ve.rowSpan)}const{root:qt,...Yn}=Ke.blocks;S={...S,...Yn,[He]:qt}})});const _=Eu(_t(r)).slice(a,d+1);return{blocks:{root:[{id:K(),type:i,children:v,colsWidth:_,rows:p-h+1,cols:d-a+1,...C}],...S},meta:{},comments:{}}}function AP(n,e){if(e.top===0)return!0;for(let t=e.left;t<=e.right;t++)if(n[e.top-1][t]===n[e.top][t])return!1;return!0}function bP(n,e){if(e.left===0)return!0;for(let t=e.top;t<=e.bottom;t++)if(n[t][e.left-1]===n[t][e.left])return!1;return!0}function vP(n,e){if(e.bottom===n.length-1)return!0;for(let t=e.left;t<=e.right;t++)if(n[e.bottom][t]===n[e.bottom+1][t])return!1;return!0}function yP(n,e){if(e.right===n[0].length-1)return!0;for(let t=e.top;t<=e.bottom;t++)if(n[t][e.right]===n[t][e.right+1])return!1;return!0}function kP(n,e,t){const o=e.col,r=e.row,i=t.col,s=t.row,l={left:o,top:r,right:i,bottom:s};let a=!1;do{if(a=!1,!AP(n,l)){l.top--,a=!0;continue}if(!bP(n,l)){l.left--,a=!0;continue}if(!vP(n,l)){l.bottom++,a=!0;continue}if(!yP(n,l)){l.right++,a=!0;continue}}while(a);return l}function wP(n,e,t,o){if(t.custom!==void 0||o.custom!==void 0)return{anchor:t,focus:o};const r=Te.fromBlock(e),i=r.map(H=>H.containerId),s=r.getCellByContainerId(t.childContainerId),l=r.getCellByContainerId(o.childContainerId),a=Math.min(s.row,l.row),d=Math.max(s.row,l.row),h=Math.min(s.col,l.col),p=Math.max(s.col,l.col),C=kP(i,{row:a,col:h},{row:d,col:p}),v=r.getCell({row:C.top,col:C.left}),B=r.getCell({row:C.bottom,col:C.right}),S=r.getCell({row:C.top,col:C.right}),x=r.getCell({row:C.bottom,col:C.left});let _,R;return s.row<=l.row?s.col<=l.col?(_=v,R=B):(_=S,R=x):s.col<l.col?(_=x,R=S):(_=B,R=v),console.log(`move ${_.col}, ${_.row}, -> ${R.col}, ${R.row}`),{anchor:ft(e,_.containerId),focus:ft(e,R.containerId)}}function v9(n,e,t){if(t.isSimple())return[_t(e).getBoundingClientRect()];const o=_t(e),r=o.getBoundingClientRect(),{fromCol:i,fromRow:s,toCol:l,toRow:a}=zo(e,t.start,t.end),d=Eu(o),h=d.slice(0,i).reduce((S,x)=>S+x,0),p=h+d.slice(i,l+1).reduce((S,x)=>S+x,0),C=s9(o);let v=C.slice(0,s).reduce((S,x)=>S+x,0);const B=v+C.slice(s,a+1).reduce((S,x)=>S+x,0);if(s===0){const S=tP(n,e);v-=S}return[new DOMRect(r.left+h,r.top+v,p-h,B-v)]}D("table-size");const BP=40;function zf(n){const e=n.querySelector("td");if(!e)return 0;const t=window.getComputedStyle(e),o=Number.parseInt(t.borderLeft,10),r=Number.parseInt(t.borderRight,10);return(o+r)/2}function EP(n,e,t){const o=ag(n,t.container);return o!==void 0?o+zf(e):BP*t.colSpan-zf(e)}function xP(n,e,t,o){let r=0;const i=t.colCount;for(let s=0;s<i;s++){const l=t.getCell({col:s,row:o});if(l.virtual)continue;let a=EP(n,e,l);const d=P4(l.container,{withPadding:!0});d&&d>a&&(a=d),r+=a+zf(e)}return r}function IP(n,e){const t=_t(e),o=Te.fromTable(t);let r=0;for(let s=0;s<o.rowCount;s++)r=Math.max(r,xP(n,t,o,s));const i=zf(t);return r+=i,r}const oi=D("table-creator");async function TP(n,e){return n.undoManager.runInGroup(()=>{var a,d;const t=e.item,o=(a=t.colCount)!=null?a:5,r=(d=t.rowCount)!=null?d:3,i=pP(n,{cols:o,rows:r});if(!i)return null;const{blockData:s,focusBlockId:l}=i;return n.insertBlock(e.containerId,e.blockIndex,s,kt(n,l,0))})}class SP{constructor(){m(this,"id","insert-table");m(this,"name","Create table");m(this,"element");m(this,"closeable",null);m(this,"colCount");m(this,"rowCount");m(this,"setCloseable",e=>{this.closeable=e});m(this,"destroy",()=>{this.closeable=null});m(this,"getTableCreatorCellId",(e,t)=>`table-creator-cell-${e}-${t}`);m(this,"handleTableCreatorClick",e=>{var C,v;e.preventDefault(),e.stopPropagation();const t=e.target;g(oi,t instanceof HTMLElement,"invalid event target");const o=t.closest(".table-creator");g(oi,o,"no table creator");const r=o.querySelectorAll(".active");if(r.length===0)return;const s=r[r.length-1].id;g(oi,s,"no cell id");const l="table-creator-cell-";if(!s.startsWith(l))return;const d=s.substring(l.length).split("-");g(oi,d.length===2,"invalid cell id");const h=Number.parseInt(d[0],10)+1,p=Number.parseInt(d[1],10)+1;oi.debug(`${h}, ${p}`),this.colCount=p,this.rowCount=h,(C=this.closeable)==null||C.click(this,this.element),(v=this.closeable)==null||v.close("clickItem"),this.handleTableCreatorLeave()});m(this,"handleTableCreatorLeave",()=>{for(let e=0;e<9;e++)for(let t=0;t<9;t++){const o=this.getTableCreatorCellId(e,t),r=document.getElementById(o);r&&re(r,"active")}});m(this,"handleTableCreatorCellEnter",e=>{const t=e.target;g(oi,t instanceof HTMLElement,"invalid event target");const o=t.id,r="table-creator-cell-";g(oi,o.startsWith(r),"invalid cell id");const s=o.substring(r.length).split("-");g(oi,s.length===2,"invalid cell id");let l=Number.parseInt(s[0],10),a=Number.parseInt(s[1],10);l===0&&a===0&&(l=-1,a=-1);for(let d=0;d<9;d++)for(let h=0;h<9;h++){const p=this.getTableCreatorCellId(d,h),C=document.getElementById(p);g(oi,C,"no cell"),d<=l&&h<=a?W(C,"active"):re(C,"active")}});this.element=this.createTableCreatorElement()}createTableCreatorElement(){const e=k("div",["table-creator"],null),t=(o,r,i)=>{const s=k("div",["table-creator-cell"],o);return s.id=this.getTableCreatorCellId(r,i),s};e.addEventListener("click",this.handleTableCreatorClick),e.addEventListener("mouseleave",this.handleTableCreatorLeave);for(let o=0;o<9;o++){const r=k("div",["table-creator-row"],e);for(let i=0;i<9;i++)t(r,o,i).addEventListener("mouseenter",this.handleTableCreatorCellEnter)}return e}}function DP(){return new SP}function LP(n){const e=/[\u4e00-\u9fff\u3040-\u309f\u30a0-\u30ff\uac00-\ud7af]/g,t=n.match(e);return t?t.length:0}function y9(n){const e=LP(n);return n.length+e}function MP(n,e){const t=y9(n),o=e-t;return o>0?n+" ".repeat(o):n}function RP(n,e,t,o,r){const i=e,s=new gf(i);if(o==="markdown"||o==="text"){const l=x=>t.blocks[x].map((H,z)=>o==="markdown"?Hg(n,H,t,[...r,{containerId:x,blockIndex:z}]):Nh(n,H,t,[...r,{containerId:x,blockIndex:z}])),a=x=>l(x).join(" ").replace(/\n/g," ").trim(),d=new Map,h=new Map;for(let x=0;x<s.colCount;x++){let _=0;for(let R=0;R<s.rowCount;R++){const H=s.getCell({row:R,col:x});let z="";H.virtual||(z=a(H.containerId)),d.set(`${R},${x}`,z),_=Math.max(_,y9(z))}h.set(x,_)}const p=x=>{const _=d.get(`${x.row},${x.col}`)||"",R=h.get(x.col)||0;return MP(_,R)},C=[];let v="|",B="|";for(let x=0;x<s.colCount;x++){const _=p({row:0,col:x});v+=` ${_} |`;const R="-".repeat((h.get(x)||0)+2);B+=`${R}|`}C.push(v),C.push(B);for(let x=1;x<s.rowCount;x++){let _="|";for(let R=0;R<s.colCount;R++){const H=p({row:x,col:R});_+=` ${H} |`}C.push(_)}return`${C.join(`
411
411
  `)}
412
412
  `}if(o==="html"){const l=d=>t.blocks[d].map((C,v)=>$g(n,C,t,[...r,{containerId:d,blockIndex:v}])).join(`
413
413
  `),a=[];a.push("<table>");for(let d=0;d<s.rowCount;d++){let h="<tr>";for(let p=0;p<s.colCount;p++){const C=s.getCell({row:d,col:p});if(!C.virtual){const v=l(C.containerId);h+=`<td colSpan="${C.colSpan}" rowSpan="${C.rowSpan}">${v}</td>`}}h+="</tr>",a.push(h)}return a.push("</table>"),a.join(`
@@ -429,7 +429,7 @@ ${s}
429
429
  \`\`\`
430
430
  ${l}`:`<p><pre><code>${s}</code></pre></p>
431
431
  <p>${l}</p>`}const n2={blockType:"code",blockKind:"complex",createBlockContent:MN,getBlockTextLength:RN,getRangeFromPoint:ON,moveCaret:_N,getCaretRect:FN,updateSelection:PN,clearSelection:NN,getChildContainers:$N,getNextContainer:HN,getSelectedContainers:jN,convertFrom:nN,handleBlockElementUpdated:UN,getOptions:VN,getBlockProperties:WN,convertTo:qN},o2={...Sn,blockType:"code-line"};class GN{constructor(e){m(this,"handleSelectionChange",()=>{const e=this.editor.selection;if(!e.range.isCollapsed())return;const t=e.focusedBlock;if(!Ic(this.editor,t))return;const o=t,r=e.range.focus.offset,i=Y4(this.editor,o,r,"code-caret");i.scrollIntoView({block:"nearest"}),setTimeout(()=>{i.remove(),this.editor.selection.caret.update()})});this.editor=e,e.addListener("selectionChanged",this.handleSelectionChange)}destroy(){this.editor.removeListener("selectionChanged",this.handleSelectionChange)}}function F9(n,e){const t=n.split(`
432
- `).map(s=>({id:K(),type:"text",text:Ni(s)})),o=K();return{blocks:{root:[{children:[o],type:"code",id:K(),...e}],[o]:t},meta:{},comments:{}}}class ZN{handleBeforeCopy(e,t,o){const r=e.getFocusedBlock();if(!Ic(e,r))return;const i=Z0(r),s=e.getBlockData(i),{language:l,nowrap:a}=s;if(e.selection.range.isCollapsed()){const h=e.getBlockString(r);return F9(h,{language:l,nowrap:a})}const d=e.getSelectedText();return F9(d,{language:l,nowrap:a})}}function QN(n){if(!n.isWritable())return!1;const e=n.getFocusedBlock();if(!!Ic(n,e)){if(n.selection.range.isCollapsed()){const t=n.selection.range.start;return n.insertTextToBlock(e,t.offset," "),!0}return n.undoManager.runInGroup(()=>{cr(n).forEach(o=>{n.insertTextToBlock(o.block,0," ")})}),!0}}function YN(n){if(!n.isWritable())return!1;const e=n.getFocusedBlock();if(!Ic(n,e))return;const t=[" "," "];return n.undoManager.runInGroup(()=>{cr(n).forEach(r=>{const i=st(n.getBlockText(r.block));for(let s=0;s<t.length;s++){const l=t[s];if(i.startsWith(l)){n.deleteTextFromBlock(r.block,0,l.length);break}}})}),!0}function JN(n){const e=n.getFocusedBlock(),t=oe(e);if(Ge(t))return;const o=ne(t);if(!o||Se(o)!=="code")return;const r=n.selection.range;if(!!r.isSimple()&&!YA(t,r))return cp(n,t),!0}const KN={Tab:QN,"Shift+Tab":YN,"CtrlOrCmd+A":JN},Lu=D("code-text-decorate");class Wf{decorateText(e,t,o){var v;if(g(Lu,t.length>0,"invalid path"),t.length===1)return{};const r=t[t.length-2];if(e.doc.getBlockData(r.containerId,r.blockIndex).type!=="code")return{};const s=o;if(s.length===0)return{};const l=st(s),a=e.doc.getBlockData(r.containerId,r.blockIndex),d=Aa.default.tokenize(l,(v=Aa.default.languages[a.language])!=null?v:Aa.default.languages.plain),h=(B,S)=>{if(g(Lu,B,"no token"),typeof B=="string")return[{insert:B,attributes:me.default(S)}];g(Lu,B instanceof Aa.default.Token,"invalid token type");const x=B.content,_=me.default(S);return _[`style-code-${B.type}`]=!0,typeof x=="string"?[{insert:x,attributes:_}]:Array.isArray(x)?x.map(z=>h(z,_)).flat():(g(Lu,x instanceof Aa.default.Token,"invalid token"),h(x,_))},C=d.map(B=>h(B,{})).flat();return g(Lu,rn(C)===rn(s),"failed to highlight code, text length mismatch"),{text:C}}}const XN={code:{title:"\u4EE3\u7801",abstract:"\u4EE3\u7801",wrap:"\u6362\u884C",copy:"\u590D\u5236",caption:"\u8BF4\u660E",search:"\u8F93\u5165\u5173\u952E\u8BCD\u641C\u7D22",copySuccess:"\u590D\u5236\u6210\u529F"}},e$={code:{title:"Code",abstract:"Code",wrap:"Wrap",copy:"Copy",caption:"Caption",search:"Search",copySuccess:"Copied successfully"}},t$={code:{title:"\u30B3\u30FC\u30C9",abstract:"\u30B3\u30FC\u30C9",wrap:"\u6298\u308A\u8FD4\u3059",copy:"\u8907\u88FD",caption:"\u4F8B\u8A3C\u3059\u308B",search:"\u30AD\u30FC\u30EF\u30FC\u30C9\u3067\u691C\u7D22",copySuccess:"\u30B3\u30D4\u30FC\u3055\u308C\u307E\u3057\u305F"}};L.mergeLang({"zh-CN":XN,"en-US":e$,"ja-JP":t$});function n$(n,e,t,o){const r=n.getBlockByIndex(e,t);if(ue(n,r)!==o)return!1;const i=st(n.getBlockText(r));if(![...i].every(h=>h==="|")||i.length<3||!n.editorBlocks.hasBlock("table"))return!1;const s=n.editorBlocks.getBlockClass("table");if(!s.convertFrom)return!1;const l=s.convertFrom(n,r,{offset:o});if(!l)return!1;const{blockData:a,focusBlockId:d}=l;return a?(n.undoManager.runInGroup(()=>{var p;const h=n.insertBlock(e,t,a,kt(n,d!=null?d:a.id,0));n.deleteBlock(r),(p=l.onConverted)==null||p.call(l,n,h)}),!0):!1}const o$={mermaid:{blockType:"embed",reg:/^```mermaid$/,data:{embedType:"mermaid"}},flowchart:{blockType:"embed",reg:/^```flowchart$/,data:{embedType:"flowchart"}},plantuml:{blockType:"embed",reg:/^```plantuml$/,data:{embedType:"plantuml"}},code:{blockType:"code",reg:/^```\S+$/},code2:{blockType:"code",reg:/^```$/},table:{blockType:"table",reg:/^\|.+\|.+\|$/},math:{blockType:"embed",reg:/^\$\$.+\$\$$/},image:{blockType:"embed",reg:/^!\[[^\]]*\]\((?<filename>.*?)(?="|\))(?<optionalPart>".*")?\)/,data:{embedType:"image"}},dividing:{blockType:"embed",reg:/^-{3,}$/,data:{embedType:"dividing-line"}},toc:{blockType:"embed",reg:/^\[toc\]/,data:{embedType:"toc"}}},r$={orderedList:{reg:/^(\d)+(\.|。)$/,blockType:"list",data:{listType:"ordered"}},unorderedList1:{reg:/^\*$/,blockType:"list",data:{listType:"unordered"}},unorderedList2:{reg:/^-$/,blockType:"list",data:{listType:"unordered"}},checkList1:{reg:/^\[\s?\]$/,blockType:"list",data:{listType:"unchecked"}},checkList2:{reg:/^\[X\]$/i,blockType:"list",data:{listType:"checked"}},image:{blockType:"embed",reg:/^!\[[^\]]*\]\((?<filename>.*?)(?="|\))(?<optionalPart>".*")?\)/,data:{embedType:"image"}}};function qf(n,e,t,o,r){const i=n.getContainerById(e);if(!Ge(i)){const s=ne(i);if(s&&yr(s))return!0}return!1}function P9(n,e,t,o,r){if(qf(n,e))return!1;if(r==="enter"&&n$(n,e,t,o))return!0;const i=n.getBlockByIndex(e,t),s=st(Tn(n.getBlockText(i),o).left).trim(),l=r==="enter"?o$:r$;for(const[,a]of Object.entries(l)){if(!s.match(a.reg))continue;return!!n.undoManager.runInGroup(()=>{var B;const h=Ch(n,i,a.blockType,{offset:o,data:a.data});if(!h)return null;const{blockData:p,focusBlockId:C}=h;if(!p)return null;const v=n.insertBlock(e,t,p,kt(n,C!=null?C:p.id,0));return n.deleteBlock(i),(B=h.onConverted)==null||B.call(h,n,v),{newBlock:v,focusBlockId:C}})}return!1}function i$(n,e,t,o){const r=n.getBlockByIndex(e,t);return n.getBlockString(r,{boxReplacement:" "}).substring(0,o)!==">"?!1:(n.undoManager.runInGroup(()=>{n.deleteTextFromBlock(r,0,o+1),n.updateBlockData(r,{quoted:!0},kt(n,r,0))}),!0)}const s$={"#":1,"##":2,"###":3,"####":4,"#####":5,"######":6,"#######":7,"########":8};function l$(n,e,t,o){const r=n.getBlockByIndex(e,t),i=n.getBlockString(r,{boxReplacement:" "}).substring(0,o);let s=s$[i];if(!s)return!1;const l=n.getBlockData(r).heading;return l&&l==s&&(s=null),n.undoManager.runInGroup(()=>{n.deleteTextFromBlock(r,0,o+1),n.updateBlockData(r,{heading:s},kt(n,r,0))}),!0}function c$(n,e,t,o){return!!(l$(n,e,t,o)||i$(n,e,t,o))}const a$=D("match-text-style");function u$(n,e){if(n.length<e.length*2+1||!n.endsWith(e)||n.substring(0,n.length-1).endsWith(e))return-1;const t=n.substring(0,n.length-e.length),o=t.lastIndexOf(e);return o===-1?-1:o===0?0:t.substring(o-1).startsWith(e)?-1:o}const d$={"*":{type:"style",styles:["style-italic"],boxType:""},"**":{type:"style",styles:["style-bold"],boxType:""},"***":{type:"style",styles:["style-bold","style-italic"],boxType:""},"~~":{type:"style",styles:["style-strikethrough"],boxType:""},"`":{type:"style",styles:["style-code"],boxType:""},$$:{type:"box",styles:[],boxType:"math"}};function h$(n,e,t,o){var C,v;const r=n.getBlockByIndex(e,t),i=n.getBlockText(r),{left:s}=Tn(i,o),l=Tg(s),a=rn(s)-l.length,d=Object.entries(d$);for(const[B,S]of d){const x=u$(l,B);if(x===-1)continue;const _=a+x,R=o,H=B.length,z=st(Vt(i,_+H,R-_-H*2).middle);if(S.type==="style"){const Q={};S.styles.forEach(fe=>{Q[fe]=!0});const ee=Ni(z,Q);n.undoManager.runInGroup(()=>{n.deleteTextFromBlock(r,_,R-_),n.insertTextToBlock(r,_,ee)})}else if(S.type==="box")try{const Q=(v=(C=n.editorBoxes.getBoxClass(S.boxType)).convertFrom)==null?void 0:v.call(C,n,z);if(!Q)continue;n.undoManager.runInGroup(()=>{n.deleteTextFromBlock(r,_,R-_),n.insertBoxToBlock(r,_,Q)})}catch(Q){a$.warn(`failed to convert to box, ${Q.message}`);continue}return!0}const h=/\[([^\]]+)\]\((https?:\/\/\S+)\)\s*$/,p=l.match(h);if(p){const B=p.index,S=p[1],x=p[2],_=B,R=o,z={...Na(i,_),link:x};return n.undoManager.runInGroup(()=>{n.deleteTextFromBlock(r,_,R-_),n.insertTextToBlock(r,_,Ni(S,z))}),!0}return!1}class Gf{handleAfterInsertText(e,t,o,r,i){if(i===" "){if(qf(e,t))return!1;if(c$(e,t,o,r)||h$(e,t,o,r))return!0}return!1}handleBeforeKeyDown(e,t){if(!e.selection.range.isSimple())return!1;const{containerId:r,blockIndex:i,offset:s}=e.getTextPosition();if(te(e,e.getBlockByIndex(r,i))){if(rr(t,"Enter")){if(P9(e,r,i,s,"enter"))return!0}else if(rr(t,"Space")&&P9(e,r,i,s,"space"))return!0}return!1}}const f$={"en-US":{placeholder:{default:"Type / for commands",heading:"Title {heading}",list:"List",mention:"Quickly assign tasks and use @ to mention yourself or others",quote:"Quote",title:"Enter document title"}},"zh-CN":{placeholder:{default:"\u8F93\u5165\u300C/\u300D\u5FEB\u901F\u63D2\u5165",heading:"\u6807\u9898{heading}",list:"\u5217\u8868",mention:"\u5FEB\u901F\u5206\u914D\u4EFB\u52A1\uFF0C@\u63D0\u53CA\u81EA\u5DF1\u6216\u4ED6\u4EBA",quote:"\u5F15\u7528",title:"\u8BF7\u8F93\u5165\u6587\u6863\u6807\u9898"}},"ja-JP":{placeholder:{default:"\u300C/\u300D\u3092\u5165\u529B\u3057\u3066\u7D20\u65E9\u304F\u633F\u5165\u3059\u308B",heading:"\u898B\u51FA\u3057{heading}",list:"\u30EA\u30B9\u30C8",mention:"\u81EA\u5206\u3084\u30E1\u30F3\u30D0\u30FC\u3092\uFF20\u3057\u3001\u30BF\u30B9\u30AF\u3092\u7D20\u65E9\u304F\u5272\u308A\u5F53\u3066\u307E\u3059",quote:"\u5F15\u7528",title:"\u30BF\u30A4\u30C8\u30EB\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"}}};L.mergeLang(f$);function Mu(n,e){const t=$i(n,e);return!!(t.text&&rn(t.text)===0&&!e.querySelector(".inputting-insertion"))}function N9(n,e){var o;Le(e).removeAttribute("data-content-placeholder"),(o=e.querySelector("[data-type=block-tools] .block-placeholder-container"))==null||o.remove()}function Zf(n,e,t){var r;if(!Mu(n,e)){N9(n,e);return}const o=Le(e);if(typeof t=="string")o.setAttribute("data-content-placeholder",t);else{const i=tt(e),s=(r=i.querySelector(".block-placeholder-container"))!=null?r:k("div",["block-placeholder-container"],i);s.innerHTML="",s.appendChild(t)}}function m$(n){const e=n.getAttribute("data-style-heading");return e?L.t("placeholder.heading",{heading:e}):n.getAttribute("data-style-quoted")?L.t("placeholder.quote"):null}function g$(n){const e=n.getAttribute("data-list-type");return e?e==="ordered"||e==="unordered"?L.t("placeholder.list"):L.t("placeholder.mention"):null}function $9(n){switch(Se(n)){case"text":return m$(n);case"list":return g$(n);default:return null}}function p$(n){if(lo(n))return!1;const e=ne(oe(n));return e?Se(e)==="code":!1}function C$(n){return!lo(n)}function A$(n,e){var h,p;const t=n.selection.focusedBlock,o=Se(t),r=e.contentPlaceholder||L.t("placeholder.default");let i=r;if(o&&Da(n,o)&&t){if(!n.isBlockWritable(t)||p$(t))return;C$(t)&&(i=L.t("placeholder.common.contentInTable")),i=(h=$9(t))!=null?h:i}const s=n.getFirstBlock(),l=Qe(s);if(!l)return;const a=Qe(l);if(a&&!e.addPlaceholderToAllCurrentEmptyBlock)return;if(!a&&Mu(n,l)){Zf(n,l,(p=$9(l))!=null?p:r);return}const d=n.getFocusedBlock();!Mu(n,d)||d!==s&&Zf(n,d,i)}function b$(n,e){var r,i;const t=n.getFirstBlock(),o=Le(t);Mu(n,t)?(o.setAttribute("data-title-placeholder",(r=e.titlePlaceholder)!=null?r:L.t("placeholder.title")),o.setAttribute("data-title-placeholder-readonly",(i=e.readonlyTitlePlaceholder)!=null?i:"")):(o.removeAttribute("data-title-placeholder"),o.removeAttribute("data-title-placeholder-readonly"))}function v$(n){n.rootContainer.querySelectorAll("[data-content-placeholder").forEach(e=>{e.removeAttribute("data-content-placeholder")}),n.rootContainer.querySelectorAll("[data-type=block-tools] .block-placeholder-container").forEach(e=>{e.remove()})}function y$(n,e){v$(n),n.selection.range.isCollapsed()&&(b$(n,e),A$(n,e))}const Loe="";function k$(n){for(let e=1;e<n.length;e++){const t=n[e];if(t.attributes&&Object.keys(t.attributes).length)return!0}return!1}const H9=D("enforce-title");class Ru{constructor(e,t={headingLevel:1}){m(this,"handleSelectionChange",e=>{setTimeout(()=>{this.applyPlaceholder(e)})});this.options=t,this.handleChanged(e),this.applyPlaceholder(e),e.addListener("selectionChanged",this.handleSelectionChange)}destroy(e){e.removeListener("selectionChanged",this.handleSelectionChange)}handleBeforeKeyDown(e,t){if(!e.selection.range.isSimple())return!1;const{containerId:r,blockIndex:i,offset:s}=e.getTextPosition();if(!Ru.isDocumentTitleBlock(r,i)||!rr(t,"Enter"))return!1;let l=!1,a=null;So(e.rootContainer)===2&&(a=Ur(e.rootContainer,1),ue(e,a)===0&&(l=!0));const d=e.getFirstBlock();return e.undoManager.runInGroup(()=>{e.breakTextBlock(d,s,{forceInsertAfter:!0}),l&&a&&e.deleteBlock(a)}),!0}handleChanged(e){var t,o;try{const r=e.doc.getContainerBlocks(ce(e.rootContainer));g(H9,r.length>0,"root container is empty");const i=r[0];if(i.type!=="text"){const s=dr("",{heading:(t=this.options.headingLevel)!=null?t:1});e.insertBlock(ce(e.rootContainer),0,s,e.selection.range.toDocRange());return}if(g(H9,i.text,"invalid text block"),k$(i.text)||i.quoted||i.heading!==this.options.headingLevel){const s=e.getBlockById(i.id),l=e.getBlockString(s),a=dr(l,{heading:(o=this.options.headingLevel)!=null?o:1,quoted:!1}),d=e.selection.focusedBlock;let h=e.selection.range;const p=e.insertBlock(ce(e.rootContainer),0,a);d===s&&(h=kt(e,a.id,ue(e,p))),Uh(e,s,h)}if(r.length>1)return;e.insertTextBlock("",ce(e.rootContainer),1,{newRange:e.selection.range.toDocRange()})}finally{this.applyPlaceholder(e)}}handleRemoteChanged(e){setTimeout(()=>{this.applyPlaceholder(e)})}handleUpdateCompositionText(e){this.applyPlaceholder(e)}applyPlaceholder(e){var t,o;!((t=this.options)!=null&&t.titlePlaceholder)&&!((o=this.options)!=null&&o.contentPlaceholder)||y$(e,this.options)}static isDocumentTitleBlock(e,t){return e==="root"&&t===0}}const w$=D("image-data"),j9=1e3,r2=400,B$=10;function Tc(n){return n.src.startsWith("empty:")||!n.src}function E$(n){return n.src.startsWith("http:")||n.src.startsWith("https:")}function U9(n){return`${Jd.default(n)}_width`}function z9(n){return`${Jd.default(n)}_height`}function V9(n){return`${n}_flex`}function W9(n){let e=n.getBoundingClientRect().width;return e-=Number.parseFloat(window.getComputedStyle(n).paddingLeft)+Number.parseFloat(window.getComputedStyle(n).paddingRight),e}function Ou(n){if(n.every(r=>typeof r.flex=="number"&&r.flex))return;const e=100,o=n.map(r=>{const i=r.height==="auto"?r.width/e:r.height/e;return r.width/i}).reduce((r,i)=>r+i,0);n.forEach(r=>{const i=r.height==="auto"?r.width/e:r.height/e,s=r.width/i;r.flex=s/o})}function Sc(n){const e=(r,i)=>{r||(r=`empty:${i}`);const s=U9(r),l=z9(r),a=V9(i);let d=n[s],h=n[l],p=n[a];return typeof d=="string"&&(d=Number.parseInt(d,10)),typeof h=="string"&&(h=Number.parseInt(h,10)),typeof p=="string"&&(p=Number.parseInt(p,10)),d&&h?{src:r,width:d,height:h,flex:p,virtualSize:!1}:d&&!h?{src:r,width:d,height:"auto",flex:p,virtualSize:!1}:(d=j9,h=r2,{src:r,width:d,height:h,flex:p,virtualSize:!0})};let t=[];const o=n.src;return Array.isArray(o)?t=o.map(e):typeof o=="string"&&(t=o.split("|").map(e)),Ou(t),t}function Wo(n){const e=n.embedData;return Sc(n.embedData).length>1?100:e.widthPercent}function x$(n,e,t,o){const r=Sc(e.embedData);if(r.length>1||o)return"100%";const i=Wo(e),s=n.rootContainer.getBoundingClientRect().width;if(i){const l=W9(t);return`${Math.min(s*i/100,l)}px`}return r[0].width?`${r[0].width}px`:"auto"}function cn(n,e){const o={src:n.map(r=>r.src).join("|"),widthPercent:e};return n.forEach((r,i)=>{if(r.width&&r.height&&!r.virtualSize){const l=r.src||`empty:${i}`,a=U9(l);o[a]=r.width;const d=z9(l);r.height!=="auto"&&(o[d]=r.height)}g(w$,r.flex,"no image flex");const s=V9(i);o[s]=r.flex}),o}function I$(n,e,t,o){const r=Sc(e.embedData),i=r.length===1?n.rootContainer:t;if(r.length===1&&o)return`${r2}px`;if(r.some(h=>h.height==="auto"))return"auto";const s=Wo(e);if(!s)return"";let l=i.getBoundingClientRect().width*(s/100);if(l-=Number.parseFloat(window.getComputedStyle(i).paddingLeft)+Number.parseFloat(window.getComputedStyle(i).paddingRight),i===n.rootContainer&&i!==t&&(l=Math.min(l,W9(t))),r.length===1){const h=r[0];return h.virtualSize?"":`${h.height/(h.width/l)}px`}l-=(r.length-1)*B$;const a=r.reduce((h,p)=>h+p.flex,0);let d=0;for(const h of r){const C=l*h.flex/a/h.width*h.height;d=Math.max(C,d)}return`${d}px`}function T$(n){return n.reduce((t,o)=>t+o.flex,0)}function S$(n,e){k("div",["resize-gripper",e],n).setAttribute("data-resize-type",e)}function i2(n){return tt(n).querySelector(".block-resizer")}function D$(n){const e=i2(n);e&&re(e,"active")}function q9(n,e,t){const o=n.getBoundingClientRect(),r=e.getBoundingClientRect(),i=r.top-o.top,s=r.left-o.left,l=r.width,a=r.height;t.style.top=`${i}px`,t.style.left=`${s}px`,t.style.width=`${l}px`,t.style.height=`${a}px`}function L$(n,e,t,o){const r=i2(n);if(r)return W(r,"active"),q9(n,e,r),r;const i=tt(n),s=k("div",["block-resizer"],i);return q9(n,e,s),t.resize.forEach(l=>{S$(s,l)}),s.addEventListener("mousedown",o),W(s,"active"),s}function s2(n,e){const t=i2(n);if(!t||!et(n,e))return;const o=n.getBoundingClientRect(),r=e.getBoundingClientRect(),i=r.top-o.top,s=r.left-o.left,l=r.width,a=r.height;t.style.top=`${i}px`,t.style.left=`${s}px`,t.style.width=`${l}px`,t.style.height=`${a}px`}const Moe="",M$=D("block-resizer");class _u extends vt.TypedEmitter{constructor(t,o){super();m(this,"resizableElement");m(this,"block",null);m(this,"startRect",null);m(this,"startPos",null);m(this,"resizeType",null);m(this,"enabled",!1);m(this,"handleMouseDown",t=>{t.preventDefault(),t.stopPropagation();const o=this.getResizableElement();if(!o||t.button!==0)return;const r=t.target;if(!r||!(r instanceof HTMLElement))return;const i=r.getAttribute("data-resize-type");!i||(this.bindEvents(),this.startRect=o.getBoundingClientRect(),this.startPos=t,this.resizeType=i,wa(window.getComputedStyle(r).cursor),this.block&&this.editor.selection.selectBlock(this.block,0))});m(this,"handleMouseMove",t=>{if(!this.startPos||!this.startRect||!this.resizeType||!this.getResizableElement()||!this.block)return;const r=t.x-this.startPos.x,i=t.y-this.startPos.y,s=this.startRect;let{top:l,left:a,right:d,bottom:h}=s;(this.resizeType==="bottom"||this.resizeType==="bottom-left"||this.resizeType==="bottom-right")&&(h+=i),(this.resizeType==="top"||this.resizeType==="top-left"||this.resizeType==="top-right")&&(l+=i),(this.resizeType==="left"||this.resizeType==="top-left"||this.resizeType==="bottom-left")&&(a+=r),(this.resizeType==="right"||this.resizeType==="top-right"||this.resizeType==="bottom-right")&&(d+=r);const p=d>a?d-a:0,C=h>l?h-l:0,v=new DOMRect(a,l,p,C);this.emit("resizing",this,v);const B=this.getResizableElement();B&&s2(this.block,B)});m(this,"handleMouseUp",t=>{if(t.button!==0)return;wa(""),this.unbindEvents(),this.emit("resized",this);const o=this.getResizableElement();!o||!this.block||s2(this.block,o)});this.editor=t,this.options=o}enableResize(t,o){this.block=t,this.resizableElement=o,this.createResizer(),this.enabled=!0}disableResize(){!this.block||(D$(this.block),this.enabled=!1)}update(t,o){this.block=t,this.resizableElement=o,this.getResizableElement()&&this.enabled&&this.createResizer()}updateResizer(){const t=this.getResizableElement();t&&this.block&&s2(this.block,t)}getBlock(){return this.block}destroy(){}getResizableElement(){return this.resizableElement?this.resizableElement:this.block?Le(this.block):null}createResizer(){const t=this.getResizableElement();!t||!this.block||(g(M$,et(this.block,t),"not a block child element"),L$(this.block,t,this.options,this.handleMouseDown))}bindEvents(){document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("mouseup",this.handleMouseUp)}unbindEvents(){document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp)}}const R$=D("image-dom");function G9(n){return n.querySelector(".uploading-progress-mask")}function O$(n){const e=G9(n);if(e)return e;const t=k("div",["uploading-progress-mask"],n),o=k("div",["uploading-progress-bar"],t);return k("div",["uploading-progress-bar-value"],o),o}function _$(n){const t=O$(n).querySelector(".uploading-progress-bar-value");return g(R$,t,"no progress value"),t}function Z9(n,e){const t=_$(n);t.style.width=`${e}%`}function F$(n){var e;(e=G9(n))==null||e.remove()}function Fu(n,e,t,o){const r=t!=null?t:n.findBlockById(e.id);if(!r)return;const i=o||oe(r),s=!!r.querySelector(".images > .image-container.error, .images > .image-container.empty "),l=x$(n,e,i,s),a=I$(n,e,i,s),d=Le(r);l==="auto"?d.style.width=l:(d.style.maxWidth=l,d.style.width="100%");const h=r.querySelector(".images");!h||(h.style.height=a||"none")}function P$(n){let e;return n.forEach((t,o)=>{o.toLocaleLowerCase()==="content-type"&&(e=t)}),e!=null?e:""}async function N$(n){try{const e=await fetch(n,{credentials:"same-origin"}),t=await e.blob(),o=P$(e.headers).toLocaleLowerCase();let r="";if(o){const s=Dm.default[o].extensions;s&&s.length>0&&(r=s[0])}return new File([t],`${Date.now()}.${r}`,{type:o})}catch{return null}}function Xi(n,e){const t=typeof e=="string"?e:ie(e);return n.getCustom(`image-${t}`)}function Qf(n,e){if(!e||!(e instanceof Node))return null;const t=ne(e);return t?Xi(n,t):null}function wr(n){return Array.from(n.querySelectorAll(".image-container"))}const l2=D("table-resize-drag-drop");class $${constructor(e,t,o,r){m(this,"cursor","col-resize");m(this,"initWidths");this.editor=e,this.elem=t,this.data=o,this.mouseDownEvent=r;const i=this.data.block,l=Xi(this.editor,i).getImages(),a=this.data.splitterIndex;g(l2,a>=0&&a<l.length-1,`invalid splitter index: ${a}`);const h=wr(i).map(p=>p.getBoundingClientRect().width);this.initWidths=h}onDragStart(e,t,o){if(!this.editor.isWritable())return;const r=this.data.block;Xi(this.editor,r).setResizing(!0)}onDragging(e,t,o,r,i){const s=this.data.block,l=Xi(this.editor,s),a=me.default(l.getImages()),d=this.data.splitterIndex;g(l2,d>=0&&d<a.length-1,`invalid splitter index: ${d}`);const h=this.initWidths[d],p=this.initWidths[d+1];if(h+p<100)return;let C=r;h+C<50&&(C=50-h),p-C<50&&(C=p-50);const S=[...this.initWidths];S[d]+=C,S[d+1]-=C;const x=wr(s);g(l2,x.length===a.length,"invalid image data");const _=S.reduce((z,Q)=>z+Q,0);for(let z=0;z<a.length;z++){const Q=S[z]/_;a[z].flex=Q,x[z].style.flexGrow=`${Q}`}const R=me.default(this.editor.getBlockData(s)),H=cn(a,Wo(R));R.embedData=H,Fu(this.editor,R,s,null)}onDragEnd(e,t,o,r,i){const s=this.data.block,l=Xi(this.editor,s),d=wr(s).map(h=>Number.parseFloat(h.style.flexGrow));l.updateFlex(d),l.setResizing(!1)}}function Q9(n){var e;return!n||!(n instanceof HTMLElement)?null:xe(n,"image-splitter")?n:(e=n.closest(".image-splitter"))!=null?e:null}function H$(n,e){var s;const t=Q9(e.target);if(!t)return;const o=ne(t);if(!o)return;Xi(n,o).setSelectedIndex(-1),n.selection.selectBlock(o,0);const r=Number.parseInt((s=t.getAttribute("data-index"))!=null?s:"",10);if(Number.isNaN(r)||typeof r!="number")return;const i={block:o,splitterIndex:r};Nm(new $$(n,t,i,e))}function j$(n,e){e.preventDefault(),e.stopPropagation();const t=Q9(e.target);if(!t)return;const o=ne(t);!o||Xi(n,o).resetFlex()}function U$(n,e,t,o){const r=k("div",["image-splitter"],t);k("div",["image-splitter-indicator"],r),r.setAttribute("data-index",`${o}`),n.domEvents.addEventListener(r,"mousedown",H$),n.domEvents.addEventListener(r,"dblclick",j$)}const z$=D("image-item");function Y9(n){return!n||!(n instanceof Node)?null:ne(n)}function J9(n){const e=Y9(n);return e?wr(e):[]}function c2(n){if(!n||!(n instanceof Node))return null;const e=n instanceof Element?n:n.parentElement;if(!e)return null;const t=e.closest(".image-container");return t||null}function Pu(n){const e=c2(n);return e?J9(n).indexOf(e):-1}async function V$(n,e){const t=Qf(n,e.target);if(!t)return;const o=Pu(e.target);if(o===-1)return;const r=e.target;if(!(r instanceof HTMLImageElement))return;const i=t.getImages()[o];if(Tc(i)||n.readonly||!t.isAutoFix()||(setTimeout(()=>{t.setAutoFix(!1)},400),i.height==="auto"&&t.fixImageSize(o,r),i.virtualSize&&t.fixImageSize(o,r),!i||!E$(i)||i.downloading))return;i.downloading=!0;const s=await N$(i.src);s?t.replaceImage(o,s):z$.warn(`failed to download image: ${i.src}`)}function W$(n,e,t){if(e.querySelector(".load-error"))return;const r=t.src.startsWith("http:")||t.src.startsWith("https:"),i=k("div",["load-error"],e),s=k("div",["error-icon"],i);s.innerHTML=vv;const l=k("div",["error-message"],i);r?(l.innerHTML=L.t("image.load.remote.failed"),n.domEvents.addEventListener(i,"click",(a,d)=>{d.preventDefault(),d.target instanceof HTMLElement&&d.target.tagName==="A"&&window.open(t.src,"_blank")})):(l.innerHTML=L.t("image.load.failed"),n.domEvents.addEventListener(i,"click",(a,d)=>{d.preventDefault(),d.stopPropagation(),d.target instanceof HTMLElement&&d.target.tagName==="A"&&Q$(a,d.target)}))}function a2(n,e){setTimeout(()=>{if(et(n.rootContainer,e)){const t=n.getBlockData(e);Fu(n,t,null,null)}})}function q$(n,e){const t=Qf(n,e.target);if(!t)return;const o=Pu(e.target);if(o===-1)return;const r=t.getImages()[o];if(!r)return;const i=c2(e.target);if(!i)return;W(i,"error","error-load");const s=ne(i);s&&a2(n,s),i.innerHTML="",W$(n,i,r)}function G$(n,e,t){if(e.querySelector(".upload-error"))return;const r=k("div",["upload-error"],e),i=k("div",["error-icon"],r);i.innerHTML=vv;const s=k("div",["error-message"],r);s.innerHTML=L.t("image.upload.failed"),n.domEvents.addEventListener(r,"click",(l,a)=>{if(a.preventDefault(),!a.target||!(a.target instanceof Element)||a.target.tagName!=="A")return;const d=Qf(l,a.target),h=Pu(a.target);!d||h===-1||d.replaceImage(h,t)})}function K9(n,e,t,o,r){const i=wr(e)[t];!i||(W(i,"error","error-upload"),a2(n,e),i.innerHTML="",G$(n,i,r))}function X9(n,e,t,o,r,i,s){const l=k("div",["image-container"],t);if(l.setAttribute("data-src",o.src),s.length>1&&(l.style.flexShrink=`${o.flex}`,l.style.flexGrow=`${o.flex}`),i===r&&W(l,"active"),Tc(o)){W(l,"empty");const d=k("div",["upload-image-icon"],l);return d.innerHTML=lM,l}const a=k("img",["editor-image"],l);if(a.src=n.doc.buildResourceUrl(o.src),n.domEvents.addEventListener(a,"load",V$),n.domEvents.addEventListener(a,"error",q$),o.src.startsWith("https:")||o.src.startsWith("http:")){const d=k("div",["image-warning"],l);d.innerHTML=bv,d.setAttribute(`data-editor-tooltip-${n.clientId}`,L.t("image.load.remote.tooltip"))}return l}function Z$(n,e,t,o,r){const i=k("div",["images"],t);return o.forEach((s,l)=>{l>0&&U$(n,e,i,l-1),X9(n,e,i,s,l,r,o)}),o.length>1&&W(e,"multi"),i}function ey(n,e,t,o,r,i){const l=Array.from(e.querySelectorAll(".image-container"))[o];if(!l)return;const a=X9(n,e,null,t,o,r,i);l.insertAdjacentElement("beforebegin",a),l.remove(),a2(n,e)}function Nu(n,e){return wr(n)[e]}function Q$(n,e){const t=Y9(e);if(!t)return;const o=Pu(e);if(o===-1)return;const r=Qf(n,e);if(!r)return;const i=r.getImages()[o];ey(n,t,i,o,r.getSelectedIndex(),r.getImages())}function qo(n){return Se(n)==="embed"&&fn(n)==="image"}async function ty(n){return new Promise((e,t)=>{const o=new Image;o.onload=()=>{e({width:o.naturalWidth,height:o.naturalHeight})},o.onerror=t,o.src=n})}async function Y$(n){const e=await Wl(n);return ty(e)}function ny(n){var o;let e="image/*";const t=(o=n.getComponentOptions("image"))==null?void 0:o.allowedMedias;return t&&(e=t.map(r=>`.${r}`).join(",")),e}function oy(n,e){var s;const{maxSize:t,allowedMedias:o,callbacks:r}=(s=n.getComponentOptions("image"))!=null?s:{};if(t&&e.size>t){const l=new Error("image is too large");throw l.code="MaxMediaSize",r!=null&&r.onError&&(r==null||r.onError(n,l)),l}const i=Ia(e.name);if(o&&!o.includes(i)){const l=new Error(`media file is not allowed: ${i}`);throw l.code="NotAllowedFile",r!=null&&r.onError&&(r==null||r.onError(n,l)),l}}function ry(n){return n.startsWith("image/")}const iy=D("image-object");class Tt{constructor(e,t){m(this,"images",[]);m(this,"selectedIndex",-1);m(this,"blockResizer");m(this,"resizing",!1);m(this,"parentContainerResizerObserver",null);m(this,"autoFix",!1);m(this,"handleMouseDown",async(e,t)=>{const o=Pu(t.target);if(o===-1)return;const r=this.images[o];Tc(r)||this.setSelectedIndex(o)});m(this,"handleRootContainerResize",()=>{this.handleEditorResize(this.editor.rootContainer)});m(this,"handleEditorResize",e=>{if(this.isEmpty()||this.resizing)return;const t=this.editor.findBlockById(this.blockData.id);!t||oe(t)===e&&Fu(this.editor,this.blockData,t,null)});m(this,"handleResizing",(e,t)=>{const o=this.editor.findBlockById(this.blockData.id);if(!o)return;this.autoFix||this.setAutoFix(!0);const i=this.editor.rootContainer.getBoundingClientRect().width,s=o.getBoundingClientRect();let l=t.width>s.width?s.width:t.width;l<50&&(l=50);const a=l*100/i;this.blockData.embedData.widthPercent=a,Fu(this.editor,this.blockData,o,null)});m(this,"handleResized",e=>{const t=this.editor.findBlockById(this.blockData.id);if(!t)return;const o=cn(this.images,Wo(this.blockData));this.editor.updateEmbedData(t,o),this.blockResizer.enableResize(t)});m(this,"fixImageSizes",Mt.default(()=>{const e=this.editor.findBlockById(this.blockData.id);if(!e)return;const t=cn(this.images,Wo(this.blockData));this.editor.updateEmbedData(e,t)},1e3));this.editor=e,this.blockData=t,this.blockResizer=new _u(this.editor,{resize:["top-left","top-right","bottom-left","bottom-right"]}),this.blockResizer.addListener("resizing",this.handleResizing),this.blockResizer.addListener("resized",this.handleResized),this.images=Sc(this.blockData.embedData)}destroy(){var e;this.blockResizer.removeAllListeners(),this.blockResizer.destroy(),this.editor.domEvents.removeEventListener(null,null,this.handleMouseDown),(e=this.parentContainerResizerObserver)==null||e.disconnect()}setAutoFix(e){this.autoFix=e}isAutoFix(){return this.autoFix}createContent(e,t,o){const r=Z$(this.editor,t,o,this.images,this.selectedIndex);if(this.editor.domEvents.addEventListener(o,"mousedown",this.handleMouseDown),this.editor.addListener("resize",this.handleRootContainerResize),Ro(e)){const s=()=>{this.handleEditorResize(e)};this.parentContainerResizerObserver=new vs(s),this.parentContainerResizerObserver.observe(e)}const i=()=>!!(this.images.length===1&&this.images[0].virtualSize);this.isEmpty()&&i()&&W(r,"empty"),Fu(this.editor,this.blockData,t,e),setTimeout(()=>{const s=this.editor.findBlockById(this.blockData.id);s&&this.blockResizer.update(s)})}getImages(){return this.images}getWidthPercent(){return Wo(this.blockData)}isEmpty(){return this.images.length===1&&Tc(this.images[0])}setResizing(e){this.resizing=e}getSelectedIndex(){return this.selectedIndex}getBlock(){return this.editor.findBlockById(this.blockData.id)}setSelectedIndex(e){const t=this.getBlock();if(!t||e===this.selectedIndex)return;if(this.selectedIndex!==-1){const r=Nu(t,this.selectedIndex);r&&re(r,"active")}this.selectedIndex=e;const o=Nu(t,e);o&&W(o,"active")}async requestUploadImage(e){const t=this.editor.findBlockById(this.blockData.id);if(!t)return;const o=Nu(t,e);if(xe(o,"error"))return;const r=ny(this.editor),i=await ql(r);await this.replaceImage(e,i)}tryEnableResizer(){const e=this.editor.findBlockById(this.blockData.id);if(!e||!this.editor.isWritable())return;const t=Nu(e,0);!this.isEmpty()&&this.images.length===1&&!xe(t,"error")&&this.blockResizer.enableResize(e)}disableResizer(){this.blockResizer.disableResize()}fixImageSize(e,t){const o=this.images[e];Tc(o)||(o.height==="auto"&&(o.height=t.height),o.width=t.naturalWidth,o.height=t.naturalHeight,o.virtualSize=!1,this.fixImageSizes())}removeImage(e){const t=this.editor.findBlockById(this.blockData.id);if(!t||e===-1||e>=this.images.length)return!1;const o=me.default(this.images);if(o.splice(e,1),o.length===0)return this.editor.deleteBlock(t),!0;o[0].flex=NaN,Ou(o),this.selectedIndex>=o.length&&(this.selectedIndex=o.length-1);const r=cn(o,Wo(this.blockData));return this.editor.updateEmbedData(t,r),!0}async replaceImage(e,t){const o=this.editor.findBlockById(this.blockData.id);if(!o)return!1;try{const i=await Wl(t),s=this.images[e];if(s.virtualSize){const{width:a,height:d}=await ty(i);s.width=a,s.height=d,s.virtualSize=!1;const h=cn(this.images,Wo(this.blockData));this.editor.updateEmbedData(o,h)}const l={...s,src:i};ey(this.editor,o,l,e,this.selectedIndex,this.images),setTimeout(()=>{this.blockResizer.update(o)})}catch(i){return K9(this.editor,o,e,i,t),!1}const r=Nu(o,e);if(!r)return!1;W(r,"uploading"),Z9(r,0),W(o,"media-block-uploading");try{const i=await this.editor.doc.uploadResource(t,{onProgress:a=>{Z9(r,a)}});re(r,"uploading"),this.images[e].src=i.resourceId;const s=this.editor.findBlockById(this.blockData.id);if(!s)return!1;re(s,"media-block-uploading");const l=cn(this.images,Wo(this.blockData));return this.editor.updateEmbedData(s,l),!0}catch(i){iy.error(i);const s=this.editor.findBlockById(this.blockData.id);return s&&(re(r,"uploading"),F$(r),K9(this.editor,s,e,i,t),re(s,"media-block-uploading")),!1}}updateFlex(e){const t=this.editor.findBlockById(this.blockData.id);if(!t)return;g(iy,e.length===this.images.length,"invalid flex");for(let r=0;r<this.images.length;r++)this.images[r].flex=e[r];const o=cn(this.images,Wo(this.blockData));this.editor.updateEmbedData(t,o)}resetFlex(){const e=this.editor.findBlockById(this.blockData.id);if(!e)return;const t=me.default(this.images);t[0].flex=NaN,Ou(t);const o=cn(t,Wo(this.blockData));this.editor.updateEmbedData(e,o)}setData(e){this.blockData=e,this.images=Sc(e.embedData)}static create(e,t){const o=e.addCustom(`image-${t.id}`,()=>new Tt(e,t));return o.setData(t),o}static getImageObject(e,t){let o;return typeof t=="string"?o=t:o=ie(t),e.getCustom(`image-${o}`)}}const Roe="",Ooe="";function Yf(n){const e=tt(n);let t=e.querySelector(":scope > .block-helper");return t||(t=k("div",["block-helper"],e),k("span",["helper-sizer"],t,"A")),t}function u2(n,e,t){const o=Yf(n),i=Array.from(o.children).find(s=>{var a;return Number.parseInt((a=s.getAttribute("data-index"))!=null?a:"0",10)>t});o.insertBefore(e,i!=null?i:null)}const sy=40,J$=20;class K${findTargetBlock(e,t){const o=t.target;if(o&&o instanceof Element){const a=ne(o);if(a&&et(e.rootContainer,a))return a}let r=t.clientX,i=t.clientY;const s=e.rootContainer.getBoundingClientRect().left;r<s&&s-r<sy&&(r+=sy);let l=document.elementFromPoint(r,i);if(l){const a=ne(l);if(a&&et(e.rootContainer,a))return a}if(i-=J$,l=document.elementFromPoint(r,i),l){const a=ne(l);if(a&&et(e.rootContainer,a))return a}return null}destroy(){}}class X$ extends Ff{constructor(t){super(t,{trigger:[],id:"empty-block-menu"});m(this,"currentBlock",null)}get isVisible(){return this.suggest.menu.isVisible}isInMenu(t){return this.menu.isInCommandBar(t)}show(){const o=this.editor.selection.focusedBlock;this.suggest.popup(o,0,"","")}setBlock(t){this.currentBlock=t}}function eH(n,e,t){const o=ig(n,e);if(!o)return[];const r=[];return Object.values(o).forEach(i=>{t!=null&&t.has(i.group)||r.push(...i.commands.map(s=>({...s,source:"block-command",blockMenuItemCustomData:i.group})))}),r}function d2(n,e,t={withPlainText:!1}){const o=j0(n,t),r=i=>{i.forEach(s=>{s.source=e,s.children&&r(s.children)})};return r(o),o}function tH(n,e,t,o=!1){var d,h;const r=oe(e);let s=be(e);ut(n,e)||o||(s+=1);const l=ce(r),a=t;return a.commandProvider?a.commandProvider.executeCommand(n,t,{from:"block-menu",containerId:l,blockIndex:s}):(h=(d=a.blockOptions)==null?void 0:d.handleInsertEmptyBlock)==null?void 0:h.call(d,n,{containerId:l,blockIndex:s,item:t})}function nH(n,e){const t=Lo(n,e),o=n.getBlockData(e);return!(t!=="text"||o.heading)}class ly{constructor(e,t,o){m(this,"source","text-style");m(this,"id","text-style-item");m(this,"name","Text styles");m(this,"element");m(this,"textStylesTooltips",{});m(this,"createHeadingItemElement",(e,t,o)=>{var i;const r=P0();this.createItem("text",hu,t,nH(this.editor,e)),(i=r.insertBlockCommandItems)==null||i.forEach(s=>{s.id&&s.icon&&this.createItem(s.id,s.icon,t,o?o===Number(s.value):!1)})});m(this,"createListItemElement",(e,t,o)=>{const{checkbox:r,ordered:i}=o,l=Se(e)==="list",a=l&&i===!1&&!r,d=l&&i,h=l&&!!r;this.createItem("unordered-list",xv,t,a),this.createItem("ordered-list",Iv,t,d),this.createItem("check-list",Bv,t,h)});m(this,"handleClick",(e,t)=>{var l,a;if(!t.target||!(t.target instanceof Node))return;const o=t.target instanceof Element?t.target:t.target.parentElement;if(!o)return;const r=o.closest(".text-style-item");if(!r)return;const i=r.id,s="heading-";if(i==="text"&&Of(e,this.block,null),i.startsWith(s)){const d=Number.parseInt(i.substring(s.length),10);d&&Of(e,this.block,d)}if(i==="blockquote"&&O0(e,this.block),i.startsWith("align")){const d=i.replace(/^align-/,"");q7(e,this.block,d)}(i==="unordered-list"||i==="ordered-list"||i==="check-list")&&F0(e,this.block,i),(a=(l=this.options).onAfterStyleItemClick)==null||a.call(l)});m(this,"calcTextStyleItemTooltipsEnum",()=>{this.textStylesTooltips={text:{title:L.t("commands.text")},blockquote:{title:L.t("commands.quote")},"align-left":{title:L.t("commands.alignLeft")},"align-center":{title:L.t("commands.alignCenter")},"align-right":{title:L.t("commands.alignRight")},"unordered-list":{title:L.t("commands.unordered")},"ordered-list":{title:L.t("commands.ordered")},"check-list":{title:L.t("commands.check")}};let e=1;for(;e<=8;)this.textStylesTooltips[`heading-${e}`]={title:L.t("commands.heading",{name:`${e}`})},e++});this.editor=e,this.block=t,this.options=o,this.calcTextStyleItemTooltipsEnum(),this.element=this.createItemElement(e,t),e.domEvents.addEventListener(this.element,"click",this.handleClick)}createItemElement(e,t){const o=k("div",["text-styles"],null),r=k("div",["text-style-section"],o),i=e.getBlockData(t);if(!this.options.fromEmbed){const l=i.heading,a=i.quoted;this.createHeadingItemElement(t,r,l),this.createListItemElement(t,r,i),this.createItem("blockquote",Ev,r,!!a)}const s=i.align||"left";return this.createItem("align-left",du,r,s==="left"),this.createItem("align-center",zp,r,s==="center"),this.createItem("align-right",Up,r,s==="right"),o}createItem(e,t,o,r=!1){const i=["style-icon","text-style-item"];r&&i.push("active");const s=Ul(t,i,o);s.id=e;const l=this.textStylesTooltips[e];if(!l)return;const{title:a,shortcut:d}=l;s.setAttribute(`data-editor-tooltip-${this.editor.clientId}`,a),d&&s.setAttribute(`data-editor-tooltip-desc-${this.editor.clientId}`,io(d))}}function cy(){return{source:"separator",type:"separator",id:`section-${K()}`,name:""}}const ay={copy:BM,cut:EM,delete:xM,"lock-block":IM,"unlock-block":TM,comment:cc},oH=["image","video"];function rH(n,e,t){const o=[],r=te(n,e),i=It(e)&&oH.includes(fn(e)),s=i&&(fn(e)!=="image"||fn(e)==="image"&&wr(e).length===1);if(r?o.push(new ly(n,e,t)):i&&s&&o.push(new ly(n,e,{...t,fromEmbed:!0})),!ut(n,e)){(r||i&&s)&&o.push(cy());const l=eH(n,e,new Set(["hovering-toolbar"]));l.sort((a,d)=>{var h,p;return((h=a.order)!=null?h:0)-((p=d.order)!=null?p:0)}),l.forEach(a=>{a.id in ay&&(a.icon=ay[a.id])}),o.push(...l)}return ut(n,e)?o.push(...d2(n,"insert-block")):o.push(cy(),{id:"insert-block-before",icon:SM,name:L.t("blockMenu.command.insertAbove"),children:d2(n,"insert-block-before",{withPlainText:!0}),childrenMenuId:"quick-menu",source:"insert-block-before"},{id:"insert-block-after",icon:DM,name:L.t("blockMenu.command.insertAfter"),children:d2(n,"insert-block",{withPlainText:!0}),source:"insert-block",childrenMenuId:"quick-menu"}),o}function iH(n,e,t){if(t.source==="block-command"){const o=t.blockMenuItemCustomData;S4(n,e,o,t)}else(t.source==="insert-block"||t.source==="insert-block-before")&&tH(n,e,t,t.source==="insert-block-before")}const sH=D("exclusive-block");function h2(n,e,t,o){var l;W(e,"block-exclusive");const r=Ye(n,e),i=(l=r.getBlockProperties)==null?void 0:l.call(r,n,e),{abstract:s}=i||{};e.setAttribute("data-user-name",o),e.setAttribute("data-user-id",t),e.setAttribute("data-exclusive-tips",L.t("exclusive.tips",{editor:o,embedType:s||L.t("exclusive.fallbackAbstract")}))}function uy(n){re(n,"block-exclusive"),n.removeAttribute("data-user-name"),n.removeAttribute("data-user-id"),n.removeAttribute("data-exclusive-tips")}function lH(n,e,t,o,r){sH.debug(`block ${ie(e)} ${t?"exclusive":"unexclusive"}, ${o}, ${r}`),t?h2(n,e,o,r):uy(e)}function $u(n){return n.classList.contains("block-exclusive")}function dy(n,e){e.blockIds.forEach(t=>{const o=n.findBlockById(t);o&&lH(n,o,e.exclusive,e.userId,e.displayName)})}class es{constructor(e){m(this,"exclusiveBlockIds",new Set);m(this,"exclusiveBlockTimer",0);m(this,"remoteExclusiveBlockIds",new Map);m(this,"handleUserChanged",e=>{const t=new Set(e.map(r=>r.userId));Array.from(this.remoteExclusiveBlockIds.entries()).forEach(([r,i])=>{if(!t.has(i.userId)){this.remoteExclusiveBlockIds.delete(r);const s={...i,exclusive:!1};dy(this.editor,s)}});const o=Array.from(this.exclusiveBlockIds).map(r=>this.editor.findBlockById(r)).filter(r=>!!r);o.length>0&&this.broadcastExclusiveBlockMessage(o,!0)});this.editor=e,e.doc.registerCallback(this),e.doc.getRemoteUsers().addListener("change",this.handleUserChanged)}destroy(){this.stopExclusiveBlockTimer(),this.editor.doc.unregisterCallback(this),this.editor.doc.getRemoteUsers().addListener("change",this.handleUserChanged)}onCustomMessage(e){if(e.type==="exclusiveBlock"){const t=e;dy(this.editor,t),t.blockIds.forEach(o=>{t.exclusive?this.remoteExclusiveBlockIds.set(o,t):this.remoteExclusiveBlockIds.delete(o)})}}getExclusiveMessage(e){return this.remoteExclusiveBlockIds.get(e)}broadcastExclusiveBlockMessage(e,t){if(this.editor.readonly||e.length===0)return;const o=this.editor.doc.getUser(),r={type:"exclusiveBlock",userId:o.userId,displayName:o.displayName,blockIds:e.map(i=>ie(i)),exclusive:t};this.editor.doc.broadcastMessage(r)}exclusiveBlock(e){this.exclusiveBlockIds.has(ie(e))||(this.broadcastExclusiveBlockMessage([e],!0),this.exclusiveBlockIds.add(ie(e)),this.exclusiveBlockIds.size===1&&this.startExclusiveBlockTimer())}unexclusiveBlock(e){!this.exclusiveBlockIds.has(ie(e))||(this.exclusiveBlockIds.delete(ie(e)),this.broadcastExclusiveBlockMessage([e],!1),this.exclusiveBlockIds.size===0&&this.stopExclusiveBlockTimer())}startExclusiveBlockTimer(){this.exclusiveBlockTimer=window.setInterval(()=>{Array.from(this.exclusiveBlockIds.keys()).forEach(e=>{this.broadcastExclusiveBlockMessage([this.editor.getBlockById(e)],!0)})},30*1e3)}stopExclusiveBlockTimer(){clearInterval(this.exclusiveBlockTimer),this.exclusiveBlockTimer=0}static get(e){return e.addCustom("exclusiveBlock",()=>new es(e))}static register(e){return this.get(e)}}function f2(n,e){es.get(n).exclusiveBlock(e)}function m2(n,e){es.get(n).unexclusiveBlock(e)}class hy{writable(e,t){if(Array.isArray(t)){for(const o of t)if($u(o))return!1;return}if($u(t))return!1}create(e,t,o,r,i){const s=es.get(e).getExclusiveMessage(i.id);s&&h2(e,r,s.userId,s.displayName)}update(e,t,o,r,i){const s=es.get(e).getExclusiveMessage(i.id);s?h2(e,r,s.userId,s.displayName):uy(r)}}const _oe="",cH={exclusive:{tips:"\u300C{editor}\u300D\u6B63\u5728\u7F16\u8F91\uFF0C\u300C{embedType}\u300D\u4E0D\u652F\u6301\u591A\u4EBA\u7F16\u8F91",fallbackAbstract:"\u8BE5 Block"}},aH={exclusive:{tips:"\u300C{editor}\u300Dis editing\uFF0C\u300C{embedType}\u300Ddoes not support multi-person editing",fallbackAbstract:"This Block"}},uH={exclusive:{tips:"\u300C{editor}\u300D\u306F\u7DE8\u96C6\u4E2D\u3067\u3059\u3002\u300C{embedType}\u300D\u306F\u8907\u6570\u4EBA\u3067\u540C\u6642\u7DE8\u96C6\u3067\u304D\u307E\u305B\u3093",fallbackAbstract:"\u3053\u306E\u8981\u7D20"}};L.mergeLang({"zh-CN":cH,"en-US":aH,"ja-JP":uH});function Hu(n,e){return n.getBlockData(e).lock}function Jf(n,e){return!!Hu(n,e)}function ju(n,e){const t=Hu(n,e);return t?t.userId===n.doc.getUser().userId:!1}function g2(n,e){const t=Hu(n,e);return t?t.userId!==n.doc.getUser().userId:!1}function dH(n,e){if(n.readonly||!n.isBlockWritable(e)||Jf(n,e)&&!ju(n,e))return;const t=n.doc.getUser(),o={userId:t.userId,displayName:t.displayName,locked:Date.now()},i={...n.getBlockData(e),lock:o};n.updateBlockData(e,i)}function hH(n,e){if(!ju(n,e))return;const t={lock:null};n.updateBlockData(e,t)}const fH=10,mH=80,gH=50;class p2{constructor(){m(this,"executeCommand",(e,t,o)=>{const r=o.data;if(!r||!r.blockId)return;const i=e.getBlockById(r.blockId);r.type==="lock"?dH(e,i):r.type==="unlock"&&hH(e,i)})}create(e,t,o,r,i){const s=i.lock;s&&(s.userId!==e.doc.getUser().userId?W(r,"locked-by-others"):W(r,"locked-by-self"))}update(e,t,o,r,i){const s=i.lock;if(s)if(s.userId!==e.doc.getUser().userId){W(r,"locked-by-others");const l=e.selection.focusedBlock;(l===r||et(r,l))&&(te(e,r)||Se(r)==="code")&&e.insertTextBlock("",ce(o),be(r)+1)}else W(r,"locked-by-self");else re(r,"locked-by-others"),re(r,"locked-by-self")}writable(e,t){let o=[];Array.isArray(t)?o=t:o.push(t);for(const r of o){if(g2(e,r))return!1;if(lo(r))return;let i=Ts(r);for(;i;){if(g2(e,i))return!1;i=Ts(i)}}}commands(e,t){const o=Jf(e,t),r=ju(e,t),i=$u(t),s={blockId:ie(t),type:"lock"},l={id:"lock-block",name:"",data:s,order:10};if(o)if(r)l.id="unlock-block",l.name=L.t("locker.unlock"),s.type="unlock";else{const a=Hu(e,t);let d=(a==null?void 0:a.displayName)||"";const h=L.getCurrentLang()==="ja-JP",p=K5(d,fH,h?gH:mH);(p==null?void 0:p.length)!==d.length&&(l.ellipsisTooltip=a==null?void 0:a.displayName,d=p||""),l.name=L.t("locker.lockedBy",{name:d}),l.states=["disabled"]}else i?(l.name=L.t("locker.lock"),l.states=["disabled"]):l.name=L.t("locker.lock");return{group:"block-locker",commands:[l],executeCommand:this.executeCommand}}}const Foe="",pH={locker:{lock:"\u9501\u5B9A",unlock:"\u89E3\u9664\u9501\u5B9A",lockedBy:"\u88AB {name} \u9501\u5B9A"}},CH={locker:{lock:"Lock",unlock:"Unlock",lockedBy:"Locked by {name}"}},AH={locker:{lock:"\u30ED\u30C3\u30AF",unlock:"\u30ED\u30C3\u30AF\u89E3\u9664",lockedBy:"{name}\u304C\u30ED\u30C3\u30AF\u3057\u307E\u3057\u305F"}};L.mergeLang({"zh-CN":pH,"en-US":CH,"ja-JP":AH});class Kf{async handleBeforePasteDoc(e,t){return Object.values(t.blocks).forEach(o=>{o.forEach(r=>{delete r.lock})}),!1}}const bH=D("standard-block-actions");class vH{constructor(){m(this,"executeCommand",(e,t,o)=>{const r=o.data;try{const i=e.getBlockById(r);if(o.id==="delete"){e.deleteBlock(i);return}o.id==="copy"&&Xh(e,i),o.id==="cut"&&(Xh(e,i),e.deleteBlock(i))}catch(i){bH.error(`failed to execute block command: ${JSON.stringify(i)}`)}})}commands(e,t){const o=Jf(e,t),r=o&&ju(e,t),i=ie(t),s=e2(),l=$u(t),a={id:"copy",name:L.t("blockMenu.command.copy"),data:i,order:1,states:s?[]:["disabled"],disableReason:s?void 0:L.t("copyCutProperty.unsafeEnvTips",{shortCut:io("CtrlOrCmd+C"),operation:L.t("copyCutProperty.copy")})},d={id:"cut",name:L.t("blockMenu.command.cut"),data:i,order:2,states:o&&!r||!s||l?["disabled"]:[],disableReason:s?void 0:L.t("copyCutProperty.unsafeEnvTips",{shortCut:io("CtrlOrCmd+X"),operation:L.t("copyCutProperty.cut")})},h={id:"delete",name:L.t("blockMenu.command.delete"),data:i,order:3,states:o&&!r||l?["disabled"]:[]};return{group:"standard-block-actions",commands:[a,d,h],executeCommand:this.executeCommand}}}const fy=D("block-menu");class yH{constructor(e){m(this,"menu");m(this,"currentBlock",null);m(this,"commandBlock",null);m(this,"handleShow",()=>{g(fy,this.currentBlock,"no target block before show block menu");const e=rH(this.editor,this.currentBlock,{onAfterStyleItemClick:this.close});this.menu.updateItems(e),this.commandBlock=this.currentBlock});m(this,"handleClose",()=>{Qp(this.editor)&&this.editor.focus()});m(this,"handleItemClick",(e,t)=>{g(fy,this.commandBlock,"no command block before show block menu"),iH(this.editor,this.commandBlock,t),t.element||this.close()});m(this,"close",()=>{this.menu.close("clickItem")});this.editor=e,this.menu=new Vs([],void 0,{id:"block-menu"}),this.menu.on("show",this.handleShow),this.menu.on("close",this.handleClose),this.menu.on("click",this.handleItemClick),e.blockHooks.push(new vH)}show(e,t){this.menu.manualShow(e,{placement:"bottom-start",...t})}isInMenu(e){return this.menu.isInCommandBar(e)}setBlock(e){this.currentBlock=e}get isVisible(){return this.menu.isVisible}destroy(){this.menu.destroy()}}const kH=1e3;async function wH(n,e){const{width:t}=n.rootContainer.getBoundingClientRect(),o=e.getBoundingClientRect();return o.width>t||o.height>=kH?"":(await l5.default.toSvg(e)).replace(/margin-block:.*?;/,"").replace(/margin:.*?;/,"")}const BH=D("drag-preview-image");class EH{constructor(e){m(this,"startPosition",null);m(this,"dragContainer",null);m(this,"handleDragStart",async(e,t)=>{const o=e.target;g(BH,o instanceof Element,`Invalid Drag target:${o}`);const{x:r,y:i}=e;this.startPosition={x:r,y:i};const s=k("div",["drag-image-container"],this.editor.rootContainer),l=k("img",["drag-image"],s),a=k("span",["drag-loading"],s);a.innerHTML=OM;const{x:d,width:h,height:p,y:C}=o.getBoundingClientRect(),v=this.editor.rootContainer.getBoundingClientRect(),B=t.getBoundingClientRect();s.style.left=`${d+h}px`,s.style.top=`${C+p}px`,s.style.width=`${Math.min(v.width/2,B.width)}px`,this.dragContainer=s;const x=await wH(this.editor,t);x?l.src=x:W(s,"drag-placeholder"),_m(s,{status:"loaded"})});m(this,"handleDrag",e=>{if(this.startPosition&&this.dragContainer){const{x:t,y:o}=e;if(t===0&&o===0){this.dragContainer.style.transition="transform 0.15s, opacity .15s",this.dragContainer.style.transform="",this.dragContainer.style.opacity="0";return}const{x:r,y:i}=this.startPosition,s=t-r,l=o-i;this.dragContainer.style.transform=`translate(${s}px, ${l}px)`}});m(this,"handleDragEnd",()=>{this.dragContainer&&(this.dragContainer.remove(),this.startPosition=null,this.dragContainer=null)});this.editor=e}}const my="drag-preview-element";function xH(n){if(xe(n,my))return n;const e=n.querySelector(`.${my}`);return e||(It(n)?Le(n):n)}const Xf=D("block-menu-drag-handler");function C2(n,e){return new DragEvent(e,{bubbles:!0,cancelable:!0,view:window,screenX:n.screenX,screenY:n.screenY,dataTransfer:new DataTransfer,clientX:n.clientX,clientY:n.clientY})}class IH{constructor(e,t){m(this,"dragPreview");m(this,"autoScroll");m(this,"oldPos",{x:0,y:0});m(this,"handleMouseDown",e=>{const t=this.button.blockMenu.currentBlock;if(g(Xf,t,"no dragged block"),e.button!==0)return;if(!this.editor.isBlockWritable(t)){e.preventDefault(),e.stopPropagation();return}const{x:o,y:r}=e;this.oldPos={x:o,y:r},document.addEventListener("mouseup",this.handleDragEnd),this.editor.contentElement.addEventListener("mousemove",this.handleDrag)});m(this,"handleDragStart",e=>{var s,l;const t=so(this.button.buttonElement);this.autoScroll||(this.autoScroll=new hh({scrollElement:t,trackMouseEvent:"mousemove",edge:{top:50,bottom:50}}));const o=this.button.blockMenu.currentBlock;g(Xf,o,"no dragged block"),(l=(s=Ye(this.editor,o)).notify)==null||l.call(s,this.editor,"beginDrag");const r=C2(e,"dragstart");MH(this.editor,r,o),window.isDragging=!0,this.button.buttonElement.style.opacity="0";const i=xH(o);this.dragPreview.handleDragStart(e,i),this.autoScroll.active(),W(o,"dragging"),W(this.editor.contentElement,"dragging")});m(this,"handleDrag",e=>{const{target:t,x:o,y:r}=e;if(this.oldPos.x===o&&this.oldPos.y===r)return;window.isDragging||this.handleDragStart(e),this.oldPos={x:o,y:r},g(Xf,t instanceof Element,"target is invalid"),this.dragPreview.handleDrag(e);const i=C2(e,"dragover");this.editor.contentElement.dispatchEvent(i)});m(this,"handleDragEnd",e=>{var r;const t=this.button.blockMenu.currentBlock;g(Xf,t,"no dragged block"),window.isDragging=!1,this.button.buttonElement.style.opacity="1",this.dragPreview.handleDragEnd(),(r=this.autoScroll)==null||r.inactive(),re(t,"dragging"),re(this.editor.contentElement,"dragging"),document.removeEventListener("mouseup",this.handleDragEnd),this.editor.contentElement.removeEventListener("mousemove",this.handleDrag);const o=C2(e,"drop");this.editor.contentElement.dispatchEvent(o)});this.editor=e,this.button=t,this.button.buttonElement.addEventListener("mousedown",this.handleMouseDown),this.dragPreview=new EH(e)}destroy(){this.button.buttonElement.removeEventListener("mousedown",this.handleMouseDown)}}class Uu{constructor(e){m(this,"highlightedBlockId","");m(this,"handleSelectionChange",()=>{this.clearHighlightedBlock()});this.editor=e,this.editor.addListener("selectionChanged",this.handleSelectionChange)}highlightBlock(e){this.clearHighlightedBlock(),this.highlightedBlockId=ie(e),W(e,"highlighted")}clearHighlightedBlock(){if(this.highlightedBlockId){const e=this.editor.findBlockById(this.highlightedBlockId);e&&re(e,"highlighted"),this.highlightedBlockId=""}}destroy(){}static register(e){return e.addCustom("editor-block-highlighter",()=>new Uu(e))}static get(e){return e.getCustom("editor-block-highlighter")}}class gy{constructor(e){m(this,"buttonElement");m(this,"emptyBlockMenu");m(this,"blockMenu");m(this,"dragHandler");m(this,"handleHoverBlock",(e,t,o)=>{if(this.emptyBlockMenu.isVisible||this.blockMenu.isVisible||!this.editor.isWritable())return;const r=this.editor.getCustom("editor-tooltip");if(r&&r.visible()&&(r.hide(),this.buttonElement.setAttribute("data-tooltip-hide-at",`${Date.now()}`)),!e){this.buttonElement.parentElement&&(this.blockMenu.isInMenu(o.target)||this.buttonElement.remove());return}const i=rg(e);this.editor.getBlockIndex(i)===0&&this.editor.getBlockData(i).heading===1||(this.updateButton(i),u2(i,this.buttonElement,Number.MAX_SAFE_INTEGER))});m(this,"handleButtonClick",()=>{if(this.buttonElement.getAttribute("data-type")==="move"){const o=this.blockMenu.currentBlock;if(!o)return;this.editor.selection.selectBlock(o,0),this.blockMenu.show(this.buttonElement,{placement:"bottom-end"}),setTimeout(()=>{Uu.get(this.editor).highlightBlock(o)});return}const t=this.emptyBlockMenu.currentBlock;!t||(this.editor.selection.selectBlock(t,0),setTimeout(()=>{this.editor.focus(),this.updatePlaceholder(t),this.emptyBlockMenu.show()}))});m(this,"updatePlaceholder",e=>{Le(e).setAttribute("data-content-placeholder",L.t("blockMenu.button.searchPlaceholder"))});m(this,"handleChanged",()=>{const e=this.emptyBlockMenu.currentBlock;if(!e)return;const t=ut(this.editor,e)?"insert":"move";this.buttonElement.getAttribute("data-type")!==t&&this.setButtonType(t)});this.editor=e,this.buttonElement=this.createButton(),this.emptyBlockMenu=new X$(e),this.blockMenu=new yH(e),this.editor.addListener("docChanged",this.handleChanged),this.buttonElement.addEventListener("click",this.handleButtonClick),this.dragHandler=new IH(this.editor,this);const t=Ct.get(e);t.addListener("change",this.handleHoverBlock),t.addFinder(new K$),Uu.register(this.editor)}destroy(){Ct.get(this.editor).removeListener("change",this.handleHoverBlock),this.buttonElement.removeEventListener("click",this.handleButtonClick),this.editor.removeListener("docChanged",this.handleChanged),this.emptyBlockMenu.destroy(),this.blockMenu.destroy(),this.buttonElement.remove(),this.dragHandler.destroy()}createButton(){const e=k("button",["block-button"],null);return e.setAttribute(`data-editor-tooltip-${this.editor.clientId}`,L.t("blockMenu.button.tips")),e.innerHTML=Tv,e}setButtonType(e){this.buttonElement.setAttribute("data-type",e);const t=`data-editor-tooltip-${this.editor.clientId}-dynamic`;this.buttonElement.hasAttribute(t)&&this.buttonElement.removeAttribute(t),e==="insert"?(this.buttonElement.innerHTML=RM,this.buttonElement.setAttribute(t,L.t("blockMenu.button.insertTips"))):(this.buttonElement.innerHTML=Tv,this.buttonElement.setAttribute(t,L.t("blockMenu.button.tips")))}updateButton(e){this.emptyBlockMenu.setBlock(e),this.blockMenu.setBlock(e),ut(this.editor,e)?this.setButtonType("insert"):this.setButtonType("move")}}const TH={blockMenu:{section:{basics:"\u57FA\u7840",system:"\u7CFB\u7EDF",styles:"\u6837\u5F0F",common:"\u901A\u7528",actions:"\u64CD\u4F5C",thirdParty:"\u7B2C\u4E09\u65B9\u5185\u5BB9"},command:{insertAbove:"\u5728\u4E0A\u65B9\u63D2\u5165",insertAfter:"\u5728\u4E0B\u65B9\u63D2\u5165",copy:"\u590D\u5236",cut:"\u526A\u5207",delete:"\u5220\u9664"},button:{searchPlaceholder:"\u8F93\u5165\u5173\u952E\u8BCD\u641C\u7D22",tips:`\u957F\u6309\u62D6\u62FD
432
+ `).map(s=>({id:K(),type:"text",text:Ni(s)})),o=K();return{blocks:{root:[{children:[o],type:"code",id:K(),...e}],[o]:t},meta:{},comments:{}}}class ZN{handleBeforeCopy(e,t,o){const r=e.getFocusedBlock();if(!Ic(e,r))return;const i=Z0(r),s=e.getBlockData(i),{language:l,nowrap:a}=s;if(e.selection.range.isCollapsed()){const h=e.getBlockString(r);return F9(h,{language:l,nowrap:a})}const d=e.getSelectedText();return F9(d,{language:l,nowrap:a})}}function QN(n){if(!n.isWritable())return!1;const e=n.getFocusedBlock();if(!!Ic(n,e)){if(n.selection.range.isCollapsed()){const t=n.selection.range.start;return n.insertTextToBlock(e,t.offset," "),!0}return n.undoManager.runInGroup(()=>{cr(n).forEach(o=>{n.insertTextToBlock(o.block,0," ")})}),!0}}function YN(n){if(!n.isWritable())return!1;const e=n.getFocusedBlock();if(!Ic(n,e))return;const t=[" "," "];return n.undoManager.runInGroup(()=>{cr(n).forEach(r=>{const i=st(n.getBlockText(r.block));for(let s=0;s<t.length;s++){const l=t[s];if(i.startsWith(l)){n.deleteTextFromBlock(r.block,0,l.length);break}}})}),!0}function JN(n){const e=n.getFocusedBlock(),t=oe(e);if(Ge(t))return;const o=ne(t);if(!o||Se(o)!=="code")return;const r=n.selection.range;if(!!r.isSimple()&&!YA(t,r))return cp(n,t),!0}const KN={Tab:QN,"Shift+Tab":YN,"CtrlOrCmd+A":JN},Lu=D("code-text-decorate");class Wf{decorateText(e,t,o){var v;if(g(Lu,t.length>0,"invalid path"),t.length===1)return{};const r=t[t.length-2];if(e.doc.getBlockData(r.containerId,r.blockIndex).type!=="code")return{};const s=o;if(s.length===0)return{};const l=st(s),a=e.doc.getBlockData(r.containerId,r.blockIndex),d=Aa.default.tokenize(l,(v=Aa.default.languages[a.language])!=null?v:Aa.default.languages.plain),h=(B,S)=>{if(g(Lu,B,"no token"),typeof B=="string")return[{insert:B,attributes:me.default(S)}];g(Lu,B instanceof Aa.default.Token,"invalid token type");const x=B.content,_=me.default(S);return _[`style-code-${B.type}`]=!0,typeof x=="string"?[{insert:x,attributes:_}]:Array.isArray(x)?x.map(z=>h(z,_)).flat():(g(Lu,x instanceof Aa.default.Token,"invalid token"),h(x,_))},C=d.map(B=>h(B,{})).flat();return g(Lu,rn(C)===rn(s),"failed to highlight code, text length mismatch"),{text:C}}}const XN={code:{title:"\u4EE3\u7801",abstract:"\u4EE3\u7801",wrap:"\u6362\u884C",copy:"\u590D\u5236",caption:"\u8BF4\u660E",search:"\u8F93\u5165\u5173\u952E\u8BCD\u641C\u7D22",copySuccess:"\u590D\u5236\u6210\u529F"}},e$={code:{title:"Code",abstract:"Code",wrap:"Wrap",copy:"Copy",caption:"Caption",search:"Search",copySuccess:"Copied successfully"}},t$={code:{title:"\u30B3\u30FC\u30C9",abstract:"\u30B3\u30FC\u30C9",wrap:"\u6298\u308A\u8FD4\u3059",copy:"\u8907\u88FD",caption:"\u4F8B\u8A3C\u3059\u308B",search:"\u30AD\u30FC\u30EF\u30FC\u30C9\u3067\u691C\u7D22",copySuccess:"\u30B3\u30D4\u30FC\u3055\u308C\u307E\u3057\u305F"}};L.mergeLang({"zh-CN":XN,"en-US":e$,"ja-JP":t$});function n$(n,e,t,o){const r=n.getBlockByIndex(e,t);if(ue(n,r)!==o)return!1;const i=st(n.getBlockText(r));if(![...i].every(h=>h==="|")||i.length<3||!n.editorBlocks.hasBlock("table"))return!1;const s=n.editorBlocks.getBlockClass("table");if(!s.convertFrom)return!1;const l=s.convertFrom(n,r,{offset:o});if(!l)return!1;const{blockData:a,focusBlockId:d}=l;return a?(n.undoManager.runInGroup(()=>{var p;const h=n.insertBlock(e,t,a,kt(n,d!=null?d:a.id,0));n.deleteBlock(r),(p=l.onConverted)==null||p.call(l,n,h)}),!0):!1}const o$={mermaid:{blockType:"embed",reg:/^```mermaid$/,data:{embedType:"mermaid"}},flowchart:{blockType:"embed",reg:/^```flowchart$/,data:{embedType:"flowchart"}},plantuml:{blockType:"embed",reg:/^```plantuml$/,data:{embedType:"plantuml"}},code:{blockType:"code",reg:/^```\S+$/},code2:{blockType:"code",reg:/^```$/},table:{blockType:"table",reg:/^\|.+\|.+\|$/},math:{blockType:"embed",reg:/^\$\$.+\$\$$/},image:{blockType:"embed",reg:/^!\[[^\]]*\]\((?<filename>.*?)(?="|\))(?<optionalPart>".*")?\)/,data:{embedType:"image"}},dividing:{blockType:"embed",reg:/^-{3,}$/,data:{embedType:"dividing-line"}},toc:{blockType:"embed",reg:/^\[toc\]/,data:{embedType:"toc"}}},r$={orderedList:{reg:/^(\d)+(\.|。)$/,blockType:"list",data:{listType:"ordered"}},unorderedList1:{reg:/^\*$/,blockType:"list",data:{listType:"unordered"}},unorderedList2:{reg:/^-$/,blockType:"list",data:{listType:"unordered"}},checkList1:{reg:/^\[\s?\]$/,blockType:"list",data:{listType:"unchecked"}},checkList2:{reg:/^\[X\]$/i,blockType:"list",data:{listType:"checked"}},image:{blockType:"embed",reg:/^!\[[^\]]*\]\((?<filename>.*?)(?="|\))(?<optionalPart>".*")?\)/,data:{embedType:"image"}}};function qf(n,e,t,o,r){const i=n.getContainerById(e);if(!Ge(i)){const s=ne(i);if(s&&yr(s))return!0}return!1}function P9(n,e,t,o,r){if(qf(n,e))return!1;if(r==="enter"&&n$(n,e,t,o))return!0;const i=n.getBlockByIndex(e,t),s=st(Tn(n.getBlockText(i),o).left).trim(),l=r==="enter"?o$:r$;for(const[,a]of Object.entries(l)){if(!s.match(a.reg))continue;return!!n.undoManager.runInGroup(()=>{var B;const h=Ch(n,i,a.blockType,{offset:o,data:a.data});if(!h)return null;const{blockData:p,focusBlockId:C}=h;if(!p)return null;const v=n.insertBlock(e,t,p,kt(n,C!=null?C:p.id,0));return n.deleteBlock(i),(B=h.onConverted)==null||B.call(h,n,v),{newBlock:v,focusBlockId:C}})}return!1}function i$(n,e,t,o){const r=n.getBlockByIndex(e,t);return n.getBlockString(r,{boxReplacement:" "}).substring(0,o)!==">"?!1:(n.undoManager.runInGroup(()=>{n.deleteTextFromBlock(r,0,o+1),n.updateBlockData(r,{quoted:!0},kt(n,r,0))}),!0)}const s$={"#":1,"##":2,"###":3,"####":4,"#####":5,"######":6,"#######":7,"########":8};function l$(n,e,t,o){const r=n.getBlockByIndex(e,t),i=n.getBlockString(r,{boxReplacement:" "}).substring(0,o);let s=s$[i];if(!s)return!1;const l=n.getBlockData(r).heading;return l&&l==s&&(s=null),n.undoManager.runInGroup(()=>{n.deleteTextFromBlock(r,0,o+1),n.updateBlockData(r,{heading:s},kt(n,r,0))}),!0}function c$(n,e,t,o){return!!(l$(n,e,t,o)||i$(n,e,t,o))}const a$=D("match-text-style");function u$(n,e){if(n.length<e.length*2+1||!n.endsWith(e)||n.substring(0,n.length-1).endsWith(e))return-1;const t=n.substring(0,n.length-e.length),o=t.lastIndexOf(e);return o===-1?-1:o===0?0:t.substring(o-1).startsWith(e)?-1:o}const d$={"*":{type:"style",styles:["style-italic"],boxType:""},"**":{type:"style",styles:["style-bold"],boxType:""},"***":{type:"style",styles:["style-bold","style-italic"],boxType:""},"~~":{type:"style",styles:["style-strikethrough"],boxType:""},"`":{type:"style",styles:["style-code"],boxType:""},$$:{type:"box",styles:[],boxType:"math"}};function h$(n,e,t,o){var C,v;const r=n.getBlockByIndex(e,t),i=n.getBlockText(r),{left:s}=Tn(i,o),l=Tg(s),a=rn(s)-l.length,d=Object.entries(d$);for(const[B,S]of d){const x=u$(l,B);if(x===-1)continue;const _=a+x,R=o,H=B.length,z=st(Vt(i,_+H,R-_-H*2).middle);if(S.type==="style"){const Q={};S.styles.forEach(fe=>{Q[fe]=!0});const ee=Ni(z,Q);n.undoManager.runInGroup(()=>{n.deleteTextFromBlock(r,_,R-_),n.insertTextToBlock(r,_,ee)})}else if(S.type==="box")try{const Q=(v=(C=n.editorBoxes.getBoxClass(S.boxType)).convertFrom)==null?void 0:v.call(C,n,z);if(!Q)continue;n.undoManager.runInGroup(()=>{n.deleteTextFromBlock(r,_,R-_),n.insertBoxToBlock(r,_,Q)})}catch(Q){a$.warn(`failed to convert to box, ${Q.message}`);continue}return!0}const h=/\[([^\]]+)\]\((https?:\/\/\S+)\)\s*$/,p=l.match(h);if(p){const B=p.index,S=p[1],x=p[2],_=B,R=o,z={...Na(i,_),link:x};return n.undoManager.runInGroup(()=>{n.deleteTextFromBlock(r,_,R-_),n.insertTextToBlock(r,_,Ni(S,z))}),!0}return!1}class Gf{handleAfterInsertText(e,t,o,r,i){if(i===" "){if(qf(e,t))return!1;if(c$(e,t,o,r)||h$(e,t,o,r))return!0}return!1}handleBeforeKeyDown(e,t){if(!e.selection.range.isSimple())return!1;const{containerId:r,blockIndex:i,offset:s}=e.getTextPosition();if(te(e,e.getBlockByIndex(r,i))){if(rr(t,"Enter")){if(P9(e,r,i,s,"enter"))return!0}else if(rr(t,"Space")&&P9(e,r,i,s,"space"))return!0}return!1}}const f$={"en-US":{placeholder:{default:"Type / for commands",heading:"Heading {heading}",list:"List",mention:"Quickly assign tasks and use @ to mention yourself or others",quote:"Quote",title:"Enter document title"}},"zh-CN":{placeholder:{default:"\u8F93\u5165\u300C/\u300D\u5FEB\u901F\u63D2\u5165",heading:"\u6807\u9898{heading}",list:"\u5217\u8868",mention:"\u5FEB\u901F\u5206\u914D\u4EFB\u52A1\uFF0C@\u63D0\u53CA\u81EA\u5DF1\u6216\u4ED6\u4EBA",quote:"\u5F15\u7528",title:"\u8BF7\u8F93\u5165\u6587\u6863\u6807\u9898"}},"ja-JP":{placeholder:{default:"\u300C/\u300D\u3092\u5165\u529B\u3057\u3066\u7D20\u65E9\u304F\u633F\u5165\u3059\u308B",heading:"\u898B\u51FA\u3057{heading}",list:"\u30EA\u30B9\u30C8",mention:"\u81EA\u5206\u3084\u30E1\u30F3\u30D0\u30FC\u3092\uFF20\u3057\u3001\u30BF\u30B9\u30AF\u3092\u7D20\u65E9\u304F\u5272\u308A\u5F53\u3066\u307E\u3059",quote:"\u5F15\u7528",title:"\u30BF\u30A4\u30C8\u30EB\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"}}};L.mergeLang(f$);function Mu(n,e){const t=$i(n,e);return!!(t.text&&rn(t.text)===0&&!e.querySelector(".inputting-insertion"))}function N9(n,e){var o;Le(e).removeAttribute("data-content-placeholder"),(o=e.querySelector("[data-type=block-tools] .block-placeholder-container"))==null||o.remove()}function Zf(n,e,t){var r;if(!Mu(n,e)){N9(n,e);return}const o=Le(e);if(typeof t=="string")o.setAttribute("data-content-placeholder",t);else{const i=tt(e),s=(r=i.querySelector(".block-placeholder-container"))!=null?r:k("div",["block-placeholder-container"],i);s.innerHTML="",s.appendChild(t)}}function m$(n){const e=n.getAttribute("data-style-heading");return e?L.t("placeholder.heading",{heading:e}):n.getAttribute("data-style-quoted")?L.t("placeholder.quote"):null}function g$(n){const e=n.getAttribute("data-list-type");return e?e==="ordered"||e==="unordered"?L.t("placeholder.list"):L.t("placeholder.mention"):null}function $9(n){switch(Se(n)){case"text":return m$(n);case"list":return g$(n);default:return null}}function p$(n){if(lo(n))return!1;const e=ne(oe(n));return e?Se(e)==="code":!1}function C$(n){return!lo(n)}function A$(n,e){var h,p;const t=n.selection.focusedBlock,o=Se(t),r=e.contentPlaceholder||L.t("placeholder.default");let i=r;if(o&&Da(n,o)&&t){if(!n.isBlockWritable(t)||p$(t))return;C$(t)&&(i=L.t("placeholder.common.contentInTable")),i=(h=$9(t))!=null?h:i}const s=n.getFirstBlock(),l=Qe(s);if(!l)return;const a=Qe(l);if(a&&!e.addPlaceholderToAllCurrentEmptyBlock)return;if(!a&&Mu(n,l)){Zf(n,l,(p=$9(l))!=null?p:r);return}const d=n.getFocusedBlock();!Mu(n,d)||d!==s&&Zf(n,d,i)}function b$(n,e){var r,i;const t=n.getFirstBlock(),o=Le(t);Mu(n,t)?(o.setAttribute("data-title-placeholder",(r=e.titlePlaceholder)!=null?r:L.t("placeholder.title")),o.setAttribute("data-title-placeholder-readonly",(i=e.readonlyTitlePlaceholder)!=null?i:"")):(o.removeAttribute("data-title-placeholder"),o.removeAttribute("data-title-placeholder-readonly"))}function v$(n){n.rootContainer.querySelectorAll("[data-content-placeholder").forEach(e=>{e.removeAttribute("data-content-placeholder")}),n.rootContainer.querySelectorAll("[data-type=block-tools] .block-placeholder-container").forEach(e=>{e.remove()})}function y$(n,e){v$(n),n.selection.range.isCollapsed()&&(b$(n,e),A$(n,e))}const Loe="";function k$(n){for(let e=1;e<n.length;e++){const t=n[e];if(t.attributes&&Object.keys(t.attributes).length)return!0}return!1}const H9=D("enforce-title");class Ru{constructor(e,t={headingLevel:1}){m(this,"handleSelectionChange",e=>{setTimeout(()=>{this.applyPlaceholder(e)})});this.options=t,this.handleChanged(e),this.applyPlaceholder(e),e.addListener("selectionChanged",this.handleSelectionChange)}destroy(e){e.removeListener("selectionChanged",this.handleSelectionChange)}handleBeforeKeyDown(e,t){if(!e.selection.range.isSimple())return!1;const{containerId:r,blockIndex:i,offset:s}=e.getTextPosition();if(!Ru.isDocumentTitleBlock(r,i)||!rr(t,"Enter"))return!1;let l=!1,a=null;So(e.rootContainer)===2&&(a=Ur(e.rootContainer,1),ue(e,a)===0&&(l=!0));const d=e.getFirstBlock();return e.undoManager.runInGroup(()=>{e.breakTextBlock(d,s,{forceInsertAfter:!0}),l&&a&&e.deleteBlock(a)}),!0}handleChanged(e){var t,o;try{const r=e.doc.getContainerBlocks(ce(e.rootContainer));g(H9,r.length>0,"root container is empty");const i=r[0];if(i.type!=="text"){const s=dr("",{heading:(t=this.options.headingLevel)!=null?t:1});e.insertBlock(ce(e.rootContainer),0,s,e.selection.range.toDocRange());return}if(g(H9,i.text,"invalid text block"),k$(i.text)||i.quoted||i.heading!==this.options.headingLevel){const s=e.getBlockById(i.id),l=e.getBlockString(s),a=dr(l,{heading:(o=this.options.headingLevel)!=null?o:1,quoted:!1}),d=e.selection.focusedBlock;let h=e.selection.range;const p=e.insertBlock(ce(e.rootContainer),0,a);d===s&&(h=kt(e,a.id,ue(e,p))),Uh(e,s,h)}if(r.length>1)return;e.insertTextBlock("",ce(e.rootContainer),1,{newRange:e.selection.range.toDocRange()})}finally{this.applyPlaceholder(e)}}handleRemoteChanged(e){setTimeout(()=>{this.applyPlaceholder(e)})}handleUpdateCompositionText(e){this.applyPlaceholder(e)}applyPlaceholder(e){var t,o;!((t=this.options)!=null&&t.titlePlaceholder)&&!((o=this.options)!=null&&o.contentPlaceholder)||y$(e,this.options)}static isDocumentTitleBlock(e,t){return e==="root"&&t===0}}const w$=D("image-data"),j9=1e3,r2=400,B$=10;function Tc(n){return n.src.startsWith("empty:")||!n.src}function E$(n){return n.src.startsWith("http:")||n.src.startsWith("https:")}function U9(n){return`${Jd.default(n)}_width`}function z9(n){return`${Jd.default(n)}_height`}function V9(n){return`${n}_flex`}function W9(n){let e=n.getBoundingClientRect().width;return e-=Number.parseFloat(window.getComputedStyle(n).paddingLeft)+Number.parseFloat(window.getComputedStyle(n).paddingRight),e}function Ou(n){if(n.every(r=>typeof r.flex=="number"&&r.flex))return;const e=100,o=n.map(r=>{const i=r.height==="auto"?r.width/e:r.height/e;return r.width/i}).reduce((r,i)=>r+i,0);n.forEach(r=>{const i=r.height==="auto"?r.width/e:r.height/e,s=r.width/i;r.flex=s/o})}function Sc(n){const e=(r,i)=>{r||(r=`empty:${i}`);const s=U9(r),l=z9(r),a=V9(i);let d=n[s],h=n[l],p=n[a];return typeof d=="string"&&(d=Number.parseInt(d,10)),typeof h=="string"&&(h=Number.parseInt(h,10)),typeof p=="string"&&(p=Number.parseInt(p,10)),d&&h?{src:r,width:d,height:h,flex:p,virtualSize:!1}:d&&!h?{src:r,width:d,height:"auto",flex:p,virtualSize:!1}:(d=j9,h=r2,{src:r,width:d,height:h,flex:p,virtualSize:!0})};let t=[];const o=n.src;return Array.isArray(o)?t=o.map(e):typeof o=="string"&&(t=o.split("|").map(e)),Ou(t),t}function Wo(n){const e=n.embedData;return Sc(n.embedData).length>1?100:e.widthPercent}function x$(n,e,t,o){const r=Sc(e.embedData);if(r.length>1||o)return"100%";const i=Wo(e),s=n.rootContainer.getBoundingClientRect().width;if(i){const l=W9(t);return`${Math.min(s*i/100,l)}px`}return r[0].width?`${r[0].width}px`:"auto"}function cn(n,e){const o={src:n.map(r=>r.src).join("|"),widthPercent:e};return n.forEach((r,i)=>{if(r.width&&r.height&&!r.virtualSize){const l=r.src||`empty:${i}`,a=U9(l);o[a]=r.width;const d=z9(l);r.height!=="auto"&&(o[d]=r.height)}g(w$,r.flex,"no image flex");const s=V9(i);o[s]=r.flex}),o}function I$(n,e,t,o){const r=Sc(e.embedData),i=r.length===1?n.rootContainer:t;if(r.length===1&&o)return`${r2}px`;if(r.some(h=>h.height==="auto"))return"auto";const s=Wo(e);if(!s)return"";let l=i.getBoundingClientRect().width*(s/100);if(l-=Number.parseFloat(window.getComputedStyle(i).paddingLeft)+Number.parseFloat(window.getComputedStyle(i).paddingRight),i===n.rootContainer&&i!==t&&(l=Math.min(l,W9(t))),r.length===1){const h=r[0];return h.virtualSize?"":`${h.height/(h.width/l)}px`}l-=(r.length-1)*B$;const a=r.reduce((h,p)=>h+p.flex,0);let d=0;for(const h of r){const C=l*h.flex/a/h.width*h.height;d=Math.max(C,d)}return`${d}px`}function T$(n){return n.reduce((t,o)=>t+o.flex,0)}function S$(n,e){k("div",["resize-gripper",e],n).setAttribute("data-resize-type",e)}function i2(n){return tt(n).querySelector(".block-resizer")}function D$(n){const e=i2(n);e&&re(e,"active")}function q9(n,e,t){const o=n.getBoundingClientRect(),r=e.getBoundingClientRect(),i=r.top-o.top,s=r.left-o.left,l=r.width,a=r.height;t.style.top=`${i}px`,t.style.left=`${s}px`,t.style.width=`${l}px`,t.style.height=`${a}px`}function L$(n,e,t,o){const r=i2(n);if(r)return W(r,"active"),q9(n,e,r),r;const i=tt(n),s=k("div",["block-resizer"],i);return q9(n,e,s),t.resize.forEach(l=>{S$(s,l)}),s.addEventListener("mousedown",o),W(s,"active"),s}function s2(n,e){const t=i2(n);if(!t||!et(n,e))return;const o=n.getBoundingClientRect(),r=e.getBoundingClientRect(),i=r.top-o.top,s=r.left-o.left,l=r.width,a=r.height;t.style.top=`${i}px`,t.style.left=`${s}px`,t.style.width=`${l}px`,t.style.height=`${a}px`}const Moe="",M$=D("block-resizer");class _u extends vt.TypedEmitter{constructor(t,o){super();m(this,"resizableElement");m(this,"block",null);m(this,"startRect",null);m(this,"startPos",null);m(this,"resizeType",null);m(this,"enabled",!1);m(this,"handleMouseDown",t=>{t.preventDefault(),t.stopPropagation();const o=this.getResizableElement();if(!o||t.button!==0)return;const r=t.target;if(!r||!(r instanceof HTMLElement))return;const i=r.getAttribute("data-resize-type");!i||(this.bindEvents(),this.startRect=o.getBoundingClientRect(),this.startPos=t,this.resizeType=i,wa(window.getComputedStyle(r).cursor),this.block&&this.editor.selection.selectBlock(this.block,0))});m(this,"handleMouseMove",t=>{if(!this.startPos||!this.startRect||!this.resizeType||!this.getResizableElement()||!this.block)return;const r=t.x-this.startPos.x,i=t.y-this.startPos.y,s=this.startRect;let{top:l,left:a,right:d,bottom:h}=s;(this.resizeType==="bottom"||this.resizeType==="bottom-left"||this.resizeType==="bottom-right")&&(h+=i),(this.resizeType==="top"||this.resizeType==="top-left"||this.resizeType==="top-right")&&(l+=i),(this.resizeType==="left"||this.resizeType==="top-left"||this.resizeType==="bottom-left")&&(a+=r),(this.resizeType==="right"||this.resizeType==="top-right"||this.resizeType==="bottom-right")&&(d+=r);const p=d>a?d-a:0,C=h>l?h-l:0,v=new DOMRect(a,l,p,C);this.emit("resizing",this,v);const B=this.getResizableElement();B&&s2(this.block,B)});m(this,"handleMouseUp",t=>{if(t.button!==0)return;wa(""),this.unbindEvents(),this.emit("resized",this);const o=this.getResizableElement();!o||!this.block||s2(this.block,o)});this.editor=t,this.options=o}enableResize(t,o){this.block=t,this.resizableElement=o,this.createResizer(),this.enabled=!0}disableResize(){!this.block||(D$(this.block),this.enabled=!1)}update(t,o){this.block=t,this.resizableElement=o,this.getResizableElement()&&this.enabled&&this.createResizer()}updateResizer(){const t=this.getResizableElement();t&&this.block&&s2(this.block,t)}getBlock(){return this.block}destroy(){}getResizableElement(){return this.resizableElement?this.resizableElement:this.block?Le(this.block):null}createResizer(){const t=this.getResizableElement();!t||!this.block||(g(M$,et(this.block,t),"not a block child element"),L$(this.block,t,this.options,this.handleMouseDown))}bindEvents(){document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("mouseup",this.handleMouseUp)}unbindEvents(){document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp)}}const R$=D("image-dom");function G9(n){return n.querySelector(".uploading-progress-mask")}function O$(n){const e=G9(n);if(e)return e;const t=k("div",["uploading-progress-mask"],n),o=k("div",["uploading-progress-bar"],t);return k("div",["uploading-progress-bar-value"],o),o}function _$(n){const t=O$(n).querySelector(".uploading-progress-bar-value");return g(R$,t,"no progress value"),t}function Z9(n,e){const t=_$(n);t.style.width=`${e}%`}function F$(n){var e;(e=G9(n))==null||e.remove()}function Fu(n,e,t,o){const r=t!=null?t:n.findBlockById(e.id);if(!r)return;const i=o||oe(r),s=!!r.querySelector(".images > .image-container.error, .images > .image-container.empty "),l=x$(n,e,i,s),a=I$(n,e,i,s),d=Le(r);l==="auto"?d.style.width=l:(d.style.maxWidth=l,d.style.width="100%");const h=r.querySelector(".images");!h||(h.style.height=a||"none")}function P$(n){let e;return n.forEach((t,o)=>{o.toLocaleLowerCase()==="content-type"&&(e=t)}),e!=null?e:""}async function N$(n){try{const e=await fetch(n,{credentials:"same-origin"}),t=await e.blob(),o=P$(e.headers).toLocaleLowerCase();let r="";if(o){const s=Dm.default[o].extensions;s&&s.length>0&&(r=s[0])}return new File([t],`${Date.now()}.${r}`,{type:o})}catch{return null}}function Xi(n,e){const t=typeof e=="string"?e:ie(e);return n.getCustom(`image-${t}`)}function Qf(n,e){if(!e||!(e instanceof Node))return null;const t=ne(e);return t?Xi(n,t):null}function wr(n){return Array.from(n.querySelectorAll(".image-container"))}const l2=D("table-resize-drag-drop");class $${constructor(e,t,o,r){m(this,"cursor","col-resize");m(this,"initWidths");this.editor=e,this.elem=t,this.data=o,this.mouseDownEvent=r;const i=this.data.block,l=Xi(this.editor,i).getImages(),a=this.data.splitterIndex;g(l2,a>=0&&a<l.length-1,`invalid splitter index: ${a}`);const h=wr(i).map(p=>p.getBoundingClientRect().width);this.initWidths=h}onDragStart(e,t,o){if(!this.editor.isWritable())return;const r=this.data.block;Xi(this.editor,r).setResizing(!0)}onDragging(e,t,o,r,i){const s=this.data.block,l=Xi(this.editor,s),a=me.default(l.getImages()),d=this.data.splitterIndex;g(l2,d>=0&&d<a.length-1,`invalid splitter index: ${d}`);const h=this.initWidths[d],p=this.initWidths[d+1];if(h+p<100)return;let C=r;h+C<50&&(C=50-h),p-C<50&&(C=p-50);const S=[...this.initWidths];S[d]+=C,S[d+1]-=C;const x=wr(s);g(l2,x.length===a.length,"invalid image data");const _=S.reduce((z,Q)=>z+Q,0);for(let z=0;z<a.length;z++){const Q=S[z]/_;a[z].flex=Q,x[z].style.flexGrow=`${Q}`}const R=me.default(this.editor.getBlockData(s)),H=cn(a,Wo(R));R.embedData=H,Fu(this.editor,R,s,null)}onDragEnd(e,t,o,r,i){const s=this.data.block,l=Xi(this.editor,s),d=wr(s).map(h=>Number.parseFloat(h.style.flexGrow));l.updateFlex(d),l.setResizing(!1)}}function Q9(n){var e;return!n||!(n instanceof HTMLElement)?null:xe(n,"image-splitter")?n:(e=n.closest(".image-splitter"))!=null?e:null}function H$(n,e){var s;const t=Q9(e.target);if(!t)return;const o=ne(t);if(!o)return;Xi(n,o).setSelectedIndex(-1),n.selection.selectBlock(o,0);const r=Number.parseInt((s=t.getAttribute("data-index"))!=null?s:"",10);if(Number.isNaN(r)||typeof r!="number")return;const i={block:o,splitterIndex:r};Nm(new $$(n,t,i,e))}function j$(n,e){e.preventDefault(),e.stopPropagation();const t=Q9(e.target);if(!t)return;const o=ne(t);!o||Xi(n,o).resetFlex()}function U$(n,e,t,o){const r=k("div",["image-splitter"],t);k("div",["image-splitter-indicator"],r),r.setAttribute("data-index",`${o}`),n.domEvents.addEventListener(r,"mousedown",H$),n.domEvents.addEventListener(r,"dblclick",j$)}const z$=D("image-item");function Y9(n){return!n||!(n instanceof Node)?null:ne(n)}function J9(n){const e=Y9(n);return e?wr(e):[]}function c2(n){if(!n||!(n instanceof Node))return null;const e=n instanceof Element?n:n.parentElement;if(!e)return null;const t=e.closest(".image-container");return t||null}function Pu(n){const e=c2(n);return e?J9(n).indexOf(e):-1}async function V$(n,e){const t=Qf(n,e.target);if(!t)return;const o=Pu(e.target);if(o===-1)return;const r=e.target;if(!(r instanceof HTMLImageElement))return;const i=t.getImages()[o];if(Tc(i)||n.readonly||!t.isAutoFix()||(setTimeout(()=>{t.setAutoFix(!1)},400),i.height==="auto"&&t.fixImageSize(o,r),i.virtualSize&&t.fixImageSize(o,r),!i||!E$(i)||i.downloading))return;i.downloading=!0;const s=await N$(i.src);s?t.replaceImage(o,s):z$.warn(`failed to download image: ${i.src}`)}function W$(n,e,t){if(e.querySelector(".load-error"))return;const r=t.src.startsWith("http:")||t.src.startsWith("https:"),i=k("div",["load-error"],e),s=k("div",["error-icon"],i);s.innerHTML=vv;const l=k("div",["error-message"],i);r?(l.innerHTML=L.t("image.load.remote.failed"),n.domEvents.addEventListener(i,"click",(a,d)=>{d.preventDefault(),d.target instanceof HTMLElement&&d.target.tagName==="A"&&window.open(t.src,"_blank")})):(l.innerHTML=L.t("image.load.failed"),n.domEvents.addEventListener(i,"click",(a,d)=>{d.preventDefault(),d.stopPropagation(),d.target instanceof HTMLElement&&d.target.tagName==="A"&&Q$(a,d.target)}))}function a2(n,e){setTimeout(()=>{if(et(n.rootContainer,e)){const t=n.getBlockData(e);Fu(n,t,null,null)}})}function q$(n,e){const t=Qf(n,e.target);if(!t)return;const o=Pu(e.target);if(o===-1)return;const r=t.getImages()[o];if(!r)return;const i=c2(e.target);if(!i)return;W(i,"error","error-load");const s=ne(i);s&&a2(n,s),i.innerHTML="",W$(n,i,r)}function G$(n,e,t){if(e.querySelector(".upload-error"))return;const r=k("div",["upload-error"],e),i=k("div",["error-icon"],r);i.innerHTML=vv;const s=k("div",["error-message"],r);s.innerHTML=L.t("image.upload.failed"),n.domEvents.addEventListener(r,"click",(l,a)=>{if(a.preventDefault(),!a.target||!(a.target instanceof Element)||a.target.tagName!=="A")return;const d=Qf(l,a.target),h=Pu(a.target);!d||h===-1||d.replaceImage(h,t)})}function K9(n,e,t,o,r){const i=wr(e)[t];!i||(W(i,"error","error-upload"),a2(n,e),i.innerHTML="",G$(n,i,r))}function X9(n,e,t,o,r,i,s){const l=k("div",["image-container"],t);if(l.setAttribute("data-src",o.src),s.length>1&&(l.style.flexShrink=`${o.flex}`,l.style.flexGrow=`${o.flex}`),i===r&&W(l,"active"),Tc(o)){W(l,"empty");const d=k("div",["upload-image-icon"],l);return d.innerHTML=lM,l}const a=k("img",["editor-image"],l);if(a.src=n.doc.buildResourceUrl(o.src),n.domEvents.addEventListener(a,"load",V$),n.domEvents.addEventListener(a,"error",q$),o.src.startsWith("https:")||o.src.startsWith("http:")){const d=k("div",["image-warning"],l);d.innerHTML=bv,d.setAttribute(`data-editor-tooltip-${n.clientId}`,L.t("image.load.remote.tooltip"))}return l}function Z$(n,e,t,o,r){const i=k("div",["images"],t);return o.forEach((s,l)=>{l>0&&U$(n,e,i,l-1),X9(n,e,i,s,l,r,o)}),o.length>1&&W(e,"multi"),i}function ey(n,e,t,o,r,i){const l=Array.from(e.querySelectorAll(".image-container"))[o];if(!l)return;const a=X9(n,e,null,t,o,r,i);l.insertAdjacentElement("beforebegin",a),l.remove(),a2(n,e)}function Nu(n,e){return wr(n)[e]}function Q$(n,e){const t=Y9(e);if(!t)return;const o=Pu(e);if(o===-1)return;const r=Qf(n,e);if(!r)return;const i=r.getImages()[o];ey(n,t,i,o,r.getSelectedIndex(),r.getImages())}function qo(n){return Se(n)==="embed"&&fn(n)==="image"}async function ty(n){return new Promise((e,t)=>{const o=new Image;o.onload=()=>{e({width:o.naturalWidth,height:o.naturalHeight})},o.onerror=t,o.src=n})}async function Y$(n){const e=await Wl(n);return ty(e)}function ny(n){var o;let e="image/*";const t=(o=n.getComponentOptions("image"))==null?void 0:o.allowedMedias;return t&&(e=t.map(r=>`.${r}`).join(",")),e}function oy(n,e){var s;const{maxSize:t,allowedMedias:o,callbacks:r}=(s=n.getComponentOptions("image"))!=null?s:{};if(t&&e.size>t){const l=new Error("image is too large");throw l.code="MaxMediaSize",r!=null&&r.onError&&(r==null||r.onError(n,l)),l}const i=Ia(e.name);if(o&&!o.includes(i)){const l=new Error(`media file is not allowed: ${i}`);throw l.code="NotAllowedFile",r!=null&&r.onError&&(r==null||r.onError(n,l)),l}}function ry(n){return n.startsWith("image/")}const iy=D("image-object");class Tt{constructor(e,t){m(this,"images",[]);m(this,"selectedIndex",-1);m(this,"blockResizer");m(this,"resizing",!1);m(this,"parentContainerResizerObserver",null);m(this,"autoFix",!1);m(this,"handleMouseDown",async(e,t)=>{const o=Pu(t.target);if(o===-1)return;const r=this.images[o];Tc(r)||this.setSelectedIndex(o)});m(this,"handleRootContainerResize",()=>{this.handleEditorResize(this.editor.rootContainer)});m(this,"handleEditorResize",e=>{if(this.isEmpty()||this.resizing)return;const t=this.editor.findBlockById(this.blockData.id);!t||oe(t)===e&&Fu(this.editor,this.blockData,t,null)});m(this,"handleResizing",(e,t)=>{const o=this.editor.findBlockById(this.blockData.id);if(!o)return;this.autoFix||this.setAutoFix(!0);const i=this.editor.rootContainer.getBoundingClientRect().width,s=o.getBoundingClientRect();let l=t.width>s.width?s.width:t.width;l<50&&(l=50);const a=l*100/i;this.blockData.embedData.widthPercent=a,Fu(this.editor,this.blockData,o,null)});m(this,"handleResized",e=>{const t=this.editor.findBlockById(this.blockData.id);if(!t)return;const o=cn(this.images,Wo(this.blockData));this.editor.updateEmbedData(t,o),this.blockResizer.enableResize(t)});m(this,"fixImageSizes",Mt.default(()=>{const e=this.editor.findBlockById(this.blockData.id);if(!e)return;const t=cn(this.images,Wo(this.blockData));this.editor.updateEmbedData(e,t)},1e3));this.editor=e,this.blockData=t,this.blockResizer=new _u(this.editor,{resize:["top-left","top-right","bottom-left","bottom-right"]}),this.blockResizer.addListener("resizing",this.handleResizing),this.blockResizer.addListener("resized",this.handleResized),this.images=Sc(this.blockData.embedData)}destroy(){var e;this.blockResizer.removeAllListeners(),this.blockResizer.destroy(),this.editor.domEvents.removeEventListener(null,null,this.handleMouseDown),(e=this.parentContainerResizerObserver)==null||e.disconnect()}setAutoFix(e){this.autoFix=e}isAutoFix(){return this.autoFix}createContent(e,t,o){const r=Z$(this.editor,t,o,this.images,this.selectedIndex);if(this.editor.domEvents.addEventListener(o,"mousedown",this.handleMouseDown),this.editor.addListener("resize",this.handleRootContainerResize),Ro(e)){const s=()=>{this.handleEditorResize(e)};this.parentContainerResizerObserver=new vs(s),this.parentContainerResizerObserver.observe(e)}const i=()=>!!(this.images.length===1&&this.images[0].virtualSize);this.isEmpty()&&i()&&W(r,"empty"),Fu(this.editor,this.blockData,t,e),setTimeout(()=>{const s=this.editor.findBlockById(this.blockData.id);s&&this.blockResizer.update(s)})}getImages(){return this.images}getWidthPercent(){return Wo(this.blockData)}isEmpty(){return this.images.length===1&&Tc(this.images[0])}setResizing(e){this.resizing=e}getSelectedIndex(){return this.selectedIndex}getBlock(){return this.editor.findBlockById(this.blockData.id)}setSelectedIndex(e){const t=this.getBlock();if(!t||e===this.selectedIndex)return;if(this.selectedIndex!==-1){const r=Nu(t,this.selectedIndex);r&&re(r,"active")}this.selectedIndex=e;const o=Nu(t,e);o&&W(o,"active")}async requestUploadImage(e){const t=this.editor.findBlockById(this.blockData.id);if(!t)return;const o=Nu(t,e);if(xe(o,"error"))return;const r=ny(this.editor),i=await ql(r);await this.replaceImage(e,i)}tryEnableResizer(){const e=this.editor.findBlockById(this.blockData.id);if(!e||!this.editor.isWritable())return;const t=Nu(e,0);!this.isEmpty()&&this.images.length===1&&!xe(t,"error")&&this.blockResizer.enableResize(e)}disableResizer(){this.blockResizer.disableResize()}fixImageSize(e,t){const o=this.images[e];Tc(o)||(o.height==="auto"&&(o.height=t.height),o.width=t.naturalWidth,o.height=t.naturalHeight,o.virtualSize=!1,this.fixImageSizes())}removeImage(e){const t=this.editor.findBlockById(this.blockData.id);if(!t||e===-1||e>=this.images.length)return!1;const o=me.default(this.images);if(o.splice(e,1),o.length===0)return this.editor.deleteBlock(t),!0;o[0].flex=NaN,Ou(o),this.selectedIndex>=o.length&&(this.selectedIndex=o.length-1);const r=cn(o,Wo(this.blockData));return this.editor.updateEmbedData(t,r),!0}async replaceImage(e,t){const o=this.editor.findBlockById(this.blockData.id);if(!o)return!1;try{const i=await Wl(t),s=this.images[e];if(s.virtualSize){const{width:a,height:d}=await ty(i);s.width=a,s.height=d,s.virtualSize=!1;const h=cn(this.images,Wo(this.blockData));this.editor.updateEmbedData(o,h)}const l={...s,src:i};ey(this.editor,o,l,e,this.selectedIndex,this.images),setTimeout(()=>{this.blockResizer.update(o)})}catch(i){return K9(this.editor,o,e,i,t),!1}const r=Nu(o,e);if(!r)return!1;W(r,"uploading"),Z9(r,0),W(o,"media-block-uploading");try{const i=await this.editor.doc.uploadResource(t,{onProgress:a=>{Z9(r,a)}});re(r,"uploading"),this.images[e].src=i.resourceId;const s=this.editor.findBlockById(this.blockData.id);if(!s)return!1;re(s,"media-block-uploading");const l=cn(this.images,Wo(this.blockData));return this.editor.updateEmbedData(s,l),!0}catch(i){iy.error(i);const s=this.editor.findBlockById(this.blockData.id);return s&&(re(r,"uploading"),F$(r),K9(this.editor,s,e,i,t),re(s,"media-block-uploading")),!1}}updateFlex(e){const t=this.editor.findBlockById(this.blockData.id);if(!t)return;g(iy,e.length===this.images.length,"invalid flex");for(let r=0;r<this.images.length;r++)this.images[r].flex=e[r];const o=cn(this.images,Wo(this.blockData));this.editor.updateEmbedData(t,o)}resetFlex(){const e=this.editor.findBlockById(this.blockData.id);if(!e)return;const t=me.default(this.images);t[0].flex=NaN,Ou(t);const o=cn(t,Wo(this.blockData));this.editor.updateEmbedData(e,o)}setData(e){this.blockData=e,this.images=Sc(e.embedData)}static create(e,t){const o=e.addCustom(`image-${t.id}`,()=>new Tt(e,t));return o.setData(t),o}static getImageObject(e,t){let o;return typeof t=="string"?o=t:o=ie(t),e.getCustom(`image-${o}`)}}const Roe="",Ooe="";function Yf(n){const e=tt(n);let t=e.querySelector(":scope > .block-helper");return t||(t=k("div",["block-helper"],e),k("span",["helper-sizer"],t,"A")),t}function u2(n,e,t){const o=Yf(n),i=Array.from(o.children).find(s=>{var a;return Number.parseInt((a=s.getAttribute("data-index"))!=null?a:"0",10)>t});o.insertBefore(e,i!=null?i:null)}const sy=40,J$=20;class K${findTargetBlock(e,t){const o=t.target;if(o&&o instanceof Element){const a=ne(o);if(a&&et(e.rootContainer,a))return a}let r=t.clientX,i=t.clientY;const s=e.rootContainer.getBoundingClientRect().left;r<s&&s-r<sy&&(r+=sy);let l=document.elementFromPoint(r,i);if(l){const a=ne(l);if(a&&et(e.rootContainer,a))return a}if(i-=J$,l=document.elementFromPoint(r,i),l){const a=ne(l);if(a&&et(e.rootContainer,a))return a}return null}destroy(){}}class X$ extends Ff{constructor(t){super(t,{trigger:[],id:"empty-block-menu"});m(this,"currentBlock",null)}get isVisible(){return this.suggest.menu.isVisible}isInMenu(t){return this.menu.isInCommandBar(t)}show(){const o=this.editor.selection.focusedBlock;this.suggest.popup(o,0,"","")}setBlock(t){this.currentBlock=t}}function eH(n,e,t){const o=ig(n,e);if(!o)return[];const r=[];return Object.values(o).forEach(i=>{t!=null&&t.has(i.group)||r.push(...i.commands.map(s=>({...s,source:"block-command",blockMenuItemCustomData:i.group})))}),r}function d2(n,e,t={withPlainText:!1}){const o=j0(n,t),r=i=>{i.forEach(s=>{s.source=e,s.children&&r(s.children)})};return r(o),o}function tH(n,e,t,o=!1){var d,h;const r=oe(e);let s=be(e);ut(n,e)||o||(s+=1);const l=ce(r),a=t;return a.commandProvider?a.commandProvider.executeCommand(n,t,{from:"block-menu",containerId:l,blockIndex:s}):(h=(d=a.blockOptions)==null?void 0:d.handleInsertEmptyBlock)==null?void 0:h.call(d,n,{containerId:l,blockIndex:s,item:t})}function nH(n,e){const t=Lo(n,e),o=n.getBlockData(e);return!(t!=="text"||o.heading)}class ly{constructor(e,t,o){m(this,"source","text-style");m(this,"id","text-style-item");m(this,"name","Text styles");m(this,"element");m(this,"textStylesTooltips",{});m(this,"createHeadingItemElement",(e,t,o)=>{var i;const r=P0();this.createItem("text",hu,t,nH(this.editor,e)),(i=r.insertBlockCommandItems)==null||i.forEach(s=>{s.id&&s.icon&&this.createItem(s.id,s.icon,t,o?o===Number(s.value):!1)})});m(this,"createListItemElement",(e,t,o)=>{const{checkbox:r,ordered:i}=o,l=Se(e)==="list",a=l&&i===!1&&!r,d=l&&i,h=l&&!!r;this.createItem("unordered-list",xv,t,a),this.createItem("ordered-list",Iv,t,d),this.createItem("check-list",Bv,t,h)});m(this,"handleClick",(e,t)=>{var l,a;if(!t.target||!(t.target instanceof Node))return;const o=t.target instanceof Element?t.target:t.target.parentElement;if(!o)return;const r=o.closest(".text-style-item");if(!r)return;const i=r.id,s="heading-";if(i==="text"&&Of(e,this.block,null),i.startsWith(s)){const d=Number.parseInt(i.substring(s.length),10);d&&Of(e,this.block,d)}if(i==="blockquote"&&O0(e,this.block),i.startsWith("align")){const d=i.replace(/^align-/,"");q7(e,this.block,d)}(i==="unordered-list"||i==="ordered-list"||i==="check-list")&&F0(e,this.block,i),(a=(l=this.options).onAfterStyleItemClick)==null||a.call(l)});m(this,"calcTextStyleItemTooltipsEnum",()=>{this.textStylesTooltips={text:{title:L.t("commands.text")},blockquote:{title:L.t("commands.quote")},"align-left":{title:L.t("commands.alignLeft")},"align-center":{title:L.t("commands.alignCenter")},"align-right":{title:L.t("commands.alignRight")},"unordered-list":{title:L.t("commands.unordered")},"ordered-list":{title:L.t("commands.ordered")},"check-list":{title:L.t("commands.check")}};let e=1;for(;e<=8;)this.textStylesTooltips[`heading-${e}`]={title:L.t("commands.heading",{name:`${e}`})},e++});this.editor=e,this.block=t,this.options=o,this.calcTextStyleItemTooltipsEnum(),this.element=this.createItemElement(e,t),e.domEvents.addEventListener(this.element,"click",this.handleClick)}createItemElement(e,t){const o=k("div",["text-styles"],null),r=k("div",["text-style-section"],o),i=e.getBlockData(t);if(!this.options.fromEmbed){const l=i.heading,a=i.quoted;this.createHeadingItemElement(t,r,l),this.createListItemElement(t,r,i),this.createItem("blockquote",Ev,r,!!a)}const s=i.align||"left";return this.createItem("align-left",du,r,s==="left"),this.createItem("align-center",zp,r,s==="center"),this.createItem("align-right",Up,r,s==="right"),o}createItem(e,t,o,r=!1){const i=["style-icon","text-style-item"];r&&i.push("active");const s=Ul(t,i,o);s.id=e;const l=this.textStylesTooltips[e];if(!l)return;const{title:a,shortcut:d}=l;s.setAttribute(`data-editor-tooltip-${this.editor.clientId}`,a),d&&s.setAttribute(`data-editor-tooltip-desc-${this.editor.clientId}`,io(d))}}function cy(){return{source:"separator",type:"separator",id:`section-${K()}`,name:""}}const ay={copy:BM,cut:EM,delete:xM,"lock-block":IM,"unlock-block":TM,comment:cc},oH=["image","video"];function rH(n,e,t){const o=[],r=te(n,e),i=It(e)&&oH.includes(fn(e)),s=i&&(fn(e)!=="image"||fn(e)==="image"&&wr(e).length===1);if(r?o.push(new ly(n,e,t)):i&&s&&o.push(new ly(n,e,{...t,fromEmbed:!0})),!ut(n,e)){(r||i&&s)&&o.push(cy());const l=eH(n,e,new Set(["hovering-toolbar"]));l.sort((a,d)=>{var h,p;return((h=a.order)!=null?h:0)-((p=d.order)!=null?p:0)}),l.forEach(a=>{a.id in ay&&(a.icon=ay[a.id])}),o.push(...l)}return ut(n,e)?o.push(...d2(n,"insert-block")):o.push(cy(),{id:"insert-block-before",icon:SM,name:L.t("blockMenu.command.insertAbove"),children:d2(n,"insert-block-before",{withPlainText:!0}),childrenMenuId:"quick-menu",source:"insert-block-before"},{id:"insert-block-after",icon:DM,name:L.t("blockMenu.command.insertAfter"),children:d2(n,"insert-block",{withPlainText:!0}),source:"insert-block",childrenMenuId:"quick-menu"}),o}function iH(n,e,t){if(t.source==="block-command"){const o=t.blockMenuItemCustomData;S4(n,e,o,t)}else(t.source==="insert-block"||t.source==="insert-block-before")&&tH(n,e,t,t.source==="insert-block-before")}const sH=D("exclusive-block");function h2(n,e,t,o){var l;W(e,"block-exclusive");const r=Ye(n,e),i=(l=r.getBlockProperties)==null?void 0:l.call(r,n,e),{abstract:s}=i||{};e.setAttribute("data-user-name",o),e.setAttribute("data-user-id",t),e.setAttribute("data-exclusive-tips",L.t("exclusive.tips",{editor:o,embedType:s||L.t("exclusive.fallbackAbstract")}))}function uy(n){re(n,"block-exclusive"),n.removeAttribute("data-user-name"),n.removeAttribute("data-user-id"),n.removeAttribute("data-exclusive-tips")}function lH(n,e,t,o,r){sH.debug(`block ${ie(e)} ${t?"exclusive":"unexclusive"}, ${o}, ${r}`),t?h2(n,e,o,r):uy(e)}function $u(n){return n.classList.contains("block-exclusive")}function dy(n,e){e.blockIds.forEach(t=>{const o=n.findBlockById(t);o&&lH(n,o,e.exclusive,e.userId,e.displayName)})}class es{constructor(e){m(this,"exclusiveBlockIds",new Set);m(this,"exclusiveBlockTimer",0);m(this,"remoteExclusiveBlockIds",new Map);m(this,"handleUserChanged",e=>{const t=new Set(e.map(r=>r.userId));Array.from(this.remoteExclusiveBlockIds.entries()).forEach(([r,i])=>{if(!t.has(i.userId)){this.remoteExclusiveBlockIds.delete(r);const s={...i,exclusive:!1};dy(this.editor,s)}});const o=Array.from(this.exclusiveBlockIds).map(r=>this.editor.findBlockById(r)).filter(r=>!!r);o.length>0&&this.broadcastExclusiveBlockMessage(o,!0)});this.editor=e,e.doc.registerCallback(this),e.doc.getRemoteUsers().addListener("change",this.handleUserChanged)}destroy(){this.stopExclusiveBlockTimer(),this.editor.doc.unregisterCallback(this),this.editor.doc.getRemoteUsers().addListener("change",this.handleUserChanged)}onCustomMessage(e){if(e.type==="exclusiveBlock"){const t=e;dy(this.editor,t),t.blockIds.forEach(o=>{t.exclusive?this.remoteExclusiveBlockIds.set(o,t):this.remoteExclusiveBlockIds.delete(o)})}}getExclusiveMessage(e){return this.remoteExclusiveBlockIds.get(e)}broadcastExclusiveBlockMessage(e,t){if(this.editor.readonly||e.length===0)return;const o=this.editor.doc.getUser(),r={type:"exclusiveBlock",userId:o.userId,displayName:o.displayName,blockIds:e.map(i=>ie(i)),exclusive:t};this.editor.doc.broadcastMessage(r)}exclusiveBlock(e){this.exclusiveBlockIds.has(ie(e))||(this.broadcastExclusiveBlockMessage([e],!0),this.exclusiveBlockIds.add(ie(e)),this.exclusiveBlockIds.size===1&&this.startExclusiveBlockTimer())}unexclusiveBlock(e){!this.exclusiveBlockIds.has(ie(e))||(this.exclusiveBlockIds.delete(ie(e)),this.broadcastExclusiveBlockMessage([e],!1),this.exclusiveBlockIds.size===0&&this.stopExclusiveBlockTimer())}startExclusiveBlockTimer(){this.exclusiveBlockTimer=window.setInterval(()=>{Array.from(this.exclusiveBlockIds.keys()).forEach(e=>{this.broadcastExclusiveBlockMessage([this.editor.getBlockById(e)],!0)})},30*1e3)}stopExclusiveBlockTimer(){clearInterval(this.exclusiveBlockTimer),this.exclusiveBlockTimer=0}static get(e){return e.addCustom("exclusiveBlock",()=>new es(e))}static register(e){return this.get(e)}}function f2(n,e){es.get(n).exclusiveBlock(e)}function m2(n,e){es.get(n).unexclusiveBlock(e)}class hy{writable(e,t){if(Array.isArray(t)){for(const o of t)if($u(o))return!1;return}if($u(t))return!1}create(e,t,o,r,i){const s=es.get(e).getExclusiveMessage(i.id);s&&h2(e,r,s.userId,s.displayName)}update(e,t,o,r,i){const s=es.get(e).getExclusiveMessage(i.id);s?h2(e,r,s.userId,s.displayName):uy(r)}}const _oe="",cH={exclusive:{tips:"\u300C{editor}\u300D\u6B63\u5728\u7F16\u8F91\uFF0C\u300C{embedType}\u300D\u4E0D\u652F\u6301\u591A\u4EBA\u7F16\u8F91",fallbackAbstract:"\u8BE5 Block"}},aH={exclusive:{tips:"\u300C{editor}\u300Dis editing\uFF0C\u300C{embedType}\u300Ddoes not support multi-person editing",fallbackAbstract:"This Block"}},uH={exclusive:{tips:"\u300C{editor}\u300D\u306F\u7DE8\u96C6\u4E2D\u3067\u3059\u3002\u300C{embedType}\u300D\u306F\u8907\u6570\u4EBA\u3067\u540C\u6642\u7DE8\u96C6\u3067\u304D\u307E\u305B\u3093",fallbackAbstract:"\u3053\u306E\u8981\u7D20"}};L.mergeLang({"zh-CN":cH,"en-US":aH,"ja-JP":uH});function Hu(n,e){return n.getBlockData(e).lock}function Jf(n,e){return!!Hu(n,e)}function ju(n,e){const t=Hu(n,e);return t?t.userId===n.doc.getUser().userId:!1}function g2(n,e){const t=Hu(n,e);return t?t.userId!==n.doc.getUser().userId:!1}function dH(n,e){if(n.readonly||!n.isBlockWritable(e)||Jf(n,e)&&!ju(n,e))return;const t=n.doc.getUser(),o={userId:t.userId,displayName:t.displayName,locked:Date.now()},i={...n.getBlockData(e),lock:o};n.updateBlockData(e,i)}function hH(n,e){if(!ju(n,e))return;const t={lock:null};n.updateBlockData(e,t)}const fH=10,mH=80,gH=50;class p2{constructor(){m(this,"executeCommand",(e,t,o)=>{const r=o.data;if(!r||!r.blockId)return;const i=e.getBlockById(r.blockId);r.type==="lock"?dH(e,i):r.type==="unlock"&&hH(e,i)})}create(e,t,o,r,i){const s=i.lock;s&&(s.userId!==e.doc.getUser().userId?W(r,"locked-by-others"):W(r,"locked-by-self"))}update(e,t,o,r,i){const s=i.lock;if(s)if(s.userId!==e.doc.getUser().userId){W(r,"locked-by-others");const l=e.selection.focusedBlock;(l===r||et(r,l))&&(te(e,r)||Se(r)==="code")&&e.insertTextBlock("",ce(o),be(r)+1)}else W(r,"locked-by-self");else re(r,"locked-by-others"),re(r,"locked-by-self")}writable(e,t){let o=[];Array.isArray(t)?o=t:o.push(t);for(const r of o){if(g2(e,r))return!1;if(lo(r))return;let i=Ts(r);for(;i;){if(g2(e,i))return!1;i=Ts(i)}}}commands(e,t){const o=Jf(e,t),r=ju(e,t),i=$u(t),s={blockId:ie(t),type:"lock"},l={id:"lock-block",name:"",data:s,order:10};if(o)if(r)l.id="unlock-block",l.name=L.t("locker.unlock"),s.type="unlock";else{const a=Hu(e,t);let d=(a==null?void 0:a.displayName)||"";const h=L.getCurrentLang()==="ja-JP",p=K5(d,fH,h?gH:mH);(p==null?void 0:p.length)!==d.length&&(l.ellipsisTooltip=a==null?void 0:a.displayName,d=p||""),l.name=L.t("locker.lockedBy",{name:d}),l.states=["disabled"]}else i?(l.name=L.t("locker.lock"),l.states=["disabled"]):l.name=L.t("locker.lock");return{group:"block-locker",commands:[l],executeCommand:this.executeCommand}}}const Foe="",pH={locker:{lock:"\u9501\u5B9A",unlock:"\u89E3\u9664\u9501\u5B9A",lockedBy:"\u88AB {name} \u9501\u5B9A"}},CH={locker:{lock:"Lock",unlock:"Unlock",lockedBy:"Locked by {name}"}},AH={locker:{lock:"\u30ED\u30C3\u30AF",unlock:"\u30ED\u30C3\u30AF\u89E3\u9664",lockedBy:"{name}\u304C\u30ED\u30C3\u30AF\u3057\u307E\u3057\u305F"}};L.mergeLang({"zh-CN":pH,"en-US":CH,"ja-JP":AH});class Kf{async handleBeforePasteDoc(e,t){return Object.values(t.blocks).forEach(o=>{o.forEach(r=>{delete r.lock})}),!1}}const bH=D("standard-block-actions");class vH{constructor(){m(this,"executeCommand",(e,t,o)=>{const r=o.data;try{const i=e.getBlockById(r);if(o.id==="delete"){e.deleteBlock(i);return}o.id==="copy"&&Xh(e,i),o.id==="cut"&&(Xh(e,i),e.deleteBlock(i))}catch(i){bH.error(`failed to execute block command: ${JSON.stringify(i)}`)}})}commands(e,t){const o=Jf(e,t),r=o&&ju(e,t),i=ie(t),s=e2(),l=$u(t),a={id:"copy",name:L.t("blockMenu.command.copy"),data:i,order:1,states:s?[]:["disabled"],disableReason:s?void 0:L.t("copyCutProperty.unsafeEnvTips",{shortCut:io("CtrlOrCmd+C"),operation:L.t("copyCutProperty.copy")})},d={id:"cut",name:L.t("blockMenu.command.cut"),data:i,order:2,states:o&&!r||!s||l?["disabled"]:[],disableReason:s?void 0:L.t("copyCutProperty.unsafeEnvTips",{shortCut:io("CtrlOrCmd+X"),operation:L.t("copyCutProperty.cut")})},h={id:"delete",name:L.t("blockMenu.command.delete"),data:i,order:3,states:o&&!r||l?["disabled"]:[]};return{group:"standard-block-actions",commands:[a,d,h],executeCommand:this.executeCommand}}}const fy=D("block-menu");class yH{constructor(e){m(this,"menu");m(this,"currentBlock",null);m(this,"commandBlock",null);m(this,"handleShow",()=>{g(fy,this.currentBlock,"no target block before show block menu");const e=rH(this.editor,this.currentBlock,{onAfterStyleItemClick:this.close});this.menu.updateItems(e),this.commandBlock=this.currentBlock});m(this,"handleClose",()=>{Qp(this.editor)&&this.editor.focus()});m(this,"handleItemClick",(e,t)=>{g(fy,this.commandBlock,"no command block before show block menu"),iH(this.editor,this.commandBlock,t),t.element||this.close()});m(this,"close",()=>{this.menu.close("clickItem")});this.editor=e,this.menu=new Vs([],void 0,{id:"block-menu"}),this.menu.on("show",this.handleShow),this.menu.on("close",this.handleClose),this.menu.on("click",this.handleItemClick),e.blockHooks.push(new vH)}show(e,t){this.menu.manualShow(e,{placement:"bottom-start",...t})}isInMenu(e){return this.menu.isInCommandBar(e)}setBlock(e){this.currentBlock=e}get isVisible(){return this.menu.isVisible}destroy(){this.menu.destroy()}}const kH=1e3;async function wH(n,e){const{width:t}=n.rootContainer.getBoundingClientRect(),o=e.getBoundingClientRect();return o.width>t||o.height>=kH?"":(await l5.default.toSvg(e)).replace(/margin-block:.*?;/,"").replace(/margin:.*?;/,"")}const BH=D("drag-preview-image");class EH{constructor(e){m(this,"startPosition",null);m(this,"dragContainer",null);m(this,"handleDragStart",async(e,t)=>{const o=e.target;g(BH,o instanceof Element,`Invalid Drag target:${o}`);const{x:r,y:i}=e;this.startPosition={x:r,y:i};const s=k("div",["drag-image-container"],this.editor.rootContainer),l=k("img",["drag-image"],s),a=k("span",["drag-loading"],s);a.innerHTML=OM;const{x:d,width:h,height:p,y:C}=o.getBoundingClientRect(),v=this.editor.rootContainer.getBoundingClientRect(),B=t.getBoundingClientRect();s.style.left=`${d+h}px`,s.style.top=`${C+p}px`,s.style.width=`${Math.min(v.width/2,B.width)}px`,this.dragContainer=s;const x=await wH(this.editor,t);x?l.src=x:W(s,"drag-placeholder"),_m(s,{status:"loaded"})});m(this,"handleDrag",e=>{if(this.startPosition&&this.dragContainer){const{x:t,y:o}=e;if(t===0&&o===0){this.dragContainer.style.transition="transform 0.15s, opacity .15s",this.dragContainer.style.transform="",this.dragContainer.style.opacity="0";return}const{x:r,y:i}=this.startPosition,s=t-r,l=o-i;this.dragContainer.style.transform=`translate(${s}px, ${l}px)`}});m(this,"handleDragEnd",()=>{this.dragContainer&&(this.dragContainer.remove(),this.startPosition=null,this.dragContainer=null)});this.editor=e}}const my="drag-preview-element";function xH(n){if(xe(n,my))return n;const e=n.querySelector(`.${my}`);return e||(It(n)?Le(n):n)}const Xf=D("block-menu-drag-handler");function C2(n,e){return new DragEvent(e,{bubbles:!0,cancelable:!0,view:window,screenX:n.screenX,screenY:n.screenY,dataTransfer:new DataTransfer,clientX:n.clientX,clientY:n.clientY})}class IH{constructor(e,t){m(this,"dragPreview");m(this,"autoScroll");m(this,"oldPos",{x:0,y:0});m(this,"handleMouseDown",e=>{const t=this.button.blockMenu.currentBlock;if(g(Xf,t,"no dragged block"),e.button!==0)return;if(!this.editor.isBlockWritable(t)){e.preventDefault(),e.stopPropagation();return}const{x:o,y:r}=e;this.oldPos={x:o,y:r},document.addEventListener("mouseup",this.handleDragEnd),this.editor.contentElement.addEventListener("mousemove",this.handleDrag)});m(this,"handleDragStart",e=>{var s,l;const t=so(this.button.buttonElement);this.autoScroll||(this.autoScroll=new hh({scrollElement:t,trackMouseEvent:"mousemove",edge:{top:50,bottom:50}}));const o=this.button.blockMenu.currentBlock;g(Xf,o,"no dragged block"),(l=(s=Ye(this.editor,o)).notify)==null||l.call(s,this.editor,"beginDrag");const r=C2(e,"dragstart");MH(this.editor,r,o),window.isDragging=!0,this.button.buttonElement.style.opacity="0";const i=xH(o);this.dragPreview.handleDragStart(e,i),this.autoScroll.active(),W(o,"dragging"),W(this.editor.contentElement,"dragging")});m(this,"handleDrag",e=>{const{target:t,x:o,y:r}=e;if(this.oldPos.x===o&&this.oldPos.y===r)return;window.isDragging||this.handleDragStart(e),this.oldPos={x:o,y:r},g(Xf,t instanceof Element,"target is invalid"),this.dragPreview.handleDrag(e);const i=C2(e,"dragover");this.editor.contentElement.dispatchEvent(i)});m(this,"handleDragEnd",e=>{var r;const t=this.button.blockMenu.currentBlock;g(Xf,t,"no dragged block"),window.isDragging=!1,this.button.buttonElement.style.opacity="1",this.dragPreview.handleDragEnd(),(r=this.autoScroll)==null||r.inactive(),re(t,"dragging"),re(this.editor.contentElement,"dragging"),document.removeEventListener("mouseup",this.handleDragEnd),this.editor.contentElement.removeEventListener("mousemove",this.handleDrag);const o=C2(e,"drop");this.editor.contentElement.dispatchEvent(o)});this.editor=e,this.button=t,this.button.buttonElement.addEventListener("mousedown",this.handleMouseDown),this.dragPreview=new EH(e)}destroy(){this.button.buttonElement.removeEventListener("mousedown",this.handleMouseDown)}}class Uu{constructor(e){m(this,"highlightedBlockId","");m(this,"handleSelectionChange",()=>{this.clearHighlightedBlock()});this.editor=e,this.editor.addListener("selectionChanged",this.handleSelectionChange)}highlightBlock(e){this.clearHighlightedBlock(),this.highlightedBlockId=ie(e),W(e,"highlighted")}clearHighlightedBlock(){if(this.highlightedBlockId){const e=this.editor.findBlockById(this.highlightedBlockId);e&&re(e,"highlighted"),this.highlightedBlockId=""}}destroy(){}static register(e){return e.addCustom("editor-block-highlighter",()=>new Uu(e))}static get(e){return e.getCustom("editor-block-highlighter")}}class gy{constructor(e){m(this,"buttonElement");m(this,"emptyBlockMenu");m(this,"blockMenu");m(this,"dragHandler");m(this,"handleHoverBlock",(e,t,o)=>{if(this.emptyBlockMenu.isVisible||this.blockMenu.isVisible||!this.editor.isWritable())return;const r=this.editor.getCustom("editor-tooltip");if(r&&r.visible()&&(r.hide(),this.buttonElement.setAttribute("data-tooltip-hide-at",`${Date.now()}`)),!e){this.buttonElement.parentElement&&(this.blockMenu.isInMenu(o.target)||this.buttonElement.remove());return}const i=rg(e);this.editor.getBlockIndex(i)===0&&this.editor.getBlockData(i).heading===1||(this.updateButton(i),u2(i,this.buttonElement,Number.MAX_SAFE_INTEGER))});m(this,"handleButtonClick",()=>{if(this.buttonElement.getAttribute("data-type")==="move"){const o=this.blockMenu.currentBlock;if(!o)return;this.editor.selection.selectBlock(o,0),this.blockMenu.show(this.buttonElement,{placement:"bottom-end"}),setTimeout(()=>{Uu.get(this.editor).highlightBlock(o)});return}const t=this.emptyBlockMenu.currentBlock;!t||(this.editor.selection.selectBlock(t,0),setTimeout(()=>{this.editor.focus(),this.updatePlaceholder(t),this.emptyBlockMenu.show()}))});m(this,"updatePlaceholder",e=>{Le(e).setAttribute("data-content-placeholder",L.t("blockMenu.button.searchPlaceholder"))});m(this,"handleChanged",()=>{const e=this.emptyBlockMenu.currentBlock;if(!e)return;const t=ut(this.editor,e)?"insert":"move";this.buttonElement.getAttribute("data-type")!==t&&this.setButtonType(t)});this.editor=e,this.buttonElement=this.createButton(),this.emptyBlockMenu=new X$(e),this.blockMenu=new yH(e),this.editor.addListener("docChanged",this.handleChanged),this.buttonElement.addEventListener("click",this.handleButtonClick),this.dragHandler=new IH(this.editor,this);const t=Ct.get(e);t.addListener("change",this.handleHoverBlock),t.addFinder(new K$),Uu.register(this.editor)}destroy(){Ct.get(this.editor).removeListener("change",this.handleHoverBlock),this.buttonElement.removeEventListener("click",this.handleButtonClick),this.editor.removeListener("docChanged",this.handleChanged),this.emptyBlockMenu.destroy(),this.blockMenu.destroy(),this.buttonElement.remove(),this.dragHandler.destroy()}createButton(){const e=k("button",["block-button"],null);return e.setAttribute(`data-editor-tooltip-${this.editor.clientId}`,L.t("blockMenu.button.tips")),e.innerHTML=Tv,e}setButtonType(e){this.buttonElement.setAttribute("data-type",e);const t=`data-editor-tooltip-${this.editor.clientId}-dynamic`;this.buttonElement.hasAttribute(t)&&this.buttonElement.removeAttribute(t),e==="insert"?(this.buttonElement.innerHTML=RM,this.buttonElement.setAttribute(t,L.t("blockMenu.button.insertTips"))):(this.buttonElement.innerHTML=Tv,this.buttonElement.setAttribute(t,L.t("blockMenu.button.tips")))}updateButton(e){this.emptyBlockMenu.setBlock(e),this.blockMenu.setBlock(e),ut(this.editor,e)?this.setButtonType("insert"):this.setButtonType("move")}}const TH={blockMenu:{section:{basics:"\u57FA\u7840",system:"\u7CFB\u7EDF",styles:"\u6837\u5F0F",common:"\u901A\u7528",actions:"\u64CD\u4F5C",thirdParty:"\u7B2C\u4E09\u65B9\u5185\u5BB9"},command:{insertAbove:"\u5728\u4E0A\u65B9\u63D2\u5165",insertAfter:"\u5728\u4E0B\u65B9\u63D2\u5165",copy:"\u590D\u5236",cut:"\u526A\u5207",delete:"\u5220\u9664"},button:{searchPlaceholder:"\u8F93\u5165\u5173\u952E\u8BCD\u641C\u7D22",tips:`\u957F\u6309\u62D6\u62FD
433
433
  \u70B9\u51FB\u6253\u5F00\u83DC\u5355`,insertTips:"\u70B9\u51FB\u6DFB\u52A0\u533A\u5757"}}},SH={blockMenu:{section:{basics:"Basic",system:"System",styles:"Styles",common:"Common",actions:"Actions",thirdParty:"Third-party content"},command:{insertAbove:"Insert above",insertAfter:"Insert below",copy:"Copy",cut:"Cut",delete:"Delete"},button:{searchPlaceholder:"Search",tips:`Hold to drag
434
434
  Click to open the menu`,insertTips:"Click to add block"}}},DH={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:"\u3092\u30C9\u30E9\u30C3\u30B0\u3057\u3066\u30AF\u30EA\u30C3\u30AF\u3067\u30E1\u30CB\u30E5\u30FC\u3092\u8868\u793A",insertTips:"\u30AF\u30EA\u30C3\u30AF\u3057\u3066\u30D6\u30ED\u30C3\u30AF\u3092\u8FFD\u52A0"}}};L.mergeLang({"zh-CN":TH,"en-US":SH,"ja-JP":DH});const Poe="";class LH{constructor(){m(this,"dragObject",null)}setData(e){this.dragObject=e}getData(){return this.dragObject}clearData(){this.dragObject=null}destroy(){}}function e1(n){return n.addCustom("drag-data",()=>new LH)}function A2(n,e){if(!e)return null;const t=e1(n).getData();return!t||t.editorId!==n.id?null:t}function py(n,e){const t=A2(n,e);return t?n.findBlockById(t.blockId):null}function MH(n,e,t){if(!e.dataTransfer)return;const r=oe(t),i=ce(r),s=ie(t),l={type:"block",editorId:n.id,containerId:i,blockId:s};e1(n).setData(l)}function RH(n,e,t,o,r){if(!e.dataTransfer)return;const s=oe(t),l=ce(s),a=ie(t),d={type:"custom",customType:o,editorId:n.id,containerId:l,blockId:a,data:r};e1(n).setData(d)}function OH(n){e1(n).clearData()}const _H=D("drop-indicator"),t1=2;class FH{constructor(e){m(this,"indicator");m(this,"target",null);this.editor=e,this.indicator=k("div",["editor-drop-indicator"],this.editor.contentElement)}show(e,t){const o=this.getIndicatorRect(e,t),r=this.editor.rootElement.getBoundingClientRect(),i=o.top-r.top,s=o.left-r.left;this.indicator.style.top=`${i}px`,this.indicator.style.left=`${s}px`,this.indicator.style.width=`${o.width}px`,this.indicator.style.height=`${o.height}px`,this.indicator.style.display="",this.target={block:e,insertPos:t}}hide(){this.indicator.style.display="none",this.target=null}getIndicatorRect(e,t){if(typeof t!="string")return t.rect;if(t==="before"){const s=Ds(e);if(!s){g(_H,Ro(oe(e)),"block does not in a child container");const d=e.getBoundingClientRect();return new DOMRect(d.x,d.y,d.width,t1)}const l=s.getBoundingClientRect(),a=e.getBoundingClientRect();return new DOMRect(l.x,(l.bottom+a.top)/2,l.width,t1)}const o=Ls(e);if(!o){const s=e.getBoundingClientRect();return new DOMRect(s.x,s.bottom,s.width,t1)}const r=e.getBoundingClientRect(),i=o.getBoundingClientRect();return new DOMRect(r.x,(r.bottom+i.top)/2,r.width,t1)}}const PH=D("find-drop-target");function NH(n,e){const t=document.elementFromPoint(n,e);if(!t)return null;if(zr(t)&&Ro(t))return t;const o=t.firstElementChild;return o&&zr(o)&&Ro(o)?o:null}function $H(n,e){const s=e,l=n;for(let a=0;a<2;a++){const d=l+a*50;for(let h=0;h<5;h++){const p=s+h*8,C=document.elementFromPoint(d,p);if(C){const S=ne(C);if(S)return S}if(h===0)continue;const v=s-h*8,B=document.elementFromPoint(d,v);if(B){const S=ne(B);if(S)return S}}}return null}function HH(n,e,t){const o=document.elementFromPoint(e,t);if(o){const h=ne(o);if(h&&!Me(n,h))return h}const r=new Set,i=NH(e,t);if(i){const h=i.getBoundingClientRect();t<h.top+h.height/2?r.add(yt(i)):r.add(Qt(i))}const s=$H(e,t);s&&r.add(s);const l=Array.from(r),a=h=>{for(let p=0;p<l.length;p++){const C=l[p];if(h!==C&&et(h,C))return!0}return!1},d=l.filter(h=>!a(h));return d.length>0?d[0]:null}function b2(n,e){if(n.readonly)return!1;const t=oe(e);if(Ge(t))return!0;const o=ne(t);return g(PH,o,"no parent block"),n.isBlockWritable(o)?b2(n,o):!1}const jH=D("drop-target");function UH(n,e){let t={};return/image/.test(e.type)?t=n.editorEmbeds.getEmbedClass("image"):/audio/.test(e.type)?t=n.editorEmbeds.getEmbedClass("audio"):/video/.test(e.type)&&(t=n.editorEmbeds.getEmbedClass("video")),g(jH,t,`unSupport file type ${e.type}`),t}async function Cy(n,e,t,o){var i,s;let r=o;for(const l of e){const a=UH(n,l);a.getOptions&&await((s=(i=a.getOptions(n)).handleInsertEmptyEmbed)==null?void 0:s.call(i,n,{containerId:t,blockIndex:r,data:{file:l}}))&&(r+=1)}}class zH{constructor(e){m(this,"handleDrop",(e,t,o,r)=>{if(Array.isArray(t)){const i=t;if(i.length>0){const s=ce(o);return Cy(e,i,s,r),!0}}return!1});this.editor=e}}class zu{constructor(e){m(this,"indicator");m(this,"lastDropOverResult");m(this,"handlers",[]);m(this,"handleDragOver",e=>{if(!this.editor.isWritable())return;const t=i=>{var d,h;const s=A2(this.editor,i.dataTransfer),l=py(this.editor,i.dataTransfer),a=this.findTargetBlock(l,i.x,i.y);if(a&&et(this.editor.rootContainer,a)){const p=this.findInsertPos(l,a,i.x,i.y,(h=s!=null?s:(d=i.dataTransfer)==null?void 0:d.items)!=null?h:null);if(p)return this.indicator.show(a,p),"move"}return this.indicator.hide(),"none"},o=(i,s)=>{i.dataTransfer&&(i.dataTransfer.dropEffect=s),s==="move"&&i.preventDefault()};if(this.lastDropOverResult&&e.x===this.lastDropOverResult.x&&e.y===this.lastDropOverResult.y){const i=this.lastDropOverResult.dropEffect;o(e,i);return}const r=t(e);o(e,r),this.lastDropOverResult={x:e.x,y:e.y,dropEffect:r}});m(this,"handleDrop",e=>{var i,s;e.stopPropagation(),setTimeout(()=>{this.indicator.hide()});const t=A2(this.editor,e.dataTransfer),o=Array.from((s=(i=e.dataTransfer)==null?void 0:i.files)!=null?s:[]);if(!t&&o.length===0){e.dataTransfer&&(e.dataTransfer.dropEffect="none");return}const r=this.indicator.target;if(r){const{block:l,insertPos:a}=r,d=py(this.editor,e.dataTransfer);this.editor.undoManager.runInGroup(()=>{const h=Ye(this.editor,l);if(h.handleDrop&&h.handleDrop(this.editor,l,t!=null?t:o,a,{isSourceBlock:!1,targetBlock:l})){e.preventDefault(),this.editor.focus();return}if(d){const p=Ye(this.editor,d);if(p.handleDrop&&p.handleDrop(this.editor,d,t!=null?t:o,a,{isSourceBlock:!0,targetBlock:l})){e.preventDefault(),this.editor.focus();return}}if(typeof a=="string"){const p=oe(l);let C=be(l);a==="after"&&(C+=1),e.preventDefault();for(let v=0;v<this.handlers.length;v++)if(this.handlers[v].handleDrop(this.editor,d!=null?d:o,p,C)){this.editor.focus();return}if(d){const v=this.editor.getBlockData(d),B=Hi(this.editor.editorBlocks,this.editor.doc.toJSON(),v),[S]=this.editor.insertDocAt(p,C,B);this.editor.selection.selectBlock(S,0),Uu.get(this.editor).highlightBlock(S),this.editor.deleteBlock(d),this.editor.focus()}}}),OH(this.editor)}});m(this,"handleDragLeave",()=>{this.indicator.hide()});this.editor=e,this.indicator=new FH(this.editor),this.handlers.push(new zH(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(e){this.handlers.push(e)}static register(e){return e.addCustom("drop-target",()=>new zu(e))}static get(e){return e.getCustom("drop-target")}static find(e){return e.findCustom("drop-target")}canInsertAfter(e,t){return!(this.editor.readonly||Ls(t)===e&&e||!b2(this.editor,t))}canInsertBefore(e,t){return!(this.editor.readonly||Ds(t)===e&&e||!b2(this.editor,t)||Ge(oe(t))&&be(t)===0)}canDrop(e,t){return e===null||e===t?!0:!et(e,t)}findTargetBlock(e,t,o){let r=HH(this.editor,t,o);if(!r||!et(this.editor.rootContainer,r))return null;const i=oe(r),s=ne(i);return s&&Se(s)==="code"&&(r=s),this.canDrop(e,r)?r:null}findInsertPos(e,t,o,r,i){let s=t;for(;s;){const a=Ye(this.editor,s);if(a.handleDropOver){const d=a.handleDropOver(this.editor,s,i,o,r);if(d)return d;if(d===!1)return null}s=Ts(s)}if(e===t)return"";const l=t.getBoundingClientRect();if(l.top<=r&&r<=l.bottom){if(r<l.top+l.height/2){if(this.canInsertBefore(e,t))return"before";if(this.canInsertAfter(e,t))return"after"}else{if(this.canInsertAfter(e,t))return"after";if(this.canInsertBefore(e,t))return"before"}return""}return r<l.top&&this.canInsertBefore(e,t)?"before":l.bottom<r&&this.canInsertAfter(e,t)?"after":""}}function Ay(n,e,t){const o=Tt.getImageObject(n,e),r=me.default(o.getImages());if(r.length===1){n.deleteBlock(e);return}if(t===-1||t>=r.length)return;const i=T$(r);if(r.splice(t,1),r.length===1){const l=r[0],a=100*(l.flex/i);l.flex=1;const d=cn([l],a);n.updateEmbedData(e,d);return}r[0].flex=NaN,Ou(r);const s=cn(r,o.getWidthPercent());n.updateEmbedData(e,s)}function VH(n,e,t,o){if(e.length===0||o==="after"||o==="before")return!1;let r=o.data;const i=Tt.getImageObject(n,t),s=me.default(i.getImages()),l=[],a=[];e.forEach(p=>{ry(p.type)&&s.length+l.length<6?l.push(p):a.push(p)}),l.forEach(p=>{try{oy(n,p)}catch{return}const C={src:"",flex:1,width:0,height:0,virtualSize:!0};s.splice(r,0,C);const v=cn(s,i.getWidthPercent());n.updateEmbedData(t,v),i.replaceImage(r,p),r+=1});const d=n.getBlockIndex(t)+1,h=ce(oe(t));return Cy(n,a,h,d),!0}function WH(n,e,t,o,r){var s,l,a;if(uh(t))return VH(n,t,e,o);if(t.type!=="custom"||t.customType!=="image"||!t.data)return;const i=t.data;if(r.isSourceBlock){const d=r.targetBlock,h=oe(d);let p=be(d);o==="after"&&(p+=1);const v=100*(i.boundingRect.width/n.rootContainer.getBoundingClientRect().width),B=cn([i.image],v),S={id:K(),type:"embed",embedType:"image",embedData:B},x=(l=(s=n.options.componentsOptions)==null?void 0:s.image)==null?void 0:l.defaultAlign;x&&(S.align=x),n.insertBlock(ce(h),p,S),Ay(n,e,i.index),(a=n.findCustom("drag-handler"))==null||a.handleDragEnd()}else{if(typeof o=="string")return;const d=e;let h=o.data;const p=Tt.getImageObject(n,d),C=me.default(p.getImages());h>C.length&&(h=C.length),n.undoManager.runInGroup(()=>{var B,S;p.setAutoFix(!0);const v=n.getBlockById(t.blockId);if(v===d){const x=i.index,_=h,R=i.image;if(x===_||_===x+1)return;let H=_;x<_?(C.splice(_,0,R),C.splice(x,1),H-=1):(C.splice(x,1),C.splice(_,0,R));const z=cn(C,p.getWidthPercent());n.updateEmbedData(d,z),p.setSelectedIndex(H),(B=n.findCustom("drag-handler"))==null||B.handleDragEnd()}else{C.splice(h,0,i.image),C[0].flex=NaN,Ou(C);const x=cn(C,p.getWidthPercent());n.updateEmbedData(d,x),Ay(n,v,i.index),(S=n.findCustom("drag-handler"))==null||S.handleDragEnd(),p.setSelectedIndex(h),n.selection.selectBlock(d,0)}})}return!0}const qH=2;function n1(n,e,t){const o=wr(e);if(t<=0){const s=o[0].getBoundingClientRect();return new DOMRect(s.left-4,s.top,2,s.height)}if(t===o.length){const s=o[t-1].getBoundingClientRect();return new DOMRect(s.right+2,s.top,2,s.height)}const r=o[t-1].getBoundingClientRect(),i=o[t].getBoundingClientRect();return new DOMRect((i.left+r.right)/2-1,r.top,qH,r.height)}function GH(n,e,t,o,r){for(let i=0;i<t.length;i++){const l=t[i].getBoundingClientRect();if(o<=l.right)return o<=l.left+l.width/2?{rect:n1(n,e,i),data:i}:{rect:n1(n,e,i+1),data:i+1}}return o>t[t.length-1].getBoundingClientRect().right?{rect:n1(n,e,t.length),data:t.length}:{rect:n1(n,e,t.length),data:0}}function ZH(n,e,t,o,r){const i=wr(e);if(t instanceof DataTransferItemList){if(!Array.from(t).some(s=>ry(s.type))||i.length>=6)return}else{if((t==null?void 0:t.type)==="block"||i.length>=6&&(t==null?void 0:t.blockId)!==ie(e))return;const s=ie(e);if(i.length===1&&s===(t==null?void 0:t.blockId))return}return GH(n,e,i,o)}async function QH(n){return await l5.default.toSvg(n)}function v2(n,e){return new DragEvent(e,{bubbles:!0,cancelable:!0,view:window,screenX:n.screenX,screenY:n.screenY,dataTransfer:new DataTransfer,clientX:n.clientX,clientY:n.clientY})}class YH{constructor(e){m(this,"img");m(this,"dragContainer",null);m(this,"autoScroll",null);m(this,"imageContainer",null);m(this,"startPosition",null);m(this,"handleMouseDown",e=>{const t=e.target;if(!t||!(t instanceof HTMLImageElement)||e.button!==0)return;const o=ne(t);if(!o||!qo(o)||!this.editor.isBlockWritable(o)||this.editor.readonly)return;const r=Tt.getImageObject(this.editor,o);if(this.imageContainer=c2(e.target),!this.imageContainer)return;const s=J9(e.target).indexOf(this.imageContainer);if(s===-1)return;const l=r.getImages()[s];if(!l)return;const{x:a,y:d}=e;this.startPosition={x:a,y:d};const h={image:l,index:s,boundingRect:this.imageContainer.getBoundingClientRect()},p=v2(e,"dragstart");RH(this.editor,p,o,"image",h),document.addEventListener("mouseup",this.handleDragEnd),this.editor.contentElement.addEventListener("mousemove",this.handleDrag),e.preventDefault()});m(this,"handleDragStart",async e=>{if(!this.imageContainer)return;const t=ne(this.imageContainer);if(!t)return;const{x:o,y:r}=e,{width:i,height:s}=e.target.getBoundingClientRect(),l=tt(t),a=k("div",["drag-container"],l);a.style.left=`${o-i/4}px`,a.style.top=`${r-s/4}px`,a.style.width=`${Math.max(i/2,16)}px`,a.style.height=`${s/2}px`,this.dragContainer=a,W(this.editor.contentElement,"dragging");const d=so(t);this.autoScroll=new hh({scrollElement:d,trackMouseEvent:"mousemove",edge:{top:50,bottom:50}}),this.autoScroll.active();const h=k("img",["drag-target"],a),C=await QH(this.imageContainer);C&&(h.src=C)});m(this,"handleDrag",e=>{var i;const{x:t,y:o}=e;if(((i=this.startPosition)==null?void 0:i.x)===t&&this.startPosition.y===o)return;if(window.isDragging||(window.isDragging=!0,this.handleDragStart(e)),this.startPosition&&this.dragContainer){const{x:s,y:l}=e;if(s===0&&l===0){this.dragContainer.style.transform="",this.dragContainer.style.opacity="0";return}const{x:a,y:d}=this.startPosition,h=s-a,p=l-d;this.dragContainer.style.transform=`translate(${h}px, ${p}px)`,this.dragContainer.style.opacity="0.5"}const r=v2(e,"dragover");this.editor.contentElement.dispatchEvent(r)});m(this,"handleDragEnd",e=>{var t;if(window.isDragging=!1,this.dragContainer&&this.dragContainer.remove(),this.dragContainer=null,this.startPosition=null,this.imageContainer=null,(t=this.autoScroll)==null||t.inactive(),re(this.editor.contentElement,"dragging"),document.removeEventListener("mouseup",this.handleDragEnd),this.editor.contentElement.removeEventListener("mousemove",this.handleDrag),e){const o=v2(e,"drop");this.editor.contentElement.dispatchEvent(o)}});this.editor=e,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 JH{constructor(e){m(this,"handleFocusBlockChanged",(e,t,o)=>{const i=this.editor.getFocusedBlock();if(i&&qo(i)){const s=Tt.getImageObject(this.editor,i);s.getImages().length>0&&s.getSelectedIndex()===-1&&s.setSelectedIndex(0)}o&&qo(o)&&e.findCustom(`image-${o.id}`)&&Tt.getImageObject(this.editor,o).blockResizer.disableResize()});this.editor=e,this.editor.addListener("focusBlockChanged",this.handleFocusBlockChanged)}destroy(){this.editor.removeListener("focusBlockChanged",this.handleFocusBlockChanged)}}class KH{constructor(e){m(this,"currentResizer",null);m(this,"handleHoveringBlockChange",(e,t)=>{window.isDragging||(t&&this.disable(t),e&&(this.currentResizer=e,this.enable(e)))});this.editor=e,Ct.get(e).addListener("change",this.handleHoveringBlockChange)}destroy(){Ct.get(this.editor).removeListener("change",this.handleHoveringBlockChange)}disable(e){qo(e)&&Tt.getImageObject(this.editor,e).disableResizer()}enable(e){if(qo(e)){const t=Tt.getImageObject(this.editor,e);this.editor.isBlockWritable(e)&&t.tryEnableResizer()}}}const XH={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"}},ej={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"}},tj={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"}};L.mergeLang({"zh-CN":XH,"en-US":ej,"ja-JP":tj});function nj(n,e,t,o){const r=n.getBlockByIndex(e,t),i=n.getBlockText(r),{left:s}=Tn(i,o),l=st(s);let a=o;if(l.endsWith("![]()"))a-=5;else if(l.endsWith("![]"))a-=3;else return!1;const d=o;return ql("image/*").then(h=>{n.undoManager.runInGroup(()=>{n.deleteTextFromBlock(r,a,d-a);let p=t+1;st(n.getBlockText(r)).trim()?(tc(n,r,a,{forceInsertAfter:!0}),a===0&&(n.deleteBlock(r),p--)):(n.deleteBlock(r),p--),sg(n,"image",e,p,{file:h})})}),!0}class oj{handleAfterInsertText(e,t,o,r,i){if(i===" "){if(qf(e,t))return!1;if(nj(e,t,o,r))return!0}return!1}}function rj(n){const e=n.getFocusedBlock(),t=Ls(e);if(t&&qo(t)){n.selection.selectBlock(t,0);const o=Tt.getImageObject(n,t);return o.getImages().length>0&&o.setSelectedIndex(0),!0}}function ij(n){const e=n.getFocusedBlock(),t=Ds(e);if(t&&qo(t)){n.selection.selectBlock(t,0);const o=Tt.getImageObject(n,t);return o.getImages().length>0&&o.setSelectedIndex(0),!0}}function sj(n){const t=n.getFocusedBlock();if(t&&qo(t)){const o=Tt.getImageObject(n,t),r=o.getImages();if(r.length>0){const i=o.getSelectedIndex();if(i===-1)return o.setSelectedIndex(r.length-1),!0;if(i>0)return o.setSelectedIndex(i-1),!0}}}function lj(n){const t=n.getFocusedBlock();if(t&&qo(t)){const o=Tt.getImageObject(n,t),r=o.getImages();if(r.length>0){const i=o.getSelectedIndex();if(i===-1)return o.setSelectedIndex(0),!0;if(i<r.length-1)return o.setSelectedIndex(i+1),!0}}}function y2(n){const t=n.getFocusedBlock();if(t&&qo(t)){const o=Tt.getImageObject(n,t);if(o.getImages().length>0){const i=o.getSelectedIndex();if(i!==-1)return o.removeImage(i),!0}}}const cj={ArrowLeft:sj,ArrowRight:lj,ArrowUp:ij,ArrowDown:rj,Delete:y2,Backspace:y2},aj=D("copy-image");function uj(n,e,t,o){const r=t.getImages()[o],i=t.getImages().length===1?t.getWidthPercent():r.flex*100,s=cn([r],i),l={id:K(),type:"embed",embedType:"image",embedData:s},a=n.options.componentsOptions.image;a!=null&&a.defaultAlign&&(l.align=a.defaultAlign);const d={blocks:{root:[l]},comments:{},meta:{}},h=document.createElement("canvas");h.width=e.naturalWidth,h.height=e.naturalHeight;const p=h.getContext("2d");if(!p)return;const C={},v={};try{p.drawImage(e,0,0,h.width,h.height);const z=h.toDataURL("image/png").replace(/^data:image\/(png|jpg);base64,/,""),Q=zm(z),ee=new File([Q],`${Date.now()}.png`,{type:"image/png"});C["image/png"]=ee}catch(H){aj.error(H)}Kh(n,d);const S=`<img src="${n.doc.buildResourceUrl(r.src,{withToken:!0})}" />`,x=Jh(S,d),_=Ua(n,d);C["text/plain"]=new Blob([_],{type:"text/plain"}),v["text/plain"]=_;const R=new Blob([x],{type:"text/html"});return C["text/html"]=R,v["text/html"]=x,[C,v]}function dj(n,e,t,o,r){const i=uj(n,e,t,o);if(!i)return;const[s,l]=i;if(s){const a=Object.entries(s).map(([d,h])=>({type:d,data:h}));return qm(a).then(d=>{if(!d&&r){const h=r.clipboardData;h&&(h.setData("text/plain",l["text/plain"]),h.setData("text/html",l["text/html"]))}}),!0}}function by(n,e){const t=n.selection.range;if(t.start.blockId!==t.end.blockId)return;const r=n.getFocusedBlock();if(r&&qo(r)){const i=Tt.getImageObject(n,r);if(i.getImages().length>0){const l=i.getSelectedIndex();if(l!==-1){const d=wr(r)[l].querySelector("img");if(d)return dj(n,d,i,l,e)}}}}class hj{constructor(e){this.editor=e,setTimeout(()=>{this.editor.input.addHandler(this)})}handleBeforeCopy(e,t,o){if(by(e,t))return!0}handleBeforeCut(e,t){if(by(e,t))return y2(e),!0}destroy(){}}class k2{constructor(e){this.editor=e,setTimeout(()=>{this.editor.input.addHandler(this)})}async handleAfterPasteDoc(e,t,o){return Object.values(t.blocks).forEach(r=>{r.forEach(i=>{if(i.type==="embed"&&i.embedType==="image"){const s=i.embedData;if(Array.isArray(s.src))return;if(s.src.startsWith("https:")||s.src.startsWith("http:")){const l=o.blockIdMap.get(i.id);l&&Xi(e,l).setAutoFix(!0)}}})}),!1}destroy(){}}const fj=D("image-embed");function mj(n,e,t,o,r,i){Tt.create(n,t).createContent(r,i,e),n.addCustom("image-select-handler",()=>new JH(n)),n.addCustom("image-copy-handler",()=>new hj(n)),setTimeout(()=>{n.addCustom("drag-handler",()=>new YH(n));const l=n.addCustom("image-resizer",()=>new KH(n)),a=t.embedData;Tc(a)?l.disable(i):l.currentResizer===i&&l.enable(i)})}function gj(n,e,t,o){const r=e.embedData,i=Sc(r);return o==="html"?i.map(s=>`<img src="${n.doc.buildResourceUrl(s.src,{withToken:!0})}">`).join(""):o==="markdown"?`${i.map(l=>`![img](${n.doc.buildResourceUrl(l.src,{withToken:!0})})`).join(`
435
435
  `)}
@@ -768,4 +768,4 @@ ${i.mermaidText}
768
768
  ${i.flowchartText}
769
769
  \`\`\`\`\`\``}return"[flowchart]"}const aZ={embedType:"flowchart",convertFrom:sZ,handleUpdateBlock:iZ,createEmbedContent:rZ,getBlockProperties:lZ,convertTo:cZ},uZ=D("plantuml-helper");function Tk(n,e){var l;let o=((l=(n.getComponentOptions("plantuml")||{}).cdn)==null?void 0:l.plantuml)||jG;o.endsWith("/")||(o+="/");const r=aE.default.encode(e);g(uZ,r,r),o+=r;const s=new URLSearchParams(document.location.search).get("doc");return Um(o,{id:`${s}-${K()}`})}async function dZ(n,e){try{const t=await tC(n,e);return(await n.doc.uploadResource(t)).resourceId}catch{return Promise.resolve(e)}}class Uc extends sC{constructor(e){super(e,"plantuml","plantumlText")}static get(e,t){return e.addCustom(`plantuml-${t.id}`,()=>new Uc(e))}code2ObjectUrl(e){return Promise.resolve(Tk(this.editor,e))}code2ResourceId(e){const t=Tk(this.editor,e);return dZ(this.editor,t)}destroy(){}}function hZ(n,e,t){Uc.get(n,t).createEmbedContent(e,t)}function fZ(n,e,t){const o=Uc.get(n,t),r=Le(e);return o.updateEmbedContent(r,t),!0}function mZ(n,e,t){const{data:o}=t,r=n.getBlockString(e).trim();if(!o||o.embedType!=="plantuml"||r!=="```plantuml"||!te(n,e))return null;const i={src:"",plantumlText:""};return{blockData:{id:K(),type:"embed",embedType:"plantuml",embedData:i},onConverted:(a,d)=>{Uc.get(a,a.getBlockData(d)).editGraph(Le(d))}}}function gZ(n,e){return Uc.get(n,n.getBlockData(e)).getBlockProperties(e)}function pZ(n,e,t,o){const{embedData:r}=e,i=r;if(o==="html")return i.src?`<img src="${n.doc.buildResourceUrl(i.src,{withToken:!0})}" />`:i.flowchartText?`<div>${i.flowchartText}</div>`:"<p>[plantuml]</p>";if(o==="markdown"){if(i.src)return`![plantuml](${n.doc.buildResourceUrl(i.src,{withToken:!0})})`;if(i.flowchartText)return`\`\`\`plantuml\`\`\`
770
770
  ${i.flowchartText}
771
- \`\`\`\`\`\``}return"[plantuml]"}const CZ={embedType:"plantuml",convertFrom:mZ,handleUpdateBlock:fZ,createEmbedContent:hZ,getBlockProperties:gZ,convertTo:pZ},ure="",AZ="hr",bZ={dividingLine:{type:"\u5206\u5272\u7EBF",abstract:"\u5206\u5272\u7EBF"}},vZ={dividingLine:{type:"Separation line",abstract:"Separation line"}},yZ={dividingLine:{type:"\u533A\u5207\u308A\u7DDA",abstract:"\u533A\u5207\u308A\u7DDA"}};L.mergeLang({"zh-CN":bZ,"en-US":vZ,"ja-JP":yZ});function kZ(n,e){const t=k("div",["editor-embed-container"],e);k("hr",["editor-embed-hr"],t)}function wZ(n,e,t,o){return o==="html"?"<hr />":o==="markdown"?"---":"------------"}function BZ(){return{name:"hr",insertEmbedCommandItems:[{id:"insert-hr",name:L.t("dividingLine.type"),icon:kM,order:500,group:"common",subText:An("insert-hr")}],handleInsertEmptyEmbed:async(n,e)=>{const{containerId:t,blockIndex:o}=e;return n.insertEmbed(t,o,AZ,{})}}}function EZ(n,e,t){const{data:o}=t;if(!o||o.embedType!=="dividing-line"||!te(n,e))return null;const r={};return{blockData:{id:K(),type:"embed",embedType:"hr",embedData:r}}}function xZ(){return{abstract:L.t("dividingLine.abstract")}}const IZ={embedType:"hr",createEmbedContent:kZ,convertTo:wZ,getOptions:BZ,convertFrom:EZ,getBlockProperties:xZ},dre="",hre="",TZ={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>'},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"}}},SZ={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>'},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"}}},DZ={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>'},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"}}};L.mergeLang({"zh-CN":TZ,"en-US":SZ,"ja-JP":DZ});var Go=(n=>(n.AUDIO="audio",n.VIDEO="video",n))(Go||{}),Xu=(n=>(n.Empty="empty",n.Progress="progress",n.Error="error",n))(Xu||{});const Sk=10*1024*1024,LZ=["wav","mp3","aac","ogg","webm","flac"],MZ=["ogg","mp4","webm"],RZ=()=>{};function Dk(n){var h,p,C,v,B,S;const e=(h=n.getComponentOptions("media"))!=null?h:{},{allowedMedias:t,maxSize:o,callbacks:r}=e,i=(p=t==null?void 0:t.audio)!=null?p:LZ,s=(C=t==null?void 0:t.video)!=null?C:MZ,l=(v=o==null?void 0:o.audio)!=null?v:Sk,a=(B=o==null?void 0:o.video)!=null?B:Sk,d=(S=r==null?void 0:r.onError)!=null?S:RZ;return{allowedMedias:{audio:i,video:s},maxSize:{audio:l,video:a},callbacks:{onError:d}}}function OZ(n,e){const t=i=>i.map(s=>`.${s}`).join(","),{allowedMedias:o}=Dk(n),r=o[e];return r?t(r):"*"}function _Z(n,e,t){const{maxSize:o,callbacks:r,allowedMedias:i}=Dk(e),{[t]:s}=o,{[t]:l}=i;if(s&&n.size>s){const d=new Error("media is too large");throw d.code=`MaxMediaSize-${t}`,r!=null&&r.onError&&(r==null||r.onError(e,d)),d}const a=Ia(n.name);if(l&&!l.includes(a)){const d=new Error(`media file is not allowed: ${a}`);throw d.code="NotAllowedFile",r!=null&&r.onError&&(r==null||r.onError(e,d)),d}}function FZ(n){return n===Xu.Empty||n===Xu.Error}const $t=D("media");class PZ extends vt.TypedEmitter{constructor(t){super();m(this,"mediaContainer",null);m(this,"media",null);m(this,"abstract",null);m(this,"handleMediaLoadError",(t,o)=>{if(!o.target||!(o.target instanceof Node)||!(o.target instanceof Element?o.target:o.target.parentElement))return;const i=ne(o.target);if(!i||!i.contains(this.mediaContainer))return;const s=this.renderError();this.updateMediaContent(s),this.emit("mediaError",t,"load_error",ie(i))});m(this,"handleUploadFile",async t=>{g($t,this.abstract,"no abstract"),g($t,this.mediaContainer,"The media element not exist");const{editor:o}=this.options,r=ne(this.mediaContainer);g($t,r,"The block element not exist");const i=o.getBlockData(r);try{const{resourceId:s}=await o.doc.uploadResource(t,{onProgress:p=>{this.renderProgress(p,t)}}),{name:l,type:a,size:d}=t,h={...i,embedData:{...i.embedData,src:s,fileName:l,fileSize:d,fileType:a}};o.updateBlockData(r,h)}catch(s){$t.error(s),this.emit("mediaError",o,"upload_error",i.id),this.renderRetry(t)}re(r,"media-block-uploading")});m(this,"destroy",()=>{this.mediaContainer=null});this.options=t}bindMediaEvent(){const{editor:t}=this.options;this.media&&t.domEvents.addEventListener(this.media,"error",this.handleMediaLoadError)}unbindMediaEvent(){const{editor:t}=this.options;this.media&&t.domEvents.removeEventListener(this.media,"error",this.handleMediaLoadError)}updateMediaContent(t){g($t,this.mediaContainer,"The media element not exist"),this.mediaContainer.innerHTML="",this.mediaContainer.append(t)}renderError(){g($t,this.abstract,"no abstract");const{editor:t,createMediaElement:o}=this.options,{mediaIcon:r,mediaName:i}=this.abstract;g($t,this.mediaContainer,"The media element not exist");const s=ne(this.mediaContainer);g($t,s,"The block element not exist");const l=t.getBlockData(s),a=l.embedData.src,d=k("div",["media-error","embed-selected-content","embed-hover-content"],null),h=k("span",["media-error-icon"],d);h.innerHTML=r;const p=k("div",[],d);p.innerHTML=L.t("media.load.failed",{name:i}),d.appendChild(p);const C=p.querySelector(".retry-upload");return g($t,C,"The element not exist"),t.domEvents.addEventListener(C,"click",(v,B)=>{const S=k("div",["media-element"],null),x=this.getResourceUrl(a),_=o(v,S,l,x);this.unbindMediaEvent(),this.media=_,this.bindMediaEvent(),this.updateMediaContent(S)}),this.setFullScreen(),d}renderRetry(t){g($t,this.abstract,"no abstract");const{editor:o}=this.options,{mediaIcon:r,mediaName:i}=this.abstract,s=k("div",["media-error","embed-selected-content","embed-hover-content"],null),l=k("span",["media-error-icon"],s);l.innerHTML=r;const a=k("div",[],s);a.innerHTML=L.t("media.upload.failed",{name:i}),s.appendChild(a);const d=a.querySelector(".retry-upload");g($t,d,"The element not exist"),o.domEvents.addEventListener(d,"click",()=>{o.readonly||(g($t,this.abstract,"no abstract"),this.handleUploadFile(t))}),this.updateMediaContent(s),this.setFullScreen()}renderProgress(t,o){g($t,this.mediaContainer,"The media element not exist");const r=this.mediaContainer.querySelector(":scope .media-progress"),i=t===-1||t===100?100:t;if(r){const{updateProgressElement:s}=this.options;s(r,i)}else{const{createProgressElement:s}=this.options,l=ne(this.mediaContainer);g($t,l,"The element not exist"),W(l,"media-block-uploading");const a=k("div",["media-progress"],null);s(a,i,o),this.updateMediaContent(a)}this.setFullScreen()}renderMediaElement(t){g($t,this.mediaContainer,"The media element not exist");const o=this.mediaContainer.querySelector(":scope > .media-element"),{createMediaElement:r,updateMediaElement:i,editor:s}=this.options,l=this.getResourceUrl(t.embedData.src);if(o){const a=i(s,o,t,l);this.unbindMediaEvent(),this.media=a,this.bindMediaEvent()}else{const a=k("div",["media-element"],null),d=r(s,a,t,l);this.unbindMediaEvent(),this.media=d,this.bindMediaEvent(),this.updateMediaContent(a)}}renderEmpty(t){g($t,this.abstract,"no abstract"),g($t,this.mediaContainer,"The media element not exist");const o=k("div",["media-empty","embed-selected-content","embed-hover-content"],this.mediaContainer);o.innerHTML=this.abstract.mediaIcon,this.updateMediaContent(o);const{editor:r}=this.options;r.findBlockById(t.id)&&this.emit("mediaError",r,"empty",t.id),this.setFullScreen()}getResourceUrl(t){const{editor:o}=this.options;return o.doc.buildResourceUrl(t)}setFullScreen(){g($t,this.mediaContainer,"The media element not exist"),W(this.mediaContainer,"full-screen")}removeFullScreen(){g($t,this.mediaContainer,"The media element not exist"),re(this.mediaContainer,"full-screen")}updateBlockAlign(t,o){const r=ne(o);g($t,r,"The block element not exist");const{align:i}=t;t.embedType==="video"&&(r.hasAttribute("data-style-align")&&r.removeAttribute("data-style-align"),r.setAttribute("data-style-align",i))}render(t,o){const{src:r}=t.embedData;(!this.mediaContainer||!o.contains(this.mediaContainer))&&(this.mediaContainer=k("div",["media"],o)),this.updateBlockAlign(t,o),FZ(r)?r===Xu.Empty&&this.renderEmpty(t):this.renderMediaElement(t)}setAbstract(t){this.abstract=t}}D("media-embed");const NZ="left";class Lk{constructor(){m(this,"handleInsertEmptyEmbed",async(e,t)=>{var p;const{containerId:o,blockIndex:r}=t;let i;(p=t.data)!=null&&p.file&&(i=t.data.file);const s=OZ(e,this.embedType);if(i=i!=null?i:await ql(s,{}),!i)return null;const{mediaType:l}=this.getAbstract();try{_Z(i,e,l)}catch{return null}const a={id:K(),type:"embed",embedType:this.embedType,embedData:{src:Xu.Empty}};l==="video"&&(a.align=NZ);const d=e.insertBlock(o,r,a);return await this.getMedia(e,a.id).handleUploadFile(i),d})}getMedia(e,t){const o=e.addCustom(`media-${t}`,()=>new PZ({editor:e,createMediaElement:this.createMediaElement,updateMediaElement:this.updateMediaElement,createProgressElement:this.createProgressElement,updateProgressElement:this.updateProgressElement}));return o.setAbstract({...this.getAbstract()}),o}getOptions(){const{menuItem:e,mediaIcon:t,mediaName:o,order:r,group:i}=this.getAbstract();return{name:o,insertEmbedCommandItems:[{id:`insert-${this.embedType}`,name:e,icon:t,order:r,group:i,subText:An(`insert-${this.embedType}`)}],handleInsertEmptyEmbed:this.handleInsertEmptyEmbed}}createEmbedContent(e,t,o){const{id:r}=o;this.getMedia(e,r).render(o,t)}handleUpdateBlock(e,t,o){const{id:r}=o,i=this.getMedia(e,r),s=Le(t);return i.render(o,s),!0}handleDeleteBlock(e,t){const o=t.id,r=this.getMedia(e,o);r.removeAllListeners(),r.destroy()}convertTo(e,t,o,r){const i=t.embedData,s=e.doc.buildResourceUrl(i.src,{withToken:!0});return r==="html"?`<${i.type} src="${s}" />`:r==="markdown"?`![${i.src}](${s})`:s}}function Mk(n,e){const t=k("div",["uploading-progress-mask"],n),o=k("div",["uploading-progress-bar"],t),r=k("div",["uploading-progress-bar-value"],o);r.style.width=`${e}%`}function Rk(n,e){const t=n.querySelector(".uploading-progress-bar-value");t&&(t.style.width=`${e}%`)}const $Z=D("media-audio");class HZ extends Lk{constructor(){super(...arguments);m(this,"embedType",Go.AUDIO);m(this,"updateProgressElement",Rk);m(this,"createMediaElement",(t,o,r,i)=>{const s=k("div",["audio-container","embed-hover-content","embed-selected-content"],o),l=k("audio",[],s);return l.innerHTML="Your browser does not support the <code>audio</code> element.",l.controls=!0,l.src=i,setTimeout(()=>{this.getMedia(t,r.id).setFullScreen()}),l})}getAbstract(){return{mediaIcon:bM,mediaName:L.t(`media.${Go.AUDIO}.menuItem`),menuItem:L.t(`media.${Go.AUDIO}.menuItem`),order:800,mediaType:Go.AUDIO,group:"common"}}getBlockProperties(){return{abstract:`${L.t(`media.${Go.AUDIO}.abstract`)}`}}updateMediaElement(t,o,r,i){const s=o.querySelector(":scope .audio-container > audio");return g($Z,s,"The media element not exist"),s.src!==i&&(s.src=i),s}createProgressElement(t,o){const r=k("audio",[],t);r.innerHTML="Your browser does not support the <code>audio</code> element.",r.controls=!0,r.src="about:blank",Mk(t,o)}}const jZ=new HZ;D("video-resizer");function Ok(n){return n&&It(n)&&fn(n)==="video"}const UZ=50;class lC{constructor(e){m(this,"currentResizableElement",null);m(this,"resizing",!1);m(this,"handleHoveringBlockChange",(e,t)=>{if(!this.resizing&&!window.isDragging&&(t&&Ok(t)&&this.disableBlockResize(t),e&&Ok(e))){const o=this.getVideoElement(e);if(!o)return;this.enableBlockResize(e,o)}});m(this,"handleResizing",(e,t)=>{if(this.resizing=!0,!this.currentResizableElement)return;const o=e.getBlock();if(!o)return;const r=o.getBoundingClientRect().width,i=Math.min(Math.max(t.width,UZ),r);this.currentResizableElement.style.width=`${i}px`,this.currentResizableElement.style.pointerEvents="none"});m(this,"handleResized",e=>{this.resizing=!1;const t=e.getBlock();if(!this.currentResizableElement||!t)return;const o=this.editor.getBlockData(t),{width:r}=this.currentResizableElement.getBoundingClientRect();this.currentResizableElement.style.pointerEvents="auto",this.editor.updateBlockData(t,{...o,width:r})});this.editor=e,Ct.get(e).addListener("change",this.handleHoveringBlockChange)}destroy(){this.currentResizableElement=null,Ct.get(this.editor).removeListener("change",this.handleHoveringBlockChange)}getVideoElement(e){return Le(e).querySelector(":scope .video-container > video")}updateResizer(e){const t=this.editor.findCustom(`${ie(e)}-resizer`);t&&t.updateResizer()}disableBlockResize(e){const t=this.editor.findCustom(`${ie(e)}-resizer`);t&&t.disableResize()}enableBlockResize(e,t){const o=this.editor.addCustom(`${ie(e)}-resizer`,()=>new _u(this.editor,{resize:["top-left","top-right","bottom-left","bottom-right"]}));o.enableResize(e,t),o.removeListener("resizing",this.handleResizing),o.removeListener("resized",this.handleResized),o.addListener("resizing",this.handleResizing),o.addListener("resized",this.handleResized),this.currentResizableElement=t}}const zZ=D("video");class VZ extends Lk{constructor(){super(...arguments);m(this,"embedType",Go.VIDEO);m(this,"updateProgressElement",Rk);m(this,"createMediaElement",(t,o,r,i)=>{const s=k("div",["video-container","embed-selected-content","drag-preview-element"],o),l=k("video",[],s);return l.innerHTML="Your browser does not support the <code>video</code> element.",l.controls=!0,l.src=i,l.addEventListener("canplay",()=>{t.addCustom("video-resizer",()=>new lC(t)),this.getMedia(t,r.id).removeListener("mediaError",this.handleMediaError),this.getMedia(t,r.id).addListener("mediaError",this.handleMediaError),this.getMedia(t,r.id).removeFullScreen()}),r.width&&(l.style.width=`${r.width}px`),l});m(this,"createProgressElement",(t,o,r)=>{const i=k("video",["progress-video"],t);i.innerHTML="Your browser does not support the <code>audio</code> element.",i.controls=!0,Mk(t,o),Wl(r).then(s=>{const l=t.querySelector(".progress-video");l&&ng(t)&&(l.src=s)})})}getAbstract(){return{mediaName:L.t(`media.${Go.VIDEO}.menuItem`),mediaIcon:vM,menuItem:L.t(`media.${Go.VIDEO}.menuItem`),order:700,mediaType:Go.VIDEO,group:"common"}}getBlockProperties(){return{abstract:`${L.t(`media.${Go.VIDEO}.abstract`)}`}}handleMediaError(t,o,r){const i=t.addCustom("video-resizer",()=>new lC(t)),s=t.getBlockById(r);i.disableBlockResize(s)}updateMediaElement(t,o,r,i){const s=o.querySelector(":scope .video-container > video");g(zZ,s,"The media element not exist"),s.src!==i&&(s.src=i),r.width?s.style.width=`${r.width}px`:s.style.width="";const l=t.getBlockById(r.id);return setTimeout(()=>{t.addCustom("video-resizer",()=>new lC(t)).updateResizer(l)}),s}}const WZ=new VZ,_k=[q0,n2,o2,W7],cC=[Bk,qq,eZ,aZ,CZ,LF,IZ,WZ,jZ,yj,sk,WV],Fk=[n9,ak,L8];function qZ(n,e,t){var r,i,s;const o=Ya(n,e,{components:{blocks:[..._k,...((r=t==null?void 0:t.components)==null?void 0:r.blocks)||[]],embeds:[...cC,...((i=t.components)==null?void 0:i.embeds)||[]],boxes:[...Fk,...((s=t.components)==null?void 0:s.boxes)||[]],textRenders:[new D0],options:{...t.componentsOptions}}});return o.readonly=!0,o.addCustom("heading-collapse",()=>new Z2(o)),o.addCustom("editor-tooltip",()=>new Pf(o)),o.addListener("clickLink",(l,a,d)=>{var p;if((p=t==null?void 0:t.events)!=null&&p.onClickLink){t.events.onClickLink(l,a,d);return}const h=d.getAttribute("link");h&&(l.readonly||a.ctrlKey||a.metaKey)&&window.open(h,"_blank")}),o}class Pk{constructor(e){this.createOptions=e,e.lang&&L.setLang(e.lang)}createHistoryEditor(e,t){return qZ(e,t,this.createOptions)}}D("create-editor");function Nk(n,{root:e,childDoc:t,doc:o}){var h,p;t.uploadResource=o.uploadResource.bind(o),t.buildResourceUrl=o.buildResourceUrl.bind(o);const r=n.getComponentOptions("comment"),i={image:{defaultAlign:"left"},toc:{showFirstBlock:!0},table:{locatingContainer:e,hideCellMenu:!0,hideToolbar:!0},...r==null?void 0:r.componentsOptions},s=[];n.editorBlocks.forEach(C=>{C.blockType==="text"||C.blockType==="embed"||s.push(C)});const l=[];n.editorEmbeds.forEach(C=>{l.push(C)});const a=[];n.editorBoxes.forEach(C=>{C.boxType==="text"||C.boxType==="br"||C.boxType==="image"||C.boxType==="anchor"||a.push(C)});const d=Ya(e,t,{shortcuts:[Yh],components:{blocks:s,commandProviders:[new bf],decorators:[new Wf],embeds:l,boxes:a,options:i}});if(d.input.addHandler(new Gf),d.input.addHandler(new w2(d)),d.input.addHandler(new T2(d)),d.input.addHandler(new Yz(d)),d.input.addHandler(new Kf),d.addCustom("image-paste-handler",()=>new k2(d)),(h=n.options.componentsOptions)!=null&&h.mention){const C=n.options.componentsOptions.mention;d.addCustom("mention",()=>new ck(d,{...C,enableFirstBlock:!0}))}if((p=n.options.componentsOptions)!=null&&p.comment){const C=n.options.componentsOptions.comment;C.onCommentEditorClick&&d.addListener("click",C.onCommentEditorClick)}return d}function GZ(n,e){const t=Array.from(n.rootContainer.querySelectorAll(`[comment-${e.toLocaleLowerCase()}="${e}"]`)),o=new Set;t.forEach(r=>{const i=ne(r);i&&o.add(i)}),o.forEach(r=>{Jz(n,r,e)})}class ZZ{constructor(e){m(this,"listeners",new Set);m(this,"doc");this.editor=e,this.doc=this.editor.doc.externalDoc,this.doc.registerCallback(this)}getComments(){return this.doc.getComments()}getComment(e){return this.doc.getComment(e)}getCommentDoc(e){return this.doc.getCommentDoc(e)}localCreateComment(e,t){this.doc.localCreateComment(e,t)}localDeleteComment(e){const t=this.getComment(e);this.doc.localDeleteComment(e);const o=t.groupId;this.getComments().filter(i=>i.groupId===o).length===0&&GZ(this.editor,o)}localUpdateComment(e,t){this.doc.localUpdateComment(e,t)}onCreateComment(e,t){Array.from(this.listeners.values()).forEach(o=>o.onCreateComment(e,t))}onDeleteComment(e,t){Array.from(this.listeners.values()).forEach(o=>o.onDeleteComment(e,t))}onUpdateComment(e,t){Array.from(this.listeners.values()).forEach(o=>o.onUpdateComment(e,t))}addListener(e){this.listeners.add(e)}removeListener(e){this.listeners.delete(e)}createCommentEditor(e,t){return Nk(this.editor,{root:e,childDoc:t,doc:this.doc})}allowEdit(e){return e.userId===this.doc.getUser().userId}}class QZ{constructor(e,t){m(this,"listeners",new Set);this.editor=e,this.localDoc=t}get doc(){return this.localDoc.toJSON()}getComments(){return Object.values(this.doc.comments)}getComment(e){return this.doc.comments[e]}getCommentDoc(e){const t=this.doc.comments[e];return Lp(t)}addListener(e){this.listeners.add(e)}removeListener(e){this.listeners.delete(e)}localCreateComment(e,t){}localDeleteComment(e){}localUpdateComment(e,t){}createCommentEditor(e,t){return Nk(this.editor,{root:e,childDoc:t,doc:this.localDoc})}allowEdit(e){return e.userId===this.localDoc.getUser().userId}}const YZ={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}"}},JZ={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}"}},KZ={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"}};L.mergeLang({"zh-CN":YZ,"en-US":JZ,"ja-JP":KZ});const XZ="UEsDBBQABgAIAAAAIQBk9WPugQEAACkGAAATAAgCW0NvbnRlbnRfVHlwZXNdLnhtbCCiBAIooAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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3dlYlNldHRpbmdzLnhtbFBLAQItABQABgAIAAAAIQA520VMuQUAACdaAAASAAAAAAAAAAAAAAAAADYcAAB3b3JkL251bWJlcmluZy54bWxQSwECLQAUAAYACAAAACEA+JXI7/wOAADzmQAADwAAAAAAAAAAAAAAAAAfIgAAd29yZC9zdHlsZXMueG1sUEsBAi0AFAAGAAgAAAAhAMySUFR9AQAA8QIAABEAAAAAAAAAAAAAAAAASDEAAGRvY1Byb3BzL2NvcmUueG1sUEsBAi0AFAAGAAgAAAAhACJREfHVAQAA3gMAABAAAAAAAAAAAAAAAAAA/DMAAGRvY1Byb3BzL2FwcC54bWxQSwECLQAUAAYACAAAACEAiD+lv+EAAABVAQAAGAAAAAAAAAAAAAAAAAAHNwAAY3VzdG9tWG1sL2l0ZW1Qcm9wczEueG1sUEsBAi0AFAAGAAgAAAAhAMEnywi2AAAAIQEAABMAAAAAAAAAAAAAAAAARjgAAGN1c3RvbVhtbC9pdGVtMS54bWxQSwECLQAUAAYACAAAACEAdD85esIAAAAoAQAAHgAAAAAAAAAAAAAAAABVOQAAY3VzdG9tWG1sL19yZWxzL2l0ZW0xLnhtbC5yZWxzUEsBAi0AFAAGAAgAAAAhAOuAYExTAwAAjw4AABIAAAAAAAAAAAAAAAAAWzsAAHdvcmQvZm9udFRhYmxlLnhtbFBLBQYAAAAADwAPANQDAADePgAAAAA=",eQ=()=>zm(XZ);async function tQ(n){return new Promise((e,t)=>{const o=new Image;o.onload=()=>{e({width:o.naturalWidth,height:o.naturalHeight})},o.onerror=t,o.src=n})}async function $k(n,e){if(n.width&&n.height)return{width:n.width,height:n.height,buffer:e};const t=await Wl(new File([e],"",{})),o=await tQ(t);return o.width===void 0||o.height===void 0?{width:345,height:230,buffer:e}:n.width||n.height?{width:n.width||o.width*n.height/o.height,height:n.height||o.height*n.width/o.width,buffer:e}:{width:o.width,height:o.height,buffer:e}}function nQ(n,e){let t=n.filter(s=>s!=null);const o=e-(t.length-1)*20,r=.87,i=t.reduce((s,l)=>s+l.width,0);return i>o&&(t=t.map(s=>({width:s.width*o/i,height:s.height*o/i,buffer:s.buffer}))),t.map(s=>({width:s.width*r,height:s.height*r,buffer:s.buffer}))}function Hk(n=[0,1,2,3,4,5,6,7],e=1){return n.map(t=>{let o;switch(t%3){case 0:o=ge.LevelFormat.DECIMAL;break;case 1:o=ge.LevelFormat.LOWER_LETTER;break;default:o=ge.LevelFormat.LOWER_ROMAN;break}return{level:t,format:o,text:`%${t+1}. `,alignment:ge.AlignmentType.START,start:e,style:{paragraph:{indent:{left:ge.convertInchesToTwip(.3*(t+1)),hanging:ge.convertInchesToTwip(.2)}}}}})}function oQ(){return[0,1,2,3,4,5,6,7].map(n=>{let e;switch(n%3){case 0:e="\u2022";break;case 1:e="\u25E6";break;default:e="\u25AA";break}return{level:n,format:ge.LevelFormat.BULLET,text:e,alignment:ge.AlignmentType.START,style:{paragraph:{indent:{left:ge.convertInchesToTwip(.3*(n+1)),hanging:ge.convertInchesToTwip(.2)}}}}})}function rQ(){return[0,1,2,3,4,5,6,7].map(n=>({level:n,format:ge.LevelFormat.BULLET,text:"\u2611",alignment:ge.AlignmentType.START,style:{paragraph:{indent:{left:ge.convertInchesToTwip(.3*(n+1)),hanging:ge.convertInchesToTwip(.2)}}}}))}function iQ(){return[0,1,2,3,4,5,6,7].map(n=>({level:n,format:ge.LevelFormat.BULLET,text:"\u2610",alignment:ge.AlignmentType.START,style:{paragraph:{indent:{left:ge.convertInchesToTwip(.3*(n+1)),hanging:ge.convertInchesToTwip(.2)}}}}))}var ed=(n=>(n.NUMBERING="number-numbering-reference",n.BULLET="number-bullet-reference",n.CHECKED="checked-bullet-reference",n.UNCHECKED="unchecked-bullet-reference",n))(ed||{});const sQ=[{levels:Hk(),reference:"number-numbering-reference"},{levels:oQ(),reference:"number-bullet-reference"},{levels:rQ(),reference:"checked-bullet-reference"},{levels:iQ(),reference:"unchecked-bullet-reference"}];function lQ(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 cQ(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 aQ(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 uQ=/rgb\((\d+),\s*(\d+),\s*(\d+)\)/;function jk(n){if(typeof n=="string"&&n.length>0){if(n[0]==="#")return n.substring(1);const e=n.match(uQ);if(e){const t=s=>{let l=Number(s).toString(16);return l.length<2&&(l=`0${l}`),l},o=t(e[1]),r=t(e[2]),i=t(e[3]);return`${o}${r}${i}`}if(n==="red")return"FF0000";if(n==="green")return"00FF00";if(n==="blue")return"0000FF"}}function en(n,e){if(n&&n.attributes&&n.attributes[e])return n.attributes[e];if(n&&n.attributes&&n.attributes.box&&n.attributes.inputType&&e==="style-underline")return!0}function Uk(n,e,t){for(let o=0;o<=t;++o){const r=`${e}${o}`;if(en(n,r))return r}}function b1(n,e,t){n.attributes=n.attributes||{},n.attributes[e]=t}function aC(n){return n==="image"||n==="drawio"||n==="plantuml"||n==="mermaid"||n==="flowchart"}function zk(n){return n&&n.startsWith("//")?`https:${n}`:n&&!n.startsWith("http://")&&!n.startsWith("https://")?`https://${n}`:n}function dQ(n){const e=en(n,"inlineStyle");if(e==null)return;const t=e.split(";");for(const o of t){const r=o.split(":");if(r.length!==2)continue;const i=r[0].trim().toLowerCase(),s=r[1].trim().toLowerCase();i==="font-size"&&b1(n,"inline-style-font-size",s),i==="color"&&b1(n,"inline-style-color",s),i==="background-color"&&b1(n,"inline-style-background-color",s),i==="font-family"&&b1(n,"inline-style-font-family",s)}}function hQ(n,e){if(e==null)return n==null?void 0:n.normal;if(n)return n[`heading${e}`]}function fQ(n){const e=`${en(n,"inline-style-font-size")}`;if(e&&e.indexOf("px")>0)return+e.replace(/px/g,"")}function mQ(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 gQ(n){if(n.attributes&&n.attributes.box&&n.attributes.text)return` @${n.attributes.text} `}function pQ(n){return en(n,"inline-style-font-family")}function CQ(n){const e=en(n,"inline-style-background-color");return jk(e)}function AQ(n){const e=en(n,"inline-style-color");return jk(e)}function bQ(n){dQ(n);const e=en(n,"type")==="mention";return{box:n.attributes&&n.attributes.box?n.attributes:void 0,inlineCode:!!en(n,"style-code"),link:zk(en(n,"link")),size:fQ(n),text:e?gQ(n):mQ(n)||n.insert,bold:!!en(n,"style-bold"),underline:!!en(n,"style-underline"),italics:!!en(n,"style-italic"),strike:!!en(n,"style-strikethrough"),superScript:!!en(n,"style-super"),subScript:!!en(n,"style-sub"),math:en(n,"type")==="math"?en(n,"src"):void 0,mention:e,fontFamily:pQ(n),background:CQ(n),color:e?"338fe5":lQ(Uk(n,"style-color-",6))||AQ(n),highlight:Uk(n,"style-bg-color-",13)}}function vQ(){return[new ge.Paragraph({border:{top:{color:"auto",style:ge.BorderStyle.DASHED,size:4,space:1}},spacing:{before:300}}),new ge.Paragraph({spacing:{line:0}})]}function yQ(){return new ge.Paragraph({children:[new ge.TextRun({text:"[\u89C6\u9891\u6682\u4E0D\u652F\u6301\u5BFC\u51FA]",shading:{type:ge.ShadingType.CLEAR,color:"FFFFFF",fill:"CCCCCC"}})]})}function kQ(){return new ge.Paragraph({children:[new ge.TextRun({text:"[\u97F3\u9891\u6682\u4E0D\u652F\u6301\u5BFC\u51FA]",shading:{type:ge.ShadingType.CLEAR,color:"FFFFFF",fill:"CCCCCC"}})]})}function wQ(n,e){return new ge.Paragraph({children:[new ge.ExternalHyperlink({children:[new ge.TextRun({style:"Hyperlink",text:e||n})],link:n})]})}function Vk(n){if(n.heading!=null)return`Heading${n.heading}`}function Wk(n){if(n.alignment!=null){if(n.alignment==="center")return ge.AlignmentType.CENTER;if(n.alignment==="right")return ge.AlignmentType.RIGHT;if(n.alignment==="left")return ge.AlignmentType.LEFT}}function BQ(n){if(n.indent)return{left:ge.convertInchesToTwip(.3*n.indent-.2)};if(n.padding)return{left:ge.convertInchesToTwip(.3*n.padding)}}function EQ(n){return{type:ge.ShadingType.CLEAR,color:"FFFFFF",fill:n}}function xQ(n){const e=n.split(",");if(e.length!==0)return e[0].trim()}function qk(n,e){let t;t=n.inlineCode?"InlineCode":void 0,t=n.link?"Hyperlink":t;const o=n.size||e,r=o!=null?Math.floor(o*1.5+.5):void 0;return new ge.TextRun({text:n.text,bold:n.bold||void 0,underline:n.underline?{type:ge.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:r,style:t,font:n.fontFamily?xQ(n.fontFamily):void 0,shading:n.background?EQ(n.background):void 0,color:n.color,highlight:cQ(n.highlight)})}function IQ(n,e){if(n.link)return new ge.ExternalHyperlink({children:[qk(n,e)],link:n.link})}async function Gk(n,e,t,o,r){const i=await r(n,e,t);if(i==null)return;const s=await $k({width:o||0,height:0,src:t},i);return new ge.ImageRun({data:i,transformation:{width:s.width||100,height:s.height||20}})}function TQ(n){if(n.heading||n.heading)return n.heading}function SQ(n){if(n.align&&(n.align==="center"||n.align==="right"||n.align==="left"))return n.align}function DQ(n){if(n.textOnly===!0&&n.level!=null)return n.level}async function LQ(n,e){var o;const t=[];if(n.text&&Array.isArray(n.text)){for(let r=0;r<n.text.length;r++){const i=n.text[r];if(((o=i.attributes)==null?void 0:o.box)===!0&&e){const s=await e(i);if(s){n.text.splice(r+1,0,...s);continue}}t.push(bQ(i))}return t}}function MQ(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 RQ(n,e){if(n.type==="embed"&&n.embedType&&aC(n.embedType)&&n.embedData&&n.embedData.src)return n.embedData.src.split("|").map(o=>{const r=e(o),i=n.embedData[`${r}_width`],s=n.embedData[`${r}_height`];return{src:o,width:i,height:s}})}function OQ(n){if(n.padding)return n.padding}function _Q(n){return!!(n.type==="embed"&&n.embedType&&aC(n.embedType)&&n.embedData&&n.embedData.src)}async function v1(n,e,t){return{quoted:!!n.quoted,heading:TQ(n),alignment:SQ(n),indent:DQ(n),padding:OQ(n),texts:await LQ(n,t),list:MQ(n),images:RQ(n,e),border:_Q(n)}}async function FQ(n,e,t,o){const r=[];if(!n.children)return[];for(const i of n.children){const s=[];for(const l of e.blocks[i])s.push(await v1(l,t,o));r.push(s)}return r}const PQ=D("to-docx");function NQ(n,e){return Array(n).fill(0).map(()=>Array(e).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 $Q(n,e,t,o){const r=!!n.hasColTitle,i=!!n.hasRowTitle,s=!!n.isStripeStyle,l="F5F8FB";for(let a=0;a<e;a++)for(let d=0;d<t;d++)(r&&d===0||i&&a===0||s&&a%2===1)&&(o[a][d].color=l)}function HQ(n){g(PQ,n.children,"no table children");const e=n.rows,t=n.cols,o=n.colsWidth;if(o)for(let s=0;s<o.length;s++)o[s]===0&&(o[s]=100);const r=NQ(e,t);let i=0;for(let s=0;s<e;++s)for(let l=0;l<t;++l){if(r[s][l].originalWidth=o?o[l]:void 0,r[s][l].from!==void 0)continue;const a=n.children[i];i+=1,r[s][l].cellId=a,r[s][l].color=aQ(n[`${a}_background`]),r[s][l].width=o?o[l]:100,r[s][l].align=n[`${a}_align`];const d=n[`${a}_rowSpan`]||1,h=n[`${a}_colSpan`]||1;if(r[s][l].rowSpan=d,r[s][l].colSpan=h,d>1||h>1){let p=0;for(let C=0;C<d;C++)for(let v=0;v<h;v++)C===0&&(p+=o?o[l+v]:80),!(C===0&&v===0)&&(r[s+C][l+v].from=[s,l]);r[s][l].width=p}}return $Q(n,e,t,r),r}async function jQ(n,e,t,o,r,i,s,l,a,d){async function h(v){if(l){const B=await l(r,i,v);if(B){await o.addDoc(n,B,d);return}}if(v.type==="text"||v.textOnly===!0){const B=await v1(v,s,a);await o.addTextBlock(B);return}if(v.type==="code"){const B=await FQ(v,t,s,a);await o.addCodeBlockObject(B);return}if(v.type==="list"&&v.textOnly!==!0){const B=await v1(v,s,a);await o.addListBlockObject(n,B);return}if(v.type==="embed"&&v.embedType){const B=v,S=B.embedData,x=B.embedType;if(aC(x)){const _=await v1(v,s,a);await o.addImagesBlockObject(v,_,d)}else v.embedType==="hr"?o.addSeparatorBlock():v.embedType==="video"?o.addVideoPlaceholder():v.embedType==="audio"?o.addAudioPlaceholder():v.embedType==="webpage"?o.addHyperlinkParagraph(zk(S.src),S.title):o.addOtherEmbedBlock(x,v.embedData);return}if(v.type==="table"){let B=[];if(v.colsWidth)B=v.colsWidth;else{const x=v.cols;B=new Array(x);for(let _=0;_<B.length;_++)B[_]=100;v.colsWidth=B}const S=HQ(v);await o.addTableMatrix(B,S,t),o.addEmptyParagraph()}}function p(v){const B=[];for(const{type:S,data:x}of v.embedData.exportSpec){if(S==="text"){const _={id:K(),text:[{insert:x}],type:"text"};B.push(_);continue}if(S==="image"){const _={id:K(),type:"embed",embedType:"image",align:"left",embedData:{src:x}};B.push(_);continue}if(S==="link"){const _={id:K(),type:"embed",embedType:"webpage",embedData:{src:x.url,title:x.title}};B.push(_);continue}}return B}function C(v){var B;return(B=v==null?void 0:v.embedData)!=null&&B.exportSpec?p(v):[v]}for(const v of e)for(const B of C(v))await h(B)}function UQ(){return{listMaxInst:1,listInstMap:{},listRefMap:{},levelConfigs:[]}}const zQ=D("to-docx");class VQ{constructor(e,t,o,r,i,s){m(this,"paragraphs");this.appId=e,this.docId=t,this.state=o,this.readImageFunc=r,this.convertBlocksFunc=i,this.defaultFontSize=s,this.paragraphs=[]}async addTextBlock(e){this.paragraphs.push(new ge.Paragraph({heading:Vk(e),alignment:Wk(e),children:await this.paragraphsFromBlockTexts(e),indent:BQ(e)}))}async addEmptyImagePlaceHolder(){this.paragraphs.push(new ge.Paragraph({text:`[${L.t("docx.imageExportFailed")}]`,shading:{type:ge.ShadingType.CLEAR,color:"FFFFFF",fill:"CCCCCC"}}))}async paragraphsFromBlockTexts(e){if(e.texts==null)return;const t=hQ(this.defaultFontSize,e.heading),o=[];for(const r of e.texts){if(r.link){const i=IQ(r,t);i&&o.push(i);continue}if(r.box&&r.box.type&&r.box.type==="br"){o.push(new ge.TextRun({text:"",break:1}));continue}if(r.box&&r.box.type&&r.box.type==="image"){const i=await Gk(this.appId,this.docId,r.box.src,r.box.width,this.readImageFunc);i&&o.push(i);continue}if(r.math){const i=await Gk(this.appId,this.docId,r.math,0,this.readImageFunc);i&&o.push(i);continue}o.push(qk(r,t))}return o}async addCodeBlockObject(e){for(const t of e)for(const o of t){const r={style:ge.BorderStyle.SINGLE,color:"#DEDEDE"};this.paragraphs.push(new ge.Paragraph({style:"Code",border:{left:{...r},right:{...r},top:{...r},bottom:{...r}},children:await this.paragraphsFromBlockTexts(o)}))}}async addListBlockObject(e,t){if(t.list==null)return;let o;const r=t.list.checkbox?`${e}-${t.list.groupId}-${t.list.checkbox}`:`${e}-${t.list.groupId}`;if(this.state.listInstMap[r])o=this.state.listInstMap[r];else if(o=this.state.listMaxInst,this.state.listMaxInst+=1,this.state.listInstMap[r]=o,t.list.start>0&&t.list.ordered){const s=`number-numbering-reference-${o}`,l=Hk([t.list.level-1],t.list.start);this.state.levelConfigs.push({levels:l,reference:s,inst:o}),this.state.listRefMap[r]=s}else t.list.ordered?this.state.listRefMap[r]=ed.NUMBERING:t.list.checkbox&&t.list.checkbox==="checked"?this.state.listRefMap[r]=ed.CHECKED:t.list.checkbox&&t.list.checkbox==="unchecked"?this.state.listRefMap[r]=ed.UNCHECKED:this.state.listRefMap[r]=ed.BULLET;const i=Vk(t);t.texts&&this.paragraphs.push(new ge.Paragraph({heading:i,children:await this.paragraphsFromBlockTexts(t),numbering:{reference:this.state.listRefMap[r],level:t.list.level-1,instance:o}}))}imageDimWithBufferToImageRun(e){return new ge.ImageRun({data:e.buffer,transformation:{width:e.width,height:e.height}})}async addImagesBlockObject(e,t,o){if(t.images==null){if(e.type==="embed"&&e.embedType==="image"){const{src:a}=e.embedData;a||this.addEmptyImagePlaceHolder()}return}const r=[],i=await Promise.all(t.images.map(async a=>{const d=await this.readImageFunc(this.appId,this.docId,a.src);if(d)return $k(a,d);r.push(a.src)})),s=nQ(i,o),l={style:ge.BorderStyle.SINGLE,color:"#DEDEDE"};s.length&&this.paragraphs.push(new ge.Paragraph({border:t.border?{left:{...l},right:{...l},top:{...l},bottom:{...l}}:void 0,alignment:Wk(t)||ge.AlignmentType.CENTER,children:s.map(a=>this.imageDimWithBufferToImageRun(a)).flatMap((a,d,h)=>a==null?[]:h.length-1!==d?[a,new ge.TextRun({text:" "})]:a)})),r.forEach(a=>{this.addHyperlinkParagraph(a)})}addSeparatorBlock(){vQ().forEach(e=>this.paragraphs.push(e))}addEmptyParagraph(){this.paragraphs.push(new ge.Paragraph(""))}addVideoPlaceholder(){this.paragraphs.push(yQ())}addAudioPlaceholder(){this.paragraphs.push(kQ())}addHyperlinkParagraph(e,t){e!=null&&this.paragraphs.push(wQ(e,t))}async addTableMatrix(e,t,o){const r=e.map(i=>i!==0?i*15:1500);this.paragraphs.push(new ge.Table({rows:await this.generateTableRows(t,o),columnWidths:r}))}async generateRowCells(e,t){const o=[];for(const r of e){const i=r.cellId;if(i===void 0)continue;const s=r.width*.9;o.push(new ge.TableCell({children:await this.convertBlocksFunc(i,t.blocks[i],t,this.appId,this.docId,this.state,s),columnSpan:r.colSpan,rowSpan:r.rowSpan,width:{type:ge.WidthType.DXA,size:r.width*15},shading:r.color?{fill:r.color,type:ge.ShadingType.CLEAR,color:"auto"}:void 0}))}return o}async generateTableRows(e,t){const o=[];for(const r of e)o.push(new ge.TableRow({children:await this.generateRowCells(r,t)}));return o}async addDoc(e,t,o){const r=await this.convertBlocksFunc(e,t.blocks.root,t,this.appId,this.docId,this.state,o);r&&(this.paragraphs=this.paragraphs.concat(r))}async addOtherEmbedBlock(){}}class WQ{constructor(e,t,o,r,i,s,l,a){m(this,"convertBlocks",async(e,t,o,r,i,s,l=720)=>{const a=new VQ(r,i,s,this.readImage,this.convertBlocks,this.defaultFontSize);return await jQ(e,t,o,a,r,i,this.md5HexFunc,this.getDocByBlock,this.getTextsByBox,l||720),a.paragraphs});this.templateData=e,this.docData=t,this.md5HexFunc=o,this.readImage=r,this.defaultFontSize=i,this.getDocByBlock=s,this.getTextsByBox=l,this.backgroundImageOptions=a}async convert(e,t){return this.snapshot2docx(this.docData,e,t)}async snapshot2docx(e,t,o){const r=new ge.ImportDotx,i=this.templateData?await r.extract(this.templateData):void 0,s=e.blocks.root;g(zQ,s,"data must have blocks");const l=UQ(),a=await this.convertBlocks("blocks",s,e,t,o,l),d=this.backgroundImageOptions?{default:new ge.Header({children:[new ge.Paragraph({children:[new ge.ImageRun(this.backgroundImageOptions)]})]})}:{},h=new ge.Document({numbering:{config:[...sQ,...l.levelConfigs]},sections:[{headers:d,children:a,properties:{page:{size:{width:12240,height:15840},margin:{top:1440,bottom:1440,left:1440,right:1440}}}}]},{template:i});return ge.Packer.toBlob(h)}}async function qQ(n,e,t,o){const r=n.doc.buildResourceUrl(o,{withToken:!0});let i=await O9(r);if(!i)return;if(i.type.indexOf("/svg")!==-1){const l=await L9(i);l&&(i=new File([l],i.name))}return await i.arrayBuffer()}async function GQ(n,e,t){const o=n.editorBlocks.getBlockClass(t.type);if(o.toStandardDoc)return o.toStandardDoc(n,t,e)}async function ZQ(n,e){const t=e.attributes,o=n.editorBoxes.getBoxClass(t.type);if(o.toStandardText)return o.toStandardText(n,t)}async function QQ(n,e){let{template:t,download:o,backgroundImageOptions:r}=e!=null?e:{};t||(t=eQ());const i=n.doc.toJSON(),s=(p,C,v)=>qQ(n,p,C,v),l=async(p,C,v)=>GQ(n,i,v),a=async p=>ZQ(n,p),h=await new WQ(t,i,Jd.default,s,void 0,l,a,r).convert("_appId","_docId");if(o){const p=URL.createObjectURL(h),C=document.createElement("a");C.setAttribute("download",`${R9(n)}.docx`),C.setAttribute("href",`${p}`),C.click(),C.remove()}return h}const uC=D("create-editor");async function YQ(n,e){var s,l,a,d,h,p,C,v,B,S,x,_,R,H;g(uC,n,"app does not exists"),e.lang&&L.setLang(e.lang),Ri.level=(s=e.logLevel)!=null?s:ba.DEBUG;const t=e.onReauth?async()=>{var fe;const z=e.user.userId,Q=e.docId,ee=await((fe=e.onReauth)==null?void 0:fe.call(e,z,Q,e.permission));return{userId:z,docId:Q,permission:e.permission,appId:e.appId,token:ee,displayName:e.user.displayName,avatarUrl:e.user.avatarUrl}}:void 0,o={auth:{appId:e.appId,docId:e.docId,userId:e.user.userId,permission:e.permission,token:e.token,displayName:e.user.displayName,avatarUrl:e.user.avatarUrl},serverUrl:e.serverUrl,reauthFunc:t,disableLogout:e.disableLogout},r=await uu.load(o),i=Ya(n,r,{id:e.id,scrollContainer:e==null?void 0:e.scrollContainer,enableComments:e==null?void 0:e.enableComments,components:{blocks:[..._k,...((l=e==null?void 0:e.components)==null?void 0:l.blocks)||[]],embeds:[...cC,...((a=e.components)==null?void 0:a.embeds)||[]],boxes:[...Fk,...((d=e.components)==null?void 0:d.boxes)||[]],commandProviders:[new bf,...((h=e.components)==null?void 0:h.commandProviders)||[]],decorators:[new Wf,new Rp],insertions:[_g],blockHooks:[new p2,new hy,...((p=e.components)==null?void 0:p.blockHooks)||[]],textRenders:[new w8,new D0],options:{...e.componentsOptions}},shortcuts:[gV,KN,cj,G0,Xy,b_,U0,JV,Yh,h_,...e.shortcuts||[]],colors:["#338FE5","#24B47E","#F0A100","#E52727","#9678D3","#2CB2AE","#EB6414","#8AAB3F"]});if(i.editorCommandProviders.registerCommandProvider(new xr(i)),i.input.addHandler(new HW),i.input.addHandler(new Gf),i.input.addHandler(new FF),i.input.addHandler(new oj),i.input.addHandler(new Ru(i,{headingLevel:1,titlePlaceholder:L.t("placeholder.common.title"),contentPlaceholder:L.t("placeholder.common.content"),readonlyTitlePlaceholder:L.t("placeholder.common.readonlyTitle"),addPlaceholderToAllCurrentEmptyBlock:!0})),i.input.addHandler(new Ff(i,(C=e.componentsOptions)==null?void 0:C.quickMenu)),i.input.addHandler(new w2(i)),i.input.addHandler(new T2(i)),i.input.addHandler(new ZN),i.input.addHandler(new Kf),i.doc.registerCallback(new jW(i)),i.addCustom("remote-cursor",()=>new hv(i)),i.addCustom("block-menu",z=>new gy(z)),i.addCustom("editor-tooltip",()=>new Pf(i)),e!=null&&e.enableComments&&i.addCustom("editor-comments",z=>new k8(z,new ZZ(z))),i.addCustom("create-options",()=>new d5(i,e)),i.addCustom("drop-target",()=>new zu(i)),i.addCustom("list-to-mindmap",()=>new Df(i)),i.addCustom("list-to-mention",()=>new lq(i)),i.addCustom("mobile-helper",()=>new Bq(i)),i.addCustom("code-caret",()=>new GN(i)),i.addCustom("image-paste-handler",()=>new k2(i)),(v=e.componentsOptions)!=null&&v.mention){const z=e.componentsOptions.mention;i.addCustom("mention",()=>new ck(i,z))}if(i.addCustom("heading-collapse",()=>new Z2(i)),wc.register(i),zu.register(i),os.register(i),es.register(i),i.addListener("clickLink",(z,Q,ee)=>{var ve;if((ve=e==null?void 0:e.events)!=null&&ve.onClickLink){e.events.onClickLink(z,Q,ee);return}const fe=ee.getAttribute("link");fe&&(z.readonly||Q.ctrlKey||Q.metaKey)&&window.open(fe,"_blank")}),(S=(B=e.componentsOptions)==null?void 0:B.remoteCarets)!=null&&S.onUserChanged){const z=(_=(x=e.componentsOptions)==null?void 0:x.remoteCarets)==null?void 0:_.onUserChanged;i.doc.getRemoteUsers().on("change",Q=>{z(i,Q)})}return(H=(R=e.componentsOptions)==null?void 0:R.templates)!=null&&H.templates.length&&(i.addListener("docChanged",()=>{C1(i)}),i.addListener("resize",()=>{C1(i,{reset:!0})}),setTimeout(()=>{C1(i)},100)),i.doc.registerCallback({onError:async z=>{if(z.code==="ResetDoc"){uC.error(`reset doc: ${z.message}`);const Q=await uu.load(o);i.doc.reset(Q)}}}),i}function JQ(n){return n.toJSON!==void 0}async function KQ(n,e,t){var i,s,l,a,d;g(uC,n,"app does not exists");const o=JQ(e)?e:new hp(e,{serverUrl:t.serverUrl||""});t.lang&&L.setLang(t.lang);const r=Ya(n,o,{id:t.id,scrollContainer:t==null?void 0:t.scrollContainer,components:{blocks:[q0,n2,o2,W7],commandProviders:[new bf],decorators:[new Wf,new Rp],embeds:[...cC,...((i=t.components)==null?void 0:i.embeds)||[]],boxes:[n9,ak,L8,...((s=t.components)==null?void 0:s.boxes)||[]],insertions:[_g],blockHooks:[new p2,...((l=t.components)==null?void 0:l.blockHooks)||[]],textRenders:[new w8,new D0,...((a=t.components)==null?void 0:a.textRenders)||[]],options:{...t.componentsOptions}},shortcuts:[G0,Xy,U0,Yh]});return r.editorCommandProviders.registerCommandProvider(new xr(r)),r.input.addHandler(new Gf),r.input.addHandler(new Ru(r,{headingLevel:1,titlePlaceholder:L.t("placeholder.common.title"),contentPlaceholder:L.t("placeholder.common.content"),readonlyTitlePlaceholder:L.t("placeholder.local.readonlyTitle"),addPlaceholderToAllCurrentEmptyBlock:!0})),r.input.addHandler(new Ff(r,(d=t.componentsOptions)==null?void 0:d.quickMenu)),r.input.addHandler(new w2(r)),r.input.addHandler(new T2(r)),r.input.addHandler(new Kf),r.addCustom("block-menu",h=>new gy(h)),r.addCustom("editor-tooltip",()=>new Pf(r)),r.addCustom("image-paste-handler",()=>new k2(r)),t!=null&&t.enableComments&&r.addCustom("editor-comments",h=>new k8(h,new QZ(h,o))),r.addCustom("heading-collapse",()=>new Z2(r)),r.addListener("clickLink",(h,p,C)=>{var B;if((B=t==null?void 0:t.events)!=null&&B.onClickLink){t.events.onClickLink(h,p,C);return}const v=C.getAttribute("link");v&&(h.readonly||p.ctrlKey||p.metaKey)&&window.open(v,"_blank")}),wc.register(r),r}function XQ(n,e){var a;const t=n.doc;if(!((a=t.getVersionHelper)==null?void 0:a.call(t)))throw new Error("the editor does not support to show versions");const r=n.getCustom("create-options");if(!r)throw new Error("the editor does not support to show versions");const i=r.getData(),s=new Pk(i),l=n.addCustom("version-dialog",()=>new G8(n.doc,s));return l.show(e),l}b.tippy=iE,b.AnchorBox=F6,b.AuthError=df,b.AuthHeader=au,b.AutoScroll=hh,b.BaseURLHeader=hf,b.BasicCommands=lF,b.BlockExclusiveHook=hy,b.BlockLockerHook=p2,b.BlockLockerPasteHandler=Kf,b.BlockResizer=_u,b.BrBox=M6,b.CodeBlock=n2,b.CodeLineBlock=o2,b.CodeTextDecorator=Wf,b.DefaultShortcuts=Yh,b.DocIdError=IL,b.DragDrop=L5,b.DrawioEmbed=Bk,b.EditorBlocks=N4,b.EditorBoxes=O6,b.EditorCommandProviders=Bb,b.EditorComplexBlockPosition=Oo,b.EditorComplexSelectionRange=lr,b.EditorDecorators=H6,b.EditorEmbeds=H4,b.EditorInsertions=$6,b.EditorSimpleBlockPosition=Ut,b.EditorSimpleSelectionRange=Yt,b.EmbedBlock=U4,b.EmbedBlockResizer=Ju,b.EnforceWithDocumentTitleHandler=Ru,b.EventCallbacks=va,b.FILL_CHAR=qI,b.FileExtError=TL,b.GroupOrder=Q7,b.HeadingBlockScrollListener=tq,b.ImageBox=_6,b.InlineBoxCommandProvider=o9,b.InputtingInsertion=P6,b.LocalDoc=hp,b.LogLevel=ba,b.Logger=Ri,b.MIN_DISTANCE_THRESHOLD=S5,b.ManualCloseDialog=gu,b.ManualMenu=Vs,b.ManualToolbar=mu,b.MarkdownInputHandler=Gf,b.MaxUserError=Ep,b.Mindmap=x0,b.OnesEditorAutoSuggest=Jp,b.OnesEditorCustomDataWrapper=d5,b.OnesEditorExclusiveBlock=es,b.OnesEditorHoveringBlock=Ct,b.OnesEditorQuickMenu=Ff,b.OnesEditorToc=Ku,b.OnesEditorTocProvider=os,b.OnesEditorToolbar=wc,b.OnesEditorTooltip=Pf,b.OnesEditorVersionsDialog=G8,b.PermissionError=xL,b.Popup=fu,b.RemoteCarets=hv,b.RemoteCaretsDecorator=Rp,b.RemoteCaretsInsertion=_g,b.RemoteUsers=of,b.RequestReloadError=cu,b.RichText=ln,b.ShareDBDoc=uu,b.ShareDBDocVersionsProvider=Pk,b.SimpleCache=b5,b.StandardEmbedBlockCommands=j2,b.TEXT_STYLE_BACKGROUND_COLOR_PREFIX=Eg,b.TEXT_STYLE_COLOR_PREFIX=Bg,b.TableBlock=q0,b.TableBlockCommandProvider=bf,b.TableShortcuts=G0,b.TextBlock=Sn,b.TextBox=L6,b.TextStyleShortcuts=U0,b.TocEmbed=sk,b.ZERO_WIDTH_SPACE_CHAR=ya,b.abbreviation=fh,b.addAttribute=Dh,b.addClass=W,b.addCommentToBlock=Yu,b.addDays=hx,b.addMetaToDoc=Kh,b.addMonths=dx,b.animateScrollTo=sh,b.applyPlaceholderToBlock=Zf,b.assert=g,b.autoShowHideTemplates=C1,b.blockToDoc=up,b.blockToHtml=$g,b.blockToMarkdown=Hg,b.blockToText=Nh,b.blocksToDoc=dS,b.clearAllSelection=v4,b.clientType=Zt,b.cloneBlock=Hi,b.cloneChildContainer=Yg,b.cloneDoc=Jg,b.cloneText=y6,b.commentToShareDbComment=Mp,b.compareElement=rh,b.comparePosition=dg,b.complexBlockAdjustSelectionPos=kh,b.complexBlockFindNearestChildBlock=q4,b.complexBlockGeFirstSimpleChild=fg,b.complexBlockGetAllChildContainers=gn,b.complexBlockGetBottomChildContainers=W4,b.complexBlockGetLastSimpleChild=Ql,b.complexBlockGetSelectedContainers=Zl,b.complexBlockGetTopChildContainers=V4,b.containerToDoc=eb,b.continuousScroll=Z5,b.convertBlockFrom=Ch,b.convertImageFileToPng=L9,b.convertImageSrcToPng=pN,b.converterIntercept=qf,b.copyBlockAttributes=X6,b.createBlockAnchor=Zr,b.createBlockCaretAnchor=Y4,b.createBlockContentElement=Ss,b.createBlockElement=a4,b.createBlockSimpleDocRange=Oh,b.createBlockSimpleRange=kt,b.createBoxContentElement=h4,b.createBoxElement=u4,b.createBoxOp=h6,b.createChildContainer=F4,b.createComplexBlockPosition=ft,b.createComplexDocPos=I6,b.createComplexDocRange=QI,b.createContainer=B6,b.createContainerElement=lg,b.createDeleteOps=c6,b.createEditor=Ya,b.createEditorSelectionRange=zt,b.createElement=k,b.createEmptyContainer=Jr,b.createEmptyDoc=Yr,b.createEmptyTextBlockData=Mh,b.createExpandedRange=nh,b.createIconButton=Ul,b.createImage=Rm,b.createInsertOps=Th,b.createInsertionContentElement=g4,b.createInsertionElement=f4,b.createLocalEditor=KQ,b.createOnesEditor=YQ,b.createRange=v5,b.createRichText=Ni,b.createRootContainer=_4,b.createSimpleBlockPosition=se,b.createSimpleDocPos=x6,b.createTextBlockData=dr,b.createTextButton=Ys,b.createTextOp=uo,b.createTextWithReplaceSoftReturn=yg,b.daysAfter=Gm,b.deleteText=wg,b.diffDays=fx,b.disablePageScroll=U5,b.docToHtml=Z6,b.docToHtmlFragment=$h,b.docToMarkdown=Ua,b.docToText=ja,b.downloadImageToFile=O9,b.downloadObjectToFile=tC,b.downloadSvgToString=gk,b.editLink=xu,b.editorAddComment=Xz,b.editorAddTextAttribute=uA,b.editorAutoInsertBlock=eA,b.editorBreakTextBlock=tc,b.editorClearCompositionText=K6,b.editorClearSelectedContents=Zg,b.editorCopyBlock=Xh,b.editorDeleteBlock=qg,b.editorDeleteBlockText=Vg,b.editorDeleteBlockWithoutChildren=Uh,b.editorDeleteChildContainer=zT,b.editorDeleteChildContainers=tA,b.editorFocusToBlock=Qg,b.editorFocusToEnd=aS,b.editorGetBlockData=$i,b.editorGetBlockText=pn,b.editorGetBlockTextEx=Fh,b.editorGetBoxData=S6,b.editorHandleKeyboardEvent=rb,b.editorInsertBlock=ec,b.editorInsertBoxToBlock=Y6,b.editorInsertDoc=cA,b.editorInsertDocAt=Kg,b.editorInsertText=zg,b.editorInsertTextToBlock=Q6,b.editorInsertTextToBlockEx=Ug,b.editorMergeTextBlock=nA,b.editorMoveDown=wA,b.editorMoveEnd=ip,b.editorMoveHome=RA,b.editorMoveLeft=vA,b.editorMoveLineEnd=jA,b.editorMoveLineHome=HA,b.editorMovePageDown=GA,b.editorMovePageUp=qA,b.editorMoveRight=yA,b.editorMoveUp=kA,b.editorMoveWordEnd=DA,b.editorMoveWordLeft=SA,b.editorRangeClearColor=hA,b.editorRangeGetColor=fA,b.editorRangeSetColor=dA,b.editorRemoveTextAttribute=GT,b.editorReplaceBlockText=Vh,b.editorReplaceContainer=aA,b.editorRunOnce=fp,b.editorSelectAll=KA,b.editorSelectContainer=cp,b.editorSelectDown=BA,b.editorSelectEnd=sp,b.editorSelectHome=OA,b.editorSelectLeft=EA,b.editorSelectLineEnd=$A,b.editorSelectLineHome=NA,b.editorSelectPageDown=QA,b.editorSelectPageUp=ZA,b.editorSelectRight=xA,b.editorSelectUp=IA,b.editorSelectWordEnd=MA,b.editorSelectWordLeft=LA,b.editorSetTextColor=nc,b.editorShowFindDialog=iz,b.editorToDocx=QQ,b.editorUpdateBlockData=Wh,b.editorUpdateCompositionText=J6,b.editorUpdateEmbedData=sA,b.enablePageScroll=z5,b.escapeHtmlText=x5,b.escapeRegExp=Jm,b.escapeSpace=QE,b.exclusiveBlock=f2,b.executeBlockCommand=S4,b.executeEmbedBlockCommand=T4,b.executeRangeCommand=wb,b.fileToDataUrl=Wl,b.findAfterOffsetNotType=Mg,b.findAllText=Sg,b.findEventTargetBlock=B5,b.findInsertionById=m4,b.findNextOffset=hT,b.findNextVisibleSimpleBlock=Sb,b.findPrevOffset=dT,b.findPrevOffsetNotType=Lg,b.findPrevSimpleBlockBeforeChildContainer=z4,b.findPrevVisibleSimpleBlock=Tb,b.findTarget=zl,b.findWordEnd=Og,b.findWordLeft=Rg,b.format=Ta,b.formatBytes=Q5,b.formatDate=Qm,b.fragmentToHtml=V5,b.fromBase64=Ea,b.fromBase64ToBlob=zm,b.fromBase64ToUint8Array=sx,b.fromDocRange=Fi,b.fromNowString=Ym,b.genId=K,b.getAllChildBlocks=gg,b.getAllQuickMenuItems=j0,b.getAllSelectedBlocks=cr,b.getAttributesAt=Na,b.getBlockBackground=c4,b.getBlockByIndex=Ur,b.getBlockCaretRect=Mo,b.getBlockClass=Ye,b.getBlockClassByType=Rs,b.getBlockClientRects=Vr,b.getBlockCommandsWithHook=ig,b.getBlockContent=Le,b.getBlockId=ie,b.getBlockIndex=be,b.getBlockInfo=Hu,b.getBlockKind=Lo,b.getBlockMinWidth=k4,b.getBlockNearestRangeFromPoint=Q4,b.getBlockOptions=Bx,b.getBlockPath=_i,b.getBlockProperties=E4,b.getBlockRangeFromPoint=wh,b.getBlockStyles=wx,b.getBlockTextLength=ue,b.getBlockTools=tt,b.getBlockType=Se,b.getBoxContent=eg,b.getBoxId=d4,b.getBoxTypeFromElement=Sa,b.getChildBlockCount=So,b.getChildBlocks=mt,b.getChildOffset=Fs,b.getColorFromAttributes=Ig,b.getColorFromContent=mh,b.getComplexBlockClass=zn,b.getContainerBlockPath=M4,b.getContainerBlocks=b4,b.getContainerBlocksElement=vh,b.getContainerById=sr,b.getContainerId=ce,b.getContainerMinWidth=ag,b.getContainerToolsElement=Sx,b.getContainerWidth=P4,b.getDistanceSquare=or,b.getElementOffset=ka,b.getElementScale=ro,b.getEmbedType=fn,b.getExistsBlockTools=ph,b.getExistsContainerById=bh,b.getFileExt=Ia,b.getFirstChildBlock=yt,b.getFirstClientRect=oh,b.getHeadingMenuOptions=P0,b.getHorizontalPadding=Om,b.getInsertionContent=tg,b.getLastChildBlock=Qt,b.getLastClientRect=ks,b.getListAllNextBrothers=Ac,b.getLogger=D,b.getNextBlock=Qe,b.getNextValidOffset=Ps,b.getNextVisibleBlock=Ls,b.getOffsetInfoAfter=Ha,b.getOffsetInfoBefore=Ph,b.getOpAt=m6,b.getOpLength=Sh,b.getParentBlock=ne,b.getParentBlockExcludeSelf=Ts,b.getParentBox=Xm,b.getParentContainer=oe,b.getPrevBlock=at,b.getPrevValidOffset=Pi,b.getPrevVisibleBlock=Ds,b.getRangeCommands=yb,b.getRootBlock=rg,b.getScrollContainer=so,b.getSpecialBlockCommands=x4,b.getStandardEmbedBlockProperties=U2,b.getTextAfterOffset=aT,b.getTextAttributes=jg,b.getTextBeforeOffset=uT,b.getTextBlockChild=Ah,b.getTextBlockClass=C4,b.getTextBlockContentChildTextLength=ao,b.getTextBlockContentChildType=D4,b.getTextBlockContentChildren=ir,b.getTextLength=rn,b.getTextOpLength=pg,b.getTextWidth=ah,b.getToolbar=Ef,b.handleBlockElementUpdated=w4,b.hasAltOnly=tx,b.hasClass=xe,b.hasCtrlOrCmd=P5,b.hasCtrlOrCmdOnly=ex,b.hashCode=n4,b.hideBlock=s4,b.htmlToFragment=ch,b.i18n=L,b.injectDocToHtmlFragment=Jh,b.injectStyle=T5,b.insertEmptyBlock=Ix,b.insertEmptyEmbedBlock=sg,b.insertText=Qr,b.intersectionCommands=gD,b.isBackspace=$5,b.isBlock=Is,b.isBlockLocked=Jf,b.isBlockLockedByOthers=g2,b.isBlockLockedBySelf=ju,b.isBlockTools=i4,b.isBox=Km,b.isCJK=_5,b.isChildContainer=Ro,b.isChildNode=et,b.isCodeBlock=yr,b.isCollapsedRange=ZI,b.isComplexBlockPosition=Gl,b.isComplexKindBlock=Me,b.isContainer=zr,b.isContainerSelectedAllChildBlocks=YA,b.isControlEvent=Es,b.isDelete=ox,b.isDraggingFiles=uh,b.isElementVisible=Pm,b.isEmbedBlock=It,b.isEmptyContainer=Ra,b.isEmptyDoc=Dg,b.isEmptyTextBlock=ut,b.isEmptyTextBlockWithoutCompositionText=Mu,b.isEnterOnly=N5,b.isEscape=jm,b.isExclusiveBlock=$u,b.isFirefox=Ba,b.isFirstChildBlockInComplexBlock=lI,b.isHighSurrogate=zE,b.isInBlock=ng,b.isInBlockTools=Ms,b.isLetter=O5,b.isLowSurrogate=Mm,b.isMatchShortcut=rr,b.isMoveForward=KE,b.isNavigationEvent=JE,b.isNavigationKey=F5,b.isNodeRemoved=k5,b.isNumber=R5,b.isPrintableKey=Hm,b.isRootBlock=lo,b.isRootContainer=Ge,b.isSafari=Vl,b.isSameDay=Zm,b.isSecureEnv=e2,b.isShiftEnter=nx,b.isShiftTab=ix,b.isShortcutEvent=XE,b.isSimpleBlock=kx,b.isSimpleBlockPosition=Gr,b.isSimplePos=E6,b.isSimpleRange=Rh,b.isSpace=lh,b.isTab=rx,b.isTextBlockContentBoxChild=co,b.isTextBlockContentChild=La,b.isTextBlockContentInsertionChild=qr,b.isTextBlockContentTextChild=Ma,b.isTextKindBlock=te,b.isTextKindBlockType=Da,b.isToday=Y5,b.isValidOffset=sn,b.isVisibleBlock=gh,b.isYesterday=J5,b.loadJs=w5,b.loadJsPromise=ws,b.lockers=To,b.mergeCommands=Bf,b.mergeDocs=Hs,b.mergeOps=kg,b.mergeText=UI,b.multiSplitText=X4,b.overflowText=K5,b.parseShortcut=H5,b.patchNode=xa,b.pointInRect=Bs,b.rangeAddAttribute=Pa,b.rangeGetTextColor=v6,b.rangeRemoveAttribute=Jl,b.rangeSetTextColor=C6,b.rangeTransformText=g6,b.registerDragDrop=Nm,b.removeAttribute=xg,b.removeClass=re,b.removeLastBr=NI,b.removePlaceholderFromBlock=N9,b.removeStyle=I5,b.replaceAll=mx,b.replaceAllCaseInsensitive=gx,b.replaceAllText=w6,b.replaceText=Lh,b.requestDownload=dh,b.resetListStart=vc,b.scrollable=G5,b.selectFile=ql,b.selectedBlockToDoc=Gh,b.selectionToDoc=Zh,b.setAttributes=ih,b.setClipboardData=qm,b.setClipboardDataByEvent=ux,b.setColorToAttributes=A6,b.setDataset=_m,b.setDefaultCursor=wa,b.setStyles=Fm,b.shareDBCommentToDocObject=Lp,b.shareDBDocCommentToComment=uv,b.shortcutToDisplayText=io,b.showBlock=l4,b.showDocVersions=XQ,b.splitText=Tn,b.splitToThree=Vt,b.stringToDataUrl=Vm,b.stringToObjectUrl=Wm,b.subText=e6,b.textNodeOffsetFromPoint=y5,b.titleFromEditor=R9,b.toBase64URL=Oi,b.toMindmap=Sf,b.toPlainText=st,b.toPlainTextKeepLength=Tg,b.trimChar=$m,b.unexclusiveBlock=m2,b.unicodeLength=VE,b.unicodeSubstr=WE,b.updateBlockSelection=y4,b.updateOpAttributes=k6,b.updateTextBlockContent=cT,b.updateUrl=Um;for(const n in vt)n!=="default"&&!b.hasOwnProperty(n)&&Object.defineProperty(b,n,{enumerable:!0,get:()=>vt[n]});Object.defineProperties(b,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
771
+ \`\`\`\`\`\``}return"[plantuml]"}const CZ={embedType:"plantuml",convertFrom:mZ,handleUpdateBlock:fZ,createEmbedContent:hZ,getBlockProperties:gZ,convertTo:pZ},ure="",AZ="hr",bZ={dividingLine:{type:"\u5206\u5272\u7EBF",abstract:"\u5206\u5272\u7EBF"}},vZ={dividingLine:{type:"Dividing-Line",abstract:"Dividing-Line"}},yZ={dividingLine:{type:"\u533A\u5207\u308A\u7DDA",abstract:"\u533A\u5207\u308A\u7DDA"}};L.mergeLang({"zh-CN":bZ,"en-US":vZ,"ja-JP":yZ});function kZ(n,e){const t=k("div",["editor-embed-container"],e);k("hr",["editor-embed-hr"],t)}function wZ(n,e,t,o){return o==="html"?"<hr />":o==="markdown"?"---":"------------"}function BZ(){return{name:"hr",insertEmbedCommandItems:[{id:"insert-hr",name:L.t("dividingLine.type"),icon:kM,order:500,group:"common",subText:An("insert-hr")}],handleInsertEmptyEmbed:async(n,e)=>{const{containerId:t,blockIndex:o}=e;return n.insertEmbed(t,o,AZ,{})}}}function EZ(n,e,t){const{data:o}=t;if(!o||o.embedType!=="dividing-line"||!te(n,e))return null;const r={};return{blockData:{id:K(),type:"embed",embedType:"hr",embedData:r}}}function xZ(){return{abstract:L.t("dividingLine.abstract")}}const IZ={embedType:"hr",createEmbedContent:kZ,convertTo:wZ,getOptions:BZ,convertFrom:EZ,getBlockProperties:xZ},dre="",hre="",TZ={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>'},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"}}},SZ={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>'},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"}}},DZ={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>'},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"}}};L.mergeLang({"zh-CN":TZ,"en-US":SZ,"ja-JP":DZ});var Go=(n=>(n.AUDIO="audio",n.VIDEO="video",n))(Go||{}),Xu=(n=>(n.Empty="empty",n.Progress="progress",n.Error="error",n))(Xu||{});const Sk=10*1024*1024,LZ=["wav","mp3","aac","ogg","webm","flac"],MZ=["ogg","mp4","webm"],RZ=()=>{};function Dk(n){var h,p,C,v,B,S;const e=(h=n.getComponentOptions("media"))!=null?h:{},{allowedMedias:t,maxSize:o,callbacks:r}=e,i=(p=t==null?void 0:t.audio)!=null?p:LZ,s=(C=t==null?void 0:t.video)!=null?C:MZ,l=(v=o==null?void 0:o.audio)!=null?v:Sk,a=(B=o==null?void 0:o.video)!=null?B:Sk,d=(S=r==null?void 0:r.onError)!=null?S:RZ;return{allowedMedias:{audio:i,video:s},maxSize:{audio:l,video:a},callbacks:{onError:d}}}function OZ(n,e){const t=i=>i.map(s=>`.${s}`).join(","),{allowedMedias:o}=Dk(n),r=o[e];return r?t(r):"*"}function _Z(n,e,t){const{maxSize:o,callbacks:r,allowedMedias:i}=Dk(e),{[t]:s}=o,{[t]:l}=i;if(s&&n.size>s){const d=new Error("media is too large");throw d.code=`MaxMediaSize-${t}`,r!=null&&r.onError&&(r==null||r.onError(e,d)),d}const a=Ia(n.name);if(l&&!l.includes(a)){const d=new Error(`media file is not allowed: ${a}`);throw d.code="NotAllowedFile",r!=null&&r.onError&&(r==null||r.onError(e,d)),d}}function FZ(n){return n===Xu.Empty||n===Xu.Error}const $t=D("media");class PZ extends vt.TypedEmitter{constructor(t){super();m(this,"mediaContainer",null);m(this,"media",null);m(this,"abstract",null);m(this,"handleMediaLoadError",(t,o)=>{if(!o.target||!(o.target instanceof Node)||!(o.target instanceof Element?o.target:o.target.parentElement))return;const i=ne(o.target);if(!i||!i.contains(this.mediaContainer))return;const s=this.renderError();this.updateMediaContent(s),this.emit("mediaError",t,"load_error",ie(i))});m(this,"handleUploadFile",async t=>{g($t,this.abstract,"no abstract"),g($t,this.mediaContainer,"The media element not exist");const{editor:o}=this.options,r=ne(this.mediaContainer);g($t,r,"The block element not exist");const i=o.getBlockData(r);try{const{resourceId:s}=await o.doc.uploadResource(t,{onProgress:p=>{this.renderProgress(p,t)}}),{name:l,type:a,size:d}=t,h={...i,embedData:{...i.embedData,src:s,fileName:l,fileSize:d,fileType:a}};o.updateBlockData(r,h)}catch(s){$t.error(s),this.emit("mediaError",o,"upload_error",i.id),this.renderRetry(t)}re(r,"media-block-uploading")});m(this,"destroy",()=>{this.mediaContainer=null});this.options=t}bindMediaEvent(){const{editor:t}=this.options;this.media&&t.domEvents.addEventListener(this.media,"error",this.handleMediaLoadError)}unbindMediaEvent(){const{editor:t}=this.options;this.media&&t.domEvents.removeEventListener(this.media,"error",this.handleMediaLoadError)}updateMediaContent(t){g($t,this.mediaContainer,"The media element not exist"),this.mediaContainer.innerHTML="",this.mediaContainer.append(t)}renderError(){g($t,this.abstract,"no abstract");const{editor:t,createMediaElement:o}=this.options,{mediaIcon:r,mediaName:i}=this.abstract;g($t,this.mediaContainer,"The media element not exist");const s=ne(this.mediaContainer);g($t,s,"The block element not exist");const l=t.getBlockData(s),a=l.embedData.src,d=k("div",["media-error","embed-selected-content","embed-hover-content"],null),h=k("span",["media-error-icon"],d);h.innerHTML=r;const p=k("div",[],d);p.innerHTML=L.t("media.load.failed",{name:i}),d.appendChild(p);const C=p.querySelector(".retry-upload");return g($t,C,"The element not exist"),t.domEvents.addEventListener(C,"click",(v,B)=>{const S=k("div",["media-element"],null),x=this.getResourceUrl(a),_=o(v,S,l,x);this.unbindMediaEvent(),this.media=_,this.bindMediaEvent(),this.updateMediaContent(S)}),this.setFullScreen(),d}renderRetry(t){g($t,this.abstract,"no abstract");const{editor:o}=this.options,{mediaIcon:r,mediaName:i}=this.abstract,s=k("div",["media-error","embed-selected-content","embed-hover-content"],null),l=k("span",["media-error-icon"],s);l.innerHTML=r;const a=k("div",[],s);a.innerHTML=L.t("media.upload.failed",{name:i}),s.appendChild(a);const d=a.querySelector(".retry-upload");g($t,d,"The element not exist"),o.domEvents.addEventListener(d,"click",()=>{o.readonly||(g($t,this.abstract,"no abstract"),this.handleUploadFile(t))}),this.updateMediaContent(s),this.setFullScreen()}renderProgress(t,o){g($t,this.mediaContainer,"The media element not exist");const r=this.mediaContainer.querySelector(":scope .media-progress"),i=t===-1||t===100?100:t;if(r){const{updateProgressElement:s}=this.options;s(r,i)}else{const{createProgressElement:s}=this.options,l=ne(this.mediaContainer);g($t,l,"The element not exist"),W(l,"media-block-uploading");const a=k("div",["media-progress"],null);s(a,i,o),this.updateMediaContent(a)}this.setFullScreen()}renderMediaElement(t){g($t,this.mediaContainer,"The media element not exist");const o=this.mediaContainer.querySelector(":scope > .media-element"),{createMediaElement:r,updateMediaElement:i,editor:s}=this.options,l=this.getResourceUrl(t.embedData.src);if(o){const a=i(s,o,t,l);this.unbindMediaEvent(),this.media=a,this.bindMediaEvent()}else{const a=k("div",["media-element"],null),d=r(s,a,t,l);this.unbindMediaEvent(),this.media=d,this.bindMediaEvent(),this.updateMediaContent(a)}}renderEmpty(t){g($t,this.abstract,"no abstract"),g($t,this.mediaContainer,"The media element not exist");const o=k("div",["media-empty","embed-selected-content","embed-hover-content"],this.mediaContainer);o.innerHTML=this.abstract.mediaIcon,this.updateMediaContent(o);const{editor:r}=this.options;r.findBlockById(t.id)&&this.emit("mediaError",r,"empty",t.id),this.setFullScreen()}getResourceUrl(t){const{editor:o}=this.options;return o.doc.buildResourceUrl(t)}setFullScreen(){g($t,this.mediaContainer,"The media element not exist"),W(this.mediaContainer,"full-screen")}removeFullScreen(){g($t,this.mediaContainer,"The media element not exist"),re(this.mediaContainer,"full-screen")}updateBlockAlign(t,o){const r=ne(o);g($t,r,"The block element not exist");const{align:i}=t;t.embedType==="video"&&(r.hasAttribute("data-style-align")&&r.removeAttribute("data-style-align"),r.setAttribute("data-style-align",i))}render(t,o){const{src:r}=t.embedData;(!this.mediaContainer||!o.contains(this.mediaContainer))&&(this.mediaContainer=k("div",["media"],o)),this.updateBlockAlign(t,o),FZ(r)?r===Xu.Empty&&this.renderEmpty(t):this.renderMediaElement(t)}setAbstract(t){this.abstract=t}}D("media-embed");const NZ="left";class Lk{constructor(){m(this,"handleInsertEmptyEmbed",async(e,t)=>{var p;const{containerId:o,blockIndex:r}=t;let i;(p=t.data)!=null&&p.file&&(i=t.data.file);const s=OZ(e,this.embedType);if(i=i!=null?i:await ql(s,{}),!i)return null;const{mediaType:l}=this.getAbstract();try{_Z(i,e,l)}catch{return null}const a={id:K(),type:"embed",embedType:this.embedType,embedData:{src:Xu.Empty}};l==="video"&&(a.align=NZ);const d=e.insertBlock(o,r,a);return await this.getMedia(e,a.id).handleUploadFile(i),d})}getMedia(e,t){const o=e.addCustom(`media-${t}`,()=>new PZ({editor:e,createMediaElement:this.createMediaElement,updateMediaElement:this.updateMediaElement,createProgressElement:this.createProgressElement,updateProgressElement:this.updateProgressElement}));return o.setAbstract({...this.getAbstract()}),o}getOptions(){const{menuItem:e,mediaIcon:t,mediaName:o,order:r,group:i}=this.getAbstract();return{name:o,insertEmbedCommandItems:[{id:`insert-${this.embedType}`,name:e,icon:t,order:r,group:i,subText:An(`insert-${this.embedType}`)}],handleInsertEmptyEmbed:this.handleInsertEmptyEmbed}}createEmbedContent(e,t,o){const{id:r}=o;this.getMedia(e,r).render(o,t)}handleUpdateBlock(e,t,o){const{id:r}=o,i=this.getMedia(e,r),s=Le(t);return i.render(o,s),!0}handleDeleteBlock(e,t){const o=t.id,r=this.getMedia(e,o);r.removeAllListeners(),r.destroy()}convertTo(e,t,o,r){const i=t.embedData,s=e.doc.buildResourceUrl(i.src,{withToken:!0});return r==="html"?`<${i.type} src="${s}" />`:r==="markdown"?`![${i.src}](${s})`:s}}function Mk(n,e){const t=k("div",["uploading-progress-mask"],n),o=k("div",["uploading-progress-bar"],t),r=k("div",["uploading-progress-bar-value"],o);r.style.width=`${e}%`}function Rk(n,e){const t=n.querySelector(".uploading-progress-bar-value");t&&(t.style.width=`${e}%`)}const $Z=D("media-audio");class HZ extends Lk{constructor(){super(...arguments);m(this,"embedType",Go.AUDIO);m(this,"updateProgressElement",Rk);m(this,"createMediaElement",(t,o,r,i)=>{const s=k("div",["audio-container","embed-hover-content","embed-selected-content"],o),l=k("audio",[],s);return l.innerHTML="Your browser does not support the <code>audio</code> element.",l.controls=!0,l.src=i,setTimeout(()=>{this.getMedia(t,r.id).setFullScreen()}),l})}getAbstract(){return{mediaIcon:bM,mediaName:L.t(`media.${Go.AUDIO}.menuItem`),menuItem:L.t(`media.${Go.AUDIO}.menuItem`),order:800,mediaType:Go.AUDIO,group:"common"}}getBlockProperties(){return{abstract:`${L.t(`media.${Go.AUDIO}.abstract`)}`}}updateMediaElement(t,o,r,i){const s=o.querySelector(":scope .audio-container > audio");return g($Z,s,"The media element not exist"),s.src!==i&&(s.src=i),s}createProgressElement(t,o){const r=k("audio",[],t);r.innerHTML="Your browser does not support the <code>audio</code> element.",r.controls=!0,r.src="about:blank",Mk(t,o)}}const jZ=new HZ;D("video-resizer");function Ok(n){return n&&It(n)&&fn(n)==="video"}const UZ=50;class lC{constructor(e){m(this,"currentResizableElement",null);m(this,"resizing",!1);m(this,"handleHoveringBlockChange",(e,t)=>{if(!this.resizing&&!window.isDragging&&(t&&Ok(t)&&this.disableBlockResize(t),e&&Ok(e))){const o=this.getVideoElement(e);if(!o)return;this.enableBlockResize(e,o)}});m(this,"handleResizing",(e,t)=>{if(this.resizing=!0,!this.currentResizableElement)return;const o=e.getBlock();if(!o)return;const r=o.getBoundingClientRect().width,i=Math.min(Math.max(t.width,UZ),r);this.currentResizableElement.style.width=`${i}px`,this.currentResizableElement.style.pointerEvents="none"});m(this,"handleResized",e=>{this.resizing=!1;const t=e.getBlock();if(!this.currentResizableElement||!t)return;const o=this.editor.getBlockData(t),{width:r}=this.currentResizableElement.getBoundingClientRect();this.currentResizableElement.style.pointerEvents="auto",this.editor.updateBlockData(t,{...o,width:r})});this.editor=e,Ct.get(e).addListener("change",this.handleHoveringBlockChange)}destroy(){this.currentResizableElement=null,Ct.get(this.editor).removeListener("change",this.handleHoveringBlockChange)}getVideoElement(e){return Le(e).querySelector(":scope .video-container > video")}updateResizer(e){const t=this.editor.findCustom(`${ie(e)}-resizer`);t&&t.updateResizer()}disableBlockResize(e){const t=this.editor.findCustom(`${ie(e)}-resizer`);t&&t.disableResize()}enableBlockResize(e,t){const o=this.editor.addCustom(`${ie(e)}-resizer`,()=>new _u(this.editor,{resize:["top-left","top-right","bottom-left","bottom-right"]}));o.enableResize(e,t),o.removeListener("resizing",this.handleResizing),o.removeListener("resized",this.handleResized),o.addListener("resizing",this.handleResizing),o.addListener("resized",this.handleResized),this.currentResizableElement=t}}const zZ=D("video");class VZ extends Lk{constructor(){super(...arguments);m(this,"embedType",Go.VIDEO);m(this,"updateProgressElement",Rk);m(this,"createMediaElement",(t,o,r,i)=>{const s=k("div",["video-container","embed-selected-content","drag-preview-element"],o),l=k("video",[],s);return l.innerHTML="Your browser does not support the <code>video</code> element.",l.controls=!0,l.src=i,l.addEventListener("canplay",()=>{t.addCustom("video-resizer",()=>new lC(t)),this.getMedia(t,r.id).removeListener("mediaError",this.handleMediaError),this.getMedia(t,r.id).addListener("mediaError",this.handleMediaError),this.getMedia(t,r.id).removeFullScreen()}),r.width&&(l.style.width=`${r.width}px`),l});m(this,"createProgressElement",(t,o,r)=>{const i=k("video",["progress-video"],t);i.innerHTML="Your browser does not support the <code>audio</code> element.",i.controls=!0,Mk(t,o),Wl(r).then(s=>{const l=t.querySelector(".progress-video");l&&ng(t)&&(l.src=s)})})}getAbstract(){return{mediaName:L.t(`media.${Go.VIDEO}.menuItem`),mediaIcon:vM,menuItem:L.t(`media.${Go.VIDEO}.menuItem`),order:700,mediaType:Go.VIDEO,group:"common"}}getBlockProperties(){return{abstract:`${L.t(`media.${Go.VIDEO}.abstract`)}`}}handleMediaError(t,o,r){const i=t.addCustom("video-resizer",()=>new lC(t)),s=t.getBlockById(r);i.disableBlockResize(s)}updateMediaElement(t,o,r,i){const s=o.querySelector(":scope .video-container > video");g(zZ,s,"The media element not exist"),s.src!==i&&(s.src=i),r.width?s.style.width=`${r.width}px`:s.style.width="";const l=t.getBlockById(r.id);return setTimeout(()=>{t.addCustom("video-resizer",()=>new lC(t)).updateResizer(l)}),s}}const WZ=new VZ,_k=[q0,n2,o2,W7],cC=[Bk,qq,eZ,aZ,CZ,LF,IZ,WZ,jZ,yj,sk,WV],Fk=[n9,ak,L8];function qZ(n,e,t){var r,i,s;const o=Ya(n,e,{components:{blocks:[..._k,...((r=t==null?void 0:t.components)==null?void 0:r.blocks)||[]],embeds:[...cC,...((i=t.components)==null?void 0:i.embeds)||[]],boxes:[...Fk,...((s=t.components)==null?void 0:s.boxes)||[]],textRenders:[new D0],options:{...t.componentsOptions}}});return o.readonly=!0,o.addCustom("heading-collapse",()=>new Z2(o)),o.addCustom("editor-tooltip",()=>new Pf(o)),o.addListener("clickLink",(l,a,d)=>{var p;if((p=t==null?void 0:t.events)!=null&&p.onClickLink){t.events.onClickLink(l,a,d);return}const h=d.getAttribute("link");h&&(l.readonly||a.ctrlKey||a.metaKey)&&window.open(h,"_blank")}),o}class Pk{constructor(e){this.createOptions=e,e.lang&&L.setLang(e.lang)}createHistoryEditor(e,t){return qZ(e,t,this.createOptions)}}D("create-editor");function Nk(n,{root:e,childDoc:t,doc:o}){var h,p;t.uploadResource=o.uploadResource.bind(o),t.buildResourceUrl=o.buildResourceUrl.bind(o);const r=n.getComponentOptions("comment"),i={image:{defaultAlign:"left"},toc:{showFirstBlock:!0},table:{locatingContainer:e,hideCellMenu:!0,hideToolbar:!0},...r==null?void 0:r.componentsOptions},s=[];n.editorBlocks.forEach(C=>{C.blockType==="text"||C.blockType==="embed"||s.push(C)});const l=[];n.editorEmbeds.forEach(C=>{l.push(C)});const a=[];n.editorBoxes.forEach(C=>{C.boxType==="text"||C.boxType==="br"||C.boxType==="image"||C.boxType==="anchor"||a.push(C)});const d=Ya(e,t,{shortcuts:[Yh],components:{blocks:s,commandProviders:[new bf],decorators:[new Wf],embeds:l,boxes:a,options:i}});if(d.input.addHandler(new Gf),d.input.addHandler(new w2(d)),d.input.addHandler(new T2(d)),d.input.addHandler(new Yz(d)),d.input.addHandler(new Kf),d.addCustom("image-paste-handler",()=>new k2(d)),(h=n.options.componentsOptions)!=null&&h.mention){const C=n.options.componentsOptions.mention;d.addCustom("mention",()=>new ck(d,{...C,enableFirstBlock:!0}))}if((p=n.options.componentsOptions)!=null&&p.comment){const C=n.options.componentsOptions.comment;C.onCommentEditorClick&&d.addListener("click",C.onCommentEditorClick)}return d}function GZ(n,e){const t=Array.from(n.rootContainer.querySelectorAll(`[comment-${e.toLocaleLowerCase()}="${e}"]`)),o=new Set;t.forEach(r=>{const i=ne(r);i&&o.add(i)}),o.forEach(r=>{Jz(n,r,e)})}class ZZ{constructor(e){m(this,"listeners",new Set);m(this,"doc");this.editor=e,this.doc=this.editor.doc.externalDoc,this.doc.registerCallback(this)}getComments(){return this.doc.getComments()}getComment(e){return this.doc.getComment(e)}getCommentDoc(e){return this.doc.getCommentDoc(e)}localCreateComment(e,t){this.doc.localCreateComment(e,t)}localDeleteComment(e){const t=this.getComment(e);this.doc.localDeleteComment(e);const o=t.groupId;this.getComments().filter(i=>i.groupId===o).length===0&&GZ(this.editor,o)}localUpdateComment(e,t){this.doc.localUpdateComment(e,t)}onCreateComment(e,t){Array.from(this.listeners.values()).forEach(o=>o.onCreateComment(e,t))}onDeleteComment(e,t){Array.from(this.listeners.values()).forEach(o=>o.onDeleteComment(e,t))}onUpdateComment(e,t){Array.from(this.listeners.values()).forEach(o=>o.onUpdateComment(e,t))}addListener(e){this.listeners.add(e)}removeListener(e){this.listeners.delete(e)}createCommentEditor(e,t){return Nk(this.editor,{root:e,childDoc:t,doc:this.doc})}allowEdit(e){return e.userId===this.doc.getUser().userId}}class QZ{constructor(e,t){m(this,"listeners",new Set);this.editor=e,this.localDoc=t}get doc(){return this.localDoc.toJSON()}getComments(){return Object.values(this.doc.comments)}getComment(e){return this.doc.comments[e]}getCommentDoc(e){const t=this.doc.comments[e];return Lp(t)}addListener(e){this.listeners.add(e)}removeListener(e){this.listeners.delete(e)}localCreateComment(e,t){}localDeleteComment(e){}localUpdateComment(e,t){}createCommentEditor(e,t){return Nk(this.editor,{root:e,childDoc:t,doc:this.localDoc})}allowEdit(e){return e.userId===this.localDoc.getUser().userId}}const YZ={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}"}},JZ={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}"}},KZ={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"}};L.mergeLang({"zh-CN":YZ,"en-US":JZ,"ja-JP":KZ});const XZ="UEsDBBQABgAIAAAAIQBk9WPugQEAACkGAAATAAgCW0NvbnRlbnRfVHlwZXNdLnhtbCCiBAIooAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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vcmQvZG9jdW1lbnQueG1sUEsBAi0AFAAGAAgAAAAhALb0Z5jSBgAAySAAABUAAAAAAAAAAAAAAAAAog8AAHdvcmQvdGhlbWUvdGhlbWUxLnhtbFBLAQItABQABgAIAAAAIQDlI7CA9QMAAKALAAARAAAAAAAAAAAAAAAAAKcWAAB3b3JkL3NldHRpbmdzLnhtbFBLAQItABQABgAIAAAAIQBAwf/xOQEAACMDAAAUAAAAAAAAAAAAAAAAAMsaAAB3b3JkL3dlYlNldHRpbmdzLnhtbFBLAQItABQABgAIAAAAIQA520VMuQUAACdaAAASAAAAAAAAAAAAAAAAADYcAAB3b3JkL251bWJlcmluZy54bWxQSwECLQAUAAYACAAAACEA+JXI7/wOAADzmQAADwAAAAAAAAAAAAAAAAAfIgAAd29yZC9zdHlsZXMueG1sUEsBAi0AFAAGAAgAAAAhAMySUFR9AQAA8QIAABEAAAAAAAAAAAAAAAAASDEAAGRvY1Byb3BzL2NvcmUueG1sUEsBAi0AFAAGAAgAAAAhACJREfHVAQAA3gMAABAAAAAAAAAAAAAAAAAA/DMAAGRvY1Byb3BzL2FwcC54bWxQSwECLQAUAAYACAAAACEAiD+lv+EAAABVAQAAGAAAAAAAAAAAAAAAAAAHNwAAY3VzdG9tWG1sL2l0ZW1Qcm9wczEueG1sUEsBAi0AFAAGAAgAAAAhAMEnywi2AAAAIQEAABMAAAAAAAAAAAAAAAAARjgAAGN1c3RvbVhtbC9pdGVtMS54bWxQSwECLQAUAAYACAAAACEAdD85esIAAAAoAQAAHgAAAAAAAAAAAAAAAABVOQAAY3VzdG9tWG1sL19yZWxzL2l0ZW0xLnhtbC5yZWxzUEsBAi0AFAAGAAgAAAAhAOuAYExTAwAAjw4AABIAAAAAAAAAAAAAAAAAWzsAAHdvcmQvZm9udFRhYmxlLnhtbFBLBQYAAAAADwAPANQDAADePgAAAAA=",eQ=()=>zm(XZ);async function tQ(n){return new Promise((e,t)=>{const o=new Image;o.onload=()=>{e({width:o.naturalWidth,height:o.naturalHeight})},o.onerror=t,o.src=n})}async function $k(n,e){if(n.width&&n.height)return{width:n.width,height:n.height,buffer:e};const t=await Wl(new File([e],"",{})),o=await tQ(t);return o.width===void 0||o.height===void 0?{width:345,height:230,buffer:e}:n.width||n.height?{width:n.width||o.width*n.height/o.height,height:n.height||o.height*n.width/o.width,buffer:e}:{width:o.width,height:o.height,buffer:e}}function nQ(n,e){let t=n.filter(s=>s!=null);const o=e-(t.length-1)*20,r=.87,i=t.reduce((s,l)=>s+l.width,0);return i>o&&(t=t.map(s=>({width:s.width*o/i,height:s.height*o/i,buffer:s.buffer}))),t.map(s=>({width:s.width*r,height:s.height*r,buffer:s.buffer}))}function Hk(n=[0,1,2,3,4,5,6,7],e=1){return n.map(t=>{let o;switch(t%3){case 0:o=ge.LevelFormat.DECIMAL;break;case 1:o=ge.LevelFormat.LOWER_LETTER;break;default:o=ge.LevelFormat.LOWER_ROMAN;break}return{level:t,format:o,text:`%${t+1}. `,alignment:ge.AlignmentType.START,start:e,style:{paragraph:{indent:{left:ge.convertInchesToTwip(.3*(t+1)),hanging:ge.convertInchesToTwip(.2)}}}}})}function oQ(){return[0,1,2,3,4,5,6,7].map(n=>{let e;switch(n%3){case 0:e="\u2022";break;case 1:e="\u25E6";break;default:e="\u25AA";break}return{level:n,format:ge.LevelFormat.BULLET,text:e,alignment:ge.AlignmentType.START,style:{paragraph:{indent:{left:ge.convertInchesToTwip(.3*(n+1)),hanging:ge.convertInchesToTwip(.2)}}}}})}function rQ(){return[0,1,2,3,4,5,6,7].map(n=>({level:n,format:ge.LevelFormat.BULLET,text:"\u2611",alignment:ge.AlignmentType.START,style:{paragraph:{indent:{left:ge.convertInchesToTwip(.3*(n+1)),hanging:ge.convertInchesToTwip(.2)}}}}))}function iQ(){return[0,1,2,3,4,5,6,7].map(n=>({level:n,format:ge.LevelFormat.BULLET,text:"\u2610",alignment:ge.AlignmentType.START,style:{paragraph:{indent:{left:ge.convertInchesToTwip(.3*(n+1)),hanging:ge.convertInchesToTwip(.2)}}}}))}var ed=(n=>(n.NUMBERING="number-numbering-reference",n.BULLET="number-bullet-reference",n.CHECKED="checked-bullet-reference",n.UNCHECKED="unchecked-bullet-reference",n))(ed||{});const sQ=[{levels:Hk(),reference:"number-numbering-reference"},{levels:oQ(),reference:"number-bullet-reference"},{levels:rQ(),reference:"checked-bullet-reference"},{levels:iQ(),reference:"unchecked-bullet-reference"}];function lQ(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 cQ(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 aQ(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 uQ=/rgb\((\d+),\s*(\d+),\s*(\d+)\)/;function jk(n){if(typeof n=="string"&&n.length>0){if(n[0]==="#")return n.substring(1);const e=n.match(uQ);if(e){const t=s=>{let l=Number(s).toString(16);return l.length<2&&(l=`0${l}`),l},o=t(e[1]),r=t(e[2]),i=t(e[3]);return`${o}${r}${i}`}if(n==="red")return"FF0000";if(n==="green")return"00FF00";if(n==="blue")return"0000FF"}}function en(n,e){if(n&&n.attributes&&n.attributes[e])return n.attributes[e];if(n&&n.attributes&&n.attributes.box&&n.attributes.inputType&&e==="style-underline")return!0}function Uk(n,e,t){for(let o=0;o<=t;++o){const r=`${e}${o}`;if(en(n,r))return r}}function b1(n,e,t){n.attributes=n.attributes||{},n.attributes[e]=t}function aC(n){return n==="image"||n==="drawio"||n==="plantuml"||n==="mermaid"||n==="flowchart"}function zk(n){return n&&n.startsWith("//")?`https:${n}`:n&&!n.startsWith("http://")&&!n.startsWith("https://")?`https://${n}`:n}function dQ(n){const e=en(n,"inlineStyle");if(e==null)return;const t=e.split(";");for(const o of t){const r=o.split(":");if(r.length!==2)continue;const i=r[0].trim().toLowerCase(),s=r[1].trim().toLowerCase();i==="font-size"&&b1(n,"inline-style-font-size",s),i==="color"&&b1(n,"inline-style-color",s),i==="background-color"&&b1(n,"inline-style-background-color",s),i==="font-family"&&b1(n,"inline-style-font-family",s)}}function hQ(n,e){if(e==null)return n==null?void 0:n.normal;if(n)return n[`heading${e}`]}function fQ(n){const e=`${en(n,"inline-style-font-size")}`;if(e&&e.indexOf("px")>0)return+e.replace(/px/g,"")}function mQ(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 gQ(n){if(n.attributes&&n.attributes.box&&n.attributes.text)return` @${n.attributes.text} `}function pQ(n){return en(n,"inline-style-font-family")}function CQ(n){const e=en(n,"inline-style-background-color");return jk(e)}function AQ(n){const e=en(n,"inline-style-color");return jk(e)}function bQ(n){dQ(n);const e=en(n,"type")==="mention";return{box:n.attributes&&n.attributes.box?n.attributes:void 0,inlineCode:!!en(n,"style-code"),link:zk(en(n,"link")),size:fQ(n),text:e?gQ(n):mQ(n)||n.insert,bold:!!en(n,"style-bold"),underline:!!en(n,"style-underline"),italics:!!en(n,"style-italic"),strike:!!en(n,"style-strikethrough"),superScript:!!en(n,"style-super"),subScript:!!en(n,"style-sub"),math:en(n,"type")==="math"?en(n,"src"):void 0,mention:e,fontFamily:pQ(n),background:CQ(n),color:e?"338fe5":lQ(Uk(n,"style-color-",6))||AQ(n),highlight:Uk(n,"style-bg-color-",13)}}function vQ(){return[new ge.Paragraph({border:{top:{color:"auto",style:ge.BorderStyle.DASHED,size:4,space:1}},spacing:{before:300}}),new ge.Paragraph({spacing:{line:0}})]}function yQ(){return new ge.Paragraph({children:[new ge.TextRun({text:"[\u89C6\u9891\u6682\u4E0D\u652F\u6301\u5BFC\u51FA]",shading:{type:ge.ShadingType.CLEAR,color:"FFFFFF",fill:"CCCCCC"}})]})}function kQ(){return new ge.Paragraph({children:[new ge.TextRun({text:"[\u97F3\u9891\u6682\u4E0D\u652F\u6301\u5BFC\u51FA]",shading:{type:ge.ShadingType.CLEAR,color:"FFFFFF",fill:"CCCCCC"}})]})}function wQ(n,e){return new ge.Paragraph({children:[new ge.ExternalHyperlink({children:[new ge.TextRun({style:"Hyperlink",text:e||n})],link:n})]})}function Vk(n){if(n.heading!=null)return`Heading${n.heading}`}function Wk(n){if(n.alignment!=null){if(n.alignment==="center")return ge.AlignmentType.CENTER;if(n.alignment==="right")return ge.AlignmentType.RIGHT;if(n.alignment==="left")return ge.AlignmentType.LEFT}}function BQ(n){if(n.indent)return{left:ge.convertInchesToTwip(.3*n.indent-.2)};if(n.padding)return{left:ge.convertInchesToTwip(.3*n.padding)}}function EQ(n){return{type:ge.ShadingType.CLEAR,color:"FFFFFF",fill:n}}function xQ(n){const e=n.split(",");if(e.length!==0)return e[0].trim()}function qk(n,e){let t;t=n.inlineCode?"InlineCode":void 0,t=n.link?"Hyperlink":t;const o=n.size||e,r=o!=null?Math.floor(o*1.5+.5):void 0;return new ge.TextRun({text:n.text,bold:n.bold||void 0,underline:n.underline?{type:ge.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:r,style:t,font:n.fontFamily?xQ(n.fontFamily):void 0,shading:n.background?EQ(n.background):void 0,color:n.color,highlight:cQ(n.highlight)})}function IQ(n,e){if(n.link)return new ge.ExternalHyperlink({children:[qk(n,e)],link:n.link})}async function Gk(n,e,t,o,r){const i=await r(n,e,t);if(i==null)return;const s=await $k({width:o||0,height:0,src:t},i);return new ge.ImageRun({data:i,transformation:{width:s.width||100,height:s.height||20}})}function TQ(n){if(n.heading||n.heading)return n.heading}function SQ(n){if(n.align&&(n.align==="center"||n.align==="right"||n.align==="left"))return n.align}function DQ(n){if(n.textOnly===!0&&n.level!=null)return n.level}async function LQ(n,e){var o;const t=[];if(n.text&&Array.isArray(n.text)){for(let r=0;r<n.text.length;r++){const i=n.text[r];if(((o=i.attributes)==null?void 0:o.box)===!0&&e){const s=await e(i);if(s){n.text.splice(r+1,0,...s);continue}}t.push(bQ(i))}return t}}function MQ(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 RQ(n,e){if(n.type==="embed"&&n.embedType&&aC(n.embedType)&&n.embedData&&n.embedData.src)return n.embedData.src.split("|").map(o=>{const r=e(o),i=n.embedData[`${r}_width`],s=n.embedData[`${r}_height`];return{src:o,width:i,height:s}})}function OQ(n){if(n.padding)return n.padding}function _Q(n){return!!(n.type==="embed"&&n.embedType&&aC(n.embedType)&&n.embedData&&n.embedData.src)}async function v1(n,e,t){return{quoted:!!n.quoted,heading:TQ(n),alignment:SQ(n),indent:DQ(n),padding:OQ(n),texts:await LQ(n,t),list:MQ(n),images:RQ(n,e),border:_Q(n)}}async function FQ(n,e,t,o){const r=[];if(!n.children)return[];for(const i of n.children){const s=[];for(const l of e.blocks[i])s.push(await v1(l,t,o));r.push(s)}return r}const PQ=D("to-docx");function NQ(n,e){return Array(n).fill(0).map(()=>Array(e).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 $Q(n,e,t,o){const r=!!n.hasColTitle,i=!!n.hasRowTitle,s=!!n.isStripeStyle,l="F5F8FB";for(let a=0;a<e;a++)for(let d=0;d<t;d++)(r&&d===0||i&&a===0||s&&a%2===1)&&(o[a][d].color=l)}function HQ(n){g(PQ,n.children,"no table children");const e=n.rows,t=n.cols,o=n.colsWidth;if(o)for(let s=0;s<o.length;s++)o[s]===0&&(o[s]=100);const r=NQ(e,t);let i=0;for(let s=0;s<e;++s)for(let l=0;l<t;++l){if(r[s][l].originalWidth=o?o[l]:void 0,r[s][l].from!==void 0)continue;const a=n.children[i];i+=1,r[s][l].cellId=a,r[s][l].color=aQ(n[`${a}_background`]),r[s][l].width=o?o[l]:100,r[s][l].align=n[`${a}_align`];const d=n[`${a}_rowSpan`]||1,h=n[`${a}_colSpan`]||1;if(r[s][l].rowSpan=d,r[s][l].colSpan=h,d>1||h>1){let p=0;for(let C=0;C<d;C++)for(let v=0;v<h;v++)C===0&&(p+=o?o[l+v]:80),!(C===0&&v===0)&&(r[s+C][l+v].from=[s,l]);r[s][l].width=p}}return $Q(n,e,t,r),r}async function jQ(n,e,t,o,r,i,s,l,a,d){async function h(v){if(l){const B=await l(r,i,v);if(B){await o.addDoc(n,B,d);return}}if(v.type==="text"||v.textOnly===!0){const B=await v1(v,s,a);await o.addTextBlock(B);return}if(v.type==="code"){const B=await FQ(v,t,s,a);await o.addCodeBlockObject(B);return}if(v.type==="list"&&v.textOnly!==!0){const B=await v1(v,s,a);await o.addListBlockObject(n,B);return}if(v.type==="embed"&&v.embedType){const B=v,S=B.embedData,x=B.embedType;if(aC(x)){const _=await v1(v,s,a);await o.addImagesBlockObject(v,_,d)}else v.embedType==="hr"?o.addSeparatorBlock():v.embedType==="video"?o.addVideoPlaceholder():v.embedType==="audio"?o.addAudioPlaceholder():v.embedType==="webpage"?o.addHyperlinkParagraph(zk(S.src),S.title):o.addOtherEmbedBlock(x,v.embedData);return}if(v.type==="table"){let B=[];if(v.colsWidth)B=v.colsWidth;else{const x=v.cols;B=new Array(x);for(let _=0;_<B.length;_++)B[_]=100;v.colsWidth=B}const S=HQ(v);await o.addTableMatrix(B,S,t),o.addEmptyParagraph()}}function p(v){const B=[];for(const{type:S,data:x}of v.embedData.exportSpec){if(S==="text"){const _={id:K(),text:[{insert:x}],type:"text"};B.push(_);continue}if(S==="image"){const _={id:K(),type:"embed",embedType:"image",align:"left",embedData:{src:x}};B.push(_);continue}if(S==="link"){const _={id:K(),type:"embed",embedType:"webpage",embedData:{src:x.url,title:x.title}};B.push(_);continue}}return B}function C(v){var B;return(B=v==null?void 0:v.embedData)!=null&&B.exportSpec?p(v):[v]}for(const v of e)for(const B of C(v))await h(B)}function UQ(){return{listMaxInst:1,listInstMap:{},listRefMap:{},levelConfigs:[]}}const zQ=D("to-docx");class VQ{constructor(e,t,o,r,i,s){m(this,"paragraphs");this.appId=e,this.docId=t,this.state=o,this.readImageFunc=r,this.convertBlocksFunc=i,this.defaultFontSize=s,this.paragraphs=[]}async addTextBlock(e){this.paragraphs.push(new ge.Paragraph({heading:Vk(e),alignment:Wk(e),children:await this.paragraphsFromBlockTexts(e),indent:BQ(e)}))}async addEmptyImagePlaceHolder(){this.paragraphs.push(new ge.Paragraph({text:`[${L.t("docx.imageExportFailed")}]`,shading:{type:ge.ShadingType.CLEAR,color:"FFFFFF",fill:"CCCCCC"}}))}async paragraphsFromBlockTexts(e){if(e.texts==null)return;const t=hQ(this.defaultFontSize,e.heading),o=[];for(const r of e.texts){if(r.link){const i=IQ(r,t);i&&o.push(i);continue}if(r.box&&r.box.type&&r.box.type==="br"){o.push(new ge.TextRun({text:"",break:1}));continue}if(r.box&&r.box.type&&r.box.type==="image"){const i=await Gk(this.appId,this.docId,r.box.src,r.box.width,this.readImageFunc);i&&o.push(i);continue}if(r.math){const i=await Gk(this.appId,this.docId,r.math,0,this.readImageFunc);i&&o.push(i);continue}o.push(qk(r,t))}return o}async addCodeBlockObject(e){for(const t of e)for(const o of t){const r={style:ge.BorderStyle.SINGLE,color:"#DEDEDE"};this.paragraphs.push(new ge.Paragraph({style:"Code",border:{left:{...r},right:{...r},top:{...r},bottom:{...r}},children:await this.paragraphsFromBlockTexts(o)}))}}async addListBlockObject(e,t){if(t.list==null)return;let o;const r=t.list.checkbox?`${e}-${t.list.groupId}-${t.list.checkbox}`:`${e}-${t.list.groupId}`;if(this.state.listInstMap[r])o=this.state.listInstMap[r];else if(o=this.state.listMaxInst,this.state.listMaxInst+=1,this.state.listInstMap[r]=o,t.list.start>0&&t.list.ordered){const s=`number-numbering-reference-${o}`,l=Hk([t.list.level-1],t.list.start);this.state.levelConfigs.push({levels:l,reference:s,inst:o}),this.state.listRefMap[r]=s}else t.list.ordered?this.state.listRefMap[r]=ed.NUMBERING:t.list.checkbox&&t.list.checkbox==="checked"?this.state.listRefMap[r]=ed.CHECKED:t.list.checkbox&&t.list.checkbox==="unchecked"?this.state.listRefMap[r]=ed.UNCHECKED:this.state.listRefMap[r]=ed.BULLET;const i=Vk(t);t.texts&&this.paragraphs.push(new ge.Paragraph({heading:i,children:await this.paragraphsFromBlockTexts(t),numbering:{reference:this.state.listRefMap[r],level:t.list.level-1,instance:o}}))}imageDimWithBufferToImageRun(e){return new ge.ImageRun({data:e.buffer,transformation:{width:e.width,height:e.height}})}async addImagesBlockObject(e,t,o){if(t.images==null){if(e.type==="embed"&&e.embedType==="image"){const{src:a}=e.embedData;a||this.addEmptyImagePlaceHolder()}return}const r=[],i=await Promise.all(t.images.map(async a=>{const d=await this.readImageFunc(this.appId,this.docId,a.src);if(d)return $k(a,d);r.push(a.src)})),s=nQ(i,o),l={style:ge.BorderStyle.SINGLE,color:"#DEDEDE"};s.length&&this.paragraphs.push(new ge.Paragraph({border:t.border?{left:{...l},right:{...l},top:{...l},bottom:{...l}}:void 0,alignment:Wk(t)||ge.AlignmentType.CENTER,children:s.map(a=>this.imageDimWithBufferToImageRun(a)).flatMap((a,d,h)=>a==null?[]:h.length-1!==d?[a,new ge.TextRun({text:" "})]:a)})),r.forEach(a=>{this.addHyperlinkParagraph(a)})}addSeparatorBlock(){vQ().forEach(e=>this.paragraphs.push(e))}addEmptyParagraph(){this.paragraphs.push(new ge.Paragraph(""))}addVideoPlaceholder(){this.paragraphs.push(yQ())}addAudioPlaceholder(){this.paragraphs.push(kQ())}addHyperlinkParagraph(e,t){e!=null&&this.paragraphs.push(wQ(e,t))}async addTableMatrix(e,t,o){const r=e.map(i=>i!==0?i*15:1500);this.paragraphs.push(new ge.Table({rows:await this.generateTableRows(t,o),columnWidths:r}))}async generateRowCells(e,t){const o=[];for(const r of e){const i=r.cellId;if(i===void 0)continue;const s=r.width*.9;o.push(new ge.TableCell({children:await this.convertBlocksFunc(i,t.blocks[i],t,this.appId,this.docId,this.state,s),columnSpan:r.colSpan,rowSpan:r.rowSpan,width:{type:ge.WidthType.DXA,size:r.width*15},shading:r.color?{fill:r.color,type:ge.ShadingType.CLEAR,color:"auto"}:void 0}))}return o}async generateTableRows(e,t){const o=[];for(const r of e)o.push(new ge.TableRow({children:await this.generateRowCells(r,t)}));return o}async addDoc(e,t,o){const r=await this.convertBlocksFunc(e,t.blocks.root,t,this.appId,this.docId,this.state,o);r&&(this.paragraphs=this.paragraphs.concat(r))}async addOtherEmbedBlock(){}}class WQ{constructor(e,t,o,r,i,s,l,a){m(this,"convertBlocks",async(e,t,o,r,i,s,l=720)=>{const a=new VQ(r,i,s,this.readImage,this.convertBlocks,this.defaultFontSize);return await jQ(e,t,o,a,r,i,this.md5HexFunc,this.getDocByBlock,this.getTextsByBox,l||720),a.paragraphs});this.templateData=e,this.docData=t,this.md5HexFunc=o,this.readImage=r,this.defaultFontSize=i,this.getDocByBlock=s,this.getTextsByBox=l,this.backgroundImageOptions=a}async convert(e,t){return this.snapshot2docx(this.docData,e,t)}async snapshot2docx(e,t,o){const r=new ge.ImportDotx,i=this.templateData?await r.extract(this.templateData):void 0,s=e.blocks.root;g(zQ,s,"data must have blocks");const l=UQ(),a=await this.convertBlocks("blocks",s,e,t,o,l),d=this.backgroundImageOptions?{default:new ge.Header({children:[new ge.Paragraph({children:[new ge.ImageRun(this.backgroundImageOptions)]})]})}:{},h=new ge.Document({numbering:{config:[...sQ,...l.levelConfigs]},sections:[{headers:d,children:a,properties:{page:{size:{width:12240,height:15840},margin:{top:1440,bottom:1440,left:1440,right:1440}}}}]},{template:i});return ge.Packer.toBlob(h)}}async function qQ(n,e,t,o){const r=n.doc.buildResourceUrl(o,{withToken:!0});let i=await O9(r);if(!i)return;if(i.type.indexOf("/svg")!==-1){const l=await L9(i);l&&(i=new File([l],i.name))}return await i.arrayBuffer()}async function GQ(n,e,t){const o=n.editorBlocks.getBlockClass(t.type);if(o.toStandardDoc)return o.toStandardDoc(n,t,e)}async function ZQ(n,e){const t=e.attributes,o=n.editorBoxes.getBoxClass(t.type);if(o.toStandardText)return o.toStandardText(n,t)}async function QQ(n,e){let{template:t,download:o,backgroundImageOptions:r}=e!=null?e:{};t||(t=eQ());const i=n.doc.toJSON(),s=(p,C,v)=>qQ(n,p,C,v),l=async(p,C,v)=>GQ(n,i,v),a=async p=>ZQ(n,p),h=await new WQ(t,i,Jd.default,s,void 0,l,a,r).convert("_appId","_docId");if(o){const p=URL.createObjectURL(h),C=document.createElement("a");C.setAttribute("download",`${R9(n)}.docx`),C.setAttribute("href",`${p}`),C.click(),C.remove()}return h}const uC=D("create-editor");async function YQ(n,e){var s,l,a,d,h,p,C,v,B,S,x,_,R,H;g(uC,n,"app does not exists"),e.lang&&L.setLang(e.lang),Ri.level=(s=e.logLevel)!=null?s:ba.DEBUG;const t=e.onReauth?async()=>{var fe;const z=e.user.userId,Q=e.docId,ee=await((fe=e.onReauth)==null?void 0:fe.call(e,z,Q,e.permission));return{userId:z,docId:Q,permission:e.permission,appId:e.appId,token:ee,displayName:e.user.displayName,avatarUrl:e.user.avatarUrl}}:void 0,o={auth:{appId:e.appId,docId:e.docId,userId:e.user.userId,permission:e.permission,token:e.token,displayName:e.user.displayName,avatarUrl:e.user.avatarUrl},serverUrl:e.serverUrl,reauthFunc:t,disableLogout:e.disableLogout},r=await uu.load(o),i=Ya(n,r,{id:e.id,scrollContainer:e==null?void 0:e.scrollContainer,enableComments:e==null?void 0:e.enableComments,components:{blocks:[..._k,...((l=e==null?void 0:e.components)==null?void 0:l.blocks)||[]],embeds:[...cC,...((a=e.components)==null?void 0:a.embeds)||[]],boxes:[...Fk,...((d=e.components)==null?void 0:d.boxes)||[]],commandProviders:[new bf,...((h=e.components)==null?void 0:h.commandProviders)||[]],decorators:[new Wf,new Rp],insertions:[_g],blockHooks:[new p2,new hy,...((p=e.components)==null?void 0:p.blockHooks)||[]],textRenders:[new w8,new D0],options:{...e.componentsOptions}},shortcuts:[gV,KN,cj,G0,Xy,b_,U0,JV,Yh,h_,...e.shortcuts||[]],colors:["#338FE5","#24B47E","#F0A100","#E52727","#9678D3","#2CB2AE","#EB6414","#8AAB3F"]});if(i.editorCommandProviders.registerCommandProvider(new xr(i)),i.input.addHandler(new HW),i.input.addHandler(new Gf),i.input.addHandler(new FF),i.input.addHandler(new oj),i.input.addHandler(new Ru(i,{headingLevel:1,titlePlaceholder:L.t("placeholder.common.title"),contentPlaceholder:L.t("placeholder.common.content"),readonlyTitlePlaceholder:L.t("placeholder.common.readonlyTitle"),addPlaceholderToAllCurrentEmptyBlock:!0})),i.input.addHandler(new Ff(i,(C=e.componentsOptions)==null?void 0:C.quickMenu)),i.input.addHandler(new w2(i)),i.input.addHandler(new T2(i)),i.input.addHandler(new ZN),i.input.addHandler(new Kf),i.doc.registerCallback(new jW(i)),i.addCustom("remote-cursor",()=>new hv(i)),i.addCustom("block-menu",z=>new gy(z)),i.addCustom("editor-tooltip",()=>new Pf(i)),e!=null&&e.enableComments&&i.addCustom("editor-comments",z=>new k8(z,new ZZ(z))),i.addCustom("create-options",()=>new d5(i,e)),i.addCustom("drop-target",()=>new zu(i)),i.addCustom("list-to-mindmap",()=>new Df(i)),i.addCustom("list-to-mention",()=>new lq(i)),i.addCustom("mobile-helper",()=>new Bq(i)),i.addCustom("code-caret",()=>new GN(i)),i.addCustom("image-paste-handler",()=>new k2(i)),(v=e.componentsOptions)!=null&&v.mention){const z=e.componentsOptions.mention;i.addCustom("mention",()=>new ck(i,z))}if(i.addCustom("heading-collapse",()=>new Z2(i)),wc.register(i),zu.register(i),os.register(i),es.register(i),i.addListener("clickLink",(z,Q,ee)=>{var ve;if((ve=e==null?void 0:e.events)!=null&&ve.onClickLink){e.events.onClickLink(z,Q,ee);return}const fe=ee.getAttribute("link");fe&&(z.readonly||Q.ctrlKey||Q.metaKey)&&window.open(fe,"_blank")}),(S=(B=e.componentsOptions)==null?void 0:B.remoteCarets)!=null&&S.onUserChanged){const z=(_=(x=e.componentsOptions)==null?void 0:x.remoteCarets)==null?void 0:_.onUserChanged;i.doc.getRemoteUsers().on("change",Q=>{z(i,Q)})}return(H=(R=e.componentsOptions)==null?void 0:R.templates)!=null&&H.templates.length&&(i.addListener("docChanged",()=>{C1(i)}),i.addListener("resize",()=>{C1(i,{reset:!0})}),setTimeout(()=>{C1(i)},100)),i.doc.registerCallback({onError:async z=>{if(z.code==="ResetDoc"){uC.error(`reset doc: ${z.message}`);const Q=await uu.load(o);i.doc.reset(Q)}}}),i}function JQ(n){return n.toJSON!==void 0}async function KQ(n,e,t){var i,s,l,a,d;g(uC,n,"app does not exists");const o=JQ(e)?e:new hp(e,{serverUrl:t.serverUrl||""});t.lang&&L.setLang(t.lang);const r=Ya(n,o,{id:t.id,scrollContainer:t==null?void 0:t.scrollContainer,components:{blocks:[q0,n2,o2,W7],commandProviders:[new bf],decorators:[new Wf,new Rp],embeds:[...cC,...((i=t.components)==null?void 0:i.embeds)||[]],boxes:[n9,ak,L8,...((s=t.components)==null?void 0:s.boxes)||[]],insertions:[_g],blockHooks:[new p2,...((l=t.components)==null?void 0:l.blockHooks)||[]],textRenders:[new w8,new D0,...((a=t.components)==null?void 0:a.textRenders)||[]],options:{...t.componentsOptions}},shortcuts:[G0,Xy,U0,Yh]});return r.editorCommandProviders.registerCommandProvider(new xr(r)),r.input.addHandler(new Gf),r.input.addHandler(new Ru(r,{headingLevel:1,titlePlaceholder:L.t("placeholder.common.title"),contentPlaceholder:L.t("placeholder.common.content"),readonlyTitlePlaceholder:L.t("placeholder.local.readonlyTitle"),addPlaceholderToAllCurrentEmptyBlock:!0})),r.input.addHandler(new Ff(r,(d=t.componentsOptions)==null?void 0:d.quickMenu)),r.input.addHandler(new w2(r)),r.input.addHandler(new T2(r)),r.input.addHandler(new Kf),r.addCustom("block-menu",h=>new gy(h)),r.addCustom("editor-tooltip",()=>new Pf(r)),r.addCustom("image-paste-handler",()=>new k2(r)),t!=null&&t.enableComments&&r.addCustom("editor-comments",h=>new k8(h,new QZ(h,o))),r.addCustom("heading-collapse",()=>new Z2(r)),r.addListener("clickLink",(h,p,C)=>{var B;if((B=t==null?void 0:t.events)!=null&&B.onClickLink){t.events.onClickLink(h,p,C);return}const v=C.getAttribute("link");v&&(h.readonly||p.ctrlKey||p.metaKey)&&window.open(v,"_blank")}),wc.register(r),r}function XQ(n,e){var a;const t=n.doc;if(!((a=t.getVersionHelper)==null?void 0:a.call(t)))throw new Error("the editor does not support to show versions");const r=n.getCustom("create-options");if(!r)throw new Error("the editor does not support to show versions");const i=r.getData(),s=new Pk(i),l=n.addCustom("version-dialog",()=>new G8(n.doc,s));return l.show(e),l}b.tippy=iE,b.AnchorBox=F6,b.AuthError=df,b.AuthHeader=au,b.AutoScroll=hh,b.BaseURLHeader=hf,b.BasicCommands=lF,b.BlockExclusiveHook=hy,b.BlockLockerHook=p2,b.BlockLockerPasteHandler=Kf,b.BlockResizer=_u,b.BrBox=M6,b.CodeBlock=n2,b.CodeLineBlock=o2,b.CodeTextDecorator=Wf,b.DefaultShortcuts=Yh,b.DocIdError=IL,b.DragDrop=L5,b.DrawioEmbed=Bk,b.EditorBlocks=N4,b.EditorBoxes=O6,b.EditorCommandProviders=Bb,b.EditorComplexBlockPosition=Oo,b.EditorComplexSelectionRange=lr,b.EditorDecorators=H6,b.EditorEmbeds=H4,b.EditorInsertions=$6,b.EditorSimpleBlockPosition=Ut,b.EditorSimpleSelectionRange=Yt,b.EmbedBlock=U4,b.EmbedBlockResizer=Ju,b.EnforceWithDocumentTitleHandler=Ru,b.EventCallbacks=va,b.FILL_CHAR=qI,b.FileExtError=TL,b.GroupOrder=Q7,b.HeadingBlockScrollListener=tq,b.ImageBox=_6,b.InlineBoxCommandProvider=o9,b.InputtingInsertion=P6,b.LocalDoc=hp,b.LogLevel=ba,b.Logger=Ri,b.MIN_DISTANCE_THRESHOLD=S5,b.ManualCloseDialog=gu,b.ManualMenu=Vs,b.ManualToolbar=mu,b.MarkdownInputHandler=Gf,b.MaxUserError=Ep,b.Mindmap=x0,b.OnesEditorAutoSuggest=Jp,b.OnesEditorCustomDataWrapper=d5,b.OnesEditorExclusiveBlock=es,b.OnesEditorHoveringBlock=Ct,b.OnesEditorQuickMenu=Ff,b.OnesEditorToc=Ku,b.OnesEditorTocProvider=os,b.OnesEditorToolbar=wc,b.OnesEditorTooltip=Pf,b.OnesEditorVersionsDialog=G8,b.PermissionError=xL,b.Popup=fu,b.RemoteCarets=hv,b.RemoteCaretsDecorator=Rp,b.RemoteCaretsInsertion=_g,b.RemoteUsers=of,b.RequestReloadError=cu,b.RichText=ln,b.ShareDBDoc=uu,b.ShareDBDocVersionsProvider=Pk,b.SimpleCache=b5,b.StandardEmbedBlockCommands=j2,b.TEXT_STYLE_BACKGROUND_COLOR_PREFIX=Eg,b.TEXT_STYLE_COLOR_PREFIX=Bg,b.TableBlock=q0,b.TableBlockCommandProvider=bf,b.TableShortcuts=G0,b.TextBlock=Sn,b.TextBox=L6,b.TextStyleShortcuts=U0,b.TocEmbed=sk,b.ZERO_WIDTH_SPACE_CHAR=ya,b.abbreviation=fh,b.addAttribute=Dh,b.addClass=W,b.addCommentToBlock=Yu,b.addDays=hx,b.addMetaToDoc=Kh,b.addMonths=dx,b.animateScrollTo=sh,b.applyPlaceholderToBlock=Zf,b.assert=g,b.autoShowHideTemplates=C1,b.blockToDoc=up,b.blockToHtml=$g,b.blockToMarkdown=Hg,b.blockToText=Nh,b.blocksToDoc=dS,b.clearAllSelection=v4,b.clientType=Zt,b.cloneBlock=Hi,b.cloneChildContainer=Yg,b.cloneDoc=Jg,b.cloneText=y6,b.commentToShareDbComment=Mp,b.compareElement=rh,b.comparePosition=dg,b.complexBlockAdjustSelectionPos=kh,b.complexBlockFindNearestChildBlock=q4,b.complexBlockGeFirstSimpleChild=fg,b.complexBlockGetAllChildContainers=gn,b.complexBlockGetBottomChildContainers=W4,b.complexBlockGetLastSimpleChild=Ql,b.complexBlockGetSelectedContainers=Zl,b.complexBlockGetTopChildContainers=V4,b.containerToDoc=eb,b.continuousScroll=Z5,b.convertBlockFrom=Ch,b.convertImageFileToPng=L9,b.convertImageSrcToPng=pN,b.converterIntercept=qf,b.copyBlockAttributes=X6,b.createBlockAnchor=Zr,b.createBlockCaretAnchor=Y4,b.createBlockContentElement=Ss,b.createBlockElement=a4,b.createBlockSimpleDocRange=Oh,b.createBlockSimpleRange=kt,b.createBoxContentElement=h4,b.createBoxElement=u4,b.createBoxOp=h6,b.createChildContainer=F4,b.createComplexBlockPosition=ft,b.createComplexDocPos=I6,b.createComplexDocRange=QI,b.createContainer=B6,b.createContainerElement=lg,b.createDeleteOps=c6,b.createEditor=Ya,b.createEditorSelectionRange=zt,b.createElement=k,b.createEmptyContainer=Jr,b.createEmptyDoc=Yr,b.createEmptyTextBlockData=Mh,b.createExpandedRange=nh,b.createIconButton=Ul,b.createImage=Rm,b.createInsertOps=Th,b.createInsertionContentElement=g4,b.createInsertionElement=f4,b.createLocalEditor=KQ,b.createOnesEditor=YQ,b.createRange=v5,b.createRichText=Ni,b.createRootContainer=_4,b.createSimpleBlockPosition=se,b.createSimpleDocPos=x6,b.createTextBlockData=dr,b.createTextButton=Ys,b.createTextOp=uo,b.createTextWithReplaceSoftReturn=yg,b.daysAfter=Gm,b.deleteText=wg,b.diffDays=fx,b.disablePageScroll=U5,b.docToHtml=Z6,b.docToHtmlFragment=$h,b.docToMarkdown=Ua,b.docToText=ja,b.downloadImageToFile=O9,b.downloadObjectToFile=tC,b.downloadSvgToString=gk,b.editLink=xu,b.editorAddComment=Xz,b.editorAddTextAttribute=uA,b.editorAutoInsertBlock=eA,b.editorBreakTextBlock=tc,b.editorClearCompositionText=K6,b.editorClearSelectedContents=Zg,b.editorCopyBlock=Xh,b.editorDeleteBlock=qg,b.editorDeleteBlockText=Vg,b.editorDeleteBlockWithoutChildren=Uh,b.editorDeleteChildContainer=zT,b.editorDeleteChildContainers=tA,b.editorFocusToBlock=Qg,b.editorFocusToEnd=aS,b.editorGetBlockData=$i,b.editorGetBlockText=pn,b.editorGetBlockTextEx=Fh,b.editorGetBoxData=S6,b.editorHandleKeyboardEvent=rb,b.editorInsertBlock=ec,b.editorInsertBoxToBlock=Y6,b.editorInsertDoc=cA,b.editorInsertDocAt=Kg,b.editorInsertText=zg,b.editorInsertTextToBlock=Q6,b.editorInsertTextToBlockEx=Ug,b.editorMergeTextBlock=nA,b.editorMoveDown=wA,b.editorMoveEnd=ip,b.editorMoveHome=RA,b.editorMoveLeft=vA,b.editorMoveLineEnd=jA,b.editorMoveLineHome=HA,b.editorMovePageDown=GA,b.editorMovePageUp=qA,b.editorMoveRight=yA,b.editorMoveUp=kA,b.editorMoveWordEnd=DA,b.editorMoveWordLeft=SA,b.editorRangeClearColor=hA,b.editorRangeGetColor=fA,b.editorRangeSetColor=dA,b.editorRemoveTextAttribute=GT,b.editorReplaceBlockText=Vh,b.editorReplaceContainer=aA,b.editorRunOnce=fp,b.editorSelectAll=KA,b.editorSelectContainer=cp,b.editorSelectDown=BA,b.editorSelectEnd=sp,b.editorSelectHome=OA,b.editorSelectLeft=EA,b.editorSelectLineEnd=$A,b.editorSelectLineHome=NA,b.editorSelectPageDown=QA,b.editorSelectPageUp=ZA,b.editorSelectRight=xA,b.editorSelectUp=IA,b.editorSelectWordEnd=MA,b.editorSelectWordLeft=LA,b.editorSetTextColor=nc,b.editorShowFindDialog=iz,b.editorToDocx=QQ,b.editorUpdateBlockData=Wh,b.editorUpdateCompositionText=J6,b.editorUpdateEmbedData=sA,b.enablePageScroll=z5,b.escapeHtmlText=x5,b.escapeRegExp=Jm,b.escapeSpace=QE,b.exclusiveBlock=f2,b.executeBlockCommand=S4,b.executeEmbedBlockCommand=T4,b.executeRangeCommand=wb,b.fileToDataUrl=Wl,b.findAfterOffsetNotType=Mg,b.findAllText=Sg,b.findEventTargetBlock=B5,b.findInsertionById=m4,b.findNextOffset=hT,b.findNextVisibleSimpleBlock=Sb,b.findPrevOffset=dT,b.findPrevOffsetNotType=Lg,b.findPrevSimpleBlockBeforeChildContainer=z4,b.findPrevVisibleSimpleBlock=Tb,b.findTarget=zl,b.findWordEnd=Og,b.findWordLeft=Rg,b.format=Ta,b.formatBytes=Q5,b.formatDate=Qm,b.fragmentToHtml=V5,b.fromBase64=Ea,b.fromBase64ToBlob=zm,b.fromBase64ToUint8Array=sx,b.fromDocRange=Fi,b.fromNowString=Ym,b.genId=K,b.getAllChildBlocks=gg,b.getAllQuickMenuItems=j0,b.getAllSelectedBlocks=cr,b.getAttributesAt=Na,b.getBlockBackground=c4,b.getBlockByIndex=Ur,b.getBlockCaretRect=Mo,b.getBlockClass=Ye,b.getBlockClassByType=Rs,b.getBlockClientRects=Vr,b.getBlockCommandsWithHook=ig,b.getBlockContent=Le,b.getBlockId=ie,b.getBlockIndex=be,b.getBlockInfo=Hu,b.getBlockKind=Lo,b.getBlockMinWidth=k4,b.getBlockNearestRangeFromPoint=Q4,b.getBlockOptions=Bx,b.getBlockPath=_i,b.getBlockProperties=E4,b.getBlockRangeFromPoint=wh,b.getBlockStyles=wx,b.getBlockTextLength=ue,b.getBlockTools=tt,b.getBlockType=Se,b.getBoxContent=eg,b.getBoxId=d4,b.getBoxTypeFromElement=Sa,b.getChildBlockCount=So,b.getChildBlocks=mt,b.getChildOffset=Fs,b.getColorFromAttributes=Ig,b.getColorFromContent=mh,b.getComplexBlockClass=zn,b.getContainerBlockPath=M4,b.getContainerBlocks=b4,b.getContainerBlocksElement=vh,b.getContainerById=sr,b.getContainerId=ce,b.getContainerMinWidth=ag,b.getContainerToolsElement=Sx,b.getContainerWidth=P4,b.getDistanceSquare=or,b.getElementOffset=ka,b.getElementScale=ro,b.getEmbedType=fn,b.getExistsBlockTools=ph,b.getExistsContainerById=bh,b.getFileExt=Ia,b.getFirstChildBlock=yt,b.getFirstClientRect=oh,b.getHeadingMenuOptions=P0,b.getHorizontalPadding=Om,b.getInsertionContent=tg,b.getLastChildBlock=Qt,b.getLastClientRect=ks,b.getListAllNextBrothers=Ac,b.getLogger=D,b.getNextBlock=Qe,b.getNextValidOffset=Ps,b.getNextVisibleBlock=Ls,b.getOffsetInfoAfter=Ha,b.getOffsetInfoBefore=Ph,b.getOpAt=m6,b.getOpLength=Sh,b.getParentBlock=ne,b.getParentBlockExcludeSelf=Ts,b.getParentBox=Xm,b.getParentContainer=oe,b.getPrevBlock=at,b.getPrevValidOffset=Pi,b.getPrevVisibleBlock=Ds,b.getRangeCommands=yb,b.getRootBlock=rg,b.getScrollContainer=so,b.getSpecialBlockCommands=x4,b.getStandardEmbedBlockProperties=U2,b.getTextAfterOffset=aT,b.getTextAttributes=jg,b.getTextBeforeOffset=uT,b.getTextBlockChild=Ah,b.getTextBlockClass=C4,b.getTextBlockContentChildTextLength=ao,b.getTextBlockContentChildType=D4,b.getTextBlockContentChildren=ir,b.getTextLength=rn,b.getTextOpLength=pg,b.getTextWidth=ah,b.getToolbar=Ef,b.handleBlockElementUpdated=w4,b.hasAltOnly=tx,b.hasClass=xe,b.hasCtrlOrCmd=P5,b.hasCtrlOrCmdOnly=ex,b.hashCode=n4,b.hideBlock=s4,b.htmlToFragment=ch,b.i18n=L,b.injectDocToHtmlFragment=Jh,b.injectStyle=T5,b.insertEmptyBlock=Ix,b.insertEmptyEmbedBlock=sg,b.insertText=Qr,b.intersectionCommands=gD,b.isBackspace=$5,b.isBlock=Is,b.isBlockLocked=Jf,b.isBlockLockedByOthers=g2,b.isBlockLockedBySelf=ju,b.isBlockTools=i4,b.isBox=Km,b.isCJK=_5,b.isChildContainer=Ro,b.isChildNode=et,b.isCodeBlock=yr,b.isCollapsedRange=ZI,b.isComplexBlockPosition=Gl,b.isComplexKindBlock=Me,b.isContainer=zr,b.isContainerSelectedAllChildBlocks=YA,b.isControlEvent=Es,b.isDelete=ox,b.isDraggingFiles=uh,b.isElementVisible=Pm,b.isEmbedBlock=It,b.isEmptyContainer=Ra,b.isEmptyDoc=Dg,b.isEmptyTextBlock=ut,b.isEmptyTextBlockWithoutCompositionText=Mu,b.isEnterOnly=N5,b.isEscape=jm,b.isExclusiveBlock=$u,b.isFirefox=Ba,b.isFirstChildBlockInComplexBlock=lI,b.isHighSurrogate=zE,b.isInBlock=ng,b.isInBlockTools=Ms,b.isLetter=O5,b.isLowSurrogate=Mm,b.isMatchShortcut=rr,b.isMoveForward=KE,b.isNavigationEvent=JE,b.isNavigationKey=F5,b.isNodeRemoved=k5,b.isNumber=R5,b.isPrintableKey=Hm,b.isRootBlock=lo,b.isRootContainer=Ge,b.isSafari=Vl,b.isSameDay=Zm,b.isSecureEnv=e2,b.isShiftEnter=nx,b.isShiftTab=ix,b.isShortcutEvent=XE,b.isSimpleBlock=kx,b.isSimpleBlockPosition=Gr,b.isSimplePos=E6,b.isSimpleRange=Rh,b.isSpace=lh,b.isTab=rx,b.isTextBlockContentBoxChild=co,b.isTextBlockContentChild=La,b.isTextBlockContentInsertionChild=qr,b.isTextBlockContentTextChild=Ma,b.isTextKindBlock=te,b.isTextKindBlockType=Da,b.isToday=Y5,b.isValidOffset=sn,b.isVisibleBlock=gh,b.isYesterday=J5,b.loadJs=w5,b.loadJsPromise=ws,b.lockers=To,b.mergeCommands=Bf,b.mergeDocs=Hs,b.mergeOps=kg,b.mergeText=UI,b.multiSplitText=X4,b.overflowText=K5,b.parseShortcut=H5,b.patchNode=xa,b.pointInRect=Bs,b.rangeAddAttribute=Pa,b.rangeGetTextColor=v6,b.rangeRemoveAttribute=Jl,b.rangeSetTextColor=C6,b.rangeTransformText=g6,b.registerDragDrop=Nm,b.removeAttribute=xg,b.removeClass=re,b.removeLastBr=NI,b.removePlaceholderFromBlock=N9,b.removeStyle=I5,b.replaceAll=mx,b.replaceAllCaseInsensitive=gx,b.replaceAllText=w6,b.replaceText=Lh,b.requestDownload=dh,b.resetListStart=vc,b.scrollable=G5,b.selectFile=ql,b.selectedBlockToDoc=Gh,b.selectionToDoc=Zh,b.setAttributes=ih,b.setClipboardData=qm,b.setClipboardDataByEvent=ux,b.setColorToAttributes=A6,b.setDataset=_m,b.setDefaultCursor=wa,b.setStyles=Fm,b.shareDBCommentToDocObject=Lp,b.shareDBDocCommentToComment=uv,b.shortcutToDisplayText=io,b.showBlock=l4,b.showDocVersions=XQ,b.splitText=Tn,b.splitToThree=Vt,b.stringToDataUrl=Vm,b.stringToObjectUrl=Wm,b.subText=e6,b.textNodeOffsetFromPoint=y5,b.titleFromEditor=R9,b.toBase64URL=Oi,b.toMindmap=Sf,b.toPlainText=st,b.toPlainTextKeepLength=Tg,b.trimChar=$m,b.unexclusiveBlock=m2,b.unicodeLength=VE,b.unicodeSubstr=WE,b.updateBlockSelection=y4,b.updateOpAttributes=k6,b.updateTextBlockContent=cT,b.updateUrl=Um;for(const n in vt)n!=="default"&&!b.hasOwnProperty(n)&&Object.defineProperty(b,n,{enumerable:!0,get:()=>vt[n]});Object.defineProperties(b,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});