vdc-editor 0.1.307 → 0.1.308

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.
@@ -341,7 +341,7 @@ ${c}`:u)}else throw a},onCacheKey:a=>fz(e,n,a)}}function nW(t){if(Oe(t))return t
341
341
  `){if(!x||!C.length)return;const k=Sk(x,E);function T(F){if(F<0&&(F=0),F>=k.length)return x.state.doc.content.size;if(k[F]!=null)return k[F];for(let j=F;j<k.length;j++)if(k[j]!=null)return k[j];for(let j=F-1;j>=0;j--)if(k[j]!=null)return k[j];return x.state.doc.content.size}const A=C.map(F=>{const j=T(F.startIndex),Y=T(Math.max(0,F.endIndex-1))+1,N=F.correctWord?.[0]??F.wrongWord;return{item:F,from:j,to:Y,replacement:N}}).filter(F=>typeof F.from=="number"&&typeof F.to=="number"&&F.from<F.to);if(!A.length)return;A.sort((F,j)=>j.from-F.from);const V=x.state.tr;let O=Number.POSITIVE_INFINITY;const B=new Set;for(const F of A)F.to>O||(V.insertText(F.replacement,F.from,F.to),B.add(F.item),O=F.from);B.size>0&&(x.view.dispatch(V),x.view.focus()),B.size>0&&(C=C.filter(F=>![...B].some(j=>j===F))),db(x,C)}function w(){for(const[x,{editor:C,wrongWords:E}]of Object.entries(t))C&&b(C,E)}return{editorsState:t,spellCheckStatus:n,countTotalWrongWords:a,allWrongWordsMissSuggestions:l,setEditor:e,resetAllEditorWrongWords:r,disableSpellCheckRealTime:g,resetEnableSpellCheckRealTime:v,applyAllEditorHighlightErrors:c,clearAllEditorHighlightErrors:f,reRunSpellCheckAndHighlight:p,handleRunSpellCheck:s,replaceAllEditorErrors:w}},JJ=o.defineComponent({__name:"DialogTrigger",props:{asChild:{type:Boolean},as:{}},setup(t){const e=t;return(n,r)=>(o.openBlock(),o.createBlock(o.unref(ID),o.normalizeProps(o.guardReactiveProps(e)),{default:o.withCtx(()=>[o.renderSlot(n.$slots,"default")]),_:3},16))}}),ZJ={key:0,class:"border-blue-500 text-white text-xs text-nowrap px-3 py-2 h-auto bg-blue-500 hover:bg-blue-500/80 flex items-center rounded"},vE=o.defineComponent({__name:"BulkSpellChecker",props:{editor:{},editorComment:{},isEnableSpellCheckRealTime:{type:Boolean},align:{default:"right"}},setup(t){const e=t,{editorsState:n,countTotalWrongWords:r,spellCheckStatus:i,allWrongWordsMissSuggestions:s,setEditor:a,disableSpellCheckRealTime:l,resetEnableSpellCheckRealTime:u,handleRunSpellCheck:c,resetAllEditorWrongWords:f,applyAllEditorHighlightErrors:p,clearAllEditorHighlightErrors:m,reRunSpellCheckAndHighlight:g,replaceAllEditorErrors:v}=YJ(),b=o.ref(!1),w=o.reactive({x:0,y:0}),x=o.ref(!1),C={x:0,y:0},E=B=>{x.value=!0,C.x=B.clientX-w.x,C.y=B.clientY-w.y,document.addEventListener("mousemove",k),document.addEventListener("mouseup",T)},k=B=>{x.value&&(w.x=B.clientX-C.x,w.y=B.clientY-C.y)},T=()=>{x.value=!1,document.removeEventListener("mousemove",k),document.removeEventListener("mouseup",T)};o.onUnmounted(()=>{document.removeEventListener("mousemove",k),document.removeEventListener("mouseup",T)});const S=o.ref(null),A=o.ref({top:0,right:0,left:0}),V=()=>{if(S.value){const B=S.value.$el.getBoundingClientRect();A.value={top:B.bottom+window.scrollY+5,right:window.innerWidth-B.right-window.scrollX,left:B.left+window.scrollX},w.x=0,w.y=0}};o.onMounted(async()=>{e.editorComment&&a(Bo.EDITOR_COMMENT,e.editorComment),a(Bo.EDITOR_CONTENT,e.editor)}),o.onUnmounted(()=>{a(Bo.EDITOR_COMMENT,null),a(Bo.EDITOR_CONTENT,null)}),o.watch(b,async B=>{B?(await o.nextTick(),V(),l(e.isEnableSpellCheckRealTime),await c(),p()):(f(),u(),m())});const O=e.editor?.extensionManager.extensions.find(B=>B.name==="spellchecker")?.options.bulkSpellCheckerButton;return(B,F)=>{const j=Ot,Y=pb,N=dh,H=ch,D=uh,L=lh,W=fY,P=Dc,q=Rc;return o.openBlock(),o.createBlock(q,{open:o.unref(b)},{default:o.withCtx(()=>[o.createVNode(o.unref(JJ),{"as-child":"",ref_key:"triggerRef",ref:S,onClick:F[0]||(F[0]=G=>b.value=!o.unref(b))},{default:o.withCtx(()=>[o.unref(O)?(o.openBlock(),o.createBlock(o.resolveDynamicComponent(o.unref(O).component),{key:1,buttonName:o.unref(O).props.buttonName,icon:o.unref(O).props.icon,type:o.unref(O).props.type,disabled:o.unref(O).props.disabled,iconPosition:o.unref(O).props.iconPosition,buttonSize:o.unref(O).props.buttonSize,iconClass:o.unref(O).props.iconClass},null,8,["buttonName","icon","type","disabled","iconPosition","buttonSize","iconClass"])):(o.openBlock(),o.createElementBlock("button",ZJ,[o.createVNode(j,{name:"checkUnderline"}),F[4]||(F[4]=o.createTextVNode("맞춤법 일괄 교정 "))]))]),_:1},512),o.createVNode(P,{"is-overlay-transparent":"",class:"p-0 gap-0 !animate-none !transition-none dark:border-ed-muted","as-child":""},{default:o.withCtx(()=>[o.createElementVNode("div",{class:"z-[70]",style:o.normalizeStyle({transform:`translate(${o.unref(w).x}px, ${o.unref(w).y}px)`,top:`${o.unref(A).top}px`,right:B.align==="left"?"auto":`${o.unref(A).right}px`,left:B.align==="left"?`${o.unref(A).left}px`:"auto"})},[o.createVNode(D,{class:"bg-ed-blue-light py-3.5 px-6 rounded-t-[5px] cursor-move text-blue-500 dark:text-dark-blue-100 flex-row items-center justify-between",onMousedown:o.withModifiers(E,["prevent"])},{default:o.withCtx(()=>[o.createVNode(N,{class:"text-base space-x-2"},{default:o.withCtx(()=>[F[5]||(F[5]=o.createElementVNode("span",null,"맞춤법/문법 오류",-1)),o.createVNode(Y,{class:"text-sm bg-blue-500 hover:bg-blue-500 dark:bg-dark-blue-100 px-2"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(r))+"개",1)]),_:1})]),_:1}),o.createVNode(H,{onClick:F[1]||(F[1]=G=>b.value=!1),class:"text-xs flex items-center gap-x-1"},{default:o.withCtx(()=>[o.createVNode(j,{name:"Close",class:"w-4 h-4"}),o.createTextVNode(o.toDisplayString(B.$t("editor.close")),1)]),_:1})]),_:1}),o.createVNode(L),o.createVNode(W,{editorsState:o.unref(n),spellCheckStatus:o.unref(i),allWrongWordsMissSuggestions:o.unref(s),onCloseModal:F[2]||(F[2]=G=>b.value=!1),onRunSpellcheck:o.unref(g),onReplaceAllEditorErrors:F[3]||(F[3]=G=>(o.unref(v)(),b.value=!1))},null,8,["editorsState","spellCheckStatus","allWrongWordsMissSuggestions","onRunSpellcheck"])],4)]),_:1})]),_:1},8,["open"])}}}),QJ=Object.freeze(Object.defineProperty({__proto__:null,default:vE},Symbol.toStringTag,{value:"Module"})),bE=Qe.create({name:"invalidCharFocus",addOptions(){return{invalidChars:["{","}"]}},addCommands(){return{focusInvalidChar:()=>({state:t,dispatch:e,view:n})=>{let r=null;if(t.doc.descendants((s,a)=>{if(!s.isText)return!0;const l=s.text??"";for(let u=0;u<l.length;u++)if(this.options.invalidChars.includes(l[u])){const c=a+u+1;(r==null||c<r)&&(r=c)}return!0}),r==null)return!1;const i=t.tr.setSelection(Ie.create(t.doc,r));return e&&e(i.scrollIntoView()),n&&n.focus(),!0},hasInvalidChar:()=>({state:t})=>{let e=!1;return t.doc.descendants(n=>{if(!n.isText)return!0;const r=n.text??"";return this.options.invalidChars.some(i=>r.includes(i))?(e=!0,!1):!0}),e}}}}),Ab=o.defineComponent({__name:"SimpleEditor",props:{modelValue:{default:""},parentEditor:{default:null},isReadOnly:{type:Boolean},autofocus:{type:[String,Number,Boolean,null],default:"start"},spellcheckEnabled:{type:Boolean,default:!0}},emits:["update:modelValue"],setup(t,{expose:e,emit:n}){const r=t,i=n,s=o.inject("isMobile",!1),a=o.inject("minCharSuperInput",0),l=[Z5,X5,J5,G5,Y5.configure({placeholder:"수퍼를 입력하세요"}),bE,N5],u=o.ref(r.spellcheckEnabled),c=o.computed(()=>r.parentEditor?.extensionManager.extensions.find(Y=>Y.name==="spellchecker")),f=o.computed(()=>gE.configure({proofreader:new dS({api:c.value?.options.proofreader?.api,limit:c.value?.options.proofreader?.limit,transfer:c.value?.options.proofreader?.transfer,enabled:u.value}),uiStrings:c.value?.options.uiStrings,bulkSpellCheckerButton:c.value?.options.bulkSpellCheckerButton,spellcheckHighlightMode:c.value?.options.spellcheckHighlightMode,spellcheckHighlightColor:c.value?.options.spellcheckHighlightColor})),p=new Oo({enablePasteRules:!1,enableInputRules:!1,content:r.modelValue,extensions:l.concat(f.value),editable:!r.isReadOnly,autofocus:r.autofocus,onUpdate:({editor:Y})=>{i("update:modelValue",Y.getHTML())},parseOptions:{preserveWhitespace:"full"}});o.watch(()=>r.isReadOnly,Y=>{p.setEditable(!Y),p?.commands?.setIsEnableSuggestion&&p.commands.setIsEnableSuggestion(!Y)},{immediate:!0});function m(Y){const{view:N}=p,{from:H}=N.state.selection;p.commands.insertContentAt(H,Y),p.commands.focus()}function g(){u.value=!u.value,p.commands.handleActiveSpellCheck(u.value),p?.commands?.setIsEnableSuggestion&&p.commands.setIsEnableSuggestion(u.value)}const{contentInner:v,measuredMinWidth:b,measure:w}=pf({minChars:a,fontSize:"",editor:p});o.watch(()=>r.modelValue,()=>{w(),p&&p.getHTML()!==r.modelValue&&p.commands.setContent(r.modelValue??"",!1,{preserveWhitespace:"full"})});const x=o.inject("fontSize",""),C=o.inject("fontFamily",""),E=o.inject("fontWeight",""),k=o.inject("letterSpacing",""),T=o.computed(()=>s?{fontSize:o.unref(x),fontFamily:o.unref(C),fontWeight:o.unref(E),letterSpacing:o.unref(k)}:{}),S=o.computed(()=>s?{paddingLeft:"7px",paddingRight:"7px"}:{width:`${b.value}px`}),V=document.createElement("canvas").getContext("2d");function O(){if(!b.value||!(v.value instanceof Element)||!V)return;const Y=p.getText({blockSeparator:`
342
342
  `}),N=getComputedStyle(v.value);V.font=N.font;const H=20,D=()=>Math.max(0,(b.value||0)-H);function L(G,se){let fe=1,Ee=G.length,ae=0;for(;fe<=Ee;){const me=Math.floor((fe+Ee)/2);V.measureText(G.slice(0,me)).width<=se?(ae=me,fe=me+1):Ee=me-1}return ae}let W="";const P=[];for(const G of Y){if(G===`
343
343
  `){P.push(W),W="";continue}if(W+=G,V.measureText(W).width>D())for(;V.measureText(W).width>D();){const se=L(W,D());se<=0?(P.push(W.charAt(0)),W=W.slice(1)):(P.push(W.slice(0,se)),W=W.slice(se))}}return P.push(W),P.map(G=>`<p>${G}</p>`).join("")}const B=o.computed(()=>{const Y=r.parentEditor?.storage.superText.superInputModal?.props?.guidelineLeftOffset;return s.value||!Y?{}:{backgroundImage:"linear-gradient(to right, #d1d5db 1px, transparent 1px)",backgroundSize:"1px 100%",backgroundRepeat:"no-repeat",backgroundPosition:Yt(Y)}}),{isScrolling:F,handleScroll:j}=Xl();return e({insertSpecialCharater:m,isChecked:u,toggleSpellCheck:g,wrapText:O,editor:p}),(Y,N)=>(o.openBlock(),o.createElementBlock("div",{ref_key:"contentInner",ref:v,class:o.normalizeClass(o.unref(ke)("h-40 overflow-y-auto border focus-within:border-ed-input-focus rounded-[3px] p-2.5 relative",Y.isReadOnly&&"border-none",o.unref(s)&&"h-auto min-h-20 max-h-44 border-ed-gray rounded-md px-4 py-2.5",o.unref(s)&&!o.unref(F)&&"scrollbar-thumb-transparent")),style:o.normalizeStyle([o.unref(S),o.unref(B),o.unref(T)]),onScroll:N[0]||(N[0]=(...H)=>o.unref(j)&&o.unref(j)(...H))},[o.createVNode(o.unref(Yn),{id:"editor-panel",editor:o.unref(p),class:o.normalizeClass(o.unref(ke)("vdc-editor relative h-full"))},null,8,["editor","class"])],38))}}),NJ={class:"sr-only"},eZ={class:"grid m-2.5 p-2.5 gap-y-2.5 rounded border border-gray-200"},tZ={class:"grid grid-cols-[60px,1fr] gap-x-2"},nZ={class:"flex items-center space-x-2 text-xs font-normal [&>input[type='checkbox']]:h-[20px] [&>input[type='checkbox']]:w-[20px] [&>input[type='checkbox']]:!border-ed-border [&>input[type='checkbox']]:shadow"},rZ=["checked"],oZ={for:"spellcheck",class:"select-none whitespace-nowrap"},iZ={class:"flex gap-x-1"},sZ={class:"ml-auto"},aZ={class:"grid grid-cols-[60px,1fr] gap-x-2"},lZ={class:"text-right text-sm p-2"},uZ={class:"grid grid-cols-[60px,1fr] gap-x-2"},yE=5,Uc=o.defineComponent({__name:"SuperInputDialog",props:{editor:{},open:{type:Boolean},superTextInit:{},superTextElementId:{}},emits:["close","save"],setup(t,{emit:e}){const n=e,r=t,{t:i}=Pt(),s=o.ref(""),a=o.ref(""),l=o.ref(null),u=o.ref(!1),c=ct.useLocalStorage("superInputModalPosition",null),f=o.reactive({x:0,y:0}),p=o.ref(!1),m={x:0,y:0},g=o.ref(!1),v=o.ref(!1),b=o.ref(!1),w=q=>{p.value=!0;const G=q.currentTarget.closest(".draggable-dialog").getBoundingClientRect();m.x=q.clientX-G.left,m.y=q.clientY-G.top,document.addEventListener("mousemove",x),document.addEventListener("mouseup",C)},x=q=>{p.value&&(f.x=q.clientX-m.x,f.y=q.clientY-m.y)},C=()=>{p.value=!1,c.value={x:f.x,y:f.y},document.removeEventListener("mousemove",x),document.removeEventListener("mouseup",C)};o.watch(()=>r.open,async q=>{if(!q)return;v.value=!1,r.superTextInit&&(s.value=r.superTextInit,r.superTextElementId&&(a.value=r.superTextElementId)),await o.nextTick();const G=document.querySelector(".draggable-dialog");if(!G)return;G.getBoundingClientRect();const se=window.innerWidth,fe=window.innerHeight;c.value&&c.value.x!==void 0&&c.value.y!==void 0?(f.x=c.value.x,f.y=c.value.y):(f.x=Math.max((se-G.offsetWidth)/2,0),f.y=Math.max((fe-G.offsetHeight)/2,0))},{immediate:!0});const E=()=>{n("close"),s.value="",a.value="",u.value=!1},k=()=>{if(l.value?.editor.commands.hasInvalidChar()){b.value=!0;return}s.value=l.value.wrapText(),a.value="",v.value?g.value=!0:n("close"),n("save",s.value),s.value=""},T=()=>{g.value=!1,n("close")},S=r.editor?.extensionManager.extensions.find(q=>q.name==="superText")?.options.specialCharModal,A=o.inject("isEditable",void 0),V=o.computed(()=>A?!o.unref(A):r.editor?!r.editor.isEditable:!1),O=o.inject("fontFamily",""),B=o.computed(()=>r.editor?.storage.superText.superInputModal?.props?.fontFamily??o.unref(O)??void 0),F=o.inject("fontSize",o.ref("")),j=o.computed(()=>r.editor?.storage.superText.superInputModal?.props?.fontSize??o.unref(F)??"14px"),Y=ct.useLocalStorage("recentSpecialChars",[]),N=q=>{if(!q)return;const G=(Y.value??[]).filter(se=>se!==q);G.unshift(q),Y.value=G.slice(0,yE)},H=q=>{l.value?.insertSpecialCharater(q)},D=(q,G)=>{G&&(l.value?.insertSpecialCharater(q),N(q))},L=o.computed(()=>l.value?.isChecked),W=()=>{l.value?.toggleSpellCheck()};o.onUnmounted(()=>{document.removeEventListener("mousemove",x),document.removeEventListener("mouseup",C)}),o.watch(s,q=>{!r.superTextElementId||r.superTextElementId===""||(v.value=q!==(r.superTextInit??""))});const P=o.computed(()=>l.value?.editor);return(q,G)=>{const se=dh,fe=ch,Ee=uh,ae=lh,me=vE,J=ub,ee=Dc,ne=Rc,oe=IX;return o.openBlock(),o.createElementBlock(o.Fragment,null,[o.createVNode(ne,{open:q.open,modal:!o.unref(V)},{default:o.withCtx(()=>[o.createVNode(o.unref(Yg),null,{default:o.withCtx(()=>[o.createVNode(o.unref(t1),{class:"!pointer-events-none bg-black/30"}),o.createVNode(ee,{"is-overlay-transparent":"",class:"p-0 gap-0 !animate-none !transition-none max-w-max","as-child":""},{default:o.withCtx(()=>[o.createElementVNode("div",{class:"draggable-dialog fixed z-[70] pointer-events-auto",style:o.normalizeStyle({top:"0px",left:"0px",transform:`translate(${f.x}px, ${f.y}px)`,fontFamily:o.unref(B),fontWeight:"normal",fontSize:o.unref(j)})},[o.createVNode(Ee,{class:"bg-blue-500 text-white p-2.5 rounded-t-[5px] cursor-move",onMousedown:o.withModifiers(w,["prevent"])},{default:o.withCtx(()=>[o.createVNode(se,null,{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(i)("editor.superinput")),1)]),_:1}),o.createVNode(fe,{class:"absolute right-3 top-3 text-white",onClick:E},{default:o.withCtx(()=>[o.createVNode(o.unref(cc),{class:"w-5 h-5"}),o.createElementVNode("span",NJ,o.toDisplayString(q.$t("editor.close")),1)]),_:1})]),_:1}),o.createVNode(ae),o.createElementVNode("div",eZ,[o.createElementVNode("div",tZ,[G[5]||(G[5]=o.createElementVNode("label",null," ",-1)),o.createElementVNode("div",{class:o.normalizeClass(o.unref(ke)("flex gap-x-6",o.unref(Y).length===yE&&"gap-x-4"))},[o.createVNode(mn,{class:"text-[#65558F] bg-[#ECE6F0] hover:bg-[#ECE6F0]/90 shadow text-xs rounded font-normal h-[25px] px-3",onClick:G[0]||(G[0]=ce=>u.value=!0)},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(i)("editor.insert.symbol")),1)]),_:1}),o.createElementVNode("div",nZ,[o.createElementVNode("input",{id:"spellcheck",type:"checkbox",class:"shrink-0",checked:o.unref(L),onChange:W},null,40,rZ),o.createElementVNode("label",oZ,o.toDisplayString(o.unref(i)("editor.menubar.menu.spellCheck")),1)]),o.createElementVNode("div",iZ,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(o.unref(Y),ce=>(o.openBlock(),o.createBlock(mn,{key:ce,variant:"outline",size:"xs",class:"h-[25px] w-[25px] p-0",onClick:_e=>H(ce)},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(ce),1)]),_:2},1032,["onClick"]))),128))]),o.createElementVNode("div",sZ,[o.unref(P)?(o.openBlock(),o.createBlock(me,{key:0,editor:o.unref(P),"is-enable-spell-check-real-time":o.unref(P)?.extensionStorage.spellchecker.spellchecker.proofreader.enabled,align:"left"},null,8,["editor","is-enable-spell-check-real-time"])):o.createCommentVNode("",!0)])],2),u.value?(o.openBlock(),o.createBlock(o.resolveDynamicComponent(o.unref(S)?.component),o.mergeProps({key:0,"custom-class":"!z-[70] !pointer-events-auto","font-family":o.unref(B)},o.unref(S).props,{onSelectedChar:D,onClose:G[1]||(G[1]=ce=>u.value=!1)}),null,16,["font-family"])):o.createCommentVNode("",!0)]),o.createElementVNode("div",aZ,[o.createElementVNode("label",lZ,o.toDisplayString(o.unref(i)("editor.detail")),1),o.createVNode(Ab,{ref_key:"simpleEditorRef",ref:l,modelValue:s.value,"onUpdate:modelValue":G[2]||(G[2]=ce=>s.value=ce),"parent-editor":q.editor,class:""},null,8,["modelValue","parent-editor"])]),o.createElementVNode("div",uZ,[G[6]||(G[6]=o.createElementVNode("label",{class:"text-right text-sm p-2"},"ID",-1)),o.createVNode(ws,{modelValue:a.value,"onUpdate:modelValue":G[3]||(G[3]=ce=>a.value=ce),class:"rounded-none","default-value":a.value,disabled:""},null,8,["modelValue","default-value"])])]),o.createVNode(J,{class:"sm:justify-center pb-3.5 pt-1"},{default:o.withCtx(()=>[o.createVNode(mn,{as:"button",variant:"default",class:"bg-blue-500 hover:bg-blue-500/90",onClick:k},{default:o.withCtx(()=>[o.createVNode(o.unref(S1),{class:"w-5 h-5 mr-2"}),o.createTextVNode(" "+o.toDisplayString(o.unref(i)("editor.check")),1)]),_:1}),o.createVNode(mn,{as:"button",variant:"destructive",onClick:E},{default:o.withCtx(()=>[o.createVNode(o.unref(cc),{class:"w-5 h-5 mr-2"}),o.createTextVNode(" "+o.toDisplayString(q.$t("editor.close")),1)]),_:1})]),_:1})],4)]),_:1})]),_:1})]),_:1},8,["open","modal"]),o.createVNode(oe,{open:g.value,onClose:T},null,8,["open"]),o.createVNode(oe,{title:"Information",message:"{ 과 } 는 입력이 제한된 문자열 입니다.",iconName:"MessageCircleWarning",confirmText:"Ok",open:b.value,onClose:G[4]||(G[4]=ce=>b.value=!1)},null,8,["open"])],64)}}}),Mb=o.defineComponent({__name:"SelectContextMenu",props:{editor:{},mode:{},superTextStore:{},disabled:{type:Boolean},disableSuperInput:{type:Boolean}},setup(t,{expose:e}){const n=t,{t:r}=Pt(),i=o.ref(!1),s=o.reactive({from:0,to:0,text:""}),a=o.inject("isEditable",o.ref(!0)),l=o.inject("canEditSuper",o.ref(!0)),u=o.computed(()=>n.mode===Te.EDITOR||n.mode===Te.PLAIN_TEXT||!l.value||n.disableSuperInput);function c(){if(!n.editor)return"";const{from:C,to:E}=n.editor.state.selection,k=n.editor.state.doc.cut(C,E),S=Ir.fromSchema(n.editor.schema).serializeFragment(k.content),A=document.createElement("div");return A.appendChild(S),A.innerHTML}const f=()=>{const{view:C}=n.editor,{from:E,to:k}=C.state.selection,T=c();s.text=T,s.from=E,s.to=k},p=()=>i.value=!i.value,m=()=>{u.value||(i.value=!0,f())},g=()=>i.value=!1,v=C=>{if(Hc(C.trim())){i.value=!1;return}const E=n?.superTextStore.addMoreSuperText(C);n.editor&&n.editor.commands.insertContentAt(s.from,{type:"superText",attrs:{"data-id":E,"data-text":C}}),i.value=!1,requestAnimationFrame(()=>{n.editor.commands.setTextSelection(s.from+1),n.editor.view.focus()})},b=o.ref(!1),w=async C=>{if(C){const E=await n.editor.hasClipboard?.();b.value=!!E}},x=()=>{if(u.value||!n.editor)return;const{view:C,state:E}=n.editor,{from:k,to:T}=E.selection;s.from=k,s.to=T,s.text="",C.dom.blur(),i.value=!0};return e({toggleDialog:p,openDialog:m,closeDialog:g}),(C,E)=>{const k=Uc,T=lb,S=ab,A=sb,V=ib;return C.disabled?o.renderSlot(C.$slots,"default",{key:0}):(o.openBlock(),o.createElementBlock(o.Fragment,{key:1},[o.createVNode(k,{open:i.value,editor:C.editor,"super-text-init":s.text,onClose:p,onSave:v},null,8,["open","editor","super-text-init"]),o.createVNode(V,{"onUpdate:open":w},{default:o.withCtx(()=>[o.createVNode(T,{as:"template",class:"relative",disabled:o.unref(u),onDblclick:o.withModifiers(x,["prevent","stop"])},{default:o.withCtx(()=>[o.renderSlot(C.$slots,"default")]),_:3},8,["disabled"]),o.createVNode(A,null,{default:o.withCtx(()=>[C.disableSuperInput?o.createCommentVNode("",!0):(o.openBlock(),o.createBlock(S,{key:0,onSelect:m},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(r)("editor.inputSuper")),1)]),_:1})),o.unref(a)?(o.openBlock(),o.createBlock(S,{key:1,onSelect:E[0]||(E[0]=O=>C.editor?.commands.cutContent())},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(r)("editor.cut")),1)]),_:1})):o.createCommentVNode("",!0),o.unref(a)?(o.openBlock(),o.createBlock(S,{key:2,onSelect:E[1]||(E[1]=O=>C.editor?.commands.copyContent())},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(r)("editor.copy")),1)]),_:1})):o.createCommentVNode("",!0),o.unref(a)?(o.openBlock(),o.createBlock(S,{key:3,disabled:!b.value,onSelect:E[2]||(E[2]=O=>C.editor?.commands.pasteContent())},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(r)("editor.paste")),1)]),_:1},8,["disabled"])):o.createCommentVNode("",!0)]),_:1})]),_:3})],64))}}}),cZ={id:"editor-panel",class:"flex relative w-full h-full"},dZ=Xr(o.defineComponent({__name:"PageNode",props:ta,setup(t){const{state:e,page:n,superTextStore:r}=bn(),{size:i,pagination:s,margin:a}=n.value,l=o.ref(null),u=o.ref(t.node.attrs.viewSuperTextArea),c=o.computed(()=>u.value&&t.editor.storage.page.mode!=="editor"),f=o.computed(()=>t.editor.storage.page.mode===Te.REPORT),{width:p,height:m}=i,g=o.computed(()=>s?`calc(${m} - ${a?.top??0} - ${a?.bottom??0}`:"max-content"),v=ct.useEventBus(ur.SUPER_VIEW_PAGE);return o.watch(()=>t.node.attrs,b=>{v.emit(b.pageNumber)},{immediate:!0}),(b,w)=>{const x=Mb;return o.openBlock(),o.createBlock(o.unref(ea),{id:b.node.attrs.id,ref_key:"containerRef",ref:l,"page-number":b.node.attrs.pageNumber,class:"overflow-hidden umo-page-node-view w-full border rounded-[3px] border-[#999999]",style:o.normalizeStyle({"--umo-page-margin-top":o.unref(a)?.top??"0","--umo-page-margin-bottom":o.unref(a)?.bottom??"0","--umo-page-margin-left":o.unref(a)?.left??"0","--umo-page-margin-right":o.unref(a)?.right??"0","--umo-page-width":o.unref(p),"--umo-page-height":o.unref(m),"--empty-node-left":"0px",left:100,"min-height":typeof o.unref(m)=="number"?`${o.unref(m)}px`:o.unref(m),height:f.value?typeof o.unref(m)=="number"?`${o.unref(m)}px`:o.unref(m):"auto"})},{default:o.withCtx(()=>[o.createElementVNode("div",cZ,[o.createVNode(x,{mode:c.value?o.unref(Te).REPORT:o.unref(Te).EDITOR,editor:b.editor,"super-text-store":o.unref(r)},{default:o.withCtx(()=>[o.createVNode(o.unref(ix),{class:"umo-page-node-content",style:o.normalizeStyle({height:g.value})},null,8,["style"])]),_:1},8,["mode","editor","super-text-store"])])]),_:1},8,["id","page-number","style"])}}}),[["__scopeId","data-v-7d55d7ea"]]);function wE(t,e){const n=t.storedMarks??(t.selection.$to.parentOffset&&t.selection.$from.marks());if(n){const r=n.filter(i=>e?.includes(i.type.name));t.tr.ensureMarks(r)}}const fZ=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:i})=>{const{selection:s,doc:a}=e,{$from:l,$to:u}=s,c=i.extensionManager.attributes,f=kh(c,l.node().type.name,l.node().attrs);if(f.id=Yv(),f.extend&&(f.extend=!1),s instanceof Re&&s.node.isBlock)return!l.parentOffset||!mr(a,l.pos)?!1:(r&&(t&&wE(n,i.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;if(r){const p=u.parentOffset===u.parent.content.size;s instanceof Ie&&e.deleteSelection();const m=l.depth===0?void 0:i4(l.node(-1).contentMatchAt(l.indexAfter(-1)));let g=p&&m?[{type:m,attrs:f}]:void 0,v=mr(e.doc,e.mapping.map(l.pos),1,g);if(!g&&!v&&mr(e.doc,e.mapping.map(l.pos),1,m?[{type:m}]:void 0)&&(v=!0,g=m?[{type:m,attrs:f}]:void 0),v&&(g||(g=[{type:l.node().type,attrs:f}]),e.split(e.mapping.map(l.pos),1,g),m&&!p&&!l.parentOffset&&l.parent.type!==m)){const b=e.mapping.map(l.before()),w=e.doc.resolve(b);l.node(-1).canReplaceWith(w.index(),w.index()+1,m)&&e.setNodeMarkup(e.mapping.map(l.before()),m)}t&&wE(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return!0},pZ=t=>({tr:e,state:n,dispatch:r,editor:i})=>{const s=vn(t,n.schema),{$from:a,$to:l}=n.selection;if((n.selection instanceof Re?n.selection.node:null)?.isBlock||a.depth<2||!a.sameParent(l))return!1;const c=a.node(-1);if(c.type!==s)return!1;const f=i.extensionManager.attributes;if(a.parent.content.size===0&&a.node(-1).childCount===a.indexAfter(-1)){if(a.depth===2||a.node(-3).type!==s||a.index(-2)!==a.node(-2).childCount-1)return!1;if(r){let b=ge.empty;const w=a.index(-1)?1:a.index(-2)?2:3;for(let S=a.depth-w;S>=a.depth-3;S-=1)b=ge.from(a.node(S).copy(b));const x=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,C=kh(f,a.node().type.name,a.node().attrs),E=s.contentMatch.defaultType?.createAndFill(C)??void 0;b=b.append(ge.from(s.createAndFill(null,E)??void 0));const k=a.before(a.depth-(w-1));e.replace(k,a.after(-x),new Se(b,4-w,0));let T=-1;e.doc.nodesBetween(k,e.doc.content.size,(S,A)=>{if(T>-1)return!1;S.isTextblock&&S.content.size===0&&(T=A+1)}),T>-1&&e.setSelection(Ie.near(e.doc.resolve(T))),e.scrollIntoView()}return!0}const p=l.pos===a.end()?c.contentMatchAt(0).defaultType:null,m=kh(f,c.type.name,c.attrs),g=kh(f,a.node().type.name,a.node().attrs);m.id=Yv(),g.id=Yv(),e.delete(a.pos,l.pos);const v=p?[{type:s,attrs:m},{type:p,attrs:g}]:[{type:s,attrs:m}];if(!mr(e.doc,a.pos,2))return!1;if(r){const{selection:b,storedMarks:w}=n,{splittableMarks:x}=i.extensionManager,C=w??(b.$to.parentOffset&&b.$from.marks());if(e.split(a.pos,2,v).scrollIntoView(),!C||!r)return!0;const E=C.filter(k=>x.includes(k.type.name));e.ensureMarks(E)}return!0},hZ=[eh,Np,th,Jv,nh,Ss,Qv,Hl,eb,nb,Nv,_a,zl,Ci,tb,rb,Zv,Gr],mZ=Lt.create({priority:200,name:`${Gr}`,content:"block*",group:`${Gr}`,isolating:!0,selectable:!1,draggable:!1,isLeaf:!0,addOptions(){return{SystemAttributes:{},nodesComputed:{},View:na(dZ),types:[],slots:{}}},addAttributes(){return{HTMLAttributes:{},id:{default:$r(10)},pageNumber:{default:1},force:{default:!1},viewSuperTextArea:{default:!0},slots:{default:this.options.slots,renderHTML:()=>({})}}},parseHTML(){return[{tag:`div[data-type="${this.name}"]`}]},renderHTML({node:t,HTMLAttributes:e}){return["div",{...wt(e),"data-type":this.name},0]},addCommands(){return{splitBlock:fZ,splitListItem:pZ,autoPaging:(t=!0)=>({tr:e,state:n,dispatch:r,editor:i})=>(r&&e.setMeta("runState",t),!0),setPageBreak:()=>({tr:t,state:e,dispatch:n,editor:r})=>(n&&t.setMeta("splitPage",!0),!0),togglePagePlugin:t=>({tr:e,dispatch:n})=>(e.setMeta("disablePage",t),n&&n(e),!0)}},addGlobalAttributes(){return[{types:hZ.concat(this.options.types||[]),attributes:{id:{default:null},extend:{default:!1}}}]},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.first(({commands:r})=>[()=>r.undoInputRule(),()=>r.command(({tr:i})=>{const{selection:s,doc:a}=i,{empty:l,$anchor:u}=s,{pos:c,parent:f}=u,p=ze.atStart(a).from===c;return!l||!p||!f.type.isTextblock||f.textContent.length?!1:r.clearNodes()}),()=>xE(r),()=>r.joinBackward(),()=>r.selectNodeBackward(),()=>r.command(({editor:i,tr:s})=>{const{selection:a,doc:l}=s,{$anchor:u}=a,{pos:c}=u;if(l.childCount===1)return!1;if(ze.atEnd(l).from===c&&!u.parentOffset)return r.deleteNode(Gr);const f=ai(p=>p.type.name===Gr)(a);if(f){if(!f.node.firstChild)return r.deleteNode(Gr);const p=f.node.firstChild.type;if(f.start+ze.atStart(f.node).from===c){const g=Ie.create(l,f.start-2,f.start-2),v=ai(b=>b.type.name===Gr)(g);if(v){const b=ze.atEnd(v.node).from+v.start,w=Ie.create(l,b,b);if(p===v.node.lastChild.type){const{parent:x}=w.$anchor;return KG(x,i.schema)?s.setSelection(w):s.step(new hn(b,c,Se.empty)),!0}s.setSelection(w)}return!0}}return!1})]),Delete:()=>this.editor.commands.first(({commands:r})=>[()=>xE(r),()=>r.command(({tr:i})=>{const{selection:s,doc:a}=i,{$anchor:l}=s,u=l.node(),c=ai(f=>f.type.name===Hl)(s);return c&&c.start+ze.atStart(c.node).from===l.pos&&c.node.childCount===1&&u.content.size===0?!0:r.joinForward()}),()=>r.selectNodeForward(),()=>r.command(({tr:i})=>{const{selection:s,doc:a}=i,{$anchor:l}=s,{pos:u}=l;if(a.childCount===1)return!1;if(ze.atEnd(a).from===u)return r.deleteNode(Gr);const c=ai(f=>f.type.name===Gr)(s);if(c&&c.start+ze.atEnd(c.node).from===u){const p=Ie.create(a,u+2,u+2),m=ai(g=>g.type.name===Gr)(p);if(m){const g=ze.atStart(m.node).from+m.start,v=Ie.create(a,g,g);if(ai(w=>w.attrs.extend)(v))return i.step(new hn(u,g,Se.empty)),!0}}return!1})]),Tab:()=>this.editor.commands.first(({commands:r})=>[()=>!this.editor.isActive("table")]),"Mod-Enter":()=>this.editor.commands.setPageBreak()}},addNodeView(){return this.options.View}});function kh(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const i=t.find(s=>s.type===e&&s.name===r);return i?i.attribute.keepOnSplit:!1}))}const xE=t=>t.command(({tr:e})=>{const{selection:n,doc:r}=e,i=s4(r,{from:n.from,to:n.to},s=>s.type.name===Hl);for(const s of i){const a=s.pos+s.node.nodeSize;if(n.from<s.pos||n.to>a)return!0}return t.deleteSelection()}),CE={"editor.remove":"Remove","editor.copy":"Copy","editor.words":"WORDS","editor.characters":"CHARACTERS","editor.default":"Default","editor.recent":"Recently Used","editor.nofill":"Remove Color","editor.format":"Format Painter","editor.close":"Close","editor.modify":"Modify","editor.preview.tooltip":"Preview","editor.draghandle.tooltip":"Click And Drag","editor.copyToClipboard":"CopyToClipboard","editor.importWord.tooltip":"Import from Word","editor.importWord.success":"Import Success","editor.importWord.fileTooLarge":"File is Too large","editor.importWord.error":"Import Failed, File not supported","editor.slash":"Press '/' for commands","editor.slash.empty":"No Result","editor.slash.format":"Format","editor.slash.insert":"Insert","editor.slash.embed":"Embed Services","editor.content":"Please input content","editor.slash.hint":"Please input content","editor.moremark":"More Text Styles","editor.size.small.tooltip":"Small","editor.size.medium.tooltip":"Medium","editor.size.large.tooltip":"Cover","editor.bold.tooltip":"Bold","editor.italic.tooltip":"Italic","editor.underline.tooltip":"Underline","editor.strike.tooltip":"Strike","editor.color.tooltip":"Color","editor.color.more":"Color Picker","editor.highlight.tooltip":"Highlight","editor.lineheight.tooltip":"Line Height","editor.heading.tooltip":"Headings","editor.heading.h1.tooltip":"Heading 1","editor.heading.h2.tooltip":"Heading 2","editor.heading.h3.tooltip":"Heading 3","editor.heading.h4.tooltip":"Heading 4","editor.heading.h5.tooltip":"Heading 5","editor.heading.h6.tooltip":"Heading 6","editor.paragraph.tooltip":"Paragraph","editor.textalign.tooltip":"Align","editor.textalign.left.tooltip":"Left","editor.textalign.center.tooltip":"Center","editor.textalign.right.tooltip":"Right","editor.textalign.justify.tooltip":"Justify","editor.indent":"Indent","editor.indent.indent":"Increase Indent","editor.indent.outdent":"Decrease Indent","editor.fontFamily.tooltip":"Font family","editor.fontFamily.default":"Default","editor.fontFamily.gulim":"Gulim","editor.fontFamily.dotum":"Dotum","editor.fontFamily.gungsuh":"Gungsuh","editor.fontSize.tooltip":"Font size","editor.fontSize.default.tooltip":"Default","editor.superscript.tooltip":"Superscript","editor.subscript.tooltip":"Subscript","editor.bulletlist.tooltip":"Bullet List","editor.bulletlist.disc.tooltip":"Disc","editor.bulletlist.circle.tooltip":"Circle","editor.bulletlist.square.tooltip":"Square","editor.orderedlist.tooltip":"Ordered List","editor.orderedlist.decimal.tooltip":"Decimal","editor.orderedlist.decimalLeadingZero.tooltip":"Decimal with leading zero","editor.orderedlist.lowerRoman.tooltip":"Lower Roman","editor.orderedlist.upperRoman.tooltip":"Upper Roman","editor.orderedlist.lowerLatin.tooltip":"Lower Latin","editor.orderedlist.upperLatin.tooltip":"Upper Latin","editor.orderedlist.tradChineseInformal.tooltip":"Trad Chinese Informal","editor.orderedlist.simpChineseFormal.tooltip":"Simp Chinese Informal","editor.tasklist.tooltip":"Task List","editor.indent.tooltip":"Indent","editor.outdent.tooltip":"Outdent","editor.columns.tooltip":"Columns","editor.link.tooltip":"Link","editor.link.unlink.tooltip":"UnLink","editor.link.open.tooltip":"Open Link","editor.link.edit.tooltip":"Edit Link","editor.link.dialog.title":"Insert Link","editor.link.dialog.link":"Link","editor.link.dialog.text":"Text","editor.link.dialog.openInNewTab":"Open In New Tab","editor.link.dialog.link.placeholder":"Link Address","editor.link.dialog.text.placeholder":"Add Description","editor.link.dialog.button.apply":"Apply","editor.image.tooltip":"Image","editor.image.menu.flipX":"Flip vertical","editor.image.menu.flipY":"Flip horizontal","editor.image.menu.moveUp":"Move up","editor.image.menu.moveDown":"Move down","editor.image.menu.size":"Set Size","editor.image.menu.size.width":"Width","editor.image.menu.size.height":"Height","editor.image.dragger.tooltip":"Click or drag the image to the area to upload","editor.image.float.left.tooltip":"Float left","editor.image.float.none.tooltip":"Float none","editor.image.float.right.tooltip":"Float right","editor.image.dialog.title":"Add an image","editor.image.dialog.tab.url":"Url","editor.image.dialog.tab.upload":"Upload","editor.image.dialog.uploading":"Uploading","editor.image.dialog.form.link":"Link","editor.image.dialog.placeholder":"Link","editor.image.dialog.form.alt":"Alt","editor.image.dialog.form.aspectRatio":"Lock original aspect ratio","editor.image.dialog.form.file":"File","editor.image.dialog.button.apply":"apply","editor.video.tooltip":"Video","editor.video.dialog.tab.upload":"Upload","editor.video.dialog.uploading":"Uploading","editor.video.dialog.title":"Embed or upload a video","editor.video.dialog.link":"link","editor.video.dialog.placeholder":"Link","editor.video.dialog.button.apply":"apply","editor.table.tooltip":"Table","editor.table.menu.insert_table":"Insert Table","editor.table.menu.insert_table.with_header_row":"With header row","editor.table.menu.insertColumnBefore":"Insert Column Before","editor.table.menu.insertColumnAfter":"Insert Column After","editor.table.menu.deleteColumn":"Delete Column","editor.table.menu.insertRowAbove":"Insert Row Above","editor.table.menu.insertRowBelow":"Insert Row Below","editor.table.menu.deleteRow":"Delete Row","editor.table.menu.mergeCells":"Merge Cells","editor.table.menu.splitCells":"Split Cells","editor.table.menu.deleteTable":"Delete Table","editor.table.menu.setCellsBgColor":"Cell Background Color","editor.blockquote.tooltip":"Blockquote","editor.horizontalrule.tooltip":"Horizontal Rule","editor.code.tooltip":"Code","editor.codeblock.tooltip":"Code Block","editor.clear.tooltip":"Clear Format","editor.undo.tooltip":"Undo","editor.redo.tooltip":"Redo","editor.fullscreen.tooltip.fullscreen":"Fullscreen","editor.fullscreen.tooltip.exit":"Fullscreen Exit","editor.imageUpload.fileTypeNotSupported":"File type not supported","editor.imageUpload.fileSizeTooBig":"File size too big, Maximum size is","editor.AI.placeholder":"Ask AI ...","editor.AI.generating":"Generating","editor.AI.insert":"Insert below selection","editor.AI.replace":"Replace selected content","editor.AI.regenerate":"Regenerate","editor.AI.close":"Close","editor.AI.stop":"Stop","editor.AI.ask":"Ask AI","editor.menubar.file":"File","editor.menubar.edit":"Edit","editor.menubar.view":"View","editor.menubar.insert":"Insert","editor.menubar.format":"Format","editor.menubar.menu.newDoc":"New Document","editor.menubar.menu.restoreLastDraft":"Restore last draft","editor.menubar.menu.print":"Print","editor.menubar.menu.cut":"Cut","editor.menubar.menu.copy":"Copy","editor.menubar.menu.paste":"Paste","editor.menubar.menu.pasteAsText":"Paste as text","editor.menubar.menu.selectAll":"Select all","editor.menubar.menu.preview":"Preview","editor.menubar.menu.spellCheck":"Spell check","editor.menubar.menu.spelling":"spelling","editor.menubar.menu.superView":"Super view","editor.menubar.menu.insertSuper":"Insert super","editor.menubar.menu.articleContent":"Article content","editor.menubar.menu.articleComment":"Article comment","editor.menubar.menu.cancel":"Cancel","editor.menubar.menu.save":"Save","editor.findAndReplace.tooltip":"Find and replace","editor.findAndReplace.find":"Find","editor.findAndReplace.replace":"Replace","editor.findAndReplace.replaceAll":"Replace All","editor.findAndReplace.caseSensitive":"Case Sensitive","editor.printer.tooltip":"Print","editor.superinput":"Super input","editor.insert.symbol":"Insert symbol","editor.check":"Check","editor.detail":"Detail","editor.inputSuper":"Input Super","editor.insertSpecial":"Special characters","editor.cut":"Cut","editor.paste":"Paste","editor.selectAll":"SelectAll","editor.delete":"Delete","editor.super.edit":"Super edit","editor.super.delete":"Super delete","editor.configPlan.edit":"Config plan edit","editor.configPlan.delete":"Config plan delete","editor.super":"Super","editor.configPlan":"Config plan","editor.insertConfigPlan":"Insert config plan","editor.alert":"Super has been changed. Super ID will be deleted.","editor.alertConfirm":"Confirm","editor.alertYes":"OK"},kE={"editor.remove":"제거","editor.copy":"복사","editor.words":"낱말","editor.characters":"문자","editor.default":"기본값","editor.recent":"최근 사용됨","editor.nofill":"색상 제거","editor.format":"형식 페인터","editor.close":"닫기","editor.modify":"수정","editor.preview.tooltip":"미리보기","editor.draghandle.tooltip":"클릭하여 드래그","editor.copyToClipboard":"클립보드에 복사","editor.importWord.tooltip":"Word에서 가져오기","editor.importWord.success":"가져오기 성공","editor.importWord.fileTooLarge":"파일이 너무 큽니다","editor.importWord.error":"가져오기 실패, 파일이 지원되지 않음","editor.slash":"명령을 보려면 '/'를 누르세요.","editor.slash.empty":"결과 없음","editor.slash.format":"형식","editor.slash.insert":"삽입","editor.slash.embed":"서비스 삽입","editor.content":"내용을 입력해주세요","editor.slash.hint":"내용을 입력해주세요","editor.moremark":"추가 텍스트 스타일","editor.size.small.tooltip":"작음","editor.size.medium.tooltip":"중간","editor.size.large.tooltip":"표지","editor.bold.tooltip":"굵게","editor.italic.tooltip":"기울임꼴","editor.underline.tooltip":"밑줄","editor.strike.tooltip":"취소선","editor.color.tooltip":"색상","editor.color.more":"색상 선택기","editor.highlight.tooltip":"강조 표시","editor.lineheight.tooltip":"줄간격","editor.heading.tooltip":"제목","editor.heading.h1.tooltip":"제목 1","editor.heading.h2.tooltip":"제목 2","editor.heading.h3.tooltip":"제목 3","editor.heading.h4.tooltip":"제목 4","editor.heading.h5.tooltip":"제목 5","editor.heading.h6.tooltip":"제목 6","editor.paragraph.tooltip":"단락","editor.textalign.tooltip":"양쪽정렬","editor.textalign.left.tooltip":"왼쪽","editor.textalign.center.tooltip":"가운데","editor.textalign.right.tooltip":"오른쪽","editor.textalign.justify.tooltip":"양쪽정렬","editor.indent":"들여쓰기","editor.indent.indent":"들여쓰기","editor.indent.outdent":"들여쓰기 줄이기","editor.fontFamily.tooltip":"맑은고딕","editor.fontFamily.default":"맑은고딕","editor.fontFamily.gulim":"굴림","editor.fontFamily.dotum":"돋움","editor.fontFamily.gungsuh":"궁서","editor.fontSize.tooltip":"기본값","editor.fontSize.default.tooltip":"기본값","editor.superscript.tooltip":"위 첨자","editor.subscript.tooltip":"아래첨자","editor.bulletlist.tooltip":"글머리 기호 목록","editor.bulletlist.disc.tooltip":"디스크","editor.bulletlist.circle.tooltip":"원","editor.bulletlist.square.tooltip":"사각형","editor.orderedlist.tooltip":"순서가 지정된 목록","editor.orderedlist.decimal.tooltip":"십진수","editor.orderedlist.decimalLeadingZero.tooltip":"앞에 0이 있는 십진수","editor.orderedlist.lowerRoman.tooltip":"하위 로마자","editor.orderedlist.upperRoman.tooltip":"상위 로마자","editor.orderedlist.lowerLatin.tooltip":"하위 라틴어","editor.orderedlist.upperLatin.tooltip":"상위 라틴어","editor.orderedlist.tradChinaInformal.tooltip":"중국어 비공식","editor.orderedlist.simpChinaFormal.tooltip":"간체 중국어 비공식","editor.tasklist.tooltip":"작업 목록","editor.indent.tooltip":"들여쓰기","editor.outdent.tooltip":"내어쓰기","editor.columns.tooltip":"열","editor.link.tooltip":"링크","editor.link.unlink.tooltip":"링크 해제","editor.link.open.tooltip":"링크 열기","editor.link.edit.tooltip":"링크 편집","editor.link.dialog.title":"링크 삽입","editor.link.dialog.link":"링크","editor.link.dialog.text":"텍스트","editor.link.dialog.openInNewTab":"새 탭에서 열기","editor.link.dialog.link.placeholder":"링크 주소","editor.link.dialog.text.placeholder":"설명 추가","editor.link.dialog.button.apply":"적용","editor.image.tooltip":"이미지","editor.image.menu.flipX":"세로 뒤집기","editor.image.menu.flipY":"가로 뒤집기","editor.image.menu.moveUp":"위로 이동","editor.image.menu.moveDown":"아래로 이동","editor.image.menu.size":"크기 설정","editor.image.menu.size.width":"너비","editor.image.menu.size.height":"높이","editor.image.dragger.tooltip":"업로드할 영역으로 이미지를 클릭하거나 드래그하세요.","editor.image.float.left.tooltip":"왼쪽으로 부동","editor.image.float.none.tooltip":"부동 없음","editor.image.float.right.tooltip":"오른쪽으로 부동","editor.image.dialog.title":"이미지 추가","editor.image.dialog.tab.url":"URL","editor.image.dialog.tab.upload":"업로드","editor.image.dialog.uploading":"업로드 중","editor.image.dialog.form.link":"링크","editor.image.dialog.placeholder":"링크","editor.image.dialog.form.alt":"Alt","editor.image.dialog.form.aspectRatio":"원본 가로 세로 비율 잠금","editor.image.dialog.form.file":"파일","editor.image.dialog.button.apply":"적용","editor.video.tooltip":"비디오","editor.video.dialog.tab.upload":"업로드","editor.video.dialog.uploading":"업로드 중","editor.video.dialog.title":"동영상 삽입 또는 업로드","editor.video.dialog.link":"링크","editor.video.dialog.placeholder":"링크","editor.video.dialog.button.apply":"적용","editor.table.tooltip":"표","editor.table.menu.insert_table":"테이블 삽입","editor.table.menu.insert_table.with_header_row":"머리글 행 포함","editor.table.menu.insertColumnBefore":"앞에 열 삽입","editor.table.menu.insertColumnAfter":"다음에 열 삽입","editor.table.menu.deleteColumn":"열 삭제","editor.table.menu.insertRowAbove":"위에 행 삽입","editor.table.menu.insertRowBelow":"아래에 행 삽입","editor.table.menu.deleteRow":"행 삭제","editor.table.menu.mergeCells":"셀 병합","editor.table.menu.splitCells":"셀 분할","editor.table.menu.deleteTable":"테이블 삭제","editor.table.menu.setCellsBgColor":"셀 배경색","editor.blockquote.tooltip":"블록인용","editor.horizontalrule.tooltip":"수평 규칙","editor.code.tooltip":"코드","editor.codeblock.tooltip":"코드 블록","editor.clear.tooltip":"형식 지우기","editor.undo.tooltip":"실행 취소","editor.redo.tooltip":"다시 실행","editor.fullscreen.tooltip.fullscreen":"전체 화면","editor.fullscreen.tooltip.exit":"전체 화면 종료","editor.imageUpload.fileTypeNotSupported":"지원되지 않는 파일 형식","editor.imageUpload.fileSizeTooBig":"파일 크기가 너무 큽니다. 최대 크기는 다음과 같습니다.","editor.AI.placeholder":"AI에게 물어보세요...","editor.AI.geneating":"생성","editor.AI.insert":"선택 항목 아래에 삽입","editor.AI.replace":"선택한 콘텐츠 교체","editor.AI.regenerate":"재생성","editor.AI.close":"닫기","editor.AI.stop":"중지","editor.AI.ask":"AI에게 물어보세요","editor.menubar.file":"파일","editor.menubar.edit":"편집","editor.menubar.view":"보기","editor.menubar.insert":"삽입","editor.menubar.format":"형식","editor.menubar.menu.newDoc":"새 문서","editor.menubar.menu.restoreLastDraft":"마지막 초안 복원","editor.menubar.menu.print":"인쇄","editor.menubar.menu.cut":"잘라내기","editor.menubar.menu.copy":"복사","editor.menubar.menu.paste":"붙여넣기","editor.menubar.menu.pasteAsText":"텍스트로 붙여넣기","editor.menubar.menu.selectAll":"모두 선택","editor.menubar.menu.preview":"미리보기","editor.menubar.menu.spellCheck":"맞춤법 검사","editor.menubar.menu.spelling":"맞춤법","editor.menubar.menu.superView":"수퍼보기","editor.menubar.menu.insertSuper":"수퍼 넣기","editor.menubar.menu.articleContent":"앵커멘트","editor.menubar.menu.articleComment":"상세 텍스트","editor.menubar.menu.cancel":"취소","editor.menubar.menu.save":"저장","editor.findAndReplace.tooltip":"찾기 및 바꾸기","editor.findAndReplace.find":"찾기","editor.findAndReplace.replace":"바꾸기","editor.findAndReplace.replaceAll":"모두 바꾸기","editor.findAndReplace.caseSensitive":"대소문자 구분","editor.printer.tooltip":"인쇄","editor.superinput":"수퍼입력","editor.insert.symbol":"기호삽입","editor.check":"확인","editor.detail":"내용","editor.inputSuper":"수퍼 작성","editor.insertSpecial":"특수문자","editor.cut":"잘라내기","editor.paste":"붙여넣기","editor.selectAll":"모두선택","editor.delete":"삭제","editor.super.edit":"수퍼 수정","editor.super.delete":"수퍼 삭제","editor.configPlan.edit":"구성안 수정","editor.configPlan.delete":"구성안 삭제","editor.super":"수퍼","editor.configPlan":"구성안","editor.insertConfigPlan":"구성안넣기","editor.alert":"수퍼가 변경되었습니다. 수퍼아이디를 삭제합니다.","editor.alertConfirm":"확인","editor.alertYes":"확인"},Oa=$W({legacy:!1,locale:"en",fallbackLocale:"en",messages:{en:CE,ko:kE}}),gZ=Qe.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:t=>t.style.fontFamily,renderHTML:t=>t.fontFamily?{style:`font-family: ${t.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:t=>({chain:e})=>e().setMark("textStyle",{fontFamily:t}).run(),unsetFontFamily:()=>({chain:t})=>t().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),vZ=["data-font"],bZ=o.defineComponent({__name:"FontFamilyMenuButton",props:{editor:{},disabled:{type:Boolean,default:!1},color:{default:void 0},shortcutKeys:{default:void 0},maxHeight:{default:void 0},tooltip:{default:""},items:{default:()=>[]},customClass:{default:""},showDefaultDivider:{type:Boolean,default:!1}},setup(t){const e=t,n=o.computed(()=>e.editor.extensionStorage["base-kit"].mode===Te.EDITOR),{t:r}=Pt(),i=[{label:r("editor.fontFamily.gulim"),value:"Gulim"},{label:r("editor.fontFamily.dotum"),value:"Dotum"},{label:r("editor.fontFamily.gungsuh"),value:"Gungsuh"}],s=o.inject("fontFamily"),a=o.computed(()=>{const f=e.editor.extensionManager.extensions.find(m=>m.name==="fontFamily").options;let p=[];return St.isEmpty(f.fontFamilyList)?p=i:p=f.fontFamilyList.filter(m=>m.enabled!==!1).map(m=>({label:m.label,value:m.value})),[{label:r("editor.fontFamily.default"),value:r("editor.fontFamily.default")},...p]}),l=o.computed(()=>{const f={label:r("editor.fontFamily.default"),value:r("editor.fontFamily.default")};return n.value?(F0(e.editor.state,"textStyle").fontFamily??e.editor.getAttributes("paragraph").fontFamily??e.editor.getAttributes("heading").fontFamily)||f.value:s.value||f.value});function u(f){f.value===l.value||f.value===r("editor.fontFamily.default")?(e.editor.chain().focus().unsetFontFamily().run(),s.value=null):(s.value=f.value,e.editor.chain().focus().setFontFamily(f.value).run()),e.editor.commands.setForceCloseBubble(!0)}e.editor.on("selectionUpdate",({editor:f})=>{f.state.selection.empty&&e.editor.commands.resetForceCloseBubble()});const c=o.computed(()=>{const f=a.value[0]?.label||r("editor.fontFamily.default");return a.value.find(p=>p.value===l.value)?.label||f});return(f,p)=>(o.openBlock(),o.createBlock(ga,{disabled:f.disabled,tooltip:f.tooltip,title:c.value,btn_class:`min-w-20 ${f.customClass}`,class:"inside-toolbar"},{default:o.withCtx(()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(a.value,(m,g)=>(o.openBlock(),o.createElementBlock(o.Fragment,{key:g},[o.createVNode(o.unref(Ml),{checked:l.value===m.value,onClick:v=>u(m)},{default:o.withCtx(()=>[o.createElementVNode("span",{class:"ml-1 h-full","data-font":m.label,style:o.normalizeStyle({fontFamily:m.value??void 0})},o.toDisplayString(m.label),13,vZ)]),_:2},1032,["checked","onClick"]),m.label===o.unref(r)("editor.fontFamily.default")&&f.showDefaultDivider?(o.openBlock(),o.createBlock(o.unref(A1),{key:0})):o.createCommentVNode("",!0)],64))),128))]),_:1},8,["disabled","tooltip","title","btn_class"]))}}),EE=gZ.extend({name:"fontFamily",addOptions(){return{...this.parent?.(),types:["textStyle"],fontFamilyList:[],button({editor:t,extension:e,t:n}){return{component:bZ,componentProps:{editor:t,disabled:!t.can().setFontFamily(""),tooltip:n("editor.fontFamily.tooltip")}}}}},addGlobalAttributes(){return[{types:["paragraph","heading","textStyle"],attributes:{style:{default:null,parseHTML:t=>t.style.fontFamily||null,renderHTML:t=>t.style?{style:`font-family: ${t.style}`}:{}},fontFamily:{default:null,parseHTML:t=>t.style.fontFamily.replace(/['"]/g,""),renderHTML:t=>t.fontFamily?{style:`font-family: ${t.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:t=>({chain:e})=>e().setMark("textStyle",{fontFamily:t}).command(({tr:n})=>(a5(n,t),!0)).run(),unsetFontFamily:()=>({chain:t})=>t().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().command(({tr:e})=>(a5(e,null),!0)).run()}},addStorage(){return{value:null}},onUpdate(){this.storage.value=this.editor.getAttributes("textStyle").fontFamily??this.editor.getAttributes("paragraph").fontFamily??this.editor.getAttributes("heading").fontFamily},onSelectionUpdate(){this.storage.value=this.editor.getAttributes("textStyle").fontFamily??this.editor.getAttributes("paragraph").fontFamily??this.editor.getAttributes("heading").fontFamily}}),yZ=Qe.create({name:"fontWeight",addOptions(){return{...this.parent?.(),types:["textStyle"]}},addGlobalAttributes(){return[{types:["paragraph","textStyle"],attributes:{fontWeight:{default:null,parseHTML:t=>t.style.fontWeight||null,renderHTML:t=>t.fontWeight?{style:`font-weight: ${t.fontWeight}`}:{}}}}]},addCommands(){return{setFontWeight:t=>({chain:e})=>e().setMark("textStyle",{fontWeight:t}).run(),unsetFontWeight:()=>({chain:t})=>t().setMark("textStyle",{fontWeight:null}).removeEmptyTextStyle().run()}},addStorage(){return{value:null}},onUpdate(){this.storage.value=this.editor.getAttributes("textStyle").fontWeight}}),wZ={class:"flex gap-2"},xZ=["disabled"],CZ=Xr(o.defineComponent({__name:"FontSizeIncreaseDecrease",props:{editor:Object},setup(t){const e=o.inject("fontSize"),n=o.computed(()=>e.value?parseInt(e.value)===parseInt(fg[0])||parseInt(e.value)<parseInt(fg[0]):!1),r=ct.useEventBus(ur.INCREASE_DECREASE_FONTSIZE),i=s=>{r.emit(s)};return(s,a)=>{const l=da,u=ca,c=fa;return o.openBlock(),o.createElementBlock("div",wZ,[o.createVNode(c,null,{default:o.withCtx(()=>[o.createVNode(u,{"delay-duration":0},{default:o.withCtx(()=>[o.createVNode(l,null,{default:o.withCtx(()=>[o.createElementVNode("button",{class:"btn",onClick:a[0]||(a[0]=f=>i(!0))},[o.createVNode(o.unref(Ot),{name:"Plus",class:"w-6 h-6"})])]),_:1}),o.createVNode(o.unref(is),null,{default:o.withCtx(()=>a[2]||(a[2]=[o.createTextVNode(" 글꼴 크기 크게 ")])),_:1})]),_:1})]),_:1}),o.createVNode(c,null,{default:o.withCtx(()=>[o.createVNode(u,{"delay-duration":0},{default:o.withCtx(()=>[o.createVNode(l,null,{default:o.withCtx(()=>[o.createElementVNode("button",{class:"btn",onClick:a[1]||(a[1]=f=>i(!1)),disabled:o.unref(n)},[o.createVNode(o.unref(Ot),{name:"Minus",class:"w-6 h-6"})],8,xZ)]),_:1}),o.createVNode(o.unref(is),null,{default:o.withCtx(()=>a[3]||(a[3]=[o.createTextVNode(" 글꼴 크기 작게 ")])),_:1})]),_:1})]),_:1})])}}}),[["__scopeId","data-v-250d04b3"]]),kZ=Fn.create({name:"fontSizeIncreaseDecrease",addOptions(){return{defaultSize:"14px",button({editor:t}){return{component:CZ,componentProps:{editor:t}}}}},addAttributes(){return{size:{default:this.options.defaultSize,parseHTML:t=>t.style.fontSize||this.options.defaultSize,renderHTML:t=>t.size?{style:`font-size: ${t.size}`}:{}}}},addCommands(){return{setFontSizeIncreaseDecrease:t=>({commands:e})=>e.setMark("textStyle",{fontSize:t})}}}),Ob=Qe.create({name:"painter",addOptions(){return{...this.parent?.(),button:({editor:t,extension:e,t:n})=>({component:Ge,componentProps:{action:()=>{t.commands.setPainter(t?.state.selection.$head.marks())},icon:"PaintRoller",tooltip:n("editor.format")}})}},addCommands(){return{setPainter:t=>({view:{dispatch:e,state:{tr:n},dom:r}})=>{const a=`url("data:image/svg+xml;utf8,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="#000" d="M9 22v-6H4V7q0-1.65 1.175-2.825T8 3h12v13h-5v6zM6 10h12V5h-1v4h-2V5h-1v2h-2V5H8q-.825 0-1.412.588T6 7zm0 4h12v-2H6zm0 0v-2z"/></svg>')}"), auto`;return r.style.cursor=a,e(n.setMeta("painterAction",{type:"start",marks:t})),!0}}},addProseMirrorPlugins(){return[new ot({key:new Et("format-painter"),state:{init:()=>[],apply:(t,e)=>{const n=t.getMeta("painterAction");return n&&n.type==="start"?e=n.marks:n&&n.type==="end"&&(e=[]),e}},props:{handleDOMEvents:{mousedown(t,e){const n=this.getState(t.state);if(!n||n.length==0)return t.dom.style.cursor="",!1;const r=()=>{document.removeEventListener("mouseup",r);const{dispatch:i,state:{selection:s},dom:a}=t;let l=t.state.tr;a.style.cursor="",l=l.removeMark(s.from,s.to);for(const u of n)u.type.name!="link"&&(l=l.addMark(s.from,s.to,u));i(l.setMeta("painterAction",{type:"end"}))};return document.addEventListener("mouseup",r),!0}}}})]}}),Bb=()=>$r(10),SE=new Et("attrkey"),EZ=t=>new ot({key:SE,state:{init:()=>!1,apply:n=>n.getMeta("initSplit")},appendTransaction(n,r,i){const{tr:s}=i;let a=!1;const l=SE.getState(i);if(n.some(c=>c.getMeta("composition")))return null;if(l||n.some(c=>c.docChanged)){const c=[];i.doc.descendants((f,p,m,g)=>{const{attrs:v}=f,b=c.includes(v.id)?Bb():v.id||Bb();t.includes(f.type.name)&&(s.setNodeMarkup(p,void 0,{...v,id:b,"number-line":g+1}),a=!0),c.push(b)})}return a?s:null}}),_E=[eh,Np,th,Jv,nh,Ss,Qv,Hl,eb,nb,Nv,_a,zl,Ci,tb,rb,Zv,Gr],SZ=Qe.create({name:"autoId",addGlobalAttributes(){return[{types:_E.concat(this.options.types||[]),attributes:{id:{default:Bb()},extend:{default:!1},class:{default:null},"number-line":{default:null}}}]},addProseMirrorPlugins(){return[EZ(_E.concat(this.options.types||[]))]}}),_Z=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,TZ=Lt.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{}}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:t}){return["img",wt(this.options.HTMLAttributes,t)]},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[h4({find:_Z,type:this.type,getAttributes:t=>{const[,,e,n,r]=t;return{src:n,alt:e,title:r}}})]}}),AZ=["src","alt"],MZ={key:0,class:"image-resizer"},OZ=["onMousedown","onTouchstart"],BZ=o.defineComponent({__name:"ImageView",props:{...ta,selected:{type:Boolean,required:!0}},setup(t){const e=t,n={TOP_LEFT:"tl",TOP_RIGHT:"tr",BOTTOM_LEFT:"bl",BOTTOM_RIGHT:"br"},r=o.inject("isMobile",!1),i=o.ref({width:ux,height:ux}),s=o.ref({width:0,height:0}),a=o.ref(!1),l=o.ref({x:0,y:0,w:0,h:0,dir:""}),u=o.computed(()=>{const{src:k,alt:T,width:S,height:A,flipX:V,flipY:O}=e.node.attrs,B=[];V&&B.push("rotateX(180deg)"),O&&B.push("rotateY(180deg)");const F=B.join(" ");return{src:k||void 0,alt:T||void 0,style:{width:mg(S)?`${S}px`:S,height:mg(A)?`${A}px`:A,transform:F||"none"}}});o.computed(()=>({width:o.unref(u).style.width==="100%"?"100%":void 0}));const c=o.ref(null),f=new ResizeObserver(k=>{for(const T of k){const{width:S,height:A}=T.contentRect;s.value={width:S,height:A},e.updateAttributes({originWidth:S,originHeight:A})}});function p(){const{editor:k,getPos:T}=e;k.commands.setNodeSelection(T())}const m=St.throttle(()=>{const{editor:k}=e;i.value.width=parseInt(getComputedStyle(k.view.dom).width,10)},cx);function g(k,T){k.preventDefault(),k.stopPropagation();let S=0,A=0;const V=document.querySelector(".image-resizer");if(V&&(V.style.borderColor="#3b82f6"),"touches"in k&&k.touches.length>0)S=k.touches[0].clientX,A=k.touches[0].clientY;else if("clientX"in k)S=k.clientX,A=k.clientY;else return;const{width:O,height:B}=o.unref(s),F=O/B;let j=Number(e.node.attrs.width)||O,Y=Number(e.node.attrs.height)||Math.round(j/F);const N=o.unref(i).width;j=Math.min(j>N?N:j,N),Y=Math.round(j/F),Object.assign(l.value,{x:S,y:A,w:j,h:Y,dir:T}),a.value=!0,w()}const v=St.throttle(k=>{if(!o.unref(a))return;let T=0;if("touches"in k&&k.touches.length>0)T=k.touches[0].clientX;else if("clientX"in k)T=k.clientX;else return;const{x:S,w:A,dir:V}=o.unref(l),O=(T-S)*(/l/.test(V)?-1:1),B=SL(A+O,mL,o.unref(i).width);e.updateAttributes({width:B})},cx),b=k=>{k.preventDefault(),k.stopPropagation();const T=document.querySelector(".image-resizer");T&&(T.style.borderColor=""),o.unref(a)&&(a.value=!1,Object.assign(l.value,{x:0,y:0,w:0,h:0,dir:""}),x(),p())};function w(){document.addEventListener("mousemove",v,!0),document.addEventListener("mouseup",b,!0),document.addEventListener("touchmove",v,!0),document.addEventListener("touchend",b,!0)}function x(){document.removeEventListener("mousemove",v,!0),document.removeEventListener("mouseup",b,!0),document.removeEventListener("touchmove",v,!0),document.removeEventListener("touchend",b,!0)}const C=new ResizeObserver(m),E=o.computed(()=>{const{textAlign:k}=e.node.attrs;return{left:"margin-right: auto;",right:"margin-left: auto;",center:"margin-left: auto; margin-right: auto;"}[k]||""});return o.onMounted(()=>{c.value&&f.observe(c.value),C.observe(e.editor.view.dom)}),o.onBeforeUnmount(()=>{x(),f.disconnect(),C.disconnect()}),(k,T)=>(o.openBlock(),o.createBlock(o.unref(ea),{class:"node-image",style:o.normalizeStyle({"pointer-events":o.unref(r)&&t.selected?"none":"auto"})},{default:o.withCtx(()=>[o.createElementVNode("div",{class:"image-view",style:o.normalizeStyle([{width:u.value.style.width,height:u.value.style.height},E.value])},[o.createElementVNode("div",{draggable:"true","data-drag-handle":"",class:o.normalizeClass([{"image-view__body--focused":t.selected,"image-view__body--resizing":a.value},"image-view__body"])},[o.createElementVNode("img",{ref_key:"imageRef",ref:c,src:u.value.src,alt:u.value.alt,class:"block w-full image-view__body__image",style:o.normalizeStyle([{transform:u.value.style.transform}]),onClick:p,onMousedown:T[0]||(T[0]=(...S)=>o.unref(ff)&&o.unref(ff)(...S))},null,44,AZ),k.editor.view.editable?o.withDirectives((o.openBlock(),o.createElementBlock("div",MZ,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(Object.values(n),S=>(o.openBlock(),o.createElementBlock("span",{key:S,class:o.normalizeClass(o.unref(ke)(`image-resizer__handler--${S}`,"image-resizer__handler",o.unref(r)&&t.selected&&"pointer-events-auto")),onMousedown:A=>g(A,S),onTouchstart:o.withModifiers(A=>g(A,S),["prevent"])},null,42,OZ))),128))],512)),[[o.vShow,t.selected||a.value]]):o.createCommentVNode("",!0)],2)],4)]),_:1},8,["style"]))}}),IZ=Xr(BZ,[["__scopeId","data-v-db9342d0"]]),Wc=TZ.extend({group:"block",defining:!0,isolating:!0,addAttributes(){return{...this.parent?.(),src:{default:null,parseHTML:t=>(t.tagName==="P"?t.querySelector("img"):t)?.getAttribute("src")},flipX:{default:!1},flipY:{default:!1},originWidth:{default:null},originHeight:{default:null},textAlign:{default:"left",parseHTML:t=>t.style.textAlign||t.getAttribute("textAlign")||null,renderHTML:t=>({textAlign:t.textAlign})},width:{default:"100%",parseHTML:t=>{const e=t.tagName==="P"?t.querySelector("img"):t,n=e&&(e.style.width||e.getAttribute("width"))||null;return n&&n.endsWith("%")?n:n==null?null:parseInt(n,10)},renderHTML:t=>({width:t.width})},height:{default:"auto",parseHTML:t=>{const e=t.style.height||t.getAttribute("height")||null;return e==null||e==="auto"?null:parseInt(e,10)},renderHTML:t=>({height:t.height})},class:{default:"",parseHTML:t=>t.getAttribute("class")||"",renderHTML:t=>({class:t.class})},"data-memo":{default:"",parseHTML:t=>t.getAttribute("data-memo")||"",renderHTML:t=>({"data-memo":t["data-memo"]})}}},addOptions(){return{...this.parent?.()}},addNodeView(){return na(IZ)},addCommands(){return{...this.parent?.(),updateImage:t=>({commands:e,editor:n})=>e.updateAttributes(this.name,t)}},renderHTML({node:t,HTMLAttributes:e}){const{textAlign:n,flipX:r,flipY:i}=t.attrs,l=`${{left:"margin-right: auto;",right:"margin-left: auto;",center:"margin-left: auto; margin-right: auto;"}[n]||""} ${r||i?`transform: rotateX(${r?"180":"0"}deg) rotateY(${i?"180":"0"}deg);`:""}`;return["img",wt(this.options.HTMLAttributes,e,{style:l})]},parseHTML(){return[{tag:"img[src]"},{tag:"p",priority:1001,getAttrs:t=>{const e=t;return e.children.length===1&&e.firstElementChild?.tagName==="IMG"&&!!!e.textContent?.trim()&&e.firstElementChild.hasAttribute("src")?null:!1}}]},addProseMirrorPlugins(){return[new ot({props:{handleTextInput(t){const{selection:e}=t.state;return e instanceof Re&&e.node.type.name==="image"},handlePaste(t){const{selection:e}=t.state;return e instanceof Re&&e.node.type.name==="image"}}})]}}),LZ=["paragraph","heading","list_item","todo_item"];function RZ(t,e){const{selection:n,doc:r}=t;if(!n||!r||!(n instanceof Ie||n instanceof An))return t;const{from:i,to:s}=n,a=[],l=e&&e!==dx?e:null;return r.nodesBetween(i,s,(u,c)=>{const f=u.type;return LZ.includes(f.name)?((u.attrs.lineHeight||null)!==l&&a.push({node:u,pos:c,nodeType:f}),f.name!=="list_item"&&f.name!=="todo_item"):!0}),a.length&&a.forEach(u=>{const{node:c,pos:f,nodeType:p}=u;let{attrs:m}=c;m={...m,lineHeight:l},t=t.setNodeMarkup(f,p,m,c.marks)}),t}function DZ(t){return({state:e,dispatch:n})=>{const{selection:r}=e;let{tr:i}=e;return i=i.setSelection(r),i=RZ(i,t),i.docChanged?(n&&n(i),!0):!1}}const PZ=o.defineComponent({__name:"LineHeightDropdown",props:{editor:{},icon:{default:void 0},tooltip:{default:void 0},disabled:{type:Boolean,default:!1},action:{type:Function,default:void 0},isActive:{type:Function,default:void 0}},setup(t){const{t:e}=Pt();function n(l){return parseFloat(l.replace("%",""))/100}const r=o.computed(()=>{const c=s.editor.extensionManager.extensions.find(f=>f.name==="lineHeight").options.lineHeights.map(f=>({label:n(f),value:f}));return c.unshift({label:o.unref(e)("editor.default"),value:"default"}),c}),i=o.ref("default"),s=t;function a(l){l==="default"?s.editor.chain().focus().unsetLineHeight().run():s.editor.chain().focus().setLineHeight(l).run(),i.value=l}return(l,u)=>(o.openBlock(),o.createBlock(ga,{icon:l.icon,tooltip:l.tooltip,disabled:l.disabled,class:"inside-toolbar"},{default:o.withCtx(()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(r.value,(c,f)=>(o.openBlock(),o.createBlock(o.unref(Ml),{key:f,checked:c.value===i.value,onClick:p=>a(c.value)},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(c.label),1)]),_:2},1032,["checked","onClick"]))),128))]),_:1},8,["icon","tooltip","disabled"]))}}),TE=Qe.create({name:"lineHeight",addOptions(){return{...this.parent?.(),types:["paragraph","heading","list_item","todo_item"],lineHeights:["100%","115%","150%","200%","250%","300%"],defaultHeight:dx,button({editor:t,t:e}){return{component:PZ,componentProps:{editor:t,icon:"LineHeight",tooltip:e("editor.lineheight.tooltip")}}}}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:t=>t.style.lineHeight||this.options.defaultHeight,renderHTML:t=>t.lineHeight===this.options.defaultHeight||!t.lineHeight?{}:{style:`line-height: ${t.lineHeight}`}}}}]},addCommands(){return{setLineHeight:t=>DZ(t),unsetLineHeight:()=>({commands:t})=>this.options.types.every(e=>t.resetAttributes(e,"lineHeight"))}}}),VZ=Lt.create({name:"column",content:"block+",isolating:!0,addAttributes(){return{position:{default:"",parseHTML:t=>t.getAttribute("data-position"),renderHTML:t=>({"data-position":t.position})}}},renderHTML({HTMLAttributes:t}){return["div",wt(t,{"data-type":"column"}),0]},parseHTML(){return[{tag:'div[data-type="column"]'}]}});var Ba=(t=>(t.SidebarLeft="sidebar-left",t.SidebarRight="sidebar-right",t.TwoColumn="two-column",t))(Ba||{});const Ib=Lt.create({name:"columns",group:"columns",content:"column+",defining:!0,isolating:!0,addOptions(){return{...this.parent?.(),layout:"two-column"}},addAttributes(){return{layout:{default:"two-column"}}},addCommands(){return{setColumns:()=>({commands:t})=>(t.insertContent('<div data-type="columns"><div data-type="column" data-position="left"><p></p></div><div data-type="column" data-position="right"><p></p></div></div>'),!0),setLayout:t=>({commands:e})=>e.updateAttributes("columns",{layout:t})}},renderHTML({HTMLAttributes:t}){return["div",{"data-type":"columns",class:`layout-${t.layout}`},0]},parseHTML(){return[{tag:'div[data-type="columns"]'}]},addExtensions(){return[VZ.configure(this.options.columnOptions)]}}),FZ={class:"flex gap-x-2 items-center"},$Z={class:"sr-only"},HZ={class:"flex justify-end gap-x-2.5 flex-1"},zZ=["disabled"],AE=Xr(o.defineComponent({__name:"SuperInputDialogMoblie",props:{editor:{},open:{type:Boolean},superTextInit:{},superTextId:{},superTextElementId:{},isViewMode:{type:Boolean},title:{}},emits:["close","save","delete"],setup(t,{emit:e}){const n=e,r=t,{t:i}=Pt(),s=o.ref(""),a=o.ref(!1),l=o.ref(r.isViewMode??!1),u=o.ref(!1);o.watch(()=>r.isViewMode,g=>{l.value=g,g||(s.value="")});const c=o.computed(()=>{if(!s.value)return!0;const g=document.createElement("div");return g.innerHTML=s.value,g?.textContent?.trim()===""});o.watch(()=>r.open,()=>{r.open&&r.superTextInit&&(s.value=r.superTextInit)},{immediate:!0});const f=()=>{n("close"),a.value=!1,l.value=!0,u.value=!1},p=()=>{n("save",s.value),s.value="",l.value=!0,u.value=!1},m=()=>{u.value=!0,l.value=!1};return(g,v)=>{const b=dh,w=ch,x=uh,C=lh,E=ub,k=Dc,T=Rc;return o.openBlock(),o.createBlock(T,{open:g.open},{default:o.withCtx(()=>[o.createVNode(k,{"is-overlay-transparent":"",class:"p-2.5 gap-0 gap-y-2.5 border-none w-[calc(100%-40px)] !shadow-ed rounded-[5px]"},{default:o.withCtx(()=>[o.createVNode(x,{class:"text-left flex-row justify-between"},{default:o.withCtx(()=>[o.createVNode(b,{class:"text-base font-normal"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(g.title?g.title:o.unref(i)("editor.superinput")),1)]),_:1}),o.createElementVNode("div",FZ,[o.withDirectives(o.createElementVNode("button",{onClick:m},[o.createVNode(o.unref(y1),{icon:"lucide:edit-2"})],512),[[o.vShow,l.value]]),o.createVNode(w,{class:"outline-none",onClick:f},{default:o.withCtx(()=>[o.createVNode(o.unref(cc),{class:"w-5 h-5"}),o.createElementVNode("span",$Z,o.toDisplayString(o.unref(i)("editor.close")),1)]),_:1})])]),_:1}),o.createVNode(C,{class:"hidden"}),o.createVNode(Ab,{modelValue:s.value,"onUpdate:modelValue":v[0]||(v[0]=S=>s.value=S),"is-read-only":l.value,"parent-editor":g.editor,"spellcheck-enabled":!1},null,8,["modelValue","is-read-only","parent-editor"]),o.createVNode(E,{class:"flex-row justify-between"},{default:o.withCtx(()=>[o.withDirectives(o.createElementVNode("button",{onClick:v[1]||(v[1]=S=>n("delete"))},o.toDisplayString(o.unref(i)("editor.delete")),513),[[o.vShow,u.value]]),o.withDirectives(o.createElementVNode("div",HZ,[o.createElementVNode("button",{onClick:f},o.toDisplayString(o.unref(i)("editor.menubar.menu.cancel")),1),o.createElementVNode("button",{disabled:o.unref(c),class:o.normalizeClass({"cursor-not-allowed":o.unref(c)}),onClick:p},o.toDisplayString(o.unref(i)("editor.menubar.menu.save")),11,zZ)],512),[[o.vShow,u.value||!l.value]])]),_:1})]),_:1})]),_:1},8,["open"])}}}),[["__scopeId","data-v-c6e8813c"]]),UZ=["innerHTML"],WZ=["book-mark-node-id","page-id","page-number","book-mark-content","node-id","line-id"],jZ=o.defineComponent({__name:"ConfigPlan",props:ta,setup(t){const e=t,n=o.ref(!1),r=o.ref(null),{selection:i,doc:s}=e.editor.state,a=o.inject("isMobile"),l=o.ref(!1),u=ct.useEventBus(ur.RENDER_SUPER_TEXT),c=o.computed(()=>{const C=s.resolve(i.from)?.node(-1),E=C?.attrs?.id,k=C?.attrs?.pageNumber;return{pageId:E,pageNumber:k}}),f=o.computed(()=>{const x=e.getPos(),C=e.editor.state.doc.resolve(x);for(let E=C.depth;E>0;E--){const k=C.node(E);if(k.type.name==="paragraph")return k}return null}),p=o.computed(()=>f.value?.attrs.id||"");function m(x){e.updateAttributes({"data-text":x}),n.value=!1}function g(x){const C=e.node.attrs[Ne.TEXT],E=e.node.attrs[Ne.ID],T={lineId:x.target.querySelector(`[node-id="${E}"]`).getAttribute("line-id"),text:C};u.emit({action:"hover",payload:T})}function v(x){const C=e.node.attrs[Ne.ID],k={lineId:x.target.querySelector(`[node-id="${C}"]`).getAttribute("line-id"),text:""};u.emit({action:"hover",payload:k})}function b(){const{getPos:x,node:C,editor:E}=e,k=x(),T=k+1;E.commands.deleteRange({from:k,to:T})}function w(){n.value=!0,a&&(l.value=!0)}return(x,C)=>{const E=mn,k=lb,T=ab,S=sb,A=ib,V=Uc;return o.openBlock(),o.createBlock(o.unref(ea),{as:"span",class:o.normalizeClass(["w-fit text-inherit super-text align-middle",{"!leading-[9px] [&_*]:!leading-[9px]":o.unref(a)}]),"data-drag-handle":"",draggable:"true",contenteditable:"false"},{default:o.withCtx(()=>[o.createVNode(A,null,{default:o.withCtx(()=>[o.createVNode(k,{as:"template",class:"relative"},{default:o.withCtx(()=>[o.createVNode(E,{variant:"ghost",class:"!p-0 !m-0 !h-fit font-normal !text-ed-blue",onClick:w,onMouseenter:g,onMouseleave:v},{default:o.withCtx(()=>[o.createVNode(o.unref(Ot),{name:"plan",class:o.normalizeClass({"w-[18px] h-auto pr-1":o.unref(a)})},null,8,["class"]),C[3]||(C[3]=o.createTextVNode(" [")),o.createElementVNode("span",{class:"[&_*]:inline",innerHTML:e.node.attrs[o.unref(Ne).TEXT]},null,8,UZ),C[4]||(C[4]=o.createTextVNode("] ")),o.createElementVNode("div",{ref_key:"bookMarkRef",ref:r,"book-mark-node-id":e.node.attrs[o.unref(Ne).ID],"page-id":c.value.pageId,"page-number":c.value.pageNumber,"book-mark-content":e.node.attrs[o.unref(Ne).TEXT],"node-id":e.node.attrs[o.unref(Ne).ID],"line-id":p.value},null,8,WZ)]),_:1})]),_:1}),o.createVNode(S,null,{default:o.withCtx(()=>[o.createVNode(T,{onSelect:C[0]||(C[0]=O=>n.value=!0)},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(x.$t("editor.configPlan.edit")),1)]),_:1}),o.createVNode(T,{onSelect:b},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(x.$t("editor.configPlan.delete")),1)]),_:1})]),_:1})]),_:1}),o.unref(a)?(o.openBlock(),o.createBlock(AE,{key:1,title:x.$t("editor.configPlan"),open:n.value,"is-view-mode":l.value,editor:e.editor,"super-text-init":e.node.attrs[o.unref(Ne).TEXT],"super-text-id":e.node.attrs[o.unref(Ne).ID],onClose:C[2]||(C[2]=O=>n.value=!1),onSave:m,onDelete:b},null,8,["title","open","is-view-mode","editor","super-text-init","super-text-id"])):(o.openBlock(),o.createBlock(V,{key:0,open:n.value,editor:e.editor,"super-text-init":e.node.attrs[o.unref(Ne).TEXT],"super-text-element-id":e.node.attrs[o.unref(Ne).ELEMENT_ID],onClose:C[1]||(C[1]=O=>n.value=!1),onSave:m},null,8,["open","editor","super-text-init","super-text-element-id"]))]),_:1},8,["class"])}}}),ME=Lt.create({name:"configPlan",inline:!0,group:"inline",atom:!0,draggable:!0,addStorage(){return{isShowConfigPlanInput:!1}},addOptions(){return{specialCharModal:null,button:({editor:t,t:e,isMobile:n})=>[...n?[{component:Ge,componentProps:{action:()=>{t.commands.toggleConfigPlanInput()},isActive:()=>{},icon:"plan",title:e("editor.insertConfigPlan"),tooltip:e("editor.insertConfigPlan"),customClass:"whitespace-nowrap !bg-ed-blue !text-white !font-normal rounded-[3px] h-[26px] gap-x-1 ml-auto",customClassTooltip:"ml-auto"}}]:[]]}},addAttributes(){return{"data-id":{default:null},"data-text":{default:""},"data-position":{default:"0"}}},addCommands(){return{toggleConfigPlanInput:()=>({editor:t})=>t.storage.configPlan.isShowConfigPlanInput=!t.storage.configPlan.isShowConfigPlanInput}},parseHTML(){return[{tag:"button.config-plan"}]},renderHTML({HTMLAttributes:t}){return["button",wt(t,{class:"config-plan"})]},addNodeView(){return na(jZ)},addProseMirrorPlugins(){return[new ot({appendTransaction(t,e,n){let r=n.tr,i=!1;return n.doc.descendants((s,a)=>{if(s.type.name==="configPlan"){const l=s.attrs["data-position"],u=String(a);l!==u&&(r=r.setNodeMarkup(a,void 0,{...s.attrs,"data-position":u}),i=!0)}}),i?r:null}})]}});var Lb,Rb;if(typeof WeakMap<"u"){let t=new WeakMap;Lb=e=>t.get(e),Rb=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;Lb=r=>{for(let i=0;i<t.length;i+=2)if(t[i]==r)return t[i+1]},Rb=(r,i)=>(n==10&&(n=0),t[n++]=r,t[n++]=i)}var an=class{constructor(t,e,n,r){this.width=t,this.height=e,this.map=n,this.problems=r}findCell(t){for(let e=0;e<this.map.length;e++){const n=this.map[e];if(n!=t)continue;const r=e%this.width,i=e/this.width|0;let s=r+1,a=i+1;for(let l=1;s<this.width&&this.map[e+l]==n;l++)s++;for(let l=1;a<this.height&&this.map[e+this.width*l]==n;l++)a++;return{left:r,top:i,right:s,bottom:a}}throw new RangeError(`No cell with offset ${t} found`)}colCount(t){for(let e=0;e<this.map.length;e++)if(this.map[e]==t)return e%this.width;throw new RangeError(`No cell with offset ${t} found`)}nextCell(t,e,n){const{left:r,right:i,top:s,bottom:a}=this.findCell(t);return e=="horiz"?(n<0?r==0:i==this.width)?null:this.map[s*this.width+(n<0?r-1:i)]:(n<0?s==0:a==this.height)?null:this.map[r+this.width*(n<0?s-1:a)]}rectBetween(t,e){const{left:n,right:r,top:i,bottom:s}=this.findCell(t),{left:a,right:l,top:u,bottom:c}=this.findCell(e);return{left:Math.min(n,a),top:Math.min(i,u),right:Math.max(r,l),bottom:Math.max(s,c)}}cellsInRect(t){const e=[],n={};for(let r=t.top;r<t.bottom;r++)for(let i=t.left;i<t.right;i++){const s=r*this.width+i,a=this.map[s];n[a]||(n[a]=!0,!(i==t.left&&i&&this.map[s-1]==a||r==t.top&&r&&this.map[s-this.width]==a)&&e.push(a))}return e}positionAt(t,e,n){for(let r=0,i=0;;r++){const s=i+n.child(r).nodeSize;if(r==t){let a=e+t*this.width;const l=(t+1)*this.width;for(;a<l&&this.map[a]<i;)a++;return a==l?s-1:this.map[a]}i=s}}static get(t){return Lb(t)||Rb(t,qZ(t))}};function qZ(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=KZ(t),n=t.childCount,r=[];let i=0,s=null;const a=[];for(let c=0,f=e*n;c<f;c++)r[c]=0;for(let c=0,f=0;c<n;c++){const p=t.child(c);f++;for(let v=0;;v++){for(;i<r.length&&r[i]!=0;)i++;if(v==p.childCount)break;const b=p.child(v),{colspan:w,rowspan:x,colwidth:C}=b.attrs;for(let E=0;E<x;E++){if(E+c>=n){(s||(s=[])).push({type:"overlong_rowspan",pos:f,n:x-E});break}const k=i+E*e;for(let T=0;T<w;T++){r[k+T]==0?r[k+T]=f:(s||(s=[])).push({type:"collision",row:c,pos:f,n:w-T});const S=C&&C[T];if(S){const A=(k+T)%e*2,V=a[A];V==null||V!=S&&a[A+1]==1?(a[A]=S,a[A+1]=1):V==S&&a[A+1]++}}}i+=w,f+=b.nodeSize}const m=(c+1)*e;let g=0;for(;i<m;)r[i++]==0&&g++;g&&(s||(s=[])).push({type:"missing",row:c,n:g}),f++}(e===0||n===0)&&(s||(s=[])).push({type:"zero_sized"});const l=new an(e,n,r,s);let u=!1;for(let c=0;!u&&c<a.length;c+=2)a[c]!=null&&a[c+1]<n&&(u=!0);return u&&GZ(l,a,t),l}function KZ(t){let e=-1,n=!1;for(let r=0;r<t.childCount;r++){const i=t.child(r);let s=0;if(n)for(let a=0;a<r;a++){const l=t.child(a);for(let u=0;u<l.childCount;u++){const c=l.child(u);a+c.attrs.rowspan>r&&(s+=c.attrs.colspan)}}for(let a=0;a<i.childCount;a++){const l=i.child(a);s+=l.attrs.colspan,l.attrs.rowspan>1&&(n=!0)}e==-1?e=s:e!=s&&(e=Math.max(e,s))}return e}function GZ(t,e,n){t.problems||(t.problems=[]);const r={};for(let i=0;i<t.map.length;i++){const s=t.map[i];if(r[s])continue;r[s]=!0;const a=n.nodeAt(s);if(!a)throw new RangeError(`No cell with offset ${s} found`);let l=null;const u=a.attrs;for(let c=0;c<u.colspan;c++){const f=(i+c)%t.width,p=e[f*2];p!=null&&(!u.colwidth||u.colwidth[c]!=p)&&((l||(l=XZ(u)))[c]=p)}l&&t.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:l})}}function XZ(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function Wn(t){let e=t.cached.tableNodeTypes;if(!e){e=t.cached.tableNodeTypes={};for(const n in t.nodes){const r=t.nodes[n],i=r.spec.tableRole;i&&(e[i]=r)}}return e}var _s=new Et("selectingCells");function ql(t){for(let e=t.depth-1;e>0;e--)if(t.node(e).type.spec.tableRole=="row")return t.node(0).resolve(t.before(e+1));return null}function YZ(t){for(let e=t.depth;e>0;e--){const n=t.node(e).type.spec.tableRole;if(n==="cell"||n==="header_cell")return t.node(e)}return null}function bo(t){const e=t.selection.$head;for(let n=e.depth;n>0;n--)if(e.node(n).type.spec.tableRole=="row")return!0;return!1}function Eh(t){const e=t.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const n=ql(e.$head)||JZ(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function JZ(t){for(let e=t.nodeAfter,n=t.pos;e;e=e.firstChild,n++){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n)}for(let e=t.nodeBefore,n=t.pos;e;e=e.lastChild,n--){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n-e.nodeSize)}}function Db(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function ZZ(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function Pb(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function OE(t,e,n){const r=t.node(-1),i=an.get(r),s=t.start(-1),a=i.nextCell(t.pos-s,e,n);return a==null?null:t.node(0).resolve(s+a)}function Ia(t,e,n=1){const r={...t,colspan:t.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,n),r.colwidth.some(i=>i>0)||(r.colwidth=null)),r}function BE(t,e,n=1){const r={...t,colspan:t.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let i=0;i<n;i++)r.colwidth.splice(e,0,0)}return r}function QZ(t,e,n){const r=Wn(e.type.schema).header_cell;for(let i=0;i<t.height;i++)if(e.nodeAt(t.map[n+i*t.width]).type!=r)return!1;return!0}var zt=class Di extends ze{constructor(e,n=e){const r=e.node(-1),i=an.get(r),s=e.start(-1),a=i.rectBetween(e.pos-s,n.pos-s),l=e.node(0),u=i.cellsInRect(a).filter(f=>f!=n.pos-s);u.unshift(n.pos-s);const c=u.map(f=>{const p=r.nodeAt(f);if(!p)throw RangeError(`No cell with offset ${f} found`);const m=s+f+1;return new d3(l.resolve(m),l.resolve(m+p.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=n}map(e,n){const r=e.resolve(n.map(this.$anchorCell.pos)),i=e.resolve(n.map(this.$headCell.pos));if(Db(r)&&Db(i)&&Pb(r,i)){const s=this.$anchorCell.node(-1)!=r.node(-1);return s&&this.isRowSelection()?Di.rowSelection(r,i):s&&this.isColSelection()?Di.colSelection(r,i):new Di(r,i)}return Ie.between(r,i)}content(){const e=this.$anchorCell.node(-1),n=an.get(e),r=this.$anchorCell.start(-1),i=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),s={},a=[];for(let u=i.top;u<i.bottom;u++){const c=[];for(let f=u*n.width+i.left,p=i.left;p<i.right;p++,f++){const m=n.map[f];if(s[m])continue;s[m]=!0;const g=n.findCell(m);let v=e.nodeAt(m);if(!v)throw RangeError(`No cell with offset ${m} found`);const b=i.left-g.left,w=g.right-i.right;if(b>0||w>0){let x=v.attrs;if(b>0&&(x=Ia(x,0,b)),w>0&&(x=Ia(x,x.colspan-w,w)),g.left<i.left){if(v=v.type.createAndFill(x),!v)throw RangeError(`Could not create cell with attrs ${JSON.stringify(x)}`)}else v=v.type.create(x,v.content)}if(g.top<i.top||g.bottom>i.bottom){const x={...v.attrs,rowspan:Math.min(g.bottom,i.bottom)-Math.max(g.top,i.top)};g.top<i.top?v=v.type.createAndFill(x):v=v.type.create(x,v.content)}c.push(v)}a.push(e.child(u).copy(ge.from(c)))}const l=this.isColSelection()&&this.isRowSelection()?e:a;return new Se(ge.from(l),1,1)}replace(e,n=Se.empty){const r=e.steps.length,i=this.ranges;for(let a=0;a<i.length;a++){const{$from:l,$to:u}=i[a],c=e.mapping.slice(r);e.replace(c.map(l.pos),c.map(u.pos),a?Se.empty:n)}const s=ze.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);s&&e.setSelection(s)}replaceWith(e,n){this.replace(e,new Se(ge.from(n),0,0))}forEachCell(e){const n=this.$anchorCell.node(-1),r=an.get(n),i=this.$anchorCell.start(-1),s=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-i,this.$headCell.pos-i));for(let a=0;a<s.length;a++)e(n.nodeAt(s[a]),i+s[a])}isColSelection(){const e=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(e,n)>0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,i=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,i)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const r=e.node(-1),i=an.get(r),s=e.start(-1),a=i.findCell(e.pos-s),l=i.findCell(n.pos-s),u=e.node(0);return a.top<=l.top?(a.top>0&&(e=u.resolve(s+i.map[a.left])),l.bottom<i.height&&(n=u.resolve(s+i.map[i.width*(i.height-1)+l.right-1]))):(l.top>0&&(n=u.resolve(s+i.map[l.left])),a.bottom<i.height&&(e=u.resolve(s+i.map[i.width*(i.height-1)+a.right-1]))),new Di(e,n)}isRowSelection(){const e=this.$anchorCell.node(-1),n=an.get(e),r=this.$anchorCell.start(-1),i=n.colCount(this.$anchorCell.pos-r),s=n.colCount(this.$headCell.pos-r);if(Math.min(i,s)>0)return!1;const a=i+this.$anchorCell.nodeAfter.attrs.colspan,l=s+this.$headCell.nodeAfter.attrs.colspan;return Math.max(a,l)==n.width}eq(e){return e instanceof Di&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),i=an.get(r),s=e.start(-1),a=i.findCell(e.pos-s),l=i.findCell(n.pos-s),u=e.node(0);return a.left<=l.left?(a.left>0&&(e=u.resolve(s+i.map[a.top*i.width])),l.right<i.width&&(n=u.resolve(s+i.map[i.width*(l.top+1)-1]))):(l.left>0&&(n=u.resolve(s+i.map[l.top*i.width])),a.right<i.width&&(e=u.resolve(s+i.map[i.width*(a.top+1)-1]))),new Di(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new Di(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){return new Di(e.resolve(n),e.resolve(r))}getBookmark(){return new NZ(this.$anchorCell.pos,this.$headCell.pos)}};zt.prototype.visible=!1,ze.jsonID("cell",zt);var NZ=class gT{constructor(e,n){this.anchor=e,this.head=n}map(e){return new gT(e.map(this.anchor),e.map(this.head))}resolve(e){const n=e.resolve(this.anchor),r=e.resolve(this.head);return n.parent.type.spec.tableRole=="row"&&r.parent.type.spec.tableRole=="row"&&n.index()<n.parent.childCount&&r.index()<r.parent.childCount&&Pb(n,r)?new zt(n,r):ze.near(r,1)}};function eQ(t){if(!(t.selection instanceof zt))return null;const e=[];return t.selection.forEachCell((n,r)=>{e.push(jt.node(r,r+n.nodeSize,{class:"selectedCell"}))}),lt.create(t.doc,e)}function tQ({$from:t,$to:e}){if(t.pos==e.pos||t.pos<e.pos-6)return!1;let n=t.pos,r=e.pos,i=t.depth;for(;i>=0&&!(t.after(i+1)<t.end(i));i--,n++);for(let s=e.depth;s>=0&&!(e.before(s+1)>e.start(s));s--,r--);return n==r&&/row|table/.test(t.node(i).type.spec.tableRole)}function nQ({$from:t,$to:e}){let n,r;for(let i=t.depth;i>0;i--){const s=t.node(i);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){n=s;break}}for(let i=e.depth;i>0;i--){const s=e.node(i);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){r=s;break}}return n!==r&&e.parentOffset===0}function rQ(t,e,n){const r=(e||t).selection,i=(e||t).doc;let s,a;if(r instanceof Re&&(a=r.node.type.spec.tableRole)){if(a=="cell"||a=="header_cell")s=zt.create(i,r.from);else if(a=="row"){const l=i.resolve(r.from+1);s=zt.rowSelection(l,l)}else if(!n){const l=an.get(r.node),u=r.from+1,c=u+l.map[l.width*l.height-1];s=zt.create(i,u+1,c)}}else r instanceof Ie&&tQ(r)?s=Ie.create(i,r.from):r instanceof Ie&&nQ(r)&&(s=Ie.create(i,r.$from.start(),r.$from.end()));return s&&(e||(e=t.tr)).setSelection(s),e}var oQ=new Et("fix-tables");function IE(t,e,n,r){const i=t.childCount,s=e.childCount;e:for(let a=0,l=0;a<s;a++){const u=e.child(a);for(let c=l,f=Math.min(i,a+3);c<f;c++)if(t.child(c)==u){l=c+1,n+=u.nodeSize;continue e}r(u,n),l<i&&t.child(l).sameMarkup(u)?IE(t.child(l),u,n+1,r):u.nodesBetween(0,u.content.size,r,n+1),n+=u.nodeSize}}function LE(t,e){let n;const r=(i,s)=>{i.type.spec.tableRole=="table"&&(n=iQ(t,i,s,n))};return e?e.doc!=t.doc&&IE(e.doc,t.doc,0,r):t.doc.descendants(r),n}function iQ(t,e,n,r){const i=an.get(e);if(!i.problems)return r;r||(r=t.tr);const s=[];for(let u=0;u<i.height;u++)s.push(0);for(let u=0;u<i.problems.length;u++){const c=i.problems[u];if(c.type=="collision"){const f=e.nodeAt(c.pos);if(!f)continue;const p=f.attrs;for(let m=0;m<p.rowspan;m++)s[c.row+m]+=c.n;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,Ia(p,p.colspan-c.n,c.n))}else if(c.type=="missing")s[c.row]+=c.n;else if(c.type=="overlong_rowspan"){const f=e.nodeAt(c.pos);if(!f)continue;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,{...f.attrs,rowspan:f.attrs.rowspan-c.n})}else if(c.type=="colwidth mismatch"){const f=e.nodeAt(c.pos);if(!f)continue;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,{...f.attrs,colwidth:c.colwidth})}else if(c.type=="zero_sized"){const f=r.mapping.map(n);r.delete(f,f+e.nodeSize)}}let a,l;for(let u=0;u<s.length;u++)s[u]&&(a==null&&(a=u),l=u);for(let u=0,c=n+1;u<i.height;u++){const f=e.child(u),p=c+f.nodeSize,m=s[u];if(m>0){let g="cell";f.firstChild&&(g=f.firstChild.type.spec.tableRole);const v=[];for(let w=0;w<m;w++){const x=Wn(t.schema)[g].createAndFill();x&&v.push(x)}const b=(u==0||a==u-1)&&l==u?c+1:p-1;r.insert(r.mapping.map(b),v)}c=p}return r.setMeta(oQ,{fixTables:!0})}function Ko(t){const e=t.selection,n=Eh(t),r=n.node(-1),i=n.start(-1),s=an.get(r);return{...e instanceof zt?s.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):s.findCell(n.pos-i),tableStart:i,map:s,table:r}}function RE(t,{map:e,tableStart:n,table:r},i){let s=i>0?-1:0;QZ(e,r,i+s)&&(s=i==0||i==e.width?null:0);for(let a=0;a<e.height;a++){const l=a*e.width+i;if(i>0&&i<e.width&&e.map[l-1]==e.map[l]){const u=e.map[l],c=r.nodeAt(u);t.setNodeMarkup(t.mapping.map(n+u),null,BE(c.attrs,i-e.colCount(u))),a+=c.attrs.rowspan-1}else{const u=s==null?Wn(r.type.schema).cell:r.nodeAt(e.map[l+s]).type,c=e.positionAt(a,i,r);t.insert(t.mapping.map(n+c),u.createAndFill())}}return t}function sQ(t,e){if(!bo(t))return!1;if(e){const n=Ko(t);e(RE(t.tr,n,n.left))}return!0}function aQ(t,e){if(!bo(t))return!1;if(e){const n=Ko(t);e(RE(t.tr,n,n.right))}return!0}function lQ(t,{map:e,table:n,tableStart:r},i){const s=t.mapping.maps.length;for(let a=0;a<e.height;){const l=a*e.width+i,u=e.map[l],c=n.nodeAt(u),f=c.attrs;if(i>0&&e.map[l-1]==u||i<e.width-1&&e.map[l+1]==u)t.setNodeMarkup(t.mapping.slice(s).map(r+u),null,Ia(f,i-e.colCount(u)));else{const p=t.mapping.slice(s).map(r+u);t.delete(p,p+c.nodeSize)}a+=f.rowspan}}function uQ(t,e){if(!bo(t))return!1;if(e){const n=Ko(t),r=t.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let i=n.right-1;lQ(r,n,i),i!=n.left;i--){const s=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!s)throw RangeError("No table found");n.table=s,n.map=an.get(s)}e(r)}return!0}function cQ(t,e,n){var r;const i=Wn(e.type.schema).header_cell;for(let s=0;s<t.width;s++)if(((r=e.nodeAt(t.map[s+n*t.width]))==null?void 0:r.type)!=i)return!1;return!0}function DE(t,{map:e,tableStart:n,table:r},i){var s;let a=n;for(let c=0;c<i;c++)a+=r.child(c).nodeSize;const l=[];let u=i>0?-1:0;cQ(e,r,i+u)&&(u=i==0||i==e.height?null:0);for(let c=0,f=e.width*i;c<e.width;c++,f++)if(i>0&&i<e.height&&e.map[f]==e.map[f-e.width]){const p=e.map[f],m=r.nodeAt(p).attrs;t.setNodeMarkup(n+p,null,{...m,rowspan:m.rowspan+1}),c+=m.colspan-1}else{const p=u==null?Wn(r.type.schema).cell:(s=r.nodeAt(e.map[f+u*e.width]))==null?void 0:s.type,m=p?.createAndFill();m&&l.push(m)}return t.insert(a,Wn(r.type.schema).row.create(null,l)),t}function dQ(t,e){if(!bo(t))return!1;if(e){const n=Ko(t);e(DE(t.tr,n,n.top))}return!0}function fQ(t,e){if(!bo(t))return!1;if(e){const n=Ko(t);e(DE(t.tr,n,n.bottom))}return!0}function pQ(t,{map:e,table:n,tableStart:r},i){let s=0;for(let c=0;c<i;c++)s+=n.child(c).nodeSize;const a=s+n.child(i).nodeSize,l=t.mapping.maps.length;t.delete(s+r,a+r);const u=new Set;for(let c=0,f=i*e.width;c<e.width;c++,f++){const p=e.map[f];if(!u.has(p)){if(u.add(p),i>0&&p==e.map[f-e.width]){const m=n.nodeAt(p).attrs;t.setNodeMarkup(t.mapping.slice(l).map(p+r),null,{...m,rowspan:m.rowspan-1}),c+=m.colspan-1}else if(i<e.height&&p==e.map[f+e.width]){const m=n.nodeAt(p),g=m.attrs,v=m.type.create({...g,rowspan:m.attrs.rowspan-1},m.content),b=e.positionAt(i+1,c,n);t.insert(t.mapping.slice(l).map(r+b),v),c+=g.colspan-1}}}}function hQ(t,e){if(!bo(t))return!1;if(e){const n=Ko(t),r=t.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let i=n.bottom-1;pQ(r,n,i),i!=n.top;i--){const s=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!s)throw RangeError("No table found");n.table=s,n.map=an.get(n.table)}e(r)}return!0}function PE(t){const e=t.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function mQ({width:t,height:e,map:n},r){let i=r.top*t+r.left,s=i,a=(r.bottom-1)*t+r.left,l=i+(r.right-r.left-1);for(let u=r.top;u<r.bottom;u++){if(r.left>0&&n[s]==n[s-1]||r.right<t&&n[l]==n[l+1])return!0;s+=t,l+=t}for(let u=r.left;u<r.right;u++){if(r.top>0&&n[i]==n[i-t]||r.bottom<e&&n[a]==n[a+t])return!0;i++,a++}return!1}function VE(t,e){const n=t.selection;if(!(n instanceof zt)||n.$anchorCell.pos==n.$headCell.pos)return!1;const r=Ko(t),{map:i}=r;if(mQ(i,r))return!1;if(e){const s=t.tr,a={};let l=ge.empty,u,c;for(let f=r.top;f<r.bottom;f++)for(let p=r.left;p<r.right;p++){const m=i.map[f*i.width+p],g=r.table.nodeAt(m);if(!(a[m]||!g))if(a[m]=!0,u==null)u=m,c=g;else{PE(g)||(l=l.append(g.content));const v=s.mapping.map(m+r.tableStart);s.delete(v,v+g.nodeSize)}}if(u==null||c==null)return!0;if(s.setNodeMarkup(u+r.tableStart,null,{...BE(c.attrs,c.attrs.colspan,r.right-r.left-c.attrs.colspan),rowspan:r.bottom-r.top}),l.size){const f=u+1+c.content.size,p=PE(c)?u+1:f;s.replaceWith(p+r.tableStart,f+r.tableStart,l)}s.setSelection(new zt(s.doc.resolve(u+r.tableStart))),e(s)}return!0}function FE(t,e){const n=Wn(t.schema);return gQ(({node:r})=>n[r.type.spec.tableRole])(t,e)}function gQ(t){return(e,n)=>{var r;const i=e.selection;let s,a;if(i instanceof zt){if(i.$anchorCell.pos!=i.$headCell.pos)return!1;s=i.$anchorCell.nodeAfter,a=i.$anchorCell.pos}else{if(s=YZ(i.$from),!s)return!1;a=(r=ql(i.$from))==null?void 0:r.pos}if(s==null||a==null||s.attrs.colspan==1&&s.attrs.rowspan==1)return!1;if(n){let l=s.attrs;const u=[],c=l.colwidth;l.rowspan>1&&(l={...l,rowspan:1}),l.colspan>1&&(l={...l,colspan:1});const f=Ko(e),p=e.tr;for(let g=0;g<f.right-f.left;g++)u.push(c?{...l,colwidth:c&&c[g]?[c[g]]:null}:l);let m;for(let g=f.top;g<f.bottom;g++){let v=f.map.positionAt(g,f.left,f.table);g==f.top&&(v+=s.nodeSize);for(let b=f.left,w=0;b<f.right;b++,w++)b==f.left&&g==f.top||p.insert(m=p.mapping.map(v+f.tableStart,1),t({node:s,row:g,col:b}).createAndFill(u[w]))}p.setNodeMarkup(a,t({node:s,row:f.top,col:f.left}),u[0]),i instanceof zt&&p.setSelection(new zt(p.doc.resolve(i.$anchorCell.pos),m?p.doc.resolve(m):void 0)),n(p)}return!0}}function vQ(t,e){return function(n,r){if(!bo(n))return!1;const i=Eh(n);if(i.nodeAfter.attrs[t]===e)return!1;if(r){const s=n.tr;n.selection instanceof zt?n.selection.forEachCell((a,l)=>{a.attrs[t]!==e&&s.setNodeMarkup(l,null,{...a.attrs,[t]:e})}):s.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[t]:e}),r(s)}return!0}}function bQ(t){return function(e,n){if(!bo(e))return!1;if(n){const r=Wn(e.schema),i=Ko(e),s=e.tr,a=i.map.cellsInRect(t=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:t=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),l=a.map(u=>i.table.nodeAt(u));for(let u=0;u<a.length;u++)l[u].type==r.header_cell&&s.setNodeMarkup(i.tableStart+a[u],r.cell,l[u].attrs);if(s.steps.length==0)for(let u=0;u<a.length;u++)s.setNodeMarkup(i.tableStart+a[u],r.header_cell,l[u].attrs);n(s)}return!0}}function $E(t,e,n){const r=e.map.cellsInRect({left:0,top:0,right:t=="row"?e.map.width:1,bottom:t=="column"?e.map.height:1});for(let i=0;i<r.length;i++){const s=e.table.nodeAt(r[i]);if(s&&s.type!==n.header_cell)return!1}return!0}function jc(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?bQ(t):function(n,r){if(!bo(n))return!1;if(r){const i=Wn(n.schema),s=Ko(n),a=n.tr,l=$E("row",s,i),u=$E("column",s,i),f=(t==="column"?l:t==="row"?u:!1)?1:0,p=t=="column"?{left:0,top:f,right:1,bottom:s.map.height}:t=="row"?{left:f,top:0,right:s.map.width,bottom:1}:s,m=t=="column"?u?i.cell:i.header_cell:t=="row"?l?i.cell:i.header_cell:i.cell;s.map.cellsInRect(p).forEach(g=>{const v=g+s.tableStart,b=a.doc.nodeAt(v);b&&a.setNodeMarkup(v,m,b.attrs)}),r(a)}return!0}}jc("row",{useDeprecatedLogic:!0}),jc("column",{useDeprecatedLogic:!0});var yQ=jc("cell",{useDeprecatedLogic:!0});function wQ(t,e){if(e<0){const n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let r=t.index(-1)-1,i=t.before();r>=0;r--){const s=t.node(-1).child(r),a=s.lastChild;if(a)return i-1-a.nodeSize;i-=s.nodeSize}}else{if(t.index()<t.parent.childCount-1)return t.pos+t.nodeAfter.nodeSize;const n=t.node(-1);for(let r=t.indexAfter(-1),i=t.after();r<n.childCount;r++){const s=n.child(r);if(s.childCount)return i+1;i+=s.nodeSize}}return null}function HE(t){return function(e,n){if(!bo(e))return!1;const r=wQ(Eh(e),t);if(r==null)return!1;if(n){const i=e.doc.resolve(r);n(e.tr.setSelection(Ie.between(i,ZZ(i))).scrollIntoView())}return!0}}function xQ(t,e){const n=t.selection.$anchor;for(let r=n.depth;r>0;r--)if(n.node(r).type.spec.tableRole=="table")return e&&e(t.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function Sh(t,e){const n=t.selection;if(!(n instanceof zt))return!1;if(e){const r=t.tr,i=Wn(t.schema).cell.createAndFill().content;n.forEachCell((s,a)=>{s.content.eq(i)||r.replace(r.mapping.map(a+1),r.mapping.map(a+s.nodeSize-1),new Se(i,0,0))}),r.docChanged&&e(r)}return!0}function CQ(t){if(!t.size)return null;let{content:e,openStart:n,openEnd:r}=t;for(;e.childCount==1&&(n>0&&r>0||e.child(0).type.spec.tableRole=="table");)n--,r--,e=e.child(0).content;const i=e.child(0),s=i.type.spec.tableRole,a=i.type.schema,l=[];if(s=="row")for(let u=0;u<e.childCount;u++){let c=e.child(u).content;const f=u?0:Math.max(0,n-1),p=u<e.childCount-1?0:Math.max(0,r-1);(f||p)&&(c=Vb(Wn(a).row,new Se(c,f,p)).content),l.push(c)}else if(s=="cell"||s=="header_cell")l.push(n||r?Vb(Wn(a).row,new Se(e,n,r)).content:e);else return null;return kQ(a,l)}function kQ(t,e){const n=[];for(let i=0;i<e.length;i++){const s=e[i];for(let a=s.childCount-1;a>=0;a--){const{rowspan:l,colspan:u}=s.child(a).attrs;for(let c=i;c<i+l;c++)n[c]=(n[c]||0)+u}}let r=0;for(let i=0;i<n.length;i++)r=Math.max(r,n[i]);for(let i=0;i<n.length;i++)if(i>=e.length&&e.push(ge.empty),n[i]<r){const s=Wn(t).cell.createAndFill(),a=[];for(let l=n[i];l<r;l++)a.push(s);e[i]=e[i].append(ge.from(a))}return{height:e.length,width:r,rows:e}}function Vb(t,e){const n=t.createAndFill();return new Jm(n).replace(0,n.content.size,e).doc}function EQ({width:t,height:e,rows:n},r,i){if(t!=r){const s=[],a=[];for(let l=0;l<n.length;l++){const u=n[l],c=[];for(let f=s[l]||0,p=0;f<r;p++){let m=u.child(p%u.childCount);f+m.attrs.colspan>r&&(m=m.type.createChecked(Ia(m.attrs,m.attrs.colspan,f+m.attrs.colspan-r),m.content)),c.push(m),f+=m.attrs.colspan;for(let g=1;g<m.attrs.rowspan;g++)s[l+g]=(s[l+g]||0)+m.attrs.colspan}a.push(ge.from(c))}n=a,t=r}if(e!=i){const s=[];for(let a=0,l=0;a<i;a++,l++){const u=[],c=n[l%e];for(let f=0;f<c.childCount;f++){let p=c.child(f);a+p.attrs.rowspan>i&&(p=p.type.create({...p.attrs,rowspan:Math.max(1,i-p.attrs.rowspan)},p.content)),u.push(p)}s.push(ge.from(u))}n=s,e=i}return{width:t,height:e,rows:n}}function SQ(t,e,n,r,i,s,a){const l=t.doc.type.schema,u=Wn(l);let c,f;if(i>e.width)for(let p=0,m=0;p<e.height;p++){const g=n.child(p);m+=g.nodeSize;const v=[];let b;g.lastChild==null||g.lastChild.type==u.cell?b=c||(c=u.cell.createAndFill()):b=f||(f=u.header_cell.createAndFill());for(let w=e.width;w<i;w++)v.push(b);t.insert(t.mapping.slice(a).map(m-1+r),v)}if(s>e.height){const p=[];for(let v=0,b=(e.height-1)*e.width;v<Math.max(e.width,i);v++){const w=v>=e.width?!1:n.nodeAt(e.map[b+v]).type==u.header_cell;p.push(w?f||(f=u.header_cell.createAndFill()):c||(c=u.cell.createAndFill()))}const m=u.row.create(null,ge.from(p)),g=[];for(let v=e.height;v<s;v++)g.push(m);t.insert(t.mapping.slice(a).map(r+n.nodeSize-2),g)}return!!(c||f)}function zE(t,e,n,r,i,s,a,l){if(a==0||a==e.height)return!1;let u=!1;for(let c=i;c<s;c++){const f=a*e.width+c,p=e.map[f];if(e.map[f-e.width]==p){u=!0;const m=n.nodeAt(p),{top:g,left:v}=e.findCell(p);t.setNodeMarkup(t.mapping.slice(l).map(p+r),null,{...m.attrs,rowspan:a-g}),t.insert(t.mapping.slice(l).map(e.positionAt(a,v,n)),m.type.createAndFill({...m.attrs,rowspan:g+m.attrs.rowspan-a})),c+=m.attrs.colspan-1}}return u}function UE(t,e,n,r,i,s,a,l){if(a==0||a==e.width)return!1;let u=!1;for(let c=i;c<s;c++){const f=c*e.width+a,p=e.map[f];if(e.map[f-1]==p){u=!0;const m=n.nodeAt(p),g=e.colCount(p),v=t.mapping.slice(l).map(p+r);t.setNodeMarkup(v,null,Ia(m.attrs,a-g,m.attrs.colspan-(a-g))),t.insert(v+m.nodeSize,m.type.createAndFill(Ia(m.attrs,0,a-g))),c+=m.attrs.rowspan-1}}return u}function WE(t,e,n,r,i){let s=n?t.doc.nodeAt(n-1):t.doc;if(!s)throw new Error("No table found");let a=an.get(s);const{top:l,left:u}=r,c=u+i.width,f=l+i.height,p=t.tr;let m=0;function g(){if(s=n?p.doc.nodeAt(n-1):p.doc,!s)throw new Error("No table found");a=an.get(s),m=p.mapping.maps.length}SQ(p,a,s,n,c,f,m)&&g(),zE(p,a,s,n,u,c,l,m)&&g(),zE(p,a,s,n,u,c,f,m)&&g(),UE(p,a,s,n,l,f,u,m)&&g(),UE(p,a,s,n,l,f,c,m)&&g();for(let v=l;v<f;v++){const b=a.positionAt(v,u,s),w=a.positionAt(v,c,s);p.replace(p.mapping.slice(m).map(b+n),p.mapping.slice(m).map(w+n),new Se(i.rows[v-l],0,0))}g(),p.setSelection(new zt(p.doc.resolve(n+a.positionAt(l,u,s)),p.doc.resolve(n+a.positionAt(f-1,c-1,s)))),e(p)}var _Q=T0({ArrowLeft:Th("horiz",-1),ArrowRight:Th("horiz",1),ArrowUp:Th("vert",-1),ArrowDown:Th("vert",1),"Shift-ArrowLeft":Ah("horiz",-1),"Shift-ArrowRight":Ah("horiz",1),"Shift-ArrowUp":Ah("vert",-1),"Shift-ArrowDown":Ah("vert",1),Backspace:Sh,"Mod-Backspace":Sh,Delete:Sh,"Mod-Delete":Sh});function _h(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function Th(t,e){return(n,r,i)=>{if(!i)return!1;const s=n.selection;if(s instanceof zt)return _h(n,r,ze.near(s.$headCell,e));if(t!="horiz"&&!s.empty)return!1;const a=jE(i,t,e);if(a==null)return!1;if(t=="horiz")return _h(n,r,ze.near(n.doc.resolve(s.head+e),e));{const l=n.doc.resolve(a),u=OE(l,t,e);let c;return u?c=ze.near(u,1):e<0?c=ze.near(n.doc.resolve(l.before(-1)),-1):c=ze.near(n.doc.resolve(l.after(-1)),1),_h(n,r,c)}}}function Ah(t,e){return(n,r,i)=>{if(!i)return!1;const s=n.selection;let a;if(s instanceof zt)a=s;else{const u=jE(i,t,e);if(u==null)return!1;a=new zt(n.doc.resolve(u))}const l=OE(a.$headCell,t,e);return l?_h(n,r,new zt(a.$anchorCell,l)):!1}}function TQ(t,e){const n=t.state.doc,r=ql(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new zt(r))),!0):!1}function AQ(t,e,n){if(!bo(t.state))return!1;let r=CQ(n);const i=t.state.selection;if(i instanceof zt){r||(r={width:1,height:1,rows:[ge.from(Vb(Wn(t.state.schema).cell,n))]});const s=i.$anchorCell.node(-1),a=i.$anchorCell.start(-1),l=an.get(s).rectBetween(i.$anchorCell.pos-a,i.$headCell.pos-a);return r=EQ(r,l.right-l.left,l.bottom-l.top),WE(t.state,t.dispatch,a,l,r),!0}else if(r){const s=Eh(t.state),a=s.start(-1);return WE(t.state,t.dispatch,a,an.get(s.node(-1)).findCell(s.pos-a),r),!0}else return!1}function MQ(t,e){var n;if(e.ctrlKey||e.metaKey)return;const r=qE(t,e.target);let i;if(e.shiftKey&&t.state.selection instanceof zt)s(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(i=ql(t.state.selection.$anchor))!=null&&((n=Fb(t,e))==null?void 0:n.pos)!=i.pos)s(i,e),e.preventDefault();else if(!r)return;function s(u,c){let f=Fb(t,c);const p=_s.getState(t.state)==null;if(!f||!Pb(u,f))if(p)f=u;else return;const m=new zt(u,f);if(p||!t.state.selection.eq(m)){const g=t.state.tr.setSelection(m);p&&g.setMeta(_s,u.pos),t.dispatch(g)}}function a(){t.root.removeEventListener("mouseup",a),t.root.removeEventListener("dragstart",a),t.root.removeEventListener("mousemove",l),_s.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(_s,-1))}function l(u){const c=u,f=_s.getState(t.state);let p;if(f!=null)p=t.state.doc.resolve(f);else if(qE(t,c.target)!=r&&(p=Fb(t,e),!p))return a();p&&s(p,c)}t.root.addEventListener("mouseup",a),t.root.addEventListener("dragstart",a),t.root.addEventListener("mousemove",l)}function jE(t,e,n){if(!(t.state.selection instanceof Ie))return null;const{$head:r}=t.state.selection;for(let i=r.depth-1;i>=0;i--){const s=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:s.childCount))return null;if(s.type.spec.tableRole=="cell"||s.type.spec.tableRole=="header_cell"){const l=r.before(i),u=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(u)?l:null}}return null}function qE(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function Fb(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});return n&&n?ql(t.state.doc.resolve(n.pos)):null}var OQ=class{constructor(e,n){this.node=e,this.defaultCellMinWidth=n,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${n}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),$b(e,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,$b(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function $b(t,e,n,r,i,s){var a;let l=0,u=!0,c=e.firstChild;const f=t.firstChild;if(f){for(let p=0,m=0;p<f.childCount;p++){const{colspan:g,colwidth:v}=f.child(p).attrs;for(let b=0;b<g;b++,m++){const w=i==m?s:v&&v[b],x=w?w+"px":"";if(l+=w||r,w||(u=!1),c)c.style.width!=x&&(c.style.width=x),c=c.nextSibling;else{const C=document.createElement("col");C.style.width=x,e.appendChild(C)}}}for(;c;){const p=c.nextSibling;(a=c.parentNode)==null||a.removeChild(c),c=p}u?(n.style.width=l+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=l+"px")}}var Er=new Et("tableColumnResizing");function BQ({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:r=OQ,lastColumnResizable:i=!0}={}){const s=new ot({key:Er,state:{init(a,l){var u,c;const f=(c=(u=s.spec)==null?void 0:u.props)==null?void 0:c.nodeViews,p=Wn(l.schema).table.name;return r&&f&&(f[p]=(m,g)=>new r(m,n,g)),new IQ(-1,!1)},apply(a,l){return l.apply(a)}},props:{attributes:a=>{const l=Er.getState(a);return l&&l.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(a,l)=>{LQ(a,l,t,i)},mouseleave:a=>{RQ(a)},mousedown:(a,l)=>{DQ(a,l,e,n)}},decorations:a=>{const l=Er.getState(a);if(l&&l.activeHandle>-1)return HQ(a,l.activeHandle)},nodeViews:{}}});return s}var IQ=class Lm{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta(Er);if(r&&r.setHandle!=null)return new Lm(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new Lm(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let i=e.mapping.map(n.activeHandle,-1);return Db(e.doc.resolve(i))||(i=-1),new Lm(i,n.dragging)}return n}};function LQ(t,e,n,r){if(!t.editable)return;const i=Er.getState(t.state);if(i&&!i.dragging){const s=VQ(e.target);let a=-1;if(s){const{left:l,right:u}=s.getBoundingClientRect();e.clientX-l<=n?a=KE(t,e,"left",n):u-e.clientX<=n&&(a=KE(t,e,"right",n))}if(a!=i.activeHandle){if(!r&&a!==-1){const l=t.state.doc.resolve(a),u=l.node(-1),c=an.get(u),f=l.start(-1);if(c.colCount(l.pos-f)+l.nodeAfter.attrs.colspan-1==c.width-1)return}XE(t,a)}}}function RQ(t){if(!t.editable)return;const e=Er.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&XE(t,-1)}function DQ(t,e,n,r){var i;if(!t.editable)return!1;const s=(i=t.dom.ownerDocument.defaultView)!=null?i:window,a=Er.getState(t.state);if(!a||a.activeHandle==-1||a.dragging)return!1;const l=t.state.doc.nodeAt(a.activeHandle),u=PQ(t,a.activeHandle,l.attrs);t.dispatch(t.state.tr.setMeta(Er,{setDragging:{startX:e.clientX,startWidth:u}}));function c(p){s.removeEventListener("mouseup",c),s.removeEventListener("mousemove",f);const m=Er.getState(t.state);m?.dragging&&(FQ(t,m.activeHandle,GE(m.dragging,p,n)),t.dispatch(t.state.tr.setMeta(Er,{setDragging:null})))}function f(p){if(!p.which)return c(p);const m=Er.getState(t.state);if(m&&m.dragging){const g=GE(m.dragging,p,n);YE(t,m.activeHandle,g,r)}}return YE(t,a.activeHandle,u,r),s.addEventListener("mouseup",c),s.addEventListener("mousemove",f),e.preventDefault(),!0}function PQ(t,e,{colspan:n,colwidth:r}){const i=r&&r[r.length-1];if(i)return i;const s=t.domAtPos(e);let l=s.node.childNodes[s.offset].offsetWidth,u=n;if(r)for(let c=0;c<n;c++)r[c]&&(l-=r[c],u--);return l/u}function VQ(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function KE(t,e,n,r){const i=n=="right"?-r:r,s=t.posAtCoords({left:e.clientX+i,top:e.clientY});if(!s)return-1;const{pos:a}=s,l=ql(t.state.doc.resolve(a));if(!l)return-1;if(n=="right")return l.pos;const u=an.get(l.node(-1)),c=l.start(-1),f=u.map.indexOf(l.pos-c);return f%u.width==0?-1:c+u.map[f-1]}function GE(t,e,n){const r=e.clientX-t.startX;return Math.max(n,t.startWidth+r)}function XE(t,e){t.dispatch(t.state.tr.setMeta(Er,{setHandle:e}))}function FQ(t,e,n){const r=t.state.doc.resolve(e),i=r.node(-1),s=an.get(i),a=r.start(-1),l=s.colCount(r.pos-a)+r.nodeAfter.attrs.colspan-1,u=t.state.tr;for(let c=0;c<s.height;c++){const f=c*s.width+l;if(c&&s.map[f]==s.map[f-s.width])continue;const p=s.map[f],m=i.nodeAt(p).attrs,g=m.colspan==1?0:l-s.colCount(p);if(m.colwidth&&m.colwidth[g]==n)continue;const v=m.colwidth?m.colwidth.slice():$Q(m.colspan);v[g]=n,u.setNodeMarkup(a+p,null,{...m,colwidth:v})}u.docChanged&&t.dispatch(u)}function YE(t,e,n,r){const i=t.state.doc.resolve(e),s=i.node(-1),a=i.start(-1),l=an.get(s).colCount(i.pos-a)+i.nodeAfter.attrs.colspan-1;let u=t.domAtPos(i.start(-1)).node;for(;u&&u.nodeName!="TABLE";)u=u.parentNode;u&&$b(s,u.firstChild,u,r,l,n)}function $Q(t){return Array(t).fill(0)}function HQ(t,e){var n;const r=[],i=t.doc.resolve(e),s=i.node(-1);if(!s)return lt.empty;const a=an.get(s),l=i.start(-1),u=a.colCount(i.pos-l)+i.nodeAfter.attrs.colspan-1;for(let c=0;c<a.height;c++){const f=u+c*a.width;if((u==a.width-1||a.map[f]!=a.map[f+1])&&(c==0||a.map[f]!=a.map[f-a.width])){const p=a.map[f],m=l+p+s.nodeAt(p).nodeSize-1,g=document.createElement("div");g.className="column-resize-handle",(n=Er.getState(t))!=null&&n.dragging&&r.push(jt.node(l+p,l+p+s.nodeAt(p).nodeSize,{class:"column-resize-dragging"})),r.push(jt.widget(m,g))}}return lt.create(t.doc,r)}function zQ({allowTableNodeSelection:t=!1}={}){return new ot({key:_s,state:{init(){return null},apply(e,n){const r=e.getMeta(_s);if(r!=null)return r==-1?null:r;if(n==null||!e.docChanged)return n;const{deleted:i,pos:s}=e.mapping.mapResult(n);return i?null:s}},props:{decorations:eQ,handleDOMEvents:{mousedown:MQ},createSelectionBetween(e){return _s.getState(e.state)!=null?e.state.selection:null},handleTripleClick:TQ,handleKeyDown:_Q,handlePaste:AQ},appendTransaction(e,n,r){return rQ(r,LE(r,n),t)}})}const UQ=(t,e,n)=>{if(!t.doc)return t;const r=t.doc.nodeAt(e);if(!r||n===r.attrs.backgroundColor)return t;const i={...r.attrs,backgroundColor:n};return t.setNodeMarkup(e,r.type,i,r.marks)},WQ=(t,e,n)=>{const{doc:r,selection:i}=t;return!r||!i||!(i instanceof zt)||i.forEachCell((s,a)=>{t=UQ(t,a,n)}),t},JE=(t,e)=>({tr:n,state:r,dispatch:i})=>{const{selection:s}=r;return n=n.setSelection(s),n=WQ(n,e,t),n.docChanged?(i?.(n),!0):!1},jQ=Qe.create({name:"tableCellBackground",addOptions(){return{types:["tableCell"],HTMLAttributes:{}}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{parseHTML:t=>t.style.backgroundColor||"",renderHTML:t=>!t.backgroundColor||t.backgroundColor===""?{}:{style:`background-color: ${t.backgroundColor}`}}}}]},addCommands(){return{setTableCellBackground:t=>JE(t,this.options),unsetTableCellBackground:()=>JE("",this.options)}}}),qQ=Lt.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",wt(this.options.HTMLAttributes,t),0]}}),KQ=Lt.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",wt(this.options.HTMLAttributes,t),0]}}),GQ=Lt.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",wt(this.options.HTMLAttributes,t),0]}});function Hb(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function ZE(t,e,n,r,i,s){var a;let l=0,u=!0,c=e.firstChild;const f=t.firstChild;if(f!==null)for(let p=0,m=0;p<f.childCount;p+=1){const{colspan:g,colwidth:v}=f.child(p).attrs;for(let b=0;b<g;b+=1,m+=1){const w=i===m?s:v&&v[b],x=w?`${w}px`:"";if(l+=w||r,w||(u=!1),c){if(c.style.width!==x){const[C,E]=Hb(r,w);c.style.setProperty(C,E)}c=c.nextSibling}else{const C=document.createElement("col"),[E,k]=Hb(r,w);C.style.setProperty(E,k),e.appendChild(C)}}}for(;c;){const p=c.nextSibling;(a=c.parentNode)===null||a===void 0||a.removeChild(c),c=p}u?(n.style.width=`${l}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${l}px`)}class XQ{constructor(e,n){this.node=e,this.cellMinWidth=n,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.colgroup=this.table.appendChild(document.createElement("colgroup")),ZE(e,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!==this.node.type?!1:(this.node=e,ZE(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){return e.type==="attributes"&&(e.target===this.table||this.colgroup.contains(e.target))}}function YQ(t,e,n,r){let i=0,s=!0;const a=[],l=t.firstChild;if(!l)return{};for(let p=0,m=0;p<l.childCount;p+=1){const{colspan:g,colwidth:v}=l.child(p).attrs;for(let b=0;b<g;b+=1,m+=1){const w=n===m?r:v&&v[b];i+=w||e,w||(s=!1);const[x,C]=Hb(e,w);a.push(["col",{style:`${x}: ${C}`}])}}const u=s?`${i}px`:"",c=s?"":`${i}px`;return{colgroup:["colgroup",{},...a],tableWidth:u,tableMinWidth:c}}function QE(t,e){return t.createAndFill()}function JQ(t){if(t.cached.tableNodeTypes)return t.cached.tableNodeTypes;const e={};return Object.keys(t.nodes).forEach(n=>{const r=t.nodes[n];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),t.cached.tableNodeTypes=e,e}function ZQ(t,e,n,r,i){const s=JQ(t),a=[],l=[];for(let c=0;c<n;c+=1){const f=QE(s.cell);if(f&&l.push(f),r){const p=QE(s.header_cell);p&&a.push(p)}}const u=[];for(let c=0;c<e;c+=1)u.push(s.row.createChecked(null,r&&c===0?a:l));return s.table.createChecked(null,u)}function QQ(t){return t instanceof zt}const Mh=({editor:t})=>{const{selection:e}=t.state;if(!QQ(e))return!1;let n=0;const r=a4(e.ranges[0].$from,s=>s.type.name==="table");return r?.node.descendants(s=>{if(s.type.name==="table")return!1;["tableCell","tableHeader"].includes(s.type.name)&&(n+=1)}),n===e.ranges.length?(t.commands.deleteTable(),!0):!1},NQ=Lt.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,handleWidth:5,cellMinWidth:25,View:XQ,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:t,HTMLAttributes:e}){const{colgroup:n,tableWidth:r,tableMinWidth:i}=YQ(t,this.options.cellMinWidth);return["table",wt(this.options.HTMLAttributes,e,{style:r?`width: ${r}`:`min-width: ${i}`}),n,["tbody",0]]},addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:i,editor:s})=>{const a=ZQ(s.schema,t,e,n);if(i){const l=r.selection.from+1;r.replaceSelectionWith(a).scrollIntoView().setSelection(Ie.near(r.doc.resolve(l)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>sQ(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>aQ(t,e),deleteColumn:()=>({state:t,dispatch:e})=>uQ(t,e),addRowBefore:()=>({state:t,dispatch:e})=>dQ(t,e),addRowAfter:()=>({state:t,dispatch:e})=>fQ(t,e),deleteRow:()=>({state:t,dispatch:e})=>hQ(t,e),deleteTable:()=>({state:t,dispatch:e})=>xQ(t,e),mergeCells:()=>({state:t,dispatch:e})=>VE(t,e),splitCell:()=>({state:t,dispatch:e})=>FE(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>jc("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>jc("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>yQ(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>VE(t,e)?!0:FE(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>vQ(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>HE(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>HE(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&LE(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const r=zt.create(e.doc,t.anchorCell,t.headCell);e.setSelection(r)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:Mh,"Mod-Backspace":Mh,Delete:Mh,"Mod-Delete":Mh}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[BQ({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],zQ({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:pt(Fe(t,"tableRole",e))}}}),eN=/(android|bb\d+|meego).+mobile|armv7l|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series[46]0|samsungbrowser.*mobile|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i,tN=/CrOS/,nN=/android|ipad|playbook|silk/i;function NE(t={}){let e=t.ua||typeof navigator<"u"&&navigator.userAgent;return e&&typeof e=="object"&&e.headers&&typeof e.headers["user-agent"]=="string"&&(e=e.headers["user-agent"]),typeof e!="string"?!1:!!(eN.test(e)&&!tN.test(e)||t.tablet&&nN.test(e)||t.tablet&&t.featureDetect&&navigator&&navigator.maxTouchPoints>1&&e.includes("Macintosh")&&e.includes("Safari"))}const rN=["disabled"],oN={"content-class":"table-grid-size-editor","content-style":"padding:0"},iN={class:"flex flex-col flex-wrap gap-1 justify-between"},sN=["onMouseover","onMousedown"],aN={class:"text-center text-sm text-zinc-600 mt-2"},lN=o.defineComponent({__name:"CreateTablePopover",props:{disabled:{type:Boolean,default:!1}},emits:["create-table"],setup(t,{emit:e}){const n=e,r=o.ref(!1),i=o.ref(!0),s=o.reactive({rows:NE()?lf:af,cols:NE()?lf:af}),a=o.reactive({rows:uf,cols:uf});function l(g,v){g===s.rows&&(s.rows=Math.min(g+1,lf)),v===s.cols&&(s.cols=Math.min(v+1,lf)),a.rows=g,a.cols=v}function u(g,v){n("create-table",{rows:g,cols:v,withHeaderRow:o.unref(i)}),c()}function c(){r.value=!1,i.value=!1,s.rows=af,s.cols=af,a.rows=uf,a.cols=uf}const f=o.inject("isMobile",!1),{isOpen:p}=Nf({scrollEl:"tool-bar-format-scroll",ignoreSelector:"[data-radix-popper-content-wrapper]"}),m=o.computed(()=>f?{modal:!1,open:p.value,"onUpdate:open":g=>p.value=g}:{});return(g,v)=>(o.openBlock(),o.createBlock(o.unref(ms),o.normalizeProps(o.guardReactiveProps(o.unref(m))),{default:o.withCtx(()=>[o.createVNode(o.unref(Ca),{"as-child":""},{default:o.withCtx(()=>[o.createElementVNode("button",{disabled:t.disabled,class:"m-0 p-0"},[o.renderSlot(g.$slots,"trigger")],8,rN)]),_:3}),o.createVNode(o.unref(gs),{class:"w-full",align:"start",side:"bottom"},{default:o.withCtx(()=>[o.createElementVNode("div",oN,[o.createElementVNode("div",iN,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(s.rows,b=>(o.openBlock(),o.createElementBlock("div",{key:"r"+b,class:"flex gap-1"},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(s.cols,w=>(o.openBlock(),o.createElementBlock("div",{key:"c"+w,class:o.normalizeClass([[w<=a.cols&&b<=a.rows&&"bg-ed-foreground border-ed-border","cursor-pointer"],"pa-1"]),onMouseover:x=>l(b,w),onMousedown:x=>u(b,w)},v[0]||(v[0]=[o.createElementVNode("div",{class:"w-4 h-4 p-1 border box-border"},null,-1)]),42,sN))),128))]))),128))]),o.createElementVNode("div",aN,o.toDisplayString(a.rows)+" x "+o.toDisplayString(a.cols),1)])]),_:1})]),_:3},16))}}),uN={style:{display:"flex"}},cN=o.defineComponent({__name:"TableActionButton",props:{editor:{},icon:{default:void 0},tooltip:{default:void 0},disabled:{type:Boolean,default:!1},color:{default:void 0},action:{type:Function,default:void 0},isActive:{type:Function,default:void 0}},setup(t){const e=t;function n(r){e.editor.isActive("table")||e.editor.chain().focus().insertTable({...r,withHeaderRow:!1}).run()}return(r,i)=>(o.openBlock(),o.createBlock(lN,{disabled:r.editor.isActive("table"),onCreateTable:n},{trigger:o.withCtx(()=>[o.createElementVNode("div",uN,[o.createVNode(Ge,{icon:r.icon,tooltip:r.tooltip,disabled:r.disabled,color:r.color,action:r.action,"is-active":r.isActive},null,8,["icon","tooltip","disabled","color","action","is-active"])])]),_:1},8,["disabled"]))}}),zb=NQ.extend({addStorage(){return{isTableMenuOpen:!1}},addCommands(){return{...this.parent?.(),toggleTableEditor:t=>({editor:e})=>e.storage.table?(e.storage.table.isTableEditorOpen=t,!0):!1}},addOptions(){return{...this.parent?.(),resizable:!0,lastColumnResizable:!0,allowTableNodeSelection:!1,button:({editor:t,t:e})=>({component:cN,componentProps:{icon:"Table",tooltip:e("editor.table.tooltip"),action:()=>{const n=t.storage.table?.isTableEditorOpen??!1;t.commands.toggleTableEditor(!n)}}})}},addExtensions(){return[KQ.configure(this.options.tableRow),qQ.configure(this.options.tableHeader),GQ.configure(this.options.tableCell),jQ.configure(this.options.tableCellBackground)]}}),dN={class:"flex items-center gap-2 px-2"},fN=o.defineComponent({__name:"TextDropdown",props:{editor:{},disabled:{type:Boolean,default:!1},color:{default:void 0},maxHeight:{default:void 0},icon:{default:void 0},tooltip:{default:""}},setup(t){const e=t,{t:n}=Pt(),r=o.computed(()=>[{name:"paragraph",label:n("editor.paragraph.tooltip"),iconName:"Paragraph",isActive:()=>e.editor.isActive("paragraph")&&!e.editor.isActive("orderedList")&&!e.editor.isActive("bulletList")&&!e.editor.isActive("taskList"),action:()=>e.editor.chain().focus().clearNodes().run()},{name:"heading1",label:n("editor.heading.h1.tooltip"),isActive:()=>e.editor.isActive("heading",{level:1}),iconName:"Heading1",action:()=>e.editor.chain().focus().clearNodes().toggleHeading({level:1}).run()},{name:"heading2",label:n("editor.heading.h2.tooltip"),isActive:()=>e.editor.isActive("heading",{level:2}),iconName:"Heading2",action:()=>e.editor.chain().focus().clearNodes().toggleHeading({level:2}).run()},{name:"heading3",label:n("editor.heading.h3.tooltip"),isActive:()=>e.editor.isActive("heading",{level:3}),iconName:"Heading3",action:()=>e.editor.chain().focus().clearNodes().toggleHeading({level:3}).run()},{name:"bulletList",label:n("editor.bulletlist.tooltip"),isActive:()=>e.editor.isActive("bulletList"),iconName:"List",action:()=>e.editor.chain().focus().clearNodes().toggleBulletList().run()},{name:"numberedList",label:n("editor.orderedlist.tooltip"),isActive:()=>e.editor.isActive("orderedList"),iconName:"ListOrdered",action:()=>e.editor.chain().focus().clearNodes().toggleOrderedList().run()},{name:"taskList",label:n("editor.tasklist.tooltip"),isActive:()=>e.editor.isActive("taskList"),iconName:"ListTodo",action:()=>e.editor.chain().focus().clearNodes().toggleTaskList().run()},{name:"blockquote",label:n("editor.blockquote.tooltip"),isActive:()=>e.editor.isActive("blockquote"),iconName:"TextQuote",action:()=>e.editor.chain().focus().clearNodes().toggleBlockquote().run()},{name:"codeBlock",label:n("editor.codeblock.tooltip"),isActive:()=>e.editor.isActive("codeBlock"),iconName:"Code2",action:()=>e.editor.chain().focus().clearNodes().toggleCodeBlock().run()}]),i=o.computed(()=>r.value.filter(s=>s.isActive()).pop()??{label:n("editor.modify")});return(s,a)=>(o.openBlock(),o.createBlock(ga,{title:i.value?.label,"side-offset":5},{default:o.withCtx(()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(r.value,(l,u)=>(o.openBlock(),o.createBlock(o.unref(Ml),{key:u,class:"cursor-pointer",checked:l.isActive?.()||!1,onClick:l.action},{default:o.withCtx(()=>[o.createElementVNode("div",dN,[o.createVNode(o.unref(Ot),{name:l.iconName,class:"h3 w-3"},null,8,["name"]),o.createElementVNode("span",null,o.toDisplayString(l.label),1)])]),_:2},1032,["checked","onClick"]))),128))]),_:1},8,["title"]))}}),pN=Qe.create({name:"text-bubble",addOptions(){return{...this.parent?.(),toolbar:!1,button:()=>({component:fN,componentProps:{}})}}}),hN=[{label:"복합 표현 - 요일과 시간대",examples:["다음 월요일 저녁","이번 토요일 오전"],pattern:"(이번|다음)?\\s?(월|화|수|목|금|토|일)요일(\\s?(오전|오후|저녁|밤|새벽))?"},{label:"시각 표현",examples:["오전 10시","오후 3시 30분","정오","자정","새벽 2시"],pattern:"((오전|오후|새벽|밤|저녁)\\s?\\d{1,2}(시(\\s?\\d{1,2}분)?)?|정오|자정)"},{label:"시간 표현 - 이른/늦은",examples:["이른 아침","늦은 밤"],pattern:"(이른\\s아침|늦은\\s밤)"},{label:"연도+월",examples:["2019년 6월","2025년12월","2024년 01월"],pattern:"\\d{4}년\\s?\\d{1,2}월"},{label:"오늘/내일/어제",examples:["오늘","내일","모레","어제","그제","그끄제"],pattern:"(오늘|내일|모레|어제|그제|그끄제)"},{label:"상대적 주 단위",examples:["이번 주","다음 주","지난 주"],pattern:"(이번|다음|지난)\\s?주"},{label:"상대적 월 단위",examples:["이번 달","다음 달","지난 달"],pattern:"(이번|다음|지난)\\s?달"},{label:"상대적 연도",examples:["올해","내년","작년","재작년","내후년"],pattern:"(올해|내년|작년|재작년|내후년)"},{label:"복합 표현 - 날짜와 시간대",examples:["1월 1일 오전","12월25일 저녁","다음 주 금요일 오전"],pattern:"(내년|올해|작년)?\\s?\\d{1,2}\\s?월\\s?\\d{1,2}\\s?일(\\s?(오전|오후|저녁|밤|새벽))?"},{label:"정확한 날짜",examples:["1월1일","1월 1일","12월 25일","01월 01일"],pattern:"\\d{1,2}\\s?월\\s?\\d{1,2}\\s?일"},{label:"요일",examples:["월요일","화요일","이번 금요일","다음 화요일"],pattern:"(이번|다음)?\\s?(월|화|수|목|금|토|일)요일"},{label:"시간대",examples:["오전","오후","저녁","밤","새벽"],pattern:"(오전|오후|저녁|밤|새벽)"},{label:"짧은 시간 표현",examples:["방금","조금 전","금방","곧","잠시 후"],pattern:"(방금|조금\\s전|금방|곧|잠시\\s후)"},{label:"연도",examples:["2015년","2024년","1998년"],pattern:"\\d{4}년"}],eS=t=>{const e=[...t||[],...hN.map(n=>n.pattern)].join("|");return new RegExp(e,"gu")},mN=Qe.create({name:sh,addOptions(){return{additionalTimeWords:[],enabled:!0}},addStorage(){return{cachedRegex:null,cachedAdditionalWords:null,enabled:this.options.enabled}},addProseMirrorPlugins(){return[new ot({props:{decorations:t=>{if(!this.storage.enabled)return lt.empty;const e=[];return(this.storage.cachedAdditionalWords!==this.options.additionalTimeWords||!this.storage.cachedRegex)&&(this.storage.cachedAdditionalWords=this.options.additionalTimeWords,this.storage.cachedRegex=eS(this.options.additionalTimeWords)),t.doc.descendants((n,r)=>{if(!n.isText)return;let i;const s=this.storage.cachedRegex;for(;i=s.exec(n.text||"");){const a=r+i.index,l=a+i[0].length;e.push(jt.inline(a,l,{class:"time-highlight"}))}}),lt.create(t.doc,e)}}})]},addCommands(){return{toggleTimeHighlight:()=>({editor:t})=>{const e=t.storage[sh];return e.enabled=!e.enabled,t.view.dispatch(t.state.tr),!0}}}});function Ub(t){const e=JSON.stringify(t),n=window.ReactNativeWebView;if(n){n.postMessage(e);return}console.warn("[clipboardBridge] no bridge found")}function gN(){return new Promise(t=>{const e=window.receiveDriverData;window.receiveDriverData=n=>{e&&e(n);let r;try{r=typeof n=="string"?JSON.parse(n):n}catch{return}r?.type==="CLIPBOARD_STATE"&&t(!!r.data?.hasClipboard)},Ub({type:"REQUEST_CLIPBOARD_STATE"})})}function vN(){return new Promise(t=>{const e=window.receiveDriverData;window.receiveDriverData=n=>{e&&e(n);let r;try{r=typeof n=="string"?JSON.parse(n):n}catch{return}r?.type==="PASTE_RESULT"&&t(r.data?.text??null)},Ub({type:"PASTE"})})}function bN(t,e){Ub({type:"COPY",data:{html:t,text:e}})}async function yN(t,e){try{const n=new ClipboardItem({"text/html":new Blob([t],{type:"text/html"}),"text/plain":new Blob([e],{type:"text/plain"})});await navigator.clipboard.write([n])}catch(n){console.error("navigator clipboard write failed:",n)}}async function wN(){try{if("read"in navigator.clipboard){const t=await navigator.clipboard.read();for(const e of t){if(e.types.includes("text/html"))return await(await e.getType("text/html")).text();if(e.types.includes("text/plain"))return await(await e.getType("text/plain")).text()}}}catch(t){console.warn("navigator clipboard read failed:",t)}}const xN=Qe.create({name:"clipboard",addCommands(){return{copyContent:()=>({editor:t,state:e})=>{const{from:n,to:r}=e.selection;return n===r?!1:((async()=>{try{const i=e.doc.slice(n,r),a=Ir.fromSchema(t.schema).serializeFragment(i.content),l=document.createElement("div");l.appendChild(a);const u=l.innerHTML,c=e.doc.textBetween(n,r,`
344
- `);t.storage.deviceEnv.isMobile?bN(u,c):await yN(u,c)}catch(i){console.warn("[clipboard] copy failed",i)}})(),!0)},cutContent:()=>({editor:t})=>((async()=>{try{await t.commands.copyContent(),t.chain().focus().deleteSelection().run()}catch(e){console.warn("[clipboard] cut failed",e)}})(),!0),pasteContent:()=>({editor:t})=>((async()=>{try{t.chain().focus().run();const e=t.storage.deviceEnv.isMobile?await vN():await wN();if(!e)return;const n=new DataTransfer;if($J(e)){n.setData("text/html",e);const i=document.createElement("div");i.innerHTML=e,n.setData("text/plain",i.innerText)}else n.setData("text/plain",e);const r=new ClipboardEvent("paste",{bubbles:!0,cancelable:!0});Object.defineProperty(r,"clipboardData",{value:n}),t.view.dom.dispatchEvent(r)}catch(e){console.warn("Clipboard paste failed:",e)}})(),!0)}},onCreate(){const t=this.editor;t.hasClipboard=async()=>{try{return!!(t.storage.deviceEnv.isMobile?await gN():await navigator.clipboard.readText())}catch(e){return console.warn("[clipboard] check failed",e),!1}}}}),CN=Qe.create({name:"deviceEnv",addOptions(){return{initial:!1,specialCharModal:void 0}},addStorage(){return{isMobile:this.options.initial,specialCharModal:this.options.specialCharModal,isForceCloseBubble:!1}},addCommands(){return{setIsMobile:t=>({editor:e})=>(e.storage.deviceEnv.isMobile=t,e.storage.spellchecker?.spellchecker.setIsMobile(t),!0),setForceCloseBubble:t=>({editor:e})=>(e.storage.deviceEnv.isForceCloseBubble=t,!0),resetForceCloseBubble:()=>({editor:t})=>(t.storage.deviceEnv.isForceCloseBubble=!1,!0)}}}),Oh=o.defineComponent({__name:"Tabs",props:{defaultValue:{},orientation:{},dir:{},activationMode:{},modelValue:{},asChild:{type:Boolean},as:{}},emits:["update:modelValue"],setup(t,{emit:e}){const i=Rt(t,e);return(s,a)=>(o.openBlock(),o.createBlock(o.unref(cF),o.normalizeProps(o.guardReactiveProps(o.unref(i))),{default:o.withCtx(()=>[o.renderSlot(s.$slots,"default")]),_:3},16))}}),kN={class:"truncate"},Kl=o.defineComponent({__name:"TabsTrigger",props:{value:{},disabled:{type:Boolean},asChild:{type:Boolean},as:{},class:{}},setup(t){const e=t,n=o.computed(()=>{const{class:i,...s}=e;return s}),r=Jn(n);return(i,s)=>(o.openBlock(),o.createBlock(o.unref(pF),o.mergeProps(o.unref(r),{class:o.unref(ke)("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-ed-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ed-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-ed-background data-[state=active]:text-ed-foreground data-[state=active]:shadow-sm",e.class)}),{default:o.withCtx(()=>[o.createElementVNode("span",kN,[o.renderSlot(i.$slots,"default")])]),_:3},16,["class"]))}}),Bh=o.defineComponent({__name:"TabsList",props:{loop:{type:Boolean},asChild:{type:Boolean},as:{},class:{}},setup(t){const e=t,n=o.computed(()=>{const{class:r,...i}=e;return i});return(r,i)=>(o.openBlock(),o.createBlock(o.unref(dF),o.mergeProps(n.value,{class:o.unref(ke)("inline-flex items-center justify-center rounded-md bg-ed-muted p-1 text-ed-muted-foreground",e.class)}),{default:o.withCtx(()=>[o.renderSlot(r.$slots,"default")]),_:3},16,["class"]))}}),Ih=o.defineComponent({__name:"TabsContent",props:{value:{},forceMount:{type:Boolean},asChild:{type:Boolean},as:{},class:{}},setup(t){const e=t,n=o.computed(()=>{const{class:r,...i}=e;return i});return(r,i)=>(o.openBlock(),o.createBlock(o.unref(fF),o.mergeProps({class:o.unref(ke)("mt-2 ring-offset-ed-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ed-ring focus-visible:ring-offset-2",e.class)},n.value),{default:o.withCtx(()=>[o.renderSlot(r.$slots,"default")]),_:3},16,["class"]))}}),EN={class:"flex items-center w-full p-3 my-3 hover:bg-ed-accent border border-ed-border text-ed-muted-foreground cursor-pointer rounded-sm transition-all"},SN={key:0,class:"flex justify-center items-center gap-3 text-s"},_N={key:1,class:"flex justify-between items-center w-full"},TN={class:"flex justify-center items-center gap-3"},AN={class:"text-sm"},MN={class:"flex items-center gap-2"},ON=o.defineComponent({__name:"VideoUploader",props:{...ta},setup(t){const e=t,n=o.inject("isEditable",o.ref(!0)),r=o.ref(""),i=o.ref(!1),s=o.ref(),{t:a}=Pt();function l(p){i.value=!0;const m=p.target,g=Array.from(m?.files||[]),v=e.editor.extensionManager.extensions.find(w=>w.name==="videoUpload")?.options;if(!e.editor||e.editor.isDestroyed||g.length===0||typeof v?.upload!="function")return;const b=g[0];v.upload(b).then(w=>{e.editor.chain().setVideo({src:w}).deleteRange({from:e.getPos(),to:e.getPos()}).insertContentAt(e.getPos()+1,{type:"paragraph"}).focus().run(),i.value=!1})}function u(){e.editor.chain().setVideo({src:r.value,width:640}).deleteRange({from:e.getPos(),to:e.getPos()}).insertContentAt(e.getPos()+1,{type:"paragraph"}).focus().run()}function c(){e.deleteNode()}function f(){s.value?.click()}return(p,m)=>(o.openBlock(),o.createBlock(o.unref(ea),{as:"div","data-drag-handle":"",class:o.normalizeClass(o.unref(ke)(!o.unref(n)&&"pointer-events-none"))},{default:o.withCtx(()=>[o.createVNode(o.unref(ms),{"default-open":o.unref(n)},{default:o.withCtx(()=>[o.createVNode(o.unref(Ca),{"as-child":""},{default:o.withCtx(()=>[o.createElementVNode("div",EN,[i.value?(o.openBlock(),o.createElementBlock("div",SN,[o.createVNode(o.unref(Ot),{class:"animate-spin w-6 h-6",name:"LoaderCircle"}),o.createElementVNode("span",null,o.toDisplayString(o.unref(a)("editor.video.dialog.uploading"))+"...",1)])):(o.openBlock(),o.createElementBlock("div",_N,[o.createElementVNode("div",TN,[o.createVNode(o.unref(Ot),{name:"Video",class:"w-6 h-6"}),o.createElementVNode("span",AN,o.toDisplayString(o.unref(a)("editor.video.dialog.title")),1)]),o.createVNode(o.unref(Ot),{name:"Trash2",class:"hover:text-ed-foreground",onClick:o.withModifiers(c,["stop"])})]))])]),_:1}),o.createVNode(o.unref(gs),{"trap-focus":"",class:"w-full","on-open-auto-focus":g=>g.preventDefault()},{default:o.withCtx(()=>[o.createVNode(o.unref(Oh),{"default-value":"upload",class:"w-[300px] sm:w-[400px]","activation-mode":"manual"},{default:o.withCtx(()=>[o.createVNode(o.unref(Bh),{class:"grid w-full grid-cols-2"},{default:o.withCtx(()=>[o.createVNode(o.unref(Kl),{value:"upload"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(a)("editor.video.dialog.tab.upload")),1)]),_:1}),o.createVNode(o.unref(Kl),{value:"link",disabled:i.value},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(a)("editor.video.dialog.link")),1)]),_:1},8,["disabled"])]),_:1}),o.createVNode(o.unref(Ih),{value:"upload"},{default:o.withCtx(()=>[o.createVNode(o.unref(mn),{class:"w-full mt-1",size:"sm",disabled:i.value,onClick:f},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(a)("editor.video.dialog.tab.upload")),1)]),_:1},8,["disabled"]),o.createElementVNode("input",{ref_key:"fileInput",ref:s,type:"file",accept:"video/*",hidden:"",onChange:l},null,544)]),_:1}),o.createVNode(o.unref(Ih),{value:"link"},{default:o.withCtx(()=>[o.createElementVNode("div",MN,[o.createVNode(o.unref(ws),{modelValue:r.value,"onUpdate:modelValue":m[0]||(m[0]=g=>r.value=g),type:"url",autofocus:"",required:"",placeholder:o.unref(a)("editor.video.dialog.placeholder")},null,8,["modelValue","placeholder"]),o.createVNode(o.unref(mn),{onClick:u},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(a)("editor.video.dialog.button.apply")),1)]),_:1})])]),_:1})]),_:1})]),_:1},8,["on-open-auto-focus"])]),_:1},8,["default-open"])]),_:1},8,["class"]))}}),tS=Lt.create({name:Bc,isolating:!0,defining:!0,group:"block",draggable:!0,selectable:!1,inline:!1,parseHTML(){return[{tag:`div[data-type="${this.name}"]`}]},renderHTML(){return["div",{"data-type":this.name}]},addCommands(){return{setVideoUpload:()=>({commands:t})=>t.insertContent(`<div data-type="${this.name}"></div>`)}},addNodeView(){return na(ON)},addOptions(){return{...this.parent?.(),upload:()=>Promise.reject("link video not found"),button:({editor:t,t:e})=>({component:Ge,componentProps:{action:()=>t.commands.setVideoUpload(),isActive:()=>t.isActive("video")||!1,disabled:!t.can().setVideo?.({}),icon:"Video",tooltip:e("editor.video.tooltip")}})}}});function BN(t){return t=t.replace("https://youtu.be/","https://www.youtube.com/watch?v=").replace("watch?v=","embed/"),t=t.replace("https://vimeo.com/","https://player.vimeo.com/video/"),/^https?:\/\/www.bilibili.com\/video\/.*/i.test(t)&&(t=t.replace(/\?.*$/i,"").replace("https://www.bilibili.com/video/","https://player.bilibili.com/player.html?bvid=")),t.includes("drive.google.com")&&(t=t.replace("/view","/preview")),t}function IN(t){return t?t.includes("youtube.com/embed")||t.includes("player.vimeo.com")||t.includes("player.bilibili.com")||t.includes("drive.google.com"):!1}const nS=Lt.create({name:"video",group:"block",atom:!0,draggable:!0,addOptions(){return{divider:!1,spacer:!1,allowFullscreen:!0,upload:void 0,width:cf["size-medium"],controls:!0,autoplay:!1,HTMLAttributes:{class:"iframe-wrapper",style:"display: flex;justify-content: center;"}}},addAttributes(){return{src:{default:null,renderHTML:({src:t})=>({src:t?BN(t):null})},width:{default:this.options.width,renderHTML:({width:t})=>({width:Yt(t)})},allowfullscreen:{default:this.options.allowFullscreen,parseHTML:()=>this.options.allowFullscreen},controls:{default:this.options.controls}}},parseHTML(){return[{tag:"video"},{tag:"iframe"}]},renderHTML({HTMLAttributes:t}){const{src:e,width:n,controls:r,allowfullscreen:i}=t??{},s=`max-width: ${Yt(n)};`;return IN(e)?["iframe",{src:e,style:s,...i&&{allowfullscreen:i}}]:["video",{src:e?e.replace(/\\/g,"/"):"",style:s,...r&&{controls:r}}]},addCommands(){return{setVideo:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t}),updateVideo:t=>({commands:e})=>e.updateAttributes(this.name,t)}}}),Gl=new Et("upload-image"),LN=()=>new ot({key:Gl,state:{init(){return lt.empty},apply(t,e){e=e.map(t.mapping,t.doc);const n=t.getMeta(Gl);if(n?.add){const r=n.add.map(({id:i,pos:s,src:a})=>{const l=RN(a);return jt.widget(s,l,{id:i,side:-1})});e=e.add(t.doc,r)}return n?.remove&&n.remove.forEach(r=>{e=e.remove(e.find(void 0,void 0,i=>i.id===r))}),e}},props:{decorations(t){return this.getState(t)}}});function RN(t){const e=document.createElement("div"),n=document.createElement("img");return n.setAttribute("class","opacity-50"),n.src=t,n.onload=()=>{e.setAttribute("class","img-placeholder")},e.appendChild(n),e}function DN(t,e){const r=Gl.getState(t).find(void 0,void 0,i=>i.id===e);return r.length?r[0]?.from:null}const rS=({validateFn:t,onUpload:e})=>async(n,r,i)=>{const s=[];for(const a of n){if(t&&!t(a))continue;const l=$r(6),u=URL.createObjectURL(a);s.push({file:a,id:l,preview:u})}s.length!==0&&(r.dispatch(r.state.tr.setMeta(Gl,{add:s.map(({id:a,preview:l})=>({id:a,pos:i,src:l}))})),await Promise.all(s.map(async({file:a,id:l,preview:u})=>{try{const c=await e(a),f=DN(r.state,l);if(f===null)return;const{schema:p}=r.state,m=typeof c=="object"?u:c,g=p.nodes.image?.create({src:m}),v=p.nodes.paragraph?.create();if(!g||!v)return;r.dispatch(r.state.tr.replaceWith(f,f,g).insert(f+g.nodeSize,v).setMeta(Gl,{remove:[l]}))}catch{r.dispatch(r.state.tr.setMeta(Gl,{remove:[l]}))}})))},PN=(t,e,n)=>{const r=Array.from(e.clipboardData?.files||[]);if(r.length){e.preventDefault();const i=t.state.selection.from;return n(r,t,i+1),!0}return!1},VN=(t,e,n,r)=>{const i=Array.from(e.dataTransfer?.files||[]);if(!n&&i.length){e.preventDefault();const s=t.posAtCoords({left:e.clientX,top:e.clientY});if(s)return r(i,t,s.pos+1),!0}return!1},FN={class:"flex items-center w-full p-3 my-3 transition-all border rounded-sm cursor-pointer hover:bg-ed-accent border-ed-border text-ed-muted-foreground"},$N={class:"flex items-center justify-between w-full"},HN={class:"flex items-center justify-center gap-3"},zN={class:"text-sm"},UN={class:"flex items-center gap-2"},WN=o.defineComponent({__name:"ImageUploader",props:{...ta},setup(t){const e=t,n=o.ref(""),r=o.ref(),{t:i}=Pt(),s=o.inject("isEditable",o.ref(!0));function a(f){const p=f?.target?.files;if(!e.editor||e.editor.isDestroyed||p.length===0)return;const m=Array.from(p),g=e.editor.extensionManager.extensions.find(b=>b.name==="imageUpload")?.options;rS({validateFn:b=>!0,onUpload:g.upload})(m,e.editor.view,e.getPos(),e.node.attrs.id)}function l(){e.editor.chain().setImage({src:n.value}).deleteRange({from:e.getPos(),to:e.getPos()}).insertContentAt(e.getPos()+1,{type:"paragraph"}).focus().run()}function u(){e.deleteNode()}function c(){r.value?.click()}return(f,p)=>(o.openBlock(),o.createBlock(o.unref(ea),{id:f.node.attrs.id,"data-drag-handle":"",class:o.normalizeClass(o.unref(ke)(!o.unref(s)&&"pointer-events-none"))},{default:o.withCtx(()=>[o.createVNode(o.unref(ms),{"default-open":o.unref(s)},{default:o.withCtx(()=>[o.createVNode(o.unref(Ca),{"as-child":""},{default:o.withCtx(()=>[o.createElementVNode("div",FN,[o.createElementVNode("div",$N,[o.createElementVNode("div",HN,[o.createVNode(o.unref(Ot),{name:"ImageUp",class:"w-6 h-6"}),o.createElementVNode("span",zN,o.toDisplayString(o.unref(i)("editor.image.dialog.title")),1)]),o.createVNode(o.unref(Ot),{name:"Trash2",class:"hover:text-ed-foreground",onClick:o.withModifiers(u,["stop"])})])])]),_:1}),o.createVNode(o.unref(gs),{"trap-focus":"",class:"w-full","on-open-auto-focus":m=>m.preventDefault()},{default:o.withCtx(()=>[o.createVNode(o.unref(Oh),{"default-value":"upload",class:"w-[300px] sm:w-[400px]","activation-mode":"manual"},{default:o.withCtx(()=>[o.createVNode(o.unref(Bh),{class:"grid w-full grid-cols-2"},{default:o.withCtx(()=>[o.createVNode(o.unref(Kl),{value:"upload"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(i)("editor.image.dialog.tab.upload")),1)]),_:1}),o.createVNode(o.unref(Kl),{value:"link"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(i)("editor.image.dialog.tab.url")),1)]),_:1})]),_:1}),o.createVNode(o.unref(Ih),{value:"upload"},{default:o.withCtx(()=>[o.createVNode(o.unref(mn),{class:"w-full mt-1",size:"sm",onClick:c},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(i)("editor.image.dialog.tab.upload")),1)]),_:1}),o.createElementVNode("input",{ref_key:"fileInput",ref:r,type:"file",accept:"image/*",multiple:"",hidden:"",onChange:a},null,544)]),_:1}),o.createVNode(o.unref(Ih),{value:"link"},{default:o.withCtx(()=>[o.createElementVNode("div",UN,[o.createVNode(o.unref(ws),{modelValue:n.value,"onUpdate:modelValue":p[0]||(p[0]=m=>n.value=m),type:"url",autofocus:"",required:"",placeholder:o.unref(i)("editor.image.dialog.placeholder")},null,8,["modelValue","placeholder"]),o.createVNode(o.unref(mn),{onClick:l},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(i)("editor.image.dialog.button.apply")),1)]),_:1})])]),_:1})]),_:1})]),_:1},8,["on-open-auto-focus"])]),_:1},8,["default-open"])]),_:1},8,["id","class"]))}}),jN=1,qN=1e6,Ei={ADD_TOAST:"ADD_TOAST",UPDATE_TOAST:"UPDATE_TOAST",DISMISS_TOAST:"DISMISS_TOAST",REMOVE_TOAST:"REMOVE_TOAST"};let Wb=0;function KN(){return Wb=(Wb+1)%Number.MAX_VALUE,Wb.toString()}const jb=new Map;function oS(t){if(jb.has(t))return;const e=setTimeout(()=>{jb.delete(t),qc({type:Ei.REMOVE_TOAST,toastId:t})},qN);jb.set(t,e)}const yo=o.ref({toasts:[]});function qc(t){switch(t.type){case Ei.ADD_TOAST:yo.value.toasts=[t.toast,...yo.value.toasts].slice(0,jN);break;case Ei.UPDATE_TOAST:yo.value.toasts=yo.value.toasts.map(e=>e.id===t.toast.id?{...e,...t.toast}:e);break;case Ei.DISMISS_TOAST:{const{toastId:e}=t;e?oS(e):yo.value.toasts.forEach(n=>{oS(n.id)}),yo.value.toasts=yo.value.toasts.map(n=>n.id===e||e===void 0?{...n,open:!1}:n);break}case Ei.REMOVE_TOAST:t.toastId===void 0?yo.value.toasts=[]:yo.value.toasts=yo.value.toasts.filter(e=>e.id!==t.toastId);break}}function qb(){return{toasts:o.computed(()=>yo.value.toasts),toast:GN,dismiss:t=>qc({type:Ei.DISMISS_TOAST,toastId:t})}}function GN(t){const e=KN(),n=i=>qc({type:Ei.UPDATE_TOAST,toast:{...i,id:e}}),r=()=>qc({type:Ei.DISMISS_TOAST,toastId:e});return qc({type:Ei.ADD_TOAST,toast:{...t,id:e,open:!0,onOpenChange:i=>{i||r()}}}),{id:e,dismiss:r,update:n}}const XN={acceptMimes:["image/jpeg","image/gif","image/png","image/jpg"],maxSize:1024*1024*5},YN=t=>`${(t/1024/1024).toFixed(2)}MB`,iS=Lt.create({name:Ci,isolating:!0,defining:!0,group:"block",draggable:!1,selectable:!1,inline:!1,onCreate(){if(typeof this.options.upload!="function")throw new Error("Image upload function should be a function")},parseHTML(){return[{tag:`div[data-type="${this.name}"]`}]},renderHTML(){return["div",{"data-type":this.name}]},addAttributes(){return{id:{default:$r(6),parseHTML:t=>t.getAttribute("id"),renderHTML:t=>t.id?{id:t.id}:{}}}},addCommands(){return{setImageUpload:()=>({commands:t})=>t.insertContent(`<div data-type="${this.name}"></div>`)}},addNodeView(){return na(WN)},addOptions(){return{...XN,...this.parent?.(),upload:()=>Promise.reject("Image Upload Function"),button:({editor:t,extension:e,t:n})=>({component:Ge,componentProps:{action:()=>t.commands.setImageUpload(),disabled:!t.can().setImage?.({}),icon:"ImageUp",tooltip:n("editor.image.tooltip")}})}},addProseMirrorPlugins(){const{toast:t}=qb(),e=Oa.global.t,r=rS({validateFn:i=>this.options.acceptMimes.includes(i.type)?i.size>this.options.maxSize?(t({description:`${e("editor.imageUpload.fileSizeTooBig")} ${YN(this.options.maxSize)}.`,duration:2e3}),!1):!0:(t({description:e("editor.imageUpload.fileTypeNotSupported"),duration:2e3}),!1),onUpload:this.options.upload});return[new ot({props:{handlePaste:(i,s)=>!s.clipboardData||Array.from(s.clipboardData.items||[]).some(l=>l.type==="text/html")?!1:PN(i,s,r),handleDrop:(i,s,a,l)=>!(s instanceof DragEvent)||!s.dataTransfer||!Array.from(s.dataTransfer.files||[]).some(f=>this.options.acceptMimes.includes(f.type))?!1:VN(i,s,l,r)}}),LN()]}}),JN=Qe.create({name:"searchHighlight",addGlobalAttributes(){return[{types:["textStyle"],attributes:{searchHighlight:{default:null,parseHTML:t=>{const e=t,n=e.style.color,r=e.style.backgroundColor;return!n||!r?null:{color:n,backgroundColor:r}},renderHTML:t=>{if(!t.searchHighlight)return{};const{color:e,backgroundColor:n}=t.searchHighlight;return{style:`color: ${e}; background-color: ${n}`}}}}}]}}),ZN=o.defineComponent({__name:"SpecialCharacterButton",props:{editor:p4},setup(t){const e=t,{t:n}=Pt(),r=bn(),i=o.computed(()=>e.editor?.storage.specialCharacter.specialCharModal),s=o.ref(!1);let a=null;function l(){const p=document.activeElement;if(p instanceof HTMLInputElement){a={type:"input",el:p};return}r.editorFocusedInstance.value&&(a={type:"editor"})}const u=()=>{if(!i.value||!i.value.component){console.error("Please configure specialCharModal!");return}s.value=!s.value};document.addEventListener("focusin",p=>{if(!s.value)return;const m=p.target;if(m instanceof HTMLInputElement){a={type:"input",el:m};return}r.editorFocusedInstance.value?.view?.dom?.contains(m)&&(a={type:"editor"})});function c(p,m){const g=p.selectionStart??p.value.length,v=p.selectionEnd??p.value.length;p.value=p.value.slice(0,g)+m+p.value.slice(v);const b=g+m.length;p.setSelectionRange(b,b),p.dispatchEvent(new Event("input",{bubbles:!0})),p.focus()}const f=(p,m)=>{if(m){if(a?.type==="input"){c(a.el,p);return}if(a?.type==="editor"){const g=r.editorFocusedInstance.value;if(!g)return;const{view:v}=g,{from:b}=v.state.selection;g.commands.insertContentAt(b,p),g.commands.focus()}}};return(p,m)=>{const g=da,v=is,b=ca,w=fa;return o.openBlock(),o.createBlock(w,null,{default:o.withCtx(()=>[o.createVNode(b,{"delay-duration":0},{default:o.withCtx(()=>[o.createVNode(g,null,{default:o.withCtx(()=>[o.createVNode(mn,{class:"text-[#65558F] hover:bg-[#ECE6F0]/90 text-xs rounded-none font-normal h-[26px] px-3 border border-gray-300 bg-ed-gray-50 dark:bg-black dark:text-white dark:hover:bg-gray-700 transition-all",onPointerdown:l,onClick:u},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(n)("editor.insert.symbol")),1)]),_:1})]),_:1}),o.createVNode(v,null,{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(n)("editor.insert.symbol")),1)]),_:1})]),_:1}),(o.openBlock(),o.createBlock(o.Teleport,{to:"body"},[o.unref(s)?(o.openBlock(),o.createBlock(o.resolveDynamicComponent(o.unref(i).component),o.mergeProps({key:0},o.unref(i).props,{"custom-class":"!z-[70] !pointer-events-auto",onClose:m[0]||(m[0]=x=>s.value=!1),onSelectedChar:f}),null,16)):o.createCommentVNode("",!0)]))]),_:1})}}}),QN=Qe.create({name:ah,addOptions(){return{button:({editor:t})=>({component:ZN,componentProps:{editor:t}}),specialCharModal:void 0}},addStorage(){return{specialCharModal:this.options.specialCharModal}}}),sS=Qe.create({name:"base-kit",addOptions(){return{...this.parent?.(),timeHighlighter:{additionalTimeWords:[]},bubble:{list:bL,defaultBubbleList:sG,button:({editor:t,extension:e,t:n})=>{const{list:r={},defaultBubbleList:i}=e.options?.bubble??{},s=i?.(t)??[];return aG(r,s,{editor:t,extension:e,t:n})}}}},addExtensions(){const t=Oa.global.t,e=[];this.options.placeholder!==!1&&e.push(Y5.configure({placeholder:({node:n,pos:r})=>{const i=n?.type?.name;return i==="heading"?`${t(`editor.heading.h${n.attrs.level}.tooltip`)}`:i==="table"||i==="codeBlock"?"":r===0?t("editor.content"):""},...this.options.placeholder})),this.options.focus!==!1&&e.push(XK.configure({className:"focus",...this.options.focus})),this.options.document!==!1&&(this.options.page?(e.push(Q5.configure().extend({content:"page+"})),e.push(mZ.configure({types:this.options.page?.nodesComputedOption?.types??[],slots:o.useSlots()}))):e.push(Q5.configure())),this.options.dropcursor!==!1&&e.push(GK.configure({...this.options.dropcursor,width:2,class:"ProseMirror-dropcursor border-black"})),this.options.characterCount!==!1&&e.push(jK.configure(this.options.characterCount)),this.options.paragraph!==!1&&e.push(X5.configure(this.options.paragraph)),this.options.hardBreak!==!1&&e.push(G5.configure(this.options.hardBreak)),this.options.listItem!==!1&&e.push(rG.configure(this.options.listItem)),this.options.textStyle!==!1&&e.push(oG.configure(this.options.textStyle)),this.options.imageUpload!==!1&&e.push(iS.configure(this.options.imageUpload)),this.options.video!==!1&&e.push(nS.configure(this.options.video)),this.options.videoUpload!==!1&&e.push(tS.configure(this.options.videoUpload)),this.options.history!==!1&&e.push(Pv.configure(this.options.history)),this.options.fontFamily!==!1&&e.push(EE.configure(this.options.fontFamily)),this.options.fontSize!==!1&&e.push(l5.configure(this.options.fontSize)),this.options.fontWeight!==!1&&e.push(yZ.configure(this.options.fontWeight)),this.options.mode!==Te.EDITOR&&e.push(QN.configure(this.options.specialCharacter)),this.options.mode!==Te.EDITOR&&e.push(kZ),this.options.superText!==!1&&this.options.mode!==Te.PLAIN_TEXT&&this.options.mode!==Te.EDITOR&&(typeof this.options.superText=="boolean"?e.push(cE.configure()):e.push(cE.configure(this.options.superText))),this.options.mode===Te.EDITOR&&(this.options.image!==!1&&e.push(Wc.configure()),e.push(Z6.configure({spacer:!0}),w6,y6,x6,Lv,zb,C6,m5.configure({spacer:!0}),Q6.configure({types:["heading","paragraph","tableCell","tableHeader"],spacer:!0}),TE)),this.options.mode!==Te.EDITOR&&this.options.configPlan!==!1&&this.options.mode!==Te.PLAIN_TEXT&&(typeof this.options.configPlan=="boolean"?e.push(ME.configure()):e.push(ME.configure({specialCharModal:this.options.configPlan?.specialCharModal}))),this.options.mode!==Te.EDITOR&&this.options.mode!==Te.PLAIN_TEXT&&e.push(SZ),(this.options.mode===Te.STRAIGHT||this.options.mode===Te.REPORT||this.options.mode===Te.EDITOR)&&this.options.timeHighlighter&&e.push(mN.configure(this.options.timeHighlighter)),this.options.invalidCharFocus!==!1&&e.push(bE.configure(this.options.invalidCharFocus)),this.options.disabled&&e.push(JN),e.push(N5,J5.configure(),pN.configure(),nG.configure(),Ib,Ob,uv,xN,CN.configure(this.options.deviceEnv),g5.configure({multicolor:!0}));for(const n in this.options.excludes)Object.prototype.hasOwnProperty.call(this.options.excludes,n)&&this.options.excludes[n]&&St.remove(e,({name:i})=>i===n);return e},addStorage(){return{mode:this.options.mode}}}),aS=Fn.create({name:"subscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sub"},{style:"vertical-align",getAttrs(t){return t!=="sub"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sub",wt(this.options.HTMLAttributes,t),0]},addCommands(){return{setSubscript:()=>({commands:t})=>t.setMark(this.name),toggleSubscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSubscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}}),lS=Fn.create({name:"superscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs(t){return t!=="super"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sup",wt(this.options.HTMLAttributes,t),0]},addCommands(){return{setSuperscript:()=>({commands:t})=>t.setMark(this.name),toggleSuperscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSuperscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-.":()=>this.editor.commands.toggleSuperscript()}}}),NN=Qe.create({name:"subAndSuperScript",addOptions(){return{...this.parent?.(),button:({editor:t,extension:e,t:n})=>{const r=e.options.subscript,i=e.options.superscript,s={component:Ge,componentProps:{action:()=>t.commands.toggleSubscript(),isActive:()=>t.isActive("subscript")||!1,disabled:!t.can().toggleSubscript(),icon:"Subscript",tooltip:n("editor.subscript.tooltip")}},a={component:Ge,componentProps:{action:()=>t.commands.toggleSuperscript(),isActive:()=>t.isActive("superscript")||!1,disabled:!t.can().toggleSuperscript(),icon:"Superscript",tooltip:n("editor.superscript.tooltip")}},l=[];return r!==!1&&l.push(s),i!==!1&&l.push(a),l}}},addExtensions(){const t=[];return this.options.subscript!==!1&&t.push(aS.configure(this.options.subscript)),this.options.superscript!==!1&&t.push(lS.configure(this.options.superscript)),t}}),eee={class:"ml-1"},tee=o.defineComponent({__name:"ActionMoreButton",props:{editor:{},disabled:{type:Boolean,default:!1},color:{default:void 0},maxHeight:{default:void 0},icon:{default:void 0},tooltip:{default:""},items:{default:()=>[]}},setup(t){const e=t,n=o.computed(()=>{const r=e.items.find(s=>s.isActive());return r&&!r.default?{...r,icon:r.icon?r.icon:e.icon}:{title:e.tooltip,icon:e.icon,isActive:()=>!1}});return(r,i)=>(o.openBlock(),o.createBlock(ga,{icon:r.icon,tooltip:r.tooltip,disabled:r.disabled},{default:o.withCtx(()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(e.items,(s,a)=>(o.openBlock(),o.createBlock(o.unref(Ml),{key:a,checked:n.value.title===s.title,disabled:s.disabled,class:"flex gap-3 items-center",onClick:s.action},{default:o.withCtx(()=>[s.icon?(o.openBlock(),o.createBlock(o.unref(Ot),{key:0,name:s.icon},null,8,["name"])):o.createCommentVNode("",!0),o.createElementVNode("span",eee,o.toDisplayString(s.title),1),s.shortcutKeys?(o.openBlock(),o.createBlock(o.unref(Y6),{key:1,class:"ml-auto"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(_x)(s.shortcutKeys)),1)]),_:2},1024)):o.createCommentVNode("",!0)]),_:2},1032,["checked","disabled","onClick"]))),128))]),_:1},8,["icon","tooltip","disabled"]))}}),nee=Qe.create({name:"moreMark",addOptions(){return{...this.parent?.(),button({editor:t,extension:e,t:n}){const r=e.options.subscript,i=e.options.superscript,s={action:()=>t.commands.toggleSubscript(),isActive:()=>t.isActive("subscript")||!1,disabled:!t.can().toggleSubscript(),icon:"Subscript",title:n("editor.subscript.tooltip"),shortcutKeys:["mod","."]},a={action:()=>t.commands.toggleSuperscript(),isActive:()=>t.isActive("superscript")||!1,disabled:!t.can().toggleSuperscript(),icon:"Superscript",title:n("editor.superscript.tooltip"),shortcutKeys:["mod",","]},l=vg(t,"code"),u=[];if(r!==!1&&u.push(s),i!==!1&&u.push(a),l){const c={action:()=>t.commands.toggleCode(),isActive:()=>t.isActive("code")||!1,disabled:!t.can().toggleCode(),icon:"Code",title:n("editor.code.tooltip"),shortcutKeys:["mod","E"]};l&&u.push(c)}return{component:tee,componentProps:{icon:"Type",tooltip:n("editor.moremark"),disabled:!t.isEditable||u.every(c=>c.disabled),items:u}}}}},addExtensions(){const t=[];return this.options.subscript!==!1&&t.push(aS.configure(this.options.subscript)),this.options.superscript!==!1&&t.push(lS.configure(this.options.superscript)),t}});var La=(t=>(t[t.max=7]="max",t[t.min=0]="min",t[t.more=1]="more",t[t.less=-1]="less",t))(La||{});function ree(t,e,n){return t<e?e:t>n?n:t}function oee(t,e,n,r){const{doc:i,selection:s}=t;if(!i||!s||!(s instanceof Ie||s instanceof An))return t;const{from:a,to:l}=s;return i.nodesBetween(a,l,(u,c)=>{const f=u.type;return n.includes(f.name)?(t=iee(t,c,e),!1):!W0(u.type.name,r.extensionManager.extensions)}),t}function iee(t,e,n){if(!t.doc)return t;const r=t.doc.nodeAt(e);if(!r)return t;const a=ree((r.attrs.indent||0)+n,0,7);if(a===r.attrs.indent)return t;const l={...r.attrs,indent:a};return t.setNodeMarkup(e,r.type,l,r.marks)}function uS({delta:t,types:e}){return({state:n,dispatch:r,editor:i})=>{const{selection:s}=n;let{tr:a}=n;return a=a.setSelection(s),a=oee(a,t,e,i),a.docChanged?(r&&r(a),!0):!1}}const see=Qe.create({name:"indent",addOptions(){return{...this.parent?.(),types:["paragraph","heading","blockquote"],minIndent:La.min,maxIndent:La.max,button({editor:t,t:e}){const{selection:n}=t.state,r=n.$anchor.parent;return[{component:Ge,componentProps:{action:()=>{t.commands.indent()},disabled:r?.attrs?.indent>=La.max||!t.can().indent(),shortcutKeys:["Tab"],icon:"IndentIncrease",tooltip:e("editor.indent.tooltip")}},{component:Ge,componentProps:{action:()=>{t.commands.outdent()},shortcutKeys:["Shift","Tab"],disabled:r?.attrs?.indent<=La.min||!t.can().outdent(),icon:"IndentDecrease",tooltip:e("editor.outdent.tooltip")}}]}}},addGlobalAttributes(){return[{types:this.options.types,attributes:{indent:{default:0,parseHTML:t=>{const e=t.getAttribute("data-indent");return(e?parseInt(e,10):0)||0},renderHTML:t=>t.indent?{"data-indent":t.indent}:{}}}}]},addCommands(){return{indent:()=>uS({delta:La.more,types:this.options.types}),outdent:()=>uS({delta:La.less,types:this.options.types})}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.indent(),"Shift-Tab":()=>this.editor.commands.outdent()}}});function aee(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:i,allowedPrefixes:s,startOfLine:a,$position:l}=t,u=r&&!i,c=AB(n),f=new RegExp(`\\s${c}$`),p=a?"^":"",m=i?"":c,g=u?new RegExp(`${p}${c}.*?(?=\\s${m}|$)`,"gm"):new RegExp(`${p}(?:^)?${c}[^\\s${m}]*`,"gm"),v=((e=l.nodeBefore)===null||e===void 0?void 0:e.isText)&&l.nodeBefore.text;if(!v)return null;const b=l.pos-v.length,w=Array.from(v.matchAll(g)).pop();if(!w||w.input===void 0||w.index===void 0)return null;const x=w.input.slice(Math.max(0,w.index-1),w.index),C=new RegExp(`^[${s?.join("")}\0]?$`).test(x);if(s!==null&&!C)return null;const E=b+w.index;let k=E+w[0].length;return u&&f.test(v.slice(k-1,k+1))&&(w[0]+=" ",k+=1),E<l.pos&&k>=l.pos?{range:{from:E,to:k},query:w[0].slice(n.length),text:w[0]}:null}const lee=new Et("suggestion");function uee({pluginKey:t=lee,editor:e,char:n="@",allowSpaces:r=!1,allowToIncludeChar:i=!1,allowedPrefixes:s=[" "],startOfLine:a=!1,decorationTag:l="span",decorationClass:u="suggestion",command:c=()=>null,items:f=()=>[],render:p=()=>({}),allow:m=()=>!0,findSuggestionMatch:g=aee}){let v;const b=p?.(),w=new ot({key:t,view(){return{update:async(x,C)=>{var E,k,T,S,A,V,O;const B=(E=this.key)===null||E===void 0?void 0:E.getState(C),F=(k=this.key)===null||k===void 0?void 0:k.getState(x.state),j=B.active&&F.active&&B.range.from!==F.range.from,Y=!B.active&&F.active,N=B.active&&!F.active,H=!Y&&!N&&B.query!==F.query,D=Y||j&&H,L=H||j,W=N||j&&H;if(!D&&!L&&!W)return;const P=W&&!D?B:F,q=x.dom.querySelector(`[data-decoration-id="${P.decorationId}"]`);v={editor:e,range:P.range,query:P.query,text:P.text,items:[],command:G=>c({editor:e,range:P.range,props:G}),decorationNode:q,clientRect:q?()=>{var G;const{decorationId:se}=(G=this.key)===null||G===void 0?void 0:G.getState(e.state),fe=x.dom.querySelector(`[data-decoration-id="${se}"]`);return fe?.getBoundingClientRect()||null}:null},D&&((T=b?.onBeforeStart)===null||T===void 0||T.call(b,v)),L&&((S=b?.onBeforeUpdate)===null||S===void 0||S.call(b,v)),(L||D)&&(v.items=await f({editor:e,query:P.query})),W&&((A=b?.onExit)===null||A===void 0||A.call(b,v)),L&&((V=b?.onUpdate)===null||V===void 0||V.call(b,v)),D&&((O=b?.onStart)===null||O===void 0||O.call(b,v))},destroy:()=>{var x;v&&((x=b?.onExit)===null||x===void 0||x.call(b,v))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(x,C,E,k){const{isEditable:T}=e,{composing:S}=e.view,{selection:A}=x,{empty:V,from:O}=A,B={...C};if(B.composing=S,T&&(V||e.view.composing)){(O<C.range.from||O>C.range.to)&&!S&&!C.composing&&(B.active=!1);const F=g({char:n,allowSpaces:r,allowToIncludeChar:i,allowedPrefixes:s,startOfLine:a,$position:A.$from}),j=`id_${Math.floor(Math.random()*4294967295)}`;F&&m({editor:e,state:k,range:F.range,isActive:C.active})?(B.active=!0,B.decorationId=C.decorationId?C.decorationId:j,B.range=F.range,B.query=F.query,B.text=F.text):B.active=!1}else B.active=!1;return B.active||(B.decorationId=null,B.range={from:0,to:0},B.query=null,B.text=null),B}},props:{handleKeyDown(x,C){var E;const{active:k,range:T}=w.getState(x.state);return k&&((E=b?.onKeyDown)===null||E===void 0?void 0:E.call(b,{view:x,event:C,range:T}))||!1},decorations(x){const{active:C,range:E,decorationId:k}=w.getState(x);return C?lt.create(x.doc,[jt.inline(E.from,E.to,{nodeName:l,class:u,"data-decoration-id":k})]):null}}});return w}const cee=[{label:"优酷",value:"youku",icon:"Youku"},{label:"哔哩哔哩",value:"bilibili",icon:"BiliBili"},{label:"腾讯视频",value:"qqvideo",icon:"QQVideo"}],dee=[{label:"高德地图",value:"amap",icon:"Gaode"},{label:"百度地图",value:"baidu_map",icon:"Baidu"}],fee=[{label:"墨刀",value:"modao",icon:"Modao"},{label:"蓝湖",value:"lanhu",icon:"Lanhu"},{label:"Figma",value:"figma",icon:"Figma"},{label:"Canva",value:"canva",icon:"Canva"},{label:"ProcessOn",value:"processon",icon:"Processon"}],pee=[{label:"CodePen",value:"codepen",icon:"Codepen"}],hee=[{label:"金数据",value:"jinshuju",icon:"Jinshuju"}],mee=[],gee=[...cee,...dee,...fee,...pee,...hee,...mee];function vee(t){const e=Oa.global.t,n=[{name:"format",title:e("editor.slash.format"),commands:[{name:"paragraph",label:e("editor.paragraph.tooltip"),aliases:["paragraph","zw"],iconName:"Paragraph",action:({editor:i,range:s})=>{i.chain().focus().deleteRange(s).setHeading({level:1}).run()}},{name:"heading1",label:e("editor.heading.h1.tooltip"),aliases:["h1","bt","bt1"],iconName:"Heading1",action:({editor:i,range:s})=>{i.chain().focus().deleteRange(s).setHeading({level:1}).run()}},{name:"heading2",label:e("editor.heading.h2.tooltip"),aliases:["h2","bt","bt2"],iconName:"Heading2",action:({editor:i,range:s})=>{i.chain().focus().deleteRange(s).setNode("heading",{level:2}).run()}},{name:"heading3",label:e("editor.heading.h3.tooltip"),aliases:["h3","bt","bt3","heading3"],iconName:"Heading3",action:({editor:i,range:s})=>{i.chain().focus().deleteRange(s).setNode("heading",{level:3}).run()}},{name:"bulletList",label:e("editor.bulletlist.tooltip"),aliases:["ul","yxlb","bulletList"],iconName:"List",action:({editor:i,range:s})=>{i.chain().focus().deleteRange(s).toggleBulletList().run()}},{name:"numberedList",label:e("editor.orderedlist.tooltip"),aliases:["ol","yxlb"],iconName:"ListOrdered",action:({editor:i,range:s})=>{i.chain().focus().deleteRange(s).toggleOrderedList().run()}},{name:"codeBlock",label:e("editor.codeblock.tooltip"),iconName:"Code2",aliases:["codeBlock"],description:"Code block with syntax highlighting",shouldBeHidden:i=>i.isActive("columns"),action:({editor:i,range:s})=>{i.chain().focus().deleteRange(s).setCodeBlock().run()}},{name:"blockquote",label:e("editor.blockquote.tooltip"),description:"插入引入格式",aliases:["yr"],iconName:"TextQuote",action:({editor:i,range:s})=>{i.chain().focus().deleteRange(s).setBlockquote().run()}},{name:"horizontalrule",label:e("editor.horizontalrule.tooltip"),aliases:["fgx","horizontalRule"],iconName:"Minus",action:({editor:i,range:s})=>{i.chain().focus().deleteRange(s).setHorizontalRule().run()}},{name:"link",label:e("editor.link.tooltip"),aliases:["link","lianjie","lj"],iconName:"Link",action:({editor:i,range:s})=>{i.chain().deleteRange(s).extendMarkRange("link").insertContent({type:"text",text:"link",marks:[{type:"link",attrs:{href:"",target:"_blank"}}]}).setLink({href:""}).focus().run()}}]},{name:"insert",title:e("editor.slash.insert"),commands:[{name:"image",label:e("editor.image.tooltip"),iconName:"ImageUp",description:"Insert a image",aliases:["image","tp","tupian"],shouldBeHidden:i=>i.isActive("columns"),action:({editor:i,range:s})=>{i.chain().focus().deleteRange(s).setImageUpload().run()}},{name:"table",label:e("editor.table.tooltip"),iconName:"Table",description:"Insert a table",aliases:["table","bg","biaoge","biao"],shouldBeHidden:i=>i.isActive("columns"),action:({editor:i,range:s})=>{i.chain().focus().deleteRange(s).insertTable({rows:3,cols:3,withHeaderRow:!1}).run()}},{name:"video",label:e("editor.video.tooltip"),iconName:"Video",description:"Insert a video",aliases:["video","sp","shipin"],shouldBeHidden:i=>i.isActive("columns"),action:({editor:i,range:s})=>{i.chain().focus().deleteRange(s).setVideoUpload().run()}},{name:"taskList",label:e("editor.tasklist.tooltip"),iconName:"ListTodo",description:"Task list with todo items",aliases:["todo"],action:({editor:i,range:s})=>{i.chain().focus().deleteRange(s).toggleTaskList().run()}},{name:"columns",label:e("editor.columns.tooltip"),iconName:"Columns2",description:"Add two column content",aliases:["columns","cols","2cols"],shouldBeHidden:i=>i.isActive("columns"),action:({editor:i,range:s})=>{i.chain().deleteRange(s).setColumns().focus(i.state.selection.head-1).run()}}]}];if(vg(t,"iframes")){const i=gee;n.push({name:"others",title:e("editor.slash.embed"),commands:i.map(s=>({name:s.value,label:s.label,iconName:s.icon,aliases:[s.value,s.label],shouldBeHidden:a=>a.isActive("columns"),action:({editor:a,range:l})=>{a.chain().deleteRange(l).focus().setIframe({src:"",service:s.value}).run()}}))})}return n}const bee={key:0,class:"grid grid-cols-1 gap-0.5 min-w-48"},yee={className:"text-neutral-500 text-[0.65rem] col-[1/-1] mx-2 mt-2 font-semibold tracking-wider select-none uppercase first:mt-0.5"},wee=["onClick"],xee=["src"],Cee={key:1,class:"p-3"},kee={class:"text-xs text-gray-800 dark:text-gray-400"},Eee=o.defineComponent({__name:"CommandsList",props:{editor:{},items:{default:void 0},command:{type:Function,default:void 0}},setup(t,{expose:e}){const n=o.ref(0),r=o.ref(0),i=o.ref(null),{t:s}=Pt(),a=o.ref([]),l=t;e({onKeyDown:u}),o.watch([()=>n.value,()=>r.value],async()=>{if(!i.value)return;await o.nextTick();const b=r.value*1e3+n.value,w=a.value[b];w&&w.scrollIntoView({behavior:"smooth",block:"nearest"})});function u({event:b}){return b.key==="ArrowUp"?(c(),!0):b.key==="ArrowDown"?(f(),!0):b.key==="Enter"?(p(),!0):!1}function c(){if(!l.items.length)return!1;let b=n.value-1,w=r.value;b<0&&(w=r.value-1,b=l.items[w]?.commands.length-1||0),w<0&&(w=l.items.length-1,b=l.items[w].commands.length-1),n.value=b,r.value=w}function f(){if(!l.items.length)return!1;const b=l.items[r.value].commands;let w=n.value+1,x=r.value;b.length-1<w&&(w=0,x=r.value+1),l.items.length-1<x&&(x=0),n.value=w,r.value=x}function p(){if(!l.items.length||r.value===-1||n.value===-1)return!1;m(r.value,n.value)}function m(b,w){const x=l.items[b].commands[w];l.command(x)}function g(b,w){m(b,w)}function v(b,w,x){a.value[b*1e3+w]=x}return(b,w)=>(o.openBlock(),o.createElementBlock("div",{ref_key:"scrollContainer",ref:i,class:"bg-white rounded-lg dark:bg-black shadow-sm border border-neutral-200 dark:border-neutral-800 text-black max-h-[min(80vh,24rem)] overflow-auto flex-wrap mb-8 p-1"},[b.items?.length?(o.openBlock(),o.createElementBlock("div",bee,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(b.items,(x,C)=>(o.openBlock(),o.createElementBlock(o.Fragment,{key:x.title},[o.createElementVNode("div",yee,o.toDisplayString(x.title),1),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(x.commands,(E,k)=>(o.openBlock(),o.createElementBlock("button",{ref_for:!0,ref:T=>v(C,k,T),key:k,class:o.normalizeClass(["flex items-center gap-3 px-2 py-1.5 text-sm text-neutral-800 dark:text-neutral-200 text-left w-full rounded-sm outline-none transition-colors",[r.value===C&&n.value===k?"bg-ed-accent text-neutral-800 dark:bg-neutral-900 dark:text-neutral-200":"hover:bg-ed-accent hover:text-neutral-800 dark:hover:bg-neutral-900 dark:hover:text-neutral-200"]]),onClick:T=>g(C,k)},[E.iconUrl?(o.openBlock(),o.createElementBlock("img",{key:0,class:"w-6 h-6",src:E.iconUrl},null,8,xee)):o.createCommentVNode("",!0),E.iconName?(o.openBlock(),o.createBlock(o.unref(Ot),{key:1,name:E.iconName,class:"mr-1 text-lg"},null,8,["name"])):o.createCommentVNode("",!0),o.createTextVNode(" "+o.toDisplayString(E.label),1)],10,wee))),128))],64))),128))])):(o.openBlock(),o.createElementBlock("div",Cee,[o.createElementVNode("span",kee,o.toDisplayString(o.unref(s)("editor.slash.empty")),1)]))],512))}}),Ra="slashCommand";let Go;const See=Qe.create({name:Ra,priority:200,onCreate(){Go=Ns("body",{interactive:!0,trigger:"manual",placement:"bottom-start",theme:"slash-command",maxWidth:"16rem",offset:[16,8],popperOptions:{strategy:"fixed",modifiers:[{name:"flip",enabled:!1}]}})},addProseMirrorPlugins(){return[uee({editor:this.editor,char:"/",allowSpaces:!0,startOfLine:!0,pluginKey:new Et(Ra),allow:({state:t,range:e})=>{const n=t.doc.resolve(e.from),r=n.depth===1,i=n.parent.type.name==="paragraph",s=n.parent.textContent?.charAt(0)==="/",a=this.editor.isActive("column"),u=!n.parent.textContent?.substring(n.parent.textContent?.indexOf("/"))?.endsWith(" ");return(r&&i&&s||a&&i&&s)&&u},command:({editor:t,range:e,props:n})=>{const{view:r}=t;n.action({editor:t,range:e}),r.focus()},items:({query:t})=>vee(this.editor).map(s=>({...s,commands:s.commands.filter(a=>{const l=a.label.toLowerCase().trim(),u=t.toLowerCase().trim();if(a.aliases){const c=a.aliases.map(m=>m.toLowerCase().trim()),f=l.match(u),p=c.some(m=>m.match(u));return f||p}return l.match(u)}).filter(a=>a.shouldBeHidden?!a.shouldBeHidden(this.editor):!0)})).filter(s=>s.commands.length>0).map(s=>({...s,commands:s.commands.map(a=>({...a,isEnabled:!0}))})),render:()=>{let t,e=null;return{onStart:n=>{t=new sx(Eee,{props:n,editor:n.editor});const{view:r}=n.editor,i=()=>{if(!n.clientRect)return n.editor.storage[Ra].rect;const s=n.clientRect();if(!s)return n.editor.storage[Ra].rect;let a=s.y;if(t.element instanceof HTMLElement&&s.top+t.element.offsetHeight+40>window.innerHeight){const l=s.top+t.element.offsetHeight-window.innerHeight+40;a=s.y-l}return new DOMRect(s.x,a,s.width,s.height)};e=()=>{Go?.[0].setProps({getReferenceClientRect:i})},r.dom.parentElement?.addEventListener("scroll",e),t.element&&Go?.[0].setProps({getReferenceClientRect:i,appendTo:()=>document.body,content:t.element}),Go?.[0].show()},onUpdate(n){t.updateProps(n);const{view:r}=n.editor,i=()=>{if(!n.clientRect)return n.editor.storage[Ra].rect;const a=n.clientRect();return a?new DOMRect(a.x,a.y,a.width,a.height):n.editor.storage[Ra].rect},s=()=>{Go?.[0].setProps({getReferenceClientRect:i})};r.dom.parentElement?.addEventListener("scroll",s),n.editor.storage[Ra].rect=n.clientRect?i():{width:0,height:0,left:0,top:0,right:0,bottom:0},Go?.[0].setProps({getReferenceClientRect:i})},onKeyDown(n){return n.event.key==="Escape"?(Go?.[0].hide(),!0):(Go?.[0].state.isShown||Go?.[0].show(),t.ref?.onKeyDown(n))},onExit(n){if(Go?.[0].hide(),e){const{view:r}=n.editor;r.dom.parentElement?.removeEventListener("scroll",e)}t.destroy()}}}})]},addStorage(){return{rect:{width:0,height:0,left:0,top:0,right:0,bottom:0}}}}),_ee=o.defineComponent({__name:"AIButton",props:{editor:{},icon:{default:void 0},title:{default:void 0},tooltip:{default:void 0},disabled:{type:Boolean,default:!1},shortcutKeys:{default:void 0},customClass:{default:""},loading:{type:Boolean,default:!1},tooltipOptions:{default:void 0},color:{default:void 0},action:{type:Function,default:void 0},isActive:{type:Function,default:void 0}},setup(t){const e=t,n=bn(),{toast:r}=qb();function i(){const s=e.editor.extensionManager.extensions.find(a=>a.name==="AI")?.options?.completions;if(typeof s!="function"){r({title:"AI completions method is not set or is not a valid function",variant:"destructive"});return}if(s.constructor.name!=="AsyncFunction"){r({title:"AI completions method must be an asynchronous function",variant:"destructive"});return}n.state.AIMenu=!0,e.editor?.commands.focus()}return(s,a)=>(o.openBlock(),o.createBlock(Ge,{action:i,title:"AI",disabled:s.disabled,icon:s.icon,tooltip:s.tooltip},null,8,["disabled","icon","tooltip"]))}}),Tee=Lt.create({name:"AI",group:"block",addOptions(){return{...this.parent?.(),toolbar:!1,button:({editor:t,t:e})=>({component:_ee,componentProps:{icon:"Sparkles",tooltip:e("editor.AI.ask")}})}}});function Aee(t,e){const n=atob(t.split(",")[1]),r=new Array(n.length);for(let s=0;s<n.length;s++)r[s]=n.charCodeAt(s);const i=new Uint8Array(r);return new Blob([i],{type:e})}function Mee(t,e){return new File([t],e,{type:t.type})}const Oee=Qe.create({name:"importWord",addOptions(){return{...this.parent?.(),upload:void 0,convert:void 0,limit:1024*1024*10,button:({editor:t,extension:e,t:n})=>({component:Ge,componentProps:{action:()=>t.commands?.toggleImportWord(),disabled:!t.can().setHorizontalRule(),icon:"Word",tooltip:n("editor.importWord.tooltip")}})}},addCommands(){return{toggleImportWord:()=>({chain:t,editor:e})=>{const{toast:n}=qb(),r=Oa.global.t;async function i(u){const f=new DOMParser().parseFromString(u,"text/html"),p=f.querySelectorAll("img");if(!p.length)return f.body.innerHTML;if(vg(e,"image")){const g=e.extensionManager.extensions.find(v=>v.name==="importWord")?.options;if(g&&typeof g.upload=="function"){const v=[];for(const w of p){const x=w.getAttribute("src"),C=Aee(x,"image/jpeg"),E=Mee(C,"image.jpeg");v.push(E)}const b=await g.upload(v);for(let w=0;w<p.length;w++){const x=p[w];x.setAttribute("src",b[w].src);const C=x.parentElement;C?.tagName==="P"&&(C.insertAdjacentElement("beforebegin",x),!C.hasChildNodes()&&C.textContent===""&&C.remove())}return f.body.innerHTML}else return console.warn("Image Upload method found, skip image conversion"),f.body.innerHTML}else return console.error("Image extension not found, unable to convert image"),f.body.innerHTML}async function s(u){const c=await i(u);e.chain().setContent(c.toString(),!0).run(),n({title:r("editor.importWord.success")})}const{open:a,onChange:l}=ct.useFileDialog({accept:".docx",reset:!0,multiple:!1});return a(),l(async u=>{const[c]=Array.from(u??[]);if(c){if(c.size>this.options.limit){n({title:r("editor.importWord.fileTooLarge"),variant:"destructive"});return}if(this.options.convert){const f=await this.options.convert(c);s(f)}else{const f=new FormData,p=JSON.stringify({collaboration_features:{comments:!0,user_id:"e3",track_changes:!0},formatting:{resets:"none",defaults:"inline",styles:"inline",comments:"basic"}});f.append("config",p),f.append("file",c),fetch("https://docx-converter.cke-cs.com/v2/convert/docx-html",{method:"POST",body:f}).then(m=>m.json()).then(async m=>{s(m.html)}).catch(m=>{n({title:r("editor.importWord.error"),variant:"destructive"}),console.error("Error:",m)})}}}),!1}}}}),Kb=bn(),Bee=Qe.create({name:"preview",addOptions(){return{...this.parent?.(),button:({t})=>({component:Ge,componentProps:{icon:"Eye",action:()=>{Kb.togglePreview()},tooltip:t("editor.preview.tooltip"),isActive:()=>Kb.state.showPreview}})}},addCommands(){return{togglePreview:()=>()=>(Kb.togglePreview(),!0)}}}),cS=bn(),Iee=(t,e,n)=>RegExp(e?t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"):t,n?"gu":"gui");function Lee(t,e,n,r){const i=[],s=[];let a=[],l=0;if(!e)return{decorationsToReturn:lt.empty,results:[]};t?.descendants((u,c)=>{u.isText?a[l]?a[l]={text:a[l].text+u.text,pos:a[l].pos}:a[l]={text:`${u.text}`,pos:c}:l+=1}),a=a.filter(Boolean);for(const u of a){const{text:c,pos:f}=u,p=Array.from(c.matchAll(e)).filter(([m])=>m.trim());for(const m of p){if(m[0]==="")break;m.index!==void 0&&s.push({from:f+m.index,to:f+m.index+m[0].length})}}for(let u=0;u<s.length;u+=1){const c=s[u],f=u===r?`${n} ${n}-current`:n,p=jt.inline(c.from,c.to,{class:f});i.push(p)}return{decorationsToReturn:lt.create(t,i),results:s}}const Ree=(t,e,{state:n,dispatch:r})=>{if(!e[0])return;const{from:s,to:a}=e[0];r&&r(n.tr.insertText(t,s,a))},Dee=(t,e,n,r)=>{const i=e+1;if(!r[i])return null;const{from:s,to:a}=r[e],l=a-s-t.length+n,{from:u,to:c}=r[i];return r[i]={to:c-l,from:u-l},[l,r]},Pee=(t,e,{tr:n,dispatch:r})=>{let i=0,s=e.slice();if(s.length){for(let a=0;a<s.length;a+=1){const{from:l,to:u}=s[a];n.insertText(t,l,u);const c=Dee(t,a,i,s);c&&(i=c[0],s=c[1])}r&&r(n)}},Vee=new Et("findAndReplacePlugin"),Fee=Qe.create({name:"findAndReplace",addOptions(){return{...this.parent?.(),searchResultClass:"vdc-editor-search-result",disableRegex:!0,button:({editor:t,extension:e,t:n})=>({component:Ge,componentProps:{icon:"DocSearch",tooltip:n("editor.findAndReplace.tooltip"),action:()=>{cS.toggleFindAndReplace()},isActive:()=>cS.state.findAndReplace}})}},addStorage(){return{searchTerm:"",replaceTerm:"",results:[],lastSearchTerm:"",caseSensitive:!1,lastCaseSensitive:!1,resultIndex:0,lastResultIndex:0}},addCommands(){return{setSearchTerm:t=>({editor:e})=>(e.storage.findAndReplace.searchTerm=t,!1),setReplaceTerm:t=>({editor:e})=>(e.storage.findAndReplace.replaceTerm=t,!1),setCaseSensitive:t=>({editor:e})=>(e.storage.findAndReplace.caseSensitive=t,!1),resetIndex:()=>({editor:t})=>(t.storage.findAndReplace.resultIndex=0,!1),nextSearchResult:()=>({editor:t})=>{const{results:e,resultIndex:n}=t.storage.findAndReplace,r=n+1;return e[r]?t.storage.findAndReplace.resultIndex=r:t.storage.findAndReplace.resultIndex=0,!1},previousSearchResult:()=>({editor:t})=>{const{results:e,resultIndex:n}=t.storage.findAndReplace,r=n-1;return e[r]?t.storage.findAndReplace.resultIndex=r:t.storage.findAndReplace.resultIndex=e.length-1,!1},replace:()=>({editor:t,state:e,dispatch:n})=>{const{replaceTerm:r,results:i}=t.storage.findAndReplace;return Ree(r,i,{state:e,dispatch:n}),!1},replaceAll:()=>({editor:t,tr:e,dispatch:n})=>{const{replaceTerm:r,results:i}=t.storage.findAndReplace;return Pee(r,i,{tr:e,dispatch:n}),!1}}},addProseMirrorPlugins(){const t=this.editor,{searchResultClass:e,disableRegex:n}=this.options,r=a=>t.storage.findAndReplace.lastSearchTerm=a,i=a=>t.storage.findAndReplace.lastCaseSensitive=a,s=a=>t.storage.findAndReplace.lastResultIndex=a;return[new ot({key:Vee,state:{init:()=>lt.empty,apply({doc:a,docChanged:l},u){const{searchTerm:c,lastSearchTerm:f,caseSensitive:p,lastCaseSensitive:m,resultIndex:g,lastResultIndex:v}=t.storage.findAndReplace;if(!l&&f===c&&m===p&&v===g)return u;if(r(c),i(p),s(g),!c)return t.storage.findAndReplace.results=[],lt.empty;const{decorationsToReturn:b,results:w}=Lee(a,Iee(c,n,p),e,g);return t.storage.findAndReplace.results=w,b}},props:{decorations(a){return this.getState(a)}}})]}}),{togglePrinter:$ee,state:Hee}=bn(),zee=Qe.create({name:"printer",addOptions(){return{...this.parent?.(),button:({t})=>({component:Ge,componentProps:{tooltip:t("editor.printer.tooltip"),action:()=>$ee(),icon:"Printer",shortcutKeys:["mod","P"],isActive:()=>Hee.printer}})}}}),Uee=async function(t){let e=[];try{if(this.enabled===!1||t.length===0||t.trim()==="")return e;if(this.limit&&t.length>this.limit)throw new Error("Text is too long");const n=await sn.post(this.getApi(),{value:t}),r=this.transfer(n.data);e=r?.map(i=>i.errorText)||[],this?.setSuggestions&&this.setSuggestions(r)}catch(n){console.error(n)}return e};class dS{suggestions=[];api="";enabled=!0;limit;transfer;constructor({api:e,limit:n,transfer:r,enabled:i}){this.suggestions=[],this.api=e,this.limit=n,this.transfer=r,this.enabled=i??!0}setSuggestions(e){this.suggestions=e}getSuggestions(e){return Promise.resolve(this.suggestions.find(n=>n.errorText.wrongWord===e)?.spellData.correctWord??[])}getApi(){return this.api}normalizeTextForLanguage(e){return e}proofreadText(e){return Promise.resolve(Uee.call(this,e))}toggleIsEnabled(){this.enabled=!this.enabled}setEnabled(e){this.enabled=e}getIsEnabled(){return this.enabled}}const Wee=Object.freeze(Object.defineProperty({__proto__:null,AI:Tee,BaseKit:sS,Blockquote:nK,Bold:y6,BulletList:Gq,Clear:uv,Code:R$,CodeBlock:ZH,Color:m5,Columns:Ib,FindAndReplace:Fee,FontFamily:EE,FontSize:l5,FormatPainter:Ob,Fullscreen:WK,Heading:Z6,Highlight:Uq,History:Pv,HorizontalRule:IK,Image:Wc,ImageUpload:iS,ImportWord:Oee,Indent:see,Italic:w6,LineHeight:TE,Link:Lv,MoreMark:nee,OrderedList:Zq,Preview:Bee,Printer:zee,Proofreader:dS,SlashCommand:See,SpellcheckerExtension:gE,Strike:C6,SubAndSuperScript:NN,Table:zb,TaskList:eK,TextAlign:Q6,Underline:x6,Video:nS,VideoUpload:tS},Symbol.toStringTag,{value:"Module"})),jee='<page id="ft6nbbxs" extend="false" pagenumber="1" force="false"><h1 id="tk6n64mj" extend="&quot;false&quot;"><strong>Introduction(English)</strong></h1><p id="s864ng1o" extend="&quot;false&quot;">MyMy Editor is open-source document editor based on Vue3 and Tiptap. MyMy Editor provides comprehensive document editing capabilities, supports pagination, supports Markdown syntax, offers basic rich text editing functions, allows for the insertion of various node types in multiple formats, provides a variety of practical tools, and supports setting page styles. It also supports exporting in various formats, printing and print preview, block-level document editing, adding custom extensions, multi-language settings, and a dark theme.</p><h1 id="jm9johtz" extend="&quot;false&quot;"><strong>소개(국문)</strong></h1><p id="0qei01hl" extend="&quot;false&quot;">마이마이 에디터는 Vue3과 Tiptap을 기반으로 한 오픈소스 문서 편집기입니다. 마이마이 에디터는 포괄적인 문서 편집 기능을 제공하며, 페이지네이션, 마크다운 구문 지원, 기본적인 리치 텍스트 편집 기능, 다양한 형식의 다양한 노드 유형 삽입, 다양한 실용적인 도구 제공, 페이지 스타일 설정 지원 등을 제공합니다. 또한 다양한 형식으로 내보내기, 인쇄 및 인쇄 미리보기, 블록 수준의 문서 편집, 사용자 지정 확장 추가, 다국어 설정 및 다크 테마를 지원합니다.마이마이 에디터는 Vue3과 Tiptap을 기반으로 한 오픈소스 문서 편집기입니다. 마이마이 에디터는 포괄적인 문서 편집 기능을 제공하며, 페이지네이션, 마크다운 구문 지원, 기본적인 리치 텍스트 편집 기능, 다양한 형식의 다양한 노드 유형 삽입, 다양한 실용적인 도구 제공, 페이지 스타일 설정 지원 등을 제공합니다. 또한 다양한 형식으로 내보내기, 인쇄 및 인쇄 미리보기, 블록 수준의 문서 편집, 사용자 지정 확장 추가, 다국어 설정 및 다크 테마를 지원합니다.</p><blockquote class="blockquote"><p id="nekf7yi0" extend="false"><span style="color: rgb(115, 209, 61)"><strong><em>Make by VDC</em></strong></span></p></blockquote></page>';function qee(){const t=window.localStorage.getItem("content"),e=o.ref(t||jee),n=o.computed(()=>[sS.configure({placeholder:{showOnlyCurrent:!0},characterCount:{limit:1e5},excludes:{}}),Pv,Ib,Ob,uv,Lv,Wc,zb]),r=ct.useEventBus(ur.RENDER_SUPER_TEXT);function i(s,a){const l={action:"status",payload:{id:s,status:a}};r.emit(l)}return{defaultExtensions:n,content:e,dispatchUpdateStatusSuperText:i}}function Kee(){const t=o.ref(!1);return{hasEverFocused:t,markAsFocused:()=>{t.value=!0},insertHtml:(r,i)=>{const{state:s}=r,{doc:a,selection:l}=s,u=l.$from,c=a.firstChild,f=r.isEmpty;if(!t.value){if(f&&c){r.chain().insertContentAt({from:0,to:c.nodeSize},i).focus().run();return}const m=a.content.size;r.chain().insertContentAt(m,i).focus().run();return}const p=u.parent;if(p.type.name==="paragraph"&&p.textContent.trim().length===0){const m=u.before();r.chain().insertContentAt({from:m,to:m+p.nodeSize},i).focus().run();return}if(u.parentOffset===0&&p.type.name==="paragraph"&&p.content.size>0){const m=u.before();r.chain().insertContentAt(m,i).focus().run();return}r.chain().insertContentAt(r.state.selection,i).focus().run()}}}function Xl(t=250){const e=o.ref(!1);let n=null;const r=()=>{e.value=!0,n&&clearTimeout(n),n=setTimeout(()=>{e.value=!1},t)};return o.onUnmounted(()=>{n&&clearTimeout(n)}),{isScrolling:e,handleScroll:r}}function Gee(){const t=o.ref(!1);let e=!1;function n(){const l=Array.from(document.querySelectorAll(".inside-toolbar")),u=document.querySelector("#tool-bar-format"),c=document.querySelector("#tool-bar-image"),f=Array.from(document.querySelectorAll('[contenteditable="true"].tiptap:not(.simple-editor)'));return{popupInsideToolbars:l,toolBarFormat:u,toolBarImage:c,tiptapEditors:f}}function r(l){if(!l)return!1;const{popupInsideToolbars:u,toolBarFormat:c,toolBarImage:f,tiptapEditors:p}=n();return u.some(m=>m.contains(l))||(c?.contains(l)??!1)||(f?.contains(l)??!1)||p.some(m=>m.contains(l))}function i(l){e=r(l.target)}function s(l){const u=l.target;u&&r(u)&&(t.value=!0)}function a(l){const u=l.relatedTarget;r(u)||e&&u===null||(t.value=!1)}return ct.useEventListener(document,"mousedown",i,{capture:!0}),ct.useEventListener(document,"touchstart",i,{capture:!0}),ct.useEventListener(document,"focusin",s),ct.useEventListener(document,"focusout",a),{isShowToolBarBaseOnEditor:t}}function Kc(){try{const{locale:t}=Pt();o.watch(t,e=>{const n=String(e);n&&Oa.global.locale.value!==n&&(Oa.global.locale.value=n)},{immediate:!0})}catch{}}const Xee={key:0,class:"p-2.5 space-y-1.5"},Yee=["innerHTML"],Jee={key:1,class:"p-2.5 space-y-1.5"},Zee=["innerHTML"],Qee={key:2,class:"p-2.5 space-y-1.5"},Nee=["innerHTML"],ete=Xr(o.defineComponent({__name:"ArticleFullViewer",props:{extensions:{},mode:{},hideComment:{type:Boolean},fieldNameComment:{},fieldNameCommentCuesheet:{},fieldNameContent:{},comment:{},commentCuesheet:{},content:{},minChars:{},fontSize:{}},setup(t){const e=t;Kc();const n=o.computed(()=>{const C=e.extensions?.filter(E=>E.name!=="spellchecker")||[];return C.some(E=>E.name==="image")||C.push(Wc.configure()),C}),r=o.computed(()=>ra(e.comment)),i=o.computed(()=>ra(e.commentCuesheet)),s=o.computed(()=>ra(e.content));function a(C){return pg(C).replace(/<script\b[\s\S]*?<\/script\s*>/gi,"")}const l=o.computed(()=>r.value?a(e.comment):""),u=o.computed(()=>i.value?a(e.commentCuesheet):""),c=o.computed(()=>s.value?a(e.content):""),f=o.ref(),p=o.ref(),m=o.ref();o.onBeforeUnmount(()=>{f.value&&f.value.destroy(),p.value&&p.value.destroy(),m.value&&m.value.destroy()});function g(C){return new Oo({extensions:n.value,content:C,editable:!1,parseOptions:{preserveWhitespace:"full"}})}o.onMounted(async()=>{!r.value&&e.comment&&(f.value=g(un(e.comment,!0,e.mode)),await o.nextTick()),!i.value&&e.commentCuesheet&&(p.value=g(un(e.commentCuesheet,!0,e.mode)),await o.nextTick()),!s.value&&e.content&&(m.value=g(un(e.content,!0,e.mode)))});function v(C,E){if(!C)return;const k=un(E,!0,e.mode);St.isEqual(C.getHTML(),k)||C.commands.setContent(k,!1,{preserveWhitespace:"full"})}o.watch(()=>e.comment,C=>{r.value||v(f.value,C)}),o.watch(()=>e.commentCuesheet,C=>{i.value||v(p.value,C)}),o.watch(()=>e.content,C=>{s.value||v(m.value,C)});const b=o.computed(()=>e.fontSize??""),{contentInner:w,measuredMinWidth:x}=pf({minChars:e.minChars,fontSize:b});return(C,E)=>{const k=YT;return o.openBlock(),o.createElementBlock("div",{ref_key:"contentInner",ref:w,style:o.normalizeStyle({minWidth:`${Number(o.unref(x))+23}px`}),class:"flex-1 border border-[#999] rounded-[3px] divide-y divide-[#999] divide-dashed overflow-y-auto"},[C.comment&&!C.hideComment?(o.openBlock(),o.createElementBlock("div",Xee,[C.fieldNameComment?.label?(o.openBlock(),o.createBlock(k,{key:0,label:C.fieldNameComment.label,"custom-class":C.fieldNameComment.customClass},null,8,["label","custom-class"])):o.createCommentVNode("",!0),o.unref(r)?(o.openBlock(),o.createElementBlock("div",{key:1,class:"ProseMirror",innerHTML:o.unref(l)},null,8,Yee)):o.unref(f)?(o.openBlock(),o.createBlock(o.unref(Yn),{key:2,editor:o.unref(f)},null,8,["editor"])):o.createCommentVNode("",!0)])):o.createCommentVNode("",!0),C.commentCuesheet&&!C.hideComment?(o.openBlock(),o.createElementBlock("div",Jee,[C.fieldNameCommentCuesheet?.label?(o.openBlock(),o.createBlock(k,{key:0,label:C.fieldNameCommentCuesheet.label,"custom-class":C.fieldNameCommentCuesheet.customClass},null,8,["label","custom-class"])):o.createCommentVNode("",!0),o.unref(i)?(o.openBlock(),o.createElementBlock("div",{key:1,class:"ProseMirror",innerHTML:o.unref(u)},null,8,Zee)):o.unref(p)?(o.openBlock(),o.createBlock(o.unref(Yn),{key:2,editor:o.unref(p)},null,8,["editor"])):o.createCommentVNode("",!0)])):o.createCommentVNode("",!0),C.content?(o.openBlock(),o.createElementBlock("div",Qee,[C.fieldNameContent?.label?(o.openBlock(),o.createBlock(k,{key:0,label:C.fieldNameContent.label,"custom-class":C.fieldNameContent.customClass},null,8,["label","custom-class"])):o.createCommentVNode("",!0),o.unref(s)?(o.openBlock(),o.createElementBlock("div",{key:1,class:"ProseMirror",innerHTML:o.unref(c)},null,8,Nee)):o.unref(m)?(o.openBlock(),o.createBlock(o.unref(Yn),{key:2,editor:o.unref(m)},null,8,["editor"])):o.createCommentVNode("",!0)])):o.createCommentVNode("",!0)],4)}}}),[["__scopeId","data-v-3357e31b"]]),wo=o.defineComponent({__name:"Separator",props:{orientation:{},decorative:{type:Boolean},asChild:{type:Boolean},as:{},class:{}},setup(t){const e=t,n=o.computed(()=>{const{class:r,...i}=e;return i});return(r,i)=>(o.openBlock(),o.createBlock(o.unref(nF),o.mergeProps(n.value,{class:o.unref(ke)("shrink-0 bg-ed-separator",e.orientation==="vertical"?"w-px h-full":"h-px w-full",e.class)}),null,16,["class"]))}}),tte={class:"flex gap-2 items-center overflow-x-auto overflow-y-hidden [&::-webkit-scrollbar]:h-1.5"},nte={class:"flex-1 flex justify-end items-center gap-x-3"},rte=o.defineComponent({__name:"Toolbar",props:{editor:{},editorComment:{},disabled:{type:Boolean,default:!1},mode:{},class:{},customClassToolbar:{},toolbarExtensionOrder:{}},setup(t){const e=o.defineAsyncComponent(()=>Promise.resolve().then(()=>QJ)),{t:n}=Pt(),r=t,i=o.inject("isEditable",o.ref(!0)),s=[rh,oh,ah,ih,ki,Lc],a=o.computed(()=>{const f=[...r.editor.extensionManager.extensions],p={[ki]:-1},m={[rh]:1,[oh]:2,[ah]:3,[ih]:4,[ki]:5,[Lc]:6},g=r.toolbarExtensionOrder??(r.mode===Te.EDITOR?p:m),v=pE(f,g);let b=[];for(const w of v){const{button:x,divider:C=!1,spacer:E=!1,toolbar:k=!0}=w.options;if(!x||!gg(x)||!k)continue;const T=x({editor:r.editor,extension:w,t:o.unref(n)});if(Array.isArray(T)){const S=T.map((A,V)=>({id:`${w.name}`,button:A,divider:V===T.length-1?C:!1,spacer:V===0?E:!1}));b=[...b,...S];continue}b.push({button:T,divider:C,spacer:E,id:`${w.name}`})}if(r.mode!==Te.EDITOR)return b.filter(w=>w.id&&s.includes(w.id));if(b=b.filter(w=>w.id!=="superText"),!i.value){b=b.map(x=>(x.button.componentProps.disabled=!0,x));const w=b.find(x=>x.id==="spellchecker");w&&(w.button.componentProps.disabled=!1)}return b}),l=f=>f.id==="spellchecker"?"!text-[#2977D9] border border-gray-300 dark:!text-white hover:!bg-gray-200 dark:hover:!bg-gray-700 rounded-none [&>div>svg]:w-[19px] [&>div>svg]:h-[19px] p-0 w-[26px] h-[26px]":f.button.componentProps.customClass,u=f=>f.id==="spellchecker"?"Spellchecker":f.button.componentProps.icon,c=o.computed(()=>r.editor?.extensionManager.extensions.find(f=>f.name==="spellchecker"));return(f,p)=>(o.openBlock(),o.createElementBlock("div",{id:"tool-bar",class:o.normalizeClass(o.unref(ke)(r.class,f.customClassToolbar))},[o.createElementVNode("div",tte,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(a.value,(m,g)=>(o.openBlock(),o.createElementBlock(o.Fragment,{key:g},[m.spacer&&g!==0?(o.openBlock(),o.createBlock(o.unref(wo),{key:0,orientation:"vertical",class:"h-[16px] mx-[10px]"})):o.createCommentVNode("",!0),(o.openBlock(),o.createBlock(o.resolveDynamicComponent(m.button.component),o.mergeProps({id:m.id,ref_for:!0},m.button.componentProps,{editor:f.editor,disabled:f.disabled||m.button.componentProps?.disabled,"custom-class":l(m),icon:u(m)}),o.createSlots({_:2},[o.renderList(m.button.componentSlots,(v,b,w)=>({name:`${b}`,fn:o.withCtx(x=>[(o.openBlock(),o.createBlock(o.resolveDynamicComponent(v),o.mergeProps({ref_for:!0},x?.props,{id:m.id}),null,16,["id"]))])}))]),1040,["id","editor","disabled","custom-class","icon"])),m.divider?(o.openBlock(),o.createBlock(o.unref(wo),{key:1,orientation:"vertical",class:"mx-2 h-auto"})):o.createCommentVNode("",!0)],64))),128)),o.createElementVNode("div",nte,[p[0]||(p[0]=o.createElementVNode("div",{id:"tool-bar-auto-save"},null,-1)),c.value?(o.openBlock(),o.createBlock(o.unref(e),{key:0,editor:f.editor,"editor-comment":f.editorComment,isEnableSpellCheckRealTime:f.editor?.extensionStorage.spellchecker.spellchecker.proofreader.enabled},null,8,["editor","editor-comment","isEnableSpellCheckRealTime"])):o.createCommentVNode("",!0)])])],2))}}),fS=(t,e)=>{const{view:n,state:{selection:{from:r}}}=t,i=document.querySelectorAll(".focus"),s=i.length,l=i[s-1];if(l&&l.getAttribute("data-type")&&l.getAttribute("data-type")===e||l&&l.classList&&l.classList.contains(e))return l;const u=n.domAtPos(r).node;let c=u;for(c.tagName||(c=u.parentElement);c&&!(c.getAttribute("data-type")&&c.getAttribute("data-type")===e)&&!c.classList.contains(e);)c=c.parentElement;return c},ote={class:"w-max px-3 py-2 transition-all border rounded-sm shadow-sm pointer-events-auto select-none border-neutral-200 dark:border-neutral-800 bg-ed-background"},ite={class:"flex items-center flex-nowrap whitespace-nowrap h-[26px] justify-start relative gap-0.5"},ste={class:"flex items-center gap-2"},ate={class:"mt-3"},pS=o.defineComponent({__name:"ImageBubbleMenu",props:{editor:{},disabled:{type:Boolean,default:!1}},setup(t){const e=t,{t:n}=Pt(),r=o.ref("100"),i=o.ref(),s=o.ref(),a=o.ref(),l=["left","center","right"],u={left:"AlignLeft",center:"AlignCenter",right:"AlignRight"},c=()=>document.body;function f(O){O?.preventDefault(),e.editor.getAttributes("image").src&&e.editor.chain().focus(void 0,{scrollIntoView:!1}).updateImage({width:i.value?`${i.value}px`:null}).run()}function p(O){const B=Math.max(0,Math.min(100,parseInt(r.value)));e.editor.chain().focus(void 0,{scrollIntoView:!1}).updateImage({width:`${B}%`}).run()}const m=o.ref(!1),g=o.ref(null),v=({editor:O})=>U0(O.view.state,"image")||m.value;function b(){const O=fS(e.editor,"node-image");return O?(g.value=O,O.getBoundingClientRect()):m.value&&g.value?g.value.getBoundingClientRect():new DOMRect(-1e3,-1e3,0,0)}function w(O){e.editor.commands.updateAttributes("image",{textAlign:O})}o.watch(r,()=>{r.value&&p()}),o.watch(()=>e.editor.getAttributes("image"),O=>{O&&(i.value=Math.round(parseFloat(O.originWidth)),s.value=Math.round(parseFloat(O.originHeight)),a.value=O.originWidth/O.originHeight)});function x(){s.value&&a.value?i.value=Math.max(30,Math.round(s.value*a.value)):i.value=null}function C(){i.value&&a.value?s.value=Math.max(20,Math.round(i.value/a.value)):s.value=null}function E(O){w(O)}function k(){const O=e.editor.getAttributes("image"),{flipX:B}=O;e.editor.chain().focus(void 0,{scrollIntoView:!1}).updateImage({flipX:!B}).run()}function T(){const O=e.editor.getAttributes("image"),{flipY:B}=O;e.editor.chain().focus(void 0,{scrollIntoView:!1}).updateImage({flipY:!B}).run()}function S(){const{state:O,dispatch:B}=e.editor.view;ol(O,B)}function A(){const{state:O,dispatch:B}=e.editor.view,{tr:F,selection:j}=O;if(!(j instanceof Re))return;const Y=j.from,N=O.doc.nodeAt(Y);if(!N)return;const D=O.doc.resolve(Y).nodeBefore;if(!D)return;const L=Y-D.nodeSize,W=F.delete(Y,Y+N.nodeSize).insert(L,N).setSelection(Re.create(F.doc,L));B(W),e.editor.commands.focus()}function V(){const{state:O,dispatch:B}=e.editor.view,{tr:F,doc:j,selection:Y}=O;if(!(Y instanceof Re))return;const N=Y.from,H=j.nodeAt(N);if(!H)return;const D=N+H.nodeSize;if(D>=j.content.size)return;const L=j.nodeAt(D);if(!L)return;const W=D+L.nodeSize-H.nodeSize,P=N+L.nodeSize,q=F.delete(N,N+H.nodeSize).insert(W,H).setSelection(Re.create(F.doc,P));B(q),e.editor.commands.focus()}return(O,B)=>{const F=Ge,j=wo,Y=Ca,N=Mc,H=ws,D=Kl,L=Bh,W=Oh,P=gs,q=ms;return o.openBlock(),o.createBlock(o.unref(Wu),{editor:O.editor,"plugin-key":"image-menus-123","should-show":v,"update-delay":0,"tippy-options":{zIndex:9999,appendTo:c,getReferenceClientRect:()=>b()}},{default:o.withCtx(()=>[o.createElementVNode("div",ote,[o.createElementVNode("div",ite,[o.createVNode(F,{tooltip:o.unref(n)("editor.image.menu.flipX"),icon:"FlipVertical",action:k},null,8,["tooltip"]),o.createVNode(F,{tooltip:o.unref(n)("editor.image.menu.flipY"),icon:"FlipHorizontal",action:T},null,8,["tooltip"]),o.createVNode(j,{orientation:"vertical",class:"mx-1 me-2 h-[16px]"}),o.createVNode(F,{tooltip:o.unref(n)("editor.image.menu.moveUp"),icon:"MoveUp",action:A,disabled:!O.editor.isEditable},null,8,["tooltip","disabled"]),o.createVNode(F,{tooltip:o.unref(n)("editor.image.menu.moveDown"),icon:"MoveDown",action:V,disabled:!O.editor.isEditable},null,8,["tooltip","disabled"]),o.createVNode(j,{orientation:"vertical",class:"mx-1 me-2 h-[16px]"}),o.createVNode(q,{open:m.value,"onUpdate:open":B[4]||(B[4]=G=>m.value=G)},{default:o.withCtx(()=>[o.createVNode(Y,null,{default:o.withCtx(()=>[o.createVNode(F,{title:o.unref(n)("editor.image.menu.size"),icon:"ImageSize"},null,8,["title"])]),_:1}),o.createVNode(P,{class:"w-84"},{default:o.withCtx(()=>[o.createElementVNode("div",ste,[o.createVNode(N,{for:"maxWidth",class:"whitespace-nowrap"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(n)("editor.image.menu.size.width")),1)]),_:1}),o.createVNode(H,{id:"maxWidth",modelValue:i.value,"onUpdate:modelValue":B[0]||(B[0]=G=>i.value=G),type:"number",class:"w-20 h-8 [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",onInput:C,onKeyup:o.withKeys(f,["enter"])},null,8,["modelValue"]),o.createVNode(N,{for:"maxWidth",class:"whitespace-nowrap"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(n)("editor.image.menu.size.height")),1)]),_:1}),o.createVNode(H,{id:"maxWidth",modelValue:s.value,"onUpdate:modelValue":B[1]||(B[1]=G=>s.value=G),type:"number",class:"w-20 h-8 [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",onInput:x,onKeyup:o.withKeys(f,["enter"])},null,8,["modelValue"])]),o.createElementVNode("div",ate,[o.createVNode(W,{"model-value":r.value,"onUpdate:modelValue":[B[2]||(B[2]=G=>r.value=G),B[3]||(B[3]=G=>{r.value=G})]},{default:o.withCtx(()=>[o.createVNode(L,null,{default:o.withCtx(()=>[(o.openBlock(),o.createElementBlock(o.Fragment,null,o.renderList(["25","50","75","100"],G=>o.createVNode(D,{key:G,value:G},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(G)+"% ",1)]),_:2},1032,["value"])),64))]),_:1})]),_:1},8,["model-value"])])]),_:1})]),_:1},8,["open"]),o.createVNode(j,{orientation:"vertical",class:"mx-1 me-2 h-[16px]"}),(o.openBlock(),o.createElementBlock(o.Fragment,null,o.renderList(l,(G,se)=>o.createVNode(F,{key:se,tooltip:o.unref(n)(`editor.textalign.${G}.tooltip`),icon:u[G],action:()=>E(G),disabled:!O.editor.can().setTextAlign(G),"is-active":()=>O.editor.isActive({textAlign:G})||!1},null,8,["tooltip","icon","action","disabled","is-active"])),64)),o.createVNode(j,{orientation:"vertical",class:"mx-1 me-2 h-[16px]"}),o.createVNode(F,{tooltip:o.unref(n)("editor.remove"),icon:"Trash2",action:S,disabled:!O.editor.isEditable},null,8,["tooltip","disabled"])])])]),_:1},8,["editor","tippy-options"])}}}),lte={class:"h-full w-fit min-w-32 flex items-center leading-none gap-0.5 p-2 bg-ed-background rounded-lg shadow-sm border border-ed-border"},Lh=o.defineComponent({__name:"TableBubbleMenu",props:{editor:{}},setup(t){const e=t,n=()=>document.body,r=({editor:w})=>w.isActive("table")&&(w.storage.table?.isTableEditorOpen??!1),{t:i}=Pt();function s(){e.editor.chain().focus().addColumnBefore().run()}function a(){e.editor.chain().focus().addColumnAfter().run()}function l(){e.editor.chain().focus().deleteColumn().run()}function u(){e.editor.chain().focus().addRowBefore().run()}function c(){e.editor.chain().focus().addRowAfter().run()}function f(){e.editor.chain().focus().deleteRow().run()}function p(){e.editor.chain().focus().mergeCells().run()}function m(){e.editor?.chain().focus().splitCell().run()}function g(){e.editor.chain().focus().deleteTable().run()}function v(w){e.editor.chain().focus().setTableCellBackground(w).run()}const b=()=>{const w=document.querySelector(".vdc-editor");if(!w)return new DOMRect(-1e3,-1e3,0,0);const x=w.getBoundingClientRect();return new DOMRect(x.left,x.top+10,x.width,0)};return(w,x)=>(o.openBlock(),o.createBlock(o.unref(Wu),{editor:w.editor,"plugin-key":"table","update-delay":0,"should-show":r,"tippy-options":{zIndex:9999,maxWidth:"auto",getReferenceClientRect:b,appendTo:n}},{default:o.withCtx(()=>[o.createElementVNode("div",lte,[o.createVNode(Ge,{icon:"TablerColumnInsertLeft","icon-class":"w-5 h-5",tooltip:o.unref(i)("editor.table.menu.insertColumnBefore"),action:s,"tooltip-options":{sideOffset:15},disabled:!w.editor?.can().addColumnBefore()},null,8,["tooltip","disabled"]),o.createVNode(Ge,{icon:"TablerColumnInsertRight",tooltip:o.unref(i)("editor.table.menu.insertColumnAfter"),"icon-class":"w-5 h-5",action:a,"tooltip-options":{sideOffset:15},disabled:!w.editor?.can().addColumnAfter()},null,8,["tooltip","disabled"]),o.createVNode(Ge,{icon:"TablerColumnRemove",action:l,"icon-class":"w-5 h-5",tooltip:o.unref(i)("editor.table.menu.deleteColumn"),"tooltip-options":{sideOffset:15},disabled:!w.editor?.can().deleteColumn()},null,8,["tooltip","disabled"]),o.createVNode(o.unref(wo),{orientation:"vertical",class:"mx-1 me-2 h-[16px]"}),o.createVNode(Ge,{icon:"TablerRowInsertTop",action:u,"icon-class":"w-5 h-5",tooltip:o.unref(i)("editor.table.menu.insertRowAbove"),"tooltip-options":{sideOffset:15},disabled:!w.editor?.can().addRowBefore()},null,8,["tooltip","disabled"]),o.createVNode(Ge,{icon:"TablerRowInsertBottom",action:c,"icon-class":"w-5 h-5",tooltip:o.unref(i)("editor.table.menu.insertRowBelow"),"tooltip-options":{sideOffset:15},disabled:!w.editor?.can().addRowAfter()},null,8,["tooltip","disabled"]),o.createVNode(Ge,{icon:"TablerRowRemove",action:f,"icon-class":"w-5 h-5",tooltip:o.unref(i)("editor.table.menu.deleteRow"),"tooltip-options":{sideOffset:15},disabled:!w.editor?.can().deleteRow()},null,8,["tooltip","disabled"]),o.createVNode(o.unref(wo),{orientation:"vertical",class:"mx-1 me-2 h-[16px]"}),o.createVNode(Ge,{icon:"TableCellsMerge",action:p,"icon-class":"w-5 h-5",tooltip:o.unref(i)("editor.table.menu.mergeCells"),"tooltip-options":{sideOffset:15},disabled:!w.editor?.can().mergeCells()},null,8,["tooltip","disabled"]),o.createVNode(Ge,{icon:"TableCellsSplit",action:m,"icon-class":"w-5 h-5",tooltip:o.unref(i)("editor.table.menu.splitCells"),"tooltip-options":{sideOffset:15},disabled:!w.editor?.can().splitCell()},null,8,["tooltip","disabled"]),o.createVNode(o.unref(wo),{orientation:"vertical",class:"mx-1 me-2 h-[16px]"}),o.createVNode(v5,{editor:w.editor,tooltip:o.unref(i)("editor.table.menu.setCellsBgColor"),action:v,"tooltip-options":{sideOffset:15}},null,8,["editor","tooltip"]),o.createVNode(Ge,{icon:"Trash2",tooltip:o.unref(i)("editor.table.menu.deleteTable"),"icon-class":"w-5 h-5",action:g,"tooltip-options":{sideOffset:15},disabled:!w.editor?.can().deleteTable()},null,8,["tooltip","disabled"])])]),_:1},8,["editor","tippy-options"]))}}),ute={class:"p-2 bg-white border rounded-lg shadow-sm dark:bg-black border-neutral-200 dark:border-neutral-800"},cte={class:"flex items-center gap-1"},Rh=o.defineComponent({__name:"ColumnsBubbleMenu",props:{editor:{},disabled:{type:Boolean,default:!1}},setup(t){const e=t,n=({editor:l})=>U0(l.view.state,"columns"),r=()=>fS(e.editor,"columns")?.getBoundingClientRect()||new DOMRect(-1e3,-1e3,0,0),i=()=>{e.editor.chain().focus().setLayout(Ba.SidebarLeft).run()},s=()=>{e.editor.chain().focus().setLayout(Ba.SidebarRight).run()},a=()=>{e.editor.chain().focus().setLayout(Ba.TwoColumn).run()};return(l,u)=>(o.openBlock(),o.createBlock(o.unref(Wu),{editor:l.editor,"plugin-key":"columns","should-show":n,"update-delay":0,"tippy-options":{offset:[0,8],popperOptions:{modifiers:[{name:"flip",enabled:!1}]},getReferenceClientRect:r,plugins:[o.unref(lL)],sticky:"popper"}},{default:o.withCtx(()=>[o.createElementVNode("div",ute,[o.createElementVNode("div",cte,[o.createVNode(Ge,{id:"panel-left",title:"ok",icon:"PanelLeft",tooltip:"tooltip",action:i,"is-active":()=>l.editor.isActive("columns",{layout:o.unref(Ba).SidebarLeft}),"tooltip-options":{sideOffset:15}},null,8,["is-active"]),o.createVNode(Ge,{id:"columns",title:"ok",icon:"Columns",tooltip:"tooltip",action:a,"is-active":()=>l.editor.isActive("columns",{layout:o.unref(Ba).TwoColumn}),"tooltip-options":{sideOffset:15}},null,8,["is-active"]),o.createVNode(Ge,{id:"panel-right",title:"ok",icon:"PanelRight",tooltip:"tooltip",action:s,"is-active":()=>l.editor.isActive("columns",{layout:o.unref(Ba).SidebarRight}),"tooltip-options":{sideOffset:15}},null,8,["is-active"])])])]),_:1},8,["editor","tippy-options"]))}}),dte={class:"flex items-center gap-2 p-2 bg-white border rounded-lg shadow-sm dark:bg-black border-neutral-200 dark:border-neutral-800"},fte=["href"],pte={class:"flex flex-nowrap"},hte=o.defineComponent({__name:"LinkViewBlock",props:{editor:{},link:{default:void 0}},emits:["clear","edit"],setup(t,{emit:e}){const{t:n}=Pt(),r=e;function i(){r("clear")}function s(){r("edit")}return(a,l)=>(o.openBlock(),o.createElementBlock("div",dte,[o.createElementVNode("a",{href:a.link,target:"_blank",rel:"noopener noreferrer",class:"text-sm underline break-all"},o.toDisplayString(o.unref(St.truncate)(a.link,{length:50,omission:"…"})),9,fte),a.link?(o.openBlock(),o.createBlock(o.unref(wo),{key:0,orientation:"vertical",class:"h-4"})):o.createCommentVNode("",!0),o.createElementVNode("div",pte,[o.createVNode(Ge,{icon:"Pencil",tooltip:o.unref(n)("editor.link.edit.tooltip"),action:s,"tooltip-options":{sideOffset:15}},null,8,["tooltip"]),o.createVNode(Ge,{icon:"Unlink",tooltip:o.unref(n)("editor.link.unlink.tooltip"),action:i,"tooltip-options":{sideOffset:15}},null,8,["tooltip"])])]))}}),Dh=o.defineComponent({__name:"LinkBubbleMenu",props:{editor:{},disabled:{type:Boolean,default:!1}},setup(t){const e=t,n=o.ref(!1),r=o.computed(()=>{const{href:l}=e.editor.getAttributes("link");return l}),i=o.computed(()=>e.editor.isActive("link"));function s(l,u,c){e.editor.chain().extendMarkRange("link").insertContent({type:"text",text:u,marks:[{type:"link",attrs:{href:l,target:c?"_blank":""}}]}).setLink({href:l}).focus().run(),n.value=!1}function a(){e.editor.chain().extendMarkRange("link").unsetLink().focus().run(),n.value=!1}return(l,u)=>o.withDirectives((o.openBlock(),o.createBlock(o.unref(Wu),{editor:l.editor,"update-delay":0,"tippy-options":{popperOptions:{modifiers:[{name:"flip",enabled:!0}]},appendTo:"parent",placement:"bottom-start",offset:[-2,16],zIndex:9999,onHidden:()=>{n.value=!1}}},{default:o.withCtx(()=>[o.createVNode(o.unref(ms),{open:n.value,"onUpdate:open":u[1]||(u[1]=c=>n.value=c)},{default:o.withCtx(()=>[o.createVNode(o.unref(uV),null,{default:o.withCtx(()=>[n.value?o.createCommentVNode("",!0):(o.openBlock(),o.createBlock(hte,{key:0,editor:l.editor,link:r.value,onClear:a,onEdit:u[0]||(u[0]=c=>n.value=!0)},null,8,["editor","link"]))]),_:1}),o.createVNode(o.unref(gs),{class:"p-0 border-0 w-fit shadow-none",align:"start",side:"bottom"},{default:o.withCtx(()=>[o.createVNode($5,{class:"p-4",editor:l.editor,onOnSetLink:s},null,8,["editor"])]),_:1})]),_:1},8,["open"])]),_:1},8,["editor","tippy-options"])),[[o.vShow,i.value]])}}),hS=(t,e,n,r,i)=>{const s=o.ref(0),a=ct.useEventBus(ur.RENDER_SUPER_TEXT),l=T=>{if(!e.value||!t)return;const S=e.value.index,A=e.value.id,{state:V}=t,{tr:O}=V;let B=!1;V.doc.descendants((F,j)=>{if(F.attrs?.[Ne.ID]===A){F.attrs[Ne.TEXT]?.trim();const Y=T.trim();if(Hc(Y))return O.delete(j,j+1),B=!0,!1;const{[Ne.ELEMENT_ID]:N,...H}=F.attrs;return O.setNodeMarkup(j,void 0,{...H,[Ne.TEXT]:Y}),B=!0,!1}return!0}),B&&t&&t.view.dispatch(O),S!==-1&&(n.value[S].text=T,n.value[S].textOriginal=T,n.value[S].hoverElementId=null)},u=o.ref(new Map),c=()=>{if(!t?.view.dom)return[];const T=[],S=t?.view.dom.querySelectorAll("[node-id]"),A=new Map;return u.value.clear(),S.forEach(V=>{const O=V.getBoundingClientRect().top;A.has(O)||A.set(O,V),u.value.set(V.getAttribute("node-id")||"unknown",0)}),T.push(...A.values()),T},f=T=>{const S=T.closest(`#${r}`);if(!S)return;const A=S.getBoundingClientRect().top,V=S?.scrollTop;return T.getBoundingClientRect().top-(A-V)},p=(T,S)=>{const A=n.value.findIndex(V=>V.id===T);A>-1&&(n.value[A].status=S)},m=T=>T.replace(/<p><\/p>/g,"<p>&nbsp;</p>"),g=()=>{if(!n.value||n.value.length===0){s.value=0,u.value.clear();return}if(!i.value||i.value.length===0)return;const T=i.value,S=new Set(n.value.map(O=>O.id)),A=T.map(O=>({isHidden:O.classList.contains("hidden"),isTruncated:O.classList.contains("super-text-truncate")}));T.forEach(O=>{O.classList.remove("hidden"),O.classList.remove("super-text-truncate")});for(const O of u.value.keys())S.has(O)||u.value.delete(O);T.forEach(O=>{const B=O.getAttribute("book-mark-id");if(!B)return;const F=O.offsetTop+O.offsetHeight,j=u.value.get(B)||0;u.value.set(B,Math.max(F,j))}),T.forEach((O,B)=>{A[B].isHidden&&O.classList.add("hidden"),A[B].isTruncated&&O.classList.add("super-text-truncate")});let V=0;for(const O of u.value.values())O>V&&(V=O);s.value=V},v=async()=>{await o.nextTick();const S=c().map(A=>{const V=A.getAttribute("node-id"),O=A.getAttribute("book-mark-content"),B=A.getAttribute("page-id"),F=A.getAttribute("page-number"),j=A.getBoundingClientRect(),Y=A.getAttribute("line-id"),N=A.getAttribute("element-id");return{position:j,text:m(O),id:V,pageId:B,pageNumber:F,visiblePosition:f(A),status:0,lineId:Y,elementId:N,hoverElementId:null,textOriginal:m(O)}});n.value=S},b=(T,S)=>{const A=T.bottom<=S.top,V=T.top>=S.bottom;return!(A||V)};async function w(){const T=i.value;if(!T||T.length===0){g();return}T.sort((S,A)=>{const V=Number(S.getAttribute("index")),O=Number(A.getAttribute("index"));return V-O}),T.forEach(S=>S.classList.remove("super-text-truncate")),T.forEach((S,A)=>{const V=S.getBoundingClientRect();T.slice(A+1).forEach(O=>{const B=O.getBoundingClientRect();b(V,B)&&S.classList.add("super-text-truncate")})}),g()}const x=async T=>{await o.nextTick();const S=t?.view.dom.querySelector(`[node-id='${T.dataId}']`),A=i.value.find(B=>{const F=B.getBoundingClientRect().top,j=S?.getBoundingClientRect().top;if(j==null)return!1;const Y=j-F;return Math.abs(Y-9)<=2});if(!A)return;const V=Number(A.getAttribute("index"));if(!T.text){A.querySelector(".super-text-lines").innerHTML=n.value[V].textOriginal,n.value[V].hoverElementId=null,i.value.forEach(B=>B.classList.remove("hidden")),w();return}n.value[V].hoverElementId=T.elementId??null,A.querySelector(".super-text-lines").innerHTML=m(T.text),A.classList.remove("super-text-truncate");const O=A.getBoundingClientRect();i.value.forEach((B,F)=>{if(F!==V){const j=B.getBoundingClientRect();b(O,j)&&B.classList.add("hidden")}}),g()},C=T=>{switch(T.action){case"hover":x(T.payload);break;case"status":p(T.payload.id,T.payload.status);break;case"render":v();break;default:console.log("There is no action")}},E=(T,S)=>{const A=T.currentTarget;A.classList.remove("super-text-truncate");const V=A.getBoundingClientRect();i.value.forEach((O,B)=>{if(B!==S){const F=O.getBoundingClientRect();b(V,F)&&O.classList.add("hidden")}}),g()},k=()=>{i.value.forEach(T=>T.classList.remove("hidden")),w()};return o.onBeforeMount(()=>{a.on(C),window.addEventListener("resize",v)}),o.onBeforeUnmount(()=>{a.off(C),window.removeEventListener("resize",v)}),o.watch(()=>n,async()=>{await o.nextTick(),w()},{deep:!0}),{onUpdate:l,hanldeTruncateSuperTexts:w,eventListener:C,handleMouseOver:E,handleMouseLeave:k,wrapperMinHeight:s}},mte=["index","book-mark-id","line-id","onMouseover"],gte=["innerHTML"],vte=Xr(o.defineComponent({__name:"SuperTextView",props:{editor:{},superPreviewCustomClass:{},minChars:{},fontSize:{},fixedWidth:{type:Boolean}},setup(t,{expose:e}){const n=t,r=o.ref([]),i=o.ref([]),s=o.ref(!1),a=o.ref(!1),l=o.ref(null),u=o.inject("isMobile",!1),c=o.inject("fontWeight",o.ref("")),f=o.computed(()=>o.unref(c)||"normal"),p=o.inject("canEditSuper",o.ref(!0)),{onUpdate:m,handleMouseOver:g,handleMouseLeave:v,wrapperMinHeight:b}=hS(n.editor,l,i,"editor-container",r),w=(S,A)=>{p.value&&(l.value={id:S.id,text:S.text,elementId:S.elementId,index:A},s.value=!0,u&&(a.value=!0))},x=S=>fd(S?n.superPreviewCustomClass?.completedSuper??"bg-black":n.superPreviewCustomClass?.unproducedSuper??"bg-red-500"),C=o.computed(()=>n.fontSize??""),E=o.computed(()=>n.fixedWidth??!1),{contentInner:k,measuredMinWidth:T}=pf({minChars:n.minChars,fontSize:C,fixed:E});return e({measuredMinWidthComment:T}),(S,A)=>{const V=Ot;return o.openBlock(),o.createElementBlock("div",{id:"super-text-view-wrapper",ref_key:"contentInner",ref:k,style:o.normalizeStyle({width:`${Number(o.unref(T))+25}px`,minHeight:`${o.unref(b)}px`}),class:o.normalizeClass(o.unref(ke)("relative border border-ed-gray-400 dark:bg-black rounded-[3px] mr-2.5",S.fixedWidth&&"overflow-hidden",S.superPreviewCustomClass?.overall??"bg-ed-gray-50"))},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(i.value,(O,B)=>(o.openBlock(),o.createElementBlock("div",{key:O.id,ref_for:!0,ref_key:"superTextRefs",ref:r,index:B,"book-mark-id":O.id,"line-id":O.lineId,class:o.normalizeClass(o.unref(ke)("super-text-view","absolute w-full px-2 translate-y-[-10px] group",{})),style:o.normalizeStyle({top:`${O.visiblePosition||O.position?.top}px`}),onMouseover:F=>o.unref(g)(F,B),onMouseleave:A[0]||(A[0]=(...F)=>o.unref(v)&&o.unref(v)(...F))},[o.createVNode(o.unref(pb),{role:"text",variant:"outline",class:o.normalizeClass(o.unref(ke)("w-full px-1 pt-0 m-0 !leading-tight rounded-sm text-white border-transparent cursor-pointer",S.fixedWidth?"whitespace-pre overflow-hidden":"wrap-anywhere whitespace-break-spaces",O.hoverElementId??O.elementId?S.superPreviewCustomClass?.completedSuper??"bg-black":S.superPreviewCustomClass?.unproducedSuper??"bg-red-500",{"cursor-default":!o.unref(p)})),onDblclick:F=>w(O,B)},{default:o.withCtx(()=>[o.createElementVNode("div",{class:"super-text-lines",style:o.normalizeStyle({fontWeight:f.value}),innerHTML:O.text},null,12,gte),o.createVNode(V,{name:"triangle",class:o.normalizeClass(["absolute top-[0.4em] rotate-90 w-3 h-3 right-0",x(O.hoverElementId??O.elementId)])},null,8,["class"])]),_:2},1032,["class","onDblclick"])],46,mte))),128)),!o.unref(u)&&l.value?(o.openBlock(),o.createBlock(Uc,{key:0,open:s.value,editor:n.editor,"super-text-init":l.value.text,"super-text-element-id":l.value.elementId,onClose:A[1]||(A[1]=O=>s.value=!1),onSave:o.unref(m)},null,8,["open","editor","super-text-init","super-text-element-id","onSave"])):o.createCommentVNode("",!0)],6)}}}),[["__scopeId","data-v-04534390"]]),bte=["index","book-mark-id","line-id","onMouseover"],yte=["innerHTML"],wte=Xr(o.defineComponent({__name:"SuperTextViewComment",props:{editor:{},disableSuperInput:{type:Boolean},superPreviewCustomClass:{},fixedWidth:{type:Boolean}},setup(t){const e=t,n=o.ref([]),r=o.ref([]),i=o.ref(!1),s=o.ref(!1),a=o.ref(null),l=o.inject("isMobile",!1),u=o.inject("fontWeight",o.ref("")),c=o.computed(()=>o.unref(u)||"normal"),f=o.inject("isEditable",o.ref(!0)),{onUpdate:p,handleMouseOver:m,handleMouseLeave:g,wrapperMinHeight:v}=hS(e.editor,a,r,"editor-container-comment",n),b=(C,E)=>{f.value&&(a.value={id:C.id,text:C.text,elementId:C.elementId,index:E},e.disableSuperInput||(i.value=!0),l&&(s.value=!0))},w=C=>fd(C?e.superPreviewCustomClass?.completedSuper??"bg-black":e.superPreviewCustomClass?.unproducedSuper??"bg-red-500"),x=o.inject("measuredMinWidthComment",0);return(C,E)=>{const k=Ot;return o.openBlock(),o.createElementBlock("div",{id:"super-text-view-wrapper",style:o.normalizeStyle({width:`${Number(o.unref(x))+25}px`,minHeight:`${o.unref(v)}px`}),class:o.normalizeClass(o.unref(ke)("relative border border-ed-gray-400 dark:bg-black rounded-[3px] mr-2.5",C.fixedWidth&&"overflow-hidden",C.superPreviewCustomClass?.overall??"bg-ed-gray-50"))},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(r.value,(T,S)=>(o.openBlock(),o.createElementBlock("div",{key:T.id,ref_for:!0,ref_key:"superTextRefs",ref:n,index:S,"book-mark-id":T.id,"line-id":T.lineId,class:o.normalizeClass(o.unref(ke)("super-text-view","absolute w-full px-2 translate-y-[-10px] group",{})),style:o.normalizeStyle({top:`${T.visiblePosition||T.position?.top}px`}),onMouseover:A=>o.unref(m)(A,S),onMouseleave:E[0]||(E[0]=(...A)=>o.unref(g)&&o.unref(g)(...A))},[o.createVNode(o.unref(pb),{role:"text",variant:"outline",class:o.normalizeClass(o.unref(ke)("w-full px-1 pt-0 m-0 !leading-tight rounded-sm text-white border-transparent cursor-pointer",C.fixedWidth?"whitespace-pre overflow-hidden":"wrap-anywhere whitespace-break-spaces",T.elementId?C.superPreviewCustomClass?.completedSuper??"bg-black":C.superPreviewCustomClass?.unproducedSuper??"bg-red-500",{"cursor-default":!o.unref(f)})),onDblclick:A=>b(T,S)},{default:o.withCtx(()=>[o.createElementVNode("div",{class:"super-text-lines",style:o.normalizeStyle({fontWeight:c.value}),innerHTML:T.text},null,12,yte),o.createVNode(k,{name:"triangle",class:o.normalizeClass(["absolute top-[0.4em] rotate-90 w-3 h-3 right-0",w(T.elementId)])},null,8,["class"])]),_:2},1032,["class","onDblclick"])],46,bte))),128)),!o.unref(l)&&a.value&&!C.disableSuperInput?(o.openBlock(),o.createBlock(Uc,{key:0,open:i.value,editor:e.editor,"super-text-init":a.value.text,"super-text-element-id":a.value.elementId,onClose:E[1]||(E[1]=T=>i.value=!1),onSave:o.unref(p)},null,8,["open","editor","super-text-init","super-text-element-id","onSave"])):o.createCommentVNode("",!0)],6)}}}),[["__scopeId","data-v-ca5d44cc"]]),mS=t=>{console.log(t),t=t.replace(/\s*style="[^"]*"/g,""),t=t.replace(/<iframe\b[\s\S]*?<\/iframe\s*>/gi,"");const e=t.match(/<!--StartFragment-->([\s\S]*?)<!--EndFragment-->/),r=(e?e[1]:t).replace(/<br\s*\/?>/gi,`
344
+ `);t.storage.deviceEnv.isMobile?bN(u,c):await yN(u,c)}catch(i){console.warn("[clipboard] copy failed",i)}})(),!0)},cutContent:()=>({editor:t})=>((async()=>{try{await t.commands.copyContent(),t.chain().focus().deleteSelection().run()}catch(e){console.warn("[clipboard] cut failed",e)}})(),!0),pasteContent:()=>({editor:t})=>((async()=>{try{t.chain().focus().run();const e=t.storage.deviceEnv.isMobile?await vN():await wN();if(!e)return;const n=new DataTransfer;if($J(e)){n.setData("text/html",e);const i=document.createElement("div");i.innerHTML=e,n.setData("text/plain",i.innerText)}else n.setData("text/plain",e);const r=new ClipboardEvent("paste",{bubbles:!0,cancelable:!0});Object.defineProperty(r,"clipboardData",{value:n}),t.view.dom.dispatchEvent(r)}catch(e){console.warn("Clipboard paste failed:",e)}})(),!0)}},onCreate(){const t=this.editor;t.hasClipboard=async()=>{try{return!!(t.storage.deviceEnv.isMobile?await gN():await navigator.clipboard.readText())}catch(e){return console.warn("[clipboard] check failed",e),!1}}}}),CN=Qe.create({name:"deviceEnv",addOptions(){return{initial:!1,specialCharModal:void 0}},addStorage(){return{isMobile:this.options.initial,specialCharModal:this.options.specialCharModal,isForceCloseBubble:!1}},addCommands(){return{setIsMobile:t=>({editor:e})=>(e.storage.deviceEnv.isMobile=t,e.storage.spellchecker?.spellchecker.setIsMobile(t),!0),setForceCloseBubble:t=>({editor:e})=>(e.storage.deviceEnv.isForceCloseBubble=t,!0),resetForceCloseBubble:()=>({editor:t})=>(t.storage.deviceEnv.isForceCloseBubble=!1,!0)}}}),Oh=o.defineComponent({__name:"Tabs",props:{defaultValue:{},orientation:{},dir:{},activationMode:{},modelValue:{},asChild:{type:Boolean},as:{}},emits:["update:modelValue"],setup(t,{emit:e}){const i=Rt(t,e);return(s,a)=>(o.openBlock(),o.createBlock(o.unref(cF),o.normalizeProps(o.guardReactiveProps(o.unref(i))),{default:o.withCtx(()=>[o.renderSlot(s.$slots,"default")]),_:3},16))}}),kN={class:"truncate"},Kl=o.defineComponent({__name:"TabsTrigger",props:{value:{},disabled:{type:Boolean},asChild:{type:Boolean},as:{},class:{}},setup(t){const e=t,n=o.computed(()=>{const{class:i,...s}=e;return s}),r=Jn(n);return(i,s)=>(o.openBlock(),o.createBlock(o.unref(pF),o.mergeProps(o.unref(r),{class:o.unref(ke)("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-ed-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ed-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-ed-background data-[state=active]:text-ed-foreground data-[state=active]:shadow-sm",e.class)}),{default:o.withCtx(()=>[o.createElementVNode("span",kN,[o.renderSlot(i.$slots,"default")])]),_:3},16,["class"]))}}),Bh=o.defineComponent({__name:"TabsList",props:{loop:{type:Boolean},asChild:{type:Boolean},as:{},class:{}},setup(t){const e=t,n=o.computed(()=>{const{class:r,...i}=e;return i});return(r,i)=>(o.openBlock(),o.createBlock(o.unref(dF),o.mergeProps(n.value,{class:o.unref(ke)("inline-flex items-center justify-center rounded-md bg-ed-muted p-1 text-ed-muted-foreground",e.class)}),{default:o.withCtx(()=>[o.renderSlot(r.$slots,"default")]),_:3},16,["class"]))}}),Ih=o.defineComponent({__name:"TabsContent",props:{value:{},forceMount:{type:Boolean},asChild:{type:Boolean},as:{},class:{}},setup(t){const e=t,n=o.computed(()=>{const{class:r,...i}=e;return i});return(r,i)=>(o.openBlock(),o.createBlock(o.unref(fF),o.mergeProps({class:o.unref(ke)("mt-2 ring-offset-ed-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ed-ring focus-visible:ring-offset-2",e.class)},n.value),{default:o.withCtx(()=>[o.renderSlot(r.$slots,"default")]),_:3},16,["class"]))}}),EN={class:"flex items-center w-full p-3 my-3 hover:bg-ed-accent border border-ed-border text-ed-muted-foreground cursor-pointer rounded-sm transition-all"},SN={key:0,class:"flex justify-center items-center gap-3 text-s"},_N={key:1,class:"flex justify-between items-center w-full"},TN={class:"flex justify-center items-center gap-3"},AN={class:"text-sm"},MN={class:"flex items-center gap-2"},ON=o.defineComponent({__name:"VideoUploader",props:{...ta},setup(t){const e=t,n=o.inject("isEditable",o.ref(!0)),r=o.ref(""),i=o.ref(!1),s=o.ref(),{t:a}=Pt();function l(p){i.value=!0;const m=p.target,g=Array.from(m?.files||[]),v=e.editor.extensionManager.extensions.find(w=>w.name==="videoUpload")?.options;if(!e.editor||e.editor.isDestroyed||g.length===0||typeof v?.upload!="function")return;const b=g[0];v.upload(b).then(w=>{e.editor.chain().setVideo({src:w}).deleteRange({from:e.getPos(),to:e.getPos()}).insertContentAt(e.getPos()+1,{type:"paragraph"}).focus().run(),i.value=!1})}function u(){e.editor.chain().setVideo({src:r.value,width:640}).deleteRange({from:e.getPos(),to:e.getPos()}).insertContentAt(e.getPos()+1,{type:"paragraph"}).focus().run()}function c(){e.deleteNode()}function f(){s.value?.click()}return(p,m)=>(o.openBlock(),o.createBlock(o.unref(ea),{as:"div","data-drag-handle":"",class:o.normalizeClass(o.unref(ke)(!o.unref(n)&&"pointer-events-none"))},{default:o.withCtx(()=>[o.createVNode(o.unref(ms),{"default-open":o.unref(n)},{default:o.withCtx(()=>[o.createVNode(o.unref(Ca),{"as-child":""},{default:o.withCtx(()=>[o.createElementVNode("div",EN,[i.value?(o.openBlock(),o.createElementBlock("div",SN,[o.createVNode(o.unref(Ot),{class:"animate-spin w-6 h-6",name:"LoaderCircle"}),o.createElementVNode("span",null,o.toDisplayString(o.unref(a)("editor.video.dialog.uploading"))+"...",1)])):(o.openBlock(),o.createElementBlock("div",_N,[o.createElementVNode("div",TN,[o.createVNode(o.unref(Ot),{name:"Video",class:"w-6 h-6"}),o.createElementVNode("span",AN,o.toDisplayString(o.unref(a)("editor.video.dialog.title")),1)]),o.createVNode(o.unref(Ot),{name:"Trash2",class:"hover:text-ed-foreground",onClick:o.withModifiers(c,["stop"])})]))])]),_:1}),o.createVNode(o.unref(gs),{"trap-focus":"",class:"w-full","on-open-auto-focus":g=>g.preventDefault()},{default:o.withCtx(()=>[o.createVNode(o.unref(Oh),{"default-value":"upload",class:"w-[300px] sm:w-[400px]","activation-mode":"manual"},{default:o.withCtx(()=>[o.createVNode(o.unref(Bh),{class:"grid w-full grid-cols-2"},{default:o.withCtx(()=>[o.createVNode(o.unref(Kl),{value:"upload"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(a)("editor.video.dialog.tab.upload")),1)]),_:1}),o.createVNode(o.unref(Kl),{value:"link",disabled:i.value},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(a)("editor.video.dialog.link")),1)]),_:1},8,["disabled"])]),_:1}),o.createVNode(o.unref(Ih),{value:"upload"},{default:o.withCtx(()=>[o.createVNode(o.unref(mn),{class:"w-full mt-1",size:"sm",disabled:i.value,onClick:f},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(a)("editor.video.dialog.tab.upload")),1)]),_:1},8,["disabled"]),o.createElementVNode("input",{ref_key:"fileInput",ref:s,type:"file",accept:"video/*",hidden:"",onChange:l},null,544)]),_:1}),o.createVNode(o.unref(Ih),{value:"link"},{default:o.withCtx(()=>[o.createElementVNode("div",MN,[o.createVNode(o.unref(ws),{modelValue:r.value,"onUpdate:modelValue":m[0]||(m[0]=g=>r.value=g),type:"url",autofocus:"",required:"",placeholder:o.unref(a)("editor.video.dialog.placeholder")},null,8,["modelValue","placeholder"]),o.createVNode(o.unref(mn),{onClick:u},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(a)("editor.video.dialog.button.apply")),1)]),_:1})])]),_:1})]),_:1})]),_:1},8,["on-open-auto-focus"])]),_:1},8,["default-open"])]),_:1},8,["class"]))}}),tS=Lt.create({name:Bc,isolating:!0,defining:!0,group:"block",draggable:!0,selectable:!1,inline:!1,parseHTML(){return[{tag:`div[data-type="${this.name}"]`}]},renderHTML(){return["div",{"data-type":this.name}]},addCommands(){return{setVideoUpload:()=>({commands:t})=>t.insertContent(`<div data-type="${this.name}"></div>`)}},addNodeView(){return na(ON)},addOptions(){return{...this.parent?.(),upload:()=>Promise.reject("link video not found"),button:({editor:t,t:e})=>({component:Ge,componentProps:{action:()=>t.commands.setVideoUpload(),isActive:()=>t.isActive("video")||!1,disabled:!t.can().setVideo?.({}),icon:"Video",tooltip:e("editor.video.tooltip")}})}}});function BN(t){return t=t.replace("https://youtu.be/","https://www.youtube.com/watch?v=").replace("watch?v=","embed/"),t=t.replace("https://vimeo.com/","https://player.vimeo.com/video/"),/^https?:\/\/www.bilibili.com\/video\/.*/i.test(t)&&(t=t.replace(/\?.*$/i,"").replace("https://www.bilibili.com/video/","https://player.bilibili.com/player.html?bvid=")),t.includes("drive.google.com")&&(t=t.replace("/view","/preview")),t}function IN(t){return t?t.includes("youtube.com/embed")||t.includes("player.vimeo.com")||t.includes("player.bilibili.com")||t.includes("drive.google.com"):!1}const nS=Lt.create({name:"video",group:"block",atom:!0,draggable:!0,addOptions(){return{divider:!1,spacer:!1,allowFullscreen:!0,upload:void 0,width:cf["size-medium"],controls:!0,autoplay:!1,HTMLAttributes:{class:"iframe-wrapper",style:"display: flex;justify-content: center;"}}},addAttributes(){return{src:{default:null,renderHTML:({src:t})=>({src:t?BN(t):null})},width:{default:this.options.width,renderHTML:({width:t})=>({width:Yt(t)})},allowfullscreen:{default:this.options.allowFullscreen,parseHTML:()=>this.options.allowFullscreen},controls:{default:this.options.controls}}},parseHTML(){return[{tag:"video"},{tag:"iframe"}]},renderHTML({HTMLAttributes:t}){const{src:e,width:n,controls:r,allowfullscreen:i}=t??{},s=`max-width: ${Yt(n)};`;return IN(e)?["iframe",{src:e,style:s,...i&&{allowfullscreen:i}}]:["video",{src:e?e.replace(/\\/g,"/"):"",style:s,...r&&{controls:r}}]},addCommands(){return{setVideo:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t}),updateVideo:t=>({commands:e})=>e.updateAttributes(this.name,t)}}}),Gl=new Et("upload-image"),LN=()=>new ot({key:Gl,state:{init(){return lt.empty},apply(t,e){e=e.map(t.mapping,t.doc);const n=t.getMeta(Gl);if(n?.add){const r=n.add.map(({id:i,pos:s,src:a})=>{const l=RN(a);return jt.widget(s,l,{id:i,side:-1})});e=e.add(t.doc,r)}return n?.remove&&n.remove.forEach(r=>{e=e.remove(e.find(void 0,void 0,i=>i.id===r))}),e}},props:{decorations(t){return this.getState(t)}}});function RN(t){const e=document.createElement("div"),n=document.createElement("img");return n.setAttribute("class","opacity-50"),n.src=t,n.onload=()=>{e.setAttribute("class","img-placeholder")},e.appendChild(n),e}function DN(t,e){const r=Gl.getState(t).find(void 0,void 0,i=>i.id===e);return r.length?r[0]?.from:null}const rS=({validateFn:t,onUpload:e})=>async(n,r,i)=>{const s=[];for(const a of n){if(t&&!t(a))continue;const l=$r(6),u=URL.createObjectURL(a);s.push({file:a,id:l,preview:u})}s.length!==0&&(r.dispatch(r.state.tr.setMeta(Gl,{add:s.map(({id:a,preview:l})=>({id:a,pos:i,src:l}))})),await Promise.all(s.map(async({file:a,id:l,preview:u})=>{try{const c=await e(a),f=DN(r.state,l);if(f===null)return;const{schema:p}=r.state,m=typeof c=="object"?u:c,g=p.nodes.image?.create({src:m}),v=p.nodes.paragraph?.create();if(!g||!v)return;r.dispatch(r.state.tr.replaceWith(f,f,g).insert(f+g.nodeSize,v).setMeta(Gl,{remove:[l]}))}catch{r.dispatch(r.state.tr.setMeta(Gl,{remove:[l]}))}})))},PN=(t,e,n)=>{const r=Array.from(e.clipboardData?.files||[]);if(r.length){e.preventDefault();const i=t.state.selection.from;return n(r,t,i+1),!0}return!1},VN=(t,e,n,r)=>{const i=Array.from(e.dataTransfer?.files||[]);if(!n&&i.length){e.preventDefault();const s=t.posAtCoords({left:e.clientX,top:e.clientY});if(s)return r(i,t,s.pos+1),!0}return!1},FN={class:"flex items-center w-full p-3 my-3 transition-all border rounded-sm cursor-pointer hover:bg-ed-accent border-ed-border text-ed-muted-foreground"},$N={class:"flex items-center justify-between w-full"},HN={class:"flex items-center justify-center gap-3"},zN={class:"text-sm"},UN={class:"flex items-center gap-2"},WN=o.defineComponent({__name:"ImageUploader",props:{...ta},setup(t){const e=t,n=o.ref(""),r=o.ref(),{t:i}=Pt(),s=o.inject("isEditable",o.ref(!0));function a(f){const p=f?.target?.files;if(!e.editor||e.editor.isDestroyed||p.length===0)return;const m=Array.from(p),g=e.editor.extensionManager.extensions.find(b=>b.name==="imageUpload")?.options;rS({validateFn:b=>!0,onUpload:g.upload})(m,e.editor.view,e.getPos(),e.node.attrs.id)}function l(){e.editor.chain().setImage({src:n.value}).deleteRange({from:e.getPos(),to:e.getPos()}).insertContentAt(e.getPos()+1,{type:"paragraph"}).focus().run()}function u(){e.deleteNode()}function c(){r.value?.click()}return(f,p)=>(o.openBlock(),o.createBlock(o.unref(ea),{id:f.node.attrs.id,"data-drag-handle":"",class:o.normalizeClass(o.unref(ke)(!o.unref(s)&&"pointer-events-none"))},{default:o.withCtx(()=>[o.createVNode(o.unref(ms),{"default-open":o.unref(s)},{default:o.withCtx(()=>[o.createVNode(o.unref(Ca),{"as-child":""},{default:o.withCtx(()=>[o.createElementVNode("div",FN,[o.createElementVNode("div",$N,[o.createElementVNode("div",HN,[o.createVNode(o.unref(Ot),{name:"ImageUp",class:"w-6 h-6"}),o.createElementVNode("span",zN,o.toDisplayString(o.unref(i)("editor.image.dialog.title")),1)]),o.createVNode(o.unref(Ot),{name:"Trash2",class:"hover:text-ed-foreground",onClick:o.withModifiers(u,["stop"])})])])]),_:1}),o.createVNode(o.unref(gs),{"trap-focus":"",class:"w-full","on-open-auto-focus":m=>m.preventDefault()},{default:o.withCtx(()=>[o.createVNode(o.unref(Oh),{"default-value":"upload",class:"w-[300px] sm:w-[400px]","activation-mode":"manual"},{default:o.withCtx(()=>[o.createVNode(o.unref(Bh),{class:"grid w-full grid-cols-2"},{default:o.withCtx(()=>[o.createVNode(o.unref(Kl),{value:"upload"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(i)("editor.image.dialog.tab.upload")),1)]),_:1}),o.createVNode(o.unref(Kl),{value:"link"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(i)("editor.image.dialog.tab.url")),1)]),_:1})]),_:1}),o.createVNode(o.unref(Ih),{value:"upload"},{default:o.withCtx(()=>[o.createVNode(o.unref(mn),{class:"w-full mt-1",size:"sm",onClick:c},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(i)("editor.image.dialog.tab.upload")),1)]),_:1}),o.createElementVNode("input",{ref_key:"fileInput",ref:r,type:"file",accept:"image/*",multiple:"",hidden:"",onChange:a},null,544)]),_:1}),o.createVNode(o.unref(Ih),{value:"link"},{default:o.withCtx(()=>[o.createElementVNode("div",UN,[o.createVNode(o.unref(ws),{modelValue:n.value,"onUpdate:modelValue":p[0]||(p[0]=m=>n.value=m),type:"url",autofocus:"",required:"",placeholder:o.unref(i)("editor.image.dialog.placeholder")},null,8,["modelValue","placeholder"]),o.createVNode(o.unref(mn),{onClick:l},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(i)("editor.image.dialog.button.apply")),1)]),_:1})])]),_:1})]),_:1})]),_:1},8,["on-open-auto-focus"])]),_:1},8,["default-open"])]),_:1},8,["id","class"]))}}),jN=1,qN=1e6,Ei={ADD_TOAST:"ADD_TOAST",UPDATE_TOAST:"UPDATE_TOAST",DISMISS_TOAST:"DISMISS_TOAST",REMOVE_TOAST:"REMOVE_TOAST"};let Wb=0;function KN(){return Wb=(Wb+1)%Number.MAX_VALUE,Wb.toString()}const jb=new Map;function oS(t){if(jb.has(t))return;const e=setTimeout(()=>{jb.delete(t),qc({type:Ei.REMOVE_TOAST,toastId:t})},qN);jb.set(t,e)}const yo=o.ref({toasts:[]});function qc(t){switch(t.type){case Ei.ADD_TOAST:yo.value.toasts=[t.toast,...yo.value.toasts].slice(0,jN);break;case Ei.UPDATE_TOAST:yo.value.toasts=yo.value.toasts.map(e=>e.id===t.toast.id?{...e,...t.toast}:e);break;case Ei.DISMISS_TOAST:{const{toastId:e}=t;e?oS(e):yo.value.toasts.forEach(n=>{oS(n.id)}),yo.value.toasts=yo.value.toasts.map(n=>n.id===e||e===void 0?{...n,open:!1}:n);break}case Ei.REMOVE_TOAST:t.toastId===void 0?yo.value.toasts=[]:yo.value.toasts=yo.value.toasts.filter(e=>e.id!==t.toastId);break}}function qb(){return{toasts:o.computed(()=>yo.value.toasts),toast:GN,dismiss:t=>qc({type:Ei.DISMISS_TOAST,toastId:t})}}function GN(t){const e=KN(),n=i=>qc({type:Ei.UPDATE_TOAST,toast:{...i,id:e}}),r=()=>qc({type:Ei.DISMISS_TOAST,toastId:e});return qc({type:Ei.ADD_TOAST,toast:{...t,id:e,open:!0,onOpenChange:i=>{i||r()}}}),{id:e,dismiss:r,update:n}}const XN={acceptMimes:["image/jpeg","image/gif","image/png","image/jpg"],maxSize:1024*1024*5},YN=t=>`${(t/1024/1024).toFixed(2)}MB`,iS=Lt.create({name:Ci,isolating:!0,defining:!0,group:"block",draggable:!1,selectable:!1,inline:!1,onCreate(){if(typeof this.options.upload!="function")throw new Error("Image upload function should be a function")},parseHTML(){return[{tag:`div[data-type="${this.name}"]`}]},renderHTML(){return["div",{"data-type":this.name}]},addAttributes(){return{id:{default:$r(6),parseHTML:t=>t.getAttribute("id"),renderHTML:t=>t.id?{id:t.id}:{}}}},addCommands(){return{setImageUpload:()=>({commands:t})=>t.insertContent(`<div data-type="${this.name}"></div>`)}},addNodeView(){return na(WN)},addOptions(){return{...XN,...this.parent?.(),upload:()=>Promise.reject("Image Upload Function"),button:({editor:t,extension:e,t:n})=>({component:Ge,componentProps:{action:()=>t.commands.setImageUpload(),disabled:!t.can().setImage?.({}),icon:"ImageUp",tooltip:n("editor.image.tooltip")}})}},addProseMirrorPlugins(){const{toast:t}=qb(),e=Oa.global.t,r=rS({validateFn:i=>this.options.acceptMimes.includes(i.type)?i.size>this.options.maxSize?(t({description:`${e("editor.imageUpload.fileSizeTooBig")} ${YN(this.options.maxSize)}.`,duration:2e3}),!1):!0:(t({description:e("editor.imageUpload.fileTypeNotSupported"),duration:2e3}),!1),onUpload:this.options.upload});return[new ot({props:{handlePaste:(i,s)=>!s.clipboardData||Array.from(s.clipboardData.items||[]).some(l=>l.type==="text/html")?!1:PN(i,s,r),handleDrop:(i,s,a,l)=>!(s instanceof DragEvent)||!s.dataTransfer||!Array.from(s.dataTransfer.files||[]).some(f=>this.options.acceptMimes.includes(f.type))?!1:VN(i,s,l,r)}}),LN()]}}),JN=Qe.create({name:"searchHighlight",addGlobalAttributes(){return[{types:["textStyle"],attributes:{searchHighlight:{default:null,parseHTML:t=>{const e=t,n=e.style.color,r=e.style.backgroundColor;return!n||!r?null:{color:n,backgroundColor:r}},renderHTML:t=>{if(!t.searchHighlight)return{};const{color:e,backgroundColor:n}=t.searchHighlight;return{style:`color: ${e}; background-color: ${n}`}}}}}]}}),ZN=o.defineComponent({__name:"SpecialCharacterButton",props:{editor:p4},setup(t){const e=t,{t:n}=Pt(),r=bn(),i=o.computed(()=>e.editor?.storage.specialCharacter.specialCharModal),s=o.ref(!1);let a=null;function l(){const p=document.activeElement;if(p instanceof HTMLInputElement){a={type:"input",el:p};return}r.editorFocusedInstance.value&&(a={type:"editor"})}const u=()=>{if(!i.value||!i.value.component){console.error("Please configure specialCharModal!");return}s.value=!s.value};document.addEventListener("focusin",p=>{if(!s.value)return;const m=p.target;if(m instanceof HTMLInputElement){a={type:"input",el:m};return}r.editorFocusedInstance.value?.view?.dom?.contains(m)&&(a={type:"editor"})});function c(p,m){const g=p.selectionStart??p.value.length,v=p.selectionEnd??p.value.length;p.value=p.value.slice(0,g)+m+p.value.slice(v);const b=g+m.length;p.setSelectionRange(b,b),p.dispatchEvent(new Event("input",{bubbles:!0})),p.focus()}const f=(p,m)=>{if(m){if(a?.type==="input"){c(a.el,p);return}if(a?.type==="editor"){const g=r.editorFocusedInstance.value;if(!g)return;const{view:v}=g,{from:b}=v.state.selection;g.commands.insertContentAt(b,p),g.commands.focus()}}};return(p,m)=>{const g=da,v=is,b=ca,w=fa;return o.openBlock(),o.createBlock(w,null,{default:o.withCtx(()=>[o.createVNode(b,{"delay-duration":0},{default:o.withCtx(()=>[o.createVNode(g,null,{default:o.withCtx(()=>[o.createVNode(mn,{class:"text-[#65558F] hover:bg-[#ECE6F0]/90 text-xs rounded-none font-normal h-[26px] px-3 border border-gray-300 bg-ed-gray-50 dark:bg-black dark:text-white dark:hover:bg-gray-700 transition-all",onPointerdown:l,onClick:u},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(n)("editor.insert.symbol")),1)]),_:1})]),_:1}),o.createVNode(v,null,{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(n)("editor.insert.symbol")),1)]),_:1})]),_:1}),(o.openBlock(),o.createBlock(o.Teleport,{to:"body"},[o.unref(s)?(o.openBlock(),o.createBlock(o.resolveDynamicComponent(o.unref(i).component),o.mergeProps({key:0},o.unref(i).props,{"custom-class":"!z-[70] !pointer-events-auto",onClose:m[0]||(m[0]=x=>s.value=!1),onSelectedChar:f}),null,16)):o.createCommentVNode("",!0)]))]),_:1})}}}),QN=Qe.create({name:ah,addOptions(){return{button:({editor:t})=>({component:ZN,componentProps:{editor:t}}),specialCharModal:void 0}},addStorage(){return{specialCharModal:this.options.specialCharModal}}}),sS=Qe.create({name:"base-kit",addOptions(){return{...this.parent?.(),timeHighlighter:{additionalTimeWords:[]},bubble:{list:bL,defaultBubbleList:sG,button:({editor:t,extension:e,t:n})=>{const{list:r={},defaultBubbleList:i}=e.options?.bubble??{},s=i?.(t)??[];return aG(r,s,{editor:t,extension:e,t:n})}}}},addExtensions(){const t=Oa.global.t,e=[];this.options.placeholder!==!1&&e.push(Y5.configure({placeholder:({node:n,pos:r})=>{const i=n?.type?.name;return i==="heading"?`${t(`editor.heading.h${n.attrs.level}.tooltip`)}`:i==="table"||i==="codeBlock"?"":r===0?t("editor.content"):""},...this.options.placeholder})),this.options.focus!==!1&&e.push(XK.configure({className:"focus",...this.options.focus})),this.options.document!==!1&&(this.options.page?(e.push(Q5.configure().extend({content:"page+"})),e.push(mZ.configure({types:this.options.page?.nodesComputedOption?.types??[],slots:o.useSlots()}))):e.push(Q5.configure())),this.options.dropcursor!==!1&&e.push(GK.configure({...this.options.dropcursor,width:2,class:"ProseMirror-dropcursor border-black"})),this.options.characterCount!==!1&&e.push(jK.configure(this.options.characterCount)),this.options.paragraph!==!1&&e.push(X5.configure(this.options.paragraph)),this.options.hardBreak!==!1&&e.push(G5.configure(this.options.hardBreak)),this.options.listItem!==!1&&e.push(rG.configure(this.options.listItem)),this.options.textStyle!==!1&&e.push(oG.configure(this.options.textStyle)),this.options.imageUpload!==!1&&e.push(iS.configure(this.options.imageUpload)),this.options.video!==!1&&e.push(nS.configure(this.options.video)),this.options.videoUpload!==!1&&e.push(tS.configure(this.options.videoUpload)),this.options.history!==!1&&e.push(Pv.configure(this.options.history)),this.options.fontFamily!==!1&&e.push(EE.configure(this.options.fontFamily)),this.options.fontSize!==!1&&e.push(l5.configure(this.options.fontSize)),this.options.fontWeight!==!1&&e.push(yZ.configure(this.options.fontWeight)),this.options.mode!==Te.EDITOR&&e.push(QN.configure(this.options.specialCharacter)),this.options.mode!==Te.EDITOR&&e.push(kZ),this.options.superText!==!1&&this.options.mode!==Te.PLAIN_TEXT&&this.options.mode!==Te.EDITOR&&(typeof this.options.superText=="boolean"?e.push(cE.configure()):e.push(cE.configure(this.options.superText))),this.options.mode===Te.EDITOR&&(this.options.image!==!1&&e.push(Wc.configure()),e.push(Z6.configure({spacer:!0}),w6,y6,x6,Lv,zb,C6,m5.configure({spacer:!0}),Q6.configure({types:["heading","paragraph","tableCell","tableHeader"],spacer:!0}),TE)),this.options.mode!==Te.EDITOR&&this.options.configPlan!==!1&&this.options.mode!==Te.PLAIN_TEXT&&(typeof this.options.configPlan=="boolean"?e.push(ME.configure()):e.push(ME.configure({specialCharModal:this.options.configPlan?.specialCharModal}))),this.options.mode!==Te.EDITOR&&this.options.mode!==Te.PLAIN_TEXT&&e.push(SZ),(this.options.mode===Te.STRAIGHT||this.options.mode===Te.REPORT||this.options.mode===Te.EDITOR)&&this.options.timeHighlighter&&e.push(mN.configure(this.options.timeHighlighter)),this.options.invalidCharFocus!==!1&&e.push(bE.configure(this.options.invalidCharFocus)),this.options.disabled&&e.push(JN),e.push(N5,J5.configure(),pN.configure(),nG.configure(),Ib,Ob,uv,xN,CN.configure(this.options.deviceEnv),g5.configure({multicolor:!0}));for(const n in this.options.excludes)Object.prototype.hasOwnProperty.call(this.options.excludes,n)&&this.options.excludes[n]&&St.remove(e,({name:i})=>i===n);return e},addStorage(){return{mode:this.options.mode}}}),aS=Fn.create({name:"subscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sub"},{style:"vertical-align",getAttrs(t){return t!=="sub"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sub",wt(this.options.HTMLAttributes,t),0]},addCommands(){return{setSubscript:()=>({commands:t})=>t.setMark(this.name),toggleSubscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSubscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}}),lS=Fn.create({name:"superscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs(t){return t!=="super"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sup",wt(this.options.HTMLAttributes,t),0]},addCommands(){return{setSuperscript:()=>({commands:t})=>t.setMark(this.name),toggleSuperscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSuperscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-.":()=>this.editor.commands.toggleSuperscript()}}}),NN=Qe.create({name:"subAndSuperScript",addOptions(){return{...this.parent?.(),button:({editor:t,extension:e,t:n})=>{const r=e.options.subscript,i=e.options.superscript,s={component:Ge,componentProps:{action:()=>t.commands.toggleSubscript(),isActive:()=>t.isActive("subscript")||!1,disabled:!t.can().toggleSubscript(),icon:"Subscript",tooltip:n("editor.subscript.tooltip")}},a={component:Ge,componentProps:{action:()=>t.commands.toggleSuperscript(),isActive:()=>t.isActive("superscript")||!1,disabled:!t.can().toggleSuperscript(),icon:"Superscript",tooltip:n("editor.superscript.tooltip")}},l=[];return r!==!1&&l.push(s),i!==!1&&l.push(a),l}}},addExtensions(){const t=[];return this.options.subscript!==!1&&t.push(aS.configure(this.options.subscript)),this.options.superscript!==!1&&t.push(lS.configure(this.options.superscript)),t}}),eee={class:"ml-1"},tee=o.defineComponent({__name:"ActionMoreButton",props:{editor:{},disabled:{type:Boolean,default:!1},color:{default:void 0},maxHeight:{default:void 0},icon:{default:void 0},tooltip:{default:""},items:{default:()=>[]}},setup(t){const e=t,n=o.computed(()=>{const r=e.items.find(s=>s.isActive());return r&&!r.default?{...r,icon:r.icon?r.icon:e.icon}:{title:e.tooltip,icon:e.icon,isActive:()=>!1}});return(r,i)=>(o.openBlock(),o.createBlock(ga,{icon:r.icon,tooltip:r.tooltip,disabled:r.disabled},{default:o.withCtx(()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(e.items,(s,a)=>(o.openBlock(),o.createBlock(o.unref(Ml),{key:a,checked:n.value.title===s.title,disabled:s.disabled,class:"flex gap-3 items-center",onClick:s.action},{default:o.withCtx(()=>[s.icon?(o.openBlock(),o.createBlock(o.unref(Ot),{key:0,name:s.icon},null,8,["name"])):o.createCommentVNode("",!0),o.createElementVNode("span",eee,o.toDisplayString(s.title),1),s.shortcutKeys?(o.openBlock(),o.createBlock(o.unref(Y6),{key:1,class:"ml-auto"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(_x)(s.shortcutKeys)),1)]),_:2},1024)):o.createCommentVNode("",!0)]),_:2},1032,["checked","disabled","onClick"]))),128))]),_:1},8,["icon","tooltip","disabled"]))}}),nee=Qe.create({name:"moreMark",addOptions(){return{...this.parent?.(),button({editor:t,extension:e,t:n}){const r=e.options.subscript,i=e.options.superscript,s={action:()=>t.commands.toggleSubscript(),isActive:()=>t.isActive("subscript")||!1,disabled:!t.can().toggleSubscript(),icon:"Subscript",title:n("editor.subscript.tooltip"),shortcutKeys:["mod","."]},a={action:()=>t.commands.toggleSuperscript(),isActive:()=>t.isActive("superscript")||!1,disabled:!t.can().toggleSuperscript(),icon:"Superscript",title:n("editor.superscript.tooltip"),shortcutKeys:["mod",","]},l=vg(t,"code"),u=[];if(r!==!1&&u.push(s),i!==!1&&u.push(a),l){const c={action:()=>t.commands.toggleCode(),isActive:()=>t.isActive("code")||!1,disabled:!t.can().toggleCode(),icon:"Code",title:n("editor.code.tooltip"),shortcutKeys:["mod","E"]};l&&u.push(c)}return{component:tee,componentProps:{icon:"Type",tooltip:n("editor.moremark"),disabled:!t.isEditable||u.every(c=>c.disabled),items:u}}}}},addExtensions(){const t=[];return this.options.subscript!==!1&&t.push(aS.configure(this.options.subscript)),this.options.superscript!==!1&&t.push(lS.configure(this.options.superscript)),t}});var La=(t=>(t[t.max=7]="max",t[t.min=0]="min",t[t.more=1]="more",t[t.less=-1]="less",t))(La||{});function ree(t,e,n){return t<e?e:t>n?n:t}function oee(t,e,n,r){const{doc:i,selection:s}=t;if(!i||!s||!(s instanceof Ie||s instanceof An))return t;const{from:a,to:l}=s;return i.nodesBetween(a,l,(u,c)=>{const f=u.type;return n.includes(f.name)?(t=iee(t,c,e),!1):!W0(u.type.name,r.extensionManager.extensions)}),t}function iee(t,e,n){if(!t.doc)return t;const r=t.doc.nodeAt(e);if(!r)return t;const a=ree((r.attrs.indent||0)+n,0,7);if(a===r.attrs.indent)return t;const l={...r.attrs,indent:a};return t.setNodeMarkup(e,r.type,l,r.marks)}function uS({delta:t,types:e}){return({state:n,dispatch:r,editor:i})=>{const{selection:s}=n;let{tr:a}=n;return a=a.setSelection(s),a=oee(a,t,e,i),a.docChanged?(r&&r(a),!0):!1}}const see=Qe.create({name:"indent",addOptions(){return{...this.parent?.(),types:["paragraph","heading","blockquote"],minIndent:La.min,maxIndent:La.max,button({editor:t,t:e}){const{selection:n}=t.state,r=n.$anchor.parent;return[{component:Ge,componentProps:{action:()=>{t.commands.indent()},disabled:r?.attrs?.indent>=La.max||!t.can().indent(),shortcutKeys:["Tab"],icon:"IndentIncrease",tooltip:e("editor.indent.tooltip")}},{component:Ge,componentProps:{action:()=>{t.commands.outdent()},shortcutKeys:["Shift","Tab"],disabled:r?.attrs?.indent<=La.min||!t.can().outdent(),icon:"IndentDecrease",tooltip:e("editor.outdent.tooltip")}}]}}},addGlobalAttributes(){return[{types:this.options.types,attributes:{indent:{default:0,parseHTML:t=>{const e=t.getAttribute("data-indent");return(e?parseInt(e,10):0)||0},renderHTML:t=>t.indent?{"data-indent":t.indent}:{}}}}]},addCommands(){return{indent:()=>uS({delta:La.more,types:this.options.types}),outdent:()=>uS({delta:La.less,types:this.options.types})}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.indent(),"Shift-Tab":()=>this.editor.commands.outdent()}}});function aee(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:i,allowedPrefixes:s,startOfLine:a,$position:l}=t,u=r&&!i,c=AB(n),f=new RegExp(`\\s${c}$`),p=a?"^":"",m=i?"":c,g=u?new RegExp(`${p}${c}.*?(?=\\s${m}|$)`,"gm"):new RegExp(`${p}(?:^)?${c}[^\\s${m}]*`,"gm"),v=((e=l.nodeBefore)===null||e===void 0?void 0:e.isText)&&l.nodeBefore.text;if(!v)return null;const b=l.pos-v.length,w=Array.from(v.matchAll(g)).pop();if(!w||w.input===void 0||w.index===void 0)return null;const x=w.input.slice(Math.max(0,w.index-1),w.index),C=new RegExp(`^[${s?.join("")}\0]?$`).test(x);if(s!==null&&!C)return null;const E=b+w.index;let k=E+w[0].length;return u&&f.test(v.slice(k-1,k+1))&&(w[0]+=" ",k+=1),E<l.pos&&k>=l.pos?{range:{from:E,to:k},query:w[0].slice(n.length),text:w[0]}:null}const lee=new Et("suggestion");function uee({pluginKey:t=lee,editor:e,char:n="@",allowSpaces:r=!1,allowToIncludeChar:i=!1,allowedPrefixes:s=[" "],startOfLine:a=!1,decorationTag:l="span",decorationClass:u="suggestion",command:c=()=>null,items:f=()=>[],render:p=()=>({}),allow:m=()=>!0,findSuggestionMatch:g=aee}){let v;const b=p?.(),w=new ot({key:t,view(){return{update:async(x,C)=>{var E,k,T,S,A,V,O;const B=(E=this.key)===null||E===void 0?void 0:E.getState(C),F=(k=this.key)===null||k===void 0?void 0:k.getState(x.state),j=B.active&&F.active&&B.range.from!==F.range.from,Y=!B.active&&F.active,N=B.active&&!F.active,H=!Y&&!N&&B.query!==F.query,D=Y||j&&H,L=H||j,W=N||j&&H;if(!D&&!L&&!W)return;const P=W&&!D?B:F,q=x.dom.querySelector(`[data-decoration-id="${P.decorationId}"]`);v={editor:e,range:P.range,query:P.query,text:P.text,items:[],command:G=>c({editor:e,range:P.range,props:G}),decorationNode:q,clientRect:q?()=>{var G;const{decorationId:se}=(G=this.key)===null||G===void 0?void 0:G.getState(e.state),fe=x.dom.querySelector(`[data-decoration-id="${se}"]`);return fe?.getBoundingClientRect()||null}:null},D&&((T=b?.onBeforeStart)===null||T===void 0||T.call(b,v)),L&&((S=b?.onBeforeUpdate)===null||S===void 0||S.call(b,v)),(L||D)&&(v.items=await f({editor:e,query:P.query})),W&&((A=b?.onExit)===null||A===void 0||A.call(b,v)),L&&((V=b?.onUpdate)===null||V===void 0||V.call(b,v)),D&&((O=b?.onStart)===null||O===void 0||O.call(b,v))},destroy:()=>{var x;v&&((x=b?.onExit)===null||x===void 0||x.call(b,v))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(x,C,E,k){const{isEditable:T}=e,{composing:S}=e.view,{selection:A}=x,{empty:V,from:O}=A,B={...C};if(B.composing=S,T&&(V||e.view.composing)){(O<C.range.from||O>C.range.to)&&!S&&!C.composing&&(B.active=!1);const F=g({char:n,allowSpaces:r,allowToIncludeChar:i,allowedPrefixes:s,startOfLine:a,$position:A.$from}),j=`id_${Math.floor(Math.random()*4294967295)}`;F&&m({editor:e,state:k,range:F.range,isActive:C.active})?(B.active=!0,B.decorationId=C.decorationId?C.decorationId:j,B.range=F.range,B.query=F.query,B.text=F.text):B.active=!1}else B.active=!1;return B.active||(B.decorationId=null,B.range={from:0,to:0},B.query=null,B.text=null),B}},props:{handleKeyDown(x,C){var E;const{active:k,range:T}=w.getState(x.state);return k&&((E=b?.onKeyDown)===null||E===void 0?void 0:E.call(b,{view:x,event:C,range:T}))||!1},decorations(x){const{active:C,range:E,decorationId:k}=w.getState(x);return C?lt.create(x.doc,[jt.inline(E.from,E.to,{nodeName:l,class:u,"data-decoration-id":k})]):null}}});return w}const cee=[{label:"优酷",value:"youku",icon:"Youku"},{label:"哔哩哔哩",value:"bilibili",icon:"BiliBili"},{label:"腾讯视频",value:"qqvideo",icon:"QQVideo"}],dee=[{label:"高德地图",value:"amap",icon:"Gaode"},{label:"百度地图",value:"baidu_map",icon:"Baidu"}],fee=[{label:"墨刀",value:"modao",icon:"Modao"},{label:"蓝湖",value:"lanhu",icon:"Lanhu"},{label:"Figma",value:"figma",icon:"Figma"},{label:"Canva",value:"canva",icon:"Canva"},{label:"ProcessOn",value:"processon",icon:"Processon"}],pee=[{label:"CodePen",value:"codepen",icon:"Codepen"}],hee=[{label:"金数据",value:"jinshuju",icon:"Jinshuju"}],mee=[],gee=[...cee,...dee,...fee,...pee,...hee,...mee];function vee(t){const e=Oa.global.t,n=[{name:"format",title:e("editor.slash.format"),commands:[{name:"paragraph",label:e("editor.paragraph.tooltip"),aliases:["paragraph","zw"],iconName:"Paragraph",action:({editor:i,range:s})=>{i.chain().focus().deleteRange(s).setHeading({level:1}).run()}},{name:"heading1",label:e("editor.heading.h1.tooltip"),aliases:["h1","bt","bt1"],iconName:"Heading1",action:({editor:i,range:s})=>{i.chain().focus().deleteRange(s).setHeading({level:1}).run()}},{name:"heading2",label:e("editor.heading.h2.tooltip"),aliases:["h2","bt","bt2"],iconName:"Heading2",action:({editor:i,range:s})=>{i.chain().focus().deleteRange(s).setNode("heading",{level:2}).run()}},{name:"heading3",label:e("editor.heading.h3.tooltip"),aliases:["h3","bt","bt3","heading3"],iconName:"Heading3",action:({editor:i,range:s})=>{i.chain().focus().deleteRange(s).setNode("heading",{level:3}).run()}},{name:"bulletList",label:e("editor.bulletlist.tooltip"),aliases:["ul","yxlb","bulletList"],iconName:"List",action:({editor:i,range:s})=>{i.chain().focus().deleteRange(s).toggleBulletList().run()}},{name:"numberedList",label:e("editor.orderedlist.tooltip"),aliases:["ol","yxlb"],iconName:"ListOrdered",action:({editor:i,range:s})=>{i.chain().focus().deleteRange(s).toggleOrderedList().run()}},{name:"codeBlock",label:e("editor.codeblock.tooltip"),iconName:"Code2",aliases:["codeBlock"],description:"Code block with syntax highlighting",shouldBeHidden:i=>i.isActive("columns"),action:({editor:i,range:s})=>{i.chain().focus().deleteRange(s).setCodeBlock().run()}},{name:"blockquote",label:e("editor.blockquote.tooltip"),description:"插入引入格式",aliases:["yr"],iconName:"TextQuote",action:({editor:i,range:s})=>{i.chain().focus().deleteRange(s).setBlockquote().run()}},{name:"horizontalrule",label:e("editor.horizontalrule.tooltip"),aliases:["fgx","horizontalRule"],iconName:"Minus",action:({editor:i,range:s})=>{i.chain().focus().deleteRange(s).setHorizontalRule().run()}},{name:"link",label:e("editor.link.tooltip"),aliases:["link","lianjie","lj"],iconName:"Link",action:({editor:i,range:s})=>{i.chain().deleteRange(s).extendMarkRange("link").insertContent({type:"text",text:"link",marks:[{type:"link",attrs:{href:"",target:"_blank"}}]}).setLink({href:""}).focus().run()}}]},{name:"insert",title:e("editor.slash.insert"),commands:[{name:"image",label:e("editor.image.tooltip"),iconName:"ImageUp",description:"Insert a image",aliases:["image","tp","tupian"],shouldBeHidden:i=>i.isActive("columns"),action:({editor:i,range:s})=>{i.chain().focus().deleteRange(s).setImageUpload().run()}},{name:"table",label:e("editor.table.tooltip"),iconName:"Table",description:"Insert a table",aliases:["table","bg","biaoge","biao"],shouldBeHidden:i=>i.isActive("columns"),action:({editor:i,range:s})=>{i.chain().focus().deleteRange(s).insertTable({rows:3,cols:3,withHeaderRow:!1}).run()}},{name:"video",label:e("editor.video.tooltip"),iconName:"Video",description:"Insert a video",aliases:["video","sp","shipin"],shouldBeHidden:i=>i.isActive("columns"),action:({editor:i,range:s})=>{i.chain().focus().deleteRange(s).setVideoUpload().run()}},{name:"taskList",label:e("editor.tasklist.tooltip"),iconName:"ListTodo",description:"Task list with todo items",aliases:["todo"],action:({editor:i,range:s})=>{i.chain().focus().deleteRange(s).toggleTaskList().run()}},{name:"columns",label:e("editor.columns.tooltip"),iconName:"Columns2",description:"Add two column content",aliases:["columns","cols","2cols"],shouldBeHidden:i=>i.isActive("columns"),action:({editor:i,range:s})=>{i.chain().deleteRange(s).setColumns().focus(i.state.selection.head-1).run()}}]}];if(vg(t,"iframes")){const i=gee;n.push({name:"others",title:e("editor.slash.embed"),commands:i.map(s=>({name:s.value,label:s.label,iconName:s.icon,aliases:[s.value,s.label],shouldBeHidden:a=>a.isActive("columns"),action:({editor:a,range:l})=>{a.chain().deleteRange(l).focus().setIframe({src:"",service:s.value}).run()}}))})}return n}const bee={key:0,class:"grid grid-cols-1 gap-0.5 min-w-48"},yee={className:"text-neutral-500 text-[0.65rem] col-[1/-1] mx-2 mt-2 font-semibold tracking-wider select-none uppercase first:mt-0.5"},wee=["onClick"],xee=["src"],Cee={key:1,class:"p-3"},kee={class:"text-xs text-gray-800 dark:text-gray-400"},Eee=o.defineComponent({__name:"CommandsList",props:{editor:{},items:{default:void 0},command:{type:Function,default:void 0}},setup(t,{expose:e}){const n=o.ref(0),r=o.ref(0),i=o.ref(null),{t:s}=Pt(),a=o.ref([]),l=t;e({onKeyDown:u}),o.watch([()=>n.value,()=>r.value],async()=>{if(!i.value)return;await o.nextTick();const b=r.value*1e3+n.value,w=a.value[b];w&&w.scrollIntoView({behavior:"smooth",block:"nearest"})});function u({event:b}){return b.key==="ArrowUp"?(c(),!0):b.key==="ArrowDown"?(f(),!0):b.key==="Enter"?(p(),!0):!1}function c(){if(!l.items.length)return!1;let b=n.value-1,w=r.value;b<0&&(w=r.value-1,b=l.items[w]?.commands.length-1||0),w<0&&(w=l.items.length-1,b=l.items[w].commands.length-1),n.value=b,r.value=w}function f(){if(!l.items.length)return!1;const b=l.items[r.value].commands;let w=n.value+1,x=r.value;b.length-1<w&&(w=0,x=r.value+1),l.items.length-1<x&&(x=0),n.value=w,r.value=x}function p(){if(!l.items.length||r.value===-1||n.value===-1)return!1;m(r.value,n.value)}function m(b,w){const x=l.items[b].commands[w];l.command(x)}function g(b,w){m(b,w)}function v(b,w,x){a.value[b*1e3+w]=x}return(b,w)=>(o.openBlock(),o.createElementBlock("div",{ref_key:"scrollContainer",ref:i,class:"bg-white rounded-lg dark:bg-black shadow-sm border border-neutral-200 dark:border-neutral-800 text-black max-h-[min(80vh,24rem)] overflow-auto flex-wrap mb-8 p-1"},[b.items?.length?(o.openBlock(),o.createElementBlock("div",bee,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(b.items,(x,C)=>(o.openBlock(),o.createElementBlock(o.Fragment,{key:x.title},[o.createElementVNode("div",yee,o.toDisplayString(x.title),1),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(x.commands,(E,k)=>(o.openBlock(),o.createElementBlock("button",{ref_for:!0,ref:T=>v(C,k,T),key:k,class:o.normalizeClass(["flex items-center gap-3 px-2 py-1.5 text-sm text-neutral-800 dark:text-neutral-200 text-left w-full rounded-sm outline-none transition-colors",[r.value===C&&n.value===k?"bg-ed-accent text-neutral-800 dark:bg-neutral-900 dark:text-neutral-200":"hover:bg-ed-accent hover:text-neutral-800 dark:hover:bg-neutral-900 dark:hover:text-neutral-200"]]),onClick:T=>g(C,k)},[E.iconUrl?(o.openBlock(),o.createElementBlock("img",{key:0,class:"w-6 h-6",src:E.iconUrl},null,8,xee)):o.createCommentVNode("",!0),E.iconName?(o.openBlock(),o.createBlock(o.unref(Ot),{key:1,name:E.iconName,class:"mr-1 text-lg"},null,8,["name"])):o.createCommentVNode("",!0),o.createTextVNode(" "+o.toDisplayString(E.label),1)],10,wee))),128))],64))),128))])):(o.openBlock(),o.createElementBlock("div",Cee,[o.createElementVNode("span",kee,o.toDisplayString(o.unref(s)("editor.slash.empty")),1)]))],512))}}),Ra="slashCommand";let Go;const See=Qe.create({name:Ra,priority:200,onCreate(){Go=Ns("body",{interactive:!0,trigger:"manual",placement:"bottom-start",theme:"slash-command",maxWidth:"16rem",offset:[16,8],popperOptions:{strategy:"fixed",modifiers:[{name:"flip",enabled:!1}]}})},addProseMirrorPlugins(){return[uee({editor:this.editor,char:"/",allowSpaces:!0,startOfLine:!0,pluginKey:new Et(Ra),allow:({state:t,range:e})=>{const n=t.doc.resolve(e.from),r=n.depth===1,i=n.parent.type.name==="paragraph",s=n.parent.textContent?.charAt(0)==="/",a=this.editor.isActive("column"),u=!n.parent.textContent?.substring(n.parent.textContent?.indexOf("/"))?.endsWith(" ");return(r&&i&&s||a&&i&&s)&&u},command:({editor:t,range:e,props:n})=>{const{view:r}=t;n.action({editor:t,range:e}),r.focus()},items:({query:t})=>vee(this.editor).map(s=>({...s,commands:s.commands.filter(a=>{const l=a.label.toLowerCase().trim(),u=t.toLowerCase().trim();if(a.aliases){const c=a.aliases.map(m=>m.toLowerCase().trim()),f=l.match(u),p=c.some(m=>m.match(u));return f||p}return l.match(u)}).filter(a=>a.shouldBeHidden?!a.shouldBeHidden(this.editor):!0)})).filter(s=>s.commands.length>0).map(s=>({...s,commands:s.commands.map(a=>({...a,isEnabled:!0}))})),render:()=>{let t,e=null;return{onStart:n=>{t=new sx(Eee,{props:n,editor:n.editor});const{view:r}=n.editor,i=()=>{if(!n.clientRect)return n.editor.storage[Ra].rect;const s=n.clientRect();if(!s)return n.editor.storage[Ra].rect;let a=s.y;if(t.element instanceof HTMLElement&&s.top+t.element.offsetHeight+40>window.innerHeight){const l=s.top+t.element.offsetHeight-window.innerHeight+40;a=s.y-l}return new DOMRect(s.x,a,s.width,s.height)};e=()=>{Go?.[0].setProps({getReferenceClientRect:i})},r.dom.parentElement?.addEventListener("scroll",e),t.element&&Go?.[0].setProps({getReferenceClientRect:i,appendTo:()=>document.body,content:t.element}),Go?.[0].show()},onUpdate(n){t.updateProps(n);const{view:r}=n.editor,i=()=>{if(!n.clientRect)return n.editor.storage[Ra].rect;const a=n.clientRect();return a?new DOMRect(a.x,a.y,a.width,a.height):n.editor.storage[Ra].rect},s=()=>{Go?.[0].setProps({getReferenceClientRect:i})};r.dom.parentElement?.addEventListener("scroll",s),n.editor.storage[Ra].rect=n.clientRect?i():{width:0,height:0,left:0,top:0,right:0,bottom:0},Go?.[0].setProps({getReferenceClientRect:i})},onKeyDown(n){return n.event.key==="Escape"?(Go?.[0].hide(),!0):(Go?.[0].state.isShown||Go?.[0].show(),t.ref?.onKeyDown(n))},onExit(n){if(Go?.[0].hide(),e){const{view:r}=n.editor;r.dom.parentElement?.removeEventListener("scroll",e)}t.destroy()}}}})]},addStorage(){return{rect:{width:0,height:0,left:0,top:0,right:0,bottom:0}}}}),_ee=o.defineComponent({__name:"AIButton",props:{editor:{},icon:{default:void 0},title:{default:void 0},tooltip:{default:void 0},disabled:{type:Boolean,default:!1},shortcutKeys:{default:void 0},customClass:{default:""},loading:{type:Boolean,default:!1},tooltipOptions:{default:void 0},color:{default:void 0},action:{type:Function,default:void 0},isActive:{type:Function,default:void 0}},setup(t){const e=t,n=bn(),{toast:r}=qb();function i(){const s=e.editor.extensionManager.extensions.find(a=>a.name==="AI")?.options?.completions;if(typeof s!="function"){r({title:"AI completions method is not set or is not a valid function",variant:"destructive"});return}if(s.constructor.name!=="AsyncFunction"){r({title:"AI completions method must be an asynchronous function",variant:"destructive"});return}n.state.AIMenu=!0,e.editor?.commands.focus()}return(s,a)=>(o.openBlock(),o.createBlock(Ge,{action:i,title:"AI",disabled:s.disabled,icon:s.icon,tooltip:s.tooltip},null,8,["disabled","icon","tooltip"]))}}),Tee=Lt.create({name:"AI",group:"block",addOptions(){return{...this.parent?.(),toolbar:!1,button:({editor:t,t:e})=>({component:_ee,componentProps:{icon:"Sparkles",tooltip:e("editor.AI.ask")}})}}});function Aee(t,e){const n=atob(t.split(",")[1]),r=new Array(n.length);for(let s=0;s<n.length;s++)r[s]=n.charCodeAt(s);const i=new Uint8Array(r);return new Blob([i],{type:e})}function Mee(t,e){return new File([t],e,{type:t.type})}const Oee=Qe.create({name:"importWord",addOptions(){return{...this.parent?.(),upload:void 0,convert:void 0,limit:1024*1024*10,button:({editor:t,extension:e,t:n})=>({component:Ge,componentProps:{action:()=>t.commands?.toggleImportWord(),disabled:!t.can().setHorizontalRule(),icon:"Word",tooltip:n("editor.importWord.tooltip")}})}},addCommands(){return{toggleImportWord:()=>({chain:t,editor:e})=>{const{toast:n}=qb(),r=Oa.global.t;async function i(u){const f=new DOMParser().parseFromString(u,"text/html"),p=f.querySelectorAll("img");if(!p.length)return f.body.innerHTML;if(vg(e,"image")){const g=e.extensionManager.extensions.find(v=>v.name==="importWord")?.options;if(g&&typeof g.upload=="function"){const v=[];for(const w of p){const x=w.getAttribute("src"),C=Aee(x,"image/jpeg"),E=Mee(C,"image.jpeg");v.push(E)}const b=await g.upload(v);for(let w=0;w<p.length;w++){const x=p[w];x.setAttribute("src",b[w].src);const C=x.parentElement;C?.tagName==="P"&&(C.insertAdjacentElement("beforebegin",x),!C.hasChildNodes()&&C.textContent===""&&C.remove())}return f.body.innerHTML}else return console.warn("Image Upload method found, skip image conversion"),f.body.innerHTML}else return console.error("Image extension not found, unable to convert image"),f.body.innerHTML}async function s(u){const c=await i(u);e.chain().setContent(c.toString(),!0).run(),n({title:r("editor.importWord.success")})}const{open:a,onChange:l}=ct.useFileDialog({accept:".docx",reset:!0,multiple:!1});return a(),l(async u=>{const[c]=Array.from(u??[]);if(c){if(c.size>this.options.limit){n({title:r("editor.importWord.fileTooLarge"),variant:"destructive"});return}if(this.options.convert){const f=await this.options.convert(c);s(f)}else{const f=new FormData,p=JSON.stringify({collaboration_features:{comments:!0,user_id:"e3",track_changes:!0},formatting:{resets:"none",defaults:"inline",styles:"inline",comments:"basic"}});f.append("config",p),f.append("file",c),fetch("https://docx-converter.cke-cs.com/v2/convert/docx-html",{method:"POST",body:f}).then(m=>m.json()).then(async m=>{s(m.html)}).catch(m=>{n({title:r("editor.importWord.error"),variant:"destructive"}),console.error("Error:",m)})}}}),!1}}}}),Kb=bn(),Bee=Qe.create({name:"preview",addOptions(){return{...this.parent?.(),button:({t})=>({component:Ge,componentProps:{icon:"Eye",action:()=>{Kb.togglePreview()},tooltip:t("editor.preview.tooltip"),isActive:()=>Kb.state.showPreview}})}},addCommands(){return{togglePreview:()=>()=>(Kb.togglePreview(),!0)}}}),cS=bn(),Iee=(t,e,n)=>RegExp(e?t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"):t,n?"gu":"gui");function Lee(t,e,n,r){const i=[],s=[];let a=[],l=0;if(!e)return{decorationsToReturn:lt.empty,results:[]};t?.descendants((u,c)=>{u.isText?a[l]?a[l]={text:a[l].text+u.text,pos:a[l].pos}:a[l]={text:`${u.text}`,pos:c}:l+=1}),a=a.filter(Boolean);for(const u of a){const{text:c,pos:f}=u,p=Array.from(c.matchAll(e)).filter(([m])=>m.trim());for(const m of p){if(m[0]==="")break;m.index!==void 0&&s.push({from:f+m.index,to:f+m.index+m[0].length})}}for(let u=0;u<s.length;u+=1){const c=s[u],f=u===r?`${n} ${n}-current`:n,p=jt.inline(c.from,c.to,{class:f});i.push(p)}return{decorationsToReturn:lt.create(t,i),results:s}}const Ree=(t,e,{state:n,dispatch:r})=>{if(!e[0])return;const{from:s,to:a}=e[0];r&&r(n.tr.insertText(t,s,a))},Dee=(t,e,n,r)=>{const i=e+1;if(!r[i])return null;const{from:s,to:a}=r[e],l=a-s-t.length+n,{from:u,to:c}=r[i];return r[i]={to:c-l,from:u-l},[l,r]},Pee=(t,e,{tr:n,dispatch:r})=>{let i=0,s=e.slice();if(s.length){for(let a=0;a<s.length;a+=1){const{from:l,to:u}=s[a];n.insertText(t,l,u);const c=Dee(t,a,i,s);c&&(i=c[0],s=c[1])}r&&r(n)}},Vee=new Et("findAndReplacePlugin"),Fee=Qe.create({name:"findAndReplace",addOptions(){return{...this.parent?.(),searchResultClass:"vdc-editor-search-result",disableRegex:!0,button:({editor:t,extension:e,t:n})=>({component:Ge,componentProps:{icon:"DocSearch",tooltip:n("editor.findAndReplace.tooltip"),action:()=>{cS.toggleFindAndReplace()},isActive:()=>cS.state.findAndReplace}})}},addStorage(){return{searchTerm:"",replaceTerm:"",results:[],lastSearchTerm:"",caseSensitive:!1,lastCaseSensitive:!1,resultIndex:0,lastResultIndex:0}},addCommands(){return{setSearchTerm:t=>({editor:e})=>(e.storage.findAndReplace.searchTerm=t,!1),setReplaceTerm:t=>({editor:e})=>(e.storage.findAndReplace.replaceTerm=t,!1),setCaseSensitive:t=>({editor:e})=>(e.storage.findAndReplace.caseSensitive=t,!1),resetIndex:()=>({editor:t})=>(t.storage.findAndReplace.resultIndex=0,!1),nextSearchResult:()=>({editor:t})=>{const{results:e,resultIndex:n}=t.storage.findAndReplace,r=n+1;return e[r]?t.storage.findAndReplace.resultIndex=r:t.storage.findAndReplace.resultIndex=0,!1},previousSearchResult:()=>({editor:t})=>{const{results:e,resultIndex:n}=t.storage.findAndReplace,r=n-1;return e[r]?t.storage.findAndReplace.resultIndex=r:t.storage.findAndReplace.resultIndex=e.length-1,!1},replace:()=>({editor:t,state:e,dispatch:n})=>{const{replaceTerm:r,results:i}=t.storage.findAndReplace;return Ree(r,i,{state:e,dispatch:n}),!1},replaceAll:()=>({editor:t,tr:e,dispatch:n})=>{const{replaceTerm:r,results:i}=t.storage.findAndReplace;return Pee(r,i,{tr:e,dispatch:n}),!1}}},addProseMirrorPlugins(){const t=this.editor,{searchResultClass:e,disableRegex:n}=this.options,r=a=>t.storage.findAndReplace.lastSearchTerm=a,i=a=>t.storage.findAndReplace.lastCaseSensitive=a,s=a=>t.storage.findAndReplace.lastResultIndex=a;return[new ot({key:Vee,state:{init:()=>lt.empty,apply({doc:a,docChanged:l},u){const{searchTerm:c,lastSearchTerm:f,caseSensitive:p,lastCaseSensitive:m,resultIndex:g,lastResultIndex:v}=t.storage.findAndReplace;if(!l&&f===c&&m===p&&v===g)return u;if(r(c),i(p),s(g),!c)return t.storage.findAndReplace.results=[],lt.empty;const{decorationsToReturn:b,results:w}=Lee(a,Iee(c,n,p),e,g);return t.storage.findAndReplace.results=w,b}},props:{decorations(a){return this.getState(a)}}})]}}),{togglePrinter:$ee,state:Hee}=bn(),zee=Qe.create({name:"printer",addOptions(){return{...this.parent?.(),button:({t})=>({component:Ge,componentProps:{tooltip:t("editor.printer.tooltip"),action:()=>$ee(),icon:"Printer",shortcutKeys:["mod","P"],isActive:()=>Hee.printer}})}}}),Uee=async function(t){let e=[];try{if(this.enabled===!1||t.length===0||t.trim()==="")return e;if(this.limit&&t.length>this.limit)throw new Error("Text is too long");const n=await sn.post(this.getApi(),{value:t}),r=this.transfer(n.data);e=r?.map(i=>i.errorText)||[],this?.setSuggestions&&this.setSuggestions(r)}catch(n){console.error(n)}return e};class dS{suggestions=[];api="";enabled=!0;limit;transfer;constructor({api:e,limit:n,transfer:r,enabled:i}){this.suggestions=[],this.api=e,this.limit=n,this.transfer=r,this.enabled=i??!0}setSuggestions(e){this.suggestions=e}getSuggestions(e){return Promise.resolve(this.suggestions.find(n=>n.errorText.wrongWord===e)?.spellData.correctWord??[])}getApi(){return this.api}normalizeTextForLanguage(e){return e}proofreadText(e){return Promise.resolve(Uee.call(this,e))}toggleIsEnabled(){this.enabled=!this.enabled}setEnabled(e){this.enabled=e}getIsEnabled(){return this.enabled}}const Wee=Object.freeze(Object.defineProperty({__proto__:null,AI:Tee,BaseKit:sS,Blockquote:nK,Bold:y6,BulletList:Gq,Clear:uv,Code:R$,CodeBlock:ZH,Color:m5,Columns:Ib,FindAndReplace:Fee,FontFamily:EE,FontSize:l5,FormatPainter:Ob,Fullscreen:WK,Heading:Z6,Highlight:Uq,History:Pv,HorizontalRule:IK,Image:Wc,ImageUpload:iS,ImportWord:Oee,Indent:see,Italic:w6,LineHeight:TE,Link:Lv,MoreMark:nee,OrderedList:Zq,Preview:Bee,Printer:zee,Proofreader:dS,SlashCommand:See,SpellcheckerExtension:gE,Strike:C6,SubAndSuperScript:NN,Table:zb,TaskList:eK,TextAlign:Q6,Underline:x6,Video:nS,VideoUpload:tS},Symbol.toStringTag,{value:"Module"})),jee='<page id="ft6nbbxs" extend="false" pagenumber="1" force="false"><h1 id="tk6n64mj" extend="&quot;false&quot;"><strong>Introduction(English)</strong></h1><p id="s864ng1o" extend="&quot;false&quot;">MyMy Editor is open-source document editor based on Vue3 and Tiptap. MyMy Editor provides comprehensive document editing capabilities, supports pagination, supports Markdown syntax, offers basic rich text editing functions, allows for the insertion of various node types in multiple formats, provides a variety of practical tools, and supports setting page styles. It also supports exporting in various formats, printing and print preview, block-level document editing, adding custom extensions, multi-language settings, and a dark theme.</p><h1 id="jm9johtz" extend="&quot;false&quot;"><strong>소개(국문)</strong></h1><p id="0qei01hl" extend="&quot;false&quot;">마이마이 에디터는 Vue3과 Tiptap을 기반으로 한 오픈소스 문서 편집기입니다. 마이마이 에디터는 포괄적인 문서 편집 기능을 제공하며, 페이지네이션, 마크다운 구문 지원, 기본적인 리치 텍스트 편집 기능, 다양한 형식의 다양한 노드 유형 삽입, 다양한 실용적인 도구 제공, 페이지 스타일 설정 지원 등을 제공합니다. 또한 다양한 형식으로 내보내기, 인쇄 및 인쇄 미리보기, 블록 수준의 문서 편집, 사용자 지정 확장 추가, 다국어 설정 및 다크 테마를 지원합니다.마이마이 에디터는 Vue3과 Tiptap을 기반으로 한 오픈소스 문서 편집기입니다. 마이마이 에디터는 포괄적인 문서 편집 기능을 제공하며, 페이지네이션, 마크다운 구문 지원, 기본적인 리치 텍스트 편집 기능, 다양한 형식의 다양한 노드 유형 삽입, 다양한 실용적인 도구 제공, 페이지 스타일 설정 지원 등을 제공합니다. 또한 다양한 형식으로 내보내기, 인쇄 및 인쇄 미리보기, 블록 수준의 문서 편집, 사용자 지정 확장 추가, 다국어 설정 및 다크 테마를 지원합니다.</p><blockquote class="blockquote"><p id="nekf7yi0" extend="false"><span style="color: rgb(115, 209, 61)"><strong><em>Make by VDC</em></strong></span></p></blockquote></page>';function qee(){const t=window.localStorage.getItem("content"),e=o.ref(t||jee),n=o.computed(()=>[sS.configure({placeholder:{showOnlyCurrent:!0},characterCount:{limit:1e5},excludes:{}}),Pv,Ib,Ob,uv,Lv,Wc,zb]),r=ct.useEventBus(ur.RENDER_SUPER_TEXT);function i(s,a){const l={action:"status",payload:{id:s,status:a}};r.emit(l)}return{defaultExtensions:n,content:e,dispatchUpdateStatusSuperText:i}}function Kee(){const t=o.ref(!1);return{hasEverFocused:t,markAsFocused:()=>{t.value=!0},insertHtml:(r,i)=>{const{state:s}=r,{doc:a,selection:l}=s,u=l.$from,c=a.firstChild,f=r.isEmpty;if(!t.value){if(f&&c){r.chain().insertContentAt({from:0,to:c.nodeSize},i).focus().run();return}const m=a.content.size;r.chain().insertContentAt(m,i).focus().run();return}const p=u.parent;if(p.type.name==="paragraph"&&p.textContent.trim().length===0){const m=u.before();r.chain().insertContentAt({from:m,to:m+p.nodeSize},i).focus().run();return}if(u.parentOffset===0&&p.type.name==="paragraph"&&p.content.size>0){const m=u.before();r.chain().insertContentAt(m,i).focus().run();return}r.chain().insertContentAt(r.state.selection,i).focus().run()}}}function Xl(t=250){const e=o.ref(!1);let n=null;const r=()=>{e.value=!0,n&&clearTimeout(n),n=setTimeout(()=>{e.value=!1},t)};return o.onUnmounted(()=>{n&&clearTimeout(n)}),{isScrolling:e,handleScroll:r}}function Gee(){const t=o.ref(!1);let e=!1;function n(){const l=Array.from(document.querySelectorAll(".inside-toolbar")),u=document.querySelector("#tool-bar-format"),c=document.querySelector("#tool-bar-image"),f=Array.from(document.querySelectorAll('[contenteditable="true"].tiptap:not(.simple-editor)'));return{popupInsideToolbars:l,toolBarFormat:u,toolBarImage:c,tiptapEditors:f}}function r(l){if(!l)return!1;const{popupInsideToolbars:u,toolBarFormat:c,toolBarImage:f,tiptapEditors:p}=n();return u.some(m=>m.contains(l))||(c?.contains(l)??!1)||(f?.contains(l)??!1)||p.some(m=>m.contains(l))}function i(l){e=r(l.target)}function s(l){const u=l.target;u&&r(u)&&(t.value=!0)}function a(l){const u=l.relatedTarget;r(u)||e&&u===null||(t.value=!1)}return ct.useEventListener(document,"mousedown",i,{capture:!0}),ct.useEventListener(document,"touchstart",i,{capture:!0}),ct.useEventListener(document,"focusin",s),ct.useEventListener(document,"focusout",a),{isShowToolBarBaseOnEditor:t}}function Kc(){try{const{locale:t}=Pt();o.watch(t,e=>{const n=String(e);n&&Oa.global.locale.value!==n&&(Oa.global.locale.value=n)},{immediate:!0})}catch{}}const Xee={key:0,class:"p-2.5 space-y-1.5"},Yee=["innerHTML"],Jee={key:1,class:"p-2.5 space-y-1.5"},Zee=["innerHTML"],Qee={key:2,class:"p-2.5 space-y-1.5"},Nee=["innerHTML"],ete=Xr(o.defineComponent({__name:"ArticleFullViewer",props:{extensions:{},mode:{},hideComment:{type:Boolean},fieldNameComment:{},fieldNameCommentCuesheet:{},fieldNameContent:{},comment:{},commentCuesheet:{},content:{},minChars:{},fontSize:{}},setup(t){const e=t;Kc();const n=o.computed(()=>{const C=e.extensions?.filter(E=>E.name!=="spellchecker")||[];return C.some(E=>E.name==="image")||C.push(Wc.configure()),C}),r=o.computed(()=>ra(e.comment)),i=o.computed(()=>ra(e.commentCuesheet)),s=o.computed(()=>ra(e.content));function a(C){return pg(C).replace(/<script\b[\s\S]*?<\/script\s*>/gi,"")}const l=o.computed(()=>r.value?a(e.comment):""),u=o.computed(()=>i.value?a(e.commentCuesheet):""),c=o.computed(()=>s.value?a(e.content):""),f=o.ref(),p=o.ref(),m=o.ref();o.onBeforeUnmount(()=>{f.value&&f.value.destroy(),p.value&&p.value.destroy(),m.value&&m.value.destroy()});function g(C){return new Oo({extensions:n.value,content:C,editable:!1,parseOptions:{preserveWhitespace:"full"}})}o.onMounted(async()=>{!r.value&&e.comment&&(f.value=g(un(e.comment,!0,e.mode)),await o.nextTick()),!i.value&&e.commentCuesheet&&(p.value=g(un(e.commentCuesheet,!0,e.mode)),await o.nextTick()),!s.value&&e.content&&(m.value=g(un(e.content,!0,e.mode)))});function v(C,E){if(!C)return;const k=un(E,!0,e.mode);St.isEqual(C.getHTML(),k)||C.commands.setContent(k,!1,{preserveWhitespace:"full"})}o.watch(()=>e.comment,C=>{r.value||v(f.value,C)}),o.watch(()=>e.commentCuesheet,C=>{i.value||v(p.value,C)}),o.watch(()=>e.content,C=>{s.value||v(m.value,C)});const b=o.computed(()=>e.fontSize??""),{contentInner:w,measuredMinWidth:x}=pf({minChars:e.minChars,fontSize:b});return(C,E)=>{const k=YT;return o.openBlock(),o.createElementBlock("div",{ref_key:"contentInner",ref:w,style:o.normalizeStyle({minWidth:`${Number(o.unref(x))+23}px`}),class:"flex-1 border border-[#999] rounded-[3px] divide-y divide-[#999] divide-dashed overflow-y-auto"},[C.comment&&!C.hideComment?(o.openBlock(),o.createElementBlock("div",Xee,[C.fieldNameComment?.label?(o.openBlock(),o.createBlock(k,{key:0,label:C.fieldNameComment.label,"custom-class":C.fieldNameComment.customClass},null,8,["label","custom-class"])):o.createCommentVNode("",!0),o.unref(r)?(o.openBlock(),o.createElementBlock("div",{key:1,class:"ProseMirror",innerHTML:o.unref(l)},null,8,Yee)):o.unref(f)?(o.openBlock(),o.createBlock(o.unref(Yn),{key:2,editor:o.unref(f)},null,8,["editor"])):o.createCommentVNode("",!0)])):o.createCommentVNode("",!0),C.commentCuesheet&&!C.hideComment?(o.openBlock(),o.createElementBlock("div",Jee,[C.fieldNameCommentCuesheet?.label?(o.openBlock(),o.createBlock(k,{key:0,label:C.fieldNameCommentCuesheet.label,"custom-class":C.fieldNameCommentCuesheet.customClass},null,8,["label","custom-class"])):o.createCommentVNode("",!0),o.unref(i)?(o.openBlock(),o.createElementBlock("div",{key:1,class:"ProseMirror",innerHTML:o.unref(u)},null,8,Zee)):o.unref(p)?(o.openBlock(),o.createBlock(o.unref(Yn),{key:2,editor:o.unref(p)},null,8,["editor"])):o.createCommentVNode("",!0)])):o.createCommentVNode("",!0),C.content?(o.openBlock(),o.createElementBlock("div",Qee,[C.fieldNameContent?.label?(o.openBlock(),o.createBlock(k,{key:0,label:C.fieldNameContent.label,"custom-class":C.fieldNameContent.customClass},null,8,["label","custom-class"])):o.createCommentVNode("",!0),o.unref(s)?(o.openBlock(),o.createElementBlock("div",{key:1,class:"ProseMirror",innerHTML:o.unref(c)},null,8,Nee)):o.unref(m)?(o.openBlock(),o.createBlock(o.unref(Yn),{key:2,editor:o.unref(m)},null,8,["editor"])):o.createCommentVNode("",!0)])):o.createCommentVNode("",!0)],4)}}}),[["__scopeId","data-v-3357e31b"]]),wo=o.defineComponent({__name:"Separator",props:{orientation:{},decorative:{type:Boolean},asChild:{type:Boolean},as:{},class:{}},setup(t){const e=t,n=o.computed(()=>{const{class:r,...i}=e;return i});return(r,i)=>(o.openBlock(),o.createBlock(o.unref(nF),o.mergeProps(n.value,{class:o.unref(ke)("shrink-0 bg-ed-separator",e.orientation==="vertical"?"w-px h-full":"h-px w-full",e.class)}),null,16,["class"]))}}),tte={class:"flex gap-2 items-center overflow-x-auto overflow-y-hidden [&::-webkit-scrollbar]:h-1.5"},nte={class:"flex-1 flex justify-end items-center gap-x-3"},rte=o.defineComponent({__name:"Toolbar",props:{editor:{},editorComment:{},disabled:{type:Boolean,default:!1},mode:{},class:{},customClassToolbar:{},toolbarExtensionOrder:{}},setup(t){const e=o.defineAsyncComponent(()=>Promise.resolve().then(()=>QJ)),{t:n}=Pt(),r=t,i=o.inject("isEditable",o.ref(!0)),s=[rh,oh,ah,ih,ki,Lc],a=o.computed(()=>{const f=[...r.editor.extensionManager.extensions],p={[ki]:-1},m={[rh]:1,[oh]:2,[ah]:3,[ih]:4,[ki]:5,[Lc]:6},g=r.toolbarExtensionOrder??(r.mode===Te.EDITOR?p:m),v=pE(f,g);let b=[];for(const w of v){const{button:x,divider:C=!1,spacer:E=!1,toolbar:k=!0}=w.options;if(!x||!gg(x)||!k)continue;const T=x({editor:r.editor,extension:w,t:o.unref(n)});if(Array.isArray(T)){const S=T.map((A,V)=>({id:`${w.name}`,button:A,divider:V===T.length-1?C:!1,spacer:V===0?E:!1}));b=[...b,...S];continue}b.push({button:T,divider:C,spacer:E,id:`${w.name}`})}if(r.mode!==Te.EDITOR)return b.filter(w=>w.id&&s.includes(w.id));if(b=b.filter(w=>w.id!=="superText"),!i.value){b=b.map(x=>(x.button.componentProps.disabled=!0,x));const w=b.find(x=>x.id==="spellchecker");w&&(w.button.componentProps.disabled=!1)}return b}),l=f=>f.id==="spellchecker"?"!text-[#2977D9] border border-gray-300 dark:!text-white hover:!bg-gray-200 dark:hover:!bg-gray-700 rounded-none [&>div>svg]:w-[19px] [&>div>svg]:h-[19px] p-0 w-[26px] h-[26px]":f.button.componentProps.customClass,u=f=>f.id==="spellchecker"?"Spellchecker":f.button.componentProps.icon,c=o.computed(()=>r.editor?.extensionManager.extensions.find(f=>f.name==="spellchecker"));return(f,p)=>(o.openBlock(),o.createElementBlock("div",{id:"tool-bar",class:o.normalizeClass(o.unref(ke)(r.class,f.customClassToolbar))},[o.createElementVNode("div",tte,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(a.value,(m,g)=>(o.openBlock(),o.createElementBlock(o.Fragment,{key:g},[m.spacer&&g!==0?(o.openBlock(),o.createBlock(o.unref(wo),{key:0,orientation:"vertical",class:"h-[16px] mx-[10px]"})):o.createCommentVNode("",!0),(o.openBlock(),o.createBlock(o.resolveDynamicComponent(m.button.component),o.mergeProps({id:m.id,ref_for:!0},m.button.componentProps,{editor:f.editor,disabled:f.disabled||m.button.componentProps?.disabled,"custom-class":l(m),icon:u(m)}),o.createSlots({_:2},[o.renderList(m.button.componentSlots,(v,b,w)=>({name:`${b}`,fn:o.withCtx(x=>[(o.openBlock(),o.createBlock(o.resolveDynamicComponent(v),o.mergeProps({ref_for:!0},x?.props,{id:m.id}),null,16,["id"]))])}))]),1040,["id","editor","disabled","custom-class","icon"])),m.divider?(o.openBlock(),o.createBlock(o.unref(wo),{key:1,orientation:"vertical",class:"mx-2 h-auto"})):o.createCommentVNode("",!0)],64))),128)),o.createElementVNode("div",nte,[p[0]||(p[0]=o.createElementVNode("div",{id:"tool-bar-auto-save"},null,-1)),c.value?(o.openBlock(),o.createBlock(o.unref(e),{key:0,editor:f.editor,"editor-comment":f.editorComment,isEnableSpellCheckRealTime:f.editor?.extensionStorage.spellchecker.spellchecker.proofreader.enabled},null,8,["editor","editor-comment","isEnableSpellCheckRealTime"])):o.createCommentVNode("",!0)])])],2))}}),fS=(t,e)=>{const{view:n,state:{selection:{from:r}}}=t,i=document.querySelectorAll(".focus"),s=i.length,l=i[s-1];if(l&&l.getAttribute("data-type")&&l.getAttribute("data-type")===e||l&&l.classList&&l.classList.contains(e))return l;const u=n.domAtPos(r).node;let c=u;for(c.tagName||(c=u.parentElement);c&&!(c.getAttribute("data-type")&&c.getAttribute("data-type")===e)&&!c.classList.contains(e);)c=c.parentElement;return c},ote={class:"w-max px-3 py-2 transition-all border rounded-sm shadow-sm pointer-events-auto select-none border-neutral-200 dark:border-neutral-800 bg-ed-background"},ite={class:"flex items-center flex-nowrap whitespace-nowrap h-[26px] justify-start relative gap-0.5"},ste={class:"flex items-center gap-2"},ate={class:"mt-3"},pS=o.defineComponent({__name:"ImageBubbleMenu",props:{editor:{},disabled:{type:Boolean,default:!1}},setup(t){const e=t,{t:n}=Pt(),r=o.ref("100"),i=o.ref(),s=o.ref(),a=o.ref(),l=["left","center","right"],u={left:"AlignLeft",center:"AlignCenter",right:"AlignRight"},c=()=>document.body;function f(O){O?.preventDefault(),e.editor.getAttributes("image").src&&e.editor.chain().focus(void 0,{scrollIntoView:!1}).updateImage({width:i.value?`${i.value}px`:null}).run()}function p(O){const B=Math.max(0,Math.min(100,parseInt(r.value)));e.editor.chain().focus(void 0,{scrollIntoView:!1}).updateImage({width:`${B}%`}).run()}const m=o.ref(!1),g=o.ref(null),v=({editor:O})=>U0(O.view.state,"image")||m.value;function b(){const O=fS(e.editor,"node-image");return O?(g.value=O,O.getBoundingClientRect()):m.value&&g.value?g.value.getBoundingClientRect():new DOMRect(-1e3,-1e3,0,0)}function w(O){e.editor.commands.updateAttributes("image",{textAlign:O})}o.watch(r,()=>{r.value&&p()}),o.watch(()=>e.editor.getAttributes("image"),O=>{O&&(i.value=Math.round(parseFloat(O.originWidth)),s.value=Math.round(parseFloat(O.originHeight)),a.value=O.originWidth/O.originHeight)});function x(){s.value&&a.value?i.value=Math.max(30,Math.round(s.value*a.value)):i.value=null}function C(){i.value&&a.value?s.value=Math.max(20,Math.round(i.value/a.value)):s.value=null}function E(O){w(O)}function k(){const O=e.editor.getAttributes("image"),{flipX:B}=O;e.editor.chain().focus(void 0,{scrollIntoView:!1}).updateImage({flipX:!B}).run()}function T(){const O=e.editor.getAttributes("image"),{flipY:B}=O;e.editor.chain().focus(void 0,{scrollIntoView:!1}).updateImage({flipY:!B}).run()}function S(){const{state:O,dispatch:B}=e.editor.view;ol(O,B)}function A(){const{state:O,dispatch:B}=e.editor.view,{tr:F,selection:j}=O;if(!(j instanceof Re))return;const Y=j.from,N=O.doc.nodeAt(Y);if(!N)return;const D=O.doc.resolve(Y).nodeBefore;if(!D)return;const L=Y-D.nodeSize,W=F.delete(Y,Y+N.nodeSize).insert(L,N).setSelection(Re.create(F.doc,L));B(W),e.editor.commands.focus()}function V(){const{state:O,dispatch:B}=e.editor.view,{tr:F,doc:j,selection:Y}=O;if(!(Y instanceof Re))return;const N=Y.from,H=j.nodeAt(N);if(!H)return;const D=N+H.nodeSize;if(D>=j.content.size)return;const L=j.nodeAt(D);if(!L)return;const W=D+L.nodeSize-H.nodeSize,P=N+L.nodeSize,q=F.delete(N,N+H.nodeSize).insert(W,H).setSelection(Re.create(F.doc,P));B(q),e.editor.commands.focus()}return(O,B)=>{const F=Ge,j=wo,Y=Ca,N=Mc,H=ws,D=Kl,L=Bh,W=Oh,P=gs,q=ms;return o.openBlock(),o.createBlock(o.unref(Wu),{editor:O.editor,"plugin-key":"image-menus-123","should-show":v,"update-delay":0,"tippy-options":{zIndex:9999,appendTo:c,getReferenceClientRect:()=>b()}},{default:o.withCtx(()=>[o.createElementVNode("div",ote,[o.createElementVNode("div",ite,[o.createVNode(F,{tooltip:o.unref(n)("editor.image.menu.flipX"),icon:"FlipVertical",action:k},null,8,["tooltip"]),o.createVNode(F,{tooltip:o.unref(n)("editor.image.menu.flipY"),icon:"FlipHorizontal",action:T},null,8,["tooltip"]),o.createVNode(j,{orientation:"vertical",class:"mx-1 me-2 h-[16px]"}),o.createVNode(F,{tooltip:o.unref(n)("editor.image.menu.moveUp"),icon:"MoveUp",action:A,disabled:!O.editor.isEditable},null,8,["tooltip","disabled"]),o.createVNode(F,{tooltip:o.unref(n)("editor.image.menu.moveDown"),icon:"MoveDown",action:V,disabled:!O.editor.isEditable},null,8,["tooltip","disabled"]),o.createVNode(j,{orientation:"vertical",class:"mx-1 me-2 h-[16px]"}),o.createVNode(q,{open:m.value,"onUpdate:open":B[4]||(B[4]=G=>m.value=G)},{default:o.withCtx(()=>[o.createVNode(Y,null,{default:o.withCtx(()=>[o.createVNode(F,{title:o.unref(n)("editor.image.menu.size"),icon:"ImageSize"},null,8,["title"])]),_:1}),o.createVNode(P,{class:"w-84"},{default:o.withCtx(()=>[o.createElementVNode("div",ste,[o.createVNode(N,{for:"maxWidth",class:"whitespace-nowrap"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(n)("editor.image.menu.size.width")),1)]),_:1}),o.createVNode(H,{id:"maxWidth",modelValue:i.value,"onUpdate:modelValue":B[0]||(B[0]=G=>i.value=G),type:"number",class:"w-20 h-8 [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",onInput:C,onKeyup:o.withKeys(f,["enter"])},null,8,["modelValue"]),o.createVNode(N,{for:"maxWidth",class:"whitespace-nowrap"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(n)("editor.image.menu.size.height")),1)]),_:1}),o.createVNode(H,{id:"maxWidth",modelValue:s.value,"onUpdate:modelValue":B[1]||(B[1]=G=>s.value=G),type:"number",class:"w-20 h-8 [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",onInput:x,onKeyup:o.withKeys(f,["enter"])},null,8,["modelValue"])]),o.createElementVNode("div",ate,[o.createVNode(W,{"model-value":r.value,"onUpdate:modelValue":[B[2]||(B[2]=G=>r.value=G),B[3]||(B[3]=G=>{r.value=G})]},{default:o.withCtx(()=>[o.createVNode(L,null,{default:o.withCtx(()=>[(o.openBlock(),o.createElementBlock(o.Fragment,null,o.renderList(["25","50","75","100"],G=>o.createVNode(D,{key:G,value:G},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(G)+"% ",1)]),_:2},1032,["value"])),64))]),_:1})]),_:1},8,["model-value"])])]),_:1})]),_:1},8,["open"]),o.createVNode(j,{orientation:"vertical",class:"mx-1 me-2 h-[16px]"}),(o.openBlock(),o.createElementBlock(o.Fragment,null,o.renderList(l,(G,se)=>o.createVNode(F,{key:se,tooltip:o.unref(n)(`editor.textalign.${G}.tooltip`),icon:u[G],action:()=>E(G),disabled:!O.editor.can().setTextAlign(G),"is-active":()=>O.editor.isActive({textAlign:G})||!1},null,8,["tooltip","icon","action","disabled","is-active"])),64)),o.createVNode(j,{orientation:"vertical",class:"mx-1 me-2 h-[16px]"}),o.createVNode(F,{tooltip:o.unref(n)("editor.remove"),icon:"Trash2",action:S,disabled:!O.editor.isEditable},null,8,["tooltip","disabled"])])])]),_:1},8,["editor","tippy-options"])}}}),lte={class:"h-full w-fit min-w-32 flex items-center leading-none gap-0.5 p-2 bg-ed-background rounded-lg shadow-sm border border-ed-border"},Lh=o.defineComponent({__name:"TableBubbleMenu",props:{editor:{}},setup(t){const e=t,n=()=>document.body,r=({editor:w})=>w.isActive("table")&&(w.storage.table?.isTableEditorOpen??!1),{t:i}=Pt();function s(){e.editor.chain().focus().addColumnBefore().run()}function a(){e.editor.chain().focus().addColumnAfter().run()}function l(){e.editor.chain().focus().deleteColumn().run()}function u(){e.editor.chain().focus().addRowBefore().run()}function c(){e.editor.chain().focus().addRowAfter().run()}function f(){e.editor.chain().focus().deleteRow().run()}function p(){e.editor.chain().focus().mergeCells().run()}function m(){e.editor?.chain().focus().splitCell().run()}function g(){e.editor.chain().focus().deleteTable().run()}function v(w){e.editor.chain().focus().setTableCellBackground(w).run()}const b=()=>{const w=document.querySelector(".vdc-editor");if(!w)return new DOMRect(-1e3,-1e3,0,0);const x=w.getBoundingClientRect();return new DOMRect(x.left,x.top+10,x.width,0)};return(w,x)=>(o.openBlock(),o.createBlock(o.unref(Wu),{editor:w.editor,"plugin-key":"table","update-delay":0,"should-show":r,"tippy-options":{zIndex:9999,maxWidth:"auto",getReferenceClientRect:b,appendTo:n}},{default:o.withCtx(()=>[o.createElementVNode("div",lte,[o.createVNode(Ge,{icon:"TablerColumnInsertLeft","icon-class":"w-5 h-5",tooltip:o.unref(i)("editor.table.menu.insertColumnBefore"),action:s,"tooltip-options":{sideOffset:15},disabled:!w.editor?.can().addColumnBefore()},null,8,["tooltip","disabled"]),o.createVNode(Ge,{icon:"TablerColumnInsertRight",tooltip:o.unref(i)("editor.table.menu.insertColumnAfter"),"icon-class":"w-5 h-5",action:a,"tooltip-options":{sideOffset:15},disabled:!w.editor?.can().addColumnAfter()},null,8,["tooltip","disabled"]),o.createVNode(Ge,{icon:"TablerColumnRemove",action:l,"icon-class":"w-5 h-5",tooltip:o.unref(i)("editor.table.menu.deleteColumn"),"tooltip-options":{sideOffset:15},disabled:!w.editor?.can().deleteColumn()},null,8,["tooltip","disabled"]),o.createVNode(o.unref(wo),{orientation:"vertical",class:"mx-1 me-2 h-[16px]"}),o.createVNode(Ge,{icon:"TablerRowInsertTop",action:u,"icon-class":"w-5 h-5",tooltip:o.unref(i)("editor.table.menu.insertRowAbove"),"tooltip-options":{sideOffset:15},disabled:!w.editor?.can().addRowBefore()},null,8,["tooltip","disabled"]),o.createVNode(Ge,{icon:"TablerRowInsertBottom",action:c,"icon-class":"w-5 h-5",tooltip:o.unref(i)("editor.table.menu.insertRowBelow"),"tooltip-options":{sideOffset:15},disabled:!w.editor?.can().addRowAfter()},null,8,["tooltip","disabled"]),o.createVNode(Ge,{icon:"TablerRowRemove",action:f,"icon-class":"w-5 h-5",tooltip:o.unref(i)("editor.table.menu.deleteRow"),"tooltip-options":{sideOffset:15},disabled:!w.editor?.can().deleteRow()},null,8,["tooltip","disabled"]),o.createVNode(o.unref(wo),{orientation:"vertical",class:"mx-1 me-2 h-[16px]"}),o.createVNode(Ge,{icon:"TableCellsMerge",action:p,"icon-class":"w-5 h-5",tooltip:o.unref(i)("editor.table.menu.mergeCells"),"tooltip-options":{sideOffset:15},disabled:!w.editor?.can().mergeCells()},null,8,["tooltip","disabled"]),o.createVNode(Ge,{icon:"TableCellsSplit",action:m,"icon-class":"w-5 h-5",tooltip:o.unref(i)("editor.table.menu.splitCells"),"tooltip-options":{sideOffset:15},disabled:!w.editor?.can().splitCell()},null,8,["tooltip","disabled"]),o.createVNode(o.unref(wo),{orientation:"vertical",class:"mx-1 me-2 h-[16px]"}),o.createVNode(v5,{editor:w.editor,tooltip:o.unref(i)("editor.table.menu.setCellsBgColor"),action:v,"tooltip-options":{sideOffset:15}},null,8,["editor","tooltip"]),o.createVNode(Ge,{icon:"Trash2",tooltip:o.unref(i)("editor.table.menu.deleteTable"),"icon-class":"w-5 h-5",action:g,"tooltip-options":{sideOffset:15},disabled:!w.editor?.can().deleteTable()},null,8,["tooltip","disabled"])])]),_:1},8,["editor","tippy-options"]))}}),ute={class:"p-2 bg-white border rounded-lg shadow-sm dark:bg-black border-neutral-200 dark:border-neutral-800"},cte={class:"flex items-center gap-1"},Rh=o.defineComponent({__name:"ColumnsBubbleMenu",props:{editor:{},disabled:{type:Boolean,default:!1}},setup(t){const e=t,n=({editor:l})=>U0(l.view.state,"columns"),r=()=>fS(e.editor,"columns")?.getBoundingClientRect()||new DOMRect(-1e3,-1e3,0,0),i=()=>{e.editor.chain().focus().setLayout(Ba.SidebarLeft).run()},s=()=>{e.editor.chain().focus().setLayout(Ba.SidebarRight).run()},a=()=>{e.editor.chain().focus().setLayout(Ba.TwoColumn).run()};return(l,u)=>(o.openBlock(),o.createBlock(o.unref(Wu),{editor:l.editor,"plugin-key":"columns","should-show":n,"update-delay":0,"tippy-options":{offset:[0,8],popperOptions:{modifiers:[{name:"flip",enabled:!1}]},getReferenceClientRect:r,plugins:[o.unref(lL)],sticky:"popper"}},{default:o.withCtx(()=>[o.createElementVNode("div",ute,[o.createElementVNode("div",cte,[o.createVNode(Ge,{id:"panel-left",title:"ok",icon:"PanelLeft",tooltip:"tooltip",action:i,"is-active":()=>l.editor.isActive("columns",{layout:o.unref(Ba).SidebarLeft}),"tooltip-options":{sideOffset:15}},null,8,["is-active"]),o.createVNode(Ge,{id:"columns",title:"ok",icon:"Columns",tooltip:"tooltip",action:a,"is-active":()=>l.editor.isActive("columns",{layout:o.unref(Ba).TwoColumn}),"tooltip-options":{sideOffset:15}},null,8,["is-active"]),o.createVNode(Ge,{id:"panel-right",title:"ok",icon:"PanelRight",tooltip:"tooltip",action:s,"is-active":()=>l.editor.isActive("columns",{layout:o.unref(Ba).SidebarRight}),"tooltip-options":{sideOffset:15}},null,8,["is-active"])])])]),_:1},8,["editor","tippy-options"]))}}),dte={class:"flex items-center gap-2 p-2 bg-white border rounded-lg shadow-sm dark:bg-black border-neutral-200 dark:border-neutral-800"},fte=["href"],pte={class:"flex flex-nowrap"},hte=o.defineComponent({__name:"LinkViewBlock",props:{editor:{},link:{default:void 0}},emits:["clear","edit"],setup(t,{emit:e}){const{t:n}=Pt(),r=e;function i(){r("clear")}function s(){r("edit")}return(a,l)=>(o.openBlock(),o.createElementBlock("div",dte,[o.createElementVNode("a",{href:a.link,target:"_blank",rel:"noopener noreferrer",class:"text-sm underline break-all"},o.toDisplayString(o.unref(St.truncate)(a.link,{length:50,omission:"…"})),9,fte),a.link?(o.openBlock(),o.createBlock(o.unref(wo),{key:0,orientation:"vertical",class:"h-4"})):o.createCommentVNode("",!0),o.createElementVNode("div",pte,[o.createVNode(Ge,{icon:"Pencil",tooltip:o.unref(n)("editor.link.edit.tooltip"),action:s,"tooltip-options":{sideOffset:15}},null,8,["tooltip"]),o.createVNode(Ge,{icon:"Unlink",tooltip:o.unref(n)("editor.link.unlink.tooltip"),action:i,"tooltip-options":{sideOffset:15}},null,8,["tooltip"])])]))}}),Dh=o.defineComponent({__name:"LinkBubbleMenu",props:{editor:{},disabled:{type:Boolean,default:!1}},setup(t){const e=t,n=o.ref(!1),r=o.computed(()=>{const{href:l}=e.editor.getAttributes("link");return l}),i=o.computed(()=>e.editor.isActive("link"));function s(l,u,c){e.editor.chain().extendMarkRange("link").insertContent({type:"text",text:u,marks:[{type:"link",attrs:{href:l,target:c?"_blank":""}}]}).setLink({href:l}).focus().run(),n.value=!1}function a(){e.editor.chain().extendMarkRange("link").unsetLink().focus().run(),n.value=!1}return(l,u)=>o.withDirectives((o.openBlock(),o.createBlock(o.unref(Wu),{editor:l.editor,"update-delay":0,"tippy-options":{popperOptions:{modifiers:[{name:"flip",enabled:!0}]},appendTo:"parent",placement:"bottom-start",offset:[-2,16],zIndex:9999,onHidden:()=>{n.value=!1}}},{default:o.withCtx(()=>[o.createVNode(o.unref(ms),{open:n.value,"onUpdate:open":u[1]||(u[1]=c=>n.value=c)},{default:o.withCtx(()=>[o.createVNode(o.unref(uV),null,{default:o.withCtx(()=>[n.value?o.createCommentVNode("",!0):(o.openBlock(),o.createBlock(hte,{key:0,editor:l.editor,link:r.value,onClear:a,onEdit:u[0]||(u[0]=c=>n.value=!0)},null,8,["editor","link"]))]),_:1}),o.createVNode(o.unref(gs),{class:"p-0 border-0 w-fit shadow-none",align:"start",side:"bottom"},{default:o.withCtx(()=>[o.createVNode($5,{class:"p-4",editor:l.editor,onOnSetLink:s},null,8,["editor"])]),_:1})]),_:1},8,["open"])]),_:1},8,["editor","tippy-options"])),[[o.vShow,i.value]])}}),hS=(t,e,n,r,i)=>{const s=o.ref(0),a=ct.useEventBus(ur.RENDER_SUPER_TEXT),l=T=>{if(!e.value||!t)return;const S=e.value.index,A=e.value.id,{state:V}=t,{tr:O}=V;let B=!1;V.doc.descendants((F,j)=>{if(F.attrs?.[Ne.ID]===A){F.attrs[Ne.TEXT]?.trim();const Y=T.trim();if(Hc(Y))return O.delete(j,j+1),B=!0,!1;const{[Ne.ELEMENT_ID]:N,...H}=F.attrs;return O.setNodeMarkup(j,void 0,{...H,[Ne.TEXT]:Y}),B=!0,!1}return!0}),B&&t&&t.view.dispatch(O),S!==-1&&(n.value[S].text=T,n.value[S].textOriginal=T,n.value[S].hoverElementId=null)},u=o.ref(new Map),c=()=>{if(!t?.view.dom)return[];const T=[],S=t?.view.dom.querySelectorAll("[node-id]"),A=new Map;return u.value.clear(),S.forEach(V=>{const O=V.getBoundingClientRect().top;A.has(O)||A.set(O,V),u.value.set(V.getAttribute("node-id")||"unknown",0)}),T.push(...A.values()),T},f=T=>{const S=T.closest(`#${r}`);if(!S)return;const A=S.getBoundingClientRect().top,V=S?.scrollTop;return T.getBoundingClientRect().top-(A-V)},p=(T,S)=>{const A=n.value.findIndex(V=>V.id===T);A>-1&&(n.value[A].status=S)},m=T=>T.replace(/<p><\/p>/g,"<p>&nbsp;</p>"),g=()=>{if(!n.value||n.value.length===0){s.value=0,u.value.clear();return}if(!i.value||i.value.length===0)return;const T=i.value,S=new Set(n.value.map(O=>O.id)),A=T.map(O=>({isHidden:O.classList.contains("hidden"),isTruncated:O.classList.contains("super-text-truncate")}));T.forEach(O=>{O.classList.remove("hidden"),O.classList.remove("super-text-truncate")});for(const O of u.value.keys())S.has(O)||u.value.delete(O);T.forEach(O=>{const B=O.getAttribute("book-mark-id");if(!B)return;const F=O.offsetTop+O.offsetHeight,j=u.value.get(B)||0;u.value.set(B,Math.max(F,j))}),T.forEach((O,B)=>{A[B].isHidden&&O.classList.add("hidden"),A[B].isTruncated&&O.classList.add("super-text-truncate")});let V=0;for(const O of u.value.values())O>V&&(V=O);s.value=V},v=async()=>{await o.nextTick();const S=c().map(A=>{const V=A.getAttribute("node-id"),O=A.getAttribute("book-mark-content"),B=A.getAttribute("page-id"),F=A.getAttribute("page-number"),j=A.getBoundingClientRect(),Y=A.getAttribute("line-id"),N=A.getAttribute("element-id");return{position:j,text:m(O),id:V,pageId:B,pageNumber:F,visiblePosition:f(A),status:0,lineId:Y,elementId:N,hoverElementId:null,textOriginal:m(O)}});n.value=S},b=(T,S)=>{const A=T.bottom<=S.top,V=T.top>=S.bottom;return!(A||V)};async function w(){const T=i.value;if(!T||T.length===0){g();return}T.sort((S,A)=>{const V=Number(S.getAttribute("index")),O=Number(A.getAttribute("index"));return V-O}),T.forEach(S=>S.classList.remove("super-text-truncate")),T.forEach((S,A)=>{const V=S.getBoundingClientRect();T.slice(A+1).forEach(O=>{const B=O.getBoundingClientRect();b(V,B)&&S.classList.add("super-text-truncate")})}),g()}const x=async T=>{await o.nextTick();const S=t?.view.dom.querySelector(`[node-id='${T.dataId}']`),A=i.value.find(B=>{const F=B.getBoundingClientRect().top,j=S?.getBoundingClientRect().top;if(j==null)return!1;const Y=j-F;return Math.abs(Y-9)<=2});if(!A)return;const V=Number(A.getAttribute("index"));if(!T.text){A.querySelector(".super-text-lines").innerHTML=n.value[V].textOriginal,n.value[V].hoverElementId=null,i.value.forEach(B=>B.classList.remove("hidden")),w();return}n.value[V].hoverElementId=T.elementId??null,A.querySelector(".super-text-lines").innerHTML=m(T.text),A.classList.remove("super-text-truncate");const O=A.getBoundingClientRect();i.value.forEach((B,F)=>{if(F!==V){const j=B.getBoundingClientRect();b(O,j)&&B.classList.add("hidden")}}),g()},C=T=>{switch(T.action){case"hover":x(T.payload);break;case"status":p(T.payload.id,T.payload.status);break;case"render":v();break;default:console.log("There is no action")}},E=(T,S)=>{const A=T.currentTarget;A.classList.remove("super-text-truncate");const V=A.getBoundingClientRect();i.value.forEach((O,B)=>{if(B!==S){const F=O.getBoundingClientRect();b(V,F)&&O.classList.add("hidden")}}),g()},k=()=>{i.value.forEach(T=>T.classList.remove("hidden")),w()};return o.onBeforeMount(()=>{a.on(C),window.addEventListener("resize",v)}),o.onBeforeUnmount(()=>{a.off(C),window.removeEventListener("resize",v)}),o.watch(()=>n,async()=>{await o.nextTick(),w()},{deep:!0}),{onUpdate:l,hanldeTruncateSuperTexts:w,eventListener:C,handleMouseOver:E,handleMouseLeave:k,wrapperMinHeight:s}},mte=["index","book-mark-id","line-id","onMouseover"],gte=["innerHTML"],vte=Xr(o.defineComponent({__name:"SuperTextView",props:{editor:{},superPreviewCustomClass:{},minChars:{},fontSize:{},fixedWidth:{type:Boolean}},setup(t,{expose:e}){const n=t,r=o.ref([]),i=o.ref([]),s=o.ref(!1),a=o.ref(!1),l=o.ref(null),u=o.inject("isMobile",!1),c=o.inject("fontWeight",o.ref("")),f=o.computed(()=>n.fixedWidth&&o.unref(c)||"normal"),p=o.inject("canEditSuper",o.ref(!0)),{onUpdate:m,handleMouseOver:g,handleMouseLeave:v,wrapperMinHeight:b}=hS(n.editor,l,i,"editor-container",r),w=(S,A)=>{p.value&&(l.value={id:S.id,text:S.text,elementId:S.elementId,index:A},s.value=!0,u&&(a.value=!0))},x=S=>fd(S?n.superPreviewCustomClass?.completedSuper??"bg-black":n.superPreviewCustomClass?.unproducedSuper??"bg-red-500"),C=o.computed(()=>n.fontSize??""),E=o.computed(()=>n.fixedWidth??!1),{contentInner:k,measuredMinWidth:T}=pf({minChars:n.minChars,fontSize:C,fixed:E});return e({measuredMinWidthComment:T}),(S,A)=>{const V=Ot;return o.openBlock(),o.createElementBlock("div",{id:"super-text-view-wrapper",ref_key:"contentInner",ref:k,style:o.normalizeStyle({width:`${Number(o.unref(T))+25}px`,minHeight:`${o.unref(b)}px`}),class:o.normalizeClass(o.unref(ke)("relative border border-ed-gray-400 dark:bg-black rounded-[3px] mr-2.5",S.fixedWidth&&"overflow-hidden",S.superPreviewCustomClass?.overall??"bg-ed-gray-50"))},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(i.value,(O,B)=>(o.openBlock(),o.createElementBlock("div",{key:O.id,ref_for:!0,ref_key:"superTextRefs",ref:r,index:B,"book-mark-id":O.id,"line-id":O.lineId,class:o.normalizeClass(o.unref(ke)("super-text-view","absolute w-full px-2 translate-y-[-10px] group",{})),style:o.normalizeStyle({top:`${O.visiblePosition||O.position?.top}px`}),onMouseover:F=>o.unref(g)(F,B),onMouseleave:A[0]||(A[0]=(...F)=>o.unref(v)&&o.unref(v)(...F))},[o.createVNode(o.unref(pb),{role:"text",variant:"outline",class:o.normalizeClass(o.unref(ke)("w-full px-1 pt-0 m-0 !leading-tight rounded-sm text-white border-transparent cursor-pointer",S.fixedWidth?"whitespace-pre overflow-hidden":"wrap-anywhere whitespace-break-spaces",O.hoverElementId??O.elementId?S.superPreviewCustomClass?.completedSuper??"bg-black":S.superPreviewCustomClass?.unproducedSuper??"bg-red-500",{"cursor-default":!o.unref(p)})),onDblclick:F=>w(O,B)},{default:o.withCtx(()=>[o.createElementVNode("div",{class:"super-text-lines",style:o.normalizeStyle({fontWeight:f.value}),innerHTML:O.text},null,12,gte),o.createVNode(V,{name:"triangle",class:o.normalizeClass(["absolute top-[0.4em] rotate-90 w-3 h-3 right-0",x(O.hoverElementId??O.elementId)])},null,8,["class"])]),_:2},1032,["class","onDblclick"])],46,mte))),128)),!o.unref(u)&&l.value?(o.openBlock(),o.createBlock(Uc,{key:0,open:s.value,editor:n.editor,"super-text-init":l.value.text,"super-text-element-id":l.value.elementId,onClose:A[1]||(A[1]=O=>s.value=!1),onSave:o.unref(m)},null,8,["open","editor","super-text-init","super-text-element-id","onSave"])):o.createCommentVNode("",!0)],6)}}}),[["__scopeId","data-v-51843f23"]]),bte=["index","book-mark-id","line-id","onMouseover"],yte=["innerHTML"],wte=Xr(o.defineComponent({__name:"SuperTextViewComment",props:{editor:{},disableSuperInput:{type:Boolean},superPreviewCustomClass:{},fixedWidth:{type:Boolean}},setup(t){const e=t,n=o.ref([]),r=o.ref([]),i=o.ref(!1),s=o.ref(!1),a=o.ref(null),l=o.inject("isMobile",!1),u=o.inject("fontWeight",o.ref("")),c=o.computed(()=>e.fixedWidth&&o.unref(u)||"normal"),f=o.inject("isEditable",o.ref(!0)),{onUpdate:p,handleMouseOver:m,handleMouseLeave:g,wrapperMinHeight:v}=hS(e.editor,a,r,"editor-container-comment",n),b=(C,E)=>{f.value&&(a.value={id:C.id,text:C.text,elementId:C.elementId,index:E},e.disableSuperInput||(i.value=!0),l&&(s.value=!0))},w=C=>fd(C?e.superPreviewCustomClass?.completedSuper??"bg-black":e.superPreviewCustomClass?.unproducedSuper??"bg-red-500"),x=o.inject("measuredMinWidthComment",0);return(C,E)=>{const k=Ot;return o.openBlock(),o.createElementBlock("div",{id:"super-text-view-wrapper",style:o.normalizeStyle({width:`${Number(o.unref(x))+25}px`,minHeight:`${o.unref(v)}px`}),class:o.normalizeClass(o.unref(ke)("relative border border-ed-gray-400 dark:bg-black rounded-[3px] mr-2.5",C.fixedWidth&&"overflow-hidden",C.superPreviewCustomClass?.overall??"bg-ed-gray-50"))},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(r.value,(T,S)=>(o.openBlock(),o.createElementBlock("div",{key:T.id,ref_for:!0,ref_key:"superTextRefs",ref:n,index:S,"book-mark-id":T.id,"line-id":T.lineId,class:o.normalizeClass(o.unref(ke)("super-text-view","absolute w-full px-2 translate-y-[-10px] group",{})),style:o.normalizeStyle({top:`${T.visiblePosition||T.position?.top}px`}),onMouseover:A=>o.unref(m)(A,S),onMouseleave:E[0]||(E[0]=(...A)=>o.unref(g)&&o.unref(g)(...A))},[o.createVNode(o.unref(pb),{role:"text",variant:"outline",class:o.normalizeClass(o.unref(ke)("w-full px-1 pt-0 m-0 !leading-tight rounded-sm text-white border-transparent cursor-pointer",C.fixedWidth?"whitespace-pre overflow-hidden":"wrap-anywhere whitespace-break-spaces",T.elementId?C.superPreviewCustomClass?.completedSuper??"bg-black":C.superPreviewCustomClass?.unproducedSuper??"bg-red-500",{"cursor-default":!o.unref(f)})),onDblclick:A=>b(T,S)},{default:o.withCtx(()=>[o.createElementVNode("div",{class:"super-text-lines",style:o.normalizeStyle({fontWeight:c.value}),innerHTML:T.text},null,12,yte),o.createVNode(k,{name:"triangle",class:o.normalizeClass(["absolute top-[0.4em] rotate-90 w-3 h-3 right-0",w(T.elementId)])},null,8,["class"])]),_:2},1032,["class","onDblclick"])],46,bte))),128)),!o.unref(l)&&a.value&&!C.disableSuperInput?(o.openBlock(),o.createBlock(Uc,{key:0,open:i.value,editor:e.editor,"super-text-init":a.value.text,"super-text-element-id":a.value.elementId,onClose:E[1]||(E[1]=T=>i.value=!1),onSave:o.unref(p)},null,8,["open","editor","super-text-init","super-text-element-id","onSave"])):o.createCommentVNode("",!0)],6)}}}),[["__scopeId","data-v-2bddcb10"]]),mS=t=>{console.log(t),t=t.replace(/\s*style="[^"]*"/g,""),t=t.replace(/<iframe\b[\s\S]*?<\/iframe\s*>/gi,"");const e=t.match(/<!--StartFragment-->([\s\S]*?)<!--EndFragment-->/),r=(e?e[1]:t).replace(/<br\s*\/?>/gi,`
345
345
  `).split(/\r?\n/),i=[];for(const a of r){const l=a.trim();if(l==="")i.push("<p></p>");else if(/^<br\s*\/?>/i.test(l)){const u=l.replace(/^<br\s*\/?>/i,"").trim();i.push(`<p>${u}</p>`)}else if(/^<\/BR>/i.test(l)){const u=l.replace(/^<\/BR>/i,"").trim();i.push(`<p>${u}</p>`)}else/^<p\b/i.test(l)?i.push(l):i.push(`<p>${l}</p>`)}let s=i.join("");return s=s.replace(/<p\b[^>]*>/gi,"<p>"),s},Gb=t=>/^https?:\/\/[^\s]+$/i.test(t.trim()),Xb=(t,e)=>{const{tr:n,selection:r,schema:i}=t.state,s=i.marks.link.create({href:e});return r.empty?(t.dispatch(n.insertText(e,r.from).addMark(r.from,r.from+e.length,s)),!0):(t.dispatch(n.addMark(r.from,r.to,s)),!0)},xte=(t,e)=>{const{tr:n,schema:r}=t.state,i=e.split(/(?:\r\n?|\n)/),s=[];if(i.forEach(u=>{let c={type:"paragraph"};u.length>0&&(c.content=[{type:"text",text:u}]);let f=Br.fromJSON(r,c);s.push(f)}),s.length===0)return!1;const a=ge.fromArray(s),l=Se.maxOpen(a);return t.dispatch(n.replaceSelection(l)),!0},Cte=bn(),Ph=t=>{const e=o.computed(()=>Cte.state.spellCheck);o.watch(()=>e.value,n=>{t.view.dispatch(t.state.tr.setMeta(Un.IS_ACTIVE_SPELLCHECK,n)),t.extensionStorage.spellchecker.spellchecker.hideSuggestionBox(),fE(t)&&t.commands.focus()},{immediate:!0})},kte={id:"editor-container-comment",class:"flex flex-col"},Ete={class:"flex flex-1"},Ste={id:"editor-panel",class:"flex-1 p-2.5 border border-ed-gray-400 rounded-[3px] focus-within:border-ed-input-focus"},_te=o.defineComponent({__name:"EditorComment",props:{isMobile:{type:Boolean},superTextArea:{default:{view:!0,button:!0}},mode:{},modelValue:{default:""},comment:{},commentCuesheet:{},hideComment:{type:Boolean},disableSuperInput:{type:Boolean,default:!1},fontSizeDefault:{},fontFamilyDefault:{},fontWeightDefault:{},showSuperElementIdColor:{type:Boolean},letterSpacingDefault:{},contentTextStyle:{},isOpenSuperView:{type:Boolean,default:!0},output:{default:"html"},dark:{type:Boolean,default:void 0},disabled:{type:Boolean,default:!1},hideToolbar:{type:Boolean,default:!1},isShowFormatControlBar:{type:Boolean},customClassFormatControlBar:{},titleBarComment:{},titleBarContent:{},fieldNameComment:{},fieldNameCommentCuesheet:{},fieldNameContent:{},fieldNameSuper:{},isScreenSplit:{},isShowLineNumber:{type:Boolean},hideMenubar:{type:Boolean},disableBubble:{type:Boolean,default:!1},hideBubble:{type:Boolean,default:!1},maxWidth:{default:void 0},minHeight:{default:600},maxHeight:{default:void 0},height:{},extensions:{default:()=>[]},editorClass:{default:void 0},contentClass:{default:void 0},isCompare:{type:Boolean},autoHeight:{type:Boolean},textAlert:{},customClassToolbar:{},readonly:{type:Boolean,default:!1},canEditSuperReadOnly:{type:Boolean},autoFocus:{type:Boolean},superPreviewCustomClass:{default:void 0},minChar:{},isAccordion:{type:Boolean},contentAutoCopied:{},isEditorView:{type:Boolean},isEditorViewSplitContent:{type:Boolean},editorContentInstance:{},toolbarExtensionOrder:{},watermarkOverlay:{},bottomOffset:{},characterCountLimit:{},blockSeparatorPolicy:{},fixedSuperPreviewWidth:{type:Boolean}},emits:["enter","change","update:modelValue","update:comment","onFocusEditor","changed:selection","setEditorSelected","onBlurEditor","lineFocus","onFocus","onBlur"],setup(t,{expose:e,emit:n}){const r=t,i=n,s=ct.useEventBus(ur.RENDER_SUPER_TEXT),a=o.useAttrs(),l=bn(),{isReady:u,editor:c,updateEditorState:f,superTextStore:p,checkSpellStore:m,setEditorContextMenuRef:g,setEditorFocusedInstance:v}=l,b=o.inject("isEditable",o.ref(!0)),w=new Oo({enablePasteRules:!1,enableInputRules:!1,content:un(r.modelValue,r.disabled),editorProps:{attributes:{id:ir.COMMENT,[ir.DISABLE_SUPER_INPUT]:`${r.disableSuperInput}`},handleKeyDown:St.throttle((S,A)=>A.key==="Enter"&&a.enter&&!A.shiftKey?(i("enter"),!0):!1,Lo),transformPastedHTML:S=>mS(S),handlePaste:(S,A)=>{const V=A.clipboardData;if(!V)return!1;const O=r.mode,B=V.getData("text/plain")||"",F=Array.from(V.items).some(j=>j.type.startsWith("image/"));return(O===Te.STRAIGHT||O===Te.REPORT)&&F?(A.preventDefault(),!0):O===Te.PLAIN_TEXT?(A.preventDefault(),S.dispatch(S.state.tr.insertText(B,S.state.selection.from)),!0):!1},clipboardTextParser:(S,A)=>{const V=S.split(/(?:\r\n?|\n)/),O=[];V.forEach(F=>{let j={type:"paragraph"};F.length>0&&(j.content=[{type:"text",text:F}]);let Y=Br.fromJSON(A.doc.type.schema,j);O.push(Y)});const B=ge.fromArray(O);return Se.maxOpen(B)}},onCreate:({editor:S})=>{f(S)},onUpdate:St.throttle(({editor:S})=>{u.value=!0;const A=C(S,r.output);i("update:modelValue",A),i("change",{editor:S,output:A}),f(S),x()},Lo),extensions:r.extensions,editable:b.value,onFocus:S=>{g(E.value),v(S.editor)}});async function x(){await o.nextTick(),s.emit({action:"render"})}function C(S,A){if(!S)return"";if(S.isEmpty)return A==="json"?{}:"";switch(A){case"html":return S.getHTML();case"json":return S.getJSON();case"text":return S.getText();default:return""}}o.watch(()=>r.disableSuperInput,()=>{document.getElementById(ir.COMMENT)?.setAttribute(ir.DISABLE_SUPER_INPUT,`${r.disableSuperInput}`)}),o.watch(()=>m.languages,()=>{w.commands.checkSpelling()}),o.watch(()=>r.modelValue,S=>{if(!w||St.isEqual(C(w,r.output),S))return;const{from:A,to:V}=w.state.selection;w.commands.setTextSelection({from:A,to:V}),w.commands.setContent(un(S,r.disabled),!1),x()},{deep:!0}),o.watch(()=>b.value,S=>{w?.setEditable(S),w?.commands?.setIsEnableSuggestion&&w.commands.setIsEnableSuggestion(S)},{immediate:!0}),o.watch(()=>c.value,()=>{c.value&&c.value.on("selectionUpdate",({editor:S})=>{i("changed:selection",{editor:S})})}),o.onUnmounted(()=>w?.destroy()),Ju(ju.SAVE,()=>{localStorage.setItem("comment",C(w,"html"))});const E=o.ref(null);function k(S){S===Te.REPORT&&g(E.value)}function T(S){S===Te.REPORT&&v(w)}return o.onMounted(()=>{k(r.mode),T(r.mode)}),o.watch(()=>r.mode,S=>{k(S),T(S)}),o.watch(()=>r.editorContentInstance?.storage[sh]?.enabled,()=>{w.commands.toggleTimeHighlight()}),Ph(w),e({editor:w}),(S,A)=>(o.openBlock(),o.createElementBlock("div",kte,[o.createElementVNode("div",Ete,[S.isOpenSuperView?(o.openBlock(),o.createBlock(wte,{key:0,"disable-super-input":S.disableSuperInput,editor:o.unref(w),"super-preview-custom-class":S.superPreviewCustomClass,"fixed-width":S.fixedSuperPreviewWidth},null,8,["disable-super-input","editor","super-preview-custom-class","fixed-width"])):o.createCommentVNode("",!0),o.createElementVNode("div",Ste,[o.createVNode(Mb,{ref_key:"selectContextMenuRef",ref:E,"disable-super-input":S.disableSuperInput,editor:o.unref(w),mode:S.mode,"super-text-store":o.unref(p)},{default:o.withCtx(()=>[o.createVNode(o.unref(Yn),{editor:o.unref(w),spellcheck:"true",class:"h-full break-all"},null,8,["editor"])]),_:1},8,["disable-super-input","editor","mode","super-text-store"])])])]))}});function Tte(t,e,n=!1,r=200){const{height:i}=ct.useElementSize(t),s=o.ref(0),a=o.ref(0),l=o.ref(r),u=o.ref(0),c=async()=>{await o.nextTick();const f=i.value-8;e.value===Te.REPORT?(s.value=f/3,a.value=n?"auto":f-s.value,l.value=r/3*2,u.value=r/3):(s.value=0,a.value=n?"auto":i.value)};return n||o.watch(()=>i.value,c),o.onMounted(()=>{c()}),{commentHeight:s,contentHeight:a,minHeight:l,minHeightComment:u}}var Ate={exports:{}};(function(t){(function(){var e=["ㄱ","ㄲ","ㄴ","ㄷ","ㄸ","ㄹ","ㅁ","ㅂ","ㅃ","ㅅ","ㅆ","ㅇ","ㅈ","ㅉ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"],n=["ㅏ","ㅐ","ㅑ","ㅒ","ㅓ","ㅔ","ㅕ","ㅖ","ㅗ",["ㅗ","ㅏ"],["ㅗ","ㅐ"],["ㅗ","ㅣ"],"ㅛ","ㅜ",["ㅜ","ㅓ"],["ㅜ","ㅔ"],["ㅜ","ㅣ"],"ㅠ","ㅡ",["ㅡ","ㅣ"],"ㅣ"],r=["","ㄱ","ㄲ",["ㄱ","ㅅ"],"ㄴ",["ㄴ","ㅈ"],["ㄴ","ㅎ"],"ㄷ","ㄹ",["ㄹ","ㄱ"],["ㄹ","ㅁ"],["ㄹ","ㅂ"],["ㄹ","ㅅ"],["ㄹ","ㅌ"],["ㄹ","ㅍ"],["ㄹ","ㅎ"],"ㅁ","ㅂ",["ㅂ","ㅅ"],"ㅅ","ㅆ","ㅇ","ㅈ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"],i=44032,s=["ㄱ","ㄲ","ㄳ","ㄴ","ㄵ","ㄶ","ㄷ","ㄸ","ㄹ","ㄺ","ㄻ","ㄼ","ㄽ","ㄾ","ㄿ","ㅀ","ㅁ","ㅂ","ㅃ","ㅄ","ㅅ","ㅆ","ㅇ","ㅈ","ㅉ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"],a=["ㄱ","ㄲ","ㄴ","ㄷ","ㄸ","ㄹ","ㅁ","ㅂ","ㅃ","ㅅ","ㅆ","ㅇ","ㅈ","ㅉ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"],l=["ㅏ","ㅐ","ㅑ","ㅒ","ㅓ","ㅔ","ㅕ","ㅖ","ㅗ","ㅘ","ㅙ","ㅚ","ㅛ","ㅜ","ㅝ","ㅞ","ㅟ","ㅠ","ㅡ","ㅢ","ㅣ"],u=["","ㄱ","ㄲ","ㄳ","ㄴ","ㄵ","ㄶ","ㄷ","ㄹ","ㄺ","ㄻ","ㄼ","ㄽ","ㄾ","ㄿ","ㅀ","ㅁ","ㅂ","ㅄ","ㅅ","ㅆ","ㅇ","ㅈ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"],c=[["ㄱ","ㅅ","ㄳ"],["ㄴ","ㅈ","ㄵ"],["ㄴ","ㅎ","ㄶ"],["ㄹ","ㄱ","ㄺ"],["ㄹ","ㅁ","ㄻ"],["ㄹ","ㅂ","ㄼ"],["ㄹ","ㅅ","ㄽ"],["ㄹ","ㅌ","ㄾ"],["ㄹ","ㅍ","ㄿ"],["ㄹ","ㅎ","ㅀ"],["ㅂ","ㅅ","ㅄ"]],f=[["ㅗ","ㅏ","ㅘ"],["ㅗ","ㅐ","ㅙ"],["ㅗ","ㅣ","ㅚ"],["ㅜ","ㅓ","ㅝ"],["ㅜ","ㅔ","ㅞ"],["ㅜ","ㅣ","ㅟ"],["ㅡ","ㅣ","ㅢ"]],p,m,g,v,b,w;function x(P){for(var q=P.length,G={0:0},se=0;se<q;se++)P[se]&&(G[P[se].charCodeAt(0)]=se);return G}p=x(s),m=x(a),g=x(l),v=x(u);function C(P){for(var q=P.length,G={},se,fe,Ee=0;Ee<q;Ee++)se=P[Ee][0].charCodeAt(0),fe=P[Ee][1].charCodeAt(0),typeof G[se]>"u"&&(G[se]={}),G[se][fe]=P[Ee][2].charCodeAt(0);return G}b=C(c),w=C(f);function E(P){return typeof p[P]<"u"}function k(P){return typeof m[P]<"u"}function T(P){return typeof g[P]<"u"}function S(P){return typeof v[P]<"u"}function A(P){return 44032<=P&&P<=55203}function V(P,q){return w[P]&&w[P][q]?w[P][q]:!1}function O(P,q){return b[P]&&b[P][q]?b[P][q]:!1}var B=function(P,q){if(P===null)throw new Error("Arguments cannot be null");typeof P=="object"&&(P=P.join(""));for(var G=[],se=P.length,fe,Ee,ae,me,J,ee=0;ee<se;ee++){var ne=[];me=P.charCodeAt(ee),A(me)?(me-=i,ae=me%28,Ee=(me-ae)/28%21,fe=parseInt((me-ae)/28/21),ne.push(e[fe]),typeof n[Ee]=="object"?ne=ne.concat(n[Ee]):ne.push(n[Ee]),ae>0&&(typeof r[ae]=="object"?ne=ne.concat(r[ae]):ne.push(r[ae]))):E(me)?(k(me)?J=e[m[me]]:J=r[v[me]],typeof J=="string"?ne.push(J):ne=ne.concat(J)):T(me)?(J=n[g[me]],typeof J=="string"?ne.push(J):ne=ne.concat(J)):ne.push(P.charAt(ee)),q?G.push(ne):G=G.concat(ne)}return G},F=function(P){return typeof P!="string"?"":(P=B(P),P.join(""))},j=function(P){typeof P=="string"&&(P=B(P));var q=[],G=P.length,se,fe=0,Ee=-1,ae,me=!1;function J(ne){var oe,ce,_e,Ae=0,Ue,We="";if(me=!1,!(Ee+1>ne))for(var qe=1;;qe++){if(qe===1){if(oe=P[Ee+qe].charCodeAt(0),T(oe))if(Ee+qe+1<=ne&&T(ce=P[Ee+qe+1].charCodeAt(0))){q.push(String.fromCharCode(V(oe,ce))),Ee=ne;return}else{q.push(P[Ee+qe]),Ee=ne;return}else if(!k(oe)){q.push(P[Ee+qe]),Ee=ne;return}We=P[Ee+qe]}else if(qe===2)if(ce=P[Ee+qe].charCodeAt(0),k(ce)){oe=O(oe,ce),We=String.fromCharCode(oe),q.push(We),Ee=ne;return}else We=String.fromCharCode((m[oe]*21+g[ce])*28+i);else qe===3?(_e=P[Ee+qe].charCodeAt(0),V(ce,_e)?ce=V(ce,_e):Ae=_e,We=String.fromCharCode((m[oe]*21+g[ce])*28+v[Ae]+i)):qe===4?(Ue=P[Ee+qe].charCodeAt(0),O(Ae,Ue)?Ae=O(Ae,Ue):Ae=Ue,We=String.fromCharCode((m[oe]*21+g[ce])*28+v[Ae]+i)):qe===5&&(Ue=P[Ee+qe].charCodeAt(0),Ae=O(Ae,Ue),We=String.fromCharCode((m[oe]*21+g[ce])*28+v[Ae]+i));if(Ee+qe>=ne){q.push(We),Ee=ne;return}}}for(var ee=0;ee<G;ee++){if(se=P[ee].charCodeAt(0),!k(se)&&!T(se)&&!S(se)){J(ee-1),J(ee),fe=0;continue}fe===0?k(se)?fe=1:T(se)&&(fe=4):fe==1?T(se)?fe=2:O(ae,se)?fe=5:J(ee-1):fe==2?S(se)?fe=3:T(se)?V(ae,se)||(J(ee-1),fe=4):(J(ee-1),fe=1):fe==3?S(se)?!me&&O(ae,se)?me=!0:(J(ee-1),fe=1):k(se)?(J(ee-1),fe=1):T(se)&&(J(ee-2),fe=2):fe==4?T(se)?V(ae,se)?(J(ee),fe=0):J(ee-1):(J(ee-1),fe=1):fe==5&&(T(se)?(J(ee-2),fe=2):(J(ee-1),fe=1)),ae=se}return J(ee-1),q.join("")},Y=function(P,q){var G=B(P).join(""),se=B(q).join("");return G.indexOf(se)},N=function(P,q){var G=B(P).join(""),se=B(q).join(""),fe=B(P,!0),Ee=new RegExp(se,"gi"),ae=[],me;if(!q.length)return[];for(;me=Ee.exec(G);)ae.push(me.index);function J(ne){for(var oe=0,ce=0;oe<fe.length;++oe)if(ce+=fe[oe].length,ne<ce)return oe}function ee(ne){for(var oe=0,ce=0;oe<fe.length;++oe)if(ce+=fe[oe].length,ne+se.length<=ce)return oe}return ae.map(function(ne){return[J(ne),ee(ne)]})};function H(P){this.string=P,this.disassembled=B(P).join("")}H.prototype.search=function(P){return B(P).join("").indexOf(this.disassembled)};var D=function(P){typeof P=="object"&&(P=P.join(""));var q=P.charCodeAt(P.length-1);if(A(q)){q-=i;var G=q%28;if(G>0)return!0}else if(E(q))return!0;return!1},L=function(P,q){return B(P).pop()===q},W={disassemble:B,d:B,disassembleToString:F,ds:F,assemble:j,a:j,search:Y,rangeSearch:N,Searcher:H,endsWithConsonant:D,endsWith:L,isHangul:function(P){return typeof P=="string"&&(P=P.charCodeAt(0)),A(P)},isComplete:function(P){return typeof P=="string"&&(P=P.charCodeAt(0)),A(P)},isConsonant:function(P){return typeof P=="string"&&(P=P.charCodeAt(0)),E(P)},isVowel:function(P){return typeof P=="string"&&(P=P.charCodeAt(0)),T(P)},isCho:function(P){return typeof P=="string"&&(P=P.charCodeAt(0)),k(P)},isJong:function(P){return typeof P=="string"&&(P=P.charCodeAt(0)),S(P)},isHangulAll:function(P){if(typeof P!="string")return!1;for(var q=0;q<P.length;q++)if(!A(P.charCodeAt(q)))return!1;return!0},isCompleteAll:function(P){if(typeof P!="string")return!1;for(var q=0;q<P.length;q++)if(!A(P.charCodeAt(q)))return!1;return!0},isConsonantAll:function(P){if(typeof P!="string")return!1;for(var q=0;q<P.length;q++)if(!E(P.charCodeAt(q)))return!1;return!0},isVowelAll:function(P){if(typeof P!="string")return!1;for(var q=0;q<P.length;q++)if(!T(P.charCodeAt(q)))return!1;return!0},isChoAll:function(P){if(typeof P!="string")return!1;for(var q=0;q<P.length;q++)if(!k(P.charCodeAt(q)))return!1;return!0},isJongAll:function(P){if(typeof P!="string")return!1;for(var q=0;q<P.length;q++)if(!S(P.charCodeAt(q)))return!1;return!0}};t.exports=W})()})(Ate);const Yl=new Et("searchHighlight");function Vh(t,e,n){const r=[];if(!e)return r;const i=n.caseSensitive?e.normalize("NFC"):e.normalize("NFC").toLowerCase(),{doc:s}=t.state,a=l=>/[0-9A-Za-z가-힣_]/.test(l);return s.descendants((l,u)=>{if(!l.isText||!l.text)return;let c=l.text.normalize("NFC");n.caseSensitive||(c=c.toLowerCase());let f=0,p=c.indexOf(i,f);for(;p!==-1;){const m=p,g=p+i.length-1;if(n.wholeWord){const v=m>0?c[m-1]:"",b=g+1<c.length?c[g+1]:"";if(v&&a(v)||b&&a(b)){f=p+1,p=c.indexOf(i,f);continue}}r.push({from:u+m,to:u+g+1}),f=p+i.length,p=c.indexOf(i,f)}}),r}function Yb(t){return t.state.selection.from}function gS(t){if(t.state.plugins.find(r=>r.spec.key===Yl))return;const n=new ot({key:Yl,state:{init(){return lt.empty},apply(r,i){const s=r.getMeta(Yl);return s!==void 0?s:i.map(r.mapping,r.doc)}},props:{decorations(r){return Yl.getState(r)}}});t.registerPlugin(n)}function vS(t,e,n){gS(t);const r=e.map((a,l)=>jt.inline(a.from,a.to,{class:l===n?"search-match-active":"search-match"})),i=lt.create(t.state.doc,r),s=t.state.tr.setMeta(Yl,i);t.view.dispatch(s)}function Jl(t){gS(t);const e=t.state.tr.setMeta(Yl,lt.empty);t.view.dispatch(e)}function Mte(t){const e=o.ref(-1),n=o.ref([]),r=o.computed(()=>n.value.length);function i(p){const m=t.value;if(!m||n.value.length===0)return;const g=n.value.length;e.value=(p%g+g)%g,vS(m,n.value,e.value);const v=n.value[e.value];m.view.domAtPos(v.from).node?.scrollIntoView?.({block:"nearest",behavior:"smooth"}),m.chain().setTextSelection({from:v.from,to:v.to}).scrollIntoView().run()}function s(p){const m=t.value;if(!m)return;if(n.value=Vh(m,p.find,p),n.value.length===0){e.value=-1,Jl(m);return}const g=Yb(m),v=n.value.findIndex(b=>b.from>g);i(v===-1?0:v)}function a(p){const m=t.value;if(!m)return;if(n.value=Vh(m,p.find,p),n.value.length===0){e.value=-1,Jl(m);return}const g=Yb(m);let v=-1;for(let b=n.value.length-1;b>=0;b--)if(n.value[b].to<g){v=b;break}i(v===-1?n.value.length-1:v)}function l(p){const m=t.value;if(!m||e.value===-1||n.value.length===0)return;const g=n.value[e.value],{state:v}=m,b=v.doc.textBetween(g.from,g.to);if(!(p.caseSensitive?b===p.find:b.toLowerCase()===p.find.toLowerCase())){s(p);return}m.chain().focus().setTextSelection({from:g.from,to:g.to}).insertContent(p.replace).run(),s(p)}function u(p){const m=t.value;if(!m)return;const g=Vh(m,p.find,p);if(g.length===0)return;const v=m.chain().focus();[...g].reverse().forEach(b=>{v.setTextSelection({from:b.from,to:b.to}).insertContent(p.replace)}),v.run(),n.value=[],e.value=-1,Jl(m)}function c(p){const m=t.value;if(!m)return;if(!p.find){n.value=[],e.value=-1,Jl(m);return}if(n.value=Vh(m,p.find,p),n.value.length===0){e.value=-1,Jl(m);return}const g=Yb(m),v=n.value.findIndex(w=>w.from>=g),b=v===-1?0:v;e.value=b,i(b),vS(m,n.value,b)}function f(){const p=t.value;p&&(n.value=[],e.value=-1,Jl(p))}return{searchUp:a,searchDown:s,replaceCurrent:l,replaceAll:u,totalMatches:r,currentMatchIndex:o.readonly(e),refreshMatches:c,clearSearch:f}}const bS={black:[0,0,0],navy:[0,0,128],darkblue:[0,0,139],mediumblue:[0,0,205],darkgreen:[0,100,0],darkcyan:[0,139,139],darkred:[139,0,0],maroon:[128,0,0],purple:[128,0,128],olive:[128,128,0],darkmagenta:[139,0,139],darkviolet:[148,0,211],indigo:[75,0,130],midnightblue:[25,25,112],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkolivegreen:[85,107,47],dimgray:[105,105,105],dimgrey:[105,105,105],saddlebrown:[139,69,19],sienna:[160,82,45],brown:[165,42,42],teal:[0,128,128]},yS=.4,wS=.6;let Fh=null;const Gc=new Map;function Ote(){if(Fh)return Fh;if(typeof document>"u")return null;const t=document.createElement("canvas");return t.width=1,t.height=1,Fh=t.getContext("2d"),Fh}function Bte(t){if(Gc.has(t))return Gc.get(t)??null;const e=Ote();if(!e)return null;e.fillStyle="#000";try{e.fillStyle=t}catch{return Gc.set(t,null),null}const r=e.fillStyle.toLowerCase();if(r==="#000000"&&t.trim().toLowerCase()!=="#000"&&t.trim().toLowerCase()!=="#000000"&&t.trim().toLowerCase()!=="black")return Gc.set(t,null),null;let i=null;const s=r.match(/^#([0-9a-f]{6})$/);if(s)i={r:parseInt(s[1].slice(0,2),16),g:parseInt(s[1].slice(2,4),16),b:parseInt(s[1].slice(4,6),16),a:1};else{const a=r.match(/^rgba?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)(?:\s*,\s*([\d.]+))?\s*\)$/);a&&(i={r:Math.round(parseFloat(a[1])),g:Math.round(parseFloat(a[2])),b:Math.round(parseFloat(a[3])),a:a[4]!==void 0?Math.max(0,Math.min(1,parseFloat(a[4]))):1})}return Gc.set(t,i),i}function $h(t){if(!t)return null;const e=t.trim().toLowerCase();if(bS[e]){const[i,s,a]=bS[e];return{r:i,g:s,b:a,a:1}}const n=e.match(/^#([0-9a-f]{3,8})$/);if(n){const i=n[1];if(i.length===3)return{r:parseInt(i[0]+i[0],16),g:parseInt(i[1]+i[1],16),b:parseInt(i[2]+i[2],16),a:1};if(i.length===4)return{r:parseInt(i[0]+i[0],16),g:parseInt(i[1]+i[1],16),b:parseInt(i[2]+i[2],16),a:parseInt(i[3]+i[3],16)/255};if(i.length===6)return{r:parseInt(i.slice(0,2),16),g:parseInt(i.slice(2,4),16),b:parseInt(i.slice(4,6),16),a:1};if(i.length===8)return{r:parseInt(i.slice(0,2),16),g:parseInt(i.slice(2,4),16),b:parseInt(i.slice(4,6),16),a:parseInt(i.slice(6,8),16)/255}}const r=e.match(/^rgba?\(\s*(\d+)[\s,]+(\d+)[\s,]+(\d+)(?:[\s,\/]+([\d.]+))?/);return r?{r:parseInt(r[1],10),g:parseInt(r[2],10),b:parseInt(r[3],10),a:r[4]!==void 0?Math.max(0,Math.min(1,parseFloat(r[4]))):1}:Bte(e)}function Hh(t,e,n){const[r,i,s]=[t/255,e/255,n/255].map(a=>a<=.04045?a/12.92:Math.pow((a+.055)/1.055,2.4));return .2126*r+.7152*i+.0722*s}function xS(t,e=yS){const n=$h(t);return n?Hh(n.r,n.g,n.b)<e:!1}function CS(t,e=wS){const n=$h(t);return n?Hh(n.r,n.g,n.b)>e:!1}function kS(t,e,n){const r=t/255,i=e/255,s=n/255,a=Math.max(r,i,s),l=Math.min(r,i,s),u=(a+l)/2;if(a===l)return[0,0,u];const c=a-l,f=u>.5?c/(2-a-l):c/(a+l);let p=0;return a===r?p=((i-s)/c+(i<s?6:0))/6:a===i?p=((s-r)/c+2)/6:p=((r-i)/c+4)/6,[p,f,u]}function ES(t,e,n){if(e===0){const a=Math.round(n*255);return[a,a,a]}const r=(a,l,u)=>(u<0&&(u+=1),u>1&&(u-=1),u<1/6?a+(l-a)*6*u:u<1/2?l:u<2/3?a+(l-a)*(2/3-u)*6:a),i=n<.5?n*(1+e):n+e-n*e,s=2*n-i;return[Math.round(r(s,i,t+1/3)*255),Math.round(r(s,i,t)*255),Math.round(r(s,i,t-1/3)*255)]}function SS(t,e,n,r){return r<1?`rgba(${t}, ${e}, ${n}, ${Number(r.toFixed(3))})`:`rgb(${t}, ${e}, ${n})`}function _S(t){const e=$h(t);if(!e||Hh(e.r,e.g,e.b)>=yS)return t;const[r,i,s]=kS(e.r,e.g,e.b),a=s<.5?1-s:s,[l,u,c]=ES(r,i,a);return SS(l,u,c,e.a)}const Ite=.4,Lte=.18;function TS(t){const e=$h(t);if(!e||Hh(e.r,e.g,e.b)<=wS)return t;const[r,i,s]=kS(e.r,e.g,e.b),a=s>.5?1-s:s,l=Math.min(a,Lte),u=i*Ite,[c,f,p]=ES(r,u,l);return SS(c,f,p,e.a)}function Rte(t){if(!t)return t;const e=document.createElement("div");return e.innerHTML=t,e.querySelectorAll("[style]").forEach(r=>{const i=r.style.color;i&&xS(i)&&(r.style.color=_S(i));const s=r.style.backgroundColor;s&&CS(s)&&(r.style.backgroundColor=TS(s))}),e.innerHTML}function Dte(t,e,n,r){let i=null;const s=`dco-${Math.random().toString(36).slice(2,8)}`;let a=null,l=null,u=null,c=null;const f=o.ref(!1);function p(k){c===k&&u||(m(),u=new MutationObserver(()=>E()),u.observe(k,{attributes:!0,subtree:!0,attributeFilter:["style"],childList:!0}),c=k)}function m(){u&&(u.disconnect(),u=null),c&&(c.removeAttribute("data-dark-scope"),c=null)}function g(){return!!(e.value||r.value?.closest(".dark")||document.documentElement.classList.contains("dark"))}function v(){f.value=g()}function b(){const k=new Set;return t?.state?.doc&&t.state.doc.descendants(T=>{T.marks.forEach(S=>{S.type.name==="textStyle"&&S.attrs.color&&k.add(S.attrs.color)})}),k}function w(){const k=b(),T=[];return k.forEach(S=>{if(xS(S)){const A=_S(S),V=S.replace(/"/g,'\\"');T.push(`[data-dark-scope="${s}"] span[style*="color: ${V}"] { color: ${A} !important; }`)}}),T.join(`
346
346
  `)}function x(){const k=r.value;if(!k)return"";const T=k.querySelectorAll('[style*="background-color"]'),S=/background-color\s*:\s*([^;"]+?)(?=\s*(?:;|$))/gi,A=new Set,V=[];return T.forEach(O=>{const B=O.getAttribute("style");if(!B)return;let F;S.lastIndex=0;let j=null,Y=null;for(;(F=S.exec(B))!==null;)j=F[0],Y=F[1].trim();if(!j||!Y||!CS(Y))return;const N=TS(Y);if(N===Y||A.has(j))return;A.add(j);const H=j.replace(/\\/g,"\\\\").replace(/"/g,'\\"');V.push(`[data-dark-scope="${s}"] [style*="${H}"] { background-color: ${N} !important; }`)}),V.join(`
347
347
  `)}function C(){if(!i)return;if(v(),!f.value||n.value){i.textContent="";return}const k=w(),T=x();i.textContent=[k,T].filter(Boolean).join(`