@ones-editor/editor 1.1.27-beta.4 → 1.1.28

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
@@ -21,7 +21,7 @@ Available method signatures are:
21
21
  `).map((i,s)=>{const l=s===0&&(t==null?void 0:t.firstLineAsTitle)?{heading:1}:void 0;return es(i,l)})},meta:{},comments:{}}}function K1(n){const t=n.blocks.root;if(t.length!==1)return!1;const e=t[0];return!(!e.text||Vn(e.text))}function p3(n,t){const e=it();return n.localInsertChildContainers([{containerId:e,blocks:t}]),e}function qs(n,t){return p3(n,[Pm(t)])}const T8="\u200B",k8=D("to-plain-text");function Re(n,t){let e="";return n.forEach(r=>{if(p(k8,typeof r.insert=="string","invalid op"),r.attributes&&r.attributes.box===!0){if(t!=null&&t.boxReplacement){e+=t.boxReplacement;return}if(r.attributes.text){e+=r.attributes.text;return}e+=" "}e+=r.insert}),e}function V1(n){return Re(n,{boxReplacement:" "})}function C3(n){return typeof n.offset=="number"}function Fm(n){return C3(n.anchor)}function R8(n){return Fm(n)&&n.anchor.offset===n.focus.offset&&n.anchor.blockId===n.focus.blockId}function E3(n,t){return{blockId:n,offset:t}}function Km(n,t){const e=E3(n,t);return{anchor:e,focus:e}}function A3(n,t){return{blockId:n,childContainerId:t}}function w8(n,t){const e=A3(n,t);return{anchor:e,focus:e}}const S8=D("block-to-text");function L8(n,t,e){let r="";return t.forEach(i=>{if(p(S8,typeof i.insert=="string","invalid op"),i.attributes&&i.attributes.box===!0){const s=i.attributes,o=n.editorBoxes.getBoxClass(s.type);if(o!=null&&o.convertTo){r+=o.convertTo(n,s,e,"text");return}if(i.attributes.text){r+=i.attributes.text;return}r+=`[${s.type}]`}r+=i.insert}),r}const I8=D("block-to-text");function D8(n,t,e){let r="";return t.forEach(i=>{if(p(I8,typeof i.insert=="string","invalid op"),i.attributes&&i.attributes.box===!0){const o=i.attributes,l=n.editorBoxes.getBoxClass(o.type);if(l!=null&&l.convertTo){r+=l.convertTo(n,o,e,"markdown");return}if(i.attributes.text){r+=i.attributes.text;return}r+=`[${o.type}]`}const s=i.attributes;if(s){let o=i.insert;s.link&&(o=`[${o}](${s.link})`);const l=[];s["style-code"]?l.push("`"):(s["style-bold"]&&l.push("**"),s["style-italic"]&&l.push("*"),s["style-underline"]&&l.push("__"),s["style-strikethrough"]&&l.push("~~"));const c=l.join("");r.endsWith(c.substring(0,1))&&(r+=" ");const d=l.reverse().join("");r+=c+o+d;return}r+=i.insert}),r}function _8(n,t,e){const r=t.text||[];let s=D8(n,r,e);if(t.heading){const o=t.heading;s=`${"#".repeat(o)} ${s}`}return t.quoted&&(s=`> ${s}`),t.type==="text"&&(s=`${s}
22
22
  `),s}function M8(n){switch(n){case"style-color-0":return"#e52727";case"style-color-1":return"#eb6414";case"style-color-2":return"#f0a100";case"style-color-3":return"#24b47e";case"style-color-4":return"#0064ff";case"style-color-5":return"#9678d3";case"style-color-6":return"#909090";default:return}}function U8(n){switch(n){case"style-bg-color-0":return"#fad4d4";case"style-bg-color-1":return"#fbe0d0";case"style-bg-color-2":return"#fceccc";case"style-bg-color-3":return"#d3f0e5";case"style-bg-color-4":return"#d6e9fa";case"style-bg-color-5":return"#eae4f6";case"style-bg-color-6":return"#dedede";case"style-bg-color-7":return"#e52727";case"style-bg-color-8":return"#eb6414";case"style-bg-color-9":return"#f0a100";case"style-bg-color-10":return"#24b47e";case"style-bg-color-11":return"#0064ff";case"style-bg-color-12":return"#9678d3";case"style-bg-color-13":return"#909090";case"style-bg-color-14":return"#e8e8e8";default:return}}const O8=D("block-to-text");function N8(n,t,e){let r="";return t.forEach(i=>{if(p(O8,typeof i.insert=="string","invalid op"),i.attributes&&i.attributes.box===!0){const o=i.attributes,l=n.editorBoxes.getBoxClass(o.type);if(l!=null&&l.convertTo){r+=l.convertTo(n,o,e,"html");return}if(i.attributes.text){r+=i.attributes.text;return}r+=`[${o.type}]`}const s=i.attributes;if(s){let o=i.insert;const l=[];let c="";s["style-bold"]&&l.push("strong"),s["style-italic"]&&l.push("em"),s["style-underline"]&&l.push("u"),s["style-strikethrough"]&&l.push("s"),s["style-code"]&&l.push("code");const d=Object.keys(s).find(A=>A.startsWith("style-bg-color-"));d&&(c+=`background-color: ${U8(d)};`);const h=Object.keys(s).find(A=>A.startsWith("style-color-"));h&&(c+=`color: ${M8(h)};`),s.link&&(o=`<a href="${s.link}">${o}</a>`);let C=l.map(A=>`<${A}>`).join(""),E=l.reverse().map(A=>`</${A}>`).join("");c&&(s.link?o=`<a href="${s.link}" style="${c}">${i.insert}</a>`:C?C=C.replace(">",` style="${c}">`):(C=`<span style="${c}">`,E="</span>")),r+=C+o+E;return}r+=i.insert}),r||(r="<br>"),`<p>${r}</p>`}const jc=D("text-block");function P8(n,t,e,r,i){const{text:s}=i;p(jc,s,"no text for text block");const o=ua(r,"div");return Im(n,t,i.id,o,s),o}function F8(n,t,e){p(jc,e,"no text to update");const r=ua(null,"div");Im(n,tl(t),ut(t),r,e);const i=zt(t);Bf(i,r)}function K8(n,t,e){return jD(n,t,e)}function x3(n,t){let e="";return t.forEach(r=>{var i,s,o;if(!!r.insert){if(r.attributes&&r.attributes.box===!0){const l=n.getBoxById(r.attributes.id),c=(s=(i=n.editorBoxes.getBoxClass(r.attributes.type)).getBoxProperties)==null?void 0:s.call(i,n,l);e+=(o=c==null?void 0:c.abstract)!=null?o:" ";return}e+=r.insert}}),e.trim()}function V8(n,t){p(jc,ot(n,t),"block in not textBlock");const e=n.selection.range;let r="";if(e.isCollapsed()){const i=n.getBlockText(t);r=x3(n,i)}else{const i=ut(t),s=Ji(n,{simpleBlockOnly:!0}).find(o=>ut(o.block)===i);if(s&&!ve(n,s.block)){p(jc,s.block===t,"block not match");const o=n.getBlockText(t),{start:l,end:c}=s,d=l.offset,h=c.offset-d;if(h>0){const{middle:C}=ln(o,d,h);r=x3(n,C)}}}return{abstract:r.trim()}}function $8(n,t,e,r){return p(jc,t.text,"no text for text block"),r==="text"?L8(n,t.text,e):r==="markdown"?_8(n,t,e):N8(n,t.text,e)}function H8(n,t){const e=Et.default(t);e.id=it();const{text:r}=e;return p(jc,r,"no text for text block"),r.forEach(i=>{i.insert&&i.attributes&&i.attributes.box===!0&&(i.attributes.id=it())}),{blocks:{root:[e]},meta:{},comments:{}}}const lr={blockType:"text",blockKind:"text",createBlockContent:P8,getBlockTextLength:Of,getRangeFromPoint:C8,moveCaret:g8,updateSelection:zD,clearSelection:GD,getCaretRect:yr,getClientRects:K8,setBlockText:F8,getBlockProperties:V8,convertTo:$8,blockToDoc:H8},j8=Im,Vm=D("action-helper");function Xs(n,t){const e=at(t),r=pt(e),i=Rt(t);return n.doc.getBlockData(r,i)}function Yn(n,t){p(Vm,ot(n,t),"not a text kind block");const r=Xs(n,t).text;return p(Vm,r,"no text in block"),r}function $m(n,t,e){return sr(Yn(n,t),e).left}function b3(n,t){const e=et(t);p(Vm,e,"no parent block");const r=Yn(n,e),i=Ov(t),s=r.find(o=>{const l=o.attributes;return l?l.box&&l.id===i:!1});return p(Vm,s,"failed to find box"),s.attributes}const Fe=D("block-text");function z8(n,t,e){p(Fe,ot(n,t),"not a text kind block"),p(Fe,or(t,e),"not a valid offset"),p(Fe,e>=0&&e<Ct(n,t),`invalid offset: ${e}`);const i=ma(t,e)-e;i===0&&p(Fe,!1,`no text after offset: ${e}`);const s=Yn(n,t),{middle:o}=ln(s,e,i);p(Fe,o.length===1,"failed to split text to 3 parts");const l=o[0];return Hs(l)?" ":(p(Fe,l.insert.length===1||l.insert.length===2,"invalid op"),l.insert)}function G8(n,t,e){p(Fe,ot(n,t),"not a text kind block"),p(Fe,or(t,e),"not a valid offset"),p(Fe,e>0&&e<=Ct(n,t),`invalid offset: ${e}`);const r=rl(t,e),i=e-r;i===0&&p(Fe,!1,`no text before offset: ${e}`);const s=Yn(n,t),{middle:o}=ln(s,r,i);p(Fe,o.length===1,"failed to split text to 3 parts");const l=o[0];return Hs(l)?" ":(p(Fe,l.insert.length===1||l.insert.length===2,"invalid op"),l.insert)}function Hm(n,t,e){p(Fe,ot(n,t),"not a text kind block"),p(Fe,or(t,e),"not a valid offset"),p(Fe,e>0&&e<=Ct(n,t),`invalid offset: ${e}`);const r=rl(t,e),i=e-r;i===0&&p(Fe,!1,`no text before offset: ${e}`);const s=Yn(n,t),{middle:o}=ln(s,r,i);p(Fe,o.length===1,"failed to split text to 3 parts");const l=o[0];return Hs(l)?{op:l,charType:"box",offset:r,length:1}:{op:l,charType:mm(l.insert)?"space":"text",offset:r,length:l.insert.length}}function Vf(n,t,e){p(Fe,ot(n,t),"not a text kind block"),p(Fe,or(t,e),"not a valid offset"),p(Fe,e>=0&&e<Ct(n,t),`invalid offset: ${e}`);const i=ma(t,e)-e;i===0&&p(Fe,!1,`no text after offset: ${e}`);const s=Yn(n,t),{middle:o}=ln(s,e,i);p(Fe,o.length===1,"failed to split text to 3 parts");const l=o[0];return Hs(l)?{op:l,charType:"box",offset:e,length:1}:{op:l,charType:mm(l.insert)?"space":"text",offset:e,length:l.insert.length}}function W8(n,t,e,r){let i=e;for(;i>0;){const s=Hm(n,t,i);if(s.charType===r)return s;i-=s.length}return null}function q8(n,t,e,r){const i=Ct(n,t);let s=e;for(;s<i;){const o=Vf(n,t,s);if(o.charType===r)return o;s+=o.length}return null}function $1(n,t,e,r){let i=e;for(;i>0;){const s=Hm(n,t,i);if(s.charType!==r)return s;i-=s.length}return null}function H1(n,t,e,r){const i=Ct(n,t);let s=e;for(;s<i;){const o=Vf(n,t,s);if(o.charType!==r)return o;s+=o.length}return null}function j1(n,t,e){if(p(Fe,ot(n,t),"invalid blok type"),ve(n,t))return 0;const r=Hm(n,t,e);if(r.charType==="box")return e-1;let i=e;if(r.charType==="space"){const o=$1(n,t,i,"space");if(!o||o.offset===0)return 0;if(o.charType==="box")return o.offset;i=o.offset}const s=$1(n,t,i,"text");return s?s.offset+s.length:0}function z1(n,t,e){if(p(Fe,ot(n,t),"invalid blok type"),ve(n,t))return 0;const r=Vf(n,t,e);if(r.charType==="box")return e+1;let i=e;if(r.charType==="space"){const o=H1(n,t,i,"space");if(!o||o.offset===0)return Ct(n,t);if(o.charType==="box")return o.offset;i=o.offset}const s=H1(n,t,i,"text");return s?s.offset:Ct(n,t)}const v3=D("text-box");function X8(n,t,e,r){p(v3,r.text,`no text for text box data: ${JSON.stringify(r)}`),p(v3,typeof r.text=="string",`invalid text type for text box data: ${JSON.stringify(r)}`),B("span",[],e,r.text)}function Y8(n,t,e,r){var i;return(i=t.text)!=null?i:""}const B3={boxType:"text",updateBoxContent:X8,convertTo:Y8},Q8="data:image/svg+xml;base64,Cjxzdmcgdmlld0JveD0iMCAwIDI0IDI0IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8cGF0aCBkPSJNMTguMjQ0NSA2QzE3LjgyNzQgNiAxNy41MzYzIDYuMjkxMTcgMTcuNTM2MyA2LjcwODI2QzE3LjUzNjMgNi45ODM3IDE3LjU1OTkgNy4yMzU1MyAxNy41NTk5IDcuNjEzMjdDMTcuNTU5OSAxMC4yODExIDE2LjYyMzQgMTEuMzc0OSAxMy45NzkyIDExLjM3NDlIOC45NDI2Nkw3LjEyNDc5IDExLjQ4NTFMOS41NDA3NSA5LjI4MTYyTDExLjE5MzQgNy41OTc1M0MxMS4zMjcxIDcuNDcxNjEgMTEuMzk4IDcuMjgyNzQgMTEuMzk4IDcuMDkzODdDMTEuMzk4IDYuNjkyNTIgMTEuMDk4OSA2LjQwMTM1IDEwLjY5NzYgNi40MDEzNUMxMC41MDg3IDYuNDAxMzUgMTAuMzM1NiA2LjQ3MjE4IDEwLjE3ODIgNi42MjE3TDUuMjQzOTYgMTEuNTQ4MUM1LjA4NjU3IDExLjcwNTUgNSAxMS44OTQzIDUgMTIuMDkxMUM1IDEyLjI4NzggNS4wODY1NyAxMi40NzY3IDUuMjQzOTYgMTIuNjI2MkwxMC4xNjI1IDE3LjUzNjhDMTAuMzM1NiAxNy43MDk5IDEwLjUwODcgMTcuNzgwOCAxMC42OTc2IDE3Ljc4MDhDMTEuMDk4OSAxNy43ODA4IDExLjM5OCAxNy40ODk2IDExLjM5OCAxNy4wODgzQzExLjM5OCAxNi44OTE1IDExLjMyNzEgMTYuNzEwNSAxMS4xOTM0IDE2LjU4NDZMOS41NDA3NSAxNC45MDA1TDcuMTMyNjYgMTIuNjk3TDguOTQyNjYgMTIuODA3MkgxNC4wNTc5QzE3LjU1OTkgMTIuODA3MiAxOSAxMS4yNDExIDE5IDcuNjc2MjJDMTkgNy4yMzU1MyAxOC45OTIxIDYuODY1NjUgMTguOTM3IDYuNjEzODNDMTguODc0MSA2LjI5OTA0IDE4LjY3NzMgNiAxOC4yNDQ1IDZaIiBmaWxsPSIjQjJCQ0NEIi8+Cjwvc3ZnPgo=";function J8(n,t,e,r){_p(Q8,[],e),B("br",[],e)}function Z8(n,t,e,r){return r==="text"?`
23
23
  `:r==="html"?"<br>":r==="markdown"?`
24
- `:""}const y3={boxType:"br",updateBoxContent:J8,convertTo:Z8},T3=D("editor-boxes");class k3{constructor(t){m(this,"boxes",new Map);this.editor=t}registerBoxClass(t){const e=t.boxType,r=this.boxes.get(e);p(T3,!r,`duplicated box type: ${e}`),this.boxes.set(e,t)}getBoxClass(t){const e=this.boxes.get(t);return p(T3,e,`unknown box type: ${t}`),e}createBox(t,e){const r=Uv(e),i=Nv(r);return this.getBoxClass(e.type).updateBoxContent(this.editor,r,i,e),r}forEach(t){this.boxes.forEach(t)}}function t_(n,t,e,r){const i=r,{width:s,height:o,src:l}=i,c=["editor-box-image"];i.link&&c.push("editor-box-image-link");const d=B("img",c,e);s&&(d.style.width=`${s}px`),o&&(d.style.height=`${o}px`),d.src=n.doc.buildResourceUrl(l)}const R3={boxType:"image",updateBoxContent:t_},e_="data:image/svg+xml;base64,Cjxzdmcgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiB2aWV3Qm94PSIwIDAgMjQgMjQiIGZpbGw9InJnYigxNzgsIDE4OCwgMjA1KSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0ibTE3IDE1IDEuNTUgMS41NWMtLjk2IDEuNjktMy4zMyAzLjA0LTUuNTUgMy4zN1YxMWgzVjloLTNWNy44MkMxNC4xNiA3LjQgMTUgNi4zIDE1IDVjMC0xLjY1LTEuMzUtMy0zLTNTOSAzLjM1IDkgNWMwIDEuMy44NCAyLjQgMiAyLjgyVjlIOHYyaDN2OC45MmMtMi4yMi0uMzMtNC41OS0xLjY4LTUuNTUtMy4zN0w3IDE1bC00LTN2M2MwIDMuODggNC45MiA3IDkgN3M5LTMuMTIgOS03di0zbC00IDN6TTEyIDRjLjU1IDAgMSAuNDUgMSAxcy0uNDUgMS0xIDEtMS0uNDUtMS0xIC40NS0xIDEtMXoiPjwvcGF0aD4KPC9zdmc+Cg==";function n_(n,t,e){q(e,"editor-box-anchor"),_p(e_,[],e)}const w3={boxType:"anchor",updateBoxContent:n_};function r_(n,t,e,r){B("span",[],e,r.text)}const S3={insertionType:"inputting",updateInsertionContent:r_},L3=D("editor-insertion");class I3{constructor(t){m(this,"insertions",new Map);this.editor=t}registerInsertionClass(t){const e=t.insertionType,r=this.insertions.get(e);p(L3,!r,`duplicated insertion type: ${e}`),this.insertions.set(e,t)}getInsertionClass(t){const e=this.insertions.get(t);return p(L3,e,`unknown insertion type: ${t}`),e}createInsertion(t,e){const r=Pv(e.type,e.id,e.attributes),i=Kv(r);return this.getInsertionClass(e.type).updateInsertionContent(this.editor,r,i,e),r}}class i_{constructor(t){m(this,"cursors",new Map);m(this,"timer");this.editor=t,this.timer=this.startTimer()}add(t,e){this.cursors.set(t,e)}startTimer(){return setInterval(()=>{const t=Date.now();Array.from(this.cursors).forEach(([e,r])=>{if(t-r>3e3){const i=Fv(this.editor,e);i&&ct(i,"active"),this.cursors.delete(e)}})},1e3)}destroy(){clearInterval(this.timer)}}function s_(n,t,e,r){var l;const i=r;Date.now()-i.time<5*1e3&&(n.addCustom("active-cursors",d=>new i_(d)).add(i.id,i.time),q(t,"active")),B("span",[],e,"|").setAttribute("data-cursor-name",i.name),t.style.setProperty("--cursor-color",n.getColor((l=i.rainbowIndex)!=null?l:0))}const G1={insertionType:"remote-cursor",updateInsertionContent:s_};class D3{constructor(t){m(this,"decorators",[]);this.editor=t}registerDecorator(t){this.decorators.push(t)}decorateBlock(t,e){let r=e;return this.decorators.forEach(i=>{if(i.decorateBlock){const s=i.decorateBlock(this.editor,t,e);s&&(r=Et.default(s))}}),r}decorateText(t,e){let r=e;const i=new Map;return this.decorators.forEach(s=>{if(s.decorateText){const o=s.decorateText(this.editor,t,e);if(o){const{insertions:l,text:c}=o;l&&Array.from(l.entries()).forEach(([d,h])=>{const C=i.get(d);C?C.push(...h):i.set(d,h)}),c&&(r=Et.default(c))}}}),{insertions:i,text:r}}}const W1=D("editor-input");class o_{constructor(t,e){m(this,"editor");m(this,"composing",!1);m(this,"callbacks");m(this,"inputElement");m(this,"handleWindowBlur",()=>{this.editor.emit("blur",this.editor),this.callbacks.onBlur()});m(this,"handleWindowFocus",()=>{document.activeElement===this.inputElement&&this.focus()});m(this,"handleDocumentClick",t=>{const e=this.editor.contentElement,r=t.target,i=this.isInDisableScrollMask(r);if(r&&(i||e.contains(r))){!i&&!Uc(r)&&(this.editor.emit("focus",this.editor),this.callbacks.onFocus(),this.editor.input.focus());return}this.isInCommandBar(r)||(this.editor.emit("blur",this.editor),this.callbacks.onBlur())});m(this,"handleDocumentSelectionChange",()=>{setTimeout(()=>{var e;const t=(e=document.getSelection())==null?void 0:e.focusNode;t&&(this.editor.contains(t)||this.isInDisableScrollMask(t)||this.isInCommandBar(t))||(this.editor.emit("blur",this.editor),this.callbacks.onBlur())},100)});m(this,"handleEditorSelectionChanged",()=>{const e=!this.editor.isWritable();this.inputElement.readOnly=e});m(this,"handleReadonlyChanged",()=>{this.handleEditorSelectionChanged()});m(this,"handleCompositionstart",t=>{!this.editor.isWritable()||(this.composing=!0,this.callbacks.onCompositionStart(t))});m(this,"handleCompositionend",t=>{Zl()?setTimeout(()=>{this.composing=!1},100):this.composing=!1,this.callbacks.onUpdateCompositionText(t,this.inputElement.value,!0),this.inputElement.value=""});m(this,"handleInput",t=>{if(t instanceof InputEvent&&!!t.data){if(this.editor.readonly||!this.editor.isWritable()){this.inputElement.value="";return}this.composing?this.callbacks.onUpdateCompositionText(t,t.data,!1):(this.callbacks.onInsertText(t,t.data),this.inputElement.value="")}});m(this,"handleKeyDown",t=>{if(!this.composing){if(this.callbacks.onKeyDown(t)){t.preventDefault(),t.stopPropagation();return}!this.editor.isWritable()||setTimeout(()=>{this.composing||(this.inputElement.value="")})}});m(this,"handleCopy",t=>{this.callbacks.onCopy(t)});m(this,"handleCut",t=>{if(this.editor.readonly){t.stopPropagation(),t.preventDefault();return}this.callbacks.onCut(t),W1.debug("on cut")});m(this,"handlePaste",t=>{if(!(t.isTrusted&&(!(t.target instanceof HTMLInputElement)||this.inputElement!==t.target))){if(this.editor.readonly||this.inputElement!==t.target){t.stopPropagation(),t.preventDefault();return}this.callbacks.onPaste(t)}});m(this,"handlePasteText",(t,e)=>{this.callbacks.onPasteText(t,e)});this.editor=t,this.callbacks=e;const r=B("input",["editor-input"],t.contentElement);r.type="text",r.name="editor-input",r.onkeydown=this.handleKeyDown,r.oninput=this.handleInput,r.oncopy=this.handleCopy,document.addEventListener("paste",this.handlePaste),r.oncut=this.handleCut,r.addEventListener("compositionstart",this.handleCompositionstart),r.addEventListener("compositionend",this.handleCompositionend),this.inputElement=r,document.addEventListener("click",this.handleDocumentClick),document.addEventListener("selectionchange",this.handleDocumentSelectionChange),this.editor.addListener("selectionChanged",this.handleEditorSelectionChanged),this.editor.addListener("readonlyChanged",this.handleReadonlyChanged),window.addEventListener("blur",this.handleWindowBlur),window.addEventListener("focus",this.handleWindowFocus)}isInCommandBar(t){let e=t;return e===null?!1:(e.nodeType===3&&(e=e.parentElement),!!(e!=null&&e.closest("div[data-command-bar-id]"))||!!(e!=null&&e.closest("[data-keep-editor-focus]")))}destroy(){this.callbacks.destroy(),document.removeEventListener("click",this.handleDocumentClick),document.removeEventListener("selectionchange",this.handleDocumentSelectionChange),this.editor.removeListener("selectionChanged",this.handleEditorSelectionChanged),this.editor.removeListener("readonlyChanged",this.handleReadonlyChanged);const t=this.inputElement;t.removeEventListener("compositionstart",this.handleCompositionstart),t.removeEventListener("compositionend",this.handleCompositionend),t.onkeydown=null,t.oninput=null,t.oncopy=null,document.removeEventListener("paste",this.handlePaste),window.removeEventListener("blur",this.handleWindowBlur),window.removeEventListener("focus",this.handleWindowFocus),t.oncut=null}getInput(){return this.inputElement}focus(){this.editor.selection.caret.visible()||this.editor.selection.caret.update(),xe.isMobileSafari?(this.inputElement.focus(),this.callbacks.onFocus()):setTimeout(()=>{this.inputElement.focus(),this.callbacks.onFocus()})}isInDisableScrollMask(t){return t instanceof HTMLElement?!!(t!=null&&t.classList.contains("editor-disable-scroll")):!1}handleChanged(t){this.callbacks.onChanged(t)}handleRemoteChanged(t){this.callbacks.onRemoteChanged(t)}addHandler(t){this.callbacks.addHandler(t)}removeHandler(t){this.callbacks.removeHandler(t)}defaultInsertText(t,e,r,i,s){p(W1,t===this.editor,"invalid editor"),this.callbacks.defaultInsertText(t,e,r,i,s)}defaultHandleKeydown(t,e){return p(W1,t===this.editor,"invalid editor"),this.callbacks.defaultHandleKeydown(t,e)}forEach(t){this.callbacks.forEach(t)}}function _3(n){const t=n.rootElement,e=t.getBoundingClientRect(),r=$r(t),i=window.innerWidth,s=window.innerHeight,o=e.left<0?0:e.left,l=e.top<0?0:e.top,c=e.right>i?i:e.right,d=e.bottom>s?s:e.bottom,h=(o+c)/2,C=(l+d)/2,E=0-e.left+h,A=0-e.top+C,v=n.input.inputElement;v.style.left=`${E/r}px`,v.style.top=`${A/r}px`}const q1=D("editor-caret");function l_(){const t=window.navigator.userAgent.match(/Firefox\/(\d+)\./);return t?Number.parseInt(t[1],10):null}class a_{constructor(t){m(this,"editor");m(this,"caretElem");m(this,"handleReadOnlyChanged",()=>{this.update()});if(this.editor=t,this.caretElem=B("div",["editor-cursor"],this.editor.contentElement),xe.isFirefox){const e=l_();e&&e<=79&&(this.caretElem.style.transition="none")}this.editor.on("readonlyChanged",this.handleReadOnlyChanged)}destroy(){this.editor.off("readonlyChanged",this.handleReadOnlyChanged)}visible(){const t=window.getComputedStyle(this.caretElem);return t.display!=="none"&&t.opacity!=="0"}hasCaret(){if(this.editor.readonly||!this.editor.selection.range.isCollapsed())return!1;const t=this.editor.selection.range.start;if(!(t instanceof gn))return!1;const e=this.editor.getBlockById(t.blockId);return!!ot(this.editor,e)}update(){if(Ef(this.editor.rootElement))return;const t=this.caretElem;if(this.hasCaret())t.style.display="";else{t.style.display="none",_3(this.editor);return}const{range:e}=this.editor.selection;p(q1,e.isCollapsed,"range is not collapsed");const r=e.start;p(q1,r instanceof gn,"only simple block position can has caret");const i=this.editor.getBlockById(r.blockId);p(q1,ot(this.editor,i),"only text kind block can has caret");let s;const o=i.querySelector("span.inputting-insertion");o?(s=ea(o),s=new DOMRect(s.right,s.top,1,s.height)):s=yr(i,r);const l=this.editor.contentElement.getBoundingClientRect(),c=s.left-l.left,d=s.top-l.top;t.style.left=`${c}px`,t.style.top=`${d}px`,t.style.height=`${s.height}px`;const h=this.editor.input.inputElement;h.style.left=`${c}px`,h.style.top=`${d+s.height-24}px`,xe.isMobileSafari&&(h.style.left=`${c-4}px`,h.style.height=`${s.height}px`);const E=mn(i,{horizontal:!0}).getBoundingClientRect(),A=E.left-l.left,v=A+E.width;c<A||c>v?(_3(this.editor),t.style.display="none"):t.style.display=""}}function M3(n){Vv(n),n.selection.range.getSelectedBlocks().forEach(t=>$v(n,t.block,t.start,t.end))}const c_=D("editor-dom");function jm(n){return mn(n.rootContainer).clientHeight}function $f(n){const e=mn(n.rootContainer).getBoundingClientRect(),r=e.x<0?0:e.x,i=e.y<0?0:e.y,s=e.right>window.innerWidth?window.innerWidth:e.right,o=e.bottom>window.innerHeight?window.innerHeight:e.bottom;return new DOMRect(r,i,s-r,o-i)}function u_(n,t){const e=$f(n),r=n.getBlockById(t.blockId),s=Zo(n,r,t);return ia(e,s.x,s.y)&&ia(e,s.right,s.bottom)}function U3(n,t){const e=$f(n),r=t.getBoundingClientRect();return r.top>=e.top&&r.top<=e.bottom||r.bottom<=e.bottom&&r.bottom>=e.top}function f_(n,t){const e=$f(n),r=t.getBoundingClientRect();if(r.top>=e.top&&r.top<=e.bottom&&r.bottom<=e.bottom&&r.bottom>=e.top)return 100;const i=Math.max(0,Math.min(r.right,e.right)-Math.max(r.left,e.left)),s=Math.max(0,Math.min(r.bottom,e.bottom)-Math.max(r.top,e.top)),o=i*s,l=r.width*r.height;return o/l*100}function d_(n,t){const e=$f(n),r=t.getBoundingClientRect();return ia(e,r.x,r.y)||ia(e,r.right,r.bottom)}function h_(n,t){const e=$f(n),r=t.getBoundingClientRect();return r.right>e.right||r.left<e.left}function Hf(n,t,e){!t||(e!=null&&e.animation?(h_(n,t)&&ra(t,{elementToScroll:mn(t,{horizontal:!0}),disableHorizontal:!1}),ra(t,{elementToScroll:mn(t),disableHorizontal:!0,verticalOffset:e==null?void 0:e.verticalOffset})):t.scrollIntoView&&t.scrollIntoView({behavior:"auto",block:"nearest",inline:"nearest"}))}function m_(n){if(!fm(n.rootContainer)){c_.warn("editorScrollIntoView: editor is not visible");return}const t=n.rootContainer.getBoundingClientRect();if(t.height<1&&t.width<1)return;const e=n.selection,r=e.range.focus;if(!r.isSimple()){const C=r,E=n.getContainerById(C.childContainerId);d_(n,E)||E.scrollIntoView();return}if(e.range.start.blockId===e.range.end.blockId){const C=n.getBlockById(e.range.start.blockId);if(Le(C)&&U3(n,C)&&f_(n,C)>=95||Pt(n,C)&&U3(n,C))return}const i=r,s=n.getBlockById(i.blockId);if(u_(n,i))return;if(Le(s)){const C=ae(s);if(C){["image"].includes(on(s))?setTimeout(()=>{Hf(n,C,{animation:!0})},500):Hf(n,C,{animation:!0});return}}const o=Zo(n,s,i),l=s.getBoundingClientRect(),c=be(s),d=B("div",["editor-block-anchor"],c),h=$r(s);d.style.top=`${(o.top-l.top)/h}px`,Hf(n,d,{animation:!0}),setTimeout(()=>{d.remove()},200)}function g_(n,t){if(t.isCollapsed())return!1;const e=_e(n.rootContainer),r=Ge(n.rootContainer),{start:i,end:s}=t;return i.blockId===ut(e)&&i.offset===0&&s.blockId===ut(r)&&s.offset===Ct(n,r)}const O3=D("range-in-block");function N3(n,t){const e=t.getEditor(),r=e.getBlockById(t.start.blockId),i=e.getBlockById(t.end.blockId),s=r===n||Ce(n,r),o=i===n||Ce(n,i);return!!(s||o)}function P3(n,t){const e=n.doc.toJSON(),r=new Set(Object.values(e.blocks).map(o=>o.map(l=>l.id)).flat());let i,s=jr(t);if(s){for(;s&&!r.has(ut(s));)s=jr(s);p(O3,s,"no prev block while deleting a block"),i=Ue(n,s,Ct(n,s))}else{const o=zr(t);p(O3,o,"no prev and next block while deleting a block"),i=Ue(n,o,0)}return i}const p_=D("block-to-html");function X1(n,t,e,r){const i=la(n,t.type);if(i.convertTo)return i.convertTo(n,t,e,"html",r);if(i.blockKind!=="text")return`[${t.type}]`;p(p_,t.text,"no text");const s=Re(t.text);return`<div>${hm(s)}</div>`}const F3=D("block-to-text");function C_(n,t,e){let r="";return t.forEach(i=>{if(p(F3,typeof i.insert=="string","invalid op"),i.attributes&&i.attributes.box===!0){const s=i.attributes,o=n.editorBoxes.getBoxClass(s.type);if(o!=null&&o.convertTo){r+=o.convertTo(n,s,e,"text");return}if(i.attributes.text){r+=i.attributes.text;return}r+=`[${s.type}]`}r+=i.insert}),r}function zm(n,t,e,r){const i=la(n,t.type);return i.convertTo?i.convertTo(n,t,e,"text",r):i.blockKind!=="text"?`[${t.type}]`:(p(F3,t.text,"no text"),C_(n,t.text,e))}function Gm(n,t,e,r){const i=la(n,t.type);return i.convertTo?i.convertTo(n,t,e,"markdown",r):zm(n,t,e,r)}function jf(n,t){return t.blocks.root.map((i,s)=>X1(n,i,t,[{containerId:"root",blockIndex:s}])).join(`
24
+ `:""}const y3={boxType:"br",updateBoxContent:J8,convertTo:Z8},T3=D("editor-boxes");class k3{constructor(t){m(this,"boxes",new Map);this.editor=t}registerBoxClass(t){const e=t.boxType,r=this.boxes.get(e);p(T3,!r,`duplicated box type: ${e}`),this.boxes.set(e,t)}getBoxClass(t){const e=this.boxes.get(t);return p(T3,e,`unknown box type: ${t}`),e}createBox(t,e){const r=Uv(e),i=Nv(r);return this.getBoxClass(e.type).updateBoxContent(this.editor,r,i,e),r}forEach(t){this.boxes.forEach(t)}}function t_(n,t,e,r){const i=r,{width:s,height:o,src:l}=i,c=["editor-box-image"];i.link&&c.push("editor-box-image-link");const d=B("img",c,e);s&&(d.style.width=`${s}px`),o&&(d.style.height=`${o}px`),d.src=n.doc.buildResourceUrl(l)}const R3={boxType:"image",updateBoxContent:t_},e_="data:image/svg+xml;base64,Cjxzdmcgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiB2aWV3Qm94PSIwIDAgMjQgMjQiIGZpbGw9InJnYigxNzgsIDE4OCwgMjA1KSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0ibTE3IDE1IDEuNTUgMS41NWMtLjk2IDEuNjktMy4zMyAzLjA0LTUuNTUgMy4zN1YxMWgzVjloLTNWNy44MkMxNC4xNiA3LjQgMTUgNi4zIDE1IDVjMC0xLjY1LTEuMzUtMy0zLTNTOSAzLjM1IDkgNWMwIDEuMy44NCAyLjQgMiAyLjgyVjlIOHYyaDN2OC45MmMtMi4yMi0uMzMtNC41OS0xLjY4LTUuNTUtMy4zN0w3IDE1bC00LTN2M2MwIDMuODggNC45MiA3IDkgN3M5LTMuMTIgOS03di0zbC00IDN6TTEyIDRjLjU1IDAgMSAuNDUgMSAxcy0uNDUgMS0xIDEtMS0uNDUtMS0xIC40NS0xIDEtMXoiPjwvcGF0aD4KPC9zdmc+Cg==";function n_(n,t,e){q(e,"editor-box-anchor"),_p(e_,[],e)}const w3={boxType:"anchor",updateBoxContent:n_};function r_(n,t,e,r){B("span",[],e,r.text)}const S3={insertionType:"inputting",updateInsertionContent:r_},L3=D("editor-insertion");class I3{constructor(t){m(this,"insertions",new Map);this.editor=t}registerInsertionClass(t){const e=t.insertionType,r=this.insertions.get(e);p(L3,!r,`duplicated insertion type: ${e}`),this.insertions.set(e,t)}getInsertionClass(t){const e=this.insertions.get(t);return p(L3,e,`unknown insertion type: ${t}`),e}createInsertion(t,e){const r=Pv(e.type,e.id,e.attributes),i=Kv(r);return this.getInsertionClass(e.type).updateInsertionContent(this.editor,r,i,e),r}}class i_{constructor(t){m(this,"cursors",new Map);m(this,"timer");this.editor=t,this.timer=this.startTimer()}add(t,e){this.cursors.set(t,e)}startTimer(){return setInterval(()=>{const t=Date.now();Array.from(this.cursors).forEach(([e,r])=>{if(t-r>3e3){const i=Fv(this.editor,e);i&&ct(i,"active"),this.cursors.delete(e)}})},1e3)}destroy(){clearInterval(this.timer)}}function s_(n,t,e,r){var l;const i=r;Date.now()-i.time<5*1e3&&(n.addCustom("active-cursors",d=>new i_(d)).add(i.id,i.time),q(t,"active")),B("span",[],e,"|").setAttribute("data-cursor-name",i.name),t.style.setProperty("--cursor-color",n.getColor((l=i.rainbowIndex)!=null?l:0))}const G1={insertionType:"remote-cursor",updateInsertionContent:s_};class D3{constructor(t){m(this,"decorators",[]);this.editor=t}registerDecorator(t){this.decorators.push(t)}decorateBlock(t,e){let r=e;return this.decorators.forEach(i=>{if(i.decorateBlock){const s=i.decorateBlock(this.editor,t,e);s&&(r=Et.default(s))}}),r}decorateText(t,e){let r=e;const i=new Map;return this.decorators.forEach(s=>{if(s.decorateText){const o=s.decorateText(this.editor,t,e);if(o){const{insertions:l,text:c}=o;l&&Array.from(l.entries()).forEach(([d,h])=>{const C=i.get(d);C?C.push(...h):i.set(d,h)}),c&&(r=Et.default(c))}}}),{insertions:i,text:r}}}const W1=D("editor-input");class o_{constructor(t,e){m(this,"editor");m(this,"composing",!1);m(this,"callbacks");m(this,"inputElement");m(this,"handleWindowBlur",()=>{this.editor.emit("blur",this.editor),this.callbacks.onBlur()});m(this,"handleWindowFocus",()=>{document.activeElement===this.inputElement&&this.focus()});m(this,"handleDocumentClick",t=>{const e=this.editor.contentElement,r=t.target,i=this.isInDisableScrollMask(r);if(r&&(i||e.contains(r))){!i&&!Uc(r)&&(this.editor.emit("focus",this.editor),this.callbacks.onFocus(),this.editor.input.focus());return}this.isInCommandBar(r)||(this.editor.emit("blur",this.editor),this.callbacks.onBlur())});m(this,"handleDocumentSelectionChange",()=>{setTimeout(()=>{var e;const t=(e=document.getSelection())==null?void 0:e.focusNode;t&&(this.editor.contains(t)||this.isInDisableScrollMask(t)||this.isInCommandBar(t))||(this.editor.emit("blur",this.editor),this.callbacks.onBlur())},100)});m(this,"handleEditorSelectionChanged",()=>{const e=!this.editor.isWritable();this.inputElement.readOnly=e});m(this,"handleReadonlyChanged",()=>{this.handleEditorSelectionChanged()});m(this,"handleCompositionstart",t=>{!this.editor.isWritable()||(this.composing=!0,this.callbacks.onCompositionStart(t))});m(this,"handleCompositionend",t=>{Zl()?setTimeout(()=>{this.composing=!1},100):this.composing=!1,this.callbacks.onUpdateCompositionText(t,this.inputElement.value,!0),this.inputElement.value=""});m(this,"handleInput",t=>{if(t instanceof InputEvent&&!!t.data){if(this.editor.readonly||!this.editor.isWritable()){this.inputElement.value="";return}this.composing?this.callbacks.onUpdateCompositionText(t,t.data,!1):(this.callbacks.onInsertText(t,t.data),this.inputElement.value="")}});m(this,"handleKeyDown",t=>{if(!this.composing){if(this.callbacks.onKeyDown(t)){t.preventDefault(),t.stopPropagation();return}!this.editor.isWritable()||setTimeout(()=>{this.composing||(this.inputElement.value="")})}});m(this,"handleCopy",t=>{this.callbacks.onCopy(t)});m(this,"handleCut",t=>{if(this.editor.readonly){t.stopPropagation(),t.preventDefault();return}this.callbacks.onCut(t),W1.debug("on cut")});m(this,"handlePaste",t=>{if(!(t.isTrusted&&(!(t.target instanceof HTMLInputElement)||this.inputElement!==t.target))){if(this.editor.readonly||this.inputElement!==t.target){t.stopPropagation(),t.preventDefault();return}this.callbacks.onPaste(t)}});m(this,"handlePasteText",(t,e)=>{this.callbacks.onPasteText(t,e)});this.editor=t,this.callbacks=e;const r=B("input",["editor-input"],t.contentElement);r.type="text",r.name="editor-input",r.onkeydown=this.handleKeyDown,r.oninput=this.handleInput,r.oncopy=this.handleCopy,document.addEventListener("paste",this.handlePaste),r.oncut=this.handleCut,r.addEventListener("compositionstart",this.handleCompositionstart),r.addEventListener("compositionend",this.handleCompositionend),this.inputElement=r,document.addEventListener("click",this.handleDocumentClick),document.addEventListener("selectionchange",this.handleDocumentSelectionChange),this.editor.addListener("selectionChanged",this.handleEditorSelectionChanged),this.editor.addListener("readonlyChanged",this.handleReadonlyChanged),window.addEventListener("blur",this.handleWindowBlur),window.addEventListener("focus",this.handleWindowFocus)}isInCommandBar(t){let e=t;return e===null?!1:(e.nodeType===3&&(e=e.parentElement),!!(e!=null&&e.closest("div[data-command-bar-id]"))||!!(e!=null&&e.closest("[data-keep-editor-focus]")))}destroy(){this.callbacks.destroy(),document.removeEventListener("click",this.handleDocumentClick),document.removeEventListener("selectionchange",this.handleDocumentSelectionChange),this.editor.removeListener("selectionChanged",this.handleEditorSelectionChanged),this.editor.removeListener("readonlyChanged",this.handleReadonlyChanged);const t=this.inputElement;t.removeEventListener("compositionstart",this.handleCompositionstart),t.removeEventListener("compositionend",this.handleCompositionend),t.onkeydown=null,t.oninput=null,t.oncopy=null,document.removeEventListener("paste",this.handlePaste),window.removeEventListener("blur",this.handleWindowBlur),window.removeEventListener("focus",this.handleWindowFocus),t.oncut=null}getInput(){return this.inputElement}focus(){this.editor.selection.caret.visible()||this.editor.selection.caret.update(),xe.isMobileSafari?(this.inputElement.focus(),this.callbacks.onFocus()):setTimeout(()=>{this.inputElement.focus(),this.callbacks.onFocus()})}isInDisableScrollMask(t){let e=t;return e===null?!1:(e.nodeType===3&&(e=e.parentElement),!!(e!=null&&e.closest(".editor-disable-scroll")))}handleChanged(t){this.callbacks.onChanged(t)}handleRemoteChanged(t){this.callbacks.onRemoteChanged(t)}addHandler(t){this.callbacks.addHandler(t)}removeHandler(t){this.callbacks.removeHandler(t)}defaultInsertText(t,e,r,i,s){p(W1,t===this.editor,"invalid editor"),this.callbacks.defaultInsertText(t,e,r,i,s)}defaultHandleKeydown(t,e){return p(W1,t===this.editor,"invalid editor"),this.callbacks.defaultHandleKeydown(t,e)}forEach(t){this.callbacks.forEach(t)}}function _3(n){const t=n.rootElement,e=t.getBoundingClientRect(),r=$r(t),i=window.innerWidth,s=window.innerHeight,o=e.left<0?0:e.left,l=e.top<0?0:e.top,c=e.right>i?i:e.right,d=e.bottom>s?s:e.bottom,h=(o+c)/2,C=(l+d)/2,E=0-e.left+h,A=0-e.top+C,v=n.input.inputElement;v.style.left=`${E/r}px`,v.style.top=`${A/r}px`}const q1=D("editor-caret");function l_(){const t=window.navigator.userAgent.match(/Firefox\/(\d+)\./);return t?Number.parseInt(t[1],10):null}class a_{constructor(t){m(this,"editor");m(this,"caretElem");m(this,"handleReadOnlyChanged",()=>{this.update()});if(this.editor=t,this.caretElem=B("div",["editor-cursor"],this.editor.contentElement),xe.isFirefox){const e=l_();e&&e<=79&&(this.caretElem.style.transition="none")}this.editor.on("readonlyChanged",this.handleReadOnlyChanged)}destroy(){this.editor.off("readonlyChanged",this.handleReadOnlyChanged)}visible(){const t=window.getComputedStyle(this.caretElem);return t.display!=="none"&&t.opacity!=="0"}hasCaret(){if(this.editor.readonly||!this.editor.selection.range.isCollapsed())return!1;const t=this.editor.selection.range.start;if(!(t instanceof gn))return!1;const e=this.editor.getBlockById(t.blockId);return!!ot(this.editor,e)}update(){if(Ef(this.editor.rootElement))return;const t=this.caretElem;if(this.hasCaret())t.style.display="";else{t.style.display="none",_3(this.editor);return}const{range:e}=this.editor.selection;p(q1,e.isCollapsed,"range is not collapsed");const r=e.start;p(q1,r instanceof gn,"only simple block position can has caret");const i=this.editor.getBlockById(r.blockId);p(q1,ot(this.editor,i),"only text kind block can has caret");let s;const o=i.querySelector("span.inputting-insertion");o?(s=ea(o),s=new DOMRect(s.right,s.top,1,s.height)):s=yr(i,r);const l=this.editor.contentElement.getBoundingClientRect(),c=s.left-l.left,d=s.top-l.top;t.style.left=`${c}px`,t.style.top=`${d}px`,t.style.height=`${s.height}px`;const h=this.editor.input.inputElement;h.style.left=`${c}px`,h.style.top=`${d+s.height-24}px`,xe.isMobileSafari&&(h.style.left=`${c-4}px`,h.style.height=`${s.height}px`);const E=mn(i,{horizontal:!0}).getBoundingClientRect(),A=E.left-l.left,v=A+E.width;c<A||c>v?(_3(this.editor),t.style.display="none"):t.style.display=""}}function M3(n){Vv(n),n.selection.range.getSelectedBlocks().forEach(t=>$v(n,t.block,t.start,t.end))}const c_=D("editor-dom");function jm(n){return mn(n.rootContainer).clientHeight}function $f(n){const e=mn(n.rootContainer).getBoundingClientRect(),r=e.x<0?0:e.x,i=e.y<0?0:e.y,s=e.right>window.innerWidth?window.innerWidth:e.right,o=e.bottom>window.innerHeight?window.innerHeight:e.bottom;return new DOMRect(r,i,s-r,o-i)}function u_(n,t){const e=$f(n),r=n.getBlockById(t.blockId),s=Zo(n,r,t);return ia(e,s.x,s.y)&&ia(e,s.right,s.bottom)}function U3(n,t){const e=$f(n),r=t.getBoundingClientRect();return r.top>=e.top&&r.top<=e.bottom||r.bottom<=e.bottom&&r.bottom>=e.top}function f_(n,t){const e=$f(n),r=t.getBoundingClientRect();if(r.top>=e.top&&r.top<=e.bottom&&r.bottom<=e.bottom&&r.bottom>=e.top)return 100;const i=Math.max(0,Math.min(r.right,e.right)-Math.max(r.left,e.left)),s=Math.max(0,Math.min(r.bottom,e.bottom)-Math.max(r.top,e.top)),o=i*s,l=r.width*r.height;return o/l*100}function d_(n,t){const e=$f(n),r=t.getBoundingClientRect();return ia(e,r.x,r.y)||ia(e,r.right,r.bottom)}function h_(n,t){const e=$f(n),r=t.getBoundingClientRect();return r.right>e.right||r.left<e.left}function Hf(n,t,e){!t||(e!=null&&e.animation?(h_(n,t)&&ra(t,{elementToScroll:mn(t,{horizontal:!0}),disableHorizontal:!1}),ra(t,{elementToScroll:mn(t),disableHorizontal:!0,verticalOffset:e==null?void 0:e.verticalOffset})):t.scrollIntoView&&t.scrollIntoView({behavior:"auto",block:"nearest",inline:"nearest"}))}function m_(n){if(!fm(n.rootContainer)){c_.warn("editorScrollIntoView: editor is not visible");return}const t=n.rootContainer.getBoundingClientRect();if(t.height<1&&t.width<1)return;const e=n.selection,r=e.range.focus;if(!r.isSimple()){const C=r,E=n.getContainerById(C.childContainerId);d_(n,E)||E.scrollIntoView();return}if(e.range.start.blockId===e.range.end.blockId){const C=n.getBlockById(e.range.start.blockId);if(Le(C)&&U3(n,C)&&f_(n,C)>=95||Pt(n,C)&&U3(n,C))return}const i=r,s=n.getBlockById(i.blockId);if(u_(n,i))return;if(Le(s)){const C=ae(s);if(C){["image"].includes(on(s))?setTimeout(()=>{Hf(n,C,{animation:!0})},500):Hf(n,C,{animation:!0});return}}const o=Zo(n,s,i),l=s.getBoundingClientRect(),c=be(s),d=B("div",["editor-block-anchor"],c),h=$r(s);d.style.top=`${(o.top-l.top)/h}px`,Hf(n,d,{animation:!0}),setTimeout(()=>{d.remove()},200)}function g_(n,t){if(t.isCollapsed())return!1;const e=_e(n.rootContainer),r=Ge(n.rootContainer),{start:i,end:s}=t;return i.blockId===ut(e)&&i.offset===0&&s.blockId===ut(r)&&s.offset===Ct(n,r)}const O3=D("range-in-block");function N3(n,t){const e=t.getEditor(),r=e.getBlockById(t.start.blockId),i=e.getBlockById(t.end.blockId),s=r===n||Ce(n,r),o=i===n||Ce(n,i);return!!(s||o)}function P3(n,t){const e=n.doc.toJSON(),r=new Set(Object.values(e.blocks).map(o=>o.map(l=>l.id)).flat());let i,s=jr(t);if(s){for(;s&&!r.has(ut(s));)s=jr(s);p(O3,s,"no prev block while deleting a block"),i=Ue(n,s,Ct(n,s))}else{const o=zr(t);p(O3,o,"no prev and next block while deleting a block"),i=Ue(n,o,0)}return i}const p_=D("block-to-html");function X1(n,t,e,r){const i=la(n,t.type);if(i.convertTo)return i.convertTo(n,t,e,"html",r);if(i.blockKind!=="text")return`[${t.type}]`;p(p_,t.text,"no text");const s=Re(t.text);return`<div>${hm(s)}</div>`}const F3=D("block-to-text");function C_(n,t,e){let r="";return t.forEach(i=>{if(p(F3,typeof i.insert=="string","invalid op"),i.attributes&&i.attributes.box===!0){const s=i.attributes,o=n.editorBoxes.getBoxClass(s.type);if(o!=null&&o.convertTo){r+=o.convertTo(n,s,e,"text");return}if(i.attributes.text){r+=i.attributes.text;return}r+=`[${s.type}]`}r+=i.insert}),r}function zm(n,t,e,r){const i=la(n,t.type);return i.convertTo?i.convertTo(n,t,e,"text",r):i.blockKind!=="text"?`[${t.type}]`:(p(F3,t.text,"no text"),C_(n,t.text,e))}function Gm(n,t,e,r){const i=la(n,t.type);return i.convertTo?i.convertTo(n,t,e,"markdown",r):zm(n,t,e,r)}function jf(n,t){return t.blocks.root.map((i,s)=>X1(n,i,t,[{containerId:"root",blockIndex:s}])).join(`
25
25
  `)}function K3(n,t){return`<!doctype html><html><head><meta charset="utf8" /></head><body>${jf(n,t)}</body></html>`}function il(n,t){return t.blocks.root.map((i,s)=>zm(n,i,t,[{containerId:"root",blockIndex:s}])).join(`
26
26
  `)}function V3(n,t){const e=t.blocks.root.map((i,s)=>Gm(n,i,t,[{containerId:"root",blockIndex:s}]));return e[e.length-1]=e[e.length-1].trimEnd(),e.join(`
27
27
  `)}const E_=D("get-text-position");function zc(n,t){const e=t!=null?t:n.selection.range.start;e instanceof gn||p(E_,!1,`invalid insert pos type: ${typeof e}`);const{blockId:r}=e,i=n.getBlockById(r),s=Rt(i),o=at(i),l=pt(o),{offset:c}=e;return{block:i,container:o,containerId:l,blockIndex:s,offset:c}}const Gc=D("insert-text");function Y1(n,t,e,r){var o;const i=n.doc.getBlockData(t,e);if(p(Gc,i,"no block data"),p(Gc,i.text,"no block text"),Vn(i.text)===0)return p(Gc,r===0,"invalid text offset"),n.editorCommandProviders.getEmptyBlockTextAttributes(n,i.id);if(r===0)return;const s=ln(i.text,r-1,1).middle;if(!((o=s[0].attributes)!=null&&o.box))return s[0].attributes}function A_(n,t,e){const r=at(t),i=pt(r),s=Rt(t);return Y1(n,i,s,e)}function $3(n,t,e,r,i){const s=at(t),o=pt(s),l=Rt(t),c=A_(n,t,e),d=Om(e,r,c!=null?c:null);return n.doc.localUpdateBlockText(o,l,d,i),Yn(n,t)}function H3(n,t,e,r){const i=at(t),s=pt(i),o=Rt(t),l=Om(e," ",r);return n.doc.localUpdateBlockText(s,o,l),Yn(n,t)}function x_(n,t){let e=0;if(t===0)return!1;for(let r=0;r<n.length;r++){const i=n[r];p(Gc,typeof i.insert=="string","invalid text op, no insert");const s=e+Sm(i);if(s===t)return!1;if(s>t)return!0;e=s}return!1}function Q1(n,t,e,r,i){const s=n.doc.getBlockData(e,r);p(Gc,s,"no block data"),p(Gc,s.text,"no block text");const o=Y1(n,e,r,i);o&&Object.keys(o).includes("link")&&(x_(s.text,i)||delete o.link);const l=Om(i,t,o!=null?o:null);return n.doc.localUpdateBlockText(e,r,l),Yn(n,n.getBlockById(s.id))}function J1(n,t){n.selection.range.isCollapsed()||n.clearSelectedContents();const{containerId:e,blockIndex:r,offset:i}=zc(n);Q1(n,t,e,r,i)}const Wm=D("update-composition-text");function j3(n){const t=n.selection.range.start;t instanceof gn||p(Wm,!1,`invalid insert pos type: ${typeof t}`);const{blockId:e}=t,r=n.getBlockById(e);p(Wm,ot(n,r),"not a text kind block");const i=at(r),s=pt(i),o=Rt(r),l=n.doc.getBlockData(s,o);p(Wm,l,"no block data in doc"),p(Wm,l.text,"no text data in text block");const c=zt(r);Im(n,tl(r),e,c,l.text)}function Z1(n){KD(n)}function Wc(n,t,e,r,i,s){return n.doc.localInsertBlock(t,e,r,i,s),n.getBlockById(r.id)}const zf=D("delete-block-text");function tC(n,t,e,r,i){if(!n.isBlockWritable(t))return zf.error("block is not writable"),0;p(zf,ot(n,t),"block is not a text kind block");const s=at(t),o=pt(s),l=Rt(t),c=n.doc.getBlockData(o,l);p(zf,c,"no block data in doc"),p(zf,c.text,"no text data in text block");let d=e;or(t,e)||(d=rl(t,d));let h=e+r;p(zf,h<=Ct(n,t),`invalid offset and count: ${e}, ${r}`),or(t,h)||(h=ma(t,h));const C=h-d,E=c3(d,C);return n.doc.localUpdateBlockText(o,l,E,i),C}const eC=D("break-text-block");function z3(n,t){const r=n.getBlockData(t).quoted;return r?{quoted:r}:{}}function qc(n,t,e,r){p(eC,ot(n,t),`block is not a text kind block: ${Ot(t)}`),p(eC,e>=0&&e<=Ct(n,t),`invalid offset: ${e}`);const i=at(t),s=pt(i),o=Rt(t),l=r!=null&&r.copyBlockAttributes?z3(n,t):{};if(!(r!=null&&r.forceInsertAfter)&&(e===0||e===Ct(n,t))){let w=o;if(e!==0){let V=zr(t);V?w=Rt(V):(V=Ge(i),w=Rt(V)+1)}const S={...es(""),...l,...r==null?void 0:r.newBlockData},U=Ue(n,t.id,0),M=Wc(n,s,w,S,U);return{block:t,newBlock:M}}p(eC,or(t,e),"not a valid offset");const c=Yn(n,t),{right:d}=sr(c,e),h=Vn(d);h>0&&tC(n,t,e,h);let C=zr(t),E;C?E=Rt(C):(C=Ge(i),E=Rt(C)+1);const A={...es(d),...l,...r==null?void 0:r.newBlockData},v=Wc(n,s,E,A,Ue(n,A.id,0));return{block:t,newBlock:v}}const b_=D("prepare-insert-new-block");function v_(n,t,e){if(t&&e!==void 0&&e!==null){const d=n.getContainerById(t),h=ke(d);return p(b_,e>=0&&e<=h.length,`invalid blockIndex: ${e}`),{containerId:t,blockIndex:e}}const r=n.selection.range.start;if(!r.isSimple())return null;const i=n.getBlockById(r.blockId);if(t=pt(at(i)),e=Rt(i),!ot(n,i))return{containerId:t,blockIndex:e+1};const o=r.offset;if(o===0||o===Ct(n,i))return{containerId:t,blockIndex:o===0?e:e+1};const c=qc(n,i,o).newBlock;return{containerId:t,blockIndex:Rt(c)}}const B_=D("auto-insert-block");function G3(n,t,e,r,i,s){const o=v_(n,e,r);p(B_,o,`not an valid insert position: ${n.selection.range}`);const l={blockId:t.id,offset:0},c={anchor:l,focus:l};return Wc(n,o.containerId,o.blockIndex,t,i!=null?i:c,s)}const y_=D("delete-block");function qm(n,t,e){t.children&&(e.push(...t.children),t.children.forEach(r=>{n.getChildContainerData(r).forEach(s=>{qm(n,s,e)})}))}function Xm(n,t,e){const r=at(t),i=pt(r),s=Rt(t),o=n.doc.getBlockData(i,s);return p(y_,o,"no block data in doc"),n.doc.localDeleteBlock(i,s,pn(n,{anchor:e.start,focus:e.end})),o}function nC(n,t,e){return n.undoManager.runInGroup(()=>{const r=at(t);qi(r)===1&&n.insertTextBlock("",pt(r),0);let i=e?el(n,e):null;if(!i){const l=n.selection.range;N3(t,l)?i=P3(n,t):i=l}const s=Xm(n,t,i),o=[];return qm(n,s,o),o.length>0&&n.doc.localDeleteChildContainers(o),s})}function T_(n,t){const e=[t];n.doc.getContainerBlocks(t).forEach(i=>{qm(n,i,e)}),n.doc.localDeleteChildContainers(e)}function W3(n,t){const e=[...t];t.forEach(r=>{n.doc.getContainerBlocks(r).forEach(s=>{qm(n,s,e)})}),n.doc.localDeleteChildContainers(e)}const rC=D("merge-text-block");function q3(n,t,e){p(rC,ot(n,t),"only text block can be merged"),p(rC,ot(n,e),"only text block can be merged");const r=Xs(n,t),i=Xs(n,e),s=r.text,o=i.text;p(rC,s&&o,"block data has no text");const l=at(t),c=pt(l),d=Rt(t),h=Ct(n,t),C=Q1(n,o,c,d,h),E=Ue(n,t,Vn(s));return nC(n,e,E),C}const ns=D("clear-selected-contents");function Ym(n,t){p(ns,ot(n,t.block),"not a text kind block");const{start:e,end:r}=t;p(ns,e.isSimple(),"not a simple block position"),p(ns,r.isSimple(),"not a simple block position");const i=e.offset,s=r.offset;p(ns,i<=s,`invalid delete text offset: ${i}, ${s}`),i!==s&&n.deleteTextFromBlock(t.block,i,s-i)}function X3(n,t,e){const r=pt(t),i=ke(t),s=e.focus?void 0:n.selection.range.toDocRange(),o=n.insertTextBlock("",r,0,{newRange:s});e.focus&&n.selection.selectBlock(o,0),i.reverse().forEach(l=>{n.deleteBlock(l)})}function k_(n,t){const{block:e,start:r,end:i}=t;if(ot(n,e)){Ym(n,t);return}if(Le(e)||r.isSimple()){p(ns,i.isSimple(),"invalid range");const o=at(e),l=Rt(e),c=n.insertTextBlock("",pt(o),l);n.selection.selectBlock(c,0),n.deleteBlock(e);return}p(ns,Pt(n,e),"invalid block kind"),p(ns,!r.isSimple()&&!i.isSimple(),"invalid range"),Nc(n,e,r,i),n.selection.range.getSelectedContainers().forEach((o,l)=>{X3(n,o,{focus:l===0})})}function R_(n){if(!n.isWritable())return;const t=n.selection.range;if(t.isCollapsed())return;const e=t.getSelectedBlocks();if(p(ns,e.length>0,"no selected block"),e.length===1){k_(n,e[0]);return}const r=e[0],i=r.block,s=at(i);p(ns,e.length>1,"no selected block");const o=e[e.length-1],l=o.block;if(ot(n,i)){Ym(n,r);const h=Ue(n,r.block,r.start.offset);if(e.slice(1,e.length-1).reverse().forEach(E=>n.deleteBlock(E.block)),ot(n,l)){Ym(n,o),n.mergeTextBlock(i,l,{focus:!0}),n.selection.setRange(h);return}n.deleteBlock(l),n.selection.setRange(h);return}if(ot(n,l)){Ym(n,o),e.slice(0,e.length-1).reverse().forEach(h=>n.deleteBlock(h.block)),n.selection.selectBlock(o.block,0);return}if(e.length===qi(s)){X3(n,s,{focus:!0});return}const c=He(i),d=ae(l);p(ns,c||d,"no prev or next block"),e.forEach(h=>n.deleteBlock(h.block))}function Qm(n){n.selection.range.isCollapsed()||n.undoManager.runInGroup(()=>{n.emit("beforeClearSelection",n);try{n.doc.beginBatchUpdate(),R_(n)}finally{n.doc.endBatchUpdate()}n.emit("afterClearSelection",n)})}const w_=D("core");function Y3(n,t,e,r){const i=at(t),s=pt(i),o=Rt(t);return n.doc.localUpdateBlockText(s,o,e,r),setTimeout(()=>{n.selection.updateSelection(null)}),Yn(n,t)}function Q3(n,t,e,r){if(!n.isBlockWritable(t)){w_.error("block is not writable");return}const i=n.getBlockText(t),s=$n.diff(i,e);Y3(n,t,s,r)}function Jm(n,t,e){const r=Yn(n,t),i=typeof e=="string"?pa(e):e,s=$n.diff(r,i);return Y3(n,t,s)}const Gf=D("update-block-data");function Zm(n,t,e,r,i){const s=at(t),o=pt(s),l=Rt(t),c=n.doc.getBlockData(o,l),d={insert:{},delete:[]},h=new Set(Object.keys(c)),C=new Set(Object.keys(e));return h.forEach(A=>{if(!C.has(A)){if(A==="id"||A==="type"||A==="text")return;Gf.debug(`delete key: ${A}`),d.delete.push(A)}}),Object.entries(e).forEach(([A,v])=>{p(Gf,A!=="id"&&A!=="type",`invalid block data delta, ${A}`);const w=c[A];if(v==null){w!=null&&(Gf.debug(`delete key: ${A}`),d.delete.push(A));return}w!==v&&(pf.default(w,v)||A==="text"&&$n.diff(w,v).length===0||(h.has(A)?(Gf.debug(`replace key: ${A}`),d.delete.push(A)):Gf.debug(`insert key: ${A}`),d.insert[A]=v))}),n.doc.localUpdateBlockData(o,l,d,r,i),Xs(n,t)}function J3(n,t,e,r){const s={...n.getBlockData(t),embedData:e};return n.updateBlockData(t,s,r)}function iC(n,t,e){if(!Pt(n,t)||!(e!=null&&e.tryFocusToChildSimpleBlock)){n.selection.selectBlock(t,0);return}const i=Hr(n,t).getChildContainers(n,t)[0],s=_e(i);iC(n,s,e)}function Ca(n){const t=[];let e={};return n.forEach(r=>{t.push(...r.blocks.root);const{root:i,...s}=r.blocks;e={...e,...s}}),{blocks:{...e,root:t},meta:{},comments:{}}}const Wf=D("clone-block");function sl(n,t,e,r){var C;const i=n.getBlockClass(e.type);if(i.blockToDoc)return i.blockToDoc(t,e,(E,A)=>(p(Wf,e!==A,"invalid child block"),sl(n,E,e,r)));let s={};const o=new Map,l=Et.default(e),c=E=>{if(o.has(E))return o.get(E);const A=it(),v=t.blocks[E];p(Wf,Array.isArray(v),"invalid child blocks");const w=v.map(V=>sl(n,t,V,r)),S=Ca(w),{root:U,...M}=S.blocks;return s={...s,...M},s[A]=S.blocks.root,o.set(E,A),A};l.children&&(l.children=l.children.map(c)),(C=l.exportSpec)==null||C.forEach(E=>{E.type==="block"&&(E.data=E.data.map(c))});const d=Array.from(o.entries()),h=E=>{for(const A of d){const[v,w]=A;{const S=`${v}/`;if(E.startsWith(S)){const U=E.substring(S.length),M=`${w}/${U}`;return Wf.debug(`replace key: ${E} -> ${M}`),M}}{const S=`${v}_`;if(E.startsWith(S)){const U=E.substring(S.length),M=`${w}_${U}`;return Wf.debug(`replace key: ${E} -> ${M}`),M}}}return E};return Array.from(Object.entries(l)).forEach(([E,A])=>{const v=h(E);v!==E&&delete l.key,l[v]=A}),l.id=it(),r&&(r.blockIdMap.set(e.id,l.id),o.forEach((E,A)=>r.containerIdMap.set(A,E))),{blocks:{root:[l],...s},meta:{},comments:{}}}function sC(n,t,e,r){const i=t.blocks[e];p(Wf,Array.isArray(i),"invalid child blocks");const s=i.map(l=>sl(n,t,l,r));return Ca(s)}function oC(n,t,e){const r=t.blocks.root.map(i=>sl(n.editorBlocks,t,i,e));return Et.default(Ca(r))}const Z3=D("insert-doc");function t5(n,t,e,r,i){if(Pt(n,t)){Z3.warn("failed to insert doc into a complex block");return}const s=oC(n,r,i),o=at(t),l=Rt(t),c=pt(o);n.doc.beginBatchUpdate(),n.undoManager.runInGroup(()=>{var V,nt,Y;const d=[];Object.entries(s.blocks).forEach(([X,ft])=>{X!=="root"&&d.push({containerId:X,blocks:ft})}),d.length>0&&n.doc.localInsertChildContainers(d);const h=s.blocks.root;if(Le(t)){n.deleteBlock(t);let X;h.reverse().forEach(ft=>{const xt=n.insertBlock(c,l,ft,void 0,{noFocus:!0});X||(X=xt)}),X&&n.selection.selectBlock(X,Ct(n,X));return}if(p(Z3,ot(n,t),"not a text block"),ve(n,t)){const X=Rt(t);let ft,xt=!1;for(let bt=0;bt<h.length;bt++){if(bt===0){const Tt=n.findBlockByIndex(c,X),ie=h[bt].type==="text"||h[bt].type==="list";if(Tt&&ot(n,Tt)&&ve(n,Tt)&&ie){const Ee=n.getBlockData(Tt),fe=Ee.type==="list"||h[bt].type==="list"?"list":"text",Lr={...Ee,...h[bt],type:fe},fr=n.insertBlock(c,X,Lr,void 0,{noFocus:!0});xt=!0,bt===h.length-1&&(ft=fr);continue}Tt&&Ps(Tt)&&(xt=!0)}const wt=n.insertBlock(c,X+bt,h[bt],void 0,{noFocus:!0});bt===h.length-1&&(ft=wt)}ft&&n.selection.selectBlock(ft,Ct(n,ft)),xt&&n.deleteBlock(t);return}if(h.length===1){const X=h[0];if(Sf(n,X.type)){n.insertTextToBlock(t,e,(V=X.text)!=null?V:[]);return}n.breakTextBlock(t,e),n.insertBlock(c,l+1,X);return}const C=e===Ct(n,t),E=e===0,A=h[0],v=h[h.length-1];let w;!C&&!E?w=n.breakTextBlock(t,e,{forceInsertAfter:!0}):w=t;const S=E?l:l+1;C?(w=n.insertBlock(c,l+1,v),n.selection.selectBlock(w,Ct(n,w))):(n.selection.selectBlock(w,0),Sf(n,v.type)?n.insertTextToBlock(w,0,(nt=v.text)!=null?nt:[]):n.insertBlock(c,S,v));const U=n.selection.range;let M=S;Sf(n,A.type)?E?(n.insertBlock(c,S,A),M+=1):n.insertTextToBlock(t,e,(Y=A.text)!=null?Y:[]):(n.insertBlock(c,S,A),M+=1),h.slice(1,h.length-1).reverse().forEach(X=>{n.insertBlock(c,M,X)}),n.selection.setRange(U)}),n.doc.endBatchUpdate()}function lC(n,t,e,r,i){const s=oC(n,r,i),o=pt(t),l=[];return n.undoManager.runInGroup(()=>{const c=[];Object.entries(s.blocks).forEach(([h,C])=>{h!=="root"&&c.push({containerId:h,blocks:C})}),n.doc.localInsertChildContainers(c),s.blocks.root.reverse().forEach(h=>{const C=n.insertBlock(o,e,h,void 0,{noFocus:!0,noScroll:!0});l.push(C)})}),l}function e5(n,t,e,r){const i=qi(t);lC(n,t,i,e,r);for(let s=0;s<i;s++){const o=_e(t);n.deleteBlock(o)}}const qf=D("add-text-attribute");function S_(n,t,e,r){const{start:i,end:s}=e;p(qf,i.blockId===s.blockId&&i.blockId===ut(t),"invalid range"),p(qf,r,"invalid attribute name");const o=n.getBlockText(t),l=Vc(i.offset,s.offset-i.offset,o,r,void 0,{ignoreValue:!0});return n.setBlockText(t,l),l}function n5(n,t,e,r,i){const{start:s,end:o}=e;p(qf,s.blockId===o.blockId&&s.blockId===ut(t),"invalid range"),p(qf,r,"invalid attribute name");const l=n.getBlockText(t),c=Pf(s.offset,o.offset-s.offset,l,r,i);return n.setBlockText(t,c),c}function Xc(n,t,e,r,i){const{start:s,end:o}=e;p(qf,s.blockId===o.blockId&&s.blockId===ut(t),"invalid range");const l=n.getBlockText(t),c=XB(s.offset,o.offset-s.offset,l,r,i);return n.setBlockText(t,c),c}function r5(n,t,e,r){const i=Ji(n,{simpleBlockOnly:!0});n.undoManager.runInGroup(()=>{i.forEach(s=>{const{block:o,start:l,end:c}=s;if(!ot(n,o))return;if(ve(n,o)){r(n,ut(o),t,e);return}const d=pn(n,{anchor:l,focus:c});t==="color"||t==="backgroundColor"?Xc(n,o,d,t,e):(Xc(n,o,d,"color",null),Xc(n,o,d,"backgroundColor",null))})})}function i5(n,t,e){const r=Ji(n,{simpleBlockOnly:!0});n.undoManager.runInGroup(()=>{r.forEach(i=>{const{block:s,start:o,end:l}=i;if(!ot(n,s))return;if(ve(n,s)){(t==="clearColor"||t==="clearAll")&&e(n,ut(s),"color",null),(t==="clearBackground"||t==="clearAll")&&e(n,ut(s),"backgroundColor",null);return}const c=pn(n,{anchor:o,focus:l});(t==="clearColor"||t==="clearAll")&&Xc(n,s,c,"color",null),(t==="clearBackground"||t==="clearAll")&&Xc(n,s,c,"backgroundColor",null)})})}function s5(n,t,e){const r=t.getSelectedBlocks().filter(l=>ot(n,l.block));if(r.length===0)return[null,null];const i=l=>{if(Ct(n,l.block)===0)return e(n,ut(l.block));const c=l.start,d=l.end,h=n.getBlockText(l.block);return JB(c.offset,d.offset-c.offset,h)};let[s,o]=i(r[0]);return s===null&&o===null?[s,o]:(r.forEach(l=>{const[c,d]=i(l);c===null||s===null?s=null:s=c===s?s:null,d===null||o===null?o=null:o=d===o?o:null}),[s,o])}const Tr=D("adjust-selection-pos");function o5(n){const t=[];for(;n;){const e=at(n);if(t.unshift(e),re(e))return t;const r=et(e);p(Tr,r,"child container has not parent container"),n=r}p(Tr,!1,"should not come here: getParentContainers")}function l5(n,t){for(;t;){const e=at(t);if(e===n)return t;const r=et(e);p(Tr,r,"could not find parent block for a child container"),t=r}p(Tr,!1,"no parent block in specified container")}function L_(n,t){const e=o5(n),r=o5(t);p(Tr,e.length>0&&r.length>0,"block has not parent container"),p(Tr,e[0]===r[0],"root container does not equal");let i=e[0];for(let l=1;l<e.length||r.length;l++)if(e[l]!==r[l]){i=e[l-1];break}const s=l5(i,n),o=l5(i,t);return{parentContainer:i,newBlock1:s,newBlock2:o}}function a5(n,t){let e=et(t);for(p(Tr,e,"element is not in a block");e;){const r=at(e);p(Tr,gi(r),"not a child container");const i=et(r);if(p(Tr,i,"child container has not parent block"),i===n)return r;e=i}p(Tr,!1,"failed to find parent container in complex block")}function t0(n,t,e){const r=n.getBlockById(t.blockId),i=n.getBlockById(e.blockId);if(r===i)return t instanceof gn&&e instanceof gn?{anchor:t,focus:e}:t instanceof Ai&&e instanceof Ai?Rm(n,r,t,e):null;const s=at(r),o=at(i);if(s===o)return t instanceof Ai&&(t=ht(r,0,"home")),e instanceof Ai&&(e=ht(i,Ct(n,i),"end")),p(Tr,t instanceof gn,"not valid position type"),p(Tr,e instanceof gn,"not valid position type"),{anchor:t,focus:e};if(r.contains(o))return null;if(i.contains(s)){if(t instanceof gn&&e instanceof Ai){const v=n.getContainerById(e.childContainerId);if(v===s)return{anchor:e,focus:e};const w=et(s);if(w&&w===et(v)){const S=Me(w,pt(s)),U=Me(w,pt(v));return Rm(n,w,S,U)}}return null}const l=cm(r,i)>0,{newBlock1:c,newBlock2:d}=L_(r,i);if(c===d){const v=c,w=a5(v,r),S=a5(v,i);return t=Me(c,pt(w)),e=Me(c,pt(S)),Tr.debug(`select in complex block: ${w.id}, ${S.id}`),Rm(n,v,t,e)}let h=l?Ct(n,c):0;c===r&&t instanceof gn&&(h=t.offset);let E=l?0:Ct(n,d);return d===i&&e instanceof gn&&(E=e.offset),t=ht(c,h,l?"end":"home"),e=ht(d,E,l?"home":"end"),{anchor:t,focus:e}}const I_=D("move-complex-block-position");function D_(n,t,e){const r=n.getBlockById(t.blockId);p(I_,Pt(n,r),"is not a complex block");const i=Hr(n,r),s=n.getContainerById(t.childContainerId),o=i.getNextContainer(n,r,s,e,{noWrap:!0});return o?Me(r,pt(o)):null}const ol=D("move-simple-block-position");function c5(n,t){const e=In(n,t,{visibleOnly:!0});if(e.length===0)return ol.warn("complex block has not any child container, not loaded?"),null;p(ol,e.length>0,"complex block has not any child container");const r=e[0];return _e(r)}function u5(n,t){const e=In(n,t,{visibleOnly:!0});if(e.length===0)return ol.warn("complex block has not any child container, not loaded?"),null;p(ol,e.length>0,"complex block has not any child container");const r=e[e.length-1];return Ge(r)}function f5(n,t,e){const r=e?c5(n,t):u5(n,t);return r?Pt(n,r)?f5(n,r,e):r:null}function __(n,t,e){const r=n.getBlockById(t.blockId);return e==="move"&&Pt(n,r)&&t.offset===0?c5(n,r):zr(r)}function M_(n,t,e){const r=n.getBlockById(t.blockId);return e==="move"&&Pt(n,r)&&t.offset===1?u5(n,r):jr(r)}function aC(n){return n==="ArrowLeft"||n==="ArrowUp"}function cC(n,t,e){const r=at(t);if(re(r))return null;const i=et(r);p(ol,i,"child container has not parent block"),p(ol,Pt(n,i),"is not a complex block");const s=Hr(n,i).getNextContainer(n,i,r,e);return s?aC(e)?Ge(s):_e(s):cC(n,i,e)}function U_(n,t,e){const r=at(t);if(re(r))return null;const i=et(r);if(p(ol,i,"child container has not parent block"),aC(e)){const l=He(i);if(l)return l}else{const l=ae(i);if(l)return l}const s=cC(n,i,e);if(s)return s;let o=i;for(;!re(at(o));)o=et(at(o));return aC(e)?He(o):ae(o)}function O_(n,t,e){if(!Pt(n,t)||Hr(n,t).enableKeyboardSelect)return t;const i=f5(n,t,e==="ArrowDown"||e==="ArrowRight");return i||t}function N_(n,t,e,r){const i=n.getBlockById(t.blockId),o=le(n,i).moveCaret(n,i,t,e);if(o)return o;let l=e==="ArrowDown"||e==="ArrowRight"?__(n,t,r):M_(n,t,r);if(l||(l=cC(n,i,e),l||(l=U_(n,i,e))),l||Pt(n,i)&&In(n,i).length===0&&(ol.warn("complex block has not any child container, not loaded?"),l=e==="ArrowDown"||e==="ArrowRight"?zr(i):jr(i)),!l){if(e==="ArrowDown"||e==="ArrowRight"){if(n.readonly||!re(at(i)))return null;const c=n.insertTextBlock("",pt(n.rootContainer),qi(n.rootContainer));return ht(c,0,"home")}return null}if(l=O_(n,l,e),ot(n,l)){const c=n.selection.getSuggestedCaretX();if(e==="ArrowDown")return c8(n,l,i,t,c);if(e==="ArrowUp")return a8(n,l,i,t,c)}return e==="ArrowLeft"||e==="ArrowUp"?ht(l,Ct(n,l),"end"):e==="ArrowRight"||e==="ArrowDown"?ht(l,0,"home"):null}function P_(n,t,e){if(t==="ArrowLeft")return e.start;const r=e.end,i=n.getBlockById(r.blockId);if(ot(n,i))return r;const s=ae(i);if(s)return ht(s,0,"home");if(!re(at(i))||n.readonly)return r;const o=n.insertTextBlock("",pt(n.rootContainer),qi(n.rootContainer));return ht(o,0,"home")}function F_(n,t,e){const r=n.selection.range;let i;if(r instanceof bn)e==="move"&&!r.isCollapsed()&&(t==="ArrowLeft"||t==="ArrowRight")?i=P_(n,t,r):i=N_(n,r.getFocusedPos(),t,e);else if(i=D_(n,r.focus,t),e==="move"){const s=i!=null?i:r.focus,o=n.getContainerById(s.childContainerId);if(t==="ArrowLeft"||t==="ArrowUp"){const l=Ge(o);i=ht(l,0,"home")}else{const l=_e(o);i=ht(l,Ct(n,l),"end")}}return i?e==="move"?{anchor:i,focus:i}:t0(n,r.anchor,i):null}function ll(n,t,e){const r=F_(n,t,e);if(!r)return!1;const{anchor:i,focus:s}=r;return n.selection.setSelection(i,s),(t==="ArrowLeft"||t==="ArrowRight")&&n.selection.updateLastCaretRect(),!0}function d5(n){return ll(n,"ArrowLeft","move"),!0}function h5(n){return ll(n,"ArrowRight","move"),!0}function m5(n){return ll(n,"ArrowUp","move"),!0}function g5(n){if(ll(n,"ArrowDown","move")||n.readonly)return!0;const t=n.getFocusedBlock(),e=at(t);if(re(e)||Ge(e)!==t)return!0;const r=n.rootContainer;return n.insertTextBlock("",pt(r),qi(r)),!0}function p5(n){return ll(n,"ArrowDown","select"),!0}function C5(n){return ll(n,"ArrowLeft","select"),!0}function E5(n){return ll(n,"ArrowRight","select"),!0}function A5(n){return ll(n,"ArrowUp","select"),!0}const x5=D("word-offset");function uC(n,t){const e=n.selection.range.focus;p(x5,e.isSimple(),"invalid range type");const r=n.getBlockById(e.blockId);if(ve(n,r))return ht(r,0,"home");if(e.offset===0||!ot(n,r)){const o=He(r);if(!o)return null;const l=ht(o,Ct(n,o),"end");if(t==="select"&&ot(n,o)){const c=j1(n,o,l.offset);return ht(o,c,"normal")}return l}const i=j1(n,r,e.offset);return ht(r,i,"normal")}function fC(n,t){const e=n.selection.range.focus;p(x5,e.isSimple(),"invalid range type");const r=n.getBlockById(e.blockId);if(ve(n,r))return ht(r,0,"end");if(e.offset===Ct(n,r)||!ot(n,r)){const o=ae(r);if(!o)return null;const l=ht(o,0,"home");if(t==="select"&&ot(n,o)){const c=z1(n,o,l.offset);return ht(o,c,"end")}return l}const i=z1(n,r,e.offset);return ht(r,i,"normal")}function b5(n){if(!n.selection.range.focus.isSimple())return!1;const e=uC(n,"move");return e?(n.selection.setSelection(e),n.selection.updateLastCaretRect(),!0):!1}function v5(n){if(!n.selection.range.focus.isSimple())return!1;const e=fC(n,"move");return e?(n.selection.setSelection(e),n.selection.updateLastCaretRect(),!0):!1}function B5(n){if(!n.selection.range.focus.isSimple())return!1;const e=uC(n,"select");return e?(n.selection.setSelection(n.selection.getAnchorPos(),e),n.selection.updateLastCaretRect(),!0):!1}function y5(n){if(!n.selection.range.focus.isSimple())return!1;const e=fC(n,"select");return e?(n.selection.setSelection(n.selection.range.anchor,e),n.selection.updateLastCaretRect(),!0):!1}D("find-block");function dC(n,t){if(!Pt(n,t))return t;const r=Hr(n,t).getChildContainers(n,t)[0],s=ke(r)[0];return dC(n,s)}function hC(n,t){if(!Pt(n,t))return t;const e=Hr(n,t).getChildContainers(n,t),r=e[e.length-1],i=ke(r),s=i[i.length-1];return hC(n,s)}function mC(n){const t=hC(n,Ge(n.rootContainer)),e=ht(t,Ct(n,t),"end");return n.selection.setSelection(e),!0}function T5(n){const t=dC(n,n.getFirstBlock()),e=ht(t,0,"home");return n.selection.setSelection(e),!0}function k5(n){const t=dC(n,n.getFirstBlock()),e=ht(t,0,"home");return n.selection.setSelection(n.selection.getAnchorPos(),e),!0}function gC(n){const t=hC(n,Ge(n.rootContainer)),e=ht(t,Ct(n,t),"end");return n.selection.setSelection(n.selection.getAnchorPos(),e),!0}const R5=D("line-offset");function w5(n){const t=n.selection.range.focus;p(R5,t.isSimple(),"invalid range type");const e=n.getBlockById(t.blockId);if(t.offset===0||!ot(n,e))return ht(e,0,"home");let i=r3(e,t).start;const{next:s}=Mf(e,i);return s&&Br(s)&&Lf(s)==="br"&&(i+=1),ht(e,i,"home")}function S5(n){const t=n.selection.range.focus;p(R5,t.isSimple(),"invalid range type");const e=n.getBlockById(t.blockId);if(t.offset===Ct(n,e)||!ot(n,e))return ht(e,Ct(n,e),"end");const r=r3(e,t);return ht(e,r.end,"end")}function L5(n){if(!n.selection.range.focus.isSimple())return!1;const e=w5(n);return e?(n.selection.setSelection(n.selection.getAnchorPos(),e),n.selection.updateLastCaretRect(),!0):!1}function I5(n){if(!n.selection.range.focus.isSimple())return!1;const e=S5(n);return e?(n.selection.setSelection(n.selection.getAnchorPos(),e),n.selection.updateLastCaretRect(),!0):!1}function D5(n){if(!n.selection.range.focus.isSimple())return!1;const e=w5(n);return e?(n.selection.setSelection(e),n.selection.updateLastCaretRect(),!0):!1}function _5(n){if(!n.selection.range.focus.isSimple())return!1;const e=S5(n);return e?(n.selection.setSelection(e),n.selection.updateLastCaretRect(),!0):!1}D("find-block-position"),D("page-offset");function M5(n,t){const r=le(n,t).getBlockTextLength(t),i=ht(t,r,"normal"),s=t0(n,n.selection.getAnchorPos(),i);if(!s)return!1;const{anchor:o,focus:l}=s;return n.selection.setSelection(o,l,{noScroll:!0}),n.selection.updateLastCaretRect(),!0}function U5(n,t){const e=ht(t,0,"normal"),r=t0(n,n.selection.getAnchorPos(),e);if(!r)return!1;const{anchor:i,focus:s}=r;return n.selection.setSelection(i,s,{noScroll:!0}),n.selection.updateLastCaretRect(),!0}async function O5(n){const t=jm(n)*.9,e=mn(n.rootContainer);await ra(Math.min(e.scrollTop+t*2,e.scrollHeight),{elementToScroll:e})}async function N5(n){const t=jm(n)*.9,e=mn(n.rootContainer);await ra(Math.max(e.scrollTop-t,0),{elementToScroll:e})}function P5(n){return N5(n),!0}function F5(n){return O5(n),!0}const K_=D("table-scroll");class K5{constructor(t,e,r,i,s){m(this,"handleEvent",t=>{this.handler(this.editor,t,this.data)});this.editor=t,this.dom=e,this.name=r,this.handler=i,this.data=s,e.addEventListener(r,this.handleEvent)}destroy(){this.dom.removeEventListener(this.name,this.handleEvent)}}class V_{constructor(t){m(this,"handlers",new Map);this.editor=t}destroy(){Array.from(this.handlers.entries()).forEach(([t,e])=>{e.forEach(r=>r.destroy()),this.handlers.delete(t)})}addEventListener(t,e,r,i){const s=this.handlers.get(t);if(s){if(s.find(o=>o.handler===r&&o.name===e)){K_.warn(`event has already registered: ${e}`);return}s.push(new K5(this.editor,t,e,r,i))}else{const o=new K5(this.editor,t,e,r,i);this.handlers.set(t,[o])}}removeEventListener(t,e,r){if(!t){for(const[s,o]of Array.from(this.handlers.entries()))for(let l=o.length-1;l>=0;l--){const c=o[l];if(e)e===c.name&&r===c.handler&&o.splice(l,1);else if(r===c.handler){o.splice(l,1),c.destroy(),o.length===0&&this.handlers.delete(s);continue}}return}const i=this.handlers.get(t);if(i){const s=i.findIndex(o=>o.handler===r&&o.name===e);if(s!==-1){const o=i[s];i.splice(s,1),o.destroy(),i.length===0&&this.handlers.delete(t)}}}removeAllListeners(t,e){const r=this.handlers.get(t);if(r)if(e)for(let i=0;i<r.length;i++){const s=r[i];s.name===e&&(r.splice(i,1),s.destroy())}else r.forEach(i=>{i.destroy()}),this.handlers.delete(t)}}function V5(n){if(!n.selection.range.focus.isSimple())return!1;const e=mn(n.rootContainer);return e.scrollTop===0?U5(n,n.getFirstBlock()):(N5(n).then(()=>{const r=e.getBoundingClientRect(),i=r.left+r.width/2,s=r.top+jm(n)*.1,o=Pe(i,s);if(o){const l=et(o);l&&U5(n,l)}}),!0)}function $5(n){if(!n.selection.range.focus.isSimple())return!1;const e=mn(n.rootContainer);return e.scrollTop+e.clientHeight>=e.scrollHeight?M5(n,n.getLastBlock()):(O5(n).then(()=>{const r=jm(n)*.9,i=e.getBoundingClientRect(),s=i.left+i.width/2,o=i.top+r,l=Pe(s,o);if(l){const c=et(l);c&&M5(n,c)}}),!0)}const Xf=D("select-all");function H5(n,t){const e=_e(n),r=Ge(n);return t.start.offset===0&&t.start.blockId===ut(e)&&t.end.offset===Ct(t.getEditor(),r)&&t.end.blockId===ut(r)}function $_(n,t){const e=t.getEditor(),r=Hr(e,n).getChildContainers(e,n),i=r[0],s=r[r.length-1],o=ut(n);return t.start.blockId===o&&t.start.childContainerId===pt(i)&&t.end.blockId===o&&t.end.childContainerId===pt(s)}function H_(n,t){p(Xf,t,"no parent block"),p(Xf,Pt(n,t),"not a complex block");const e=Hr(n,t).getChildContainers(n,t),r=e[0],i=e[e.length-1];n.selection.setRange(pn(n,{anchor:Me(t,pt(r)),focus:Me(t,pt(i))}))}function j5(n,t){const e=at(t);e0(n,e)}function pC(n){const t=n.getFocusedBlock(),e=n.selection.range;if(e.start.isSimple()){if(e.start.blockId===e.end.blockId&&ot(n,t)){const i=e.start,s=e.end,o=Ct(n,t);if(i.offset>0||s.offset<o)return n.selection.selectBlock(t,0,o),!1}return q(n.rootContainer,"select-all"),j5(n,_e(n.rootContainer)),!1}return p(Xf,!e.isSimple(),"invalid range type"),$_(t,e)?(j5(n,t),!1):(p(Xf,t,"no parent block"),p(Xf,Pt(n,t),"not a complex block"),H_(n,t),!0)}function e0(n,t){const e=ke(t),r=e[0],i=e[e.length-1],s=ht(r,0,"home"),o=ht(i,Ct(n,i),"end");n.selection.setSelection(s,o,{noScroll:!0})}function j_(n){gC(n),n.focus()}function z_(n){const t=[];return n.forEach(e=>{var r;((r=e.attributes)==null?void 0:r.box)===!0?(t.length>0&&t[t.length-1].length===0&&t.pop(),t.push([e]),t.push([])):t.length>0?t[t.length-1].push(e):t.push([e])}),t.length>0&&t[t.length-1].length===0&&t.pop(),t}function CC(n,t,e,r=!1){var c;if(!e)return[];const i=e.length;e=e.toLowerCase();const s=[];let o=0;const l=z_(t);for(const d of l){if(((c=d[0].attributes)==null?void 0:c.box)===!0){const E=d[0].attributes,A=n.editorBoxes.getBoxClass(E.type);(A==null?void 0:A.matchText)&&!r&&A.matchText(n,E,e)&&s.push({start:o,end:o+1}),o+=1;continue}const h=Re(d,{boxReplacement:" "}).toLowerCase();let C=h.indexOf(e,0);for(;C!==-1;)s.push({start:C+o,end:C+i+o}),C=h.indexOf(e,C+i);o+=h.length}return s}function z5(n,t,e,r,i){const s=CC(n,t,e,!0);let o=Et.default(t);return s.length===0||(s.reverse().forEach(l=>{o=Nm(o,l.start,l.end,r)}),i&&(i.count=s.length)),o}const EC=D("selected-block-to-doc");function G5(n,t,e){!t.children||t.children.forEach(r=>{const i=n.getChildContainerData(r);i.forEach(s=>{G5(n,s,e)}),e.blocks[r]=Et.default(i)})}function n0(n,t){const e=le(n,t.block);if(e.selectionToDoc)return e.selectionToDoc(n,t);const r=Et.default(Xs(n,t.block));if(ot(n,t.block)){const s=t.start,o=t.end;if(p(EC,r.text,"no block text"),s.offset===o.offset)return{blocks:{root:[{...r,text:[]}]},meta:{},comments:{}};const{middle:l}=ln(r.text,s.offset,o.offset-s.offset);return{blocks:{root:[{...r,text:l}]},meta:{},comments:{}}}if(Le(t.block))return{blocks:{root:[r]},meta:{},comments:{}};p(EC,Pt(n,t.block),"not complex block"),p(EC,r.children,"no children");const i={blocks:{root:[r]},meta:{},comments:{}};return G5(n,r,i),i}function AC(n,t){const e=ht(t,0,"normal"),r=ht(t,Ct(n,t),"end");return n0(n,{block:t,start:e,end:r})}const G_=D("block-to-doc");function W5(n,t){p(G_,t.length>0,"invalid params, no blocks");const e=t.map(r=>AC(n,r));return Ca(e)}function Yc(n){const e=n.selection.range.getSelectedBlocks().map(r=>n0(n,r));return Ca(e)}function q5(n,t){const e=n.getContainerById(t),s=ke(e).map(o=>({start:ht(o,0,"home"),end:ht(o,Ct(n,o),"end"),block:o})).map(o=>n0(n,o));return Ca(s)}const X5=D("ensure-block-visible");function W_(n,t){var e;for(;t;){const r=at(t);if(re(r)){n.emit("resize",n);return}const i=et(r);p(X5,i,"no parent block");const s=le(n,i);s.isChildContainerVisible&&!((e=s.isChildContainerVisible)!=null&&e.call(s,n,i,r))&&(p(X5,s.showChildContainer,"no showChildContainer method"),s.showChildContainer(n,i,r)),t=i}}const r0=D("editor-selection");class q_{constructor(t){m(this,"editor");m(this,"caret");m(this,"_range");m(this,"lastCaretRect");m(this,"handleBlockDelete",(t,e,r,i)=>{if(r||i.child)return;const s=this.range;if(N3(e,s)){r0.debug("adjust selection because remote deleted current block");const o=P3(t,e);this.setRange(o,{noScroll:!0})}});this.editor=t;const e=t.getFirstBlock(),r=ut(e);this.caret=new a_(t);const i=ht(r,0,"normal");this._range=pn(t,{anchor:i,focus:i}),this.lastCaretRect=null,this.editor.addListener("blockDeleted",this.handleBlockDelete),setTimeout(()=>{this.updateFocusedBlock(null)})}destroy(){this.caret.destroy()}get range(){return this._range}get focusedBlock(){return this.getFocusedBlock()}get startBlock(){return this.getStartBlock()}get endBlock(){return this.getEndBlock()}getFocusedBlock(){const t=this.range.focus;return this.editor.getBlockById(t.blockId)}getStartBlock(){const t=this.range.start;return this.editor.getBlockById(t.blockId)}getEndBlock(){const t=this.range.end;return this.editor.getBlockById(t.blockId)}selectBlock(t,e,r,i){const s=ht(t,e,"normal");let o;r&&(o=ht(t,r,"normal")),this.setSelection(s,o,i)}setSelection(t,e,r){if(e||(e=t),this.verifyPos(t),this.verifyPos(e),!this.selectionChanging(t,e))return this.range;const i=this.editor.getBlockById(t.blockId);W_(this.editor,i);const s=pn(this.editor,{anchor:t,focus:e});if(this.range.isEqual(s))return this.range;const o=this._range;return this._range=s,this.selectionChanged(),this.updateFocusedBlock(o),Mt(this.editor.rootContainer,"select-all")&&(!s.isSimple()||!g_(this.editor,s))&&ct(this.editor.rootContainer,"select-all"),r!=null&&r.noScroll||this.scrollIntoView(),this.range}setRange(t,e){return this.setSelection(t.anchor,t.focus,e)}updateSelection(t,e){this.caret.update(),M3(this.editor),e!=null&&e.focusBlockChanged&&this.updateFocusedBlock(t)}getFocusedPos(){return this.range.focus}getAnchorPos(){return this.range.anchor}selectionChanging(t,e){return!0}selectionChanged(){this.caret.update(),M3(this.editor),this.editor.emit("selectionChanged",this.editor)}updateLastCaretRect(){const t=this.range.focus;if(!xi(t))return;const e=this.editor.getBlockById(t.blockId);this.lastCaretRect=Zo(this.editor,e,t)}getSuggestedCaretX(){var t;return(t=this.lastCaretRect)==null?void 0:t.x}scrollIntoView(){m_(this.editor)}verifyPos(t){const e=this.editor.getBlockById(t.blockId);if(t.isSimple())t.offset>=0&&t.offset<=Ct(this.editor,e)||p(r0,!1,"invalid block position, out of range");else{const r=t.childContainerId;!!this.editor.getContainerById(r)||p(r0,!1,"invalid complex block position, no container found")}}updateFocusedBlock(t){if(t&&this.range.start.blockId===t.start.blockId)return;let e;t&&t.start.blockId===t.end.blockId&&(e=this.editor.findBlockById(t.start.blockId));let r;(this.range.isCollapsed()||!this.range.isSimple()||this.range.start.blockId===this.range.end.blockId)&&(r=this.editor.getBlockById(this.range.start.blockId));let i=!1;e&&Mt(e,"focused")&&(ct(e,"focused"),i=!0),this.removeAllBlockFocusedClass(),r&&this.setBlockFocused(r)&&(i=!0),i&&this.editor.emit("focusBlockChanged",this.editor,r!=null?r:null,e!=null?e:null)}verify(){this.verifyPos(this._range.start),this.verifyPos(this._range.end)}to(t){const e=Yc(this.editor);return t==="text"?il(this.editor,e):t==="markdown"?V3(this.editor,e):K3(this.editor,e)}removeAllBlockFocusedClass(){this.editor.rootContainer.querySelectorAll('div[data-type="editor-block"].focused, div[data-type="editor-block"].child-focused').forEach(t=>{ct(t,"focused"),ct(t,"child-focused")})}setBlockFocused(t){if(Mt(t,"focused"))return!1;q(t,"focused");let e=at(t);for(;gi(e);){const r=et(e);p(r0,r,"parent block not found"),q(r,"child-focused"),e=at(r)}return!0}}function X_(n){const t=n.selection.range.focus;if(!t.isSimple())return;const e=n.findBlockById(t.blockId);!e||n.selection.selectBlock(e,0,Ct(n,e))}function Y_(n){const t=n.selection.range.focus;if(!t.isSimple())return;const e=n.findBlockById(t.blockId);if(!e||!ot(n,e))return;let r=uC(n,"select"),i=fC(n,"select");if(!r||!i)return;const s=t.blockId;r.blockId!==s&&(r=ht(e,0,"home")),i.blockId!==s&&(i=ht(e,Ct(n,e),"end")),n.selection.setSelection(r,i)}class Q_{constructor(t){m(this,"editor");m(this,"startPos",null);m(this,"lastCaretRect");m(this,"mouseDownEvent",null);m(this,"autoScroll",null);m(this,"handleMouseDown",(t,e)=>{var i;this.mouseDownEvent=t;const r=x1(this.editor,t.x,t.y);if(r){if(r instanceof Qi)return;if(!this.autoScroll&&e.autoScroll){const o=r.getSelectedBlocks(),l=mn(o[0].block);this.autoScroll=new xm({scrollElement:l,edge:{top:50,bottom:50}})}const s=this.editor.selection.range;if(t.shiftKey&&s.isSimple()){const o=s.anchor;this.editor.selection.setSelection(o,r.focus),this.startPos=r.start}else this.editor.selection.setSelection(r.anchor,r.focus),this.startPos=r.start;this.editor.selection.updateLastCaretRect(),e.autoScroll&&((i=this.autoScroll)==null||i.active())}});m(this,"handleMouseMove",t=>{if(!this.startPos||!this.mouseDownEvent||Math.abs(this.mouseDownEvent.x-t.x)<3&&Math.abs(this.mouseDownEvent.y-t.y)<3)return;const e=wm(this.editor,t.x,t.y);if(!e)return;const r=t0(this.editor,this.startPos,e.end);if(!r)return;const{anchor:i,focus:s}=r;this.editor.selection.setSelection(i,s)});m(this,"handleMouseUp",t=>{var e;(e=this.autoScroll)==null||e.inactive(),this.startPos=null});this.editor=t,this.startPos=null,this.lastCaretRect=new DOMRect}isSelecting(){return this.startPos!==null}stopSelection(){this.startPos=null}handleDblClick(t){Y_(this.editor)}handleTripleClick(t){X_(this.editor)}}function J_(n){return n.readonly||!n.isWritable()?!1:(n.undoManager.undo(),!0)}function Z_(n){return n.readonly||!n.isWritable()?!1:(n.undoManager.redo(),!0)}const Y5=D("delete-text");function Q5(n,t,e,r){const i=r!=null?r:n.selection.range.start;i instanceof gn||p(Y5,!1,`invalid insert pos type: ${typeof i}`);const{blockId:s}=i,o=n.getBlockById(s);p(Y5,ot(n,o),"block is not a text kind block");let{offset:l}=i;if(t==="backward"){if(l-e<0)return 0;if(!or(o,l-e)){const c=rl(o,l);e=l-c}}else if(t==="forward"&&l+e>Ct(n,o))return 0;return t==="backward"&&(l-=e),n.deleteTextFromBlock(o,l,e)}function J5(n,t){if(n.getBlockData(t).quoted){const e={quoted:null};return n.updateBlockData(t,e),!0}return!1}const tM=D("handle-backspace");function xC(n,t){if(!ve(n,t))return;const e=at(t);qi(e)!==1&&n.deleteBlock(t)}function eM(n,t){if(!n.selection.range.isCollapsed()){n.clearSelectedContents();return}const e=n.selection.range.start,r=n.getBlockById(e.blockId);if(ot(n,r))if(e.offset===0){if(J5(n,r))return;const i=jr(r);if(i){if(!n.isBlockWritable(i))return;if(ot(n,i))n.mergeTextBlock(i,r,{focus:!0});else if(Pt(n,i)){xC(n,r);const s=Pc(n,i);s?n.selection.selectBlock(s,Ct(n,s)):n.selection.selectBlock(i,0,Ct(n,i))}else xC(n,r),p(tM,Le(i),"prev block is not embed block"),n.selection.selectBlock(i,1)}else{const s=at(r);if(gi(s)){const o=hB(n,s,{visibleOnly:!0});if(o){if(!n.isBlockWritable(o))return;xC(n,r),n.selection.selectBlock(o,Ct(n,o))}}}}else Q5(n,"backward",1,null),n.selection.updateLastCaretRect();else{const i=Rt(r),s=at(r);n.insertTextBlock("",pt(s),i),n.deleteBlock(r)}}function nM(n,t){if(!n.selection.range.isCollapsed()){n.clearSelectedContents();return}const e=n.selection.range.start,r=n.getBlockById(e.blockId);if(ot(n,r))if(e.offset===Ct(n,r)){const i=ae(r);if(i){if(!n.isBlockWritable(i))return;ot(n,i)?n.mergeTextBlock(r,i,{focus:!0}):ve(n,r)?n.deleteBlock(r,Ue(n,i,0)):n.deleteBlock(i)}}else Q5(n,"forward",1,null);else{const i=Rt(r),s=at(r);n.insertTextBlock("",pt(s),i),n.deleteBlock(r)}}function rM(n){const{range:t}=n.selection,{start:e,end:r}=t,i=n.getBlockById(e.blockId),s=n.getBlockById(r.blockId);if(i!==s||!Pt(n,i))return!1;if(xi(e))return!0;const o=Nc(n,i,e,r),l=In(n,i);return o.length===l.length}function iM(n,t){if(rM(n)){const o=n.getFocusedBlock(),l=Rt(o),c=pt(at(o));n.insertTextBlock("",c,l+1);return}const e=n.getFocusedBlock(),{start:r,end:i}=n.selection.range,s=r.blockId===i.blockId&&Le(e);if(!n.selection.range.isCollapsed()&&!s&&n.clearSelectedContents(),ot(n,e)){if(ve(n,e)&&J5(n,e))return;const o=n.selection.range.start,l=n.breakTextBlock(e,o.offset,{copyBlockAttributes:!0});o.offset!==0?n.selection.selectBlock(l,0):n.selection.scrollIntoView()}else{const o=n.insertTextBlock();n.selection.selectBlock(o,0)}}function sM(n,t){const e=n.selection.range.getSelectedBlocks()[0],{block:r}=e;if(!ot(n,r))return!1;const i=e.end;return n.insertBoxToBlock(r,i.offset,{type:"br",id:it(),box:!0,created:Date.now()}),!0}function bC(n,t,e,r){if(e.type==="embed"){const l=e.embedData.src;if(l&&typeof l=="string")for(const c of l.split("|"))r.add(c);return}const i=e.text;i&&i.forEach(o=>{if(o.attributes&&o.attributes.src&&typeof o.attributes.src=="string")if(Hs(o)){const l=n.editorBoxes.getBoxClass(o.attributes.type);if(l.getResources){const c=l.getResources(n,o.attributes);c?c.forEach(d=>{r.add(d)}):r.add(o.attributes.src)}else r.add(o.attributes.src)}else r.add(o.attributes.src)});const s=e.children;s&&s.forEach(o=>{t.blocks[o].forEach(c=>{bC(n,t,c,r)})})}function oM(n,t){const e=new Set;return t.blocks.root.forEach(i=>{const s=n.editorBlocks.getBlockClass(i.type);if(s.getResources){const o=s.getResources(n,i);o?o.forEach(l=>{e.add(l)}):bC(n,t,i,e)}else bC(n,t,i,e)}),Array.from(e)}function Yf(n,t){return xe.isFirefox?`<!doctype html><html><head><meta charset="utf8" /></head><body><canvas data-editor-doc="${Wi(JSON.stringify(t))}" id="ones-editor-doc"></canvas>${n}</body></html>`:`<!doctype html><html><head><meta charset="utf8" />${`<meta charset="utf-8"><ones-editor-doc data-source="ones-editor-doc::${Wi(JSON.stringify(t))}::ones-editor-doc" />`}</head><body>${n}</body></html>`}function Qf(n,t){var s,o,l;const e=(l=(o=(s=n.doc).getServerMeta)==null?void 0:o.call(s))!=null?l:{},r=oM(n,t),i={};r.forEach(c=>{const d=n.doc.buildResourceUrl(c,{withToken:!0});i[c]=d}),t.meta={...e,resources:i}}function lM(n,t,e){if(t.preventDefault(),t.stopPropagation(),!t.clipboardData)return;let r=Yc(n);const i=e==null?void 0:e(n,t,r);if(i===!0)return;typeof i=="object"&&i!==null&&(r=i),Qf(n,r);const s=jf(n,r),o=il(n,r),l=Yf(s,r);t.clipboardData.setData("text/html",l),t.clipboardData.setData("text/plain",o),t.clipboardData.setData("text/x-ones-editor-doc",JSON.stringify(r))}function i0(n,t){Qf(n,t);const e=jf(n,t),r=Yf(e,t),i=il(n,t),s=new Blob([r],{type:"text/html"});yf([{type:"text/plain",data:new Blob([i],{type:"text/plain"})},{type:"text/html",data:s}])}function aM(n,t){if(n.selection.range.isCollapsed())return;let e=Yc(n);const r=t==null?void 0:t(n,new ClipboardEvent("mock-event"),e);r!==!0&&(typeof r=="object"&&r!==null&&(e=r),i0(n,e))}async function vC(n,t){if(!window.isSecureContext)throw new Error("Can't copy block in insecure context.");const e=AC(n,t);i0(n,e)}const cM=D("input-handler-actions");function Z5(n,t){return n.readonly||!n.isWritable()?!1:n.undoManager.runInGroup(()=>(iM(n),!0))}function ty(n,t){return n.readonly||!n.isWritable()?!1:n.undoManager.runInGroup(()=>(nM(n),!0))}function ey(n,t){return n.readonly||!n.isWritable()?!1:n.undoManager.runInGroup(()=>(eM(n),!0))}function ny(n,t){return n.readonly||!n.isWritable()?!1:n.undoManager.runInGroup(()=>(sM(n),!0))}function ry(n){return n.readonly||!n.isWritable()||!window.isSecureContext?!1:(navigator.clipboard.readText().then(t=>{n.input.handlePasteText(t,{toPlainText:!0})}).catch(t=>{cM.error(t)}),!0)}function iy(n){return n.selection.range.getSelectedBlocks().every(e=>{const r=e.block,i=at(r);if(re(i))return!1;const s=et(i);return s&&Ot(s)==="code"})}function sy(n,t){const e=n.selection.range.getSelectedBlocks(),r=at(e[0].block),i=et(r);return i?`\`\`\`${n.getBlockData(i).language}
@@ -661,7 +661,7 @@ ${l}`:r==="markdown"?`\`\`\`${i.language}
661
661
  ${o}
662
662
  \`\`\`
663
663
  ${l}`:`<p><pre><code>${hm(o)}</code></pre></p>
664
- <p>${hm(l)}</p>`}function oH(n,t){gT(n,LR)}const EA={blockType:"code",blockKind:"complex",createBlockContent:z$,getBlockTextLength:G$,getRangeFromPoint:W$,moveCaret:q$,getCaretRect:X$,updateSelection:Y$,clearSelection:Q$,getChildContainers:J$,getNextContainer:Z$,getSelectedContainers:tH,convertFrom:C$,handleBlockElementUpdated:eH,getOptions:rH,getBlockProperties:iH,convertTo:sH,handleDeleteBlock:oH},AA={...lr,blockType:"code-line"};class lH{constructor(t){m(this,"handleSelectionChange",()=>{const t=this.editor.selection;if(!t.range.isCollapsed())return;const e=t.focusedBlock;if(!_d(this.editor,e))return;const r=e,i=t.range.focus.offset,s=CB(this.editor,r,i,"code-caret");s.scrollIntoView({block:"nearest"}),setTimeout(()=>{s.remove(),this.editor.selection.caret.update()})});this.editor=t,t.addListener("selectionChanged",this.handleSelectionChange)}destroy(){this.editor.removeListener("selectionChanged",this.handleSelectionChange)}}function aH(n){if(!n.isWritable())return!1;const t=n.getFocusedBlock();if(!!_d(n,t)){if(n.selection.range.isCollapsed()){const e=n.selection.range.start;return n.insertTextToBlock(t,e.offset," "),!0}return n.undoManager.runInGroup(()=>{Ji(n).forEach(r=>{n.insertTextToBlock(r.block,0," ")})}),!0}}function cH(n){if(!n.isWritable())return!1;const t=n.getFocusedBlock();if(!_d(n,t))return;const e=[" "," "];return n.undoManager.runInGroup(()=>{Ji(n).forEach(i=>{const s=Re(n.getBlockText(i.block));for(let o=0;o<e.length;o++){const l=e[o];if(s.startsWith(l)){n.deleteTextFromBlock(i.block,0,l.length);break}}})}),!0}function uH(n){const t=n.getFocusedBlock(),e=at(t);if(re(e))return;const r=et(e);if(!r||Ot(r)!=="code")return;const i=n.selection.range;if(!!i.isSimple()&&!H5(e,i))return e0(n,e),!0}const fH={Tab:aH,"Shift+Tab":cH,"CtrlOrCmd+A":uH},Md=D("code-text-decorate");class fg{decorateText(t,e,r){if(p(Md,e.length>0,"invalid path"),e.length===1)return{};const i=e[e.length-2];if(t.doc.getBlockData(i.containerId,i.blockIndex).type!=="code")return{};const o=r;if(o.length===0)return{};const l=Re(o),c=t.doc.getBlockData(i.containerId,i.blockIndex),h=(w=>{if(!w)return wc.default.languages.plain;const S=w.replace(/\s/g,"").toLocaleLowerCase();return wc.default.languages[S]||wc.default.languages.plain})(c.language),C=wc.default.tokenize(l,h),E=(w,S)=>{if(p(Md,w,"no token"),typeof w=="string")return[{insert:w,attributes:Et.default(S)}];p(Md,w instanceof wc.default.Token,"invalid token type");const U=w.content,M=Et.default(S);return M[`style-code-${w.type}`]=!0,typeof U=="string"?[{insert:U,attributes:M}]:Array.isArray(U)?U.filter(Y=>Y.length).map(Y=>E(Y,M)).flat():(p(Md,U instanceof wc.default.Token,"invalid token"),E(U,M))},v=C.map(w=>E(w,{})).flat();return p(Md,Vn(v)===Vn(o),"failed to highlight code, text length mismatch"),{text:v}}}const dH={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",plainText:"Plain Text"}},hH={code:{title:"Code",abstract:"Code",wrap:"Wrap",copy:"Copy",caption:"Caption",search:"Search",copySuccess:"Copied successfully",plainText:"Plain Text"}},mH={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",plainText:"\u30D7\u30EC\u30FC\u30F3\u30C6\u30AD\u30B9\u30C8"}};_.mergeLang({"zh-CN":dH,"en-US":hH,"ja-JP":mH});function gH(n,t,e,r){const i=n.getBlockByIndex(t,e);if(Ct(n,i)!==r)return!1;const s=Re(n.getBlockText(i));if(![...s].every(h=>h==="|")||s.length<3||!n.editorBlocks.hasBlock("table"))return!1;const o=n.editorBlocks.getBlockClass("table");if(!o.convertFrom)return!1;const l=o.convertFrom(n,i,{offset:r});if(!l)return!1;const{blockData:c,focusBlockId:d}=l;return c?(n.undoManager.runInGroup(()=>{var C;const h=n.insertBlock(t,e,c,Ue(n,d!=null?d:c.id,0));n.deleteBlock(i),(C=l.onConverted)==null||C.call(l,n,h)}),!0):!1}const pH={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\]/i,data:{embedType:"toc"}}},CH={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 dg(n,t,e,r,i){const s=n.getContainerById(t);if(!re(s)){const o=et(s);if(o&&Di(o))return!0}return!1}function IR(n,t,e,r,i){if(dg(n,t))return!1;if(i==="enter"&&gH(n,t,e,r))return!0;const s=n.getBlockByIndex(t,e),o=Re(sr(n.getBlockText(s),r).left),l=i==="enter"?pH:CH;for(const[,c]of Object.entries(l)){if(!o.match(c.reg))continue;return!!n.undoManager.runInGroup(()=>{var v;const h=Tm(n,s,c.blockType,{offset:r,data:c.data});if(!h)return null;const{blockData:C,focusBlockId:E}=h;if(!C)return null;const A=n.insertBlock(t,e,C,Ue(n,E!=null?E:C.id,0));return n.deleteBlock(s),(v=h.onConverted)==null||v.call(h,n,A),{newBlock:A,focusBlockId:E}})}return!1}function EH(n,t,e,r){const i=n.getBlockByIndex(t,e);return n.getBlockString(i,{boxReplacement:" "}).substring(0,r)!==">"?!1:(n.undoManager.runInGroup(()=>{n.deleteTextFromBlock(i,0,r+1),n.updateBlockData(i,{quoted:!0},Ue(n,i,0))}),!0)}const AH={"#":1,"##":2,"###":3,"####":4,"#####":5,"######":6,"#######":7,"########":8};function xH(n,t,e,r){const i=n.getBlockByIndex(t,e),s=n.getBlockString(i,{boxReplacement:" "}).substring(0,r);let o=AH[s];if(!o)return!1;const l=n.getBlockData(i).heading;return l&&l==o&&(o=null),n.undoManager.runInGroup(()=>{n.deleteTextFromBlock(i,0,r+1),n.updateBlockData(i,{heading:o},Ue(n,i,0))}),!0}function bH(n,t,e,r){return!!(xH(n,t,e,r)||EH(n,t,e,r))}const vH=D("match-text-style");function BH(n,t){if(n.length<t.length*2+1||!n.endsWith(t)||n.substring(0,n.length-1).endsWith(t))return-1;const e=n.substring(0,n.length-t.length),r=e.lastIndexOf(t);return r===-1?-1:r===0?0:e.substring(r-1).startsWith(t)?-1:r}const yH={"*":{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 TH(n,t,e,r){var E,A;const i=n.getBlockByIndex(t,e),s=n.getBlockText(i),{left:o}=sr(s,r),l=V1(o),c=Vn(o)-l.length,d=Object.entries(yH);for(const[v,w]of d){const S=BH(l,v);if(S===-1)continue;const U=c+S,M=r,V=v.length,nt=Re(ln(s,U+V,M-U-V*2).middle);if(w.type==="style"){const Y={};w.styles.forEach(ft=>{Y[ft]=!0});const X=pa(nt,Y);n.undoManager.runInGroup(()=>{n.deleteTextFromBlock(i,U,M-U),n.insertTextToBlock(i,U,X)})}else if(w.type==="box")try{const Y=(A=(E=n.editorBoxes.getBoxClass(w.boxType)).convertFrom)==null?void 0:A.call(E,n,nt);if(!Y)continue;n.undoManager.runInGroup(()=>{n.deleteTextFromBlock(i,U,M-U),n.insertBoxToBlock(i,U,Y)})}catch(Y){vH.warn(`failed to convert to box, ${Y.message}`);continue}return!0}const h=/\[([^\]]+)\]\((https?:\/\/\S+)\)\s*$/,C=l.match(h);if(C){const v=C.index,w=C[1],S=C[2],U=v,M=r,nt={...$c(s,U),link:S};return n.undoManager.runInGroup(()=>{n.deleteTextFromBlock(i,U,M-U),n.insertTextToBlock(i,U,pa(w,nt))}),!0}return!1}class hg{handleAfterInsertText(t,e,r,i,s){if(s===" "){if(dg(t,e))return!1;if(bH(t,e,r,i)||TH(t,e,r,i))return!0}return!1}handleBeforeKeyDown(t,e){if(!t.selection.range.isSimple())return!1;const{containerId:i,blockIndex:s,offset:o}=t.getTextPosition();if(ot(t,t.getBlockByIndex(i,s))){if(Gi(e,"Enter")){if(IR(t,i,s,o,"enter"))return!0}else if(Gi(e,"Space")&&IR(t,i,s,o,"space"))return!0}return!1}}const kH={"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"}}};_.mergeLang(kH);function Ud(n,t){const e=Xs(n,t);return!!(ot(n,t)&&e.text&&Vn(e.text)===0&&!t.querySelector(".inputting-insertion"))}function DR(n,t){var r;zt(t).removeAttribute("data-content-placeholder"),(r=t.querySelector("[data-type=block-tools] .block-placeholder-container"))==null||r.remove()}function Od(n,t,e){var i;if(DR(n,t),!Ud(n,t))return;const r=zt(t);if(typeof e=="string")r.setAttribute("data-content-placeholder",e);else{const s=be(t),o=(i=s.querySelector(".block-placeholder-container"))!=null?i:B("div",["block-placeholder-container"],s);o.innerHTML="",o.appendChild(e)}}function RH(n){const t=n.getAttribute("data-style-heading");return t?_.t("placeholder.heading",{heading:t}):n.getAttribute("data-style-quoted")?_.t("placeholder.quote"):null}function wH(n){const t=n.getAttribute("data-list-type");return t?t==="ordered"||t==="unordered"?_.t("placeholder.list"):_.t("placeholder.mention"):null}function _R(n){switch(Ot(n)){case"text":return RH(n);case"list":return wH(n);default:return null}}function SH(n){if(Gr(n))return!1;const t=et(at(n));return t?Ot(t)==="code":!1}function LH(n){return!Gr(n)}function IH(n,t){var h,C;const e=n.selection.focusedBlock,r=Ot(e),i=t.contentPlaceholder||_.t("placeholder.default");let s=i;if(r&&Sf(n,r)&&e){if(!n.isBlockWritable(e)||SH(e))return;LH(e)&&(s=_.t("placeholder.common.contentInTable")),s=(h=_R(e))!=null?h:s}const o=n.getFirstBlock(),l=t.hideTitle?o:ae(o);if(!l)return;const c=ae(l);if(c&&!t.addPlaceholderToAllCurrentEmptyBlock)return;if(!c&&Ud(n,l)){Od(n,l,(C=_R(l))!=null?C:i);return}const d=n.getFocusedBlock();!Ud(n,d)||d===o&&!t.hideTitle||Od(n,d,s)}function DH(n,t){var i,s;const e=n.getFirstBlock(),r=zt(e);Ud(n,e)?(r.setAttribute("data-title-placeholder",(i=t.titlePlaceholder)!=null?i:_.t("placeholder.title")),r.setAttribute("data-title-placeholder-readonly",(s=t.readonlyTitlePlaceholder)!=null?s:"")):(r.removeAttribute("data-title-placeholder"),r.removeAttribute("data-title-placeholder-readonly"))}function MR(n){n.rootContainer.querySelectorAll("[data-content-placeholder").forEach(t=>{t.removeAttribute("data-content-placeholder")}),n.rootContainer.querySelectorAll("[data-type=block-tools] .block-placeholder-container").forEach(t=>{t.remove()})}function _H(n,t){var e;MR(n),n.selection.range.isCollapsed()&&(t.hideTitle||DH(n,t),(e=t.applyContentPlaceholder)!=null&&e.call(t,n)||IH(n,t))}const Aat="";function MH(n){for(let t=0;t<n.length;t++){const e=n[t];if(e.attributes&&Object.keys(e.attributes).length)return!0}return!1}const UR=D("enforce-title");class xA{constructor(t,e={headingLevel:1}){m(this,"handleSelectionChange",t=>{setTimeout(()=>{this.applyPlaceholder(t)})});m(this,"reload",t=>{this.handleChanged(t),this.applyPlaceholder(t)});m(this,"applyPlaceholder",t=>{var e,r;!((e=this.options)!=null&&e.titlePlaceholder)&&!((r=this.options)!=null&&r.contentPlaceholder)||_H(t,this.options)});this.options=e,this.handleChanged(t),this.applyPlaceholder(t),t.addListener("selectionChanged",this.handleSelectionChange),setTimeout(()=>{t.addListener("load",this.reload)}),t.addListener("blur",this.removePlaceholder),t.addListener("focus",this.applyPlaceholder)}destroy(t){t.removeListener("selectionChanged",this.handleSelectionChange),t.removeListener("load",this.reload),t.removeListener("blur",this.removePlaceholder),t.removeListener("focus",this.applyPlaceholder)}handleBeforeKeyDown(t,e){if(!t.selection.range.isSimple())return!1;const{containerId:i,blockIndex:s,offset:o}=t.getTextPosition();if(!this.isDocumentTitleBlock(i,s)||!Gi(e,"Enter"))return!1;let l=!1,c=null;qi(t.rootContainer)===2&&(c=Qo(t.rootContainer,1),Ct(t,c)===0&&(l=!0));const d=t.getFirstBlock();return t.undoManager.runInGroup(()=>{t.breakTextBlock(d,o,{forceInsertAfter:!0}),l&&c&&t.deleteBlock(c)}),!0}handleChanged(t){var e,r;try{const i=t.doc.getContainerBlocks(pt(t.rootContainer));p(UR,i.length>0,"root container is empty");const s=i[0];if(s.type!=="text"&&!this.options.hideTitle){const o=es("",{heading:(e=this.options.headingLevel)!=null?e:1});t.insertBlock(pt(t.rootContainer),0,o,t.selection.range.toDocRange()).setAttribute("data-document-title","");return}if(!this.options.hideTitle){p(UR,s.text,"invalid text block");const o=t.getBlockById(s.id);if(MH(s.text)||s.quoted||s.heading!==this.options.headingLevel){const l=t.getBlockString(o),c=es(l,{heading:(r=this.options.headingLevel)!=null?r:1,quoted:!1}),d=t.selection.focusedBlock;let h=t.selection.range;const C=t.insertBlock(pt(t.rootContainer),0,c);C.setAttribute("data-document-title",""),d===o&&(h=Ue(t,c.id,Ct(t,C))),Xm(t,o,h)}else o.setAttribute("data-document-title","")}if(i.length>1||this.options.hideTitle)return;t.insertTextBlock("",pt(t.rootContainer),1,{newRange:t.selection.range.toDocRange()})}finally{this.applyPlaceholder(t)}}handleRemoteChanged(t){setTimeout(()=>{this.applyPlaceholder(t)})}handleUpdateCompositionText(t){this.applyPlaceholder(t)}removePlaceholder(t){MR(t)}isDocumentTitleBlock(t,e){return t==="root"&&e===0&&!this.options.hideTitle}}function _i(n){return Ot(n)==="embed"&&on(n)==="image"}async function OR(n){return new Promise((t,e)=>{const r=new Image;r.onload=()=>{t({width:r.naturalWidth,height:r.naturalHeight})},r.onerror=e,r.src=n})}async function UH(n){const t=await _c(n);return OR(t)}function vl(n){return typeof n=="number"}const OH=D("image-data"),bu=new Map,Nd=1e3,NR=400,NH=10;function vu(n){return n.src.startsWith("empty:")||!n.src}function PH(n){return n.src.startsWith("http:")||n.src.startsWith("https:")}function PR(n){if(bu.has(n))return bu.get(n);const t=nm.default(n);return bu.set(n,t),`${t}_width`}function FR(n){if(bu.has(n))return bu.get(n);const t=nm.default(n);return bu.set(n,t),`${t}_height`}function KR(n){return`${n}_flex`}function VR(n){let t=n.getBoundingClientRect().width;return t-=Number.parseFloat(window.getComputedStyle(n).paddingLeft)+Number.parseFloat(window.getComputedStyle(n).paddingRight),t}function Bu(n){if(n.every(i=>typeof i.flex=="number"&&i.flex))return;const t=100,r=n.map(i=>{const s=i.width==="auto"?Nd:i.width,o=i.height==="auto"?s/t:i.height/t;return s/o}).reduce((i,s)=>i+s,0);n.forEach(i=>{const s=i.width==="auto"?Nd:i.width,o=i.height==="auto"?s/t:i.height/t,l=s/o;i.flex=l/r})}function yu(n){const t=(i,s)=>{i||(i=`empty:${s}`);const o=PR(i),l=FR(i),c=KR(s);let d=n[o],h=n[l],C=n[c];return typeof d=="string"&&(d=Number.parseInt(d,10)),typeof h=="string"&&(h=Number.parseInt(h,10)),typeof C=="string"&&(C=Number.parseInt(C,10)),{src:i,width:d!=null?d:"auto",height:h!=null?h:"auto",flex:C,virtualSize:!d||!h}};let e=[];const r=n.src;return Array.isArray(r)?e=r.map(t):typeof r=="string"&&(e=r.split("|").map(t)),Bu(e),e}function Mi(n){const t=n.embedData;return yu(n.embedData).length>1?100:t.widthPercent}function FH(n,t,e,r){const i=yu(t.embedData);if(i.length>1||r)return"100%";const s=Mi(t),o=n.rootContainer.getBoundingClientRect().width;if(s){const l=VR(e);return`${Math.min(o*s/100,l)}px`}return vl(i[0].width)?`${i[0].width}px`:"auto"}function jn(n,t){const r={src:n.map(i=>i.src).join("|"),widthPercent:t};return n.forEach((i,s)=>{const o=i.src||`empty:${s}`,l=PR(o);l&&vl(i.width)&&(r[l]=i.width);const c=FR(o);c&&vl(i.height)&&(r[c]=i.height),p(OH,i.flex,"no image flex");const d=KR(s);r[d]=i.flex}),r}function KH(n,t,e,r){const i=yu(t.embedData),s=i.length===1?n.rootContainer:e;if(i.length===1&&r)return`${NR}px`;if(i.some(h=>h.height==="auto"))return"auto";const o=Mi(t);if(!o){if(i.length!==1||vl(i[0].width))return"";const C=i[0].height;return C==="auto"?"auto":`${C}px`}let l=s.getBoundingClientRect().width*(o/100);if(l-=Number.parseFloat(window.getComputedStyle(s).paddingLeft)+Number.parseFloat(window.getComputedStyle(s).paddingRight),s===n.rootContainer&&s!==e&&(l=Math.min(l,VR(e))),i.length===1){const h=i[0];if(h.virtualSize)return"";const C=h.width==="auto"?Nd:h.width;return`${h.height/(C/l)}px`}l-=(i.length-1)*NH;const c=i.reduce((h,C)=>h+C.flex,0);let d=0;for(const h of i){const C=l*h.flex/c,E=h.width==="auto"?Nd:h.width,A=C/E*h.height;d=Math.max(A,d)}return`${d}px`}function VH(n){return n.reduce((e,r)=>e+r.flex,0)}function $H(n,t){B("div",["resize-gripper",t],n).setAttribute("data-resize-type",t)}function bA(n){return be(n).querySelector(".block-resizer")}function HH(n){const t=bA(n);t&&ct(t,"active")}function $R(n,t,e){const r=n.getBoundingClientRect(),i=t.getBoundingClientRect(),s=i.top-r.top,o=i.left-r.left,l=i.width,c=i.height;e.style.top=`${s}px`,e.style.left=`${o}px`,e.style.width=`${l}px`,e.style.height=`${c}px`}function jH(n,t,e,r){const i=bA(n);if(i)return q(i,"active"),$R(n,t,i),i;const s=be(n),o=B("div",["block-resizer"],s);return $R(n,t,o),e.resize.forEach(l=>{$H(o,l)}),o.addEventListener("mousedown",r),q(o,"active"),o}function vA(n,t){const e=bA(n);if(!e||!Ce(n,t))return;const r=n.getBoundingClientRect(),i=t.getBoundingClientRect(),s=i.top-r.top,o=i.left-r.left,l=i.width,c=i.height;e.style.top=`${s}px`,e.style.left=`${o}px`,e.style.width=`${l}px`,e.style.height=`${c}px`}const xat="",zH=D("block-resizer");class Pd extends Ve.TypedEmitter{constructor(e,r){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",e=>{e.preventDefault(),e.stopPropagation();const r=this.getResizableElement();if(!r||e.button!==0)return;const i=e.target;if(!i||!(i instanceof HTMLElement))return;const s=i.getAttribute("data-resize-type");!s||(this.bindEvents(),this.startRect=r.getBoundingClientRect(),this.startPos=e,this.resizeType=s,bf(window.getComputedStyle(i).cursor),this.block&&this.editor.selection.selectBlock(this.block,0))});m(this,"handleMouseMove",e=>{if(!this.startPos||!this.startRect||!this.resizeType||!this.getResizableElement()||!this.block)return;const i=e.x-this.startPos.x,s=e.y-this.startPos.y,o=this.startRect;let{top:l,left:c,right:d,bottom:h}=o;(this.resizeType==="bottom"||this.resizeType==="bottom-left"||this.resizeType==="bottom-right")&&(h+=s),(this.resizeType==="top"||this.resizeType==="top-left"||this.resizeType==="top-right")&&(l+=s),(this.resizeType==="left"||this.resizeType==="top-left"||this.resizeType==="bottom-left")&&(c+=i),(this.resizeType==="right"||this.resizeType==="top-right"||this.resizeType==="bottom-right")&&(d+=i);const C=d>c?d-c:0,E=h>l?h-l:0,A=new DOMRect(c,l,C,E);this.emit("resizing",this,A);const v=this.getResizableElement();v&&vA(this.block,v)});m(this,"handleMouseUp",e=>{if(e.button!==0)return;bf(""),this.unbindEvents(),this.emit("resized",this);const r=this.getResizableElement();!r||!this.block||vA(this.block,r)});this.editor=e,this.options=r}enableResize(e,r){this.block=e,this.resizableElement=r,this.createResizer(),this.enabled=!0}disableResize(){!this.block||(HH(this.block),this.enabled=!1)}update(e,r){this.block=e,this.resizableElement=r,this.getResizableElement()&&this.enabled&&this.createResizer()}updateResizer(){const e=this.getResizableElement();e&&this.block&&vA(this.block,e)}getBlock(){return this.block}destroy(){}getResizableElement(){return this.resizableElement?this.resizableElement:this.block?zt(this.block):null}createResizer(){const e=this.getResizableElement();!e||!this.block||(p(zH,Ce(this.block,e),"not a block child element"),jH(this.block,e,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 GH=D("image-dom");function HR(n){return n.querySelector(".uploading-progress-mask")}function WH(n){const t=HR(n);if(t)return t;const e=B("div",["uploading-progress-mask"],n),r=B("div",["uploading-progress-bar"],e);return B("div",["uploading-progress-bar-value"],r),r}function qH(n){const e=WH(n).querySelector(".uploading-progress-bar-value");return p(GH,e,"no progress value"),e}function jR(n,t){const e=qH(n);e.style.width=`${t}%`}function XH(n){var t;(t=HR(n))==null||t.remove()}function Fd(n,t,e,r){const i=e!=null?e:n.findBlockById(t.id);if(!i)return;const s=r||at(i),o=!!i.querySelector(".images > .image-container.error, .images > .image-container.empty "),l=FH(n,t,s,o),c=KH(n,t,s,o),d=zt(i);l==="auto"?d.style.width=l:(d.style.maxWidth=l,d.style.width="100%");const h=i.querySelector(".images");!h||(h.style.height=c||"none")}function YH(n){let t;return n.forEach((e,r)=>{r.toLocaleLowerCase()==="content-type"&&(t=e)}),t!=null?t:""}async function QH(n){try{const t=await fetch(n,{credentials:"same-origin"}),e=await t.blob(),r=YH(t.headers).toLocaleLowerCase();let i="";if(r){const o=Ip.default[r].extensions;o&&o.length>0&&(i=o[0])}return new File([e],`${Date.now()}.${i}`,{type:r})}catch{return null}}function Bl(n,t){const e=typeof t=="string"?t:ut(t);return n.getCustom(`image-${e}`)}function mg(n,t){if(!t||!(t instanceof Node))return null;const e=et(t);return e?Bl(n,e):null}function ds(n){return Array.from(n.querySelectorAll(".image-container"))}const BA=D("table-resize-drag-drop");class JH{constructor(t,e,r,i){m(this,"cursor","col-resize");m(this,"initWidths");this.editor=t,this.elem=e,this.data=r,this.mouseDownEvent=i;const s=this.data.block,l=Bl(this.editor,s).getImages(),c=this.data.splitterIndex;p(BA,c>=0&&c<l.length-1,`invalid splitter index: ${c}`);const h=ds(s).map(C=>C.getBoundingClientRect().width);this.initWidths=h}onDragStart(t,e,r){if(!this.editor.isWritable())return;const i=this.data.block;Bl(this.editor,i).setResizing(!0)}onDragging(t,e,r,i,s){const o=this.data.block,l=Bl(this.editor,o),c=Et.default(l.getImages()),d=this.data.splitterIndex;p(BA,d>=0&&d<c.length-1,`invalid splitter index: ${d}`);const h=this.initWidths[d],C=this.initWidths[d+1];if(h+C<100)return;let E=i;h+E<50&&(E=50-h),C-E<50&&(E=C-50);const w=[...this.initWidths];w[d]+=E,w[d+1]-=E;const S=ds(o);p(BA,S.length===c.length,"invalid image data");const U=w.reduce((nt,Y)=>nt+Y,0);for(let nt=0;nt<c.length;nt++){const Y=w[nt]/U;c[nt].flex=Y,S[nt].style.flexGrow=`${Y}`}const M=Et.default(this.editor.getBlockData(o)),V=jn(c,Mi(M));M.embedData=V,Fd(this.editor,M,o,null)}onDragEnd(t,e,r,i,s){const o=this.data.block,l=Bl(this.editor,o),d=ds(o).map(h=>Number.parseFloat(h.style.flexGrow));l.updateFlex(d),l.setResizing(!1)}}function zR(n){var t;return!n||!(n instanceof HTMLElement)?null:Mt(n,"image-splitter")?n:(t=n.closest(".image-splitter"))!=null?t:null}function ZH(n,t){var o;const e=zR(t.target);if(!e)return;const r=et(e);if(!r)return;Bl(n,r).setSelectedIndex(-1),n.selection.selectBlock(r,0);const i=Number.parseInt((o=e.getAttribute("data-index"))!=null?o:"",10);if(Number.isNaN(i)||typeof i!="number")return;const s={block:r,splitterIndex:i};Pp(new JH(n,e,s,t))}function tj(n,t){t.preventDefault(),t.stopPropagation();const e=zR(t.target);if(!e)return;const r=et(e);!r||Bl(n,r).resetFlex()}function ej(n,t,e,r){const i=B("div",["image-splitter"],e);B("div",["image-splitter-indicator"],i),i.setAttribute("data-index",`${r}`),n.domEvents.addEventListener(i,"mousedown",ZH),n.domEvents.addEventListener(i,"dblclick",tj)}const nj=D("image-item");function GR(n){return!n||!(n instanceof Node)?null:et(n)}function WR(n){const t=GR(n);return t?ds(t):[]}function yA(n){if(!n||!(n instanceof Node))return null;const t=n instanceof Element?n:n.parentElement;if(!t)return null;const e=t.closest(".image-container");return e||null}function Kd(n){const t=yA(n);return t?WR(n).indexOf(t):-1}function rj(n){return n.startsWith("data:image/")}async function ij(n,t){const e=mg(n,t.target);if(!e)return;const r=Kd(t.target);if(r===-1)return;const i=t.target;if(!(i instanceof HTMLImageElement))return;const s=e.getImages()[r];if(vu(s)||n.readonly||!e.isAutoFix())return;setTimeout(()=>{e.setAutoFix(!1)},400),(s.height==="auto"||s.width==="auto")&&e.fixImageSize(r,i),s.virtualSize&&e.fixImageSize(r,i);const o=PH(s)||rj(s.src);if(!s||!o||s.downloading)return;s.downloading=!0;const l=await QH(s.src);l?e.replaceImage(r,l):nj.warn(`failed to download image: ${s.src}`)}function sj(n,t,e){if(t.querySelector(".load-error"))return;const i=e.src.startsWith("http:")||e.src.startsWith("https:"),s=B("div",["load-error"],t),o=B("div",["error-icon"],s);o.innerHTML=ZC;const l=B("div",["error-message"],s);i?(l.innerHTML=_.t("image.load.remote.failed"),n.domEvents.addEventListener(s,"click",(c,d)=>{d.preventDefault(),d.target instanceof HTMLElement&&d.target.tagName==="A"&&window.open(e.src,"_blank","noreferrer=1")})):(l.innerHTML=_.t("image.load.failed"),n.domEvents.addEventListener(s,"click",(c,d)=>{d.preventDefault(),d.stopPropagation(),d.target instanceof HTMLElement&&d.target.tagName==="A"&&cj(c,d.target)}))}function TA(n,t){setTimeout(()=>{if(Ce(n.rootContainer,t)){const e=n.getBlockData(t);Fd(n,e,null,null)}})}function oj(n,t){const e=mg(n,t.target);if(!e)return;const r=Kd(t.target);if(r===-1)return;const i=e.getImages()[r];if(!i)return;const s=yA(t.target);if(!s)return;const o=et(s);let l=!1;n.doc.buildResourceUrl(i.src,{syncNewResources(c,d){var C,E;n.doc.addResources([c]);const h=(E=(C=n.doc).getServerMeta)==null?void 0:E.call(C).appId;if(i.src&&d!==i.src&&h&&i.src.includes(h)&&o&&!n.readonly&&n.isBlockWritable(o)){const A=Et.default(n.getBlockData(o));A.embedData.src=c,n.updateEmbedData(o,A.embedData),l=!0,t.target instanceof HTMLImageElement&&(t.target.src=d)}}}),!l&&(q(s,"error","error-load"),o&&TA(n,o),s.innerHTML="",sj(n,s,i))}function lj(n,t,e){if(t.querySelector(".upload-error"))return;const i=B("div",["upload-error"],t),s=B("div",["error-icon"],i);s.innerHTML=ZC;const o=B("div",["error-message"],i);o.innerHTML=_.t("image.upload.failed"),n.domEvents.addEventListener(i,"click",(l,c)=>{if(c.preventDefault(),!c.target||!(c.target instanceof Element)||c.target.tagName!=="A")return;const d=mg(l,c.target),h=Kd(c.target);!d||h===-1||d.replaceImage(h,e)})}function qR(n,t,e,r,i){const s=ds(t)[e];!s||(q(s,"error","error-upload"),TA(n,t),s.innerHTML="",lj(n,s,i))}function XR(n,t,e,r,i,s,o){const l=B("div",["image-container"],e);if(l.setAttribute("data-src",r.src),o.length>1&&(l.style.flexShrink=`${r.flex}`,l.style.flexGrow=`${r.flex}`),s===i&&q(l,"active"),vu(r)){q(l,"empty");const d=B("div",["upload-image-icon"],l);return d.innerHTML=LT,l}const c=B("img",["editor-image"],l);if(c.src=n.doc.buildResourceUrl(r.src),n.domEvents.addEventListener(c,"load",ij),n.domEvents.addEventListener(c,"error",oj),r.src.startsWith("https:")||r.src.startsWith("http:")){const d=B("div",["image-warning"],l);d.innerHTML=JC,d.setAttribute(`data-editor-tooltip-${n.clientId}`,_.t("image.load.remote.tooltip"))}return l}function aj(n,t,e,r,i){const s=B("div",["images"],e);return r.forEach((o,l)=>{l>0&&ej(n,t,s,l-1),XR(n,t,s,o,l,i,r)}),r.length>1&&q(t,"multi"),s}function YR(n,t,e,r,i,s){const l=Array.from(t.querySelectorAll(".image-container"))[r];if(!l)return;const c=XR(n,t,null,e,r,i,s);l.insertAdjacentElement("beforebegin",c),l.remove(),TA(n,t)}function Vd(n,t){return ds(n)[t]}function cj(n,t){const e=GR(t);if(!e)return;const r=Kd(t);if(r===-1)return;const i=mg(n,t);if(!i)return;const s=i.getImages()[r];YR(n,e,s,r,i.getSelectedIndex(),i.getImages())}function QR(n){var r;let t="image/*";const e=(r=n.getComponentOptions("image"))==null?void 0:r.allowedMedias;return e&&(t=e.map(i=>`.${i}`).join(",")),t}function JR(n,t){var o;const{maxSize:e,allowedMedias:r,callbacks:i}=(o=n.getComponentOptions("image"))!=null?o:{};if(e&&t.size>e){const l=new Error("image is too large");throw l.code="MaxMediaSize",i!=null&&i.onError&&(i==null||i.onError(n,l)),l}const s=Tf(t.name);if(r&&!r.includes(s.toLowerCase())){const l=new Error(`media file is not allowed: ${s}`);throw l.code="NotAllowedFile",i!=null&&i.onError&&(i==null||i.onError(n,l)),l}}function ZR(n){return n.startsWith("image/")}const tw=D("image-object");class qe{constructor(t,e){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(t,e)=>{const r=Kd(e.target);if(r===-1)return;const i=this.images[r];vu(i)||this.setSelectedIndex(r)});m(this,"handleRootContainerResize",()=>{this.handleEditorResize(this.editor.rootContainer)});m(this,"handleEditorResize",t=>{if(this.isEmpty()||this.resizing)return;const e=this.editor.findBlockById(this.blockData.id);!e||at(e)===t&&Fd(this.editor,this.blockData,e,null)});m(this,"handleResizing",(t,e)=>{const r=this.editor.findBlockById(this.blockData.id);if(!r)return;this.autoFix||this.setAutoFix(!0);const i=r.querySelector(".images");i.style.height="";const o=this.editor.rootContainer.getBoundingClientRect().width,l=r.getBoundingClientRect();let c=e.width>l.width?l.width:e.width;c<50&&(c=50);const d=c*100/o;this.blockData.embedData.widthPercent=d,Fd(this.editor,this.blockData,r,null)});m(this,"handleResized",t=>{const e=this.editor.findBlockById(this.blockData.id);if(!e)return;const r=jn(this.images,Mi(this.blockData));this.editor.updateEmbedData(e,r),this.blockResizer.enableResize(e)});m(this,"fixImageSizes",Ne.default(()=>{const t=this.editor.findBlockById(this.blockData.id);if(!t)return;const e=jn(this.images,Mi(this.blockData));this.editor.updateEmbedData(t,e)},1e3));this.editor=t,this.blockData=e,this.blockResizer=new Pd(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=yu(this.blockData.embedData)}destroy(){var t;this.blockResizer.removeAllListeners(),this.blockResizer.destroy(),this.editor.domEvents.removeEventListener(null,null,this.handleMouseDown),(t=this.parentContainerResizerObserver)==null||t.disconnect()}setAutoFix(t){this.autoFix=t}isAutoFix(){return this.autoFix}createContent(t,e,r){const i=aj(this.editor,e,r,this.images,this.selectedIndex);if(this.editor.domEvents.addEventListener(r,"mousedown",this.handleMouseDown),this.editor.addListener("resize",this.handleRootContainerResize),gi(t)){const o=()=>{this.handleEditorResize(t)};this.parentContainerResizerObserver=new Jl(o),this.parentContainerResizerObserver.observe(t)}const s=()=>!!(this.images.length===1&&this.images[0].virtualSize);this.isEmpty()&&s()&&q(i,"empty"),Fd(this.editor,this.blockData,e,t),setTimeout(()=>{const o=this.editor.findBlockById(this.blockData.id);o&&this.blockResizer.update(o)})}getImages(){return this.images}getWidthPercent(){return Mi(this.blockData)}isEmpty(){return this.images.length===1&&vu(this.images[0])}setResizing(t){this.resizing=t}getSelectedIndex(){return this.selectedIndex}getBlock(){return this.editor.findBlockById(this.blockData.id)}setSelectedIndex(t){const e=this.getBlock();if(!e||t===this.selectedIndex)return;if(this.selectedIndex!==-1){const i=Vd(e,this.selectedIndex);i&&ct(i,"active")}this.selectedIndex=t;const r=Vd(e,t);r&&q(r,"active")}async requestUploadImage(t){const e=this.editor.findBlockById(this.blockData.id);if(!e)return;const r=Vd(e,t);if(Mt(r,"error"))return;const i=QR(this.editor),s=await Mc(i);!s||await this.replaceImage(t,s)}tryEnableResizer(){const t=this.editor.findBlockById(this.blockData.id);if(!t||!this.editor.isWritable())return;const e=Vd(t,0);!this.isEmpty()&&this.images.length===1&&!Mt(e,"error")&&this.blockResizer.enableResize(t)}disableResizer(){this.blockResizer.disableResize()}fixImageSize(t,e){const r=this.images[t];vu(r)||(vl(r.width)&&!vl(r.height)?r.height=r.width/e.naturalWidth*e.naturalHeight:vl(r.height)&&!vl(r.width)?r.width=r.height/e.naturalHeight*e.naturalWidth:(r.width=e.naturalWidth,r.height=e.naturalHeight),r.virtualSize=!1,this.fixImageSizes())}removeImage(t){const e=this.editor.findBlockById(this.blockData.id);if(!e||t===-1||t>=this.images.length)return!1;const r=Et.default(this.images);if(r.splice(t,1),r.length===0)return this.editor.deleteBlock(e),!0;r[0].flex=NaN,Bu(r),this.selectedIndex>=r.length&&(this.selectedIndex=r.length-1);const i=jn(r,Mi(this.blockData));return this.editor.updateEmbedData(e,i),!0}async replaceImage(t,e){const r=this.editor.findBlockById(this.blockData.id);if(!r)return!1;try{const s=await _c(e),o=this.images[t];if(o.virtualSize){const{width:c,height:d}=await OR(s);o.width=c,o.height=d,o.virtualSize=!1,this.images[0].flex=NaN,Bu(this.images);const h=jn(this.images,Mi(this.blockData));this.editor.updateEmbedData(r,h)}const l={...o,src:s};YR(this.editor,r,l,t,this.selectedIndex,this.images),setTimeout(()=>{this.blockResizer.update(r)})}catch(s){return qR(this.editor,r,t,s,e),!1}const i=Vd(r,t);if(!i)return!1;q(i,"uploading"),jR(i,0),q(r,"media-block-uploading");try{const s=await this.editor.doc.uploadResource(e,{onProgress:c=>{jR(i,c)}});ct(i,"uploading"),this.images[t].src=s.resourceId;const o=this.editor.findBlockById(this.blockData.id);if(!o)return!1;ct(o,"media-block-uploading");const l=jn(this.images,Mi(this.blockData));return this.editor.updateEmbedData(o,l),!0}catch(s){tw.error(s);const o=this.editor.findBlockById(this.blockData.id);return o&&(ct(i,"uploading"),XH(i),qR(this.editor,o,t,s,e),ct(o,"media-block-uploading")),!1}}updateFlex(t){const e=this.editor.findBlockById(this.blockData.id);if(!e)return;p(tw,t.length===this.images.length,"invalid flex");for(let i=0;i<this.images.length;i++)this.images[i].flex=t[i];const r=jn(this.images,Mi(this.blockData));this.editor.updateEmbedData(e,r)}resetFlex(){const t=this.editor.findBlockById(this.blockData.id);if(!t)return;const e=Et.default(this.images);e[0].flex=NaN,Bu(e);const r=jn(e,Mi(this.blockData));this.editor.updateEmbedData(t,r)}setData(t){this.blockData=t,this.images=yu(t.embedData)}static create(t,e){const r=t.addCustom(`image-${e.id}`,()=>new qe(t,e));return r.setData(e),r}static getImageObject(t,e){let r;return typeof e=="string"?r=e:r=ut(e),t.getCustom(`image-${r}`)}}const bat="",vat="";function gg(n){const t=be(n);let e=t.querySelector(":scope > .block-helper");return e||(e=B("div",["block-helper"],t),B("span",["helper-sizer"],e,"A")),e}function kA(n,t,e){const r=gg(n),s=Array.from(r.children).find(o=>{var c;return Number.parseInt((c=o.getAttribute("data-index"))!=null?c:"0",10)>e});r.insertBefore(t,s!=null?s:null)}const ew=40,uj=20;class fj{findTargetBlock(t,e){const r=e.target;if(r&&r instanceof Element){const c=et(r);if(c&&Ce(t.rootContainer,c))return c}let i=e.clientX,s=e.clientY;const o=t.rootContainer.getBoundingClientRect().left;i<o&&o-i<ew&&(i+=ew);let l=Pe(i,s,{noFilter:!0});if(l){const c=et(l);if(c&&Ce(t.rootContainer,c))return c}if(s-=uj,l=Pe(i,s,{noFilter:!0}),l){const c=et(l);if(c&&Ce(t.rootContainer,c))return c}return null}destroy(){}}class dj extends sg{constructor(e){super(e,{trigger:[],id:"empty-block-menu"});m(this,"currentBlock",null)}get isVisible(){return this.suggest.menu.isVisible}isInMenu(e){return this.menu.isInCommandBar(e)}show(){const r=this.editor.selection.focusedBlock;this.suggest.popup(r,0,"","")}setBlock(e){this.currentBlock=e}}function hj(n,t,e){const r=u1(n,t);if(!r)return[];const i=[],s=(o,l)=>{var c;return(c=o.children)==null?void 0:c.map(d=>({...d,source:"block-command",blockMenuItemCustomData:l,children:s(d,l)}))};return Object.values(r).forEach(o=>{e!=null&&e.has(o.group)||i.push(...o.commands.map(l=>({...l,source:"block-command",blockMenuItemCustomData:o.group,children:s(l,o.group)})))}),i}function RA(n,t,e){const r=iA(n,e),i=s=>{s.forEach(o=>{o.source=t,o.children&&i(o.children)})};return i(r),r}function mj(n,t,e,r=!1){var h,C,E;const i=at(t);let s=t;if(s&&Ht(s)&&KE(s)){if(!r){const A=qP(s);s=(h=ae(A))!=null?h:A}J0.closeMindmap(n,t)}let l=Rt(s);if(!ve(n,s)&&!r){let A=zr(s);A?l=Rt(A):(A=Ge(i),l=Rt(A)+1)}const c=pt(i),d=e;return n.emit("beforeExecCommand",n,e,{source:"block-menu"}),d.commandProvider?d.commandProvider.executeCommand(n,e,{from:"block-menu",containerId:c,blockIndex:l}):(E=(C=d.blockOptions)==null?void 0:C.handleInsertEmptyBlock)==null?void 0:E.call(C,n,{containerId:c,blockIndex:l,item:e,from:"block-menu"})}function gj(n,t){const e=Ci(n,t),r=n.getBlockData(t);return!(e!=="text"||r.heading)}class nw{constructor(t,e,r){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",(t,e,r)=>{var s;const i=tA();this.createItem("text",ru,e,gj(this.editor,t)),(s=i.insertBlockCommandItems)==null||s.forEach(o=>{o.id&&o.icon&&this.createItem(o.id,o.icon,e,r?r===Number(o.value):!1)})});m(this,"createListItemElement",(t,e,r)=>{const{checkbox:i,ordered:s}=r,l=Ot(t)==="list",c=l&&s===!1&&!i,d=l&&s,h=l&&!!i;this.createItem("unordered-list",oE,e,c),this.createItem("ordered-list",lE,e,d),this.createItem("check-list",iE,e,h)});m(this,"handleClick",(t,e)=>{var c,d;if(!e.target||!(e.target instanceof Node))return;const r=e.target instanceof Element?e.target:e.target.parentElement;if(!r)return;const i=r.closest(".text-style-item");if(!i)return;const s=i.id,o="heading-",l={id:s,name:""};if(t.emit("beforeExecCommand",t,l,{source:"block-command"}),s==="text"&&ng(t,this.block,null),s.startsWith(o)){const h=Number.parseInt(s.substring(o.length),10);h&&ng(t,this.block,h)}if(s==="blockquote"&&QE(t,this.block),s.startsWith("align")){const h=s.replace(/^align-/,"");_k(t,this.block,h)}(s==="unordered-list"||s==="ordered-list"||s==="check-list")&&ZE(t,this.block,s),(d=(c=this.options).onAfterStyleItemClick)==null||d.call(c)});m(this,"calcTextStyleItemTooltipsEnum",()=>{this.textStylesTooltips={text:{title:_.t("commands.text")},blockquote:{title:_.t("commands.quote")},"align-left":{title:_.t("commands.alignLeft")},"align-center":{title:_.t("commands.alignCenter")},"align-right":{title:_.t("commands.alignRight")},"unordered-list":{title:_.t("commands.unordered")},"ordered-list":{title:_.t("commands.ordered")},"check-list":{title:_.t("commands.check")}};let t=1;for(;t<=8;)this.textStylesTooltips[`heading-${t}`]={title:_.t("commands.heading",{name:`${t}`})},t++});this.editor=t,this.block=e,this.options=r,this.calcTextStyleItemTooltipsEnum(),this.element=this.createItemElement(t,e),t.domEvents.addEventListener(this.element,"click",this.handleClick)}createItemElement(t,e){const r=B("div",["text-styles"],null),i=B("div",["text-style-section"],r),s=t.getBlockData(e);if(!this.options.fromEmbed){const l=s.heading,c=s.quoted;this.createHeadingItemElement(e,i,l),this.createListItemElement(e,i,s),this.createItem("blockquote",sE,i,!!c)}const o=s.align||"left";return this.createItem("align-left",nu,i,o==="left"),this.createItem("align-center",S0,i,o==="center"),this.createItem("align-right",w0,i,o==="right"),r}createItem(t,e,r,i=!1){const s=["style-icon","text-style-item"];i&&s.push("active");const o=ta(e,s,r);o.id=t;const l=this.textStylesTooltips[t];if(!l)return;const{title:c,shortcut:d}=l;o.setAttribute(`data-editor-tooltip-${this.editor.clientId}`,c),d&&o.setAttribute(`data-editor-tooltip-desc-${this.editor.clientId}`,hn(d))}}function rw(){return{source:"separator",type:"separator",id:`section-${it()}`,name:""}}const iw={copy:GT,cut:WT,delete:qT,"lock-block":XT,"unlock-block":YT,comment:ba},pj=["image","video"];function Cj(n,t,e){const r=[],i=ot(n,t),s=Le(t)&&pj.includes(on(t)),o=s&&(on(t)!=="image"||on(t)==="image"&&ds(t).length===1);if(i?r.push(new nw(n,t,e)):s&&o&&r.push(new nw(n,t,{...e,fromEmbed:!0})),!ve(n,t)||FE(t)){(i||s&&o)&&r.push(rw());const l=hj(n,t,new Set(["hovering-toolbar"]));l.sort((c,d)=>{var h,C;return((h=c.order)!=null?h:0)-((C=d.order)!=null?C:0)}),l.forEach(c=>{c.id in iw&&(c.icon=iw[c.id])}),r.push(...l)}return ve(n,t)&&!FE(t)?r.push(...RA(n,"insert-block",{withPlainText:!1,from:"block-menu"})):r.push(rw(),{id:"insert-block-before",icon:QT,name:_.t("blockMenu.command.insertAbove"),children:RA(n,"insert-block-before",{withPlainText:!0,from:"block-menu"}),childrenMenuId:"quick-menu",source:"insert-block-before"},{id:"insert-block-after",icon:JT,name:_.t("blockMenu.command.insertAfter"),children:RA(n,"insert-block",{withPlainText:!0,from:"block-menu"}),source:"insert-block",childrenMenuId:"quick-menu"}),r}function Ej(n,t,e){if(e.source==="block-command"){const r=e.blockMenuItemCustomData;Yv(n,t,r,e)}else(e.source==="insert-block"||e.source==="insert-block-before")&&mj(n,t,e,e.source==="insert-block-before")}const Aj=D("exclusive-block");function wA(n,t,e,r){var l;q(t,"block-exclusive");const i=le(n,t),s=(l=i.getBlockProperties)==null?void 0:l.call(i,n,t),{abstract:o}=s||{};t.setAttribute("data-user-name",r),t.setAttribute("data-user-id",e),t.setAttribute("data-exclusive-tips",_.t("exclusive.tips",{editor:r,embedType:o||_.t("exclusive.fallbackAbstract")}))}function sw(n){ct(n,"block-exclusive"),n.removeAttribute("data-user-name"),n.removeAttribute("data-user-id"),n.removeAttribute("data-exclusive-tips")}function xj(n,t,e,r,i){Aj.debug(`block ${ut(t)} ${e?"exclusive":"unexclusive"}, ${r}, ${i}`),e?wA(n,t,r,i):sw(t)}function $d(n){return n.classList.contains("block-exclusive")}function ow(n,t){t.blockIds.forEach(e=>{const r=n.findBlockById(e);r&&xj(n,r,t.exclusive,t.userId,t.displayName)})}class yl{constructor(t){m(this,"exclusiveBlockIds",new Set);m(this,"exclusiveBlockTimer",0);m(this,"remoteExclusiveBlockIds",new Map);m(this,"handleUserChanged",t=>{const e=new Set(t.map(i=>i.userId));Array.from(this.remoteExclusiveBlockIds.entries()).forEach(([i,s])=>{if(!e.has(s.userId)){this.remoteExclusiveBlockIds.delete(i);const o={...s,exclusive:!1};ow(this.editor,o)}});const r=Array.from(this.exclusiveBlockIds).map(i=>this.editor.findBlockById(i)).filter(i=>!!i);r.length>0&&this.broadcastExclusiveBlockMessage(r,!0)});this.editor=t,t.doc.registerCallback(this),t.doc.getRemoteUsers().addListener("change",this.handleUserChanged)}destroy(){this.stopExclusiveBlockTimer(),this.editor.doc.unregisterCallback(this),this.editor.doc.getRemoteUsers().addListener("change",this.handleUserChanged)}onCustomMessage(t){if(t.type==="exclusiveBlock"){const e=t;ow(this.editor,e),e.blockIds.forEach(r=>{e.exclusive?this.remoteExclusiveBlockIds.set(r,e):this.remoteExclusiveBlockIds.delete(r)})}}getExclusiveMessage(t){return this.remoteExclusiveBlockIds.get(t)}broadcastExclusiveBlockMessage(t,e){if(this.editor.readonly||t.length===0)return;const r=this.editor.doc.getUser(),i={type:"exclusiveBlock",userId:r.userId,displayName:r.displayName,blockIds:t.map(s=>ut(s)),exclusive:e};this.editor.doc.broadcastMessage(i)}exclusiveBlock(t){this.exclusiveBlockIds.has(ut(t))||(this.broadcastExclusiveBlockMessage([t],!0),this.exclusiveBlockIds.add(ut(t)),this.exclusiveBlockIds.size===1&&this.startExclusiveBlockTimer())}unexclusiveBlock(t){!this.exclusiveBlockIds.has(ut(t))||(this.exclusiveBlockIds.delete(ut(t)),this.broadcastExclusiveBlockMessage([t],!1),this.exclusiveBlockIds.size===0&&this.stopExclusiveBlockTimer())}startExclusiveBlockTimer(){this.exclusiveBlockTimer=window.setInterval(()=>{Array.from(this.exclusiveBlockIds.keys()).forEach(t=>{this.broadcastExclusiveBlockMessage([this.editor.getBlockById(t)],!0)})},30*1e3)}stopExclusiveBlockTimer(){clearInterval(this.exclusiveBlockTimer),this.exclusiveBlockTimer=0}static get(t){return t.addCustom("exclusiveBlock",()=>new yl(t))}static register(t){return this.get(t)}}function SA(n,t){yl.get(n).exclusiveBlock(t)}function LA(n,t){yl.get(n).unexclusiveBlock(t)}class lw{writable(t,e){if(Array.isArray(e)){for(const r of e)if($d(r))return!1;return}if($d(e))return!1}create(t,e,r,i,s){const o=yl.get(t).getExclusiveMessage(s.id);o&&wA(t,i,o.userId,o.displayName)}update(t,e,r,i,s){const o=yl.get(t).getExclusiveMessage(s.id);o?wA(t,i,o.userId,o.displayName):sw(i)}}const Bat="",bj={exclusive:{tips:"\u300C{editor}\u300D\u6B63\u5728\u7F16\u8F91\uFF0C\u300C{embedType}\u300D\u4E0D\u652F\u6301\u591A\u4EBA\u7F16\u8F91",fallbackAbstract:"\u8BE5 Block"}},vj={exclusive:{tips:"\u300C{editor}\u300Dis editing\uFF0C\u300C{embedType}\u300Ddoes not support multi-person editing",fallbackAbstract:"This Block"}},Bj={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"}};_.mergeLang({"zh-CN":bj,"en-US":vj,"ja-JP":Bj});function Hd(n,t){return n.getBlockData(t).lock}function pg(n,t){return!!Hd(n,t)}function jd(n,t){const e=Hd(n,t);return e?e.userId===n.doc.getUser().userId:!1}function IA(n,t){const e=Hd(n,t);return e?e.userId!==n.doc.getUser().userId:!1}function yj(n,t){if(n.readonly||!n.isBlockWritable(t)||pg(n,t)&&!jd(n,t))return;const e=n.doc.getUser(),r={userId:e.userId,displayName:e.displayName,locked:Date.now()},s={...n.getBlockData(t),lock:r};n.updateBlockData(t,s)}function Tj(n,t){if(!jd(n,t))return;const e={lock:null};n.updateBlockData(t,e)}const kj=10,Rj=80,wj=50;class DA{constructor(){m(this,"executeCommand",(t,e,r)=>{const i=r.data;if(!i||!i.blockId)return;const s=t.getBlockById(i.blockId);i.type==="lock"?yj(t,s):i.type==="unlock"&&Tj(t,s)})}create(t,e,r,i,s){const o=s.lock;o&&(o.userId!==t.doc.getUser().userId?q(i,"locked-by-others"):q(i,"locked-by-self"))}update(t,e,r,i,s){const o=s.lock;if(o)if(o.userId!==t.doc.getUser().userId){q(i,"locked-by-others");const l=t.selection.focusedBlock;(l===i||Ce(i,l))&&(ot(t,i)||Ot(i)==="code")&&t.insertTextBlock("",pt(r),Rt(i)+1)}else q(i,"locked-by-self");else ct(i,"locked-by-others"),ct(i,"locked-by-self")}writable(t,e){let r=[];Array.isArray(e)?r=e:r.push(e);for(const i of r){if(IA(t,i))return!1;if(Gr(i))return;let s=ca(i);for(;s;){if(IA(t,s))return!1;s=ca(s)}}}commands(t,e){const r=pg(t,e),i=jd(t,e),s=$d(e),o={blockId:ut(e),type:"lock"},l={id:"lock-block",name:"",data:o,order:50};if(r)if(i)l.id="unlock-block",l.name=_.t("locker.unlock"),o.type="unlock";else{const c=Hd(t,e);let d=(c==null?void 0:c.displayName)||"";const h=_.getCurrentLang()==="ja-JP",C=Cv(d,kj,h?wj:Rj);(C==null?void 0:C.length)!==d.length&&(l.ellipsisTooltip=c==null?void 0:c.displayName,d=C||""),l.name=_.t("locker.lockedBy",{name:d}),l.states=["disabled"]}else s?(l.name=_.t("locker.lock"),l.states=["disabled"]):l.name=_.t("locker.lock");return{group:"block-locker",commands:[l],executeCommand:this.executeCommand}}}const yat="",Sj={locker:{lock:"\u9501\u5B9A",unlock:"\u89E3\u9664\u9501\u5B9A",lockedBy:"\u88AB {name} \u9501\u5B9A"}},Lj={locker:{lock:"Lock",unlock:"Unlock",lockedBy:"Locked by {name}"}},Ij={locker:{lock:"\u30ED\u30C3\u30AF",unlock:"\u30ED\u30C3\u30AF\u89E3\u9664",lockedBy:"{name}\u304C\u30ED\u30C3\u30AF\u3057\u307E\u3057\u305F"}};_.mergeLang({"zh-CN":Sj,"en-US":Lj,"ja-JP":Ij});class Cg{async handleBeforePasteDoc(t,e){return Object.values(e.blocks).forEach(r=>{r.forEach(i=>{delete i.lock})}),!1}}const Dj=D("standard-block-actions");class _j{constructor(){m(this,"executeCommand",(t,e,r)=>{const i=r.data;try{const s=t.getBlockById(i);if(r.id==="delete"){this.deleteBlock(t,s);return}r.id==="copy"&&this.copyBlock(t,s),r.id==="cut"&&(this.copyBlock(t,s),this.deleteBlock(t,s))}catch(s){Dj.error(`failed to execute block command: ${JSON.stringify(s)}`)}})}commands(t,e){const r=pg(t,e),i=r&&jd(t,e),s=ut(e),o=window.isSecureContext,l=$d(e),c={id:"copy",name:_.t("blockMenu.command.copy"),data:s,order:10,states:o?[]:["disabled"],disableReason:o?void 0:_.t("copyCutProperty.unsafeEnvTips",{shortCut:hn("CtrlOrCmd+C"),operation:_.t("copyCutProperty.copy")})},d={id:"cut",name:_.t("blockMenu.command.cut"),data:s,order:20,states:r&&!i||!o||l?["disabled"]:[],disableReason:o?void 0:_.t("copyCutProperty.unsafeEnvTips",{shortCut:hn("CtrlOrCmd+X"),operation:_.t("copyCutProperty.cut")})},h={id:"delete",name:_.t("blockMenu.command.delete"),data:s,order:30,states:r&&!i||l?["disabled"]:[]};return{group:"standard-block-actions",commands:[c,d,h],executeCommand:this.executeCommand}}deleteBlock(t,e){if(Xi(e)){const r=Oc(e);t.undoManager.runInGroup(()=>{[e,...r].forEach(i=>t.deleteBlock(i))})}else t.deleteBlock(e)}copyBlock(t,e){if(Xi(e)){const r=Oc(e),i=W5(t,[e,...r]);i0(t,i)}else vC(t,e)}}const aw=D("block-menu");class Mj{constructor(t){m(this,"menu");m(this,"currentBlock",null);m(this,"commandBlock",null);m(this,"handleShow",()=>{p(aw,this.currentBlock,"no target block before show block menu");const t=Cj(this.editor,this.currentBlock,{onAfterStyleItemClick:this.close});this.menu.updateItems(t),this.commandBlock=this.currentBlock});m(this,"handleClose",()=>{dE(this.editor)&&this.editor.focus()});m(this,"handleItemClick",(t,e)=>{p(aw,this.commandBlock,"no command block before show block menu"),Ej(this.editor,this.commandBlock,e),e.element||this.close()});m(this,"close",()=>{this.menu.close("clickItem")});this.editor=t,this.menu=new dl([],void 0,{id:"block-menu"}),this.menu.on("show",this.handleShow),this.menu.on("close",this.handleClose),this.menu.on("click",this.handleItemClick),t.blockHooks.push(new _j)}show(t,e){this.menu.manualShow(t,{placement:"bottom-start",...e})}isInMenu(t){return this.menu.isInCommandBar(t)}setBlock(t){this.currentBlock=t}get isVisible(){return this.menu.isVisible}destroy(){this.menu.destroy()}}const Uj=1e3;async function Oj(n,t){const{width:e}=n.rootContainer.getBoundingClientRect(),r=t.getBoundingClientRect();return r.width>e||r.height>=Uj?"":await wb.default.toPng(t,{style:{margin:0}})}const Nj=D("drag-preview-image");class Pj{constructor(t){m(this,"startPosition",null);m(this,"dragContainer",null);m(this,"handleDragStart",async(t,e)=>{const r=t.target;p(Nj,r instanceof Element,`Invalid Drag target:${r}`);const{x:i,y:s}=t;this.startPosition={x:i,y:s};const o=B("div",["drag-image-container"],this.editor.rootContainer),l=B("img",["drag-image"],o),c=B("span",["drag-loading"],o);c.innerHTML=n2;const{x:d,width:h,height:C,y:E}=r.getBoundingClientRect(),A=this.editor.rootContainer.getBoundingClientRect(),v=e.getBoundingClientRect();o.style.left=`${d+h}px`,o.style.top=`${E+C}px`,o.style.width=`${Math.min(A.width/2,v.width)}px`,this.dragContainer=o;const S=await Oj(this.editor,e);S?l.src=S:q(o,"drag-placeholder"),Op(o,{status:"loaded"})});m(this,"handleDrag",t=>{if(this.startPosition&&this.dragContainer){const{x:e,y:r}=t;if(e===0&&r===0){this.dragContainer.style.transition="transform 0.15s, opacity .15s",this.dragContainer.style.transform="",this.dragContainer.style.opacity="0";return}const{x:i,y:s}=this.startPosition,o=e-i,l=r-s;this.dragContainer.style.transform=`translate(${o}px, ${l}px)`}});m(this,"handleDragEnd",()=>{this.dragContainer&&(this.dragContainer.remove(),this.startPosition=null,this.dragContainer=null)});this.editor=t}}const cw="drag-preview-element";function Fj(n){if(Mt(n,cw))return n;const t=n.querySelector(`.${cw}`);return t||(Le(n)?zt(n):n)}const Eg=D("block-menu-drag-handler");function _A(n,t){return new DragEvent(t,{bubbles:!0,cancelable:!0,view:window,screenX:n.screenX,screenY:n.screenY,dataTransfer:new DataTransfer,clientX:n.clientX,clientY:n.clientY})}class Kj{constructor(t,e){m(this,"dragPreview");m(this,"autoScroll");m(this,"oldPos",{x:0,y:0});m(this,"handleMouseDown",t=>{const e=this.button.blockMenu.currentBlock;if(p(Eg,e,"no dragged block"),t.button!==0)return;if(!this.editor.isBlockWritable(e)){t.preventDefault(),t.stopPropagation();return}const{x:r,y:i}=t;this.oldPos={x:r,y:i},document.addEventListener("mouseup",this.handleDragEnd),this.editor.contentElement.addEventListener("mousemove",this.handleDrag)});m(this,"handleDragStart",t=>{var o,l;const e=mn(this.button.buttonElement);this.autoScroll||(this.autoScroll=new xm({scrollElement:e,trackMouseEvent:"mousemove",edge:{top:50,bottom:50}}));const r=this.button.blockMenu.currentBlock;p(Eg,r,"no dragged block"),(l=(o=le(this.editor,r)).notify)==null||l.call(o,this.editor,"beginDrag");const i=_A(t,"dragstart");zj(this.editor,i,r),window.isDragging=!0,this.button.buttonElement.style.opacity="0";const s=Fj(r);this.dragPreview.handleDragStart(t,s),this.autoScroll.active(),q(r,"dragging"),q(this.editor.contentElement,"dragging")});m(this,"handleDrag",t=>{const{target:e,x:r,y:i}=t;if(this.oldPos.x===r&&this.oldPos.y===i)return;window.isDragging||this.handleDragStart(t),this.oldPos={x:r,y:i},p(Eg,e instanceof Element,"target is invalid"),this.dragPreview.handleDrag(t);const s=_A(t,"dragover");this.editor.contentElement.dispatchEvent(s)});m(this,"handleDragEnd",t=>{var i;const e=this.button.blockMenu.currentBlock;p(Eg,e,"no dragged block"),window.isDragging=!1,this.button.buttonElement.style.opacity="1",this.dragPreview.handleDragEnd(),(i=this.autoScroll)==null||i.inactive(),ct(e,"dragging"),ct(this.editor.contentElement,"dragging"),document.removeEventListener("mouseup",this.handleDragEnd),this.editor.contentElement.removeEventListener("mousemove",this.handleDrag);const r=_A(t,"drop");this.editor.contentElement.dispatchEvent(r)});this.editor=t,this.button=e,this.button.buttonElement.addEventListener("mousedown",this.handleMouseDown),this.dragPreview=new Pj(t)}destroy(){this.button.buttonElement.removeEventListener("mousedown",this.handleMouseDown)}}class zd{constructor(t){m(this,"highlightedBlockId","");m(this,"handleSelectionChange",()=>{this.clearHighlightedBlock()});this.editor=t,this.editor.addListener("selectionChanged",this.handleSelectionChange)}highlightBlock(t){this.clearHighlightedBlock(),this.highlightedBlockId=ut(t),q(t,"highlighted")}clearHighlightedBlock(){if(this.highlightedBlockId){const t=this.editor.findBlockById(this.highlightedBlockId);t&&ct(t,"highlighted"),this.highlightedBlockId=""}}destroy(){}static register(t){return t.addCustom("editor-block-highlighter",()=>new zd(t))}static get(t){return t.getCustom("editor-block-highlighter")}}class uw{constructor(t){m(this,"buttonElement");m(this,"emptyBlockMenu");m(this,"blockMenu");m(this,"dragHandler");m(this,"handleHoverBlock",(t,e,r)=>{if(this.emptyBlockMenu.isVisible||this.blockMenu.isVisible||!this.editor.isWritable())return;const i=this.editor.getCustom("editor-tooltip");if(i&&i.visible()&&(i.hide(),this.buttonElement.setAttribute("data-tooltip-hide-at",`${Date.now()}`)),!t){this.buttonElement.parentElement&&(this.blockMenu.isInMenu(r.target)||this.buttonElement.remove());return}const s=c1(t);Ps(s)||(this.updateButton(s),kA(s,this.buttonElement,Number.MAX_SAFE_INTEGER))});m(this,"handleButtonClick",()=>{if(this.buttonElement.getAttribute("data-type")==="move"){const r=this.blockMenu.currentBlock;if(!r)return;this.editor.selection.selectBlock(r,0,void 0,{noScroll:!0}),this.blockMenu.show(this.buttonElement,{placement:"bottom-end"}),setTimeout(()=>{zd.get(this.editor).highlightBlock(r)});return}const e=this.emptyBlockMenu.currentBlock;!e||(this.editor.selection.selectBlock(e,0,void 0,{noScroll:!0}),setTimeout(()=>{this.editor.focus(),this.updatePlaceholder(e),this.emptyBlockMenu.show()}))});m(this,"updatePlaceholder",t=>{Od(this.editor,t,_.t("blockMenu.button.searchPlaceholder"))});m(this,"handleChanged",()=>{const t=this.emptyBlockMenu.currentBlock;if(!t)return;if(this.blockMenu.currentBlock){const r=ut(this.blockMenu.currentBlock);if(!this.editor.findBlockById(r)&&this.blockMenu.isVisible){this.blockMenu.close();return}}const e=ve(this.editor,t)?"insert":"move";this.buttonElement.getAttribute("data-type")!==e&&this.setButtonType(e)});this.editor=t,this.buttonElement=this.createButton(),this.emptyBlockMenu=new dj(t),this.blockMenu=new Mj(t),this.editor.addListener("docChanged",this.handleChanged),this.buttonElement.addEventListener("click",this.handleButtonClick),this.dragHandler=new Kj(this.editor,this);const e=$e.get(t);e.addListener("change",this.handleHoverBlock),e.addFinder(new fj),zd.register(this.editor)}destroy(){$e.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 t=B("button",["block-button"],null);return t.setAttribute(`data-editor-tooltip-${this.editor.clientId}`,_.t("blockMenu.button.tips")),t.innerHTML=aE,t}setButtonType(t){this.buttonElement.setAttribute("data-type",t);const e=`data-editor-tooltip-${this.editor.clientId}-dynamic`;this.buttonElement.hasAttribute(e)&&this.buttonElement.removeAttribute(e),t==="insert"?(this.buttonElement.innerHTML=e2,this.buttonElement.setAttribute(e,_.t("blockMenu.button.insertTips"))):(this.buttonElement.innerHTML=aE,this.buttonElement.setAttribute(e,_.t("blockMenu.button.tips")))}updateButton(t){this.emptyBlockMenu.setBlock(t),this.blockMenu.setBlock(t),ve(this.editor,t)&&!(Ht(t)&&FE(t))?this.setButtonType("insert"):this.setButtonType("move")}}const Vj={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
664
+ <p>${hm(l)}</p>`}function oH(n,t){gT(n,LR)}const EA={blockType:"code",blockKind:"complex",createBlockContent:z$,getBlockTextLength:G$,getRangeFromPoint:W$,moveCaret:q$,getCaretRect:X$,updateSelection:Y$,clearSelection:Q$,getChildContainers:J$,getNextContainer:Z$,getSelectedContainers:tH,convertFrom:C$,handleBlockElementUpdated:eH,getOptions:rH,getBlockProperties:iH,convertTo:sH,handleDeleteBlock:oH},AA={...lr,blockType:"code-line"};class lH{constructor(t){m(this,"handleSelectionChange",()=>{const t=this.editor.selection;if(!t.range.isCollapsed())return;const e=t.focusedBlock;if(!_d(this.editor,e))return;const r=e,i=t.range.focus.offset,s=CB(this.editor,r,i,"code-caret");s.scrollIntoView({block:"nearest"}),setTimeout(()=>{s.remove(),this.editor.selection.caret.update()})});this.editor=t,t.addListener("selectionChanged",this.handleSelectionChange)}destroy(){this.editor.removeListener("selectionChanged",this.handleSelectionChange)}}function aH(n){if(!n.isWritable())return!1;const t=n.getFocusedBlock();if(!!_d(n,t)){if(n.selection.range.isCollapsed()){const e=n.selection.range.start;return n.insertTextToBlock(t,e.offset," "),!0}return n.undoManager.runInGroup(()=>{Ji(n).forEach(r=>{n.insertTextToBlock(r.block,0," ")})}),!0}}function cH(n){if(!n.isWritable())return!1;const t=n.getFocusedBlock();if(!_d(n,t))return;const e=[" "," "];return n.undoManager.runInGroup(()=>{Ji(n).forEach(i=>{const s=Re(n.getBlockText(i.block));for(let o=0;o<e.length;o++){const l=e[o];if(s.startsWith(l)){n.deleteTextFromBlock(i.block,0,l.length);break}}})}),!0}function uH(n){const t=n.getFocusedBlock(),e=at(t);if(re(e))return;const r=et(e);if(!r||Ot(r)!=="code")return;const i=n.selection.range;if(!!i.isSimple()&&!H5(e,i))return e0(n,e),!0}const fH={Tab:aH,"Shift+Tab":cH,"CtrlOrCmd+A":uH},Md=D("code-text-decorate");class fg{decorateText(t,e,r){if(p(Md,e.length>0,"invalid path"),e.length===1)return{};const i=e[e.length-2];if(t.doc.getBlockData(i.containerId,i.blockIndex).type!=="code")return{};const o=r;if(o.length===0)return{};const l=Re(o),c=t.doc.getBlockData(i.containerId,i.blockIndex),h=(w=>{if(!w)return wc.default.languages.plain;const S=w.replace(/\s/g,"").toLocaleLowerCase();return wc.default.languages[S]||wc.default.languages.plain})(c.language),C=wc.default.tokenize(l,h),E=(w,S)=>{if(p(Md,w,"no token"),typeof w=="string")return[{insert:w,attributes:Et.default(S)}];p(Md,w instanceof wc.default.Token,"invalid token type");const U=w.content,M=Et.default(S);return M[`style-code-${w.type}`]=!0,typeof U=="string"?[{insert:U,attributes:M}]:Array.isArray(U)?U.filter(Y=>Y.length).map(Y=>E(Y,M)).flat():(p(Md,U instanceof wc.default.Token,"invalid token"),E(U,M))},v=C.map(w=>E(w,{})).flat();return p(Md,Vn(v)===Vn(o),"failed to highlight code, text length mismatch"),{text:v}}}const dH={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",plainText:"Plain Text"}},hH={code:{title:"Code",abstract:"Code",wrap:"Wrap",copy:"Copy",caption:"Caption",search:"Search",copySuccess:"Copied successfully",plainText:"Plain Text"}},mH={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",plainText:"\u30D7\u30EC\u30FC\u30F3\u30C6\u30AD\u30B9\u30C8"}};_.mergeLang({"zh-CN":dH,"en-US":hH,"ja-JP":mH});function gH(n,t,e,r){const i=n.getBlockByIndex(t,e);if(Ct(n,i)!==r)return!1;const s=Re(n.getBlockText(i));if(![...s].every(h=>h==="|")||s.length<3||!n.editorBlocks.hasBlock("table"))return!1;const o=n.editorBlocks.getBlockClass("table");if(!o.convertFrom)return!1;const l=o.convertFrom(n,i,{offset:r});if(!l)return!1;const{blockData:c,focusBlockId:d}=l;return c?(n.undoManager.runInGroup(()=>{var C;const h=n.insertBlock(t,e,c,Ue(n,d!=null?d:c.id,0));n.deleteBlock(i),(C=l.onConverted)==null||C.call(l,n,h)}),!0):!1}const pH={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\]/i,data:{embedType:"toc"}}},CH={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 dg(n,t,e,r,i){const s=n.getContainerById(t);if(!re(s)){const o=et(s);if(o&&Di(o))return!0}return!1}function IR(n,t,e,r,i){if(dg(n,t))return!1;if(i==="enter"&&gH(n,t,e,r))return!0;const s=n.getBlockByIndex(t,e),o=Re(sr(n.getBlockText(s),r).left),l=i==="enter"?pH:CH;for(const[,c]of Object.entries(l)){if(!o.match(c.reg))continue;return!!n.undoManager.runInGroup(()=>{var v;const h=Tm(n,s,c.blockType,{offset:r,data:c.data});if(!h)return null;const{blockData:C,focusBlockId:E}=h;if(!C)return null;const A=n.insertBlock(t,e,C,Ue(n,E!=null?E:C.id,0));return n.deleteBlock(s),(v=h.onConverted)==null||v.call(h,n,A),{newBlock:A,focusBlockId:E}})}return!1}function EH(n,t,e,r){const i=n.getBlockByIndex(t,e);return n.getBlockString(i,{boxReplacement:" "}).substring(0,r)!==">"?!1:(n.undoManager.runInGroup(()=>{n.deleteTextFromBlock(i,0,r+1),n.updateBlockData(i,{quoted:!0},Ue(n,i,0))}),!0)}const AH={"#":1,"##":2,"###":3,"####":4,"#####":5,"######":6,"#######":7,"########":8};function xH(n,t,e,r){const i=n.getBlockByIndex(t,e),s=n.getBlockString(i,{boxReplacement:" "}).substring(0,r);let o=AH[s];if(!o)return!1;const l=n.getBlockData(i).heading;return l&&l==o&&(o=null),n.undoManager.runInGroup(()=>{n.deleteTextFromBlock(i,0,r+1),n.updateBlockData(i,{heading:o},Ue(n,i,0))}),!0}function bH(n,t,e,r){return!!(xH(n,t,e,r)||EH(n,t,e,r))}const vH=D("match-text-style");function BH(n,t){if(n.length<t.length*2+1||!n.endsWith(t)||n.substring(0,n.length-1).endsWith(t))return-1;const e=n.substring(0,n.length-t.length),r=e.lastIndexOf(t);return r===-1?-1:r===0?0:e.substring(r-1).startsWith(t)?-1:r}const yH={"*":{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 TH(n,t,e,r){var E,A;const i=n.getBlockByIndex(t,e),s=n.getBlockText(i),{left:o}=sr(s,r),l=V1(o),c=Vn(o)-l.length,d=Object.entries(yH);for(const[v,w]of d){const S=BH(l,v);if(S===-1)continue;const U=c+S,M=r,V=v.length,nt=Re(ln(s,U+V,M-U-V*2).middle);if(w.type==="style"){const Y={};w.styles.forEach(ft=>{Y[ft]=!0});const X=pa(nt,Y);n.undoManager.runInGroup(()=>{n.deleteTextFromBlock(i,U,M-U),n.insertTextToBlock(i,U,X)})}else if(w.type==="box")try{const Y=(A=(E=n.editorBoxes.getBoxClass(w.boxType)).convertFrom)==null?void 0:A.call(E,n,nt);if(!Y)continue;n.undoManager.runInGroup(()=>{n.deleteTextFromBlock(i,U,M-U),n.insertBoxToBlock(i,U,Y)})}catch(Y){vH.warn(`failed to convert to box, ${Y.message}`);continue}return!0}const h=/\[([^\]]+)\]\((https?:\/\/\S+)\)\s*$/,C=l.match(h);if(C){const v=C.index,w=C[1],S=C[2],U=v,M=r,nt={...$c(s,U),link:S};return n.undoManager.runInGroup(()=>{n.deleteTextFromBlock(i,U,M-U),n.insertTextToBlock(i,U,pa(w,nt))}),!0}return!1}class hg{handleAfterInsertText(t,e,r,i,s){if(s===" "){if(dg(t,e))return!1;if(bH(t,e,r,i)||TH(t,e,r,i))return!0}return!1}handleBeforeKeyDown(t,e){if(!t.selection.range.isSimple())return!1;const{containerId:i,blockIndex:s,offset:o}=t.getTextPosition();if(ot(t,t.getBlockByIndex(i,s))){if(Gi(e,"Enter")){if(IR(t,i,s,o,"enter"))return!0}else if(Gi(e,"Space")&&IR(t,i,s,o,"space"))return!0}return!1}}const kH={"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"}}};_.mergeLang(kH);function Ud(n,t){const e=Xs(n,t);return!!(ot(n,t)&&e.text&&Vn(e.text)===0&&!t.querySelector(".inputting-insertion"))}function DR(n,t){var r;zt(t).removeAttribute("data-content-placeholder"),(r=t.querySelector("[data-type=block-tools] .block-placeholder-container"))==null||r.remove()}function Od(n,t,e){var i;if(DR(n,t),!Ud(n,t))return;const r=zt(t);if(typeof e=="string")r.setAttribute("data-content-placeholder",e);else{const s=be(t),o=(i=s.querySelector(".block-placeholder-container"))!=null?i:B("div",["block-placeholder-container"],s);o.innerHTML="",o.appendChild(e)}}function RH(n){const t=n.getAttribute("data-style-heading");return t?_.t("placeholder.heading",{heading:t}):n.getAttribute("data-style-quoted")?_.t("placeholder.quote"):null}function wH(n){const t=n.getAttribute("data-list-type");return t?t==="ordered"||t==="unordered"?_.t("placeholder.list"):_.t("placeholder.mention"):null}function _R(n){switch(Ot(n)){case"text":return RH(n);case"list":return wH(n);default:return null}}function SH(n){if(Gr(n))return!1;const t=et(at(n));return t?Ot(t)==="code":!1}function LH(n){return!Gr(n)}function IH(n,t){var h,C;const e=n.selection.focusedBlock,r=Ot(e),i=t.contentPlaceholder||_.t("placeholder.default");let s=i;if(r&&Sf(n,r)&&e){if(!n.isBlockWritable(e)||SH(e))return;LH(e)&&(s=_.t("placeholder.common.contentInTable")),s=(h=_R(e))!=null?h:s}const o=n.getFirstBlock(),l=t.hideTitle?o:ae(o);if(!l)return;const c=ae(l);if(c&&!t.addPlaceholderToAllCurrentEmptyBlock)return;if(!c&&Ud(n,l)){Od(n,l,(C=_R(l))!=null?C:i);return}const d=n.getFocusedBlock();!Ud(n,d)||d===o&&!t.hideTitle||Od(n,d,s)}function DH(n,t){var i,s;const e=n.getFirstBlock(),r=zt(e);Ud(n,e)?(r.setAttribute("data-title-placeholder",(i=t.titlePlaceholder)!=null?i:_.t("placeholder.title")),r.setAttribute("data-title-placeholder-readonly",(s=t.readonlyTitlePlaceholder)!=null?s:"")):(r.removeAttribute("data-title-placeholder"),r.removeAttribute("data-title-placeholder-readonly"))}function MR(n){n.rootContainer.querySelectorAll("[data-content-placeholder").forEach(t=>{t.removeAttribute("data-content-placeholder")}),n.rootContainer.querySelectorAll("[data-type=block-tools] .block-placeholder-container").forEach(t=>{t.remove()})}function _H(n,t){var e;MR(n),n.selection.range.isCollapsed()&&(t.hideTitle||DH(n,t),(e=t.applyContentPlaceholder)!=null&&e.call(t,n)||IH(n,t))}const Aat="";function MH(n){for(let t=0;t<n.length;t++){const e=n[t];if(e.attributes&&Object.keys(e.attributes).length)return!0}return!1}const UR=D("enforce-title");class xA{constructor(t,e={headingLevel:1}){m(this,"handleSelectionChange",t=>{setTimeout(()=>{this.applyPlaceholder(t)})});m(this,"reload",t=>{this.handleChanged(t),this.applyPlaceholder(t)});m(this,"applyPlaceholder",t=>{var e,r;!((e=this.options)!=null&&e.titlePlaceholder)&&!((r=this.options)!=null&&r.contentPlaceholder)||_H(t,this.options)});this.options=e,this.handleChanged(t),this.applyPlaceholder(t),t.addListener("selectionChanged",this.handleSelectionChange),setTimeout(()=>{t.addListener("load",this.reload)}),t.addListener("blur",this.removePlaceholder),t.addListener("focus",this.applyPlaceholder)}destroy(t){t.removeListener("selectionChanged",this.handleSelectionChange),t.removeListener("load",this.reload),t.removeListener("blur",this.removePlaceholder),t.removeListener("focus",this.applyPlaceholder)}handleBeforeKeyDown(t,e){if(!t.selection.range.isSimple())return!1;const{containerId:i,blockIndex:s,offset:o}=t.getTextPosition();if(!this.isDocumentTitleBlock(i,s)||!Gi(e,"Enter"))return!1;let l=!1,c=null;qi(t.rootContainer)===2&&(c=Qo(t.rootContainer,1),Ct(t,c)===0&&(l=!0));const d=t.getFirstBlock();return t.undoManager.runInGroup(()=>{t.breakTextBlock(d,o,{forceInsertAfter:!0}),l&&c&&t.deleteBlock(c)}),!0}handleChanged(t){var e,r;try{const i=t.doc.getContainerBlocks(pt(t.rootContainer));p(UR,i.length>0,"root container is empty");const s=i[0];if(s.type!=="text"&&!this.options.hideTitle){const o=es("",{heading:(e=this.options.headingLevel)!=null?e:1});t.insertBlock(pt(t.rootContainer),0,o,t.selection.range.toDocRange()).setAttribute("data-document-title","");return}if(!this.options.hideTitle){p(UR,s.text,"invalid text block");const o=t.getBlockById(s.id);if(MH(s.text)||s.quoted||s.heading!==this.options.headingLevel){const l=t.getBlockString(o),c=es(l,{heading:(r=this.options.headingLevel)!=null?r:1,quoted:!1}),d=t.selection.focusedBlock;let h=t.selection.range;const C=t.insertBlock(pt(t.rootContainer),0,c);C.setAttribute("data-document-title",""),d===o&&(h=Ue(t,c.id,Ct(t,C))),Xm(t,o,h)}else o.setAttribute("data-document-title","")}if(i.length>1||this.options.hideTitle)return;t.insertTextBlock("",pt(t.rootContainer),1,{newRange:t.selection.range.toDocRange()})}finally{this.applyPlaceholder(t)}}handleRemoteChanged(t){setTimeout(()=>{this.applyPlaceholder(t)})}handleUpdateCompositionText(t){this.applyPlaceholder(t)}removePlaceholder(t){MR(t)}isDocumentTitleBlock(t,e){return t==="root"&&e===0&&!this.options.hideTitle}}function _i(n){return Ot(n)==="embed"&&on(n)==="image"}async function OR(n){return new Promise((t,e)=>{const r=new Image;r.onload=()=>{t({width:r.naturalWidth,height:r.naturalHeight})},r.onerror=e,r.src=n})}async function UH(n){const t=await _c(n);return OR(t)}function vl(n){return typeof n=="number"}const OH=D("image-data"),bu=new Map,Nd=1e3,NR=400,NH=10;function vu(n){return n.src.startsWith("empty:")||!n.src}function PH(n){return n.src.startsWith("http:")||n.src.startsWith("https:")}function PR(n){if(bu.has(n))return`${bu.get(n)}_width`;const t=nm.default(n);return bu.set(n,t),`${t}_width`}function FR(n){if(bu.has(n))return`${bu.get(n)}_height`;const t=nm.default(n);return bu.set(n,t),`${t}_height`}function KR(n){return`${n}_flex`}function VR(n){let t=n.getBoundingClientRect().width;return t-=Number.parseFloat(window.getComputedStyle(n).paddingLeft)+Number.parseFloat(window.getComputedStyle(n).paddingRight),t}function Bu(n){if(n.every(i=>typeof i.flex=="number"&&i.flex))return;const t=100,r=n.map(i=>{const s=i.width==="auto"?Nd:i.width,o=i.height==="auto"?s/t:i.height/t;return s/o}).reduce((i,s)=>i+s,0);n.forEach(i=>{const s=i.width==="auto"?Nd:i.width,o=i.height==="auto"?s/t:i.height/t,l=s/o;i.flex=l/r})}function yu(n){const t=(i,s)=>{i||(i=`empty:${s}`);const o=PR(i),l=FR(i),c=KR(s);let d=n[o],h=n[l],C=n[c];return typeof d=="string"&&(d=Number.parseInt(d,10)),typeof h=="string"&&(h=Number.parseInt(h,10)),typeof C=="string"&&(C=Number.parseInt(C,10)),{src:i,width:d!=null?d:"auto",height:h!=null?h:"auto",flex:C,virtualSize:!d||!h}};let e=[];const r=n.src;return Array.isArray(r)?e=r.map(t):typeof r=="string"&&(e=r.split("|").map(t)),Bu(e),e}function Mi(n){const t=n.embedData;return yu(n.embedData).length>1?100:t.widthPercent}function FH(n,t,e,r){const i=yu(t.embedData);if(i.length>1||r)return"100%";const s=Mi(t),o=n.rootContainer.getBoundingClientRect().width;if(s){const l=VR(e);return`${Math.min(o*s/100,l)}px`}return vl(i[0].width)?`${i[0].width}px`:"auto"}function jn(n,t){const r={src:n.map(i=>i.src).join("|"),widthPercent:t};return n.forEach((i,s)=>{const o=i.src||`empty:${s}`,l=PR(o);l&&vl(i.width)&&(r[l]=i.width);const c=FR(o);c&&vl(i.height)&&(r[c]=i.height),p(OH,i.flex,"no image flex");const d=KR(s);r[d]=i.flex}),r}function KH(n,t,e,r){const i=yu(t.embedData),s=i.length===1?n.rootContainer:e;if(i.length===1&&r)return`${NR}px`;if(i.some(h=>h.height==="auto"))return"auto";const o=Mi(t);if(!o){if(i.length!==1||vl(i[0].width))return"";const C=i[0].height;return C==="auto"?"auto":`${C}px`}let l=s.getBoundingClientRect().width*(o/100);if(l-=Number.parseFloat(window.getComputedStyle(s).paddingLeft)+Number.parseFloat(window.getComputedStyle(s).paddingRight),s===n.rootContainer&&s!==e&&(l=Math.min(l,VR(e))),i.length===1){const h=i[0];if(h.virtualSize)return"";const C=h.width==="auto"?Nd:h.width;return`${h.height/(C/l)}px`}l-=(i.length-1)*NH;const c=i.reduce((h,C)=>h+C.flex,0);let d=0;for(const h of i){const C=l*h.flex/c,E=h.width==="auto"?Nd:h.width,A=C/E*h.height;d=Math.max(A,d)}return`${d}px`}function VH(n){return n.reduce((e,r)=>e+r.flex,0)}function $H(n,t){B("div",["resize-gripper",t],n).setAttribute("data-resize-type",t)}function bA(n){return be(n).querySelector(".block-resizer")}function HH(n){const t=bA(n);t&&ct(t,"active")}function $R(n,t,e){const r=n.getBoundingClientRect(),i=t.getBoundingClientRect(),s=i.top-r.top,o=i.left-r.left,l=i.width,c=i.height;e.style.top=`${s}px`,e.style.left=`${o}px`,e.style.width=`${l}px`,e.style.height=`${c}px`}function jH(n,t,e,r){const i=bA(n);if(i)return q(i,"active"),$R(n,t,i),i;const s=be(n),o=B("div",["block-resizer"],s);return $R(n,t,o),e.resize.forEach(l=>{$H(o,l)}),o.addEventListener("mousedown",r),q(o,"active"),o}function vA(n,t){const e=bA(n);if(!e||!Ce(n,t))return;const r=n.getBoundingClientRect(),i=t.getBoundingClientRect(),s=i.top-r.top,o=i.left-r.left,l=i.width,c=i.height;e.style.top=`${s}px`,e.style.left=`${o}px`,e.style.width=`${l}px`,e.style.height=`${c}px`}const xat="",zH=D("block-resizer");class Pd extends Ve.TypedEmitter{constructor(e,r){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",e=>{e.preventDefault(),e.stopPropagation();const r=this.getResizableElement();if(!r||e.button!==0)return;const i=e.target;if(!i||!(i instanceof HTMLElement))return;const s=i.getAttribute("data-resize-type");!s||(this.bindEvents(),this.startRect=r.getBoundingClientRect(),this.startPos=e,this.resizeType=s,bf(window.getComputedStyle(i).cursor),this.block&&this.editor.selection.selectBlock(this.block,0))});m(this,"handleMouseMove",e=>{if(!this.startPos||!this.startRect||!this.resizeType||!this.getResizableElement()||!this.block)return;const i=e.x-this.startPos.x,s=e.y-this.startPos.y,o=this.startRect;let{top:l,left:c,right:d,bottom:h}=o;(this.resizeType==="bottom"||this.resizeType==="bottom-left"||this.resizeType==="bottom-right")&&(h+=s),(this.resizeType==="top"||this.resizeType==="top-left"||this.resizeType==="top-right")&&(l+=s),(this.resizeType==="left"||this.resizeType==="top-left"||this.resizeType==="bottom-left")&&(c+=i),(this.resizeType==="right"||this.resizeType==="top-right"||this.resizeType==="bottom-right")&&(d+=i);const C=d>c?d-c:0,E=h>l?h-l:0,A=new DOMRect(c,l,C,E);this.emit("resizing",this,A);const v=this.getResizableElement();v&&vA(this.block,v)});m(this,"handleMouseUp",e=>{if(e.button!==0)return;bf(""),this.unbindEvents(),this.emit("resized",this);const r=this.getResizableElement();!r||!this.block||vA(this.block,r)});this.editor=e,this.options=r}enableResize(e,r){this.block=e,this.resizableElement=r,this.createResizer(),this.enabled=!0}disableResize(){!this.block||(HH(this.block),this.enabled=!1)}update(e,r){this.block=e,this.resizableElement=r,this.getResizableElement()&&this.enabled&&this.createResizer()}updateResizer(){const e=this.getResizableElement();e&&this.block&&vA(this.block,e)}getBlock(){return this.block}destroy(){}getResizableElement(){return this.resizableElement?this.resizableElement:this.block?zt(this.block):null}createResizer(){const e=this.getResizableElement();!e||!this.block||(p(zH,Ce(this.block,e),"not a block child element"),jH(this.block,e,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 GH=D("image-dom");function HR(n){return n.querySelector(".uploading-progress-mask")}function WH(n){const t=HR(n);if(t)return t;const e=B("div",["uploading-progress-mask"],n),r=B("div",["uploading-progress-bar"],e);return B("div",["uploading-progress-bar-value"],r),r}function qH(n){const e=WH(n).querySelector(".uploading-progress-bar-value");return p(GH,e,"no progress value"),e}function jR(n,t){const e=qH(n);e.style.width=`${t}%`}function XH(n){var t;(t=HR(n))==null||t.remove()}function Fd(n,t,e,r){const i=e!=null?e:n.findBlockById(t.id);if(!i)return;const s=r||at(i),o=!!i.querySelector(".images > .image-container.error, .images > .image-container.empty "),l=FH(n,t,s,o),c=KH(n,t,s,o),d=zt(i);l==="auto"?d.style.width=l:(d.style.maxWidth=l,d.style.width="100%");const h=i.querySelector(".images");!h||(h.style.height=c||"none")}function YH(n){let t;return n.forEach((e,r)=>{r.toLocaleLowerCase()==="content-type"&&(t=e)}),t!=null?t:""}async function QH(n){try{const t=await fetch(n,{credentials:"same-origin"}),e=await t.blob(),r=YH(t.headers).toLocaleLowerCase();let i="";if(r){const o=Ip.default[r].extensions;o&&o.length>0&&(i=o[0])}return new File([e],`${Date.now()}.${i}`,{type:r})}catch{return null}}function Bl(n,t){const e=typeof t=="string"?t:ut(t);return n.getCustom(`image-${e}`)}function mg(n,t){if(!t||!(t instanceof Node))return null;const e=et(t);return e?Bl(n,e):null}function ds(n){return Array.from(n.querySelectorAll(".image-container"))}const BA=D("table-resize-drag-drop");class JH{constructor(t,e,r,i){m(this,"cursor","col-resize");m(this,"initWidths");this.editor=t,this.elem=e,this.data=r,this.mouseDownEvent=i;const s=this.data.block,l=Bl(this.editor,s).getImages(),c=this.data.splitterIndex;p(BA,c>=0&&c<l.length-1,`invalid splitter index: ${c}`);const h=ds(s).map(C=>C.getBoundingClientRect().width);this.initWidths=h}onDragStart(t,e,r){if(!this.editor.isWritable())return;const i=this.data.block;Bl(this.editor,i).setResizing(!0)}onDragging(t,e,r,i,s){const o=this.data.block,l=Bl(this.editor,o),c=Et.default(l.getImages()),d=this.data.splitterIndex;p(BA,d>=0&&d<c.length-1,`invalid splitter index: ${d}`);const h=this.initWidths[d],C=this.initWidths[d+1];if(h+C<100)return;let E=i;h+E<50&&(E=50-h),C-E<50&&(E=C-50);const w=[...this.initWidths];w[d]+=E,w[d+1]-=E;const S=ds(o);p(BA,S.length===c.length,"invalid image data");const U=w.reduce((nt,Y)=>nt+Y,0);for(let nt=0;nt<c.length;nt++){const Y=w[nt]/U;c[nt].flex=Y,S[nt].style.flexGrow=`${Y}`}const M=Et.default(this.editor.getBlockData(o)),V=jn(c,Mi(M));M.embedData=V,Fd(this.editor,M,o,null)}onDragEnd(t,e,r,i,s){const o=this.data.block,l=Bl(this.editor,o),d=ds(o).map(h=>Number.parseFloat(h.style.flexGrow));l.updateFlex(d),l.setResizing(!1)}}function zR(n){var t;return!n||!(n instanceof HTMLElement)?null:Mt(n,"image-splitter")?n:(t=n.closest(".image-splitter"))!=null?t:null}function ZH(n,t){var o;const e=zR(t.target);if(!e)return;const r=et(e);if(!r)return;Bl(n,r).setSelectedIndex(-1),n.selection.selectBlock(r,0);const i=Number.parseInt((o=e.getAttribute("data-index"))!=null?o:"",10);if(Number.isNaN(i)||typeof i!="number")return;const s={block:r,splitterIndex:i};Pp(new JH(n,e,s,t))}function tj(n,t){t.preventDefault(),t.stopPropagation();const e=zR(t.target);if(!e)return;const r=et(e);!r||Bl(n,r).resetFlex()}function ej(n,t,e,r){const i=B("div",["image-splitter"],e);B("div",["image-splitter-indicator"],i),i.setAttribute("data-index",`${r}`),n.domEvents.addEventListener(i,"mousedown",ZH),n.domEvents.addEventListener(i,"dblclick",tj)}const nj=D("image-item");function GR(n){return!n||!(n instanceof Node)?null:et(n)}function WR(n){const t=GR(n);return t?ds(t):[]}function yA(n){if(!n||!(n instanceof Node))return null;const t=n instanceof Element?n:n.parentElement;if(!t)return null;const e=t.closest(".image-container");return e||null}function Kd(n){const t=yA(n);return t?WR(n).indexOf(t):-1}function rj(n){return n.startsWith("data:image/")}async function ij(n,t){const e=mg(n,t.target);if(!e)return;const r=Kd(t.target);if(r===-1)return;const i=t.target;if(!(i instanceof HTMLImageElement))return;const s=e.getImages()[r];if(vu(s)||n.readonly||!e.isAutoFix())return;setTimeout(()=>{e.setAutoFix(!1)},400),(s.height==="auto"||s.width==="auto")&&e.fixImageSize(r,i),s.virtualSize&&e.fixImageSize(r,i);const o=PH(s)||rj(s.src);if(!s||!o||s.downloading)return;s.downloading=!0;const l=await QH(s.src);l?e.replaceImage(r,l):nj.warn(`failed to download image: ${s.src}`)}function sj(n,t,e){if(t.querySelector(".load-error"))return;const i=e.src.startsWith("http:")||e.src.startsWith("https:"),s=B("div",["load-error"],t),o=B("div",["error-icon"],s);o.innerHTML=ZC;const l=B("div",["error-message"],s);i?(l.innerHTML=_.t("image.load.remote.failed"),n.domEvents.addEventListener(s,"click",(c,d)=>{d.preventDefault(),d.target instanceof HTMLElement&&d.target.tagName==="A"&&window.open(e.src,"_blank","noreferrer=1")})):(l.innerHTML=_.t("image.load.failed"),n.domEvents.addEventListener(s,"click",(c,d)=>{d.preventDefault(),d.stopPropagation(),d.target instanceof HTMLElement&&d.target.tagName==="A"&&cj(c,d.target)}))}function TA(n,t){setTimeout(()=>{if(Ce(n.rootContainer,t)){const e=n.getBlockData(t);Fd(n,e,null,null)}})}function oj(n,t){const e=mg(n,t.target);if(!e)return;const r=Kd(t.target);if(r===-1)return;const i=e.getImages()[r];if(!i)return;const s=yA(t.target);if(!s)return;const o=et(s);let l=!1;n.doc.buildResourceUrl(i.src,{syncNewResources(c,d){var C,E;n.doc.addResources([c]);const h=(E=(C=n.doc).getServerMeta)==null?void 0:E.call(C).appId;if(i.src&&d!==i.src&&h&&i.src.includes(h)&&o&&!n.readonly&&n.isBlockWritable(o)){const A=Et.default(n.getBlockData(o));A.embedData.src=c,n.updateEmbedData(o,A.embedData),l=!0,t.target instanceof HTMLImageElement&&(t.target.src=d)}}}),!l&&(q(s,"error","error-load"),o&&TA(n,o),s.innerHTML="",sj(n,s,i))}function lj(n,t,e){if(t.querySelector(".upload-error"))return;const i=B("div",["upload-error"],t),s=B("div",["error-icon"],i);s.innerHTML=ZC;const o=B("div",["error-message"],i);o.innerHTML=_.t("image.upload.failed"),n.domEvents.addEventListener(i,"click",(l,c)=>{if(c.preventDefault(),!c.target||!(c.target instanceof Element)||c.target.tagName!=="A")return;const d=mg(l,c.target),h=Kd(c.target);!d||h===-1||d.replaceImage(h,e)})}function qR(n,t,e,r,i){const s=ds(t)[e];!s||(q(s,"error","error-upload"),TA(n,t),s.innerHTML="",lj(n,s,i))}function XR(n,t,e,r,i,s,o){const l=B("div",["image-container"],e);if(l.setAttribute("data-src",r.src),o.length>1&&(l.style.flexShrink=`${r.flex}`,l.style.flexGrow=`${r.flex}`),s===i&&q(l,"active"),vu(r)){q(l,"empty");const d=B("div",["upload-image-icon"],l);return d.innerHTML=LT,l}const c=B("img",["editor-image"],l);if(c.src=n.doc.buildResourceUrl(r.src),n.domEvents.addEventListener(c,"load",ij),n.domEvents.addEventListener(c,"error",oj),r.src.startsWith("https:")||r.src.startsWith("http:")){const d=B("div",["image-warning"],l);d.innerHTML=JC,d.setAttribute(`data-editor-tooltip-${n.clientId}`,_.t("image.load.remote.tooltip"))}return l}function aj(n,t,e,r,i){const s=B("div",["images"],e);return r.forEach((o,l)=>{l>0&&ej(n,t,s,l-1),XR(n,t,s,o,l,i,r)}),r.length>1&&q(t,"multi"),s}function YR(n,t,e,r,i,s){const l=Array.from(t.querySelectorAll(".image-container"))[r];if(!l)return;const c=XR(n,t,null,e,r,i,s);l.insertAdjacentElement("beforebegin",c),l.remove(),TA(n,t)}function Vd(n,t){return ds(n)[t]}function cj(n,t){const e=GR(t);if(!e)return;const r=Kd(t);if(r===-1)return;const i=mg(n,t);if(!i)return;const s=i.getImages()[r];YR(n,e,s,r,i.getSelectedIndex(),i.getImages())}function QR(n){var r;let t="image/*";const e=(r=n.getComponentOptions("image"))==null?void 0:r.allowedMedias;return e&&(t=e.map(i=>`.${i}`).join(",")),t}function JR(n,t){var o;const{maxSize:e,allowedMedias:r,callbacks:i}=(o=n.getComponentOptions("image"))!=null?o:{};if(e&&t.size>e){const l=new Error("image is too large");throw l.code="MaxMediaSize",i!=null&&i.onError&&(i==null||i.onError(n,l)),l}const s=Tf(t.name);if(r&&!r.includes(s.toLowerCase())){const l=new Error(`media file is not allowed: ${s}`);throw l.code="NotAllowedFile",i!=null&&i.onError&&(i==null||i.onError(n,l)),l}}function ZR(n){return n.startsWith("image/")}const tw=D("image-object");class qe{constructor(t,e){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(t,e)=>{const r=Kd(e.target);if(r===-1)return;const i=this.images[r];vu(i)||this.setSelectedIndex(r)});m(this,"handleRootContainerResize",()=>{this.handleEditorResize(this.editor.rootContainer)});m(this,"handleEditorResize",t=>{if(this.isEmpty()||this.resizing)return;const e=this.editor.findBlockById(this.blockData.id);!e||at(e)===t&&Fd(this.editor,this.blockData,e,null)});m(this,"handleResizing",(t,e)=>{const r=this.editor.findBlockById(this.blockData.id);if(!r)return;this.autoFix||this.setAutoFix(!0);const i=r.querySelector(".images");i.style.height="";const o=this.editor.rootContainer.getBoundingClientRect().width,l=r.getBoundingClientRect();let c=e.width>l.width?l.width:e.width;c<50&&(c=50);const d=c*100/o;this.blockData.embedData.widthPercent=d,Fd(this.editor,this.blockData,r,null)});m(this,"handleResized",t=>{const e=this.editor.findBlockById(this.blockData.id);if(!e)return;const r=jn(this.images,Mi(this.blockData));this.editor.updateEmbedData(e,r),this.blockResizer.enableResize(e)});m(this,"fixImageSizes",Ne.default(()=>{const t=this.editor.findBlockById(this.blockData.id);if(!t)return;const e=jn(this.images,Mi(this.blockData));this.editor.updateEmbedData(t,e)},1e3));this.editor=t,this.blockData=e,this.blockResizer=new Pd(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=yu(this.blockData.embedData)}destroy(){var t;this.blockResizer.removeAllListeners(),this.blockResizer.destroy(),this.editor.domEvents.removeEventListener(null,null,this.handleMouseDown),(t=this.parentContainerResizerObserver)==null||t.disconnect()}setAutoFix(t){this.autoFix=t}isAutoFix(){return this.autoFix}createContent(t,e,r){const i=aj(this.editor,e,r,this.images,this.selectedIndex);if(this.editor.domEvents.addEventListener(r,"mousedown",this.handleMouseDown),this.editor.addListener("resize",this.handleRootContainerResize),gi(t)){const o=()=>{this.handleEditorResize(t)};this.parentContainerResizerObserver=new Jl(o),this.parentContainerResizerObserver.observe(t)}const s=()=>!!(this.images.length===1&&this.images[0].virtualSize);this.isEmpty()&&s()&&q(i,"empty"),Fd(this.editor,this.blockData,e,t),setTimeout(()=>{const o=this.editor.findBlockById(this.blockData.id);o&&this.blockResizer.update(o)})}getImages(){return this.images}getWidthPercent(){return Mi(this.blockData)}isEmpty(){return this.images.length===1&&vu(this.images[0])}setResizing(t){this.resizing=t}getSelectedIndex(){return this.selectedIndex}getBlock(){return this.editor.findBlockById(this.blockData.id)}setSelectedIndex(t){const e=this.getBlock();if(!e||t===this.selectedIndex)return;if(this.selectedIndex!==-1){const i=Vd(e,this.selectedIndex);i&&ct(i,"active")}this.selectedIndex=t;const r=Vd(e,t);r&&q(r,"active")}async requestUploadImage(t){const e=this.editor.findBlockById(this.blockData.id);if(!e)return;const r=Vd(e,t);if(Mt(r,"error"))return;const i=QR(this.editor),s=await Mc(i);!s||await this.replaceImage(t,s)}tryEnableResizer(){const t=this.editor.findBlockById(this.blockData.id);if(!t||!this.editor.isWritable())return;const e=Vd(t,0);!this.isEmpty()&&this.images.length===1&&!Mt(e,"error")&&this.blockResizer.enableResize(t)}disableResizer(){this.blockResizer.disableResize()}fixImageSize(t,e){const r=this.images[t];vu(r)||(vl(r.width)&&!vl(r.height)?r.height=r.width/e.naturalWidth*e.naturalHeight:vl(r.height)&&!vl(r.width)?r.width=r.height/e.naturalHeight*e.naturalWidth:(r.width=e.naturalWidth,r.height=e.naturalHeight),r.virtualSize=!1,this.fixImageSizes())}removeImage(t){const e=this.editor.findBlockById(this.blockData.id);if(!e||t===-1||t>=this.images.length)return!1;const r=Et.default(this.images);if(r.splice(t,1),r.length===0)return this.editor.deleteBlock(e),!0;r[0].flex=NaN,Bu(r),this.selectedIndex>=r.length&&(this.selectedIndex=r.length-1);const i=jn(r,Mi(this.blockData));return this.editor.updateEmbedData(e,i),!0}async replaceImage(t,e){const r=this.editor.findBlockById(this.blockData.id);if(!r)return!1;try{const s=await _c(e),o=this.images[t];if(o.virtualSize){const{width:c,height:d}=await OR(s);o.width=c,o.height=d,o.virtualSize=!1,this.images[0].flex=NaN,Bu(this.images);const h=jn(this.images,Mi(this.blockData));this.editor.updateEmbedData(r,h)}const l={...o,src:s};YR(this.editor,r,l,t,this.selectedIndex,this.images),setTimeout(()=>{this.blockResizer.update(r)})}catch(s){return qR(this.editor,r,t,s,e),!1}const i=Vd(r,t);if(!i)return!1;q(i,"uploading"),jR(i,0),q(r,"media-block-uploading");try{const s=await this.editor.doc.uploadResource(e,{onProgress:c=>{jR(i,c)}});ct(i,"uploading"),this.images[t].src=s.resourceId;const o=this.editor.findBlockById(this.blockData.id);if(!o)return!1;ct(o,"media-block-uploading");const l=jn(this.images,Mi(this.blockData));return this.editor.updateEmbedData(o,l),!0}catch(s){tw.error(s);const o=this.editor.findBlockById(this.blockData.id);return o&&(ct(i,"uploading"),XH(i),qR(this.editor,o,t,s,e),ct(o,"media-block-uploading")),!1}}updateFlex(t){const e=this.editor.findBlockById(this.blockData.id);if(!e)return;p(tw,t.length===this.images.length,"invalid flex");for(let i=0;i<this.images.length;i++)this.images[i].flex=t[i];const r=jn(this.images,Mi(this.blockData));this.editor.updateEmbedData(e,r)}resetFlex(){const t=this.editor.findBlockById(this.blockData.id);if(!t)return;const e=Et.default(this.images);e[0].flex=NaN,Bu(e);const r=jn(e,Mi(this.blockData));this.editor.updateEmbedData(t,r)}setData(t){this.blockData=t,this.images=yu(t.embedData)}static create(t,e){const r=t.addCustom(`image-${e.id}`,()=>new qe(t,e));return r.setData(e),r}static getImageObject(t,e){let r;return typeof e=="string"?r=e:r=ut(e),t.getCustom(`image-${r}`)}}const bat="",vat="";function gg(n){const t=be(n);let e=t.querySelector(":scope > .block-helper");return e||(e=B("div",["block-helper"],t),B("span",["helper-sizer"],e,"A")),e}function kA(n,t,e){const r=gg(n),s=Array.from(r.children).find(o=>{var c;return Number.parseInt((c=o.getAttribute("data-index"))!=null?c:"0",10)>e});r.insertBefore(t,s!=null?s:null)}const ew=40,uj=20;class fj{findTargetBlock(t,e){const r=e.target;if(r&&r instanceof Element){const c=et(r);if(c&&Ce(t.rootContainer,c))return c}let i=e.clientX,s=e.clientY;const o=t.rootContainer.getBoundingClientRect().left;i<o&&o-i<ew&&(i+=ew);let l=Pe(i,s,{noFilter:!0});if(l){const c=et(l);if(c&&Ce(t.rootContainer,c))return c}if(s-=uj,l=Pe(i,s,{noFilter:!0}),l){const c=et(l);if(c&&Ce(t.rootContainer,c))return c}return null}destroy(){}}class dj extends sg{constructor(e){super(e,{trigger:[],id:"empty-block-menu"});m(this,"currentBlock",null)}get isVisible(){return this.suggest.menu.isVisible}isInMenu(e){return this.menu.isInCommandBar(e)}show(){const r=this.editor.selection.focusedBlock;this.suggest.popup(r,0,"","")}setBlock(e){this.currentBlock=e}}function hj(n,t,e){const r=u1(n,t);if(!r)return[];const i=[],s=(o,l)=>{var c;return(c=o.children)==null?void 0:c.map(d=>({...d,source:"block-command",blockMenuItemCustomData:l,children:s(d,l)}))};return Object.values(r).forEach(o=>{e!=null&&e.has(o.group)||i.push(...o.commands.map(l=>({...l,source:"block-command",blockMenuItemCustomData:o.group,children:s(l,o.group)})))}),i}function RA(n,t,e){const r=iA(n,e),i=s=>{s.forEach(o=>{o.source=t,o.children&&i(o.children)})};return i(r),r}function mj(n,t,e,r=!1){var h,C,E;const i=at(t);let s=t;if(s&&Ht(s)&&KE(s)){if(!r){const A=qP(s);s=(h=ae(A))!=null?h:A}J0.closeMindmap(n,t)}let l=Rt(s);if(!ve(n,s)&&!r){let A=zr(s);A?l=Rt(A):(A=Ge(i),l=Rt(A)+1)}const c=pt(i),d=e;return n.emit("beforeExecCommand",n,e,{source:"block-menu"}),d.commandProvider?d.commandProvider.executeCommand(n,e,{from:"block-menu",containerId:c,blockIndex:l}):(E=(C=d.blockOptions)==null?void 0:C.handleInsertEmptyBlock)==null?void 0:E.call(C,n,{containerId:c,blockIndex:l,item:e,from:"block-menu"})}function gj(n,t){const e=Ci(n,t),r=n.getBlockData(t);return!(e!=="text"||r.heading)}class nw{constructor(t,e,r){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",(t,e,r)=>{var s;const i=tA();this.createItem("text",ru,e,gj(this.editor,t)),(s=i.insertBlockCommandItems)==null||s.forEach(o=>{o.id&&o.icon&&this.createItem(o.id,o.icon,e,r?r===Number(o.value):!1)})});m(this,"createListItemElement",(t,e,r)=>{const{checkbox:i,ordered:s}=r,l=Ot(t)==="list",c=l&&s===!1&&!i,d=l&&s,h=l&&!!i;this.createItem("unordered-list",oE,e,c),this.createItem("ordered-list",lE,e,d),this.createItem("check-list",iE,e,h)});m(this,"handleClick",(t,e)=>{var c,d;if(!e.target||!(e.target instanceof Node))return;const r=e.target instanceof Element?e.target:e.target.parentElement;if(!r)return;const i=r.closest(".text-style-item");if(!i)return;const s=i.id,o="heading-",l={id:s,name:""};if(t.emit("beforeExecCommand",t,l,{source:"block-command"}),s==="text"&&ng(t,this.block,null),s.startsWith(o)){const h=Number.parseInt(s.substring(o.length),10);h&&ng(t,this.block,h)}if(s==="blockquote"&&QE(t,this.block),s.startsWith("align")){const h=s.replace(/^align-/,"");_k(t,this.block,h)}(s==="unordered-list"||s==="ordered-list"||s==="check-list")&&ZE(t,this.block,s),(d=(c=this.options).onAfterStyleItemClick)==null||d.call(c)});m(this,"calcTextStyleItemTooltipsEnum",()=>{this.textStylesTooltips={text:{title:_.t("commands.text")},blockquote:{title:_.t("commands.quote")},"align-left":{title:_.t("commands.alignLeft")},"align-center":{title:_.t("commands.alignCenter")},"align-right":{title:_.t("commands.alignRight")},"unordered-list":{title:_.t("commands.unordered")},"ordered-list":{title:_.t("commands.ordered")},"check-list":{title:_.t("commands.check")}};let t=1;for(;t<=8;)this.textStylesTooltips[`heading-${t}`]={title:_.t("commands.heading",{name:`${t}`})},t++});this.editor=t,this.block=e,this.options=r,this.calcTextStyleItemTooltipsEnum(),this.element=this.createItemElement(t,e),t.domEvents.addEventListener(this.element,"click",this.handleClick)}createItemElement(t,e){const r=B("div",["text-styles"],null),i=B("div",["text-style-section"],r),s=t.getBlockData(e);if(!this.options.fromEmbed){const l=s.heading,c=s.quoted;this.createHeadingItemElement(e,i,l),this.createListItemElement(e,i,s),this.createItem("blockquote",sE,i,!!c)}const o=s.align||"left";return this.createItem("align-left",nu,i,o==="left"),this.createItem("align-center",S0,i,o==="center"),this.createItem("align-right",w0,i,o==="right"),r}createItem(t,e,r,i=!1){const s=["style-icon","text-style-item"];i&&s.push("active");const o=ta(e,s,r);o.id=t;const l=this.textStylesTooltips[t];if(!l)return;const{title:c,shortcut:d}=l;o.setAttribute(`data-editor-tooltip-${this.editor.clientId}`,c),d&&o.setAttribute(`data-editor-tooltip-desc-${this.editor.clientId}`,hn(d))}}function rw(){return{source:"separator",type:"separator",id:`section-${it()}`,name:""}}const iw={copy:GT,cut:WT,delete:qT,"lock-block":XT,"unlock-block":YT,comment:ba},pj=["image","video"];function Cj(n,t,e){const r=[],i=ot(n,t),s=Le(t)&&pj.includes(on(t)),o=s&&(on(t)!=="image"||on(t)==="image"&&ds(t).length===1);if(i?r.push(new nw(n,t,e)):s&&o&&r.push(new nw(n,t,{...e,fromEmbed:!0})),!ve(n,t)||FE(t)){(i||s&&o)&&r.push(rw());const l=hj(n,t,new Set(["hovering-toolbar"]));l.sort((c,d)=>{var h,C;return((h=c.order)!=null?h:0)-((C=d.order)!=null?C:0)}),l.forEach(c=>{c.id in iw&&(c.icon=iw[c.id])}),r.push(...l)}return ve(n,t)&&!FE(t)?r.push(...RA(n,"insert-block",{withPlainText:!1,from:"block-menu"})):r.push(rw(),{id:"insert-block-before",icon:QT,name:_.t("blockMenu.command.insertAbove"),children:RA(n,"insert-block-before",{withPlainText:!0,from:"block-menu"}),childrenMenuId:"quick-menu",source:"insert-block-before"},{id:"insert-block-after",icon:JT,name:_.t("blockMenu.command.insertAfter"),children:RA(n,"insert-block",{withPlainText:!0,from:"block-menu"}),source:"insert-block",childrenMenuId:"quick-menu"}),r}function Ej(n,t,e){if(e.source==="block-command"){const r=e.blockMenuItemCustomData;Yv(n,t,r,e)}else(e.source==="insert-block"||e.source==="insert-block-before")&&mj(n,t,e,e.source==="insert-block-before")}const Aj=D("exclusive-block");function wA(n,t,e,r){var l;q(t,"block-exclusive");const i=le(n,t),s=(l=i.getBlockProperties)==null?void 0:l.call(i,n,t),{abstract:o}=s||{};t.setAttribute("data-user-name",r),t.setAttribute("data-user-id",e),t.setAttribute("data-exclusive-tips",_.t("exclusive.tips",{editor:r,embedType:o||_.t("exclusive.fallbackAbstract")}))}function sw(n){ct(n,"block-exclusive"),n.removeAttribute("data-user-name"),n.removeAttribute("data-user-id"),n.removeAttribute("data-exclusive-tips")}function xj(n,t,e,r,i){Aj.debug(`block ${ut(t)} ${e?"exclusive":"unexclusive"}, ${r}, ${i}`),e?wA(n,t,r,i):sw(t)}function $d(n){return n.classList.contains("block-exclusive")}function ow(n,t){t.blockIds.forEach(e=>{const r=n.findBlockById(e);r&&xj(n,r,t.exclusive,t.userId,t.displayName)})}class yl{constructor(t){m(this,"exclusiveBlockIds",new Set);m(this,"exclusiveBlockTimer",0);m(this,"remoteExclusiveBlockIds",new Map);m(this,"handleUserChanged",t=>{const e=new Set(t.map(i=>i.userId));Array.from(this.remoteExclusiveBlockIds.entries()).forEach(([i,s])=>{if(!e.has(s.userId)){this.remoteExclusiveBlockIds.delete(i);const o={...s,exclusive:!1};ow(this.editor,o)}});const r=Array.from(this.exclusiveBlockIds).map(i=>this.editor.findBlockById(i)).filter(i=>!!i);r.length>0&&this.broadcastExclusiveBlockMessage(r,!0)});this.editor=t,t.doc.registerCallback(this),t.doc.getRemoteUsers().addListener("change",this.handleUserChanged)}destroy(){this.stopExclusiveBlockTimer(),this.editor.doc.unregisterCallback(this),this.editor.doc.getRemoteUsers().addListener("change",this.handleUserChanged)}onCustomMessage(t){if(t.type==="exclusiveBlock"){const e=t;ow(this.editor,e),e.blockIds.forEach(r=>{e.exclusive?this.remoteExclusiveBlockIds.set(r,e):this.remoteExclusiveBlockIds.delete(r)})}}getExclusiveMessage(t){return this.remoteExclusiveBlockIds.get(t)}broadcastExclusiveBlockMessage(t,e){if(this.editor.readonly||t.length===0)return;const r=this.editor.doc.getUser(),i={type:"exclusiveBlock",userId:r.userId,displayName:r.displayName,blockIds:t.map(s=>ut(s)),exclusive:e};this.editor.doc.broadcastMessage(i)}exclusiveBlock(t){this.exclusiveBlockIds.has(ut(t))||(this.broadcastExclusiveBlockMessage([t],!0),this.exclusiveBlockIds.add(ut(t)),this.exclusiveBlockIds.size===1&&this.startExclusiveBlockTimer())}unexclusiveBlock(t){!this.exclusiveBlockIds.has(ut(t))||(this.exclusiveBlockIds.delete(ut(t)),this.broadcastExclusiveBlockMessage([t],!1),this.exclusiveBlockIds.size===0&&this.stopExclusiveBlockTimer())}startExclusiveBlockTimer(){this.exclusiveBlockTimer=window.setInterval(()=>{Array.from(this.exclusiveBlockIds.keys()).forEach(t=>{this.broadcastExclusiveBlockMessage([this.editor.getBlockById(t)],!0)})},30*1e3)}stopExclusiveBlockTimer(){clearInterval(this.exclusiveBlockTimer),this.exclusiveBlockTimer=0}static get(t){return t.addCustom("exclusiveBlock",()=>new yl(t))}static register(t){return this.get(t)}}function SA(n,t){yl.get(n).exclusiveBlock(t)}function LA(n,t){yl.get(n).unexclusiveBlock(t)}class lw{writable(t,e){if(Array.isArray(e)){for(const r of e)if($d(r))return!1;return}if($d(e))return!1}create(t,e,r,i,s){const o=yl.get(t).getExclusiveMessage(s.id);o&&wA(t,i,o.userId,o.displayName)}update(t,e,r,i,s){const o=yl.get(t).getExclusiveMessage(s.id);o?wA(t,i,o.userId,o.displayName):sw(i)}}const Bat="",bj={exclusive:{tips:"\u300C{editor}\u300D\u6B63\u5728\u7F16\u8F91\uFF0C\u300C{embedType}\u300D\u4E0D\u652F\u6301\u591A\u4EBA\u7F16\u8F91",fallbackAbstract:"\u8BE5 Block"}},vj={exclusive:{tips:"\u300C{editor}\u300Dis editing\uFF0C\u300C{embedType}\u300Ddoes not support multi-person editing",fallbackAbstract:"This Block"}},Bj={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"}};_.mergeLang({"zh-CN":bj,"en-US":vj,"ja-JP":Bj});function Hd(n,t){return n.getBlockData(t).lock}function pg(n,t){return!!Hd(n,t)}function jd(n,t){const e=Hd(n,t);return e?e.userId===n.doc.getUser().userId:!1}function IA(n,t){const e=Hd(n,t);return e?e.userId!==n.doc.getUser().userId:!1}function yj(n,t){if(n.readonly||!n.isBlockWritable(t)||pg(n,t)&&!jd(n,t))return;const e=n.doc.getUser(),r={userId:e.userId,displayName:e.displayName,locked:Date.now()},s={...n.getBlockData(t),lock:r};n.updateBlockData(t,s)}function Tj(n,t){if(!jd(n,t))return;const e={lock:null};n.updateBlockData(t,e)}const kj=10,Rj=80,wj=50;class DA{constructor(){m(this,"executeCommand",(t,e,r)=>{const i=r.data;if(!i||!i.blockId)return;const s=t.getBlockById(i.blockId);i.type==="lock"?yj(t,s):i.type==="unlock"&&Tj(t,s)})}create(t,e,r,i,s){const o=s.lock;o&&(o.userId!==t.doc.getUser().userId?q(i,"locked-by-others"):q(i,"locked-by-self"))}update(t,e,r,i,s){const o=s.lock;if(o)if(o.userId!==t.doc.getUser().userId){q(i,"locked-by-others");const l=t.selection.focusedBlock;(l===i||Ce(i,l))&&(ot(t,i)||Ot(i)==="code")&&t.insertTextBlock("",pt(r),Rt(i)+1)}else q(i,"locked-by-self");else ct(i,"locked-by-others"),ct(i,"locked-by-self")}writable(t,e){let r=[];Array.isArray(e)?r=e:r.push(e);for(const i of r){if(IA(t,i))return!1;if(Gr(i))return;let s=ca(i);for(;s;){if(IA(t,s))return!1;s=ca(s)}}}commands(t,e){const r=pg(t,e),i=jd(t,e),s=$d(e),o={blockId:ut(e),type:"lock"},l={id:"lock-block",name:"",data:o,order:50};if(r)if(i)l.id="unlock-block",l.name=_.t("locker.unlock"),o.type="unlock";else{const c=Hd(t,e);let d=(c==null?void 0:c.displayName)||"";const h=_.getCurrentLang()==="ja-JP",C=Cv(d,kj,h?wj:Rj);(C==null?void 0:C.length)!==d.length&&(l.ellipsisTooltip=c==null?void 0:c.displayName,d=C||""),l.name=_.t("locker.lockedBy",{name:d}),l.states=["disabled"]}else s?(l.name=_.t("locker.lock"),l.states=["disabled"]):l.name=_.t("locker.lock");return{group:"block-locker",commands:[l],executeCommand:this.executeCommand}}}const yat="",Sj={locker:{lock:"\u9501\u5B9A",unlock:"\u89E3\u9664\u9501\u5B9A",lockedBy:"\u88AB {name} \u9501\u5B9A"}},Lj={locker:{lock:"Lock",unlock:"Unlock",lockedBy:"Locked by {name}"}},Ij={locker:{lock:"\u30ED\u30C3\u30AF",unlock:"\u30ED\u30C3\u30AF\u89E3\u9664",lockedBy:"{name}\u304C\u30ED\u30C3\u30AF\u3057\u307E\u3057\u305F"}};_.mergeLang({"zh-CN":Sj,"en-US":Lj,"ja-JP":Ij});class Cg{async handleBeforePasteDoc(t,e){return Object.values(e.blocks).forEach(r=>{r.forEach(i=>{delete i.lock})}),!1}}const Dj=D("standard-block-actions");class _j{constructor(){m(this,"executeCommand",(t,e,r)=>{const i=r.data;try{const s=t.getBlockById(i);if(r.id==="delete"){this.deleteBlock(t,s);return}r.id==="copy"&&this.copyBlock(t,s),r.id==="cut"&&(this.copyBlock(t,s),this.deleteBlock(t,s))}catch(s){Dj.error(`failed to execute block command: ${JSON.stringify(s)}`)}})}commands(t,e){const r=pg(t,e),i=r&&jd(t,e),s=ut(e),o=window.isSecureContext,l=$d(e),c={id:"copy",name:_.t("blockMenu.command.copy"),data:s,order:10,states:o?[]:["disabled"],disableReason:o?void 0:_.t("copyCutProperty.unsafeEnvTips",{shortCut:hn("CtrlOrCmd+C"),operation:_.t("copyCutProperty.copy")})},d={id:"cut",name:_.t("blockMenu.command.cut"),data:s,order:20,states:r&&!i||!o||l?["disabled"]:[],disableReason:o?void 0:_.t("copyCutProperty.unsafeEnvTips",{shortCut:hn("CtrlOrCmd+X"),operation:_.t("copyCutProperty.cut")})},h={id:"delete",name:_.t("blockMenu.command.delete"),data:s,order:30,states:r&&!i||l?["disabled"]:[]};return{group:"standard-block-actions",commands:[c,d,h],executeCommand:this.executeCommand}}deleteBlock(t,e){if(Xi(e)){const r=Oc(e);t.undoManager.runInGroup(()=>{[e,...r].forEach(i=>t.deleteBlock(i))})}else t.deleteBlock(e)}copyBlock(t,e){if(Xi(e)){const r=Oc(e),i=W5(t,[e,...r]);i0(t,i)}else vC(t,e)}}const aw=D("block-menu");class Mj{constructor(t){m(this,"menu");m(this,"currentBlock",null);m(this,"commandBlock",null);m(this,"handleShow",()=>{p(aw,this.currentBlock,"no target block before show block menu");const t=Cj(this.editor,this.currentBlock,{onAfterStyleItemClick:this.close});this.menu.updateItems(t),this.commandBlock=this.currentBlock});m(this,"handleClose",()=>{dE(this.editor)&&this.editor.focus()});m(this,"handleItemClick",(t,e)=>{p(aw,this.commandBlock,"no command block before show block menu"),Ej(this.editor,this.commandBlock,e),e.element||this.close()});m(this,"close",()=>{this.menu.close("clickItem")});this.editor=t,this.menu=new dl([],void 0,{id:"block-menu"}),this.menu.on("show",this.handleShow),this.menu.on("close",this.handleClose),this.menu.on("click",this.handleItemClick),t.blockHooks.push(new _j)}show(t,e){this.menu.manualShow(t,{placement:"bottom-start",...e})}isInMenu(t){return this.menu.isInCommandBar(t)}setBlock(t){this.currentBlock=t}get isVisible(){return this.menu.isVisible}destroy(){this.menu.destroy()}}const Uj=1e3;async function Oj(n,t){const{width:e}=n.rootContainer.getBoundingClientRect(),r=t.getBoundingClientRect();return r.width>e||r.height>=Uj?"":await wb.default.toPng(t,{style:{margin:0}})}const Nj=D("drag-preview-image");class Pj{constructor(t){m(this,"startPosition",null);m(this,"dragContainer",null);m(this,"handleDragStart",async(t,e)=>{const r=t.target;p(Nj,r instanceof Element,`Invalid Drag target:${r}`);const{x:i,y:s}=t;this.startPosition={x:i,y:s};const o=B("div",["drag-image-container"],this.editor.rootContainer),l=B("img",["drag-image"],o),c=B("span",["drag-loading"],o);c.innerHTML=n2;const{x:d,width:h,height:C,y:E}=r.getBoundingClientRect(),A=this.editor.rootContainer.getBoundingClientRect(),v=e.getBoundingClientRect();o.style.left=`${d+h}px`,o.style.top=`${E+C}px`,o.style.width=`${Math.min(A.width/2,v.width)}px`,this.dragContainer=o;const S=await Oj(this.editor,e);S?l.src=S:q(o,"drag-placeholder"),Op(o,{status:"loaded"})});m(this,"handleDrag",t=>{if(this.startPosition&&this.dragContainer){const{x:e,y:r}=t;if(e===0&&r===0){this.dragContainer.style.transition="transform 0.15s, opacity .15s",this.dragContainer.style.transform="",this.dragContainer.style.opacity="0";return}const{x:i,y:s}=this.startPosition,o=e-i,l=r-s;this.dragContainer.style.transform=`translate(${o}px, ${l}px)`}});m(this,"handleDragEnd",()=>{this.dragContainer&&(this.dragContainer.remove(),this.startPosition=null,this.dragContainer=null)});this.editor=t}}const cw="drag-preview-element";function Fj(n){if(Mt(n,cw))return n;const t=n.querySelector(`.${cw}`);return t||(Le(n)?zt(n):n)}const Eg=D("block-menu-drag-handler");function _A(n,t){return new DragEvent(t,{bubbles:!0,cancelable:!0,view:window,screenX:n.screenX,screenY:n.screenY,dataTransfer:new DataTransfer,clientX:n.clientX,clientY:n.clientY})}class Kj{constructor(t,e){m(this,"dragPreview");m(this,"autoScroll");m(this,"oldPos",{x:0,y:0});m(this,"handleMouseDown",t=>{const e=this.button.blockMenu.currentBlock;if(p(Eg,e,"no dragged block"),t.button!==0)return;if(!this.editor.isBlockWritable(e)){t.preventDefault(),t.stopPropagation();return}const{x:r,y:i}=t;this.oldPos={x:r,y:i},document.addEventListener("mouseup",this.handleDragEnd),this.editor.contentElement.addEventListener("mousemove",this.handleDrag)});m(this,"handleDragStart",t=>{var o,l;const e=mn(this.button.buttonElement);this.autoScroll||(this.autoScroll=new xm({scrollElement:e,trackMouseEvent:"mousemove",edge:{top:50,bottom:50}}));const r=this.button.blockMenu.currentBlock;p(Eg,r,"no dragged block"),(l=(o=le(this.editor,r)).notify)==null||l.call(o,this.editor,"beginDrag");const i=_A(t,"dragstart");zj(this.editor,i,r),window.isDragging=!0,this.button.buttonElement.style.opacity="0";const s=Fj(r);this.dragPreview.handleDragStart(t,s),this.autoScroll.active(),q(r,"dragging"),q(this.editor.contentElement,"dragging")});m(this,"handleDrag",t=>{const{target:e,x:r,y:i}=t;if(this.oldPos.x===r&&this.oldPos.y===i)return;window.isDragging||this.handleDragStart(t),this.oldPos={x:r,y:i},p(Eg,e instanceof Element,"target is invalid"),this.dragPreview.handleDrag(t);const s=_A(t,"dragover");this.editor.contentElement.dispatchEvent(s)});m(this,"handleDragEnd",t=>{var i;const e=this.button.blockMenu.currentBlock;p(Eg,e,"no dragged block"),window.isDragging=!1,this.button.buttonElement.style.opacity="1",this.dragPreview.handleDragEnd(),(i=this.autoScroll)==null||i.inactive(),ct(e,"dragging"),ct(this.editor.contentElement,"dragging"),document.removeEventListener("mouseup",this.handleDragEnd),this.editor.contentElement.removeEventListener("mousemove",this.handleDrag);const r=_A(t,"drop");this.editor.contentElement.dispatchEvent(r)});this.editor=t,this.button=e,this.button.buttonElement.addEventListener("mousedown",this.handleMouseDown),this.dragPreview=new Pj(t)}destroy(){this.button.buttonElement.removeEventListener("mousedown",this.handleMouseDown)}}class zd{constructor(t){m(this,"highlightedBlockId","");m(this,"handleSelectionChange",()=>{this.clearHighlightedBlock()});this.editor=t,this.editor.addListener("selectionChanged",this.handleSelectionChange)}highlightBlock(t){this.clearHighlightedBlock(),this.highlightedBlockId=ut(t),q(t,"highlighted")}clearHighlightedBlock(){if(this.highlightedBlockId){const t=this.editor.findBlockById(this.highlightedBlockId);t&&ct(t,"highlighted"),this.highlightedBlockId=""}}destroy(){}static register(t){return t.addCustom("editor-block-highlighter",()=>new zd(t))}static get(t){return t.getCustom("editor-block-highlighter")}}class uw{constructor(t){m(this,"buttonElement");m(this,"emptyBlockMenu");m(this,"blockMenu");m(this,"dragHandler");m(this,"handleHoverBlock",(t,e,r)=>{if(this.emptyBlockMenu.isVisible||this.blockMenu.isVisible||!this.editor.isWritable())return;const i=this.editor.getCustom("editor-tooltip");if(i&&i.visible()&&(i.hide(),this.buttonElement.setAttribute("data-tooltip-hide-at",`${Date.now()}`)),!t){this.buttonElement.parentElement&&(this.blockMenu.isInMenu(r.target)||this.buttonElement.remove());return}const s=c1(t);Ps(s)||(this.updateButton(s),kA(s,this.buttonElement,Number.MAX_SAFE_INTEGER))});m(this,"handleButtonClick",()=>{if(this.buttonElement.getAttribute("data-type")==="move"){const r=this.blockMenu.currentBlock;if(!r)return;this.editor.selection.selectBlock(r,0,void 0,{noScroll:!0}),this.blockMenu.show(this.buttonElement,{placement:"bottom-end"}),setTimeout(()=>{zd.get(this.editor).highlightBlock(r)});return}const e=this.emptyBlockMenu.currentBlock;!e||(this.editor.selection.selectBlock(e,0,void 0,{noScroll:!0}),setTimeout(()=>{this.editor.focus(),this.updatePlaceholder(e),this.emptyBlockMenu.show()}))});m(this,"updatePlaceholder",t=>{Od(this.editor,t,_.t("blockMenu.button.searchPlaceholder"))});m(this,"handleChanged",()=>{const t=this.emptyBlockMenu.currentBlock;if(!t)return;if(this.blockMenu.currentBlock){const r=ut(this.blockMenu.currentBlock);if(!this.editor.findBlockById(r)&&this.blockMenu.isVisible){this.blockMenu.close();return}}const e=ve(this.editor,t)?"insert":"move";this.buttonElement.getAttribute("data-type")!==e&&this.setButtonType(e)});this.editor=t,this.buttonElement=this.createButton(),this.emptyBlockMenu=new dj(t),this.blockMenu=new Mj(t),this.editor.addListener("docChanged",this.handleChanged),this.buttonElement.addEventListener("click",this.handleButtonClick),this.dragHandler=new Kj(this.editor,this);const e=$e.get(t);e.addListener("change",this.handleHoverBlock),e.addFinder(new fj),zd.register(this.editor)}destroy(){$e.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 t=B("button",["block-button"],null);return t.setAttribute(`data-editor-tooltip-${this.editor.clientId}`,_.t("blockMenu.button.tips")),t.innerHTML=aE,t}setButtonType(t){this.buttonElement.setAttribute("data-type",t);const e=`data-editor-tooltip-${this.editor.clientId}-dynamic`;this.buttonElement.hasAttribute(e)&&this.buttonElement.removeAttribute(e),t==="insert"?(this.buttonElement.innerHTML=e2,this.buttonElement.setAttribute(e,_.t("blockMenu.button.insertTips"))):(this.buttonElement.innerHTML=aE,this.buttonElement.setAttribute(e,_.t("blockMenu.button.tips")))}updateButton(t){this.emptyBlockMenu.setBlock(t),this.blockMenu.setBlock(t),ve(this.editor,t)&&!(Ht(t)&&FE(t))?this.setButtonType("insert"):this.setButtonType("move")}}const Vj={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
665
665
  \u70B9\u51FB\u6253\u5F00\u83DC\u5355`,insertTips:"\u70B9\u51FB\u6DFB\u52A0\u533A\u5757"}}},$j={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
666
666
  Click to open the menu`,insertTips:"Click to add block"}}},Hj={blockMenu:{section:{basics:"\u4E00\u822C",system:"\u30B7\u30B9\u30C6\u30E0",styles:"\u30B9\u30BF\u30A4\u30EB",common:"\u4E00\u822C",actions:"\u64CD\u4F5C",thirdParty:"\u5916\u90E8\u30B3\u30F3\u30C6\u30F3\u30C4"},command:{insertAbove:"\u4E0A\u306B\u633F\u5165",insertAfter:"\u4E0B\u306B\u633F\u5165",copy:"\u8907\u88FD",cut:"\u5207\u308B",delete:"\u524A\u9664"},button:{searchPlaceholder:"\u30AD\u30FC\u30EF\u30FC\u30C9\u3067\u691C\u7D22",tips:`\u30DE\u30A6\u30B9\u306E\u30DC\u30BF\u30F3\u3092\u62BC\u3057\u306A\u304C\u3089\u30C9\u30E9\u30C3\u30B0\u3059\u308B
667
667
  \u30AF\u30EA\u30C3\u30AF\u3057\u3066\u30E1\u30CB\u30E5\u30FC\u3092\u8868\u793A\u3059\u308B`,insertTips:"\u30AF\u30EA\u30C3\u30AF\u3057\u3066\u30D6\u30ED\u30C3\u30AF\u3092\u8FFD\u52A0"}}};_.mergeLang({"zh-CN":Vj,"en-US":$j,"ja-JP":Hj});const Tat="";class jj{constructor(){m(this,"dragObject",null)}setData(t){this.dragObject=t}getData(){return this.dragObject}clearData(){this.dragObject=null}destroy(){}}function Ag(n){return n.addCustom("drag-data",()=>new jj)}function MA(n,t){if(!t)return null;const e=Ag(n).getData();return!e||e.editorId!==n.id?null:e}function fw(n,t){const e=MA(n,t);return e?n.findBlockById(e.blockId):null}function zj(n,t,e){if(!t.dataTransfer)return;const i=at(e),s=pt(i),o=ut(e),l={type:"block",editorId:n.id,containerId:s,blockId:o};Ag(n).setData(l)}function Gj(n,t,e,r,i){if(!t.dataTransfer)return;const o=at(e),l=pt(o),c=ut(e),d={type:"custom",customType:r,editorId:n.id,containerId:l,blockId:c,data:i};Ag(n).setData(d)}function Gd(n){Ag(n).clearData()}const Wj=D("drop-indicator"),Wd=2;class qj{constructor(t){m(this,"indicator");m(this,"target",null);this.editor=t,this.indicator=B("div",["editor-drop-indicator"],this.editor.contentElement)}show(t,e){const r=this.getIndicatorRect(t,e),i=this.editor.rootElement.getBoundingClientRect(),s=r.top-i.top,o=r.left-i.left;this.indicator.style.top=`${s}px`,this.indicator.style.left=`${o}px`,this.indicator.style.width=`${r.width}px`,this.indicator.style.height=`${r.height}px`,this.indicator.style.display="",this.target={block:t,insertPos:e}}hide(){this.indicator.style.display="none",this.target=null}getIndicatorRect(t,e){if(typeof e!="string")return e.rect;if(e==="before"){const l=jr(t);if(!l){p(Wj,gi(at(t)),"block does not in a child container");const C=t.getBoundingClientRect(),E=this.getViewRect(t);return new DOMRect(E.x,C.y,E.width,Wd)}const c=l.getBoundingClientRect(),d=t.getBoundingClientRect(),h=this.getViewRect(t);return new DOMRect(h.x,(c.bottom+d.top)/2,h.width,Wd)}const r=zr(t);if(!r){const l=t.getBoundingClientRect(),c=this.getViewRect(t);return new DOMRect(c.x,l.bottom,c.width,Wd)}const i=t.getBoundingClientRect(),s=r.getBoundingClientRect(),o=this.getViewRect(t);return new DOMRect(o.x,(i.bottom+s.top)/2,o.width,Wd)}getViewRect(t){const e=mn(t,{horizontal:!0}),r=t.getBoundingClientRect(),i=e.getBoundingClientRect(),s=Math.max(i.x-r.x,0),o=Math.max(r.right-i.right,0);return new DOMRect(r.x+s,r.y,Math.max(r.width-s-o,0),Wd)}}const Xj=D("find-drop-target");function Yj(n,t){const e=Pe(n,t);if(!e)return null;if(Yo(e)&&gi(e))return e;const r=e.firstElementChild;return r&&Yo(r)&&gi(r)?r:null}function Qj(n,t,e){const c=e,d=t;for(let h=0;h<2;h++){const C=d+h*50;for(let E=0;E<5;E++){const A=c+E*8,v=Pe(C,A);if(v){const U=et(v);if(U){if(!Pt(n,U))return U;const M=U.getBoundingClientRect();if(e-M.top<40||M.bottom-e<40)return U}}if(E===0)continue;const w=c-E*8,S=Pe(C,w);if(S){const U=et(S);if(U){if(!Pt(n,U))return U;const M=U.getBoundingClientRect();if(e-M.top<40||M.bottom-e<40)return U}}}}return null}function Jj(n,t,e){const r=Pe(t,e);if(r){const h=et(r);if(h&&!Pt(n,h))return h}const i=new Set,s=Yj(t,e);if(s){const h=s.getBoundingClientRect();e<h.top+h.height/2?i.add(_e(s)):i.add(Ge(s))}const o=Qj(n,t,e);o&&i.add(o);const l=Array.from(i),c=h=>{for(let C=0;C<l.length;C++){const E=l[C];if(h!==E&&Ce(h,E))return!0}return!1},d=l.filter(h=>!c(h));return d.length>0?d[0]:null}function UA(n,t){if(n.readonly)return!1;const e=at(t);if(re(e))return!0;const r=et(e);return p(Xj,r,"no parent block"),n.isBlockWritable(r)?UA(n,r):!1}const Zj=D("drop-target");function tz(n,t){let e={};return/image/.test(t.type)?e=n.editorEmbeds.getEmbedClass("image"):/audio/.test(t.type)?e=n.editorEmbeds.getEmbedClass("audio"):/video/.test(t.type)&&(e=n.editorEmbeds.getEmbedClass("video")),p(Zj,e,`unSupport file type ${t.type}`),e}async function dw(n,t,e,r){var s,o;let i=r;for(const l of t){const c=tz(n,l);c.getOptions&&await((o=(s=c.getOptions(n)).handleInsertEmptyEmbed)==null?void 0:o.call(s,n,{containerId:e,blockIndex:i,data:{file:l}}))&&(i+=1)}}class ez{constructor(t){m(this,"handleDrop",(t,e,r,i)=>{if(Array.isArray(e)){const s=e;if(s.length>0){const o=pt(r);return dw(t,s,o,i),!0}}return!1});this.editor=t}}class qd{constructor(t){m(this,"indicator");m(this,"lastDropOverResult");m(this,"handlers",[]);m(this,"handleDragOver",t=>{if(!this.editor.isWritable())return;const e=s=>{var d,h,C,E;const o=MA(this.editor,s.dataTransfer),l=fw(this.editor,s.dataTransfer);if(((d=s.dataTransfer)==null?void 0:d.types.length)&&!((h=s.dataTransfer)!=null&&h.types.includes("Files")))return"none";const c=this.findTargetBlock(l,s.x,s.y);if(c&&Ce(this.editor.rootContainer,c)){const A=this.findInsertPos(l,c,s.x,s.y,(E=o!=null?o:(C=s.dataTransfer)==null?void 0:C.items)!=null?E:null);if(A)return this.indicator.show(c,A),"move"}return this.indicator.hide(),"none"},r=(s,o)=>{s.dataTransfer&&(s.dataTransfer.dropEffect=o),o==="move"&&s.preventDefault()};if(this.lastDropOverResult&&t.x===this.lastDropOverResult.x&&t.y===this.lastDropOverResult.y){const s=this.lastDropOverResult.dropEffect;r(t,s);return}const i=e(t);r(t,i),this.lastDropOverResult={x:t.x,y:t.y,dropEffect:i}});m(this,"handleDrop",t=>{var s,o;t.stopPropagation(),setTimeout(()=>{this.indicator.hide()});const e=MA(this.editor,t.dataTransfer),r=Array.from((o=(s=t.dataTransfer)==null?void 0:s.files)!=null?o:[]);if(!e&&r.length===0){t.dataTransfer&&(t.dataTransfer.dropEffect="none"),Gd(this.editor);return}const i=this.indicator.target;if(i){const{block:l,insertPos:c}=i,d=fw(this.editor,t.dataTransfer);this.editor.undoManager.runInGroup(()=>{const h=le(this.editor,l);if(h.handleDrop&&h.handleDrop(this.editor,l,e!=null?e:r,c,{isSourceBlock:!1,targetBlock:l})){t.preventDefault(),this.editor.focus(),Gd(this.editor);return}if(d){const C=le(this.editor,d);if(C.handleDrop&&C.handleDrop(this.editor,d,e!=null?e:r,c,{isSourceBlock:!0,targetBlock:l})){t.preventDefault(),this.editor.focus(),Gd(this.editor);return}}if(typeof c=="string"){const C=at(l);let E=Rt(l);if(c==="after"){E+=1;let A=ae(l);for(;A&&!Jo(A);)E+=1,A=ae(A)}t.preventDefault();for(let A=0;A<this.handlers.length;A++)if(this.handlers[A].handleDrop(this.editor,d!=null?d:r,C,E)){this.editor.focus(),Gd(this.editor);return}if(d){const A=this.editor.getBlockData(d),v=sl(this.editor.editorBlocks,this.editor.doc.toJSON(),A),[w]=this.editor.insertDocAt(C,E,v);this.editor.selection.selectBlock(w,0),zd.get(this.editor).highlightBlock(w),this.editor.deleteBlock(d),this.editor.focus()}}})}Gd(this.editor)});m(this,"handleDragLeave",()=>{this.indicator.hide()});this.editor=t,this.indicator=new qj(this.editor),this.handlers.push(new ez(this.editor)),this.editor.contentElement.addEventListener("dragover",this.handleDragOver),this.editor.contentElement.addEventListener("dragleave",this.handleDragLeave),this.editor.contentElement.addEventListener("drop",this.handleDrop)}destroy(){this.editor.contentElement.removeEventListener("dragover",this.handleDragOver),this.editor.contentElement.removeEventListener("dragleave",this.handleDragLeave),this.editor.contentElement.removeEventListener("drop",this.handleDrop),this.handlers=[]}addHandler(t){this.handlers.push(t)}static register(t){return t.addCustom("drop-target",()=>new qd(t))}static get(t){return t.getCustom("drop-target")}static find(t){return t.findCustom("drop-target")}canInsertAfter(t,e){return!(this.editor.readonly||zr(e)===t&&t||!UA(this.editor,e))}canInsertBefore(t,e){return!(this.editor.readonly||jr(e)===t&&t||!UA(this.editor,e)||re(at(e))&&Rt(e)===0)}canDrop(t,e){return t===null||t===e?!0:!Ce(t,e)}findTargetBlock(t,e,r){let i=Jj(this.editor,e,r);if(!i||!Ce(this.editor.rootContainer,i))return null;const s=at(i),o=et(s);return o&&Ot(o)==="code"&&(i=o),this.canDrop(t,i)?i:null}findInsertPos(t,e,r,i,s){let o=e;for(;o;){const c=le(this.editor,o);if(c.handleDropOver){const d=c.handleDropOver(this.editor,o,s,r,i);if(d)return d;if(d===!1)return null}o=ca(o)}if(t===e)return"";const l=e.getBoundingClientRect();if(l.top<=i&&i<=l.bottom){if(i<l.top+l.height/2){if(this.canInsertBefore(t,e))return"before";if(this.canInsertAfter(t,e))return"after"}else{if(this.canInsertAfter(t,e))return"after";if(this.canInsertBefore(t,e))return"before"}return""}return i<l.top&&this.canInsertBefore(t,e)?"before":l.bottom<i&&this.canInsertAfter(t,e)?"after":""}}function hw(n,t,e){const r=qe.getImageObject(n,t),i=Et.default(r.getImages());if(i.length===1){n.deleteBlock(t);return}if(e===-1||e>=i.length)return;const s=VH(i);if(i.splice(e,1),i.length===1){const l=i[0],c=100*(l.flex/s);l.flex=1;const d=jn([l],c);n.updateEmbedData(t,d);return}i[0].flex=NaN,Bu(i);const o=jn(i,r.getWidthPercent());n.updateEmbedData(t,o)}function nz(n,t,e,r){if(t.length===0||r==="after"||r==="before")return!1;let i=r.data;const s=qe.getImageObject(n,e),o=Et.default(s.getImages()),l=[],c=[];t.forEach(C=>{ZR(C.type)&&o.length+l.length<6?l.push(C):c.push(C)}),l.forEach(C=>{try{JR(n,C)}catch{return}const E={src:"",flex:1,width:0,height:0,virtualSize:!0};o.splice(i,0,E);const A=jn(o,s.getWidthPercent());n.updateEmbedData(e,A),s.replaceImage(i,C),i+=1});const d=n.getBlockIndex(e)+1,h=pt(at(e));return dw(n,c,h,d),!0}function rz(n,t,e,r,i){var o,l,c;if(Em(e))return nz(n,e,t,r);if(e.type!=="custom"||e.customType!=="image"||!e.data)return;const s=e.data;if(i.isSourceBlock){const d=i.targetBlock,h=at(d);let C=Rt(d);r==="after"&&(C+=1);const A=100*(s.boundingRect.width/n.rootContainer.getBoundingClientRect().width),v=jn([s.image],A),w={id:it(),type:"embed",embedType:"image",embedData:v},S=(l=(o=n.options.componentsOptions)==null?void 0:o.image)==null?void 0:l.defaultAlign;S&&(w.align=S),n.insertBlock(pt(h),C,w),hw(n,t,s.index),(c=n.findCustom("drag-handler"))==null||c.handleDragEnd()}else{if(typeof r=="string")return;const d=t;let h=r.data;const C=qe.getImageObject(n,d),E=Et.default(C.getImages());h>E.length&&(h=E.length),n.undoManager.runInGroup(()=>{var v,w;C.setAutoFix(!0);const A=n.getBlockById(e.blockId);if(A===d){const S=s.index,U=h,M=s.image;if(S===U||U===S+1)return;let V=U;S<U?(E.splice(U,0,M),E.splice(S,1),V-=1):(E.splice(S,1),E.splice(U,0,M));const nt=jn(E,C.getWidthPercent());n.updateEmbedData(d,nt),C.setSelectedIndex(V),(v=n.findCustom("drag-handler"))==null||v.handleDragEnd()}else{E.splice(h,0,s.image),E[0].flex=NaN,Bu(E);const S=jn(E,C.getWidthPercent());n.updateEmbedData(d,S),hw(n,A,s.index),(w=n.findCustom("drag-handler"))==null||w.handleDragEnd(),C.setSelectedIndex(h),n.selection.selectBlock(d,0)}})}return!0}const iz=2;function xg(n,t,e){const r=ds(t);if(e<=0){const o=r[0].getBoundingClientRect();return new DOMRect(o.left-4,o.top,2,o.height)}if(e===r.length){const o=r[e-1].getBoundingClientRect();return new DOMRect(o.right+2,o.top,2,o.height)}const i=r[e-1].getBoundingClientRect(),s=r[e].getBoundingClientRect();return new DOMRect((s.left+i.right)/2-1,i.top,iz,i.height)}function sz(n,t,e,r,i){for(let s=0;s<e.length;s++){const l=e[s].getBoundingClientRect();if(r<=l.right)return r<=l.left+l.width/2?{rect:xg(n,t,s),data:s}:{rect:xg(n,t,s+1),data:s+1}}return r>e[e.length-1].getBoundingClientRect().right?{rect:xg(n,t,e.length),data:e.length}:{rect:xg(n,t,e.length),data:0}}function oz(n,t,e,r,i){const s=ds(t);if(e instanceof DataTransferItemList){if(!Array.from(e).some(o=>ZR(o.type))||s.length>=6)return}else{if((e==null?void 0:e.type)==="block"||s.length>=6&&(e==null?void 0:e.blockId)!==ut(t))return;const o=ut(t);if(s.length===1&&o===(e==null?void 0:e.blockId))return}return sz(n,t,s,r)}async function lz(n){return await wb.default.toSvg(n)}function OA(n,t){return new DragEvent(t,{bubbles:!0,cancelable:!0,view:window,screenX:n.screenX,screenY:n.screenY,dataTransfer:new DataTransfer,clientX:n.clientX,clientY:n.clientY})}class az{constructor(t){m(this,"img");m(this,"dragContainer",null);m(this,"autoScroll",null);m(this,"imageContainer",null);m(this,"startPosition",null);m(this,"handleMouseDown",t=>{const e=t.target;if(!e||!(e instanceof HTMLImageElement)||t.button!==0)return;const r=et(e);if(!r||!_i(r)||!this.editor.isBlockWritable(r)||this.editor.readonly)return;const i=qe.getImageObject(this.editor,r);if(this.imageContainer=yA(t.target),!this.imageContainer)return;const o=WR(t.target).indexOf(this.imageContainer);if(o===-1)return;const l=i.getImages()[o];if(!l)return;const{x:c,y:d}=t;this.startPosition={x:c,y:d};const h={image:l,index:o,boundingRect:this.imageContainer.getBoundingClientRect()},C=OA(t,"dragstart");Gj(this.editor,C,r,"image",h),document.addEventListener("mouseup",this.handleDragEnd),this.editor.contentElement.addEventListener("mousemove",this.handleDrag),t.preventDefault()});m(this,"handleDragStart",async t=>{if(!this.imageContainer)return;const e=et(this.imageContainer);if(!e)return;const{x:r,y:i}=t,{width:s,height:o}=t.target.getBoundingClientRect(),l=be(e),c=B("div",["drag-container"],l);c.style.left=`${r-s/4}px`,c.style.top=`${i-o/4}px`,c.style.width=`${Math.max(s/2,16)}px`,c.style.height=`${o/2}px`,this.dragContainer=c,q(this.editor.contentElement,"dragging");const d=mn(e);this.autoScroll=new xm({scrollElement:d,trackMouseEvent:"mousemove",edge:{top:50,bottom:50}}),this.autoScroll.active();const h=B("img",["drag-target"],c),E=await lz(this.imageContainer);E&&(h.src=E)});m(this,"handleDrag",t=>{var s;const{x:e,y:r}=t;if(((s=this.startPosition)==null?void 0:s.x)===e&&this.startPosition.y===r)return;if(window.isDragging||(window.isDragging=!0,this.handleDragStart(t)),this.startPosition&&this.dragContainer){const{x:o,y:l}=t;if(o===0&&l===0){this.dragContainer.style.transform="",this.dragContainer.style.opacity="0";return}const{x:c,y:d}=this.startPosition,h=o-c,C=l-d;this.dragContainer.style.transform=`translate(${h}px, ${C}px)`,this.dragContainer.style.opacity="0.5"}const i=OA(t,"dragover");this.editor.contentElement.dispatchEvent(i)});m(this,"handleDragEnd",t=>{var e;if(window.isDragging=!1,this.dragContainer&&this.dragContainer.remove(),this.dragContainer=null,this.startPosition=null,this.imageContainer=null,(e=this.autoScroll)==null||e.inactive(),ct(this.editor.contentElement,"dragging"),document.removeEventListener("mouseup",this.handleDragEnd),this.editor.contentElement.removeEventListener("mousemove",this.handleDrag),t){const r=OA(t,"drop");this.editor.contentElement.dispatchEvent(r)}});this.editor=t,this.editor.rootContainer.addEventListener("mousedown",this.handleMouseDown),this.img=new Image,this.img.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"}destroy(){this.editor.rootContainer.removeEventListener("mousedown",this.handleMouseDown)}}class cz{constructor(t){m(this,"handleFocusBlockChanged",(t,e,r)=>{const s=this.editor.getFocusedBlock();if(s&&_i(s)){const o=qe.getImageObject(this.editor,s);o.getImages().length>0&&o.getSelectedIndex()===-1&&o.setSelectedIndex(0)}r&&_i(r)&&t.findCustom(`image-${r.id}`)&&qe.getImageObject(this.editor,r).blockResizer.disableResize()});this.editor=t,this.editor.addListener("focusBlockChanged",this.handleFocusBlockChanged)}destroy(){this.editor.removeListener("focusBlockChanged",this.handleFocusBlockChanged)}}class uz{constructor(t){m(this,"currentResizer",null);m(this,"handleHoveringBlockChange",(t,e)=>{window.isDragging||(e&&this.disable(e),t&&(this.currentResizer=t,this.enable(t)))});this.editor=t,$e.get(t).addListener("change",this.handleHoveringBlockChange)}destroy(){$e.get(this.editor).removeListener("change",this.handleHoveringBlockChange)}disable(t){_i(t)&&qe.getImageObject(this.editor,t).disableResizer()}enable(t){if(_i(t)){const e=qe.getImageObject(this.editor,t);this.editor.isBlockWritable(t)&&e.tryEnableResizer()}}}const fz={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"}},dz={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"}},hz={image:{title:"\u753B\u50CF",upload:{failed:'<div class="line-1">\u753B\u50CF\u3092\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F</div><div class="line-2">\u304A\u4F7F\u3044\u306E\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF\u63A5\u7D9A\u306B\u554F\u984C\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002\u6B21\u306E\u64CD\u4F5C\u3092\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002 <a href="" class="retry-upload">\u518D\u8A66\u884C</a></div>'},load:{failed:'<div class="line-1">\u753B\u50CF\u3092\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093\u3067\u3057\u305F</div><div class="line-2">\u304A\u4F7F\u3044\u306E\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF\u63A5\u7D9A\u306B\u554F\u984C\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002\u6B21\u306E\u64CD\u4F5C\u3092\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002 <a href="" class="retry-upload">\u518D\u8A66\u884C</a></div>',remote:{failed:'<div class="line-1">\u753B\u50CF\u3092\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093\u3067\u3057\u305F</div><div class="line-2">\u3053\u306E\u753B\u50CF\u306B\u30EA\u30F3\u30AF\u3057\u3066\u3044\u308B URL \u304C\u7121\u52B9\u306B\u306A\u3063\u3066\u3044\u307E\u3059\u306E\u3067\u3001\u8868\u793A\u3067\u304D\u307E\u305B\u3093</div><div class="line-3">\u753B\u50CF\u3092\u30ED\u30FC\u30AB\u30EB\u306B\u4FDD\u5B58\u3057\u3066\u30A2\u30C3\u30D7\u30ED\u30FC\u30C0\u3057\u3066\u304F\u3060\u3055\u3044 <a href="" class="retry-upload">\u753B\u50CF\u30EA\u30F3\u30AF\u3092\u958B\u304F</a></div>',tooltip:"\u3053\u306E\u753B\u50CF\u306F\u5916\u90E8\u306B\u30EA\u30F3\u30AF\u3057\u3066\u3044\u308B\u305F\u3081\u3001\u30EA\u30F3\u30AF\u304C\u7121\u52B9\u306B\u306A\u308B\u3068\u3001\u8868\u793A\u3067\u304D\u306A\u304F\u306A\u308A\u307E\u3059\u306E\u3067\u3001\u30ED\u30FC\u30AB\u30EB\u306B\u4FDD\u5B58\u3057\u3001\u30DA\u30FC\u30B8\u306B\u633F\u5165\u3059\u308B\u3053\u3068\u3092\u304A\u52E7\u3081\u3057\u307E\u3059"}},abstract:"\u753B\u50CF"}};_.mergeLang({"zh-CN":fz,"en-US":dz,"ja-JP":hz});function mz(n,t,e,r){const i=n.getBlockByIndex(t,e),s=n.getBlockText(i),{left:o}=sr(s,r),l=Re(o);let c=r;if(l.endsWith("![]()"))c-=5;else if(l.endsWith("![]"))c-=3;else return!1;const d=r;return Mc("image/*").then(h=>{!h||n.undoManager.runInGroup(()=>{n.deleteTextFromBlock(i,c,d-c);let C=e+1;Re(n.getBlockText(i)).trim()?(qc(n,i,c,{forceInsertAfter:!0}),c===0&&(n.deleteBlock(i),C--)):(n.deleteBlock(i),C--),f1(n,"image",t,C,{file:h})})}),!0}class gz{handleAfterInsertText(t,e,r,i,s){if(s===" "){if(dg(t,e))return!1;if(mz(t,e,r,i))return!0}return!1}}const pz=D("copy-image");function Cz(n,t,e,r){const i=e.getImages()[r],s=e.getImages().length===1?e.getWidthPercent():i.flex*100,o=jn([i],s),l={id:it(),type:"embed",embedType:"image",embedData:o},c=n.options.componentsOptions.image;c!=null&&c.defaultAlign&&(l.align=c.defaultAlign);const d={blocks:{root:[l]},comments:{},meta:{}},h=document.createElement("canvas");h.width=t.naturalWidth,h.height=t.naturalHeight;const C=h.getContext("2d");if(!C)return;const E={},A={};try{C.drawImage(t,0,0,h.width,h.height);const V=h.toDataURL("image/png").replace(/^data:image\/(png|jpg);base64,/,""),nt=$p(V),Y=new File([nt],`${Date.now()}.png`,{type:"image/png"});E["image/png"]=Y}catch(M){pz.error(M)}Qf(n,d);const w=`<img src="${n.doc.buildResourceUrl(i.src,{withToken:!0})}" />`,S=Yf(w,d),U=new Blob([S],{type:"text/html"});return E["text/html"]=U,A["text/html"]=S,[E,A]}function Ez(n,t,e,r,i){const s=Cz(n,t,e,r);if(!s)return;const[o,l]=s;if(o){const c=Object.entries(o).map(([d,h])=>({type:d,data:h}));return yf(c).then(d=>{if(!d&&i){const h=i.clipboardData;h&&(h.setData("text/plain",l["text/plain"]),h.setData("text/html",l["text/html"]))}}),!0}}function bg(n,t){const e=n.selection.range;if(e.start.blockId!==e.end.blockId)return;const i=n.getFocusedBlock();if(i&&_i(i)){const s=qe.getImageObject(n,i);if(s.getImages().length>0){const l=s.getSelectedIndex();if(l!==-1){const d=ds(i)[l].querySelector("img");if(d)return Ez(n,d,s,l,t)}}}}function Az(n){const t=n.getFocusedBlock(),e=zr(t);if(e&&_i(e)){n.selection.selectBlock(e,0);const r=qe.getImageObject(n,e);return r.getImages().length>0&&r.setSelectedIndex(0),!0}}function xz(n){const t=n.getFocusedBlock(),e=jr(t);if(e&&_i(e)){n.selection.selectBlock(e,0);const r=qe.getImageObject(n,e);return r.getImages().length>0&&r.setSelectedIndex(0),!0}}function bz(n){const e=n.getFocusedBlock();if(e&&_i(e)){const r=qe.getImageObject(n,e),i=r.getImages();if(i.length>0){const s=r.getSelectedIndex();if(s===-1)return r.setSelectedIndex(i.length-1),!0;if(s>0)return r.setSelectedIndex(s-1),!0}}}function vz(n){const e=n.getFocusedBlock();if(e&&_i(e)){const r=qe.getImageObject(n,e),i=r.getImages();if(i.length>0){const s=r.getSelectedIndex();if(s===-1)return r.setSelectedIndex(0),!0;if(s<i.length-1)return r.setSelectedIndex(s+1),!0}}}function vg(n){const e=n.getFocusedBlock();if(e&&_i(e)){const r=qe.getImageObject(n,e);if(r.getImages().length>0){const s=r.getSelectedIndex();if(s!==-1)return r.removeImage(s),!0}}}const Bz={ArrowLeft:bz,ArrowRight:vz,ArrowUp:xz,ArrowDown:Az,Delete:vg,Backspace:vg};class yz{constructor(t){this.editor=t,setTimeout(()=>{this.editor.input.addHandler(this)})}handleBeforeCopy(t,e,r){if(!window.isSecureContext)return;if(bg(t,e))return!0}handleBeforeCut(t,e){if(bg(t,e))return vg(t),!0}destroy(){}}class NA{constructor(t){this.editor=t,setTimeout(()=>{this.editor.input.addHandler(this)})}async handleAfterPasteDoc(t,e,r){return Object.values(e.blocks).forEach(i=>{i.forEach(s=>{if(s.type==="embed"&&s.embedType==="image"){const o=s.embedData;if(Array.isArray(o.src))return;let l=r.blockIdMap.get(s.id);for(;l&&r.blockIdMap.get(l);)l=r.blockIdMap.get(l);l&&Bl(t,l).setAutoFix(!0)}})}),!1}destroy(){}}const Tz=D("image-embed");function kz(n,t,e,r,i,s){qe.create(n,e).createContent(i,s,t),n.addCustom("image-select-handler",()=>new cz(n)),n.addCustom("image-copy-handler",()=>new yz(n)),setTimeout(()=>{n.addCustom("drag-handler",()=>new az(n));const l=n.addCustom("image-resizer",()=>new uz(n)),c=e.embedData;vu(c)?l.disable(s):l.currentResizer===s&&l.enable(s)})}function Rz(n,t,e,r){const i=t.embedData,s=yu(i);return r==="html"?s.map(o=>`<img src="${n.doc.buildResourceUrl(o.src,{withToken:!0})}">`).join(""):r==="markdown"?`${s.map(l=>`![img](${n.doc.buildResourceUrl(l.src,{withToken:!0})})`).join(`
@@ -960,4 +960,4 @@ ${s.mermaidText}
960
960
  ${s.flowchartText}
961
961
  \`\`\`\`\`\``}return""}const KJ={embedType:"flowchart",convertFrom:NJ,handleUpdateBlock:OJ,createEmbedContent:UJ,getBlockProperties:PJ,convertTo:FJ},VJ=D("plantuml-helper");function MS(n,t){var l;let r=((l=(n.getComponentOptions("plantuml")||{}).cdn)==null?void 0:l.plantuml)||EJ;r.endsWith("/")||(r+="/");const i=h9.default.encode(t);p(VJ,i,i),r+=i;const o=new URLSearchParams(document.location.search).get("doc");return Vp(r,{id:`${o}-${it()}`})}async function $J(n,t){try{const e=await bx(n,t);return(await n.doc.uploadResource(e)).resourceId}catch{return Promise.resolve(t)}}class Uu extends Tx{constructor(t){super(t,"plantuml","plantumlText")}static get(t,e){return t.addCustom(`plantuml-${e.id}`,()=>new Uu(t))}code2ObjectUrl(t){return Promise.resolve(MS(this.editor,t))}code2ResourceId(t){const e=MS(this.editor,t);return $J(this.editor,e)}destroy(){}}function HJ(n,t,e){Uu.get(n,e).createEmbedContent(t,e)}function jJ(n,t,e){const r=Uu.get(n,e),i=zt(t);return r.updateEmbedContent(i,e),!0}function zJ(n,t,e){const{data:r}=e,i=n.getBlockString(t).trim();if(!r||r.embedType!=="plantuml"||i!=="```plantuml"||!ot(n,t))return null;const s={src:"",plantumlText:""};return{blockData:{id:it(),type:"embed",embedType:"plantuml",embedData:s},onConverted:(c,d)=>{Uu.get(c,c.getBlockData(d)).editGraph(zt(d))}}}function GJ(n,t){return Uu.get(n,n.getBlockData(t)).getBlockProperties(t)}function WJ(n,t,e,r){const{embedData:i}=t,s=i;if(r==="html")return s.src?`<img src="${n.doc.buildResourceUrl(s.src,{withToken:!0})}" />`:s.flowchartText?`<div>${s.flowchartText}</div>`:"<p>[plantuml]</p>";if(r==="markdown"){if(s.src)return`![plantuml](${n.doc.buildResourceUrl(s.src,{withToken:!0})})`;if(s.flowchartText)return`\`\`\`plantuml\`\`\`
962
962
  ${s.flowchartText}
963
- \`\`\`\`\`\``}return""}const qJ={embedType:"plantuml",convertFrom:zJ,handleUpdateBlock:jJ,createEmbedContent:HJ,getBlockProperties:GJ,convertTo:WJ},tct="",XJ="hr",YJ={dividingLine:{type:"\u5206\u5272\u7EBF",abstract:"\u5206\u5272\u7EBF"}},QJ={dividingLine:{type:"Dividing-Line",abstract:"Dividing-Line"}},JJ={dividingLine:{type:"\u533A\u5207\u308A\u7DDA",abstract:"\u533A\u5207\u308A\u7DDA"}};_.mergeLang({"zh-CN":YJ,"en-US":QJ,"ja-JP":JJ});function ZJ(n,t){const e=B("div",["editor-embed-container"],t);B("hr",["editor-embed-hr"],e)}function tZ(n,t,e,r){return r==="html"?"<hr />":r==="markdown"?"---":"------------"}function eZ(){return{name:"hr",insertEmbedCommandItems:[{id:"insert-hr",name:_.t("dividingLine.type"),icon:jT,order:500,group:"common",subText:Qn("insert-hr")}],handleInsertEmptyEmbed:async(n,t)=>{const{containerId:e,blockIndex:r}=t;return n.insertEmbed(e,r,XJ,{})}}}function nZ(n,t,e){const{data:r}=e;if(!r||r.embedType!=="dividing-line"||!ot(n,t))return null;const i={};return{blockData:{id:it(),type:"embed",embedType:"hr",embedData:i}}}function rZ(){return{abstract:_.t("dividingLine.abstract")}}const iZ={embedType:"hr",createEmbedContent:ZJ,convertTo:tZ,getOptions:eZ,convertFrom:nZ,getBlockProperties:rZ},ect="",nct="",sZ={media:{upload:{failed:'<div class="line-1">{name}\u4E0A\u4F20\u5931\u8D25</div><div class="line-2">\u7F51\u7EDC\u670D\u52A1\u5F02\u5E38\uFF0C\u4F60\u53EF\u4EE5 <span class="retry-upload">\u91CD\u8BD5</span></div>',maxSizeFailed:'<div class="line-1">{name}\u4E0A\u4F20\u5931\u8D25</div><div class="line-2">\u6587\u4EF6\u5927\u5C0F\u8D85\u8FC7\u9650\u5236\uFF0C\u8BF7\u91CD\u65B0\u9009\u62E9\u6587\u4EF6</div>'},load:{failed:'<div class="line-1">{name}\u52A0\u8F7D\u5931\u8D25</div><div class="line-2">\u7F51\u7EDC\u670D\u52A1\u5F02\u5E38\uFF0C\u4F60\u53EF\u4EE5 <span class="retry-upload">\u91CD\u8BD5</span></div>'},audio:{menuItem:"\u97F3\u9891",abstract:"\u97F3\u9891"},video:{menuItem:"\u89C6\u9891",abstract:"\u89C6\u9891"}}},oZ={media:{upload:{failed:'<div class="line-1">{name} upload failed</div><div class="line-2">Network error, you can <span class="retry-upload">Retry</span></div>',maxSizeFailed:'<div class="line-1">{name} upload failed</div><div class="line-2">The file size exceeds limit. Please choose another file.</div>'},load:{failed:'<div class="line-1">{name} loading failed</div><div class="line-2">Network error, you can <span class="retry-upload">Retry</span></div>'},audio:{menuItem:"Audio",abstract:"Audio"},video:{menuItem:"Video",abstract:"Video"}}},lZ={media:{upload:{failed:'<div class="line-1">{name}\u306E\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u306B\u5931\u6557\u3057\u307E\u3057\u305F</div><div class="line-2">\u304A\u4F7F\u3044\u306E\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF\u63A5\u7D9A\u306B\u554F\u984C\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002\u6B21\u306E\u64CD\u4F5C\u3092\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002 <span class="retry-upload">\u518D\u8A66\u884C</span></div>',maxSizeFailed:'<div class="line-1">{name}\u306E\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u306B\u5931\u6557\u3057\u307E\u3057\u305F</div><div class="line-2">\u30D5\u30A1\u30A4\u30EB\u306E\u30B5\u30A4\u30BA\u304C\u4E0A\u9650\u3092\u8D85\u3048\u3066\u3044\u308B\u305F\u3081\u3001\u4ED6\u306E\u30D5\u30A1\u30A4\u30EB\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044</div>'},load:{failed:'<div class="line-1">{name}\u3092\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093\u3067\u3057\u305F</div><div class="line-2">\u304A\u4F7F\u3044\u306E\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF\u63A5\u7D9A\u306B\u554F\u984C\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002\u6B21\u306E\u64CD\u4F5C\u3092\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002 <span class="retry-upload">\u518D\u8A66\u884C</span></div>'},audio:{menuItem:"\u97F3\u58F0",abstract:"\u97F3\u58F0"},video:{menuItem:"\u52D5\u753B",abstract:"\u52D5\u753B"}}};_.mergeLang({"zh-CN":sZ,"en-US":oZ,"ja-JP":lZ});var Ui=(n=>(n.AUDIO="audio",n.VIDEO="video",n))(Ui||{}),lh=(n=>(n.Empty="empty",n.Progress="progress",n.Error="error",n))(lh||{});const US=10*1024*1024,aZ=["wav","mp3","aac","ogg","webm","flac"],cZ=["ogg","mp4","webm"],uZ=()=>{};function OS(n){var h,C,E,A,v,w;const t=(h=n.getComponentOptions("media"))!=null?h:{},{allowedMedias:e,maxSize:r,callbacks:i}=t,s=(C=e==null?void 0:e.audio)!=null?C:aZ,o=(E=e==null?void 0:e.video)!=null?E:cZ,l=(A=r==null?void 0:r.audio)!=null?A:US,c=(v=r==null?void 0:r.video)!=null?v:US,d=(w=i==null?void 0:i.onError)!=null?w:uZ;return{allowedMedias:{audio:s,video:o},maxSize:{audio:l,video:c},callbacks:{onError:d}}}function fZ(n,t){const e=s=>s.map(o=>`.${o}`).join(","),{allowedMedias:r}=OS(n),i=r[t];return i?e(i):"*"}function dZ(n,t,e){const{maxSize:r,callbacks:i,allowedMedias:s}=OS(t),{[e]:o}=r,{[e]:l}=s;if(o&&n.size>o){const d=new Error("media is too large");throw d.code=`MaxMediaSize-${e}`,i!=null&&i.onError&&(i==null||i.onError(t,d)),d}const c=Tf(n.name);if(l&&!l.includes(c.toLowerCase())){const d=new Error(`media file is not allowed: ${c}`);throw d.code="NotAllowedFile",i!=null&&i.onError&&(i==null||i.onError(t,d)),d}}function hZ(n){return n===lh.Empty||n===lh.Error}const En=D("media");class mZ extends Ve.TypedEmitter{constructor(e){super();m(this,"mediaContainer",null);m(this,"media",null);m(this,"abstract",null);m(this,"handleMediaLoadError",(e,r)=>{if(!r.target||!(r.target instanceof Node)||!(r.target instanceof Element?r.target:r.target.parentElement))return;const s=et(r.target);if(!s||!s.contains(this.mediaContainer))return;const o=this.renderError();this.updateMediaContent(o),this.emit("mediaError",e,"load_error",ut(s))});m(this,"handleUploadFile",async e=>{p(En,this.abstract,"no abstract"),p(En,this.mediaContainer,"The media element not exist");const{editor:r}=this.options,i=et(this.mediaContainer);p(En,i,"The block element not exist");const s=r.getBlockData(i);try{const{resourceId:o}=await r.doc.uploadResource(e,{onProgress:C=>{this.renderProgress(C,e)}}),{name:l,type:c,size:d}=e,h={...s,embedData:{...s.embedData,src:o,fileName:l,fileSize:d,fileType:c}};r.updateBlockData(i,h)}catch(o){En.error(o),this.emit("mediaError",r,"upload_error",s.id),this.renderRetry(e,o)}ct(i,"media-block-uploading")});m(this,"destroy",()=>{this.mediaContainer=null});this.options=e}bindMediaEvent(){const{editor:e}=this.options;this.media&&e.domEvents.addEventListener(this.media,"error",this.handleMediaLoadError)}unbindMediaEvent(){const{editor:e}=this.options;this.media&&e.domEvents.removeEventListener(this.media,"error",this.handleMediaLoadError)}updateMediaContent(e){p(En,this.mediaContainer,"The media element not exist"),this.mediaContainer.innerHTML="",this.mediaContainer.append(e)}renderError(){p(En,this.abstract,"no abstract");const{editor:e,createMediaElement:r}=this.options,{mediaIcon:i,mediaName:s}=this.abstract;p(En,this.mediaContainer,"The media element not exist");const o=et(this.mediaContainer);p(En,o,"The block element not exist");const l=e.getBlockData(o),c=B("div",["media-error","embed-selected-content","embed-hover-content"],null),d=B("span",["media-error-icon"],c);d.innerHTML=i;const h=B("div",[],c);h.innerHTML=_.t("media.load.failed",{name:s}),c.appendChild(h);const C=h.querySelector(".retry-upload");return p(En,C,"The element not exist"),e.domEvents.addEventListener(C,"click",(E,A)=>{const v=B("div",["media-element"],null),w=this.getResourceUrl(l),S=r(E,v,l,w);this.unbindMediaEvent(),this.media=S,this.bindMediaEvent(),this.updateMediaContent(v)}),this.setFullScreen(),c}renderRetry(e,r){var E,A;p(En,this.abstract,"no abstract");const{editor:i}=this.options,{mediaIcon:s,mediaName:o}=this.abstract,l=B("div",["media-error","embed-selected-content","embed-hover-content"],null),c=B("span",["media-error-icon"],l);c.innerHTML=s;const d=B("div",[],l);let h=_.t("media.upload.failed",{name:o});(((E=r.response)==null?void 0:E.status)===420||((A=r.response)==null?void 0:A.status)===413)&&(h=_.t("media.upload.maxSizeFailed",{name:o})),d.innerHTML=h,l.appendChild(d);const C=d.querySelector(".retry-upload");C&&i.domEvents.addEventListener(C,"click",()=>{i.readonly||(p(En,this.abstract,"no abstract"),this.handleUploadFile(e))}),this.updateMediaContent(l),this.setFullScreen()}renderProgress(e,r){p(En,this.mediaContainer,"The media element not exist");const i=this.mediaContainer.querySelector(":scope .media-progress"),s=e===-1||e===100?100:e;if(i){const{updateProgressElement:o}=this.options;o(i,s)}else{const{createProgressElement:o}=this.options,l=et(this.mediaContainer);p(En,l,"The element not exist"),q(l,"media-block-uploading");const c=B("div",["media-progress"],null);o(c,s,r),this.updateMediaContent(c)}this.setFullScreen()}renderMediaElement(e,r){p(En,this.mediaContainer,"The media element not exist");const i=this.mediaContainer.querySelector(":scope > .media-element"),{createMediaElement:s,updateMediaElement:o,editor:l}=this.options,c=this.getResourceUrl(e,r);if(i){const d=o(l,i,e,c);this.unbindMediaEvent(),this.media=d,this.bindMediaEvent()}else{const d=B("div",["media-element"],null),h=s(l,d,e,c);this.unbindMediaEvent(),this.media=h,this.bindMediaEvent(),this.updateMediaContent(d)}}renderEmpty(e){p(En,this.abstract,"no abstract"),p(En,this.mediaContainer,"The media element not exist");const r=B("div",["media-empty","embed-selected-content","embed-hover-content"],this.mediaContainer);r.innerHTML=this.abstract.mediaIcon,this.updateMediaContent(r);const{editor:i}=this.options;i.findBlockById(e.id)&&this.emit("mediaError",i,"empty",e.id),this.setFullScreen()}getResourceUrl(e,r){const{src:i}=e.embedData,{editor:s}=this.options;return s.doc.buildResourceUrl(i,{syncNewResources:async(o,l)=>{var d,h;if(!r)return;await s.doc.addResources([o]);const c=(h=(d=s.doc).getServerMeta)==null?void 0:h.call(d).appId;if(l!==e.embedData.src&&c&&e.embedData.src.includes(c)){const C=et(r);if(C&&!s.readonly&&s.isBlockWritable(C)){const E=Et.default(e);E.embedData.src=o,s.updateBlockData(C,E)}}}})}setFullScreen(){p(En,this.mediaContainer,"The media element not exist"),q(this.mediaContainer,"full-screen")}removeFullScreen(){p(En,this.mediaContainer,"The media element not exist"),ct(this.mediaContainer,"full-screen")}updateBlockAlign(e,r){const i=et(r);p(En,i,"The block element not exist");const{align:s}=e;e.embedType==="video"&&(i.hasAttribute("data-style-align")&&i.removeAttribute("data-style-align"),i.setAttribute("data-style-align",s))}render(e,r){const{src:i}=e.embedData;(!this.mediaContainer||!r.contains(this.mediaContainer))&&(this.mediaContainer=B("div",["media"],r)),this.updateBlockAlign(e,r),hZ(i)?i===lh.Empty&&this.renderEmpty(e):this.renderMediaElement(e,r)}setAbstract(e){this.abstract=e}}D("media-embed");const gZ="left";class NS{constructor(){m(this,"handleInsertEmptyEmbed",async(t,e)=>{var C;const{containerId:r,blockIndex:i}=e;let s;(C=e.data)!=null&&C.file&&(s=e.data.file);const o=fZ(t,this.embedType);if(s=s!=null?s:await Mc(o,{}),!s)return null;const{mediaType:l}=this.getAbstract();try{dZ(s,t,l)}catch{return null}const c={id:it(),type:"embed",embedType:this.embedType,embedData:{src:lh.Empty}};l==="video"&&(c.align=gZ);const d=t.insertBlock(r,i,c);return await this.getMedia(t,c.id).handleUploadFile(s),d})}getMedia(t,e){const r=t.addCustom(`media-${e}`,()=>new mZ({editor:t,createMediaElement:this.createMediaElement,updateMediaElement:this.updateMediaElement,createProgressElement:this.createProgressElement,updateProgressElement:this.updateProgressElement}));return r.setAbstract({...this.getAbstract()}),r}getOptions(){const{menuItem:t,mediaIcon:e,mediaName:r,order:i,group:s}=this.getAbstract();return{name:r,insertEmbedCommandItems:[{id:`insert-${this.embedType}`,name:t,icon:e,order:i,group:s,subText:Qn(`insert-${this.embedType}`)}],handleInsertEmptyEmbed:this.handleInsertEmptyEmbed}}createEmbedContent(t,e,r){const{id:i}=r;this.getMedia(t,i).render(r,e)}handleUpdateBlock(t,e,r){const{id:i}=r,s=this.getMedia(t,i),o=zt(e);return s.render(r,o),!0}handleDeleteBlock(t,e){const r=e.id,i=this.getMedia(t,r);i.removeAllListeners(),i.destroy()}convertTo(t,e,r,i){const s=e.embedData,o=t.doc.buildResourceUrl(s.src,{withToken:!0});return i==="html"?`<${s.type} src="${o}" />`:i==="markdown"?`![${s.src}](${o})`:o}}function PS(n,t){const e=B("div",["uploading-progress-mask"],n),r=B("div",["uploading-progress-bar"],e),i=B("div",["uploading-progress-bar-value"],r);i.style.width=`${t}%`}function FS(n,t){const e=n.querySelector(".uploading-progress-bar-value");e&&(e.style.width=`${t}%`)}const pZ=D("media-audio");class CZ extends NS{constructor(){super(...arguments);m(this,"embedType",Ui.AUDIO);m(this,"updateProgressElement",FS);m(this,"createMediaElement",(e,r,i,s)=>{const o=B("div",["audio-container","embed-hover-content","embed-selected-content"],r),l=B("audio",[],o);return l.innerHTML="Your browser does not support the <code>audio</code> element.",l.controls=!0,l.src=s,setTimeout(()=>{this.getMedia(e,i.id).setFullScreen()}),l})}getAbstract(){return{mediaIcon:VT,mediaName:_.t(`media.${Ui.AUDIO}.menuItem`),menuItem:_.t(`media.${Ui.AUDIO}.menuItem`),order:800,mediaType:Ui.AUDIO,group:"common"}}getBlockProperties(){return{abstract:`${_.t(`media.${Ui.AUDIO}.abstract`)}`}}updateMediaElement(e,r,i,s){const o=r.querySelector(":scope .audio-container > audio");return p(pZ,o,"The media element not exist"),o.src!==s&&(o.src=s),o}createProgressElement(e,r){const i=B("audio",[],e);i.innerHTML="Your browser does not support the <code>audio</code> element.",i.controls=!0,i.src="about:blank",PS(e,r)}}const EZ=new CZ;D("video-resizer");function KS(n){return n&&Le(n)&&on(n)==="video"}const AZ=50;class kx{constructor(t){m(this,"currentResizableElement",null);m(this,"resizing",!1);m(this,"handleHoveringBlockChange",(t,e)=>{if(!this.resizing&&!window.isDragging&&(e&&KS(e)&&this.disableBlockResize(e),t&&KS(t)&&this.editor.isBlockWritable(t))){const r=this.getVideoElement(t);if(!r)return;this.enableBlockResize(t,r)}});m(this,"handleResizing",(t,e)=>{if(this.resizing=!0,!this.currentResizableElement)return;const r=t.getBlock();if(!r)return;const i=r.getBoundingClientRect().width,s=Math.min(Math.max(e.width,AZ),i);this.currentResizableElement.style.width=`${s}px`,this.currentResizableElement.style.pointerEvents="none"});m(this,"handleResized",t=>{this.resizing=!1;const e=t.getBlock();if(!this.currentResizableElement||!e)return;const r=this.editor.getBlockData(e),{width:i}=this.currentResizableElement.getBoundingClientRect();this.currentResizableElement.style.pointerEvents="auto",this.editor.updateBlockData(e,{...r,width:i})});this.editor=t,$e.get(t).addListener("change",this.handleHoveringBlockChange)}destroy(){this.currentResizableElement=null,$e.get(this.editor).removeListener("change",this.handleHoveringBlockChange)}getVideoElement(t){return zt(t).querySelector(":scope .video-container > video")}updateResizer(t){const e=this.editor.findCustom(`${ut(t)}-resizer`);e&&e.updateResizer()}disableBlockResize(t){const e=this.editor.findCustom(`${ut(t)}-resizer`);e&&e.disableResize()}enableBlockResize(t,e){const r=this.editor.addCustom(`${ut(t)}-resizer`,()=>new Pd(this.editor,{resize:["top-left","top-right","bottom-left","bottom-right"]}));r.enableResize(t,e),r.removeListener("resizing",this.handleResizing),r.removeListener("resized",this.handleResized),r.addListener("resizing",this.handleResizing),r.addListener("resized",this.handleResized),this.currentResizableElement=e}}const xZ=D("video");class bZ extends NS{constructor(){super(...arguments);m(this,"embedType",Ui.VIDEO);m(this,"updateProgressElement",FS);m(this,"createMediaElement",(e,r,i,s)=>{const o=B("div",["video-container","embed-selected-content","drag-preview-element"],r),l=B("video",[],o);return l.innerHTML="Your browser does not support the <code>video</code> element.",l.controls=!0,l.src=s,l.addEventListener("canplay",()=>{e.addCustom("video-resizer",()=>new kx(e)),this.getMedia(e,i.id).removeListener("mediaError",this.handleMediaError),this.getMedia(e,i.id).addListener("mediaError",this.handleMediaError),this.getMedia(e,i.id).removeFullScreen()}),i.width&&(l.style.width=`${i.width}px`),l});m(this,"createProgressElement",(e,r,i)=>{const s=B("video",["progress-video"],e);s.innerHTML="Your browser does not support the <code>audio</code> element.",s.controls=!0,PS(e,r),_c(i).then(o=>{const l=e.querySelector(".progress-video");l&&l1(e)&&(l.src=o)})})}getAbstract(){return{mediaName:_.t(`media.${Ui.VIDEO}.menuItem`),mediaIcon:$T,menuItem:_.t(`media.${Ui.VIDEO}.menuItem`),order:700,mediaType:Ui.VIDEO,group:"common"}}getBlockProperties(){return{abstract:`${_.t(`media.${Ui.VIDEO}.abstract`)}`}}handleMediaError(e,r,i){const s=e.addCustom("video-resizer",()=>new kx(e)),o=e.getBlockById(i);s.disableBlockResize(o)}updateMediaElement(e,r,i,s){const o=r.querySelector(":scope .video-container > video");p(xZ,o,"The media element not exist"),o.src!==s&&(o.src=s),i.width?o.style.width=`${i.width}px`:o.style.width="";const l=e.getBlockById(i.id);return setTimeout(()=>{e.addCustom("video-resizer",()=>new kx(e)).updateResizer(l)}),o}}const vZ=new bZ,VS=[uA,EA,AA,Dk],Rx=[LS,vQ,IJ,KJ,qJ,NK,iZ,vZ,EZ,_z,lS,gX],$S=[jk,uS,_4];function BZ(n,t,e){var i,s,o,l;hi.level=(i=e.logLevel)!=null?i:qo.DEBUG;const r=Zf(n,t,{components:{blocks:[...VS,...((s=e==null?void 0:e.components)==null?void 0:s.blocks)||[]],embeds:[...Rx,...((o=e.components)==null?void 0:o.embeds)||[]],boxes:[...$S,...((l=e.components)==null?void 0:l.boxes)||[]],textRenders:[new WE],options:{...e.componentsOptions}}});return r.readonly=!0,r.addCustom("heading-collapse",()=>new fx(r)),r.addCustom("editor-tooltip",()=>new Ld(r)),r.addListener("clickLink",(c,d,h)=>{var E;if((E=e==null?void 0:e.events)!=null&&E.onClickLink){e.events.onClickLink(c,d,h);return}const C=h.getAttribute("link");C&&(c.readonly||d.ctrlKey||d.metaKey)&&window.open(C,"_blank")}),r}class HS{constructor(t){this.createOptions=t,t.lang&&_.setLang(t.lang)}createHistoryEditor(t,e){return BZ(t,e,this.createOptions)}}function jS(n,{root:t,childDoc:e,doc:r}){var h,C;e.uploadResource=r.uploadResource.bind(r),e.buildResourceUrl=r.buildResourceUrl.bind(r);const i=n.getComponentOptions("comment"),s={image:{defaultAlign:"left"},table:{locatingContainer:t,hideCellMenu:!0,hideToolbar:!0},...i==null?void 0:i.componentsOptions},o=[];n.editorBlocks.forEach(E=>{E.blockType==="text"||E.blockType==="embed"||o.push(E)});const l=[];n.editorEmbeds.forEach(E=>{l.push(E)});const c=[];n.editorBoxes.forEach(E=>{E.boxType==="text"||E.boxType==="br"||E.boxType==="image"||E.boxType==="anchor"||c.push(E)});const d=Zf(t,e,{shortcuts:[s0],components:{blocks:o,commandProviders:[new P0],decorators:[new fg],embeds:l,boxes:c,options:s}});if(d.input.addHandler(new hg),d.input.addHandler(new PA(d)),d.input.addHandler(new jA(d)),d.input.addHandler(new Tq(d)),d.input.addHandler(new Cg),d.addCustom("image-paste-handler",()=>new NA(d)),xe.isMobile||d.addCustom("editor-tooltip",()=>new Ld(d)),n.options.enableContextMenu!==!1&&d.addCustom("editor-context-menu",E=>new WA(E)),(h=n.options.componentsOptions)!=null&&h.mention){const E=n.options.componentsOptions.mention;d.addCustom("mention",()=>new cS(d,{...E}))}if((C=n.options.componentsOptions)!=null&&C.comment){const E=n.options.componentsOptions.comment;E.onCommentEditorClick&&d.addListener("click",E.onCommentEditorClick)}return d}function yZ(n,t){const e=Array.from(n.rootContainer.querySelectorAll(`[comment-${t.toLocaleLowerCase()}="${t}"]`)),r=new Set;e.forEach(i=>{const s=et(i);s&&r.add(s)}),r.forEach(i=>{kq(n,i,t)})}class TZ{constructor(t){m(this,"listeners",new Set);m(this,"doc");this.editor=t,this.doc=this.editor.doc.externalDoc,this.doc.registerCallback(this)}getComments(){return this.doc.getComments()}getComment(t){return this.doc.getComment(t)}getCommentDoc(t){return this.doc.getCommentDoc(t)}localCreateComment(t,e){this.doc.localCreateComment(t,e)}localDeleteComment(t){const e=this.getComment(t);this.doc.localDeleteComment(t);const r=e.groupId;this.getComments().filter(s=>s.groupId===r).length===0&&yZ(this.editor,r)}localUpdateComment(t,e){this.doc.localUpdateComment(t,e)}onCreateComment(t,e){Array.from(this.listeners.values()).forEach(r=>r.onCreateComment(t,e))}onDeleteComment(t,e){Array.from(this.listeners.values()).forEach(r=>r.onDeleteComment(t,e))}onUpdateComment(t,e){Array.from(this.listeners.values()).forEach(r=>r.onUpdateComment(t,e))}addListener(t){this.listeners.add(t)}removeListener(t){this.listeners.delete(t)}createCommentEditor(t,e){return jS(this.editor,{root:t,childDoc:e,doc:this.doc})}allowEdit(t){return t.userId===this.doc.getUser().userId}}class kZ{constructor(t,e){m(this,"listeners",new Set);this.editor=t,this.localDoc=e}get doc(){return this.localDoc.toJSON()}getComments(){return Object.values(this.doc.comments)}getComment(t){return this.doc.comments[t]}getCommentDoc(t){const e=this.doc.comments[t];return zC(e)}addListener(t){this.listeners.add(t)}removeListener(t){this.listeners.delete(t)}localCreateComment(t,e){}localDeleteComment(t){}localUpdateComment(t,e){}createCommentEditor(t,e){return jS(this.editor,{root:t,childDoc:e,doc:this.localDoc})}allowEdit(t){return t.userId===this.localDoc.getUser().userId}}const RZ={placeholder:{common:{title:"\u8BF7\u8F93\u5165\u6807\u9898",readonlyTitle:"\u8BF7\u8F93\u5165\u6807\u9898",content:"\u70B9\u51FB + \uFF0C\u6216\u8F93\u5165 / \u5FEB\u6377\u63D2\u5165\u7EC4\u4EF6",contentInTable:"\u8F93\u5165 / \u5FEB\u6377\u63D2\u5165\u7EC4\u4EF6"},local:{readonlyTitle:"\u672A\u547D\u540D"}},copyCutProperty:{copy:"\u590D\u5236",cut:"\u526A\u5207",unsafeEnvTips:"\u7531\u4E8E\u5F53\u524D http \u8BBF\u95EE\u73AF\u5883\u4E0B\u7684\u9650\u5236\uFF0C\u8BF7\u4F7F\u7528\u5FEB\u6377\u952E({shortCut}) {operation}",limitedEnvTips:"\u7531\u4E8E\u6D4F\u89C8\u5668\u9650\u5236\uFF0C\u8BF7\u4F7F\u7528 {shortCut} \u7C98\u8D34"}},wZ={placeholder:{common:{title:"Enter a title",readonlyTitle:"Enter a title",content:'Click "+", or enter "/" to insert components quickly',contentInTable:'Enter "/" to insert components quickly'},local:{readonlyTitle:"Untitled"}},copyCutProperty:{copy:"Copy",cut:"Cut",unsafeEnvTips:"Due to the limitations of the current http access environment, please use the shortcut ({shortCut}) {operation}",limitedEnvTips:"Press {shortCut} to paste due to browser restrictions"}},SZ={placeholder:{common:{title:"\u30BF\u30A4\u30C8\u30EB\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044",readonlyTitle:"\u30BF\u30A4\u30C8\u30EB\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044",content:"\u300C+\u300D\u3092\u30AF\u30EA\u30C3\u30AF\u3059\u308B\u304B\u3001\u300C/\u300D\u3092\u5165\u529B\u3059\u308B\u3068\u3001\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u304C\u7D20\u65E9\u304F\u633F\u5165\u3067\u304D\u307E\u3059",contentInTable:"\u300C/\u300D\u3092\u5165\u529B\u3059\u308B\u3068\u3001\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u304C\u7D20\u65E9\u304F\u633F\u5165\u3067\u304D\u307E\u3059"},local:{readonlyTitle:"\u7121\u984C"}},copyCutProperty:{copy:"\u8907\u88FD",cut:"\u5207\u308B",unsafeEnvTips:"HTTP\u74B0\u5883\u306E\u5236\u7D04\u306B\u3088\u308A\u3001{operation}\u3059\u308B\u306B\u306F\u3001\u30B7\u30E7\u30FC\u30C8\u30AB\u30C3\u30C8({shortCut}) \u3092\u3054\u4F7F\u7528\u304F\u3060\u3055\u3044",limitedEnvTips:"\u30D6\u30E9\u30A6\u30B6\u30FC\u306E\u5236\u9650\u306B\u3088\u308A\u3001\u300C{shortCut}\u300D\u3092\u4F7F\u7528\u3057\u3066\u8CBC\u308A\u4ED8\u3051\u3066\u304F\u3060\u3055\u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tMS54bWxQSwECLQAUAAYACAAAACEAdD85esIAAAAoAQAAHgAAAAAAAAAAAAAAAABVOQAAY3VzdG9tWG1sL19yZWxzL2l0ZW0xLnhtbC5yZWxzUEsBAi0AFAAGAAgAAAAhAOuAYExTAwAAjw4AABIAAAAAAAAAAAAAAAAAWzsAAHdvcmQvZm9udFRhYmxlLnhtbFBLBQYAAAAADwAPANQDAADePgAAAAA=",IZ=()=>$p(LZ),DZ=D("image-to-docx");async function _Z(n){return new Promise((t,e)=>{const r=new Image;r.onload=()=>{t({width:r.naturalWidth,height:r.naturalHeight})},r.onerror=e,r.src=n})}async function zS(n,t){if(n.width&&n.height)return{width:n.width,height:n.height,buffer:t};try{const e=await _c(new File([t],"",{})),r=await _Z(e);return r.width===void 0||r.height===void 0?{width:345,height:230,buffer:t}:n.width||n.height?{width:n.width||r.width*n.height/r.height,height:n.height||r.height*n.width/r.width,buffer:t}:{width:r.width,height:r.height,buffer:t}}catch(e){DZ.error(e);return}}function MZ(n,t){let e=n.filter(o=>o!=null);const r=t-(e.length-1)*20,i=.87,s=e.reduce((o,l)=>o+l.width,0);return s>r&&(e=e.map(o=>({width:o.width*r/s,height:o.height*r/s,buffer:o.buffer}))),e.map(o=>({width:o.width*i,height:o.height*i,buffer:o.buffer}))}function UZ(n,t,e){if(!e||typeof e!="object")return;const r=e,i=n.filter(o=>o!=null),s=t-(i.length-1)*20;i.forEach((o,l)=>{if(i.length===1&&r.widthPercent){const d=r.widthPercent,h=o.width;o.width=s*(d/100),o.height*=o.width/h;return}const c=`${l}_flex`;if(r[c]){const d=r[c],h=o.width;o.width=s*d,o.height*=o.width/h}})}function GS(n=[0,1,2,3,4,5,6,7],t=1){return n.map(e=>{let r;switch(e%3){case 0:r=Bt.LevelFormat.DECIMAL;break;case 1:r=Bt.LevelFormat.LOWER_LETTER;break;default:r=Bt.LevelFormat.LOWER_ROMAN;break}return{level:e,format:r,text:`%${e+1}. `,alignment:Bt.AlignmentType.START,start:t,style:{paragraph:{indent:{left:Bt.convertInchesToTwip(.3*(e+1)),hanging:Bt.convertInchesToTwip(.2)}}}}})}function OZ(){return[0,1,2,3,4,5,6,7].map(n=>{let t;switch(n%3){case 0:t="\u2022";break;case 1:t="\u25E6";break;default:t="\u25AA";break}return{level:n,format:Bt.LevelFormat.BULLET,text:t,alignment:Bt.AlignmentType.START,style:{paragraph:{indent:{left:Bt.convertInchesToTwip(.3*(n+1)),hanging:Bt.convertInchesToTwip(.2)}}}}})}function NZ(){return[0,1,2,3,4,5,6,7].map(n=>({level:n,format:Bt.LevelFormat.BULLET,text:"\u2611",alignment:Bt.AlignmentType.START,style:{paragraph:{indent:{left:Bt.convertInchesToTwip(.3*(n+1)),hanging:Bt.convertInchesToTwip(.2)}}}}))}function PZ(){return[0,1,2,3,4,5,6,7].map(n=>({level:n,format:Bt.LevelFormat.BULLET,text:"\u2610",alignment:Bt.AlignmentType.START,style:{paragraph:{indent:{left:Bt.convertInchesToTwip(.3*(n+1)),hanging:Bt.convertInchesToTwip(.2)}}}}))}var ah=(n=>(n.NUMBERING="number-numbering-reference",n.BULLET="number-bullet-reference",n.CHECKED="checked-bullet-reference",n.UNCHECKED="unchecked-bullet-reference",n))(ah||{});const FZ=[{levels:GS(),reference:"number-numbering-reference"},{levels:OZ(),reference:"number-bullet-reference"},{levels:NZ(),reference:"checked-bullet-reference"},{levels:PZ(),reference:"unchecked-bullet-reference"}];function KZ(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 VZ(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 $Z(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 HZ=/rgb\((\d+),\s*(\d+),\s*(\d+)\)/;function WS(n){if(typeof n=="string"&&n.length>0){if(n[0]==="#")return n.substring(1);const t=n.match(HZ);if(t){const e=o=>{let l=Number(o).toString(16);return l.length<2&&(l=`0${l}`),l},r=e(t[1]),i=e(t[2]),s=e(t[3]);return`${r}${i}${s}`}if(n==="red")return"FF0000";if(n==="green")return"00FF00";if(n==="blue")return"0000FF"}}function Mn(n,t){if(n&&n.attributes&&n.attributes[t])return n.attributes[t];if(n&&n.attributes&&n.attributes.box&&n.attributes.inputType&&t==="style-underline")return!0}function qS(n,t,e){for(let r=0;r<=e;++r){const i=`${t}${r}`;if(Mn(n,i))return i}}function Kg(n,t,e){n.attributes=n.attributes||{},n.attributes[t]=e}function wx(n){return n==="image"||n==="drawio"||n==="plantuml"||n==="mermaid"||n==="flowchart"}function XS(n){return n&&n.startsWith("//")?`https:${n}`:n&&!n.startsWith("http://")&&!n.startsWith("https://")?`https://${n}`:n}function jZ(n){const t=Mn(n,"inlineStyle");if(t==null)return;const e=t.split(";");for(const r of e){const i=r.split(":");if(i.length!==2)continue;const s=i[0].trim().toLowerCase(),o=i[1].trim().toLowerCase();s==="font-size"&&Kg(n,"inline-style-font-size",o),s==="color"&&Kg(n,"inline-style-color",o),s==="background-color"&&Kg(n,"inline-style-background-color",o),s==="font-family"&&Kg(n,"inline-style-font-family",o)}}function zZ(n,t){if(t==null)return n==null?void 0:n.normal;if(n)return n[`heading${t}`]}function GZ(n){const t=`${Mn(n,"inline-style-font-size")}`;if(t&&t.indexOf("px")>0)return+t.replace(/px/g,"")}function WZ(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 qZ(n){if(n.attributes&&n.attributes.box&&n.attributes.text)return` @${n.attributes.text} `}function XZ(n){return Mn(n,"inline-style-font-family")}function YZ(n){const t=Mn(n,"inline-style-background-color");return WS(t)}function QZ(n){const t=Mn(n,"inline-style-color");return WS(t)}function JZ(n){jZ(n);const t=Mn(n,"type")==="mention";return{box:n.attributes&&n.attributes.box?n.attributes:void 0,inlineCode:!!Mn(n,"style-code"),link:XS(Mn(n,"link")),size:GZ(n),text:t?qZ(n):WZ(n)||n.insert,bold:!!Mn(n,"style-bold"),underline:!!Mn(n,"style-underline"),italics:!!Mn(n,"style-italic"),strike:!!Mn(n,"style-strikethrough"),superScript:!!Mn(n,"style-super"),subScript:!!Mn(n,"style-sub"),math:Mn(n,"type")==="math"?Mn(n,"src"):void 0,mention:t,fontFamily:XZ(n),background:YZ(n),color:t?"338fe5":KZ(qS(n,"style-color-",6))||QZ(n),highlight:qS(n,"style-bg-color-",13)}}function ZZ(){return[new Bt.Paragraph({border:{top:{color:"auto",style:Bt.BorderStyle.DASHED,size:4,space:1}},spacing:{before:300}}),new Bt.Paragraph({spacing:{line:0}})]}function ttt(){return new Bt.Paragraph({children:[new Bt.TextRun({text:"[\u89C6\u9891\u6682\u4E0D\u652F\u6301\u5BFC\u51FA]",shading:{type:Bt.ShadingType.CLEAR,color:"FFFFFF",fill:"CCCCCC"}})]})}function ett(){return new Bt.Paragraph({children:[new Bt.TextRun({text:"[\u97F3\u9891\u6682\u4E0D\u652F\u6301\u5BFC\u51FA]",shading:{type:Bt.ShadingType.CLEAR,color:"FFFFFF",fill:"CCCCCC"}})]})}function ntt(n,t){return new Bt.Paragraph({children:[new Bt.ExternalHyperlink({children:[new Bt.TextRun({style:"Hyperlink",text:t||n})],link:n})]})}function YS(n){if(n.heading!=null)return`Heading${n.heading}`}function QS(n){if(n.alignment!=null){if(n.alignment==="center")return Bt.AlignmentType.CENTER;if(n.alignment==="right")return Bt.AlignmentType.RIGHT;if(n.alignment==="left")return Bt.AlignmentType.LEFT}}function rtt(n){if(n.indent)return{left:Bt.convertInchesToTwip(.3*n.indent-.2)};if(n.padding)return{left:Bt.convertInchesToTwip(.3*n.padding)}}function itt(n){return{type:Bt.ShadingType.CLEAR,color:"FFFFFF",fill:n}}function stt(n){const t=n.split(",");if(t.length!==0)return t[0].trim()}function JS(n,t){var s;let e;e=n.inlineCode?"InlineCode":void 0,e=n.link?"Hyperlink":e;const r=n.size||t,i=r!=null?Math.floor(r*1.5+.5):void 0;return n.text=(s=n.text)==null?void 0:s.replace(/\x00/g," "),new Bt.TextRun({text:n.text,bold:n.bold||void 0,underline:n.underline?{type:Bt.UnderlineType.SINGLE}:void 0,italics:n.italics||void 0,strike:n.strike||void 0,superScript:n.superScript||void 0,subScript:n.subScript||void 0,size:i,style:e,font:n.fontFamily?stt(n.fontFamily):void 0,shading:n.background?itt(n.background):void 0,color:n.color,highlight:VZ(n.highlight)})}function ott(n,t){if(n.link)return n.link=n.link.replace(/\x00/g," "),new Bt.ExternalHyperlink({children:[JS(n,t)],link:n.link})}async function ZS(n,t,e,r,i){const[s]=await i(n,t,e);if(s==null)return;const o=await zS({width:r||0,height:0,src:e},s);return new Bt.ImageRun({data:s,transformation:{width:(o==null?void 0:o.width)||100,height:(o==null?void 0:o.height)||20}})}function ltt(n){if(n.heading||n.heading)return n.heading}function att(n){if(n.align&&(n.align==="center"||n.align==="right"||n.align==="left"))return n.align}function ctt(n){if(n.textOnly===!0&&n.level!=null)return n.level}async function utt(n,t){var r;const e=[];if(n.text&&Array.isArray(n.text)){for(let i=0;i<n.text.length;i++){const s=n.text[i];if(((r=s.attributes)==null?void 0:r.box)===!0&&t){const o=await t(s);if(o){n.text.splice(i+1,0,...o);continue}}e.push(JZ(s))}return e}}function ftt(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 dtt(n,t){if(n.type==="embed"&&n.embedType&&wx(n.embedType)&&n.embedData&&n.embedData.src)return n.embedData.src.split("|").map(r=>{const i=t(r),s=n.embedData[`${i}_width`],o=n.embedData[`${i}_height`];return{src:r,width:s,height:o}})}function htt(n){if(n.padding)return n.padding}function mtt(n){return!!(n.type==="embed"&&n.embedType&&wx(n.embedType)&&n.embedData&&n.embedData.src)}async function Vg(n,t,e){return{quoted:!!n.quoted,heading:ltt(n),alignment:att(n),indent:ctt(n),padding:htt(n),texts:await utt(n,e),list:ftt(n),images:dtt(n,t),border:mtt(n)}}async function gtt(n,t,e,r){const i=[];if(!n.children)return[];for(const s of n.children){const o=[];for(const l of t.blocks[s])o.push(await Vg(l,e,r));i.push(o)}return i}const ptt=D("to-docx");function Ctt(n,t){return Array(n).fill(0).map(()=>Array(t).fill(0).map(()=>({cellId:void 0,color:void 0,from:void 0,rowSpan:1,colSpan:1,width:0,originalWidth:void 0,align:void 0})))}function Ett(n,t,e,r){const i=!!n.hasColTitle,s=!!n.hasRowTitle,o=!!n.isStripeStyle,l="F5F8FB";for(let c=0;c<t;c++)for(let d=0;d<e;d++)(i&&d===0||s&&c===0||o&&c%2===1)&&(r[c][d].color=l)}function Att(n){p(ptt,n.children,"no table children");const t=n.rows,e=n.cols,r=n.colsWidth;if(r)for(let o=0;o<r.length;o++)r[o]===0&&(r[o]=100);const i=Ctt(t,e);let s=0;for(let o=0;o<t;++o)for(let l=0;l<e;++l){if(i[o][l].originalWidth=r?r[l]:void 0,i[o][l].from!==void 0)continue;const c=n.children[s];s+=1,i[o][l].cellId=c,i[o][l].color=$Z(n[`${c}_background`]),i[o][l].width=r?r[l]:100,i[o][l].align=n[`${c}_align`];const d=n[`${c}_rowSpan`]||1,h=n[`${c}_colSpan`]||1;if(i[o][l].rowSpan=d,i[o][l].colSpan=h,d>1||h>1){let C=0;for(let E=0;E<d;E++)for(let A=0;A<h;A++)E===0&&(C+=r?r[l+A]:80),!(E===0&&A===0)&&(i[o+E][l+A].from=[o,l]);i[o][l].width=C}}return Ett(n,t,e,i),i}async function xtt(n,t,e,r,i,s,o,l,c,d){async function h(E){if(l&&E.type!=="_exportVirtualBlock"){const A=await l(i,s,E);if(A){await r.addDoc(n,A,d);return}}if(E.type==="text"||E.textOnly===!0){const A=await Vg(E,o,c);await r.addTextBlock(A);return}if(E.type==="code"){const A=await gtt(E,e,o,c);await r.addCodeBlockObject(A);return}if(E.type==="list"&&E.textOnly!==!0){const A=await Vg(E,o,c);await r.addListBlockObject(n,A);return}if(E.type==="embed"&&E.embedType){const A=E,v=A.embedData,w=A.embedType;if(wx(w)){const S=await Vg(E,o,c);await r.addImagesBlockObject(E,S,d)}else E.embedType==="hr"?r.addSeparatorBlock():E.embedType==="video"?r.addVideoPlaceholder():E.embedType==="audio"?r.addAudioPlaceholder():E.embedType==="webpage"?r.addHyperlinkParagraph(XS(v.src),v.title):r.addOtherEmbedBlock(w,E.embedData);return}if(E.type==="table"){let A=[];if(E.colsWidth)A=E.colsWidth;else{const w=E.cols;A=new Array(w);for(let S=0;S<A.length;S++)A[S]=100;E.colsWidth=A}const v=Att(E);await r.addTableMatrix(A,v,e),r.addEmptyParagraph()}E.type==="_exportVirtualBlock"&&await r.addVirtualBlock(E.id,e,d)}function C(E){var w;const A=((w=E==null?void 0:E.embedData)==null?void 0:w.exportSpec)||(E==null?void 0:E.exportSpec);if(!A)return[E];const v=[];for(const{type:S,data:U}of A){if(S==="text"){const M={id:it(),text:[{insert:U}],type:"text"};v.push(M);continue}if(S==="image"){const M={id:it(),type:"embed",embedType:"image",align:"left",embedData:{src:U}};v.push(M);continue}if(S==="link"){const M={id:it(),type:"embed",embedType:"webpage",embedData:{src:U.url,title:U.title}};v.push(M);continue}if(S==="block")for(const M of U){if(!e.blocks[M])continue;const nt={id:M,type:"_exportVirtualBlock"};v.push(nt)}}return v}for(const E of t)for(const A of C(E))!A||await h(A)}function btt(){return{listMaxInst:1,listInstMap:{},listRefMap:{},levelConfigs:[]}}const vtt=D("to-docx");class Btt{constructor(t,e,r,i,s,o){m(this,"paragraphs");this.appId=t,this.docId=e,this.state=r,this.readImageFunc=i,this.convertBlocksFunc=s,this.defaultFontSize=o,this.paragraphs=[]}async addTextBlock(t){this.paragraphs.push(new Bt.Paragraph({heading:YS(t),alignment:QS(t),children:await this.paragraphsFromBlockTexts(t),indent:rtt(t)}))}async addEmptyImagePlaceHolder(){this.paragraphs.push(new Bt.Paragraph({text:`[${_.t("docx.imageExportFailed")}]`,shading:{type:Bt.ShadingType.CLEAR,color:"FFFFFF",fill:"CCCCCC"}}))}async paragraphsFromBlockTexts(t){if(t.texts==null)return;const e=zZ(this.defaultFontSize,t.heading),r=[];for(const i of t.texts){if(i.link){const s=ott(i,e);s&&r.push(s);continue}if(i.box&&i.box.type&&i.box.type==="br"){r.push(new Bt.TextRun({text:"",break:1}));continue}if(i.box&&i.box.type&&i.box.type==="image"){const s=await ZS(this.appId,this.docId,i.box.src,i.box.width,this.readImageFunc);s&&r.push(s);continue}if(i.math){const s=await ZS(this.appId,this.docId,i.math,0,this.readImageFunc);s&&r.push(s);continue}r.push(JS(i,e))}return r}async addCodeBlockObject(t){for(const e of t)for(const r of e){const i={style:Bt.BorderStyle.SINGLE,color:"#DEDEDE"};this.paragraphs.push(new Bt.Paragraph({style:"Code",border:{left:{...i},right:{...i},top:{...i},bottom:{...i}},children:await this.paragraphsFromBlockTexts(r)}))}}async addListBlockObject(t,e){if(e.list==null)return;let r;const i=e.list.checkbox?`${t}-${e.list.groupId}-${e.list.checkbox}`:`${t}-${e.list.groupId}`;if(this.state.listInstMap[i])r=this.state.listInstMap[i];else if(r=this.state.listMaxInst,this.state.listMaxInst+=1,this.state.listInstMap[i]=r,e.list.start>0&&e.list.ordered){const o=`number-numbering-reference-${r}`,l=GS([e.list.level-1],e.list.start);this.state.levelConfigs.push({levels:l,reference:o,inst:r}),this.state.listRefMap[i]=o}else e.list.ordered?this.state.listRefMap[i]=ah.NUMBERING:e.list.checkbox&&e.list.checkbox==="checked"?this.state.listRefMap[i]=ah.CHECKED:e.list.checkbox&&e.list.checkbox==="unchecked"?this.state.listRefMap[i]=ah.UNCHECKED:this.state.listRefMap[i]=ah.BULLET;const s=YS(e);e.texts&&this.paragraphs.push(new Bt.Paragraph({heading:s,children:await this.paragraphsFromBlockTexts(e),numbering:{reference:this.state.listRefMap[i],level:e.list.level-1,instance:r}}))}imageDimWithBufferToImageRun(t){return new Bt.ImageRun({data:t.buffer,transformation:{width:t.width,height:t.height}})}async addImagesBlockObject(t,e,r){if(e.images==null){if(t.type==="embed"&&t.embedType==="image"){const{src:c}=t.embedData;c||this.addEmptyImagePlaceHolder()}return}const i=[],s=await Promise.all(e.images.map(async c=>{const[d,h]=await this.readImageFunc(this.appId,this.docId,c.src);if(d){const C=await zS(c,d);if(C)return C}i.push(h)}));UZ(s,r,t.embedData);const o=MZ(s,r),l={style:Bt.BorderStyle.SINGLE,color:"#DEDEDE"};o.length&&this.paragraphs.push(new Bt.Paragraph({border:e.border?{left:{...l},right:{...l},top:{...l},bottom:{...l}}:void 0,alignment:QS(e)||Bt.AlignmentType.CENTER,children:o.map(c=>this.imageDimWithBufferToImageRun(c)).flatMap((c,d,h)=>c==null?[]:h.length-1!==d?[c,new Bt.TextRun({text:" "})]:c)})),i.forEach(c=>{this.addHyperlinkParagraph(c)})}addSeparatorBlock(){ZZ().forEach(t=>this.paragraphs.push(t))}addEmptyParagraph(){this.paragraphs.push(new Bt.Paragraph(""))}addVideoPlaceholder(){this.paragraphs.push(ttt())}addAudioPlaceholder(){this.paragraphs.push(ett())}addHyperlinkParagraph(t,e){t!=null&&this.paragraphs.push(ntt(t,e))}async addTableMatrix(t,e,r){const i=t.map(s=>s!==0?s*15:1500);this.paragraphs.push(new Bt.Table({rows:await this.generateTableRows(e,r),columnWidths:i}))}async generateRowCells(t,e){const r=[];for(const i of t){const s=i.cellId;if(s===void 0)continue;const o=i.width*.9;r.push(new Bt.TableCell({children:await this.convertBlocksFunc(s,e.blocks[s],e,this.appId,this.docId,this.state,o),columnSpan:i.colSpan,rowSpan:i.rowSpan,width:{type:Bt.WidthType.DXA,size:i.width*15},shading:i.color?{fill:i.color,type:Bt.ShadingType.CLEAR,color:"auto"}:void 0}))}return r}async generateTableRows(t,e){const r=[];for(const i of t)r.push(new Bt.TableRow({children:await this.generateRowCells(i,e)}));return r}async addDoc(t,e,r){const i=await this.convertBlocksFunc(t,e.blocks.root,e,this.appId,this.docId,this.state,r);i&&(this.paragraphs=this.paragraphs.concat(i))}async addVirtualBlock(t,e,r){const i=await this.convertBlocksFunc(t,e.blocks[t],e,this.appId,this.docId,this.state,r);this.paragraphs.push(...i)}async addOtherEmbedBlock(){}}class ytt{constructor(t,e,r,i,s,o,l,c){m(this,"convertBlocks",async(t,e,r,i,s,o,l=720)=>{const c=new Btt(i,s,o,this.readImage,this.convertBlocks,this.defaultFontSize);return await xtt(t,e,r,c,i,s,this.md5HexFunc,this.getDocByBlock,this.getTextsByBox,l||720),c.paragraphs});this.templateData=t,this.docData=e,this.md5HexFunc=r,this.readImage=i,this.defaultFontSize=s,this.getDocByBlock=o,this.getTextsByBox=l,this.backgroundImageOptions=c}async convert(t,e){return this.snapshot2docx(this.docData,t,e)}async snapshot2docx(t,e,r){const i=new Bt.ImportDotx,s=this.templateData?await i.extract(this.templateData):void 0,o=t.blocks.root;p(vtt,o,"data must have blocks");const l=btt(),c=await this.convertBlocks("blocks",o,t,e,r,l),d=this.backgroundImageOptions?{default:new Bt.Header({children:[new Bt.Paragraph({children:[new Bt.ImageRun(this.backgroundImageOptions)]})]})}:{},h=new Bt.Document({numbering:{config:[...FZ,...l.levelConfigs]},sections:[{headers:d,children:c,properties:{page:{size:{width:12240,height:15840},margin:{top:1440,bottom:1440,left:1440,right:1440}}}}]},{template:s});return Bt.Packer.toBlob(h)}}const Ttt=D("editor-to-docx");async function ktt(n,t,e,r){const i=n.doc.buildResourceUrl(r,{withToken:!0});let s=await CS(i);if(!s)return[void 0,i];if(s.type.indexOf("/svg")!==-1){const l=await mS(s);l&&(s=new File([l],s.name))}return[await s.arrayBuffer(),i]}async function Rtt(n,t,e){const r=n.editorBlocks.getBlockClass(e.type);if(r.toStandardDoc)try{return await r.toStandardDoc(n,e,t)}catch(i){Ttt.error(`toStandardDoc error: ${JSON.stringify(i)}`);return}}async function wtt(n,t){const e=t.attributes,r=n.editorBoxes.getBoxClass(e.type);if(r.toStandardText)return r.toStandardText(n,e)}async function Stt(n,t){let{template:e,download:r,backgroundImageOptions:i}=t!=null?t:{};e||(e=IZ());const s=n.doc.toJSON(),o=(C,E,A)=>ktt(n,C,E,A),l=async(C,E,A)=>Rtt(n,s,A),c=async C=>wtt(n,C),h=await new ytt(e,s,nm.default,o,void 0,l,c,i).convert("_appId","_docId");if(r){const C=URL.createObjectURL(h),E=document.createElement("a");E.setAttribute("download",`${pS(n)}.docx`),E.setAttribute("href",`${C}`),E.click(),E.remove()}return h}const Sx=D("create-editor");async function Ltt(n,t){var o,l,c,d,h,C,E,A,v,w,S,U,M,V,nt,Y;p(Sx,n,"app does not exists"),t.lang&&_.setLang(t.lang),hi.level=(o=t.logLevel)!=null?o:qo.DEBUG;const e=t.onReauth?async()=>{var bt;const X=t.user.userId,ft=t.docId,xt=await((bt=t.onReauth)==null?void 0:bt.call(t,X,ft,t.permission));return{userId:X,docId:ft,permission:t.permission,appId:t.appId,token:xt,displayName:t.user.displayName,avatarUrl:t.user.avatarUrl}}:void 0,r={auth:{appId:t.appId,docId:t.docId,userId:t.user.userId,permission:t.permission,token:t.token,displayName:t.user.displayName,avatarUrl:t.user.avatarUrl},serverUrl:t.serverUrl,reauthFunc:e,disableLogout:t.disableLogout,onMaxUsersError:t.onMaxUsersError},i=await hd.load(r),s=Zf(n,i,{id:t.id,scrollContainer:t==null?void 0:t.scrollContainer,enableComments:t==null?void 0:t.enableComments,enableContextMenu:t==null?void 0:t.enableContextMenu,components:{blocks:[...VS,...((l=t==null?void 0:t.components)==null?void 0:l.blocks)||[]],embeds:[...Rx,...((c=t.components)==null?void 0:c.embeds)||[]],boxes:[...$S,...((d=t.components)==null?void 0:d.boxes)||[]],commandProviders:[new P0,...((h=t.components)==null?void 0:h.commandProviders)||[]],decorators:[new fg,new WC],insertions:[G1],blockHooks:[new DA,new lw,...((C=t.components)==null?void 0:C.blockHooks)||[]],textRenders:[new T4,new WE,...((E=t.components)==null?void 0:E.textRenders)||[]],options:{...t.componentsOptions}},shortcuts:[Nq,fH,Bz,fA,Qw,AF,sA,bX,s0,dF,...t.shortcuts||[]],colors:["#0064FF","#EB3723","#F59300","#00A865","#F25A0A","#70A310","#009CAD","#0990D9","#8851ED","#D62069"]});if(s.editorCommandProviders.registerCommandProvider(new ms(s)),s.input.addHandler(new uY),s.input.addHandler(new hg),s.input.addHandler(new $K),s.input.addHandler(new gz),s.input.addHandler(new xA(s,{hideTitle:t.hideTitle,headingLevel:1,titlePlaceholder:_.t("placeholder.common.title"),contentPlaceholder:_.t("placeholder.common.content"),readonlyTitlePlaceholder:_.t("placeholder.common.readonlyTitle"),addPlaceholderToAllCurrentEmptyBlock:!0,applyContentPlaceholder:(A=t.placeholder)==null?void 0:A.applyContentPlaceholder})),s.input.addHandler(new sg(s,(v=t.componentsOptions)==null?void 0:v.quickMenu)),s.input.addHandler(new PA(s)),s.input.addHandler(new jA(s)),s.input.addHandler(new Cg),s.input.addHandler(new Ik),s.doc.registerCallback(new fY(s)),s.addCustom("remote-cursor",()=>new uT(s)),s.addCustom("block-menu",X=>new uw(X)),xe.isMobile||s.addCustom("editor-tooltip",()=>new Ld(s)),t!=null&&t.enableComments&&s.addCustom("editor-comments",X=>new y4(X,new TZ(X))),t.enableContextMenu!==!1&&s.addCustom("editor-context-menu",X=>new WA(X)),s.addCustom("create-options",()=>new Db(s,t)),s.addCustom("drop-target",()=>new qd(s)),s.addCustom("list-to-mindmap",()=>new Z0(s)),s.addCustom("list-to-mention",()=>new DY(s)),s.addCustom("mobile-helper",()=>new tQ(s)),s.addCustom("code-caret",()=>new lH(s)),s.addCustom("image-paste-handler",()=>new NA(s)),(w=t.componentsOptions)!=null&&w.mention){const X=t.componentsOptions.mention;s.addCustom("mention",()=>new cS(s,X))}if(s.addCustom("heading-collapse",()=>new fx(s)),s.addCustom(Pg,X=>new Ex(X)),Au.register(s),qd.register(s),Ll.register(s),yl.register(s),s.addListener("clickLink",(X,ft,xt)=>{var wt;if((wt=t==null?void 0:t.events)!=null&&wt.onClickLink){t.events.onClickLink(X,ft,xt);return}const bt=xt.getAttribute("link");bt&&(X.readonly||ft.ctrlKey||ft.metaKey)&&window.open(bt,"_blank")}),(U=(S=t.componentsOptions)==null?void 0:S.remoteCarets)!=null&&U.onUserChanged){const X=(V=(M=t.componentsOptions)==null?void 0:M.remoteCarets)==null?void 0:V.onUserChanged;s.doc.getRemoteUsers().on("change",ft=>{X(s,ft)})}return(Y=(nt=t.componentsOptions)==null?void 0:nt.templates)!=null&&Y.templates.length&&(s.addListener("docChanged",()=>{Ng(s)}),s.addListener("resize",()=>{Ng(s,{reset:!0})}),setTimeout(()=>{Ng(s)},100)),s.doc.registerCallback({onError:async X=>{if(X.code==="ResetDoc"){Sx.error(`reset doc: ${X.message}`);const ft=await hd.load(r);s.doc.reset(ft)}}}),s.version="1.1.27-beta.4",hi.level===qo.DEBUG&&(window.setReauthFail=X=>{window.isReauthError=X},window.reConnect=X=>s.doc.externalDoc.client.connection.reConnect(X)),s}function Itt(n){return n.toJSON!==void 0}async function Dtt(n,t,e){var s,o,l,c,d,h,C,E;p(Sx,n,"app does not exists");const r=Itt(t)?t:new TC(t,{serverUrl:e.serverUrl||""});e.lang&&_.setLang(e.lang),hi.level=(s=e.logLevel)!=null?s:qo.DEBUG;const i=Zf(n,r,{id:e.id,scrollContainer:e==null?void 0:e.scrollContainer,components:{blocks:[uA,EA,AA,Dk,...(l=(o=e.components)==null?void 0:o.blocks)!=null?l:[]],commandProviders:[new P0],decorators:[new fg,new WC],embeds:[...Rx,...((c=e.components)==null?void 0:c.embeds)||[]],boxes:[jk,uS,_4,...((d=e.components)==null?void 0:d.boxes)||[]],insertions:[G1],blockHooks:[new DA,...((h=e.components)==null?void 0:h.blockHooks)||[]],textRenders:[new T4,new WE,...((C=e.components)==null?void 0:C.textRenders)||[]],options:{...e.componentsOptions}},shortcuts:[fA,Qw,sA,s0]});return i.editorCommandProviders.registerCommandProvider(new ms(i)),i.input.addHandler(new hg),i.input.addHandler(new xA(i,{hideTitle:e.hideTitle,headingLevel:1,titlePlaceholder:_.t("placeholder.common.title"),contentPlaceholder:_.t("placeholder.common.content"),readonlyTitlePlaceholder:_.t("placeholder.local.readonlyTitle"),addPlaceholderToAllCurrentEmptyBlock:!0})),i.input.addHandler(new sg(i,(E=e.componentsOptions)==null?void 0:E.quickMenu)),i.input.addHandler(new PA(i)),i.input.addHandler(new jA(i)),i.input.addHandler(new Cg),i.input.addHandler(new Ik),i.addCustom("block-menu",A=>new uw(A)),xe.isMobile||i.addCustom("editor-tooltip",()=>new Ld(i)),i.addCustom("image-paste-handler",()=>new NA(i)),e!=null&&e.enableComments&&i.addCustom("editor-comments",A=>new y4(A,new kZ(A,r))),e.enableContextMenu!==!1&&i.addCustom("editor-context-menu",A=>new WA(A)),i.addCustom("heading-collapse",()=>new fx(i)),i.addListener("clickLink",(A,v,w)=>{var U;if((U=e==null?void 0:e.events)!=null&&U.onClickLink){e.events.onClickLink(A,v,w);return}const S=w.getAttribute("link");S&&(A.readonly||v.ctrlKey||v.metaKey)&&window.open(S,"_blank")}),i.addCustom(Pg,A=>new Ex(A)),Au.register(i),i.version="1.1.27-beta.4",i}async function _tt(n,t,e){var h;const r=n.doc.externalDoc.client.auth,i=await C0.load({auth:r,serverUrl:e});if(!((h=i.getVersionHelper)==null?void 0:h.call(i)))throw new Error("the editor does not support to show versions");const o=n.getCustom("create-options");if(!o)throw new Error("the editor does not support to show versions");const l=o.getData(),c=new HS(l),d=n.addCustom("version-dialog",()=>new X4(i,c));return d.show(t),d}b.tippy=c9,b.AnchorBox=w3,b.AuthError=fd,b.AuthHeader=xa,b.AutoScroll=xm,b.BaseURLHeader=eu,b.BasicCommands=uK,b.BlockExclusiveHook=lw,b.BlockLockerHook=DA,b.BlockLockerPasteHandler=Cg,b.BlockResizer=Pd,b.BrBox=y3,b.CodeBlock=EA,b.CodeLineBlock=AA,b.CodeTextDecorator=fg,b.DOC_RE_AUTH_KEYS=Pg,b.DefaultShortcuts=s0,b.DocIdError=tO,b.DocReAuthCallbacks=Ex,b.DragDrop=Yb,b.DrawioEmbed=LS,b.EditorBlocks=lB,b.EditorBoxes=k3,b.EditorCommandProviders=yy,b.EditorComplexBlockPosition=Ai,b.EditorComplexSelectionRange=Qi,b.EditorDecorators=D3,b.EditorEmbeds=cB,b.EditorInsertions=I3,b.EditorSimpleBlockPosition=gn,b.EditorSimpleSelectionRange=bn,b.EmbedBlock=fB,b.EmbedBlockResizer=nh,b.EnforceWithDocumentTitleHandler=xA,b.EventCallbacks=Lc,b.FILL_CHAR=T8,b.FileExtError=eO,b.GroupOrder=Ok,b.HeadingBlockScrollListener=TY,b.ImageBox=R3,b.InlineBoxCommandProvider=Yk,b.InputtingInsertion=S3,b.LocalDoc=TC,b.LogLevel=qo,b.Logger=hi,b.MIN_DISTANCE_THRESHOLD=qb,b.ManualCloseDialog=gd,b.ManualMenu=dl,b.ManualToolbar=md,b.MarkdownInputHandler=hg,b.MaxUserError=PC,b.Mindmap=J0,b.OnesEditorAutoSuggest=mE,b.OnesEditorCustomDataWrapper=Db,b.OnesEditorExclusiveBlock=yl,b.OnesEditorHoveringBlock=$e,b.OnesEditorIcons=KO,b.OnesEditorQuickMenu=sg,b.OnesEditorToc=oh,b.OnesEditorTocProvider=Ll,b.OnesEditorToolbar=Au,b.OnesEditorTooltip=Ld,b.OnesEditorVersionsDialog=X4,b.PermissionError=p0,b.Popup=su,b.ReAuthToolbar=ES,b.RemoteCarets=uT,b.RemoteCaretsDecorator=WC,b.RemoteCaretsInsertion=G1,b.RemoteUsers=td,b.RequestReloadError=dd,b.RichText=$n,b.ShareDBDoc=hd,b.ShareDBDocVersionsProvider=HS,b.ShareDBServer=C0,b.SimpleCache=Kb,b.StandardEmbedBlockCommands=rx,b.TEXT_STYLE_BACKGROUND_COLOR_PREFIX=T1,b.TEXT_STYLE_COLOR_PREFIX=y1,b.TableBlock=uA,b.TableBlockCommandProvider=P0,b.TableShortcuts=fA,b.TextBlock=lr,b.TextBox=B3,b.TextColorItem=w2,b.TextStyleShortcuts=sA,b.TocEmbed=lS,b.ZERO_WIDTH_SPACE_CHAR=xf,b.abbreviation=bm,b.addAttribute=Lm,b.addClass=q,b.addCommentToBlock=eh,b.addDays=AI,b.addMetaToDoc=Qf,b.addMonths=EI,b.animateScrollTo=ra,b.applyPlaceholderToBlock=Od,b.assert=p,b.autoShowHideTemplates=Ng,b.bindKeyDownEvent=dm,b.blockToDoc=AC,b.blockToHtml=X1,b.blockToMarkdown=Gm,b.blockToText=zm,b.blocksToDoc=W5,b.clearAllSelection=Vv,b.clientType=xe,b.cloneBlock=sl,b.cloneChildContainer=sC,b.cloneDoc=oC,b.cloneText=m3,b.commentToShareDbComment=GC,b.compareElement=cm,b.comparePosition=p1,b.complexBlockAdjustSelectionPos=Rm,b.complexBlockFindNearestChildBlock=C7,b.complexBlockGetAllChildContainers=In,b.complexBlockGetBottomChildContainers=gB,b.complexBlockGetDeepFirstChild=dB,b.complexBlockGetFirstSimpleChild=E1,b.complexBlockGetLastSimpleChild=Pc,b.complexBlockGetSelectedContainers=Nc,b.complexBlockGetTopChildContainers=mB,b.containerToDoc=q5,b.continuousScroll=hv,b.convertBlockFrom=Tm,b.convertImageFileToPng=mS,b.convertImageSrcToPng=qY,b.converterIntercept=dg,b.copyBlockAttributes=z3,b.copyResourcesFromDoc=yC,b.createBlockAnchor=$s,b.createBlockCaretAnchor=CB,b.createBlockContentElement=ua,b.createBlockElement=Mv,b.createBlockSimpleDocRange=Km,b.createBlockSimpleRange=Ue,b.createBoxContentElement=Nv,b.createBoxElement=Uv,b.createBoxOp=h3,b.createChildContainer=sB,b.createComplexBlockPosition=Me,b.createComplexDocPos=A3,b.createComplexDocRange=w8,b.createContainer=p3,b.createContainerElement=t1,b.createDeleteOps=c3,b.createEditor=Zf,b.createEditorSelectionRange=pn,b.createElement=B,b.createEmptyContainer=qs,b.createEmptyDoc=Ws,b.createEmptyTextBlockData=Pm,b.createExpandedRange=lm,b.createIconButton=ta,b.createImage=_p,b.createInsertOps=Om,b.createInsertionContentElement=Kv,b.createInsertionElement=Pv,b.createLocalEditor=Dtt,b.createOnesEditor=Ltt,b.createRange=Vb,b.createRichText=pa,b.createRootContainer=iB,b.createSimpleBlockPosition=ht,b.createSimpleDocPos=E3,b.createTextBlockData=es,b.createTextButton=Sa,b.createTextOp=qr,b.createTextWithReplaceSoftReturn=N1,b.daysAfter=qp,b.deleteText=F1,b.diffDays=xI,b.disablePageScroll=jp,b.docToHtml=K3,b.docToHtmlFragment=jf,b.docToMarkdown=V3,b.docToText=il,b.downloadImageToFile=CS,b.downloadObjectToFile=bx,b.downloadSvgToString=bS,b.editLink=kd,b.editorAddComment=wq,b.editorAddTextAttribute=n5,b.editorAutoInsertBlock=G3,b.editorBreakTextBlock=qc,b.editorClearCompositionText=Z1,b.editorClearSelectedContents=Qm,b.editorCopyBlock=vC,b.editorCopyDoc=i0,b.editorDeleteBlock=nC,b.editorDeleteBlockText=tC,b.editorDeleteBlockWithoutChildren=Xm,b.editorDeleteChildContainer=T_,b.editorDeleteChildContainers=W3,b.editorFocusToBlock=iC,b.editorFocusToEnd=j_,b.editorGetBlockData=Xs,b.editorGetBlockText=Yn,b.editorGetBlockTextEx=$m,b.editorGetBoxData=b3,b.editorHandleKeyboardEvent=oy,b.editorInsertBlock=Wc,b.editorInsertBoxToBlock=H3,b.editorInsertDoc=t5,b.editorInsertDocAt=lC,b.editorInsertText=J1,b.editorInsertTextToBlock=$3,b.editorInsertTextToBlockEx=Q1,b.editorMergeTextBlock=q3,b.editorMoveDown=g5,b.editorMoveEnd=mC,b.editorMoveHome=T5,b.editorMoveLeft=d5,b.editorMoveLineEnd=_5,b.editorMoveLineHome=D5,b.editorMovePageDown=F5,b.editorMovePageUp=P5,b.editorMoveRight=h5,b.editorMoveUp=m5,b.editorMoveWordEnd=v5,b.editorMoveWordLeft=b5,b.editorRangeClearColor=i5,b.editorRangeGetColor=s5,b.editorRangeSetColor=r5,b.editorRemoveTextAttribute=S_,b.editorReplaceBlockText=Jm,b.editorReplaceContainer=e5,b.editorRunOnce=kC,b.editorSelectAll=pC,b.editorSelectContainer=e0,b.editorSelectDown=p5,b.editorSelectEnd=gC,b.editorSelectHome=k5,b.editorSelectLeft=C5,b.editorSelectLineEnd=I5,b.editorSelectLineHome=L5,b.editorSelectPageDown=$5,b.editorSelectPageUp=V5,b.editorSelectRight=E5,b.editorSelectUp=A5,b.editorSelectWordEnd=y5,b.editorSelectWordLeft=B5,b.editorSetTextColor=Xc,b.editorShowFindDialog=AW,b.editorToDocx=Stt,b.editorUpdateBlockData=Zm,b.editorUpdateCompositionText=j3,b.editorUpdateEmbedData=J3,b.enablePageScroll=zp,b.escapeHtmlText=hm,b.escapeRegExp=Jp,b.escapeSpace=tI,b.exclusiveBlock=SA,b.executeBlockCommand=Yv,b.executeEmbedBlockCommand=Xv,b.executeRangeCommand=By,b.fileToDataUrl=_c,b.findAfterOffsetNotType=H1,b.findAllText=CC,b.findBlockByIndex=kv,b.findEventTargetBlock=jb,b.findInsertionById=Fv,b.findNextOffset=q8,b.findNextVisibleSimpleBlock=wy,b.findPrevOffset=W8,b.findPrevOffsetNotType=$1,b.findPrevSimpleBlockBeforeChildContainer=hB,b.findPrevVisibleSimpleBlock=Ry,b.findTarget=Dc,b.findWordEnd=z1,b.findWordLeft=j1,b.format=kf,b.formatBytes=mv,b.formatDate=Yp,b.fragmentToHtml=lv,b.fromBase64=vf,b.fromBase64ToBlob=$p,b.fromBase64ToUint8Array=fI,b.fromDocRange=el,b.fromNowString=Qp,b.genId=it,b.generateEditorContainerId=Zp,b.getAllChildBlocks=v1,b.getAllQuickMenuItems=iA,b.getAllSelectedBlocks=Ji,b.getAttributesAt=$c,b.getBlockBackground=r1,b.getBlockByIndex=Qo,b.getBlockCaretRect=Zo,b.getBlockClass=le,b.getBlockClassByType=la,b.getBlockClientRects=Fs,b.getBlockCommandsWithHook=u1,b.getBlockContent=zt,b.getBlockHeading=If,b.getBlockId=ut,b.getBlockIndex=Rt,b.getBlockInfo=Hd,b.getBlockKind=Ci,b.getBlockMinWidth=Hv,b.getBlockNearestRangeFromPoint=x1,b.getBlockOptions=_I,b.getBlockPath=tl,b.getBlockProperties=Gv,b.getBlockRangeFromPoint=wm,b.getBlockStyles=DI,b.getBlockTextLength=Ct,b.getBlockTools=be,b.getBlockType=Ot,b.getBoxContent=s1,b.getBoxId=Ov,b.getBoxTypeFromElement=Lf,b.getChildBlockCount=qi,b.getChildBlocks=ke,b.getChildOffset=nl,b.getColorFromAttributes=R1,b.getColorFromContent=vm,b.getComplexBlockClass=Hr,b.getContainerBlockPath=eB,b.getContainerBlocks=yv,b.getContainerBlocksElement=wf,b.getContainerById=pi,b.getContainerId=pt,b.getContainerMinWidth=m1,b.getContainerToolsElement=SI,b.getContainerWidth=oB,b.getDistanceSquare=Xo,b.getElementFromPoint=Pe,b.getElementOffset=Af,b.getElementScale=$r,b.getEmbedType=on,b.getExistsBlockTools=Bm,b.getExistsContainerById=Rf,b.getFileExt=Tf,b.getFirstChildBlock=_e,b.getFirstClientRect=am,b.getHeadingBlockChildren=Oc,b.getHeadingMenuOptions=tA,b.getHorizontalPadding=Up,b.getInsertionContent=o1,b.getLastChildBlock=Ge,b.getLastClientRect=ea,b.getListAllNextBrothers=mu,b.getLogger=D,b.getNextBlock=ae,b.getNextHiddenBlocks=Zv,b.getNextValidOffset=ma,b.getNextVisibleBlock=zr,b.getOffsetFromPoint=Mp,b.getOffsetInfoAfter=Vf,b.getOffsetInfoBefore=Hm,b.getOpAt=HB,b.getOpLength=Sm,b.getParentBlock=et,b.getParentBlockExcludeSelf=ca,b.getParentBox=i1,b.getParentContainer=at,b.getPrevBlock=He,b.getPrevValidOffset=rl,b.getPrevVisibleBlock=jr,b.getRangeCommands=by,b.getReferenceClientRect=lk,b.getRootBlock=c1,b.getScrollContainer=mn,b.getSpecialBlockCommands=Wv,b.getStandardEmbedBlockProperties=ix,b.getTextAfterOffset=z8,b.getTextAttributes=Y1,b.getTextBeforeOffset=G8,b.getTextBlockChild=Mf,b.getTextBlockClass=wv,b.getTextBlockContentChildTextLength=Wr,b.getTextBlockContentChildType=tB,b.getTextBlockContentChildren=Yi,b.getTextLength=Vn,b.getTextOpLength=B1,b.getTextWidth=Cm,b.getToolbar=z0,b.handleBlockElementUpdated=jv,b.hasAltOnly=oI,b.hasClass=Mt,b.hasCtrlOrCmd=nv,b.hasCtrlOrCmdOnly=sI,b.hashCode=bv,b.hideBlock=_v,b.hideTemplates=hS,b.htmlToFragment=pm,b.i18n=_,b.includeBigTable=pN,b.injectDocToHtmlFragment=Yf,b.injectStyle=Wb,b.inputActions=uM,b.insertEmptyBlock=OI,b.insertEmptyEmbedBlock=f1,b.insertText=Gs,b.intersectionCommands=HM,b.isBackspace=iv,b.isBlock=aa,b.isBlockLocked=pg,b.isBlockLockedByOthers=IA,b.isBlockLockedBySelf=jd,b.isBlockTools=Dv,b.isBox=ym,b.isBoxOp=Hs,b.isCJK=tv,b.isChildContainer=gi,b.isChildNode=Ce,b.isCodeBlock=Di,b.isCollapsedHeadingBlock=Xi,b.isCollapsedRange=R8,b.isComplexBlockPosition=da,b.isComplexKindBlock=Pt,b.isContainer=Yo,b.isContainerSelectedAllChildBlocks=H5,b.isControlEvent=sa,b.isDelete=aI,b.isDraggingFiles=Em,b.isElementVisible=fm,b.isEmbedBlock=Le,b.isEmptyContainer=Uf,b.isEmptyDoc=K1,b.isEmptyTextBlock=ve,b.isEmptyTextBlockWithoutCompositionText=Ud,b.isEnterOnly=rv,b.isEscape=gm,b.isExclusiveBlock=$d,b.isExpandedHeadingBlock=Jv,b.isFirefox=Cf,b.isFirstChildBlockInComplexBlock=p7,b.isHeadingBlock=Ln,b.isHighSurrogate=Y9,b.isInBlock=l1,b.isInBlockTools=Uc,b.isLetter=Zb,b.isLowSurrogate=Q9,b.isMatchShortcut=Gi,b.isMoveForward=rI,b.isNavigationEvent=nI,b.isNavigationKey=ev,b.isNodeRemoved=Ef,b.isNumber=Jb,b.isPrintableKey=Kp,b.isRootBlock=Gr,b.isRootContainer=re,b.isSafari=Zl,b.isSameDay=Xp,b.isSelectBoxOnly=ti,b.isShiftEnter=lI,b.isShiftTab=uI,b.isShortcutEvent=iI,b.isSimpleBlock=II,b.isSimpleBlockPosition=xi,b.isSimplePos=C3,b.isSimpleRange=Fm,b.isSpace=mm,b.isTab=cI,b.isTextBlockContentBoxChild=Br,b.isTextBlockContentChild=Df,b.isTextBlockContentInsertionChild=Vs,b.isTextBlockContentTextChild=_f,b.isTextKindBlock=ot,b.isTextKindBlockType=Sf,b.isTitleBlock=Ps,b.isToday=gv,b.isValidOffset=or,b.isVisibleBlock=Jo,b.isYesterday=pv,b.loadJs=Hb,b.loadJsPromise=na,b.lockers=mi,b.mergeCommands=j0,b.mergeDocs=Ca,b.mergeOps=P1,b.mergeText=B8,b.multiSplitText=zB,b.overflowText=Cv,b.parseShortcut=sv,b.patchNode=Bf,b.pointInRect=ia,b.rangeAddAttribute=Pf,b.rangeGetTextColor=JB,b.rangeRemoveAttribute=Vc,b.rangeSetTextColor=XB,b.rangeTransformText=WB,b.registerDragDrop=Pp,b.removeAttribute=k1,b.removeClass=ct,b.removeLastBr=A8,b.removePlaceholderFromBlock=DR,b.removeStyle=Gb,b.replaceAll=bI,b.replaceAllCaseInsensitive=vI,b.replaceAllText=z5,b.replaceText=Nm,b.requestDownload=Am,b.resetListStart=pu,b.scrollIntoView=Hf,b.scrollable=dv,b.selectFile=Mc,b.selectedBlockToDoc=n0,b.selectionToDoc=Yc,b.setAttributes=um,b.setClipboardData=yf,b.setClipboardDataByEvent=mI,b.setColorToAttributes=YB,b.setDataset=Op,b.setDefaultCursor=bf,b.setStyles=Np,b.shareDBCommentToDocObject=zC,b.shareDBDocCommentToComment=aT,b.shortcutToDisplayText=hn,b.showBlock=n1,b.showDocVersions=_tt,b.showTemplates=px,b.splitText=sr,b.splitToThree=ln,b.stringToDataUrl=Hp,b.stringToObjectUrl=Gp,b.subText=GB,b.textNodeOffsetFromPoint=$b,b.titleFromEditor=pS,b.toBase64URL=Wi,b.toMindmap=Q0,b.toPlainText=Re,b.toPlainTextKeepLength=V1,b.trimChar=Fp,b.unexclusiveBlock=LA,b.unicodeLength=J9,b.unicodeSubstr=Z9,b.updateBlockSelection=$v,b.updateOpAttributes=g3,b.updateTextBlockContent=j8,b.updateUrl=Vp;for(const n in Ve)n!=="default"&&!b.hasOwnProperty(n)&&Object.defineProperty(b,n,{enumerable:!0,get:()=>Ve[n]});Object.defineProperties(b,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
963
+ \`\`\`\`\`\``}return""}const qJ={embedType:"plantuml",convertFrom:zJ,handleUpdateBlock:jJ,createEmbedContent:HJ,getBlockProperties:GJ,convertTo:WJ},tct="",XJ="hr",YJ={dividingLine:{type:"\u5206\u5272\u7EBF",abstract:"\u5206\u5272\u7EBF"}},QJ={dividingLine:{type:"Dividing-Line",abstract:"Dividing-Line"}},JJ={dividingLine:{type:"\u533A\u5207\u308A\u7DDA",abstract:"\u533A\u5207\u308A\u7DDA"}};_.mergeLang({"zh-CN":YJ,"en-US":QJ,"ja-JP":JJ});function ZJ(n,t){const e=B("div",["editor-embed-container"],t);B("hr",["editor-embed-hr"],e)}function tZ(n,t,e,r){return r==="html"?"<hr />":r==="markdown"?"---":"------------"}function eZ(){return{name:"hr",insertEmbedCommandItems:[{id:"insert-hr",name:_.t("dividingLine.type"),icon:jT,order:500,group:"common",subText:Qn("insert-hr")}],handleInsertEmptyEmbed:async(n,t)=>{const{containerId:e,blockIndex:r}=t;return n.insertEmbed(e,r,XJ,{})}}}function nZ(n,t,e){const{data:r}=e;if(!r||r.embedType!=="dividing-line"||!ot(n,t))return null;const i={};return{blockData:{id:it(),type:"embed",embedType:"hr",embedData:i}}}function rZ(){return{abstract:_.t("dividingLine.abstract")}}const iZ={embedType:"hr",createEmbedContent:ZJ,convertTo:tZ,getOptions:eZ,convertFrom:nZ,getBlockProperties:rZ},ect="",nct="",sZ={media:{upload:{failed:'<div class="line-1">{name}\u4E0A\u4F20\u5931\u8D25</div><div class="line-2">\u7F51\u7EDC\u670D\u52A1\u5F02\u5E38\uFF0C\u4F60\u53EF\u4EE5 <span class="retry-upload">\u91CD\u8BD5</span></div>',maxSizeFailed:'<div class="line-1">{name}\u4E0A\u4F20\u5931\u8D25</div><div class="line-2">\u6587\u4EF6\u5927\u5C0F\u8D85\u8FC7\u9650\u5236\uFF0C\u8BF7\u91CD\u65B0\u9009\u62E9\u6587\u4EF6</div>'},load:{failed:'<div class="line-1">{name}\u52A0\u8F7D\u5931\u8D25</div><div class="line-2">\u7F51\u7EDC\u670D\u52A1\u5F02\u5E38\uFF0C\u4F60\u53EF\u4EE5 <span class="retry-upload">\u91CD\u8BD5</span></div>'},audio:{menuItem:"\u97F3\u9891",abstract:"\u97F3\u9891"},video:{menuItem:"\u89C6\u9891",abstract:"\u89C6\u9891"}}},oZ={media:{upload:{failed:'<div class="line-1">{name} upload failed</div><div class="line-2">Network error, you can <span class="retry-upload">Retry</span></div>',maxSizeFailed:'<div class="line-1">{name} upload failed</div><div class="line-2">The file size exceeds limit. Please choose another file.</div>'},load:{failed:'<div class="line-1">{name} loading failed</div><div class="line-2">Network error, you can <span class="retry-upload">Retry</span></div>'},audio:{menuItem:"Audio",abstract:"Audio"},video:{menuItem:"Video",abstract:"Video"}}},lZ={media:{upload:{failed:'<div class="line-1">{name}\u306E\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u306B\u5931\u6557\u3057\u307E\u3057\u305F</div><div class="line-2">\u304A\u4F7F\u3044\u306E\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF\u63A5\u7D9A\u306B\u554F\u984C\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002\u6B21\u306E\u64CD\u4F5C\u3092\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002 <span class="retry-upload">\u518D\u8A66\u884C</span></div>',maxSizeFailed:'<div class="line-1">{name}\u306E\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u306B\u5931\u6557\u3057\u307E\u3057\u305F</div><div class="line-2">\u30D5\u30A1\u30A4\u30EB\u306E\u30B5\u30A4\u30BA\u304C\u4E0A\u9650\u3092\u8D85\u3048\u3066\u3044\u308B\u305F\u3081\u3001\u4ED6\u306E\u30D5\u30A1\u30A4\u30EB\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044</div>'},load:{failed:'<div class="line-1">{name}\u3092\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093\u3067\u3057\u305F</div><div class="line-2">\u304A\u4F7F\u3044\u306E\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF\u63A5\u7D9A\u306B\u554F\u984C\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002\u6B21\u306E\u64CD\u4F5C\u3092\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002 <span class="retry-upload">\u518D\u8A66\u884C</span></div>'},audio:{menuItem:"\u97F3\u58F0",abstract:"\u97F3\u58F0"},video:{menuItem:"\u52D5\u753B",abstract:"\u52D5\u753B"}}};_.mergeLang({"zh-CN":sZ,"en-US":oZ,"ja-JP":lZ});var Ui=(n=>(n.AUDIO="audio",n.VIDEO="video",n))(Ui||{}),lh=(n=>(n.Empty="empty",n.Progress="progress",n.Error="error",n))(lh||{});const US=10*1024*1024,aZ=["wav","mp3","aac","ogg","webm","flac"],cZ=["ogg","mp4","webm"],uZ=()=>{};function OS(n){var h,C,E,A,v,w;const t=(h=n.getComponentOptions("media"))!=null?h:{},{allowedMedias:e,maxSize:r,callbacks:i}=t,s=(C=e==null?void 0:e.audio)!=null?C:aZ,o=(E=e==null?void 0:e.video)!=null?E:cZ,l=(A=r==null?void 0:r.audio)!=null?A:US,c=(v=r==null?void 0:r.video)!=null?v:US,d=(w=i==null?void 0:i.onError)!=null?w:uZ;return{allowedMedias:{audio:s,video:o},maxSize:{audio:l,video:c},callbacks:{onError:d}}}function fZ(n,t){const e=s=>s.map(o=>`.${o}`).join(","),{allowedMedias:r}=OS(n),i=r[t];return i?e(i):"*"}function dZ(n,t,e){const{maxSize:r,callbacks:i,allowedMedias:s}=OS(t),{[e]:o}=r,{[e]:l}=s;if(o&&n.size>o){const d=new Error("media is too large");throw d.code=`MaxMediaSize-${e}`,i!=null&&i.onError&&(i==null||i.onError(t,d)),d}const c=Tf(n.name);if(l&&!l.includes(c.toLowerCase())){const d=new Error(`media file is not allowed: ${c}`);throw d.code="NotAllowedFile",i!=null&&i.onError&&(i==null||i.onError(t,d)),d}}function hZ(n){return n===lh.Empty||n===lh.Error}const En=D("media");class mZ extends Ve.TypedEmitter{constructor(e){super();m(this,"mediaContainer",null);m(this,"media",null);m(this,"abstract",null);m(this,"handleMediaLoadError",(e,r)=>{if(!r.target||!(r.target instanceof Node)||!(r.target instanceof Element?r.target:r.target.parentElement))return;const s=et(r.target);if(!s||!s.contains(this.mediaContainer))return;const o=this.renderError();this.updateMediaContent(o),this.emit("mediaError",e,"load_error",ut(s))});m(this,"handleUploadFile",async e=>{p(En,this.abstract,"no abstract"),p(En,this.mediaContainer,"The media element not exist");const{editor:r}=this.options,i=et(this.mediaContainer);p(En,i,"The block element not exist");const s=r.getBlockData(i);try{const{resourceId:o}=await r.doc.uploadResource(e,{onProgress:C=>{this.renderProgress(C,e)}}),{name:l,type:c,size:d}=e,h={...s,embedData:{...s.embedData,src:o,fileName:l,fileSize:d,fileType:c}};r.updateBlockData(i,h)}catch(o){En.error(o),this.emit("mediaError",r,"upload_error",s.id),this.renderRetry(e,o)}ct(i,"media-block-uploading")});m(this,"destroy",()=>{this.mediaContainer=null});this.options=e}bindMediaEvent(){const{editor:e}=this.options;this.media&&e.domEvents.addEventListener(this.media,"error",this.handleMediaLoadError)}unbindMediaEvent(){const{editor:e}=this.options;this.media&&e.domEvents.removeEventListener(this.media,"error",this.handleMediaLoadError)}updateMediaContent(e){p(En,this.mediaContainer,"The media element not exist"),this.mediaContainer.innerHTML="",this.mediaContainer.append(e)}renderError(){p(En,this.abstract,"no abstract");const{editor:e,createMediaElement:r}=this.options,{mediaIcon:i,mediaName:s}=this.abstract;p(En,this.mediaContainer,"The media element not exist");const o=et(this.mediaContainer);p(En,o,"The block element not exist");const l=e.getBlockData(o),c=B("div",["media-error","embed-selected-content","embed-hover-content"],null),d=B("span",["media-error-icon"],c);d.innerHTML=i;const h=B("div",[],c);h.innerHTML=_.t("media.load.failed",{name:s}),c.appendChild(h);const C=h.querySelector(".retry-upload");return p(En,C,"The element not exist"),e.domEvents.addEventListener(C,"click",(E,A)=>{const v=B("div",["media-element"],null),w=this.getResourceUrl(l),S=r(E,v,l,w);this.unbindMediaEvent(),this.media=S,this.bindMediaEvent(),this.updateMediaContent(v)}),this.setFullScreen(),c}renderRetry(e,r){var E,A;p(En,this.abstract,"no abstract");const{editor:i}=this.options,{mediaIcon:s,mediaName:o}=this.abstract,l=B("div",["media-error","embed-selected-content","embed-hover-content"],null),c=B("span",["media-error-icon"],l);c.innerHTML=s;const d=B("div",[],l);let h=_.t("media.upload.failed",{name:o});(((E=r.response)==null?void 0:E.status)===420||((A=r.response)==null?void 0:A.status)===413)&&(h=_.t("media.upload.maxSizeFailed",{name:o})),d.innerHTML=h,l.appendChild(d);const C=d.querySelector(".retry-upload");C&&i.domEvents.addEventListener(C,"click",()=>{i.readonly||(p(En,this.abstract,"no abstract"),this.handleUploadFile(e))}),this.updateMediaContent(l),this.setFullScreen()}renderProgress(e,r){p(En,this.mediaContainer,"The media element not exist");const i=this.mediaContainer.querySelector(":scope .media-progress"),s=e===-1||e===100?100:e;if(i){const{updateProgressElement:o}=this.options;o(i,s)}else{const{createProgressElement:o}=this.options,l=et(this.mediaContainer);p(En,l,"The element not exist"),q(l,"media-block-uploading");const c=B("div",["media-progress"],null);o(c,s,r),this.updateMediaContent(c)}this.setFullScreen()}renderMediaElement(e,r){p(En,this.mediaContainer,"The media element not exist");const i=this.mediaContainer.querySelector(":scope > .media-element"),{createMediaElement:s,updateMediaElement:o,editor:l}=this.options,c=this.getResourceUrl(e,r);if(i){const d=o(l,i,e,c);this.unbindMediaEvent(),this.media=d,this.bindMediaEvent()}else{const d=B("div",["media-element"],null),h=s(l,d,e,c);this.unbindMediaEvent(),this.media=h,this.bindMediaEvent(),this.updateMediaContent(d)}}renderEmpty(e){p(En,this.abstract,"no abstract"),p(En,this.mediaContainer,"The media element not exist");const r=B("div",["media-empty","embed-selected-content","embed-hover-content"],this.mediaContainer);r.innerHTML=this.abstract.mediaIcon,this.updateMediaContent(r);const{editor:i}=this.options;i.findBlockById(e.id)&&this.emit("mediaError",i,"empty",e.id),this.setFullScreen()}getResourceUrl(e,r){const{src:i}=e.embedData,{editor:s}=this.options;return s.doc.buildResourceUrl(i,{syncNewResources:async(o,l)=>{var d,h;if(!r)return;await s.doc.addResources([o]);const c=(h=(d=s.doc).getServerMeta)==null?void 0:h.call(d).appId;if(l!==e.embedData.src&&c&&e.embedData.src.includes(c)){const C=et(r);if(C&&!s.readonly&&s.isBlockWritable(C)){const E=Et.default(e);E.embedData.src=o,s.updateBlockData(C,E)}}}})}setFullScreen(){p(En,this.mediaContainer,"The media element not exist"),q(this.mediaContainer,"full-screen")}removeFullScreen(){p(En,this.mediaContainer,"The media element not exist"),ct(this.mediaContainer,"full-screen")}updateBlockAlign(e,r){const i=et(r);p(En,i,"The block element not exist");const{align:s}=e;e.embedType==="video"&&(i.hasAttribute("data-style-align")&&i.removeAttribute("data-style-align"),i.setAttribute("data-style-align",s))}render(e,r){const{src:i}=e.embedData;(!this.mediaContainer||!r.contains(this.mediaContainer))&&(this.mediaContainer=B("div",["media"],r)),this.updateBlockAlign(e,r),hZ(i)?i===lh.Empty&&this.renderEmpty(e):this.renderMediaElement(e,r)}setAbstract(e){this.abstract=e}}D("media-embed");const gZ="left";class NS{constructor(){m(this,"handleInsertEmptyEmbed",async(t,e)=>{var C;const{containerId:r,blockIndex:i}=e;let s;(C=e.data)!=null&&C.file&&(s=e.data.file);const o=fZ(t,this.embedType);if(s=s!=null?s:await Mc(o,{}),!s)return null;const{mediaType:l}=this.getAbstract();try{dZ(s,t,l)}catch{return null}const c={id:it(),type:"embed",embedType:this.embedType,embedData:{src:lh.Empty}};l==="video"&&(c.align=gZ);const d=t.insertBlock(r,i,c);return await this.getMedia(t,c.id).handleUploadFile(s),d})}getMedia(t,e){const r=t.addCustom(`media-${e}`,()=>new mZ({editor:t,createMediaElement:this.createMediaElement,updateMediaElement:this.updateMediaElement,createProgressElement:this.createProgressElement,updateProgressElement:this.updateProgressElement}));return r.setAbstract({...this.getAbstract()}),r}getOptions(){const{menuItem:t,mediaIcon:e,mediaName:r,order:i,group:s}=this.getAbstract();return{name:r,insertEmbedCommandItems:[{id:`insert-${this.embedType}`,name:t,icon:e,order:i,group:s,subText:Qn(`insert-${this.embedType}`)}],handleInsertEmptyEmbed:this.handleInsertEmptyEmbed}}createEmbedContent(t,e,r){const{id:i}=r;this.getMedia(t,i).render(r,e)}handleUpdateBlock(t,e,r){const{id:i}=r,s=this.getMedia(t,i),o=zt(e);return s.render(r,o),!0}handleDeleteBlock(t,e){const r=e.id,i=this.getMedia(t,r);i.removeAllListeners(),i.destroy()}convertTo(t,e,r,i){const s=e.embedData,o=t.doc.buildResourceUrl(s.src,{withToken:!0});return i==="html"?`<${s.type} src="${o}" />`:i==="markdown"?`![${s.src}](${o})`:o}}function PS(n,t){const e=B("div",["uploading-progress-mask"],n),r=B("div",["uploading-progress-bar"],e),i=B("div",["uploading-progress-bar-value"],r);i.style.width=`${t}%`}function FS(n,t){const e=n.querySelector(".uploading-progress-bar-value");e&&(e.style.width=`${t}%`)}const pZ=D("media-audio");class CZ extends NS{constructor(){super(...arguments);m(this,"embedType",Ui.AUDIO);m(this,"updateProgressElement",FS);m(this,"createMediaElement",(e,r,i,s)=>{const o=B("div",["audio-container","embed-hover-content","embed-selected-content"],r),l=B("audio",[],o);return l.innerHTML="Your browser does not support the <code>audio</code> element.",l.controls=!0,l.src=s,setTimeout(()=>{this.getMedia(e,i.id).setFullScreen()}),l})}getAbstract(){return{mediaIcon:VT,mediaName:_.t(`media.${Ui.AUDIO}.menuItem`),menuItem:_.t(`media.${Ui.AUDIO}.menuItem`),order:800,mediaType:Ui.AUDIO,group:"common"}}getBlockProperties(){return{abstract:`${_.t(`media.${Ui.AUDIO}.abstract`)}`}}updateMediaElement(e,r,i,s){const o=r.querySelector(":scope .audio-container > audio");return p(pZ,o,"The media element not exist"),o.src!==s&&(o.src=s),o}createProgressElement(e,r){const i=B("audio",[],e);i.innerHTML="Your browser does not support the <code>audio</code> element.",i.controls=!0,i.src="about:blank",PS(e,r)}}const EZ=new CZ;D("video-resizer");function KS(n){return n&&Le(n)&&on(n)==="video"}const AZ=50;class kx{constructor(t){m(this,"currentResizableElement",null);m(this,"resizing",!1);m(this,"handleHoveringBlockChange",(t,e)=>{if(!this.resizing&&!window.isDragging&&(e&&KS(e)&&this.disableBlockResize(e),t&&KS(t)&&this.editor.isBlockWritable(t))){const r=this.getVideoElement(t);if(!r)return;this.enableBlockResize(t,r)}});m(this,"handleResizing",(t,e)=>{if(this.resizing=!0,!this.currentResizableElement)return;const r=t.getBlock();if(!r)return;const i=r.getBoundingClientRect().width,s=Math.min(Math.max(e.width,AZ),i);this.currentResizableElement.style.width=`${s}px`,this.currentResizableElement.style.pointerEvents="none"});m(this,"handleResized",t=>{this.resizing=!1;const e=t.getBlock();if(!this.currentResizableElement||!e)return;const r=this.editor.getBlockData(e),{width:i}=this.currentResizableElement.getBoundingClientRect();this.currentResizableElement.style.pointerEvents="auto",this.editor.updateBlockData(e,{...r,width:i})});this.editor=t,$e.get(t).addListener("change",this.handleHoveringBlockChange)}destroy(){this.currentResizableElement=null,$e.get(this.editor).removeListener("change",this.handleHoveringBlockChange)}getVideoElement(t){return zt(t).querySelector(":scope .video-container > video")}updateResizer(t){const e=this.editor.findCustom(`${ut(t)}-resizer`);e&&e.updateResizer()}disableBlockResize(t){const e=this.editor.findCustom(`${ut(t)}-resizer`);e&&e.disableResize()}enableBlockResize(t,e){const r=this.editor.addCustom(`${ut(t)}-resizer`,()=>new Pd(this.editor,{resize:["top-left","top-right","bottom-left","bottom-right"]}));r.enableResize(t,e),r.removeListener("resizing",this.handleResizing),r.removeListener("resized",this.handleResized),r.addListener("resizing",this.handleResizing),r.addListener("resized",this.handleResized),this.currentResizableElement=e}}const xZ=D("video");class bZ extends NS{constructor(){super(...arguments);m(this,"embedType",Ui.VIDEO);m(this,"updateProgressElement",FS);m(this,"createMediaElement",(e,r,i,s)=>{const o=B("div",["video-container","embed-selected-content","drag-preview-element"],r),l=B("video",[],o);return l.innerHTML="Your browser does not support the <code>video</code> element.",l.controls=!0,l.src=s,l.addEventListener("canplay",()=>{e.addCustom("video-resizer",()=>new kx(e)),this.getMedia(e,i.id).removeListener("mediaError",this.handleMediaError),this.getMedia(e,i.id).addListener("mediaError",this.handleMediaError),this.getMedia(e,i.id).removeFullScreen()}),i.width&&(l.style.width=`${i.width}px`),l});m(this,"createProgressElement",(e,r,i)=>{const s=B("video",["progress-video"],e);s.innerHTML="Your browser does not support the <code>audio</code> element.",s.controls=!0,PS(e,r),_c(i).then(o=>{const l=e.querySelector(".progress-video");l&&l1(e)&&(l.src=o)})})}getAbstract(){return{mediaName:_.t(`media.${Ui.VIDEO}.menuItem`),mediaIcon:$T,menuItem:_.t(`media.${Ui.VIDEO}.menuItem`),order:700,mediaType:Ui.VIDEO,group:"common"}}getBlockProperties(){return{abstract:`${_.t(`media.${Ui.VIDEO}.abstract`)}`}}handleMediaError(e,r,i){const s=e.addCustom("video-resizer",()=>new kx(e)),o=e.getBlockById(i);s.disableBlockResize(o)}updateMediaElement(e,r,i,s){const o=r.querySelector(":scope .video-container > video");p(xZ,o,"The media element not exist"),o.src!==s&&(o.src=s),i.width?o.style.width=`${i.width}px`:o.style.width="";const l=e.getBlockById(i.id);return setTimeout(()=>{e.addCustom("video-resizer",()=>new kx(e)).updateResizer(l)}),o}}const vZ=new bZ,VS=[uA,EA,AA,Dk],Rx=[LS,vQ,IJ,KJ,qJ,NK,iZ,vZ,EZ,_z,lS,gX],$S=[jk,uS,_4];function BZ(n,t,e){var i,s,o,l;hi.level=(i=e.logLevel)!=null?i:qo.DEBUG;const r=Zf(n,t,{components:{blocks:[...VS,...((s=e==null?void 0:e.components)==null?void 0:s.blocks)||[]],embeds:[...Rx,...((o=e.components)==null?void 0:o.embeds)||[]],boxes:[...$S,...((l=e.components)==null?void 0:l.boxes)||[]],textRenders:[new WE],options:{...e.componentsOptions}}});return r.readonly=!0,r.addCustom("heading-collapse",()=>new fx(r)),r.addCustom("editor-tooltip",()=>new Ld(r)),r.addListener("clickLink",(c,d,h)=>{var E;if((E=e==null?void 0:e.events)!=null&&E.onClickLink){e.events.onClickLink(c,d,h);return}const C=h.getAttribute("link");C&&(c.readonly||d.ctrlKey||d.metaKey)&&window.open(C,"_blank")}),r}class HS{constructor(t){this.createOptions=t,t.lang&&_.setLang(t.lang)}createHistoryEditor(t,e){return BZ(t,e,this.createOptions)}}function jS(n,{root:t,childDoc:e,doc:r}){var h,C;e.uploadResource=r.uploadResource.bind(r),e.buildResourceUrl=r.buildResourceUrl.bind(r);const i=n.getComponentOptions("comment"),s={image:{defaultAlign:"left"},table:{locatingContainer:t,hideCellMenu:!0,hideToolbar:!0},...i==null?void 0:i.componentsOptions},o=[];n.editorBlocks.forEach(E=>{E.blockType==="text"||E.blockType==="embed"||o.push(E)});const l=[];n.editorEmbeds.forEach(E=>{l.push(E)});const c=[];n.editorBoxes.forEach(E=>{E.boxType==="text"||E.boxType==="br"||E.boxType==="image"||E.boxType==="anchor"||c.push(E)});const d=Zf(t,e,{shortcuts:[s0],components:{blocks:o,commandProviders:[new P0],decorators:[new fg],embeds:l,boxes:c,options:s}});if(d.input.addHandler(new hg),d.input.addHandler(new PA(d)),d.input.addHandler(new jA(d)),d.input.addHandler(new Tq(d)),d.input.addHandler(new Cg),d.addCustom("image-paste-handler",()=>new NA(d)),xe.isMobile||d.addCustom("editor-tooltip",()=>new Ld(d)),n.options.enableContextMenu!==!1&&d.addCustom("editor-context-menu",E=>new WA(E)),(h=n.options.componentsOptions)!=null&&h.mention){const E=n.options.componentsOptions.mention;d.addCustom("mention",()=>new cS(d,{...E}))}if((C=n.options.componentsOptions)!=null&&C.comment){const E=n.options.componentsOptions.comment;E.onCommentEditorClick&&d.addListener("click",E.onCommentEditorClick)}return d}function yZ(n,t){const e=Array.from(n.rootContainer.querySelectorAll(`[comment-${t.toLocaleLowerCase()}="${t}"]`)),r=new Set;e.forEach(i=>{const s=et(i);s&&r.add(s)}),r.forEach(i=>{kq(n,i,t)})}class TZ{constructor(t){m(this,"listeners",new Set);m(this,"doc");this.editor=t,this.doc=this.editor.doc.externalDoc,this.doc.registerCallback(this)}getComments(){return this.doc.getComments()}getComment(t){return this.doc.getComment(t)}getCommentDoc(t){return this.doc.getCommentDoc(t)}localCreateComment(t,e){this.doc.localCreateComment(t,e)}localDeleteComment(t){const e=this.getComment(t);this.doc.localDeleteComment(t);const r=e.groupId;this.getComments().filter(s=>s.groupId===r).length===0&&yZ(this.editor,r)}localUpdateComment(t,e){this.doc.localUpdateComment(t,e)}onCreateComment(t,e){Array.from(this.listeners.values()).forEach(r=>r.onCreateComment(t,e))}onDeleteComment(t,e){Array.from(this.listeners.values()).forEach(r=>r.onDeleteComment(t,e))}onUpdateComment(t,e){Array.from(this.listeners.values()).forEach(r=>r.onUpdateComment(t,e))}addListener(t){this.listeners.add(t)}removeListener(t){this.listeners.delete(t)}createCommentEditor(t,e){return jS(this.editor,{root:t,childDoc:e,doc:this.doc})}allowEdit(t){return t.userId===this.doc.getUser().userId}}class kZ{constructor(t,e){m(this,"listeners",new Set);this.editor=t,this.localDoc=e}get doc(){return this.localDoc.toJSON()}getComments(){return Object.values(this.doc.comments)}getComment(t){return this.doc.comments[t]}getCommentDoc(t){const e=this.doc.comments[t];return zC(e)}addListener(t){this.listeners.add(t)}removeListener(t){this.listeners.delete(t)}localCreateComment(t,e){}localDeleteComment(t){}localUpdateComment(t,e){}createCommentEditor(t,e){return jS(this.editor,{root:t,childDoc:e,doc:this.localDoc})}allowEdit(t){return t.userId===this.localDoc.getUser().userId}}const RZ={placeholder:{common:{title:"\u8BF7\u8F93\u5165\u6807\u9898",readonlyTitle:"\u8BF7\u8F93\u5165\u6807\u9898",content:"\u70B9\u51FB + \uFF0C\u6216\u8F93\u5165 / \u5FEB\u6377\u63D2\u5165\u7EC4\u4EF6",contentInTable:"\u8F93\u5165 / \u5FEB\u6377\u63D2\u5165\u7EC4\u4EF6"},local:{readonlyTitle:"\u672A\u547D\u540D"}},copyCutProperty:{copy:"\u590D\u5236",cut:"\u526A\u5207",unsafeEnvTips:"\u7531\u4E8E\u5F53\u524D http \u8BBF\u95EE\u73AF\u5883\u4E0B\u7684\u9650\u5236\uFF0C\u8BF7\u4F7F\u7528\u5FEB\u6377\u952E({shortCut}) {operation}",limitedEnvTips:"\u7531\u4E8E\u6D4F\u89C8\u5668\u9650\u5236\uFF0C\u8BF7\u4F7F\u7528 {shortCut} \u7C98\u8D34"}},wZ={placeholder:{common:{title:"Enter a title",readonlyTitle:"Enter a title",content:'Click "+", or enter "/" to insert components quickly',contentInTable:'Enter "/" to insert components quickly'},local:{readonlyTitle:"Untitled"}},copyCutProperty:{copy:"Copy",cut:"Cut",unsafeEnvTips:"Due to the limitations of the current http access environment, please use the shortcut ({shortCut}) {operation}",limitedEnvTips:"Press {shortCut} to paste due to browser restrictions"}},SZ={placeholder:{common:{title:"\u30BF\u30A4\u30C8\u30EB\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044",readonlyTitle:"\u30BF\u30A4\u30C8\u30EB\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044",content:"\u300C+\u300D\u3092\u30AF\u30EA\u30C3\u30AF\u3059\u308B\u304B\u3001\u300C/\u300D\u3092\u5165\u529B\u3059\u308B\u3068\u3001\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u304C\u7D20\u65E9\u304F\u633F\u5165\u3067\u304D\u307E\u3059",contentInTable:"\u300C/\u300D\u3092\u5165\u529B\u3059\u308B\u3068\u3001\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u304C\u7D20\u65E9\u304F\u633F\u5165\u3067\u304D\u307E\u3059"},local:{readonlyTitle:"\u7121\u984C"}},copyCutProperty:{copy:"\u8907\u88FD",cut:"\u5207\u308B",unsafeEnvTips:"HTTP\u74B0\u5883\u306E\u5236\u7D04\u306B\u3088\u308A\u3001{operation}\u3059\u308B\u306B\u306F\u3001\u30B7\u30E7\u30FC\u30C8\u30AB\u30C3\u30C8({shortCut}) \u3092\u3054\u4F7F\u7528\u304F\u3060\u3055\u3044",limitedEnvTips:"\u30D6\u30E9\u30A6\u30B6\u30FC\u306E\u5236\u9650\u306B\u3088\u308A\u3001\u300C{shortCut}\u300D\u3092\u4F7F\u7528\u3057\u3066\u8CBC\u308A\u4ED8\u3051\u3066\u304F\u3060\u3055\u3044"}};_.mergeLang({"zh-CN":RZ,"en-US":wZ,"ja-JP":SZ});const LZ="UEsDBBQABgAIAAAAIQBk9WPugQEAACkGAAATAAgCW0NvbnRlbnRfVHlwZXNdLnhtbCCiBAIooAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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IZ=()=>$p(LZ),DZ=D("image-to-docx");async function _Z(n){return new Promise((t,e)=>{const r=new Image;r.onload=()=>{t({width:r.naturalWidth,height:r.naturalHeight})},r.onerror=e,r.src=n})}async function zS(n,t){if(n.width&&n.height)return{width:n.width,height:n.height,buffer:t};try{const e=await _c(new File([t],"",{})),r=await _Z(e);return r.width===void 0||r.height===void 0?{width:345,height:230,buffer:t}:n.width||n.height?{width:n.width||r.width*n.height/r.height,height:n.height||r.height*n.width/r.width,buffer:t}:{width:r.width,height:r.height,buffer:t}}catch(e){DZ.error(e);return}}function MZ(n,t){let e=n.filter(o=>o!=null);const r=t-(e.length-1)*20,i=.87,s=e.reduce((o,l)=>o+l.width,0);return s>r&&(e=e.map(o=>({width:o.width*r/s,height:o.height*r/s,buffer:o.buffer}))),e.map(o=>({width:o.width*i,height:o.height*i,buffer:o.buffer}))}function UZ(n,t,e){if(!e||typeof e!="object")return;const r=e,i=n.filter(o=>o!=null),s=t-(i.length-1)*20;i.forEach((o,l)=>{if(i.length===1&&r.widthPercent){const d=r.widthPercent,h=o.width;o.width=s*(d/100),o.height*=o.width/h;return}const c=`${l}_flex`;if(r[c]){const d=r[c],h=o.width;o.width=s*d,o.height*=o.width/h}})}function GS(n=[0,1,2,3,4,5,6,7],t=1){return n.map(e=>{let r;switch(e%3){case 0:r=Bt.LevelFormat.DECIMAL;break;case 1:r=Bt.LevelFormat.LOWER_LETTER;break;default:r=Bt.LevelFormat.LOWER_ROMAN;break}return{level:e,format:r,text:`%${e+1}. `,alignment:Bt.AlignmentType.START,start:t,style:{paragraph:{indent:{left:Bt.convertInchesToTwip(.3*(e+1)),hanging:Bt.convertInchesToTwip(.2)}}}}})}function OZ(){return[0,1,2,3,4,5,6,7].map(n=>{let t;switch(n%3){case 0:t="\u2022";break;case 1:t="\u25E6";break;default:t="\u25AA";break}return{level:n,format:Bt.LevelFormat.BULLET,text:t,alignment:Bt.AlignmentType.START,style:{paragraph:{indent:{left:Bt.convertInchesToTwip(.3*(n+1)),hanging:Bt.convertInchesToTwip(.2)}}}}})}function NZ(){return[0,1,2,3,4,5,6,7].map(n=>({level:n,format:Bt.LevelFormat.BULLET,text:"\u2611",alignment:Bt.AlignmentType.START,style:{paragraph:{indent:{left:Bt.convertInchesToTwip(.3*(n+1)),hanging:Bt.convertInchesToTwip(.2)}}}}))}function PZ(){return[0,1,2,3,4,5,6,7].map(n=>({level:n,format:Bt.LevelFormat.BULLET,text:"\u2610",alignment:Bt.AlignmentType.START,style:{paragraph:{indent:{left:Bt.convertInchesToTwip(.3*(n+1)),hanging:Bt.convertInchesToTwip(.2)}}}}))}var ah=(n=>(n.NUMBERING="number-numbering-reference",n.BULLET="number-bullet-reference",n.CHECKED="checked-bullet-reference",n.UNCHECKED="unchecked-bullet-reference",n))(ah||{});const FZ=[{levels:GS(),reference:"number-numbering-reference"},{levels:OZ(),reference:"number-bullet-reference"},{levels:NZ(),reference:"checked-bullet-reference"},{levels:PZ(),reference:"unchecked-bullet-reference"}];function KZ(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 VZ(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 $Z(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 HZ=/rgb\((\d+),\s*(\d+),\s*(\d+)\)/;function WS(n){if(typeof n=="string"&&n.length>0){if(n[0]==="#")return n.substring(1);const t=n.match(HZ);if(t){const e=o=>{let l=Number(o).toString(16);return l.length<2&&(l=`0${l}`),l},r=e(t[1]),i=e(t[2]),s=e(t[3]);return`${r}${i}${s}`}if(n==="red")return"FF0000";if(n==="green")return"00FF00";if(n==="blue")return"0000FF"}}function Mn(n,t){if(n&&n.attributes&&n.attributes[t])return n.attributes[t];if(n&&n.attributes&&n.attributes.box&&n.attributes.inputType&&t==="style-underline")return!0}function qS(n,t,e){for(let r=0;r<=e;++r){const i=`${t}${r}`;if(Mn(n,i))return i}}function Kg(n,t,e){n.attributes=n.attributes||{},n.attributes[t]=e}function wx(n){return n==="image"||n==="drawio"||n==="plantuml"||n==="mermaid"||n==="flowchart"}function XS(n){return n&&n.startsWith("//")?`https:${n}`:n&&!n.startsWith("http://")&&!n.startsWith("https://")?`https://${n}`:n}function jZ(n){const t=Mn(n,"inlineStyle");if(t==null)return;const e=t.split(";");for(const r of e){const i=r.split(":");if(i.length!==2)continue;const s=i[0].trim().toLowerCase(),o=i[1].trim().toLowerCase();s==="font-size"&&Kg(n,"inline-style-font-size",o),s==="color"&&Kg(n,"inline-style-color",o),s==="background-color"&&Kg(n,"inline-style-background-color",o),s==="font-family"&&Kg(n,"inline-style-font-family",o)}}function zZ(n,t){if(t==null)return n==null?void 0:n.normal;if(n)return n[`heading${t}`]}function GZ(n){const t=`${Mn(n,"inline-style-font-size")}`;if(t&&t.indexOf("px")>0)return+t.replace(/px/g,"")}function WZ(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 qZ(n){if(n.attributes&&n.attributes.box&&n.attributes.text)return` @${n.attributes.text} `}function XZ(n){return Mn(n,"inline-style-font-family")}function YZ(n){const t=Mn(n,"inline-style-background-color");return WS(t)}function QZ(n){const t=Mn(n,"inline-style-color");return WS(t)}function JZ(n){jZ(n);const t=Mn(n,"type")==="mention";return{box:n.attributes&&n.attributes.box?n.attributes:void 0,inlineCode:!!Mn(n,"style-code"),link:XS(Mn(n,"link")),size:GZ(n),text:t?qZ(n):WZ(n)||n.insert,bold:!!Mn(n,"style-bold"),underline:!!Mn(n,"style-underline"),italics:!!Mn(n,"style-italic"),strike:!!Mn(n,"style-strikethrough"),superScript:!!Mn(n,"style-super"),subScript:!!Mn(n,"style-sub"),math:Mn(n,"type")==="math"?Mn(n,"src"):void 0,mention:t,fontFamily:XZ(n),background:YZ(n),color:t?"338fe5":KZ(qS(n,"style-color-",6))||QZ(n),highlight:qS(n,"style-bg-color-",13)}}function ZZ(){return[new Bt.Paragraph({border:{top:{color:"auto",style:Bt.BorderStyle.DASHED,size:4,space:1}},spacing:{before:300}}),new Bt.Paragraph({spacing:{line:0}})]}function ttt(){return new Bt.Paragraph({children:[new Bt.TextRun({text:"[\u89C6\u9891\u6682\u4E0D\u652F\u6301\u5BFC\u51FA]",shading:{type:Bt.ShadingType.CLEAR,color:"FFFFFF",fill:"CCCCCC"}})]})}function ett(){return new Bt.Paragraph({children:[new Bt.TextRun({text:"[\u97F3\u9891\u6682\u4E0D\u652F\u6301\u5BFC\u51FA]",shading:{type:Bt.ShadingType.CLEAR,color:"FFFFFF",fill:"CCCCCC"}})]})}function ntt(n,t){return new Bt.Paragraph({children:[new Bt.ExternalHyperlink({children:[new Bt.TextRun({style:"Hyperlink",text:t||n})],link:n})]})}function YS(n){if(n.heading!=null)return`Heading${n.heading}`}function QS(n){if(n.alignment!=null){if(n.alignment==="center")return Bt.AlignmentType.CENTER;if(n.alignment==="right")return Bt.AlignmentType.RIGHT;if(n.alignment==="left")return Bt.AlignmentType.LEFT}}function rtt(n){if(n.indent)return{left:Bt.convertInchesToTwip(.3*n.indent-.2)};if(n.padding)return{left:Bt.convertInchesToTwip(.3*n.padding)}}function itt(n){return{type:Bt.ShadingType.CLEAR,color:"FFFFFF",fill:n}}function stt(n){const t=n.split(",");if(t.length!==0)return t[0].trim()}function JS(n,t){var s;let e;e=n.inlineCode?"InlineCode":void 0,e=n.link?"Hyperlink":e;const r=n.size||t,i=r!=null?Math.floor(r*1.5+.5):void 0;return n.text=(s=n.text)==null?void 0:s.replace(/\x00/g," "),new Bt.TextRun({text:n.text,bold:n.bold||void 0,underline:n.underline?{type:Bt.UnderlineType.SINGLE}:void 0,italics:n.italics||void 0,strike:n.strike||void 0,superScript:n.superScript||void 0,subScript:n.subScript||void 0,size:i,style:e,font:n.fontFamily?stt(n.fontFamily):void 0,shading:n.background?itt(n.background):void 0,color:n.color,highlight:VZ(n.highlight)})}function ott(n,t){if(n.link)return n.link=n.link.replace(/\x00/g," "),new Bt.ExternalHyperlink({children:[JS(n,t)],link:n.link})}async function ZS(n,t,e,r,i){const[s]=await i(n,t,e);if(s==null)return;const o=await zS({width:r||0,height:0,src:e},s);return new Bt.ImageRun({data:s,transformation:{width:(o==null?void 0:o.width)||100,height:(o==null?void 0:o.height)||20}})}function ltt(n){if(n.heading||n.heading)return n.heading}function att(n){if(n.align&&(n.align==="center"||n.align==="right"||n.align==="left"))return n.align}function ctt(n){if(n.textOnly===!0&&n.level!=null)return n.level}async function utt(n,t){var r;const e=[];if(n.text&&Array.isArray(n.text)){for(let i=0;i<n.text.length;i++){const s=n.text[i];if(((r=s.attributes)==null?void 0:r.box)===!0&&t){const o=await t(s);if(o){n.text.splice(i+1,0,...o);continue}}e.push(JZ(s))}return e}}function ftt(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 dtt(n,t){if(n.type==="embed"&&n.embedType&&wx(n.embedType)&&n.embedData&&n.embedData.src)return n.embedData.src.split("|").map(r=>{const i=t(r),s=n.embedData[`${i}_width`],o=n.embedData[`${i}_height`];return{src:r,width:s,height:o}})}function htt(n){if(n.padding)return n.padding}function mtt(n){return!!(n.type==="embed"&&n.embedType&&wx(n.embedType)&&n.embedData&&n.embedData.src)}async function Vg(n,t,e){return{quoted:!!n.quoted,heading:ltt(n),alignment:att(n),indent:ctt(n),padding:htt(n),texts:await utt(n,e),list:ftt(n),images:dtt(n,t),border:mtt(n)}}async function gtt(n,t,e,r){const i=[];if(!n.children)return[];for(const s of n.children){const o=[];for(const l of t.blocks[s])o.push(await Vg(l,e,r));i.push(o)}return i}const ptt=D("to-docx");function Ctt(n,t){return Array(n).fill(0).map(()=>Array(t).fill(0).map(()=>({cellId:void 0,color:void 0,from:void 0,rowSpan:1,colSpan:1,width:0,originalWidth:void 0,align:void 0})))}function Ett(n,t,e,r){const i=!!n.hasColTitle,s=!!n.hasRowTitle,o=!!n.isStripeStyle,l="F5F8FB";for(let c=0;c<t;c++)for(let d=0;d<e;d++)(i&&d===0||s&&c===0||o&&c%2===1)&&(r[c][d].color=l)}function Att(n){p(ptt,n.children,"no table children");const t=n.rows,e=n.cols,r=n.colsWidth;if(r)for(let o=0;o<r.length;o++)r[o]===0&&(r[o]=100);const i=Ctt(t,e);let s=0;for(let o=0;o<t;++o)for(let l=0;l<e;++l){if(i[o][l].originalWidth=r?r[l]:void 0,i[o][l].from!==void 0)continue;const c=n.children[s];s+=1,i[o][l].cellId=c,i[o][l].color=$Z(n[`${c}_background`]),i[o][l].width=r?r[l]:100,i[o][l].align=n[`${c}_align`];const d=n[`${c}_rowSpan`]||1,h=n[`${c}_colSpan`]||1;if(i[o][l].rowSpan=d,i[o][l].colSpan=h,d>1||h>1){let C=0;for(let E=0;E<d;E++)for(let A=0;A<h;A++)E===0&&(C+=r?r[l+A]:80),!(E===0&&A===0)&&(i[o+E][l+A].from=[o,l]);i[o][l].width=C}}return Ett(n,t,e,i),i}async function xtt(n,t,e,r,i,s,o,l,c,d){async function h(E){if(l&&E.type!=="_exportVirtualBlock"){const A=await l(i,s,E);if(A){await r.addDoc(n,A,d);return}}if(E.type==="text"||E.textOnly===!0){const A=await Vg(E,o,c);await r.addTextBlock(A);return}if(E.type==="code"){const A=await gtt(E,e,o,c);await r.addCodeBlockObject(A);return}if(E.type==="list"&&E.textOnly!==!0){const A=await Vg(E,o,c);await r.addListBlockObject(n,A);return}if(E.type==="embed"&&E.embedType){const A=E,v=A.embedData,w=A.embedType;if(wx(w)){const S=await Vg(E,o,c);await r.addImagesBlockObject(E,S,d)}else E.embedType==="hr"?r.addSeparatorBlock():E.embedType==="video"?r.addVideoPlaceholder():E.embedType==="audio"?r.addAudioPlaceholder():E.embedType==="webpage"?r.addHyperlinkParagraph(XS(v.src),v.title):r.addOtherEmbedBlock(w,E.embedData);return}if(E.type==="table"){let A=[];if(E.colsWidth)A=E.colsWidth;else{const w=E.cols;A=new Array(w);for(let S=0;S<A.length;S++)A[S]=100;E.colsWidth=A}const v=Att(E);await r.addTableMatrix(A,v,e),r.addEmptyParagraph()}E.type==="_exportVirtualBlock"&&await r.addVirtualBlock(E.id,e,d)}function C(E){var w;const A=((w=E==null?void 0:E.embedData)==null?void 0:w.exportSpec)||(E==null?void 0:E.exportSpec);if(!A)return[E];const v=[];for(const{type:S,data:U}of A){if(S==="text"){const M={id:it(),text:[{insert:U}],type:"text"};v.push(M);continue}if(S==="image"){const M={id:it(),type:"embed",embedType:"image",align:"left",embedData:{src:U}};v.push(M);continue}if(S==="link"){const M={id:it(),type:"embed",embedType:"webpage",embedData:{src:U.url,title:U.title}};v.push(M);continue}if(S==="block")for(const M of U){if(!e.blocks[M])continue;const nt={id:M,type:"_exportVirtualBlock"};v.push(nt)}}return v}for(const E of t)for(const A of C(E))!A||await h(A)}function btt(){return{listMaxInst:1,listInstMap:{},listRefMap:{},levelConfigs:[]}}const vtt=D("to-docx");class Btt{constructor(t,e,r,i,s,o){m(this,"paragraphs");this.appId=t,this.docId=e,this.state=r,this.readImageFunc=i,this.convertBlocksFunc=s,this.defaultFontSize=o,this.paragraphs=[]}async addTextBlock(t){this.paragraphs.push(new Bt.Paragraph({heading:YS(t),alignment:QS(t),children:await this.paragraphsFromBlockTexts(t),indent:rtt(t)}))}async addEmptyImagePlaceHolder(){this.paragraphs.push(new Bt.Paragraph({text:`[${_.t("docx.imageExportFailed")}]`,shading:{type:Bt.ShadingType.CLEAR,color:"FFFFFF",fill:"CCCCCC"}}))}async paragraphsFromBlockTexts(t){if(t.texts==null)return;const e=zZ(this.defaultFontSize,t.heading),r=[];for(const i of t.texts){if(i.link){const s=ott(i,e);s&&r.push(s);continue}if(i.box&&i.box.type&&i.box.type==="br"){r.push(new Bt.TextRun({text:"",break:1}));continue}if(i.box&&i.box.type&&i.box.type==="image"){const s=await ZS(this.appId,this.docId,i.box.src,i.box.width,this.readImageFunc);s&&r.push(s);continue}if(i.math){const s=await ZS(this.appId,this.docId,i.math,0,this.readImageFunc);s&&r.push(s);continue}r.push(JS(i,e))}return r}async addCodeBlockObject(t){for(const e of t)for(const r of e){const i={style:Bt.BorderStyle.SINGLE,color:"#DEDEDE"};this.paragraphs.push(new Bt.Paragraph({style:"Code",border:{left:{...i},right:{...i},top:{...i},bottom:{...i}},children:await this.paragraphsFromBlockTexts(r)}))}}async addListBlockObject(t,e){if(e.list==null)return;let r;const i=e.list.checkbox?`${t}-${e.list.groupId}-${e.list.checkbox}`:`${t}-${e.list.groupId}`;if(this.state.listInstMap[i])r=this.state.listInstMap[i];else if(r=this.state.listMaxInst,this.state.listMaxInst+=1,this.state.listInstMap[i]=r,e.list.start>0&&e.list.ordered){const o=`number-numbering-reference-${r}`,l=GS([e.list.level-1],e.list.start);this.state.levelConfigs.push({levels:l,reference:o,inst:r}),this.state.listRefMap[i]=o}else e.list.ordered?this.state.listRefMap[i]=ah.NUMBERING:e.list.checkbox&&e.list.checkbox==="checked"?this.state.listRefMap[i]=ah.CHECKED:e.list.checkbox&&e.list.checkbox==="unchecked"?this.state.listRefMap[i]=ah.UNCHECKED:this.state.listRefMap[i]=ah.BULLET;const s=YS(e);e.texts&&this.paragraphs.push(new Bt.Paragraph({heading:s,children:await this.paragraphsFromBlockTexts(e),numbering:{reference:this.state.listRefMap[i],level:e.list.level-1,instance:r}}))}imageDimWithBufferToImageRun(t){return new Bt.ImageRun({data:t.buffer,transformation:{width:t.width,height:t.height}})}async addImagesBlockObject(t,e,r){if(e.images==null){if(t.type==="embed"&&t.embedType==="image"){const{src:c}=t.embedData;c||this.addEmptyImagePlaceHolder()}return}const i=[],s=await Promise.all(e.images.map(async c=>{const[d,h]=await this.readImageFunc(this.appId,this.docId,c.src);if(d){const C=await zS(c,d);if(C)return C}i.push(h)}));UZ(s,r,t.embedData);const o=MZ(s,r),l={style:Bt.BorderStyle.SINGLE,color:"#DEDEDE"};o.length&&this.paragraphs.push(new Bt.Paragraph({border:e.border?{left:{...l},right:{...l},top:{...l},bottom:{...l}}:void 0,alignment:QS(e)||Bt.AlignmentType.CENTER,children:o.map(c=>this.imageDimWithBufferToImageRun(c)).flatMap((c,d,h)=>c==null?[]:h.length-1!==d?[c,new Bt.TextRun({text:" "})]:c)})),i.forEach(c=>{this.addHyperlinkParagraph(c)})}addSeparatorBlock(){ZZ().forEach(t=>this.paragraphs.push(t))}addEmptyParagraph(){this.paragraphs.push(new Bt.Paragraph(""))}addVideoPlaceholder(){this.paragraphs.push(ttt())}addAudioPlaceholder(){this.paragraphs.push(ett())}addHyperlinkParagraph(t,e){t!=null&&this.paragraphs.push(ntt(t,e))}async addTableMatrix(t,e,r){const i=t.map(s=>s!==0?s*15:1500);this.paragraphs.push(new Bt.Table({rows:await this.generateTableRows(e,r),columnWidths:i}))}async generateRowCells(t,e){const r=[];for(const i of t){const s=i.cellId;if(s===void 0)continue;const o=i.width*.9;r.push(new Bt.TableCell({children:await this.convertBlocksFunc(s,e.blocks[s],e,this.appId,this.docId,this.state,o),columnSpan:i.colSpan,rowSpan:i.rowSpan,width:{type:Bt.WidthType.DXA,size:i.width*15},shading:i.color?{fill:i.color,type:Bt.ShadingType.CLEAR,color:"auto"}:void 0}))}return r}async generateTableRows(t,e){const r=[];for(const i of t)r.push(new Bt.TableRow({children:await this.generateRowCells(i,e)}));return r}async addDoc(t,e,r){const i=await this.convertBlocksFunc(t,e.blocks.root,e,this.appId,this.docId,this.state,r);i&&(this.paragraphs=this.paragraphs.concat(i))}async addVirtualBlock(t,e,r){const i=await this.convertBlocksFunc(t,e.blocks[t],e,this.appId,this.docId,this.state,r);this.paragraphs.push(...i)}async addOtherEmbedBlock(){}}class ytt{constructor(t,e,r,i,s,o,l,c){m(this,"convertBlocks",async(t,e,r,i,s,o,l=720)=>{const c=new Btt(i,s,o,this.readImage,this.convertBlocks,this.defaultFontSize);return await xtt(t,e,r,c,i,s,this.md5HexFunc,this.getDocByBlock,this.getTextsByBox,l||720),c.paragraphs});this.templateData=t,this.docData=e,this.md5HexFunc=r,this.readImage=i,this.defaultFontSize=s,this.getDocByBlock=o,this.getTextsByBox=l,this.backgroundImageOptions=c}async convert(t,e){return this.snapshot2docx(this.docData,t,e)}async snapshot2docx(t,e,r){const i=new Bt.ImportDotx,s=this.templateData?await i.extract(this.templateData):void 0,o=t.blocks.root;p(vtt,o,"data must have blocks");const l=btt(),c=await this.convertBlocks("blocks",o,t,e,r,l),d=this.backgroundImageOptions?{default:new Bt.Header({children:[new Bt.Paragraph({children:[new Bt.ImageRun(this.backgroundImageOptions)]})]})}:{},h=new Bt.Document({numbering:{config:[...FZ,...l.levelConfigs]},sections:[{headers:d,children:c,properties:{page:{size:{width:12240,height:15840},margin:{top:1440,bottom:1440,left:1440,right:1440}}}}]},{template:s});return Bt.Packer.toBlob(h)}}const Ttt=D("editor-to-docx");async function ktt(n,t,e,r){const i=n.doc.buildResourceUrl(r,{withToken:!0});let s=await CS(i);if(!s)return[void 0,i];if(s.type.indexOf("/svg")!==-1){const l=await mS(s);l&&(s=new File([l],s.name))}return[await s.arrayBuffer(),i]}async function Rtt(n,t,e){const r=n.editorBlocks.getBlockClass(e.type);if(r.toStandardDoc)try{return await r.toStandardDoc(n,e,t)}catch(i){Ttt.error(`toStandardDoc error: ${JSON.stringify(i)}`);return}}async function wtt(n,t){const e=t.attributes,r=n.editorBoxes.getBoxClass(e.type);if(r.toStandardText)return r.toStandardText(n,e)}async function Stt(n,t){let{template:e,download:r,backgroundImageOptions:i}=t!=null?t:{};e||(e=IZ());const s=n.doc.toJSON(),o=(C,E,A)=>ktt(n,C,E,A),l=async(C,E,A)=>Rtt(n,s,A),c=async C=>wtt(n,C),h=await new ytt(e,s,nm.default,o,void 0,l,c,i).convert("_appId","_docId");if(r){const C=URL.createObjectURL(h),E=document.createElement("a");E.setAttribute("download",`${pS(n)}.docx`),E.setAttribute("href",`${C}`),E.click(),E.remove()}return h}const Sx=D("create-editor");async function Ltt(n,t){var o,l,c,d,h,C,E,A,v,w,S,U,M,V,nt,Y;p(Sx,n,"app does not exists"),t.lang&&_.setLang(t.lang),hi.level=(o=t.logLevel)!=null?o:qo.DEBUG;const e=t.onReauth?async()=>{var bt;const X=t.user.userId,ft=t.docId,xt=await((bt=t.onReauth)==null?void 0:bt.call(t,X,ft,t.permission));return{userId:X,docId:ft,permission:t.permission,appId:t.appId,token:xt,displayName:t.user.displayName,avatarUrl:t.user.avatarUrl}}:void 0,r={auth:{appId:t.appId,docId:t.docId,userId:t.user.userId,permission:t.permission,token:t.token,displayName:t.user.displayName,avatarUrl:t.user.avatarUrl},serverUrl:t.serverUrl,reauthFunc:e,disableLogout:t.disableLogout,onMaxUsersError:t.onMaxUsersError},i=await hd.load(r),s=Zf(n,i,{id:t.id,scrollContainer:t==null?void 0:t.scrollContainer,enableComments:t==null?void 0:t.enableComments,enableContextMenu:t==null?void 0:t.enableContextMenu,components:{blocks:[...VS,...((l=t==null?void 0:t.components)==null?void 0:l.blocks)||[]],embeds:[...Rx,...((c=t.components)==null?void 0:c.embeds)||[]],boxes:[...$S,...((d=t.components)==null?void 0:d.boxes)||[]],commandProviders:[new P0,...((h=t.components)==null?void 0:h.commandProviders)||[]],decorators:[new fg,new WC],insertions:[G1],blockHooks:[new DA,new lw,...((C=t.components)==null?void 0:C.blockHooks)||[]],textRenders:[new T4,new WE,...((E=t.components)==null?void 0:E.textRenders)||[]],options:{...t.componentsOptions}},shortcuts:[Nq,fH,Bz,fA,Qw,AF,sA,bX,s0,dF,...t.shortcuts||[]],colors:["#0064FF","#EB3723","#F59300","#00A865","#F25A0A","#70A310","#009CAD","#0990D9","#8851ED","#D62069"]});if(s.editorCommandProviders.registerCommandProvider(new ms(s)),s.input.addHandler(new uY),s.input.addHandler(new hg),s.input.addHandler(new $K),s.input.addHandler(new gz),s.input.addHandler(new xA(s,{hideTitle:t.hideTitle,headingLevel:1,titlePlaceholder:_.t("placeholder.common.title"),contentPlaceholder:_.t("placeholder.common.content"),readonlyTitlePlaceholder:_.t("placeholder.common.readonlyTitle"),addPlaceholderToAllCurrentEmptyBlock:!0,applyContentPlaceholder:(A=t.placeholder)==null?void 0:A.applyContentPlaceholder})),s.input.addHandler(new sg(s,(v=t.componentsOptions)==null?void 0:v.quickMenu)),s.input.addHandler(new PA(s)),s.input.addHandler(new jA(s)),s.input.addHandler(new Cg),s.input.addHandler(new Ik),s.doc.registerCallback(new fY(s)),s.addCustom("remote-cursor",()=>new uT(s)),s.addCustom("block-menu",X=>new uw(X)),xe.isMobile||s.addCustom("editor-tooltip",()=>new Ld(s)),t!=null&&t.enableComments&&s.addCustom("editor-comments",X=>new y4(X,new TZ(X))),t.enableContextMenu!==!1&&s.addCustom("editor-context-menu",X=>new WA(X)),s.addCustom("create-options",()=>new Db(s,t)),s.addCustom("drop-target",()=>new qd(s)),s.addCustom("list-to-mindmap",()=>new Z0(s)),s.addCustom("list-to-mention",()=>new DY(s)),s.addCustom("mobile-helper",()=>new tQ(s)),s.addCustom("code-caret",()=>new lH(s)),s.addCustom("image-paste-handler",()=>new NA(s)),(w=t.componentsOptions)!=null&&w.mention){const X=t.componentsOptions.mention;s.addCustom("mention",()=>new cS(s,X))}if(s.addCustom("heading-collapse",()=>new fx(s)),s.addCustom(Pg,X=>new Ex(X)),Au.register(s),qd.register(s),Ll.register(s),yl.register(s),s.addListener("clickLink",(X,ft,xt)=>{var wt;if((wt=t==null?void 0:t.events)!=null&&wt.onClickLink){t.events.onClickLink(X,ft,xt);return}const bt=xt.getAttribute("link");bt&&(X.readonly||ft.ctrlKey||ft.metaKey)&&window.open(bt,"_blank")}),(U=(S=t.componentsOptions)==null?void 0:S.remoteCarets)!=null&&U.onUserChanged){const X=(V=(M=t.componentsOptions)==null?void 0:M.remoteCarets)==null?void 0:V.onUserChanged;s.doc.getRemoteUsers().on("change",ft=>{X(s,ft)})}return(Y=(nt=t.componentsOptions)==null?void 0:nt.templates)!=null&&Y.templates.length&&(s.addListener("docChanged",()=>{Ng(s)}),s.addListener("resize",()=>{Ng(s,{reset:!0})}),setTimeout(()=>{Ng(s)},100)),s.doc.registerCallback({onError:async X=>{if(X.code==="ResetDoc"){Sx.error(`reset doc: ${X.message}`);const ft=await hd.load(r);s.doc.reset(ft)}}}),s.version="1.1.28",hi.level===qo.DEBUG&&(window.setReauthFail=X=>{window.isReauthError=X},window.reConnect=X=>s.doc.externalDoc.client.connection.reConnect(X)),s}function Itt(n){return n.toJSON!==void 0}async function Dtt(n,t,e){var s,o,l,c,d,h,C,E;p(Sx,n,"app does not exists");const r=Itt(t)?t:new TC(t,{serverUrl:e.serverUrl||""});e.lang&&_.setLang(e.lang),hi.level=(s=e.logLevel)!=null?s:qo.DEBUG;const i=Zf(n,r,{id:e.id,scrollContainer:e==null?void 0:e.scrollContainer,components:{blocks:[uA,EA,AA,Dk,...(l=(o=e.components)==null?void 0:o.blocks)!=null?l:[]],commandProviders:[new P0],decorators:[new fg,new WC],embeds:[...Rx,...((c=e.components)==null?void 0:c.embeds)||[]],boxes:[jk,uS,_4,...((d=e.components)==null?void 0:d.boxes)||[]],insertions:[G1],blockHooks:[new DA,...((h=e.components)==null?void 0:h.blockHooks)||[]],textRenders:[new T4,new WE,...((C=e.components)==null?void 0:C.textRenders)||[]],options:{...e.componentsOptions}},shortcuts:[fA,Qw,sA,s0]});return i.editorCommandProviders.registerCommandProvider(new ms(i)),i.input.addHandler(new hg),i.input.addHandler(new xA(i,{hideTitle:e.hideTitle,headingLevel:1,titlePlaceholder:_.t("placeholder.common.title"),contentPlaceholder:_.t("placeholder.common.content"),readonlyTitlePlaceholder:_.t("placeholder.local.readonlyTitle"),addPlaceholderToAllCurrentEmptyBlock:!0})),i.input.addHandler(new sg(i,(E=e.componentsOptions)==null?void 0:E.quickMenu)),i.input.addHandler(new PA(i)),i.input.addHandler(new jA(i)),i.input.addHandler(new Cg),i.input.addHandler(new Ik),i.addCustom("block-menu",A=>new uw(A)),xe.isMobile||i.addCustom("editor-tooltip",()=>new Ld(i)),i.addCustom("image-paste-handler",()=>new NA(i)),e!=null&&e.enableComments&&i.addCustom("editor-comments",A=>new y4(A,new kZ(A,r))),e.enableContextMenu!==!1&&i.addCustom("editor-context-menu",A=>new WA(A)),i.addCustom("heading-collapse",()=>new fx(i)),i.addListener("clickLink",(A,v,w)=>{var U;if((U=e==null?void 0:e.events)!=null&&U.onClickLink){e.events.onClickLink(A,v,w);return}const S=w.getAttribute("link");S&&(A.readonly||v.ctrlKey||v.metaKey)&&window.open(S,"_blank")}),i.addCustom(Pg,A=>new Ex(A)),Au.register(i),i.version="1.1.28",i}async function _tt(n,t,e){var h;const r=n.doc.externalDoc.client.auth,i=await C0.load({auth:r,serverUrl:e});if(!((h=i.getVersionHelper)==null?void 0:h.call(i)))throw new Error("the editor does not support to show versions");const o=n.getCustom("create-options");if(!o)throw new Error("the editor does not support to show versions");const l=o.getData(),c=new HS(l),d=n.addCustom("version-dialog",()=>new X4(i,c));return d.show(t),d}b.tippy=c9,b.AnchorBox=w3,b.AuthError=fd,b.AuthHeader=xa,b.AutoScroll=xm,b.BaseURLHeader=eu,b.BasicCommands=uK,b.BlockExclusiveHook=lw,b.BlockLockerHook=DA,b.BlockLockerPasteHandler=Cg,b.BlockResizer=Pd,b.BrBox=y3,b.CodeBlock=EA,b.CodeLineBlock=AA,b.CodeTextDecorator=fg,b.DOC_RE_AUTH_KEYS=Pg,b.DefaultShortcuts=s0,b.DocIdError=tO,b.DocReAuthCallbacks=Ex,b.DragDrop=Yb,b.DrawioEmbed=LS,b.EditorBlocks=lB,b.EditorBoxes=k3,b.EditorCommandProviders=yy,b.EditorComplexBlockPosition=Ai,b.EditorComplexSelectionRange=Qi,b.EditorDecorators=D3,b.EditorEmbeds=cB,b.EditorInsertions=I3,b.EditorSimpleBlockPosition=gn,b.EditorSimpleSelectionRange=bn,b.EmbedBlock=fB,b.EmbedBlockResizer=nh,b.EnforceWithDocumentTitleHandler=xA,b.EventCallbacks=Lc,b.FILL_CHAR=T8,b.FileExtError=eO,b.GroupOrder=Ok,b.HeadingBlockScrollListener=TY,b.ImageBox=R3,b.InlineBoxCommandProvider=Yk,b.InputtingInsertion=S3,b.LocalDoc=TC,b.LogLevel=qo,b.Logger=hi,b.MIN_DISTANCE_THRESHOLD=qb,b.ManualCloseDialog=gd,b.ManualMenu=dl,b.ManualToolbar=md,b.MarkdownInputHandler=hg,b.MaxUserError=PC,b.Mindmap=J0,b.OnesEditorAutoSuggest=mE,b.OnesEditorCustomDataWrapper=Db,b.OnesEditorExclusiveBlock=yl,b.OnesEditorHoveringBlock=$e,b.OnesEditorIcons=KO,b.OnesEditorQuickMenu=sg,b.OnesEditorToc=oh,b.OnesEditorTocProvider=Ll,b.OnesEditorToolbar=Au,b.OnesEditorTooltip=Ld,b.OnesEditorVersionsDialog=X4,b.PermissionError=p0,b.Popup=su,b.ReAuthToolbar=ES,b.RemoteCarets=uT,b.RemoteCaretsDecorator=WC,b.RemoteCaretsInsertion=G1,b.RemoteUsers=td,b.RequestReloadError=dd,b.RichText=$n,b.ShareDBDoc=hd,b.ShareDBDocVersionsProvider=HS,b.ShareDBServer=C0,b.SimpleCache=Kb,b.StandardEmbedBlockCommands=rx,b.TEXT_STYLE_BACKGROUND_COLOR_PREFIX=T1,b.TEXT_STYLE_COLOR_PREFIX=y1,b.TableBlock=uA,b.TableBlockCommandProvider=P0,b.TableShortcuts=fA,b.TextBlock=lr,b.TextBox=B3,b.TextColorItem=w2,b.TextStyleShortcuts=sA,b.TocEmbed=lS,b.ZERO_WIDTH_SPACE_CHAR=xf,b.abbreviation=bm,b.addAttribute=Lm,b.addClass=q,b.addCommentToBlock=eh,b.addDays=AI,b.addMetaToDoc=Qf,b.addMonths=EI,b.animateScrollTo=ra,b.applyPlaceholderToBlock=Od,b.assert=p,b.autoShowHideTemplates=Ng,b.bindKeyDownEvent=dm,b.blockToDoc=AC,b.blockToHtml=X1,b.blockToMarkdown=Gm,b.blockToText=zm,b.blocksToDoc=W5,b.clearAllSelection=Vv,b.clientType=xe,b.cloneBlock=sl,b.cloneChildContainer=sC,b.cloneDoc=oC,b.cloneText=m3,b.commentToShareDbComment=GC,b.compareElement=cm,b.comparePosition=p1,b.complexBlockAdjustSelectionPos=Rm,b.complexBlockFindNearestChildBlock=C7,b.complexBlockGetAllChildContainers=In,b.complexBlockGetBottomChildContainers=gB,b.complexBlockGetDeepFirstChild=dB,b.complexBlockGetFirstSimpleChild=E1,b.complexBlockGetLastSimpleChild=Pc,b.complexBlockGetSelectedContainers=Nc,b.complexBlockGetTopChildContainers=mB,b.containerToDoc=q5,b.continuousScroll=hv,b.convertBlockFrom=Tm,b.convertImageFileToPng=mS,b.convertImageSrcToPng=qY,b.converterIntercept=dg,b.copyBlockAttributes=z3,b.copyResourcesFromDoc=yC,b.createBlockAnchor=$s,b.createBlockCaretAnchor=CB,b.createBlockContentElement=ua,b.createBlockElement=Mv,b.createBlockSimpleDocRange=Km,b.createBlockSimpleRange=Ue,b.createBoxContentElement=Nv,b.createBoxElement=Uv,b.createBoxOp=h3,b.createChildContainer=sB,b.createComplexBlockPosition=Me,b.createComplexDocPos=A3,b.createComplexDocRange=w8,b.createContainer=p3,b.createContainerElement=t1,b.createDeleteOps=c3,b.createEditor=Zf,b.createEditorSelectionRange=pn,b.createElement=B,b.createEmptyContainer=qs,b.createEmptyDoc=Ws,b.createEmptyTextBlockData=Pm,b.createExpandedRange=lm,b.createIconButton=ta,b.createImage=_p,b.createInsertOps=Om,b.createInsertionContentElement=Kv,b.createInsertionElement=Pv,b.createLocalEditor=Dtt,b.createOnesEditor=Ltt,b.createRange=Vb,b.createRichText=pa,b.createRootContainer=iB,b.createSimpleBlockPosition=ht,b.createSimpleDocPos=E3,b.createTextBlockData=es,b.createTextButton=Sa,b.createTextOp=qr,b.createTextWithReplaceSoftReturn=N1,b.daysAfter=qp,b.deleteText=F1,b.diffDays=xI,b.disablePageScroll=jp,b.docToHtml=K3,b.docToHtmlFragment=jf,b.docToMarkdown=V3,b.docToText=il,b.downloadImageToFile=CS,b.downloadObjectToFile=bx,b.downloadSvgToString=bS,b.editLink=kd,b.editorAddComment=wq,b.editorAddTextAttribute=n5,b.editorAutoInsertBlock=G3,b.editorBreakTextBlock=qc,b.editorClearCompositionText=Z1,b.editorClearSelectedContents=Qm,b.editorCopyBlock=vC,b.editorCopyDoc=i0,b.editorDeleteBlock=nC,b.editorDeleteBlockText=tC,b.editorDeleteBlockWithoutChildren=Xm,b.editorDeleteChildContainer=T_,b.editorDeleteChildContainers=W3,b.editorFocusToBlock=iC,b.editorFocusToEnd=j_,b.editorGetBlockData=Xs,b.editorGetBlockText=Yn,b.editorGetBlockTextEx=$m,b.editorGetBoxData=b3,b.editorHandleKeyboardEvent=oy,b.editorInsertBlock=Wc,b.editorInsertBoxToBlock=H3,b.editorInsertDoc=t5,b.editorInsertDocAt=lC,b.editorInsertText=J1,b.editorInsertTextToBlock=$3,b.editorInsertTextToBlockEx=Q1,b.editorMergeTextBlock=q3,b.editorMoveDown=g5,b.editorMoveEnd=mC,b.editorMoveHome=T5,b.editorMoveLeft=d5,b.editorMoveLineEnd=_5,b.editorMoveLineHome=D5,b.editorMovePageDown=F5,b.editorMovePageUp=P5,b.editorMoveRight=h5,b.editorMoveUp=m5,b.editorMoveWordEnd=v5,b.editorMoveWordLeft=b5,b.editorRangeClearColor=i5,b.editorRangeGetColor=s5,b.editorRangeSetColor=r5,b.editorRemoveTextAttribute=S_,b.editorReplaceBlockText=Jm,b.editorReplaceContainer=e5,b.editorRunOnce=kC,b.editorSelectAll=pC,b.editorSelectContainer=e0,b.editorSelectDown=p5,b.editorSelectEnd=gC,b.editorSelectHome=k5,b.editorSelectLeft=C5,b.editorSelectLineEnd=I5,b.editorSelectLineHome=L5,b.editorSelectPageDown=$5,b.editorSelectPageUp=V5,b.editorSelectRight=E5,b.editorSelectUp=A5,b.editorSelectWordEnd=y5,b.editorSelectWordLeft=B5,b.editorSetTextColor=Xc,b.editorShowFindDialog=AW,b.editorToDocx=Stt,b.editorUpdateBlockData=Zm,b.editorUpdateCompositionText=j3,b.editorUpdateEmbedData=J3,b.enablePageScroll=zp,b.escapeHtmlText=hm,b.escapeRegExp=Jp,b.escapeSpace=tI,b.exclusiveBlock=SA,b.executeBlockCommand=Yv,b.executeEmbedBlockCommand=Xv,b.executeRangeCommand=By,b.fileToDataUrl=_c,b.findAfterOffsetNotType=H1,b.findAllText=CC,b.findBlockByIndex=kv,b.findEventTargetBlock=jb,b.findInsertionById=Fv,b.findNextOffset=q8,b.findNextVisibleSimpleBlock=wy,b.findPrevOffset=W8,b.findPrevOffsetNotType=$1,b.findPrevSimpleBlockBeforeChildContainer=hB,b.findPrevVisibleSimpleBlock=Ry,b.findTarget=Dc,b.findWordEnd=z1,b.findWordLeft=j1,b.format=kf,b.formatBytes=mv,b.formatDate=Yp,b.fragmentToHtml=lv,b.fromBase64=vf,b.fromBase64ToBlob=$p,b.fromBase64ToUint8Array=fI,b.fromDocRange=el,b.fromNowString=Qp,b.genId=it,b.generateEditorContainerId=Zp,b.getAllChildBlocks=v1,b.getAllQuickMenuItems=iA,b.getAllSelectedBlocks=Ji,b.getAttributesAt=$c,b.getBlockBackground=r1,b.getBlockByIndex=Qo,b.getBlockCaretRect=Zo,b.getBlockClass=le,b.getBlockClassByType=la,b.getBlockClientRects=Fs,b.getBlockCommandsWithHook=u1,b.getBlockContent=zt,b.getBlockHeading=If,b.getBlockId=ut,b.getBlockIndex=Rt,b.getBlockInfo=Hd,b.getBlockKind=Ci,b.getBlockMinWidth=Hv,b.getBlockNearestRangeFromPoint=x1,b.getBlockOptions=_I,b.getBlockPath=tl,b.getBlockProperties=Gv,b.getBlockRangeFromPoint=wm,b.getBlockStyles=DI,b.getBlockTextLength=Ct,b.getBlockTools=be,b.getBlockType=Ot,b.getBoxContent=s1,b.getBoxId=Ov,b.getBoxTypeFromElement=Lf,b.getChildBlockCount=qi,b.getChildBlocks=ke,b.getChildOffset=nl,b.getColorFromAttributes=R1,b.getColorFromContent=vm,b.getComplexBlockClass=Hr,b.getContainerBlockPath=eB,b.getContainerBlocks=yv,b.getContainerBlocksElement=wf,b.getContainerById=pi,b.getContainerId=pt,b.getContainerMinWidth=m1,b.getContainerToolsElement=SI,b.getContainerWidth=oB,b.getDistanceSquare=Xo,b.getElementFromPoint=Pe,b.getElementOffset=Af,b.getElementScale=$r,b.getEmbedType=on,b.getExistsBlockTools=Bm,b.getExistsContainerById=Rf,b.getFileExt=Tf,b.getFirstChildBlock=_e,b.getFirstClientRect=am,b.getHeadingBlockChildren=Oc,b.getHeadingMenuOptions=tA,b.getHorizontalPadding=Up,b.getInsertionContent=o1,b.getLastChildBlock=Ge,b.getLastClientRect=ea,b.getListAllNextBrothers=mu,b.getLogger=D,b.getNextBlock=ae,b.getNextHiddenBlocks=Zv,b.getNextValidOffset=ma,b.getNextVisibleBlock=zr,b.getOffsetFromPoint=Mp,b.getOffsetInfoAfter=Vf,b.getOffsetInfoBefore=Hm,b.getOpAt=HB,b.getOpLength=Sm,b.getParentBlock=et,b.getParentBlockExcludeSelf=ca,b.getParentBox=i1,b.getParentContainer=at,b.getPrevBlock=He,b.getPrevValidOffset=rl,b.getPrevVisibleBlock=jr,b.getRangeCommands=by,b.getReferenceClientRect=lk,b.getRootBlock=c1,b.getScrollContainer=mn,b.getSpecialBlockCommands=Wv,b.getStandardEmbedBlockProperties=ix,b.getTextAfterOffset=z8,b.getTextAttributes=Y1,b.getTextBeforeOffset=G8,b.getTextBlockChild=Mf,b.getTextBlockClass=wv,b.getTextBlockContentChildTextLength=Wr,b.getTextBlockContentChildType=tB,b.getTextBlockContentChildren=Yi,b.getTextLength=Vn,b.getTextOpLength=B1,b.getTextWidth=Cm,b.getToolbar=z0,b.handleBlockElementUpdated=jv,b.hasAltOnly=oI,b.hasClass=Mt,b.hasCtrlOrCmd=nv,b.hasCtrlOrCmdOnly=sI,b.hashCode=bv,b.hideBlock=_v,b.hideTemplates=hS,b.htmlToFragment=pm,b.i18n=_,b.includeBigTable=pN,b.injectDocToHtmlFragment=Yf,b.injectStyle=Wb,b.inputActions=uM,b.insertEmptyBlock=OI,b.insertEmptyEmbedBlock=f1,b.insertText=Gs,b.intersectionCommands=HM,b.isBackspace=iv,b.isBlock=aa,b.isBlockLocked=pg,b.isBlockLockedByOthers=IA,b.isBlockLockedBySelf=jd,b.isBlockTools=Dv,b.isBox=ym,b.isBoxOp=Hs,b.isCJK=tv,b.isChildContainer=gi,b.isChildNode=Ce,b.isCodeBlock=Di,b.isCollapsedHeadingBlock=Xi,b.isCollapsedRange=R8,b.isComplexBlockPosition=da,b.isComplexKindBlock=Pt,b.isContainer=Yo,b.isContainerSelectedAllChildBlocks=H5,b.isControlEvent=sa,b.isDelete=aI,b.isDraggingFiles=Em,b.isElementVisible=fm,b.isEmbedBlock=Le,b.isEmptyContainer=Uf,b.isEmptyDoc=K1,b.isEmptyTextBlock=ve,b.isEmptyTextBlockWithoutCompositionText=Ud,b.isEnterOnly=rv,b.isEscape=gm,b.isExclusiveBlock=$d,b.isExpandedHeadingBlock=Jv,b.isFirefox=Cf,b.isFirstChildBlockInComplexBlock=p7,b.isHeadingBlock=Ln,b.isHighSurrogate=Y9,b.isInBlock=l1,b.isInBlockTools=Uc,b.isLetter=Zb,b.isLowSurrogate=Q9,b.isMatchShortcut=Gi,b.isMoveForward=rI,b.isNavigationEvent=nI,b.isNavigationKey=ev,b.isNodeRemoved=Ef,b.isNumber=Jb,b.isPrintableKey=Kp,b.isRootBlock=Gr,b.isRootContainer=re,b.isSafari=Zl,b.isSameDay=Xp,b.isSelectBoxOnly=ti,b.isShiftEnter=lI,b.isShiftTab=uI,b.isShortcutEvent=iI,b.isSimpleBlock=II,b.isSimpleBlockPosition=xi,b.isSimplePos=C3,b.isSimpleRange=Fm,b.isSpace=mm,b.isTab=cI,b.isTextBlockContentBoxChild=Br,b.isTextBlockContentChild=Df,b.isTextBlockContentInsertionChild=Vs,b.isTextBlockContentTextChild=_f,b.isTextKindBlock=ot,b.isTextKindBlockType=Sf,b.isTitleBlock=Ps,b.isToday=gv,b.isValidOffset=or,b.isVisibleBlock=Jo,b.isYesterday=pv,b.loadJs=Hb,b.loadJsPromise=na,b.lockers=mi,b.mergeCommands=j0,b.mergeDocs=Ca,b.mergeOps=P1,b.mergeText=B8,b.multiSplitText=zB,b.overflowText=Cv,b.parseShortcut=sv,b.patchNode=Bf,b.pointInRect=ia,b.rangeAddAttribute=Pf,b.rangeGetTextColor=JB,b.rangeRemoveAttribute=Vc,b.rangeSetTextColor=XB,b.rangeTransformText=WB,b.registerDragDrop=Pp,b.removeAttribute=k1,b.removeClass=ct,b.removeLastBr=A8,b.removePlaceholderFromBlock=DR,b.removeStyle=Gb,b.replaceAll=bI,b.replaceAllCaseInsensitive=vI,b.replaceAllText=z5,b.replaceText=Nm,b.requestDownload=Am,b.resetListStart=pu,b.scrollIntoView=Hf,b.scrollable=dv,b.selectFile=Mc,b.selectedBlockToDoc=n0,b.selectionToDoc=Yc,b.setAttributes=um,b.setClipboardData=yf,b.setClipboardDataByEvent=mI,b.setColorToAttributes=YB,b.setDataset=Op,b.setDefaultCursor=bf,b.setStyles=Np,b.shareDBCommentToDocObject=zC,b.shareDBDocCommentToComment=aT,b.shortcutToDisplayText=hn,b.showBlock=n1,b.showDocVersions=_tt,b.showTemplates=px,b.splitText=sr,b.splitToThree=ln,b.stringToDataUrl=Hp,b.stringToObjectUrl=Gp,b.subText=GB,b.textNodeOffsetFromPoint=$b,b.titleFromEditor=pS,b.toBase64URL=Wi,b.toMindmap=Q0,b.toPlainText=Re,b.toPlainTextKeepLength=V1,b.trimChar=Fp,b.unexclusiveBlock=LA,b.unicodeLength=J9,b.unicodeSubstr=Z9,b.updateBlockSelection=$v,b.updateOpAttributes=g3,b.updateTextBlockContent=j8,b.updateUrl=Vp;for(const n in Ve)n!=="default"&&!b.hasOwnProperty(n)&&Object.defineProperty(b,n,{enumerable:!0,get:()=>Ve[n]});Object.defineProperties(b,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});