vdc-editor 0.1.216 → 0.1.217

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.
@@ -290,7 +290,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`),oe=P,G=q),J===void 0&&
290
290
  `){Q.push(D),D="";continue}if(D+=H,E.measureText(D).width>M())for(;E.measureText(D).width>M();){const F=j(D,M());F<=0?(Q.push(D.charAt(0)),D=D.slice(1)):(Q.push(D.slice(0,F)),D=D.slice(F))}}return Q.push(D),Q.map(H=>`<p>${H}</p>`).join("")}const{isScrolling:_,handleScroll:A}=wa();return e({insertSpecialCharater:m,isChecked:u,toggleSpellCheck:g,wrapText:C}),(T,L)=>(o.openBlock(),o.createElementBlock("div",{ref_key:"contentInner",ref:b,style:o.normalizeStyle(o.unref(x)),onScroll:L[0]||(L[0]=(...I)=>o.unref(A)&&o.unref(A)(...I)),class:o.normalizeClass(o.unref(ke)("h-40 overflow-y-auto border focus-within:border-ed-input-focus rounded-[3px] p-2.5",T.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(_)&&"scrollbar-thumb-transparent"))},[o.createVNode(o.unref(Xn),{id:"editor-panel",editor:o.unref(p),class:o.normalizeClass(o.unref(ke)("vdc-editor relative h-full"))},null,8,["editor","class"])],38))}}),Zq={class:"sr-only"},Qq={class:"grid m-2.5 p-2.5 gap-y-2.5 rounded border border-gray-200"},Nq={class:"grid grid-cols-[70px,1fr] gap-x-2"},eK={class:"flex gap-x-7"},tK={class:"flex items-center space-x-2 text-xs font-normal"},nK={for:"spellcheck",class:"select-none whitespace-nowrap"},rK={class:"flex gap-x-1"},oK={class:"grid grid-cols-[70px,1fr] gap-x-2"},iK={class:"text-right text-sm p-2"},sK={class:"grid grid-cols-[70px,1fr] gap-x-2"},mc=o.defineComponent({__name:"SuperInputDialog",props:{editor:{},open:{type:Boolean},superTextInit:{},superTextElementId:{}},emits:["close","save"],setup(t,{emit:e}){var j,D;const n=e,r=t,{t:i}=Ot(),s=o.ref(""),a=o.ref(""),l=o.ref(null),u=o.ref(!1),c=o.reactive({x:0,y:0}),f=o.ref(!1),p={x:0,y:0},m=o.ref(!1),g=o.ref(!1),b=Q=>{f.value=!0,p.x=Q.clientX-c.x,p.y=Q.clientY-c.y,document.addEventListener("mousemove",v),document.addEventListener("mouseup",w)},v=Q=>{f.value&&(c.x=Q.clientX-p.x,c.y=Q.clientY-p.y)},w=()=>{f.value=!1,document.removeEventListener("mousemove",v),document.removeEventListener("mouseup",w)};o.watch(()=>r.open,async Q=>{if(Q){g.value=!1,r.superTextInit&&(s.value=r.superTextInit,r.superTextElementId&&(a.value=r.superTextElementId)),await o.nextTick();const te=document.querySelector(".draggable-dialog");if(te){const{width:H,height:F}=te.getBoundingClientRect(),P=window.innerHeight;c.x=0,c.y=(P-F)/2}}},{immediate:!0});const x=()=>{n("close"),s.value="",a.value="",u.value=!1},k=()=>{s.value=l.value.wrapText(),a.value="",g.value?m.value=!0:n("close"),n("save",s.value),s.value=""},E=()=>{m.value=!1,n("close")},C=(D=(j=r.editor)==null?void 0:j.extensionManager.extensions.find(Q=>Q.name==="superText"))==null?void 0:D.options.specialCharModal,_=mt.useLocalStorage("recentSpecialChars",[]),A=Q=>{if(!Q)return;const te=(_.value??[]).filter(H=>H!==Q);te.unshift(Q),_.value=te.slice(0,5)},T=Q=>{var te;(te=l.value)==null||te.insertSpecialCharater(Q)},L=(Q,te)=>{var H;te&&((H=l.value)==null||H.insertSpecialCharater(Q),A(Q))},I=o.computed(()=>{var Q;return(Q=l.value)==null?void 0:Q.isChecked}),M=()=>{var Q;(Q=l.value)==null||Q.toggleSpellCheck()};return o.onUnmounted(()=>{document.removeEventListener("mousemove",v),document.removeEventListener("mouseup",w)}),o.watch(s,Q=>{!r.superTextElementId||r.superTextElementId===""||(g.value=Q!==(r.superTextInit??""))}),(Q,te)=>{const H=Ap,F=Tp,P=_p,q=mb,J=hb,G=Sp,oe=kp,xe=Jq;return o.openBlock(),o.createElementBlock(o.Fragment,null,[o.createVNode(oe,{open:Q.open},{default:o.withCtx(()=>[o.createVNode(o.unref(Z0),null,{default:o.withCtx(()=>[o.createVNode(o.unref(r1),{class:"!pointer-events-none bg-black/30"}),o.createVNode(G,{"is-overlay-transparent":"",class:"p-0 gap-0 !animate-none !transition-none max-w-max","as-child":""},{default:o.withCtx(()=>{var Ce,He,Oe;return[o.createElementVNode("div",{class:"draggable-dialog fixed z-[70] pointer-events-auto",style:o.normalizeStyle({transform:`translate(${c.x}px, ${c.y}px)`,top:"0px",left:"auto",right:"15px"})},[o.createVNode(P,{class:"bg-blue-500 text-white p-2.5 rounded-t-[5px] cursor-move",onMousedown:o.withModifiers(b,["prevent"])},{default:o.withCtx(()=>[o.createVNode(H,null,{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(i)("editor.superinput")),1)]),_:1}),o.createVNode(F,{class:"absolute right-3 top-3 text-white",onClick:x},{default:o.withCtx(()=>[o.createVNode(o.unref(Ff),{class:"w-5 h-5"}),o.createElementVNode("span",Zq,o.toDisplayString(Q.$t("editor.close")),1)]),_:1})]),_:1}),o.createVNode(q),o.createElementVNode("div",Qq,[o.createElementVNode("div",Nq,[te[4]||(te[4]=o.createElementVNode("label",null," ",-1)),o.createElementVNode("div",eK,[o.createVNode(wn,{class:"text-[#65558F] bg-[#ECE6F0] hover:bg-[#ECE6F0]/90 shadow text-xs rounded font-normal h-[25px] px-3",onClick:te[0]||(te[0]=De=>u.value=!0)},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(i)("editor.insert.symbol")),1)]),_:1}),o.createElementVNode("div",tK,[o.createVNode(fE,{id:"spellcheck",checked:o.unref(I),"onUpdate:checked":M},null,8,["checked"]),o.createElementVNode("label",nK,o.toDisplayString(o.unref(i)("editor.menubar.menu.spellCheck")),1)]),o.createElementVNode("div",rK,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(o.unref(_),De=>(o.openBlock(),o.createBlock(wn,{key:De,variant:"outline",size:"xs",class:"h-[25px] w-[25px] p-0",onClick:Z=>T(De)},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(De),1)]),_:2},1032,["onClick"]))),128))])]),u.value?(o.openBlock(),o.createBlock(o.resolveDynamicComponent((Ce=o.unref(C))==null?void 0:Ce.component),{key:0,"custom-class":"!z-[70] !pointer-events-auto",class:o.normalizeClass((Oe=(He=o.unref(C))==null?void 0:He.componentProps)==null?void 0:Oe.class),onSelectedChar:L,onClose:te[1]||(te[1]=De=>u.value=!1)},null,40,["class"])):o.createCommentVNode("",!0)]),o.createElementVNode("div",oK,[o.createElementVNode("label",iK,o.toDisplayString(o.unref(i)("editor.detail")),1),o.createVNode(gb,{ref_key:"simpleEditorRef",ref:l,modelValue:s.value,"onUpdate:modelValue":te[2]||(te[2]=De=>s.value=De),"parent-editor":Q.editor,class:""},null,8,["modelValue","parent-editor"])]),o.createElementVNode("div",sK,[te[5]||(te[5]=o.createElementVNode("label",{class:"text-right text-sm p-2"},"ID",-1)),o.createVNode(gl,{modelValue:a.value,"onUpdate:modelValue":te[3]||(te[3]=De=>a.value=De),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(wn,{as:"button",variant:"default",class:"bg-blue-500 hover:bg-blue-500/90",onClick:k},{default:o.withCtx(()=>[o.createVNode(o.unref(ug),{class:"w-5 h-5 mr-2"}),o.createTextVNode(" "+o.toDisplayString(o.unref(i)("editor.check")),1)]),_:1}),o.createVNode(wn,{as:"button",variant:"destructive",onClick:x},{default:o.withCtx(()=>[o.createVNode(o.unref(Ff),{class:"w-5 h-5 mr-2"}),o.createTextVNode(" "+o.toDisplayString(Q.$t("editor.close")),1)]),_:1})]),_:1})],4)]}),_:1})]),_:1})]),_:1},8,["open"]),o.createVNode(xe,{open:m.value,onClose:E},null,8,["open"])],64)}}}),bb=o.defineComponent({__name:"SelectContextMenu",props:{editor:{},mode:{},superTextStore:{},disabled:{type:Boolean},disableSuperInput:{type:Boolean}},setup(t,{expose:e}){const n=t,{t:r}=Ot(),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===Be.EDITOR||n.mode===Be.PLAIN_TEXT||!l.value||n.disableSuperInput);function c(){if(!n.editor)return"";const{from:k,to:E}=n.editor.state.selection,C=n.editor.state.doc.cut(k,E),A=no.fromSchema(n.editor.schema).serializeFragment(C.content),T=document.createElement("div");return T.appendChild(A),T.innerHTML}const f=()=>{const{view:k}=n.editor,{from:E,to:C}=k.state.selection,_=c();s.text=_,s.from=E,s.to=C},p=()=>i.value=!i.value,m=()=>{u.value||(i.value=!0,f())},g=()=>i.value=!1,b=k=>{const E=n==null?void 0:n.superTextStore.addMoreSuperText(k);n.editor&&n.editor.commands.insertContentAt(s.from,{type:"superText",attrs:{"data-id":E,"data-text":k}}),i.value=!1,requestAnimationFrame(()=>{n.editor.commands.setTextSelection(s.from+1),n.editor.view.focus()})},v=o.ref(!1),w=async k=>{var E,C;if(k){const _=await((C=(E=n.editor).hasClipboard)==null?void 0:C.call(E));v.value=!!_}},x=()=>{if(u.value||!n.editor)return;const{view:k,state:E}=n.editor,{from:C,to:_}=E.selection;s.from=C,s.to=_,s.text="",k.dom.blur(),i.value=!0};return e({toggleDialog:p,openDialog:m,closeDialog:g}),(k,E)=>{const C=mc,_=pb,A=fb,T=db,L=cb;return o.openBlock(),o.createElementBlock(o.Fragment,null,[o.createVNode(C,{open:i.value,editor:k.editor,"super-text-init":s.text,onClose:p,onSave:b},null,8,["open","editor","super-text-init"]),o.createVNode(L,{"onUpdate:open":w},{default:o.withCtx(()=>[o.createVNode(_,{as:"template",class:"relative",disabled:o.unref(u),onDblclick:o.withModifiers(x,["prevent","stop"])},{default:o.withCtx(()=>[o.renderSlot(k.$slots,"default")]),_:3},8,["disabled"]),o.createVNode(T,null,{default:o.withCtx(()=>[k.disableSuperInput?o.createCommentVNode("",!0):(o.openBlock(),o.createBlock(A,{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(A,{key:1,onSelect:E[0]||(E[0]=I=>{var M;return(M=k.editor)==null?void 0:M.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(A,{key:2,onSelect:E[1]||(E[1]=I=>{var M;return(M=k.editor)==null?void 0:M.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(A,{key:3,disabled:!v.value,onSelect:E[2]||(E[2]=I=>{var M;return(M=k.editor)==null?void 0:M.commands.pasteContent()})},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(r)("editor.paste")),1)]),_:1},8,["disabled"])):o.createCommentVNode("",!0)]),_:1})]),_:3})],64)}}});var lr=(t=>(t.TOGGLE_SUPER_TEXT="toggle-super-text",t.SUPER_TEXT_UPDATE_POSITION="SUPER_TEXT_UPDATE_POSITION",t.RENDER_SUPER_TEXT="RENDER_SUPER_TEXT",t.SUPER_VIEW_PAGE="SUPER_VIEW_PAGE",t.INCREASE_DECREASE_FONTSIZE="increase-decrease-fontsize",t))(lr||{});const aK={id:"editor-panel",class:"flex relative w-full h-full"},lK=Io(o.defineComponent({__name:"PageNode",props:js,setup(t){const{state:e,page:n,superTextStore:r}=xn(),{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===Be.REPORT),{width:p,height:m}=i,g=o.computed(()=>s?`calc(${m} - ${(a==null?void 0:a.top)??0} - ${(a==null?void 0:a.bottom)??0}`:"max-content"),b=mt.useEventBus(lr.SUPER_VIEW_PAGE);return o.watch(()=>t.node.attrs,v=>{b.emit(v.pageNumber)},{immediate:!0}),(v,w)=>{var k,E,C,_;const x=bb;return o.openBlock(),o.createBlock(o.unref(Ws),{id:v.node.attrs.id,ref_key:"containerRef",ref:l,"page-number":v.node.attrs.pageNumber,class:"overflow-hidden umo-page-node-view w-full border rounded-[3px] border-[#999999]",style:o.normalizeStyle({"--umo-page-margin-top":((k=o.unref(a))==null?void 0:k.top)??"0","--umo-page-margin-bottom":((E=o.unref(a))==null?void 0:E.bottom)??"0","--umo-page-margin-left":((C=o.unref(a))==null?void 0:C.left)??"0","--umo-page-margin-right":((_=o.unref(a))==null?void 0:_.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",aK,[o.createVNode(x,{mode:c.value?o.unref(Be).REPORT:o.unref(Be).EDITOR,editor:v.editor,"super-text-store":o.unref(r)},{default:o.withCtx(()=>[o.createVNode(o.unref(aw),{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 pE(t,e){const n=t.storedMarks??(t.selection.$to.parentOffset&&t.selection.$from.marks());if(n){const r=n.filter(i=>e==null?void 0:e.includes(i.type.name));t.tr.ensureMarks(r)}}const uK=({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=Op(c,l.node().type.name,l.node().attrs);if(f.id=Ng(),f.extend&&(f.extend=!1),s instanceof Ve&&s.node.isBlock)return!l.parentOffset||!mr(a,l.pos)?!1:(r&&(t&&pE(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 Ae&&e.deleteSelection();const m=l.depth===0?void 0:l4(l.node(-1).contentMatchAt(l.indexAfter(-1)));let g=p&&m?[{type:m,attrs:f}]:void 0,b=mr(e.doc,e.mapping.map(l.pos),1,g);if(!g&&!b&&mr(e.doc,e.mapping.map(l.pos),1,m?[{type:m}]:void 0)&&(b=!0,g=m?[{type:m,attrs:f}]:void 0),b&&(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 v=e.mapping.map(l.before()),w=e.doc.resolve(v);l.node(-1).canReplaceWith(w.index(),w.index()+1,m)&&e.setNodeMarkup(e.mapping.map(l.before()),m)}t&&pE(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return!0},cK=t=>({tr:e,state:n,dispatch:r,editor:i})=>{var v;const s=mn(t,n.schema),{$from:a,$to:l}=n.selection,u=n.selection instanceof Ve?n.selection.node:null;if(u!=null&&u.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 w=fe.empty;const x=a.index(-1)?1:a.index(-2)?2:3;for(let T=a.depth-x;T>=a.depth-3;T-=1)w=fe.from(a.node(T).copy(w));const k=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,E=Op(f,a.node().type.name,a.node().attrs),C=((v=s.contentMatch.defaultType)==null?void 0:v.createAndFill(E))??void 0;w=w.append(fe.from(s.createAndFill(null,C)??void 0));const _=a.before(a.depth-(x-1));e.replace(_,a.after(-k),new Ee(w,4-x,0));let A=-1;e.doc.nodesBetween(_,e.doc.content.size,(T,L)=>{if(A>-1)return!1;T.isTextblock&&T.content.size===0&&(A=L+1)}),A>-1&&e.setSelection(Ae.near(e.doc.resolve(A))),e.scrollIntoView()}return!0}const p=l.pos===a.end()?c.contentMatchAt(0).defaultType:null,m=Op(f,c.type.name,c.attrs),g=Op(f,a.node().type.name,a.node().attrs);m.id=Ng(),g.id=Ng(),e.delete(a.pos,l.pos);const b=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:w,storedMarks:x}=n,{splittableMarks:k}=i.extensionManager,E=x??(w.$to.parentOffset&&w.$from.marks());if(e.split(a.pos,2,b).scrollIntoView(),!E||!r)return!0;const C=E.filter(_=>k.includes(_.type.name));e.ensureMarks(C)}return!0},dK=[eb,xp,Cp,tb,Ep,ps,rb,Al,ib,ab,ob,fa,hs,ms,sb,lb,nb,qr],fK=Bt.create({priority:200,name:`${qr}`,content:"block*",group:`${qr}`,isolating:!0,selectable:!1,draggable:!1,isLeaf:!0,addOptions(){return{SystemAttributes:{},nodesComputed:{},View:qs(lK),types:[],slots:{}}},addAttributes(){return{HTMLAttributes:{},id:{default:hi(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",{...bt(e),"data-type":this.name},0]},addCommands(){return{splitBlock:uK,splitListItem:cK,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:dK.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()}),()=>hE(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(qr);const f=oi(p=>p.type.name===qr)(a);if(f){if(!f.node.firstChild)return r.deleteNode(qr);const p=f.node.firstChild.type;if(f.start+ze.atStart(f.node).from===c){const g=Ae.create(l,f.start-2,f.start-2),b=oi(v=>v.type.name===qr)(g);if(b){const v=ze.atEnd(b.node).from+b.start,w=Ae.create(l,v,v);if(p===b.node.lastChild.type){const{parent:x}=w.$anchor;return lq(x,i.schema)?s.setSelection(w):s.step(new fn(v,c,Ee.empty)),!0}s.setSelection(w)}return!0}}return!1})]),Delete:()=>this.editor.commands.first(({commands:r})=>[()=>hE(r),()=>r.command(({tr:i})=>{const{selection:s,doc:a}=i,{$anchor:l}=s,u=l.node(),c=oi(f=>f.type.name===Al)(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(qr);const c=oi(f=>f.type.name===qr)(s);if(c&&c.start+ze.atEnd(c.node).from===u){const p=Ae.create(a,u+2,u+2),m=oi(g=>g.type.name===qr)(p);if(m){const g=ze.atStart(m.node).from+m.start,b=Ae.create(a,g,g);if(oi(w=>w.attrs.extend)(b))return i.step(new fn(u,g,Ee.empty)),!0}}return!1})]),Tab:()=>this.editor.commands.first(({commands:r})=>[()=>!0]),"Mod-Enter":()=>this.editor.commands.setPageBreak()}},addNodeView(){return this.options.View}});function Op(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 hE=t=>t.command(({tr:e})=>{const{selection:n,doc:r}=e,i=u4(r,{from:n.from,to:n.to},s=>s.type.name===Al);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()}),pK=Je.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()}}}),hK=["data-font"],mK=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:""}},setup(t){const e=t,n=o.computed(()=>e.editor.extensionStorage["base-kit"].mode===Be.EDITOR),{t:r}=Ot(),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 p=e.editor.extensionManager.extensions.find(g=>g.name==="fontFamily").options;return tt.isEmpty(p.fontFamilyMap)&&(p.fontFamilyMap=i),[{label:r("editor.fontFamily.default"),value:r("editor.fontFamily.default")},...p.fontFamilyMap]}),l=o.computed(()=>{const p={label:r("editor.fontFamily.default"),value:r("editor.fontFamily.default")};return n.value?Zm(e.editor.state,"textStyle").fontFamily||p.value:s.value||p.value}),u=mt.useEventBus("fontFamily");function c(p){p.value===l.value||p.value===r("editor.fontFamily.default")?(e.editor.commands.unsetFontFamily(),s.value=null):(s.value=p.value,e.editor.commands.setFontFamily(p.value),u.emit())}const f=o.computed(()=>{var p;return(p=a.value.find(m=>m.value===l.value))==null?void 0:p.label});return(p,m)=>(o.openBlock(),o.createBlock(la,{disabled:p.disabled,tooltip:p.tooltip,title:f.value,btn_class:`min-w-24 ${p.customClass}`},{default:o.withCtx(()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(a.value,(g,b)=>(o.openBlock(),o.createElementBlock(o.Fragment,{key:b},[o.createVNode(o.unref(kl),{checked:l.value===g.value,onClick:v=>c(g)},{default:o.withCtx(()=>[o.createElementVNode("span",{class:"ml-1 h-full","data-font":g.label,style:o.normalizeStyle({fontFamily:g.value??void 0})},o.toDisplayString(g.label),13,hK)]),_:2},1032,["checked","onClick"]),g.label===o.unref(r)("editor.fontFamily.default")?(o.openBlock(),o.createBlock(o.unref(fg),{key:0})):o.createCommentVNode("",!0)],64))),128))]),_:1},8,["disabled","tooltip","title","btn_class"]))}}),mE=pK.extend({name:"fontFamily",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),types:["textStyle"],fontFamilyMap:[],button({editor:e,extension:n,t:r}){return{component:mK,componentProps:{editor:e,disabled:!e.can().setFontFamily(""),tooltip:r("editor.fontFamily.tooltip"),customClass:"border border-gray-300 rounded-none text-gray-500 px-2.5 h-[26px]"}}}}},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}).run(),unsetFontFamily:()=>({chain:t})=>t().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}},addStorage(){return{value:null}},onUpdate(){this.storage.value=this.editor.getAttributes("textStyle").fontFamily}}),gK={class:"flex gap-2"},bK=["disabled"],vK=Io(o.defineComponent({__name:"FontSizeIncreaseDecrease",props:{editor:Object},setup(t){const e=o.inject("fontSize"),n=o.computed(()=>e.value?parseInt(e.value)===parseInt(k0[0])||parseInt(e.value)<parseInt(k0[0]):!1),r=mt.useEventBus(lr.INCREASE_DECREASE_FONTSIZE),i=s=>{r.emit(s)};return(s,a)=>{const l=yl,u=vl,c=wl;return o.openBlock(),o.createElementBlock("div",gK,[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(Lt),{name:"Plus",class:"w-6 h-6"})])]),_:1}),o.createVNode(o.unref(oa),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(Lt),{name:"Minus",class:"w-6 h-6"})],8,bK)]),_:1}),o.createVNode(o.unref(oa),null,{default:o.withCtx(()=>a[3]||(a[3]=[o.createTextVNode(" 글꼴 크기 작게 ")])),_:1})]),_:1})]),_:1})])}}}),[["__scopeId","data-v-250d04b3"]]),yK=Vn.create({name:"fontSizeIncreaseDecrease",addOptions(){return{defaultSize:"14px",button({editor:t}){return{component:vK,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})}}}),vb=Je.create({name:"painter",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:e,extension:n,t:r})=>({component:Ke,componentProps:{action:()=>{e.commands.setPainter(e==null?void 0:e.state.selection.$head.marks())},icon:"PaintRoller",tooltip:r("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 et({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}}}})]}}),yb=()=>hi(10),gE=new Et("attrkey"),wK=t=>new et({key:gE,state:{init:()=>!1,apply:n=>n.getMeta("initSplit")},appendTransaction(n,r,i){const{tr:s}=i;let a=!1;const l=gE.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:b}=f,v=c.includes(b.id)?yb():b.id||yb();t.includes(f.type.name)&&(s.setNodeMarkup(p,void 0,{...b,id:v,"number-line":g+1}),a=!0),c.push(v)})}return a?s:null}}),bE=[eb,xp,Cp,tb,Ep,ps,rb,Al,ib,ab,ob,fa,hs,ms,sb,lb,nb,qr],xK=Je.create({name:"autoId",addGlobalAttributes(){return[{types:bE.concat(this.options.types||[]),attributes:{id:{default:yb()},extend:{default:!1},class:{default:null},"number-line":{default:null}}}]},addProseMirrorPlugins(){return[wK(bE.concat(this.options.types||[]))]}}),CK=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,EK=Bt.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",bt(this.options.HTMLAttributes,t)]},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[g4({find:CK,type:this.type,getAttributes:t=>{const[,,e,n,r]=t;return{src:n,alt:e,title:r}}})]}}),kK=["src","alt"],SK={key:0,class:"image-resizer"},_K=["onMousedown","onTouchstart"],TK=o.defineComponent({__name:"ImageView",props:{...js,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.ref({width:uw,height:uw}),i=o.ref({width:0,height:0}),s=o.ref(!1),a=o.ref({x:0,y:0,w:0,h:0,dir:""}),l=o.computed(()=>{const{src:E,alt:C,width:_,height:A,flipX:T,flipY:L}=e.node.attrs,I=[];T&&I.push("rotateX(180deg)"),L&&I.push("rotateY(180deg)");const M=I.join(" ");return{src:E||void 0,alt:C||void 0,style:{width:S0(_)?`${_}px`:_,height:S0(A)?`${A}px`:A,transform:M||"none"}}});o.computed(()=>({width:o.unref(l).style.width==="100%"?"100%":void 0}));const u=o.ref(null),c=new ResizeObserver(E=>{for(const C of E){const{width:_,height:A}=C.contentRect;i.value={width:_,height:A},e.updateAttributes({originWidth:_,originHeight:A})}});function f(){const{editor:E,getPos:C}=e;E.commands.setNodeSelection(C())}const p=tt.throttle(()=>{const{editor:E}=e;r.value.width=parseInt(getComputedStyle(E.view.dom).width,10)},cw);function m(E,C){E.preventDefault(),E.stopPropagation();let _=0,A=0;const T=document.querySelector(".image-resizer");if(T&&(T.style.borderColor="#3b82f6"),"touches"in E&&E.touches.length>0)_=E.touches[0].clientX,A=E.touches[0].clientY;else if("clientX"in E)_=E.clientX,A=E.clientY;else return;const{width:L,height:I}=o.unref(i),M=L/I;let j=Number(e.node.attrs.width)||L,D=Number(e.node.attrs.height)||Math.round(j/M);const Q=o.unref(r).width;j=Math.min(j>Q?Q:j,Q),D=Math.round(j/M),Object.assign(a.value,{x:_,y:A,w:j,h:D,dir:C}),s.value=!0,v()}const g=tt.throttle(E=>{if(!o.unref(s))return;let C=0;if("touches"in E&&E.touches.length>0)C=E.touches[0].clientX;else if("clientX"in E)C=E.clientX;else return;const{x:_,w:A,dir:T}=o.unref(a),L=(C-_)*(/l/.test(T)?-1:1),I=qB(A+L,VB,o.unref(r).width);e.updateAttributes({width:I})},cw),b=E=>{E.preventDefault(),E.stopPropagation();const C=document.querySelector(".image-resizer");C&&(C.style.borderColor=""),o.unref(s)&&(s.value=!1,Object.assign(a.value,{x:0,y:0,w:0,h:0,dir:""}),w(),f())};function v(){document.addEventListener("mousemove",g,!0),document.addEventListener("mouseup",b,!0),document.addEventListener("touchmove",g,!0),document.addEventListener("touchend",b,!0)}function w(){document.removeEventListener("mousemove",g,!0),document.removeEventListener("mouseup",b,!0),document.removeEventListener("touchmove",g,!0),document.removeEventListener("touchend",b,!0)}const x=new ResizeObserver(p),k=o.computed(()=>{const{textAlign:E}=e.node.attrs;return{left:"margin-right: auto;",right:"margin-left: auto;",center:"margin-left: auto; margin-right: auto;"}[E]||""});return o.onMounted(()=>{u.value&&c.observe(u.value),x.observe(e.editor.view.dom)}),o.onBeforeUnmount(()=>{w(),c.disconnect(),x.disconnect()}),(E,C)=>(o.openBlock(),o.createBlock(o.unref(Ws),{class:"node-image"},{default:o.withCtx(()=>[o.createElementVNode("div",{class:"image-view",style:o.normalizeStyle([{width:l.value.style.width,height:l.value.style.height},k.value])},[o.createElementVNode("div",{draggable:"true","data-drag-handle":"",class:o.normalizeClass([{"image-view__body--focused":t.selected,"image-view__body--resizing":s.value},"image-view__body"])},[o.createElementVNode("img",{ref_key:"imageRef",ref:u,src:l.value.src,alt:l.value.alt,class:"block w-full image-view__body__image",style:o.normalizeStyle([{transform:l.value.style.transform}]),onClick:f},null,12,kK),E.editor.view.editable?o.withDirectives((o.openBlock(),o.createElementBlock("div",SK,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(Object.values(n),_=>(o.openBlock(),o.createElementBlock("span",{key:_,class:o.normalizeClass([`image-resizer__handler--${_}`,"image-resizer__handler"]),onMousedown:A=>m(A,_),onTouchstart:o.withModifiers(A=>m(A,_),["prevent"])},null,42,_K))),128))],512)),[[o.vShow,t.selected||s.value]]):o.createCommentVNode("",!0)],2)],4)]),_:1}))}}),AK=Io(TK,[["__scopeId","data-v-6435a6f3"]]),wb=EK.extend({group:"block",defining:!0,isolating:!0,addAttributes(){var t;return{...(t=this.parent)==null?void 0:t.call(this),flipX:{default:!1},flipY:{default:!1},originWidth:{default:null},originHeight:{default:null},textAlign:{default:"left",parseHTML:e=>e.style.textAlign||e.getAttribute("textAlign")||null,renderHTML:e=>({textAlign:e.textAlign})},width:{default:"100%",parseHTML:e=>{const n=e.style.width||e.getAttribute("width")||null;return n&&n.endsWith("%")?n:n==null?null:parseInt(n,10)},renderHTML:e=>({width:e.width})},class:{default:"",parseHTML:e=>e.getAttribute("class")||"",renderHTML:e=>({class:e.class})},"data-memo":{default:"",parseHTML:e=>e.getAttribute("data-memo")||"",renderHTML:e=>({"data-memo":e["data-memo"]})}}},addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this)}},addNodeView(){return qs(AK)},addCommands(){var t;return{...(t=this.parent)==null?void 0:t.call(this),updateImage:e=>({commands:n,editor:r})=>n.updateAttributes(this.name,e)}},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",bt({height:"auto",style:l},this.options.HTMLAttributes,e)]},parseHTML(){return[{tag:"img[src]"}]},addProseMirrorPlugins(){return[new et({props:{handleTextInput(t){const{selection:e}=t.state;return e instanceof Ve&&e.node.type.name==="image"},handlePaste(t){const{selection:e}=t.state;return e instanceof Ve&&e.node.type.name==="image"}}})]}}),OK=["paragraph","heading","list_item","todo_item"];function MK(t,e){const{selection:n,doc:r}=t;if(!n||!r||!(n instanceof Ae||n instanceof Ln))return t;const{from:i,to:s}=n,a=[],l=e&&e!==dw?e:null;return r.nodesBetween(i,s,(u,c)=>{const f=u.type;return OK.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 BK(t){return({state:e,dispatch:n})=>{const{selection:r}=e;let{tr:i}=e;return i=i.setSelection(r),i=MK(i,t),i.docChanged?(n&&n(i),!0):!1}}const IK=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}=Ot();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.commands.unsetLineHeight():s.editor.commands.setLineHeight(l),i.value=l}return(l,u)=>(o.openBlock(),o.createBlock(la,{icon:l.icon,tooltip:l.tooltip,disabled:l.disabled},{default:o.withCtx(()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(r.value,(c,f)=>(o.openBlock(),o.createBlock(o.unref(kl),{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"]))}}),vE=Je.create({name:"lineHeight",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),types:["paragraph","heading","list_item","todo_item"],lineHeights:["100%","115%","150%","200%","250%","300%"],defaultHeight:dw,button({editor:e,t:n}){return{component:IK,componentProps:{editor:e,icon:"LineHeight",tooltip:n("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=>BK(t),unsetLineHeight:()=>({commands:t})=>this.options.types.every(e=>t.resetAttributes(e,"lineHeight"))}}}),RK=Bt.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",bt(t,{"data-type":"column"}),0]},parseHTML(){return[{tag:'div[data-type="column"]'}]}});var pa=(t=>(t.SidebarLeft="sidebar-left",t.SidebarRight="sidebar-right",t.TwoColumn="two-column",t))(pa||{});const xb=Bt.create({name:"columns",group:"columns",content:"column+",defining:!0,isolating:!0,addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),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[RK.configure(this.options.columnOptions)]}});function LK(t){let e=t;for(;e&&e!==document.body;){if(e.nodeType===1){const n=e;if(n.id==="editor-panel")return n}e=e.parentNode}return null}const Mp=t=>{var n;if(!t)return!0;const e=document.createElement("div");return e.innerHTML=t,((n=e==null?void 0:e.textContent)==null?void 0:n.trim())===""},PK=t=>{if(!t)return"";const{from:e,to:n}=t.state.selection,r=t.state.doc.cut(e,n),s=no.fromSchema(t.schema).serializeFragment(r.content),a=document.createElement("div");return a.appendChild(s),a.innerHTML},yE=8;function DK(t,e){const n=o.ref(!1);let r=!1,i=null,s=null,a=null,l=null,u=0,c=0;function f(k){const E=k.cloneNode(!0);return E.style.position="fixed",E.style.pointerEvents="none",E.style.opacity="0.9",E.style.zIndex="9999",E.style.transform="translate(-50%, -50%)",E.style.left="0px",E.style.top="0px",document.body.appendChild(E),E}function p(){s&&s.parentElement&&s.parentElement.removeChild(s),s=null}function m(){try{if(typeof t.getPos=="function"){const k=t.getPos();if(typeof k=="number"&&k>=0)return k}}catch{}return null}function g(k,E){n.value||(l=m(),document.body.style.userSelect="none",document.body.style.touchAction="none",E&&(s=f(E),s.style.left=`${k.clientX}px`,s.style.top=`${k.clientY}px`),n.value=!0,r=!1,a=null)}function b(){i=null,l=null,a=null,r=!1,n.value=!1,p(),document.body.style.userSelect="",document.body.style.touchAction=""}function v(k){if(o.unref(e)||n.value)return;const E=k.changedTouches[0];i=E.identifier,u=E.clientX,c=E.clientY,r=!0,l=null,a=null}function w(k){var T;if(!r&&!n.value||i===null)return;const E=Array.from(k.changedTouches).find(L=>L.identifier===i);if(!E)return;const C=E.clientX-u,_=E.clientY-c,A=C*C+_*_;if(!n.value&&r&&A>=yE*yE){const L=k.currentTarget||k.target||null;g(E,L)}if(n.value){s&&(s.style.left=`${E.clientX}px`,s.style.top=`${E.clientY}px`);try{const L=(T=t.editor)==null?void 0:T.view;if(!L){a=null;return}const I=L.posAtCoords({left:E.clientX,top:E.clientY});I&&typeof I.pos=="number"?a=I.pos:a=null}catch{a=null}}}async function x(k){var E;if(n.value){if(document.body.style.userSelect="",document.body.style.touchAction="",p(),n.value=!1,l===null||a===null){b();return}const C=(E=t.editor)==null?void 0:E.view;if(!C){b();return}const _=C.state.doc.nodeAt(l);if(!_){b();return}const A=_.nodeSize,T=l,L=T+A,I=a;if(I>=T&&I<=L){b();return}let M=I;I>T&&(M=I-A);const j=C.state.doc.content.size;M<0&&(M=0),M>j&&(M=j);const D=_.type.create(_.attrs),Q=C.state.tr;Q.delete(T,L),Q.insert(M,D),C.dispatch(Q),b();return}if(r){b();return}}return{onTouchStart:v,onTouchMove:w,onTouchEnd:x}}function VK(...t){return k2(Kh(t))}const FK=["innerHTML"],$K=["book-mark-node-id","book-mark-content","node-id","element-id","line-id"],zK=o.defineComponent({__name:"SuperText",props:js,setup(t){const e=t,n=o.ref(!1),r=o.inject("isMobile",!1),i=o.computed(()=>e.editor.storage.superText.enable),s=mt.useEventBus(lr.RENDER_SUPER_TEXT),{onTouchStart:a,onTouchMove:l,onTouchEnd:u}=DK(e,i),c=o.computed(()=>{const E=e.getPos(),C=e.editor.state.doc.resolve(E);for(let _=C.depth;_>0;_--){const A=C.node(_);if(A.type.name==="paragraph")return A}return null}),f=o.computed(()=>{var E;return((E=c.value)==null?void 0:E.attrs.id)||""}),p=o.inject("canEditSuper",o.ref(!0));function m(E){var I,M;if(Mp(E)){v();return}const C=e.getPos(),_=(I=e.editor)==null?void 0:I.state.doc.nodeAt(C),A=E.trim(),{[Ze.ELEMENT_ID]:T,...L}=(_==null?void 0:_.attrs)||{};(M=e.editor)==null||M.view.dispatch(e.editor.state.tr.setNodeMarkup(C,void 0,{...L,[Ze.TEXT]:A})),requestAnimationFrame(()=>{e.editor.commands.setTextSelection(C+1),e.editor.view.focus()})}function g(E){const C=e.node.attrs[Ze.TEXT],_=e.node.attrs[Ze.ID],T={lineId:E.target.querySelector(`[node-id="${_}"]`).getAttribute("line-id"),dataId:_,text:C};s.emit({action:"hover",payload:T})}function b(E){const C=e.node.attrs[Ze.ID],A={lineId:E.target.querySelector(`[node-id="${C}"]`).getAttribute("line-id"),dataId:C,text:""};s.emit({action:"hover",payload:A})}function v(){const{getPos:E,node:C,editor:_}=e,A=E(),T=A+1;_.commands.deleteRange({from:A,to:T})}function w(){if(!p.value)return;const{attributes:E}=e.editor.options.editorProps;if(E&&E.id===ir.COMMENT){const C=document.getElementById(ir.COMMENT);if((C==null?void 0:C.getAttribute(ir.DISABLE_SUPER_INPUT))==="true")return}e.editor.view.dom.blur(),n.value=!0}function x(){e.editor.commands.setSuperTextContent(e.node.attrs[Ze.TEXT],e.node.attrs[Ze.POSITION]),e.editor.commands.toggleSuperInputMoblie()}o.watch(i,E=>{e.editor.setEditable(!E),E?e.editor.view.dom.classList.add("super-text-view-mode"):e.editor.view.dom.classList.remove("super-text-view-mode")});const k=o.computed(()=>`{${e.node.attrs[Ze.TEXT].replace(/<\/p>\s*<p>/g,"<br/>").replace(/<\/?p[^>]*>/g,"").trim()}}`);return(E,C)=>{const _=wn,A=pb,T=fb,L=db,I=cb,M=mc;return o.openBlock(),o.createBlock(o.unref(Ws),{as:"span",class:o.normalizeClass(o.unref(VK)("text-inherit super-text shrink-0 inline-flex items-center justify-center",o.unref(r)&&i.value&&"block")),"data-drag-handle":"",draggable:o.unref(p),onPointerdown:C[2]||(C[2]=o.withModifiers(()=>{},["stop"])),onTouchstartPassive:o.unref(a),onTouchmovePassive:o.unref(l),onTouchendPassive:o.unref(u),onTouchcancelPassive:o.unref(u)},{default:o.withCtx(()=>[o.unref(r)&&!i.value?(o.openBlock(),o.createElementBlock("button",{key:0,onClick:o.withModifiers(x,["stop"]),class:"w-5 inline-flex justify-center rounded text-ed-red-500 active:bg-ed-accent"},[o.createVNode(o.unref(Lt),{name:"fileEdit2"})])):o.createCommentVNode("",!0),o.unref(r)&&i.value?(o.openBlock(),o.createElementBlock("div",{key:1,innerHTML:k.value,onClick:o.withModifiers(x,["stop"]),class:"super-text-view-mode-item"},null,8,FK)):o.createCommentVNode("",!0),o.unref(r)?o.createCommentVNode("",!0):(o.openBlock(),o.createBlock(I,{key:2},{default:o.withCtx(()=>[o.createVNode(A,{as:"template",class:"relative",disabled:!o.unref(p)},{default:o.withCtx(()=>[o.createVNode(_,{class:o.normalizeClass([{"pointer-events-none":!o.unref(p)},"!p-0 !m-0 !h-fit"]),variant:"ghost",onDblclick:o.withModifiers(w,["stop"]),onMouseenter:g,onMouseleave:b},{default:o.withCtx(()=>[o.createVNode(o.unref(Lt),{name:"fileEdit"}),o.createElementVNode("div",{ref:"bookMarkRef","book-mark-node-id":e.node.attrs[o.unref(Ze).ID],"book-mark-content":e.node.attrs[o.unref(Ze).TEXT],"node-id":e.node.attrs[o.unref(Ze).ID],"element-id":e.node.attrs[o.unref(Ze).ELEMENT_ID],"line-id":f.value},null,8,$K)]),_:1},8,["class"])]),_:1},8,["disabled"]),o.createVNode(L,null,{default:o.withCtx(()=>[o.createVNode(T,{onSelect:C[0]||(C[0]=j=>n.value=!0)},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(E.$t("editor.super.edit")),1)]),_:1}),o.createVNode(T,{onSelect:v},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(E.$t("editor.super.delete")),1)]),_:1})]),_:1})]),_:1})),o.unref(r)?o.createCommentVNode("",!0):(o.openBlock(),o.createBlock(M,{key:3,open:n.value,editor:e.editor,"super-text-init":e.node.attrs[o.unref(Ze).TEXT],"super-text-element-id":e.node.attrs[o.unref(Ze).ELEMENT_ID],onClose:C[1]||(C[1]=j=>n.value=!1),onSave:m},null,8,["open","editor","super-text-init","super-text-element-id"]))]),_:1},8,["class","draggable","onTouchstartPassive","onTouchmovePassive","onTouchendPassive","onTouchcancelPassive"])}}}),HK=new et({props:{handleKeyDown(t,e){var n;if(e.key==="Backspace"){const{state:r,dispatch:i}=t,{$from:s}=r.selection;if(s.parentOffset===1){const u=s.nodeAfter;if(u&&u.type.name==="superText"){const c=r.tr;c.delete(s.pos-1,s.pos);const f=r.schema.text("​");return c.insert(s.pos-1,fe.from(f)),c.setSelection(Ae.create(c.doc,s.pos)),i(c),e.preventDefault(),!0}}const a=s.nodeBefore,l=s.nodeAfter;if(a&&a.isText&&((n=a.text)==null?void 0:n.length)===1&&l&&l.type.name==="superText"){const u=s.parent.childBefore(s.parentOffset-1).node;if(u&&u.type.name==="superText"){const c=r.tr;return c.delete(s.pos-1,s.pos),c.setSelection(Ae.create(c.doc,s.pos-1)),i(c),e.preventDefault(),!0}}}return!1}}}),UK=new et({appendTransaction(t,e,n){const r=new Set;let i=n.tr,s=!1;return n.doc.descendants((a,l)=>{if(a.type.name===gc){const u=a.attrs[Ze.ID];if(!u||r.has(u)){const c=hi();i=i.setNodeMarkup(l,void 0,{...a.attrs,[Ze.ID]:c}),s=!0,r.add(c)}else r.add(u)}}),s?i:null}}),gc="superText",wE={UPDATE:"superTextUpdate"},xE=Bt.create({name:"superText",inline:!0,group:"inline",selectable:!1,defining:!0,draggable:!0,addStorage(){return{enable:!0,isShowSuperInputMoblie:!1,view:!0,items:[],toggleSuperViewMobileCallBack:this.options.toggleSuperViewMobileCallBack,bottomSheetComponent:this.options.bottomSheetComponent,addToast:this.options.addToast,superTextContent:"",superTextPosition:""}},addOptions(){return{specialCharModal:null,button:({editor:t,t:e,isMobile:n})=>n?[{component:Ke,componentProps:{action:()=>{t.commands.toggleSuperInputMoblie()},isActive:()=>{},icon:"fileEdit",title:e("editor.menubar.menu.insertSuper"),tooltip:e("editor.menubar.menu.insertSuper"),customClass:"whitespace-nowrap !bg-ed-blue active:!bg-ed-blue/90 !transition-none !text-white !font-normal rounded-[3px] h-[26px] ml-auto",customClassTooltip:"ml-auto"}}]:[{component:Ke,componentProps:{action:()=>t.commands.toggleSuperTextView(),isActive:()=>t.storage.superText.enable,title:e("editor.menubar.menu.superView"),customClass:`whitespace-nowrap !text-white !font-normal rounded-[3px] h-[26px]
291
291
  ${t.storage.superText.enable?"!bg-blue-700":"!bg-blue-500"}
292
292
  `,tooltip:"수퍼 보기"}}]}},addAttributes(){return{[Ze.ID]:{default:null},[Ze.TEXT]:{default:""},[Ze.POSITION]:{default:"0"},[Ze.ELEMENT_ID]:{default:""}}},addCommands(){return{toggleSuperTextView:()=>({editor:t})=>t.storage.superText.enable=!t.storage.superText.enable,toggleSuperInputMoblie:()=>({editor:t})=>t.storage.superText.bottomSheetComponent?t.storage.superText.isShowSuperInputMoblie=!t.storage.superText.isShowSuperInputMoblie:(console.error("Please configure bottomSheetComponent!"),!1),setSuperTextContent:(t,e)=>({editor:n})=>(n.storage.superText.superTextContent=t,n.storage.superText.superTextPosition=e,!!t)}},parseHTML(){return[{tag:"button.super-text"}]},renderHTML({HTMLAttributes:t}){return["button",bt(t,{class:"super-text"})]},addNodeView(){return qs(zK)},addProseMirrorPlugins(){return[new et({appendTransaction(t,e,n){let r=n.tr,i=!1;return n.doc.descendants((s,a)=>{if(s.type.name==="superText"){const l=s.attrs[Ze.POSITION],u=String(a);l!==u&&(r=r.setNodeMarkup(a,void 0,{...s.attrs,[Ze.POSITION]:u}),i=!0)}}),i?r:null}}),new et({filterTransaction(t,e){return t.steps.some(r=>{if(r.toJSON&&r.toJSON().stepType==="replace"){const i=r.toJSON();return i.slice&&i.slice.content&&i.slice.content.some(s=>s.type===gc)}return!1})&&t.setMeta(wE.UPDATE,!0),!0}}),HK,UK]}}),WK={class:"flex gap-x-2 items-center"},jK={class:"sr-only"},qK={class:"flex justify-end gap-x-2.5 flex-1"},KK=["disabled"],CE=Io(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}=Ot(),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(()=>{var b;if(!s.value)return!0;const g=document.createElement("div");return g.innerHTML=s.value,((b=g==null?void 0:g.textContent)==null?void 0:b.trim())===""});o.watch(()=>r.open,()=>{r.open&&r.superTextInit&&(s.value=r.superTextInit)});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,b)=>{const v=Ap,w=Tp,x=_p,k=mb,E=hb,C=Sp,_=kp;return o.openBlock(),o.createBlock(_,{open:g.open},{default:o.withCtx(()=>[o.createVNode(C,{isOverlayTransparent:"",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(v,{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",WK,[o.withDirectives(o.createElementVNode("button",{onClick:m},[o.createVNode(o.unref(N1),{icon:"lucide:edit-2"})],512),[[o.vShow,l.value]]),o.createVNode(w,{class:"outline-none",onClick:f},{default:o.withCtx(()=>[o.createVNode(o.unref(Ff),{class:"w-5 h-5"}),o.createElementVNode("span",jK,o.toDisplayString(o.unref(i)("editor.close")),1)]),_:1})])]),_:1}),o.createVNode(k,{class:"hidden"}),o.createVNode(gb,{isReadOnly:l.value,modelValue:s.value,"onUpdate:modelValue":b[0]||(b[0]=A=>s.value=A),"parent-editor":g.editor,"spellcheck-enabled":!1},null,8,["isReadOnly","modelValue","parent-editor"]),o.createVNode(E,{class:"flex-row justify-between"},{default:o.withCtx(()=>[o.withDirectives(o.createElementVNode("button",{onClick:b[1]||(b[1]=A=>n("delete"))},o.toDisplayString(o.unref(i)("editor.delete")),513),[[o.vShow,u.value]]),o.withDirectives(o.createElementVNode("div",qK,[o.createElementVNode("button",{onClick:f},o.toDisplayString(o.unref(i)("editor.menubar.menu.cancel")),1),o.createElementVNode("button",{onClick:p,disabled:o.unref(c),class:o.normalizeClass({"cursor-not-allowed":o.unref(c)})},o.toDisplayString(o.unref(i)("editor.menubar.menu.save")),11,KK)],512),[[o.vShow,u.value||!l.value]])]),_:1})]),_:1})]),_:1},8,["open"])}}}),[["__scopeId","data-v-2f4982a0"]]),GK=["innerHTML"],XK=["book-mark-node-id","page-id","page-number","book-mark-content","node-id","line-id"],YK=o.defineComponent({__name:"ConfigPlan",props:js,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=mt.useEventBus(lr.RENDER_SUPER_TEXT),c=o.computed(()=>{var _,A;const x=s.resolve(i.from),k=x==null?void 0:x.node(-1),E=(_=k==null?void 0:k.attrs)==null?void 0:_.id,C=(A=k==null?void 0:k.attrs)==null?void 0:A.pageNumber;return{pageId:E,pageNumber:C}}),f=o.computed(()=>{const x=e.getPos(),k=e.editor.state.doc.resolve(x);for(let E=k.depth;E>0;E--){const C=k.node(E);if(C.type.name==="paragraph")return C}return null}),p=o.computed(()=>{var x;return((x=f.value)==null?void 0:x.attrs.id)||""});function m(x){e.updateAttributes({"data-text":x}),n.value=!1}function g(x){const k=e.node.attrs[Ze.TEXT],E=e.node.attrs[Ze.ID],_={lineId:x.target.querySelector(`[node-id="${E}"]`).getAttribute("line-id"),text:k};u.emit({action:"hover",payload:_})}function b(x){const k=e.node.attrs[Ze.ID],C={lineId:x.target.querySelector(`[node-id="${k}"]`).getAttribute("line-id"),text:""};u.emit({action:"hover",payload:C})}function v(){const{getPos:x,node:k,editor:E}=e,C=x(),_=C+1;E.commands.deleteRange({from:C,to:_})}function w(){n.value=!0,a&&(l.value=!0)}return(x,k)=>{const E=wn,C=pb,_=fb,A=db,T=cb,L=mc;return o.openBlock(),o.createBlock(o.unref(Ws),{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(T,null,{default:o.withCtx(()=>[o.createVNode(C,{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:b},{default:o.withCtx(()=>[o.createVNode(o.unref(Lt),{name:"plan",class:o.normalizeClass({"w-[18px] h-auto pr-1":o.unref(a)})},null,8,["class"]),k[3]||(k[3]=o.createTextVNode(" [")),o.createElementVNode("span",{class:"[&_*]:inline",innerHTML:e.node.attrs[o.unref(Ze).TEXT]},null,8,GK),k[4]||(k[4]=o.createTextVNode("] ")),o.createElementVNode("div",{ref_key:"bookMarkRef",ref:r,"book-mark-node-id":e.node.attrs[o.unref(Ze).ID],"page-id":c.value.pageId,"page-number":c.value.pageNumber,"book-mark-content":e.node.attrs[o.unref(Ze).TEXT],"node-id":e.node.attrs[o.unref(Ze).ID],"line-id":p.value},null,8,XK)]),_:1})]),_:1}),o.createVNode(A,null,{default:o.withCtx(()=>[o.createVNode(_,{onSelect:k[0]||(k[0]=I=>n.value=!0)},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(x.$t("editor.configPlan.edit")),1)]),_:1}),o.createVNode(_,{onSelect:v},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(x.$t("editor.configPlan.delete")),1)]),_:1})]),_:1})]),_:1}),o.unref(a)?(o.openBlock(),o.createBlock(CE,{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(Ze).TEXT],"super-text-id":e.node.attrs[o.unref(Ze).ID],onClose:k[2]||(k[2]=I=>n.value=!1),onSave:m,onDelete:v},null,8,["title","open","is-view-mode","editor","super-text-init","super-text-id"])):(o.openBlock(),o.createBlock(L,{key:0,open:n.value,editor:e.editor,"super-text-init":e.node.attrs[o.unref(Ze).TEXT],"super-text-element-id":e.node.attrs[o.unref(Ze).ELEMENT_ID],onClose:k[1]||(k[1]=I=>n.value=!1),onSave:m},null,8,["open","editor","super-text-init","super-text-element-id"]))]),_:1},8,["class"])}}}),EE=Bt.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:Ke,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",bt(t,{class:"config-plan"})]},addNodeView(){return qs(YK)},addProseMirrorPlugins(){return[new et({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 Cb,Eb;if(typeof WeakMap<"u"){let t=new WeakMap;Cb=e=>t.get(e),Eb=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;Cb=r=>{for(let i=0;i<t.length;i+=2)if(t[i]==r)return t[i+1]},Eb=(r,i)=>(n==10&&(n=0),t[n++]=r,t[n++]=i)}var rn=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 Cb(t)||Eb(t,JK(t))}};function JK(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=ZK(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 b=0;;b++){for(;i<r.length&&r[i]!=0;)i++;if(b==p.childCount)break;const v=p.child(b),{colspan:w,rowspan:x,colwidth:k}=v.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 C=i+E*e;for(let _=0;_<w;_++){r[C+_]==0?r[C+_]=f:(s||(s=[])).push({type:"collision",row:c,pos:f,n:w-_});const A=k&&k[_];if(A){const T=(C+_)%e*2,L=a[T];L==null||L!=A&&a[T+1]==1?(a[T]=A,a[T+1]=1):L==A&&a[T+1]++}}}i+=w,f+=v.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 rn(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&&QK(l,a,t),l}function ZK(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 QK(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=NK(u)))[c]=p)}l&&t.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:l})}}function NK(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function zn(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 gs=new Et("selectingCells");function Ol(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 eG(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 go(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 Bp(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=Ol(e.$head)||tG(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function tG(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 kb(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function nG(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function Sb(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function kE(t,e,n){const r=t.node(-1),i=rn.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 ha(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 SE(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 rG(t,e,n){const r=zn(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 Mi extends ze{constructor(e,n=e){const r=e.node(-1),i=rn.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 hy(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(kb(r)&&kb(i)&&Sb(r,i)){const s=this.$anchorCell.node(-1)!=r.node(-1);return s&&this.isRowSelection()?Mi.rowSelection(r,i):s&&this.isColSelection()?Mi.colSelection(r,i):new Mi(r,i)}return Ae.between(r,i)}content(){const e=this.$anchorCell.node(-1),n=rn.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 b=e.nodeAt(m);if(!b)throw RangeError(`No cell with offset ${m} found`);const v=i.left-g.left,w=g.right-i.right;if(v>0||w>0){let x=b.attrs;if(v>0&&(x=ha(x,0,v)),w>0&&(x=ha(x,x.colspan-w,w)),g.left<i.left){if(b=b.type.createAndFill(x),!b)throw RangeError(`Could not create cell with attrs ${JSON.stringify(x)}`)}else b=b.type.create(x,b.content)}if(g.top<i.top||g.bottom>i.bottom){const x={...b.attrs,rowspan:Math.min(g.bottom,i.bottom)-Math.max(g.top,i.top)};g.top<i.top?b=b.type.createAndFill(x):b=b.type.create(x,b.content)}c.push(b)}a.push(e.child(u).copy(fe.from(c)))}const l=this.isColSelection()&&this.isRowSelection()?e:a;return new Ee(fe.from(l),1,1)}replace(e,n=Ee.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?Ee.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 Ee(fe.from(n),0,0))}forEachCell(e){const n=this.$anchorCell.node(-1),r=rn.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=rn.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 Mi(e,n)}isRowSelection(){const e=this.$anchorCell.node(-1),n=rn.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 Mi&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),i=rn.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 Mi(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new Mi(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){return new Mi(e.resolve(n),e.resolve(r))}getBookmark(){return new oG(this.$anchorCell.pos,this.$headCell.pos)}};zt.prototype.visible=!1,ze.jsonID("cell",zt);var oG=class D_{constructor(e,n){this.anchor=e,this.head=n}map(e){return new D_(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&&Sb(n,r)?new zt(n,r):ze.near(r,1)}};function iG(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"}))}),ft.create(t.doc,e)}function sG({$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 aG({$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 lG(t,e,n){const r=(e||t).selection,i=(e||t).doc;let s,a;if(r instanceof Ve&&(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=rn.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 Ae&&sG(r)?s=Ae.create(i,r.from):r instanceof Ae&&aG(r)&&(s=Ae.create(i,r.$from.start(),r.$from.end()));return s&&(e||(e=t.tr)).setSelection(s),e}var uG=new Et("fix-tables");function _E(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)?_E(t.child(l),u,n+1,r):u.nodesBetween(0,u.content.size,r,n+1),n+=u.nodeSize}}function TE(t,e){let n;const r=(i,s)=>{i.type.spec.tableRole=="table"&&(n=cG(t,i,s,n))};return e?e.doc!=t.doc&&_E(e.doc,t.doc,0,r):t.doc.descendants(r),n}function cG(t,e,n,r){const i=rn.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,ha(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 b=[];for(let w=0;w<m;w++){const x=zn(t.schema)[g].createAndFill();x&&b.push(x)}const v=(u==0||a==u-1)&&l==u?c+1:p-1;r.insert(r.mapping.map(v),b)}c=p}return r.setMeta(uG,{fixTables:!0})}function jo(t){const e=t.selection,n=Bp(t),r=n.node(-1),i=n.start(-1),s=rn.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 AE(t,{map:e,tableStart:n,table:r},i){let s=i>0?-1:0;rG(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,SE(c.attrs,i-e.colCount(u))),a+=c.attrs.rowspan-1}else{const u=s==null?zn(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 dG(t,e){if(!go(t))return!1;if(e){const n=jo(t);e(AE(t.tr,n,n.left))}return!0}function fG(t,e){if(!go(t))return!1;if(e){const n=jo(t);e(AE(t.tr,n,n.right))}return!0}function pG(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,ha(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 hG(t,e){if(!go(t))return!1;if(e){const n=jo(t),r=t.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let i=n.right-1;pG(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=rn.get(s)}e(r)}return!0}function mG(t,e,n){var r;const i=zn(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 OE(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;mG(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?zn(r.type.schema).cell:(s=r.nodeAt(e.map[f+u*e.width]))==null?void 0:s.type,m=p==null?void 0:p.createAndFill();m&&l.push(m)}return t.insert(a,zn(r.type.schema).row.create(null,l)),t}function gG(t,e){if(!go(t))return!1;if(e){const n=jo(t);e(OE(t.tr,n,n.top))}return!0}function bG(t,e){if(!go(t))return!1;if(e){const n=jo(t);e(OE(t.tr,n,n.bottom))}return!0}function vG(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,b=m.type.create({...g,rowspan:m.attrs.rowspan-1},m.content),v=e.positionAt(i+1,c,n);t.insert(t.mapping.slice(l).map(r+v),b),c+=g.colspan-1}}}}function yG(t,e){if(!go(t))return!1;if(e){const n=jo(t),r=t.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let i=n.bottom-1;vG(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=rn.get(n.table)}e(r)}return!0}function ME(t){const e=t.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function wG({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 BE(t,e){const n=t.selection;if(!(n instanceof zt)||n.$anchorCell.pos==n.$headCell.pos)return!1;const r=jo(t),{map:i}=r;if(wG(i,r))return!1;if(e){const s=t.tr,a={};let l=fe.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{ME(g)||(l=l.append(g.content));const b=s.mapping.map(m+r.tableStart);s.delete(b,b+g.nodeSize)}}if(u==null||c==null)return!0;if(s.setNodeMarkup(u+r.tableStart,null,{...SE(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=ME(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 IE(t,e){const n=zn(t.schema);return xG(({node:r})=>n[r.type.spec.tableRole])(t,e)}function xG(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=eG(i.$from),!s)return!1;a=(r=Ol(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=jo(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 b=f.map.positionAt(g,f.left,f.table);g==f.top&&(b+=s.nodeSize);for(let v=f.left,w=0;v<f.right;v++,w++)v==f.left&&g==f.top||p.insert(m=p.mapping.map(b+f.tableStart,1),t({node:s,row:g,col:v}).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 CG(t,e){return function(n,r){if(!go(n))return!1;const i=Bp(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 EG(t){return function(e,n){if(!go(e))return!1;if(n){const r=zn(e.schema),i=jo(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 RE(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 bc(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?EG(t):function(n,r){if(!go(n))return!1;if(r){const i=zn(n.schema),s=jo(n),a=n.tr,l=RE("row",s,i),u=RE("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 b=g+s.tableStart,v=a.doc.nodeAt(b);v&&a.setNodeMarkup(b,m,v.attrs)}),r(a)}return!0}}bc("row",{useDeprecatedLogic:!0}),bc("column",{useDeprecatedLogic:!0});var kG=bc("cell",{useDeprecatedLogic:!0});function SG(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 LE(t){return function(e,n){if(!go(e))return!1;const r=SG(Bp(e),t);if(r==null)return!1;if(n){const i=e.doc.resolve(r);n(e.tr.setSelection(Ae.between(i,nG(i))).scrollIntoView())}return!0}}function _G(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 Ip(t,e){const n=t.selection;if(!(n instanceof zt))return!1;if(e){const r=t.tr,i=zn(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 Ee(i,0,0))}),r.docChanged&&e(r)}return!0}function TG(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=_b(zn(a).row,new Ee(c,f,p)).content),l.push(c)}else if(s=="cell"||s=="header_cell")l.push(n||r?_b(zn(a).row,new Ee(e,n,r)).content:e);else return null;return AG(a,l)}function AG(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(fe.empty),n[i]<r){const s=zn(t).cell.createAndFill(),a=[];for(let l=n[i];l<r;l++)a.push(s);e[i]=e[i].append(fe.from(a))}return{height:e.length,width:r,rows:e}}function _b(t,e){const n=t.createAndFill();return new lm(n).replace(0,n.content.size,e).doc}function OG({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(ha(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(fe.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(fe.from(u))}n=s,e=i}return{width:t,height:e,rows:n}}function MG(t,e,n,r,i,s,a){const l=t.doc.type.schema,u=zn(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 b=[];let v;g.lastChild==null||g.lastChild.type==u.cell?v=c||(c=u.cell.createAndFill()):v=f||(f=u.header_cell.createAndFill());for(let w=e.width;w<i;w++)b.push(v);t.insert(t.mapping.slice(a).map(m-1+r),b)}if(s>e.height){const p=[];for(let b=0,v=(e.height-1)*e.width;b<Math.max(e.width,i);b++){const w=b>=e.width?!1:n.nodeAt(e.map[v+b]).type==u.header_cell;p.push(w?f||(f=u.header_cell.createAndFill()):c||(c=u.cell.createAndFill()))}const m=u.row.create(null,fe.from(p)),g=[];for(let b=e.height;b<s;b++)g.push(m);t.insert(t.mapping.slice(a).map(r+n.nodeSize-2),g)}return!!(c||f)}function PE(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:b}=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,b,n)),m.type.createAndFill({...m.attrs,rowspan:g+m.attrs.rowspan-a})),c+=m.attrs.colspan-1}}return u}function DE(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),b=t.mapping.slice(l).map(p+r);t.setNodeMarkup(b,null,ha(m.attrs,a-g,m.attrs.colspan-(a-g))),t.insert(b+m.nodeSize,m.type.createAndFill(ha(m.attrs,0,a-g))),c+=m.attrs.rowspan-1}}return u}function VE(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=rn.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=rn.get(s),m=p.mapping.maps.length}MG(p,a,s,n,c,f,m)&&g(),PE(p,a,s,n,u,c,l,m)&&g(),PE(p,a,s,n,u,c,f,m)&&g(),DE(p,a,s,n,l,f,u,m)&&g(),DE(p,a,s,n,l,f,c,m)&&g();for(let b=l;b<f;b++){const v=a.positionAt(b,u,s),w=a.positionAt(b,c,s);p.replace(p.mapping.slice(m).map(v+n),p.mapping.slice(m).map(w+n),new Ee(i.rows[b-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 BG=$m({ArrowLeft:Lp("horiz",-1),ArrowRight:Lp("horiz",1),ArrowUp:Lp("vert",-1),ArrowDown:Lp("vert",1),"Shift-ArrowLeft":Pp("horiz",-1),"Shift-ArrowRight":Pp("horiz",1),"Shift-ArrowUp":Pp("vert",-1),"Shift-ArrowDown":Pp("vert",1),Backspace:Ip,"Mod-Backspace":Ip,Delete:Ip,"Mod-Delete":Ip});function Rp(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function Lp(t,e){return(n,r,i)=>{if(!i)return!1;const s=n.selection;if(s instanceof zt)return Rp(n,r,ze.near(s.$headCell,e));if(t!="horiz"&&!s.empty)return!1;const a=FE(i,t,e);if(a==null)return!1;if(t=="horiz")return Rp(n,r,ze.near(n.doc.resolve(s.head+e),e));{const l=n.doc.resolve(a),u=kE(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),Rp(n,r,c)}}}function Pp(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=FE(i,t,e);if(u==null)return!1;a=new zt(n.doc.resolve(u))}const l=kE(a.$headCell,t,e);return l?Rp(n,r,new zt(a.$anchorCell,l)):!1}}function IG(t,e){const n=t.state.doc,r=Ol(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new zt(r))),!0):!1}function RG(t,e,n){if(!go(t.state))return!1;let r=TG(n);const i=t.state.selection;if(i instanceof zt){r||(r={width:1,height:1,rows:[fe.from(_b(zn(t.state.schema).cell,n))]});const s=i.$anchorCell.node(-1),a=i.$anchorCell.start(-1),l=rn.get(s).rectBetween(i.$anchorCell.pos-a,i.$headCell.pos-a);return r=OG(r,l.right-l.left,l.bottom-l.top),VE(t.state,t.dispatch,a,l,r),!0}else if(r){const s=Bp(t.state),a=s.start(-1);return VE(t.state,t.dispatch,a,rn.get(s.node(-1)).findCell(s.pos-a),r),!0}else return!1}function LG(t,e){var n;if(e.ctrlKey||e.metaKey)return;const r=$E(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=Ol(t.state.selection.$anchor))!=null&&((n=Tb(t,e))==null?void 0:n.pos)!=i.pos)s(i,e),e.preventDefault();else if(!r)return;function s(u,c){let f=Tb(t,c);const p=gs.getState(t.state)==null;if(!f||!Sb(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(gs,u.pos),t.dispatch(g)}}function a(){t.root.removeEventListener("mouseup",a),t.root.removeEventListener("dragstart",a),t.root.removeEventListener("mousemove",l),gs.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(gs,-1))}function l(u){const c=u,f=gs.getState(t.state);let p;if(f!=null)p=t.state.doc.resolve(f);else if($E(t,c.target)!=r&&(p=Tb(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 FE(t,e,n){if(!(t.state.selection instanceof Ae))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 $E(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function Tb(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});return n&&n?Ol(t.state.doc.resolve(n.pos)):null}var PG=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")),Ab(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,Ab(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function Ab(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:b}=f.child(p).attrs;for(let v=0;v<g;v++,m++){const w=i==m?s:b&&b[v],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 k=document.createElement("col");k.style.width=x,e.appendChild(k)}}}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 Cr=new Et("tableColumnResizing");function DG({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:r=PG,lastColumnResizable:i=!0}={}){const s=new et({key:Cr,state:{init(a,l){var u,c;const f=(c=(u=s.spec)==null?void 0:u.props)==null?void 0:c.nodeViews,p=zn(l.schema).table.name;return r&&f&&(f[p]=(m,g)=>new r(m,n,g)),new VG(-1,!1)},apply(a,l){return l.apply(a)}},props:{attributes:a=>{const l=Cr.getState(a);return l&&l.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(a,l)=>{FG(a,l,t,i)},mouseleave:a=>{$G(a)},mousedown:(a,l)=>{zG(a,l,e,n)}},decorations:a=>{const l=Cr.getState(a);if(l&&l.activeHandle>-1)return qG(a,l.activeHandle)},nodeViews:{}}});return s}var VG=class qh{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta(Cr);if(r&&r.setHandle!=null)return new qh(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new qh(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let i=e.mapping.map(n.activeHandle,-1);return kb(e.doc.resolve(i))||(i=-1),new qh(i,n.dragging)}return n}};function FG(t,e,n,r){if(!t.editable)return;const i=Cr.getState(t.state);if(i&&!i.dragging){const s=UG(e.target);let a=-1;if(s){const{left:l,right:u}=s.getBoundingClientRect();e.clientX-l<=n?a=zE(t,e,"left",n):u-e.clientX<=n&&(a=zE(t,e,"right",n))}if(a!=i.activeHandle){if(!r&&a!==-1){const l=t.state.doc.resolve(a),u=l.node(-1),c=rn.get(u),f=l.start(-1);if(c.colCount(l.pos-f)+l.nodeAfter.attrs.colspan-1==c.width-1)return}UE(t,a)}}}function $G(t){if(!t.editable)return;const e=Cr.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&UE(t,-1)}function zG(t,e,n,r){var i;if(!t.editable)return!1;const s=(i=t.dom.ownerDocument.defaultView)!=null?i:window,a=Cr.getState(t.state);if(!a||a.activeHandle==-1||a.dragging)return!1;const l=t.state.doc.nodeAt(a.activeHandle),u=HG(t,a.activeHandle,l.attrs);t.dispatch(t.state.tr.setMeta(Cr,{setDragging:{startX:e.clientX,startWidth:u}}));function c(p){s.removeEventListener("mouseup",c),s.removeEventListener("mousemove",f);const m=Cr.getState(t.state);m!=null&&m.dragging&&(WG(t,m.activeHandle,HE(m.dragging,p,n)),t.dispatch(t.state.tr.setMeta(Cr,{setDragging:null})))}function f(p){if(!p.which)return c(p);const m=Cr.getState(t.state);if(m&&m.dragging){const g=HE(m.dragging,p,n);WE(t,m.activeHandle,g,r)}}return WE(t,a.activeHandle,u,r),s.addEventListener("mouseup",c),s.addEventListener("mousemove",f),e.preventDefault(),!0}function HG(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 UG(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function zE(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=Ol(t.state.doc.resolve(a));if(!l)return-1;if(n=="right")return l.pos;const u=rn.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 HE(t,e,n){const r=e.clientX-t.startX;return Math.max(n,t.startWidth+r)}function UE(t,e){t.dispatch(t.state.tr.setMeta(Cr,{setHandle:e}))}function WG(t,e,n){const r=t.state.doc.resolve(e),i=r.node(-1),s=rn.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 b=m.colwidth?m.colwidth.slice():jG(m.colspan);b[g]=n,u.setNodeMarkup(a+p,null,{...m,colwidth:b})}u.docChanged&&t.dispatch(u)}function WE(t,e,n,r){const i=t.state.doc.resolve(e),s=i.node(-1),a=i.start(-1),l=rn.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&&Ab(s,u.firstChild,u,r,l,n)}function jG(t){return Array(t).fill(0)}function qG(t,e){var n;const r=[],i=t.doc.resolve(e),s=i.node(-1);if(!s)return ft.empty;const a=rn.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=Cr.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 ft.create(t.doc,r)}function KG({allowTableNodeSelection:t=!1}={}){return new et({key:gs,state:{init(){return null},apply(e,n){const r=e.getMeta(gs);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:iG,handleDOMEvents:{mousedown:LG},createSelectionBetween(e){return gs.getState(e.state)!=null?e.state.selection:null},handleTripleClick:IG,handleKeyDown:BG,handlePaste:RG},appendTransaction(e,n,r){return lG(r,TE(r,n),t)}})}const GG=(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)},XG=(t,e,n)=>{const{doc:r,selection:i}=t;return!r||!i||!(i instanceof zt)||i.forEachCell((s,a)=>{t=GG(t,a,n)}),t},jE=(t,e)=>({tr:n,state:r,dispatch:i})=>{const{selection:s}=r;return n=n.setSelection(s),n=XG(n,e,t),n.docChanged?(i==null||i(n),!0):!1},YG=Je.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)}}}),JG=Bt.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",bt(this.options.HTMLAttributes,t),0]}}),ZG=Bt.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",bt(this.options.HTMLAttributes,t),0]}}),QG=Bt.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",bt(this.options.HTMLAttributes,t),0]}});function Ob(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function qE(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:b}=f.child(p).attrs;for(let v=0;v<g;v+=1,m+=1){const w=i===m?s:b&&b[v],x=w?`${w}px`:"";if(l+=w||r,w||(u=!1),c){if(c.style.width!==x){const[k,E]=Ob(r,w);c.style.setProperty(k,E)}c=c.nextSibling}else{const k=document.createElement("col"),[E,C]=Ob(r,w);k.style.setProperty(E,C),e.appendChild(k)}}}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 NG{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")),qE(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,qE(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){return e.type==="attributes"&&(e.target===this.table||this.colgroup.contains(e.target))}}function eX(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:b}=l.child(p).attrs;for(let v=0;v<g;v+=1,m+=1){const w=n===m?r:b&&b[v];i+=w||e,w||(s=!1);const[x,k]=Ob(e,w);a.push(["col",{style:`${x}: ${k}`}])}}const u=s?`${i}px`:"",c=s?"":`${i}px`;return{colgroup:["colgroup",{},...a],tableWidth:u,tableMinWidth:c}}function KE(t,e){return t.createAndFill()}function tX(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 nX(t,e,n,r,i){const s=tX(t),a=[],l=[];for(let c=0;c<n;c+=1){const f=KE(s.cell);if(f&&l.push(f),r){const p=KE(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 rX(t){return t instanceof zt}const Dp=({editor:t})=>{const{selection:e}=t.state;if(!rX(e))return!1;let n=0;const r=c4(e.ranges[0].$from,s=>s.type.name==="table");return r==null||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},oX=Bt.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,handleWidth:5,cellMinWidth:25,View:NG,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}=eX(t,this.options.cellMinWidth);return["table",bt(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=nX(s.schema,t,e,n);if(i){const l=r.selection.from+1;r.replaceSelectionWith(a).scrollIntoView().setSelection(Ae.near(r.doc.resolve(l)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>dG(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>fG(t,e),deleteColumn:()=>({state:t,dispatch:e})=>hG(t,e),addRowBefore:()=>({state:t,dispatch:e})=>gG(t,e),addRowAfter:()=>({state:t,dispatch:e})=>bG(t,e),deleteRow:()=>({state:t,dispatch:e})=>yG(t,e),deleteTable:()=>({state:t,dispatch:e})=>_G(t,e),mergeCells:()=>({state:t,dispatch:e})=>BE(t,e),splitCell:()=>({state:t,dispatch:e})=>IE(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>bc("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>bc("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>kG(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>BE(t,e)?!0:IE(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>CG(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>LE(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>LE(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&TE(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:Dp,"Mod-Backspace":Dp,Delete:Dp,"Mod-Delete":Dp}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[DG({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],KG({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:at(Pe(t,"tableRole",e))}}}),iX=/(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,sX=/CrOS/,aX=/android|ipad|playbook|silk/i;function GE(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:!!(iX.test(e)&&!sX.test(e)||t.tablet&&aX.test(e)||t.tablet&&t.featureDetect&&navigator&&navigator.maxTouchPoints>1&&e.includes("Macintosh")&&e.includes("Safari"))}const lX=["disabled"],uX={"content-class":"table-grid-size-editor","content-style":"padding:0"},cX={class:"flex flex-col flex-wrap gap-1 justify-between"},dX=["onMouseover","onMousedown"],fX={class:"text-center text-sm text-zinc-600 mt-2"},pX=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:GE()?Pd:Ld,cols:GE()?Pd:Ld}),a=o.reactive({rows:Dd,cols:Dd});function l(f,p){f===s.rows&&(s.rows=Math.min(f+1,Pd)),p===s.cols&&(s.cols=Math.min(p+1,Pd)),a.rows=f,a.cols=p}function u(f,p){n("create-table",{rows:f,cols:p,withHeaderRow:o.unref(i)}),c()}function c(){r.value=!1,i.value=!1,s.rows=Ld,s.cols=Ld,a.rows=Dd,a.cols=Dd}return(f,p)=>(o.openBlock(),o.createBlock(o.unref(na),null,{default:o.withCtx(()=>[o.createVNode(o.unref(bl),{"as-child":""},{default:o.withCtx(()=>[o.createElementVNode("button",{disabled:t.disabled,class:"m-0 p-0"},[o.renderSlot(f.$slots,"trigger")],8,lX)]),_:3}),o.createVNode(o.unref(ra),{class:"w-full",align:"start",side:"bottom"},{default:o.withCtx(()=>[o.createElementVNode("div",uX,[o.createElementVNode("div",cX,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(s.rows,m=>(o.openBlock(),o.createElementBlock("div",{key:"r"+m,class:"flex gap-1"},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(s.cols,g=>(o.openBlock(),o.createElementBlock("div",{key:"c"+g,class:o.normalizeClass([[g<=a.cols&&m<=a.rows&&"bg-ed-foreground border-ed-border","cursor-pointer"],"pa-1"]),onMouseover:b=>l(m,g),onMousedown:b=>u(m,g)},p[0]||(p[0]=[o.createElementVNode("div",{class:"w-4 h-4 p-1 border box-border"},null,-1)]),42,dX))),128))]))),128))]),o.createElementVNode("div",fX,o.toDisplayString(a.rows)+" x "+o.toDisplayString(a.cols),1)])]),_:1})]),_:3}))}}),hX={style:{display:"flex"}},mX=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(pX,{disabled:r.editor.isActive("table"),onCreateTable:n},{trigger:o.withCtx(()=>[o.createElementVNode("div",hX,[o.createVNode(Ke,{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"]))}}),Mb=oX.extend({addStorage(){return{isTableMenuOpen:!1}},addCommands(){var t;return{...(t=this.parent)==null?void 0:t.call(this),toggleTableEditor:e=>({editor:n})=>n.storage.table?(n.storage.table.isTableEditorOpen=e,!0):!1}},addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),resizable:!0,lastColumnResizable:!0,allowTableNodeSelection:!1,button:({editor:e,t:n})=>({component:mX,componentProps:{icon:"Table",tooltip:n("editor.table.tooltip"),action:()=>{var i;const r=((i=e.storage.table)==null?void 0:i.isTableEditorOpen)??!1;e.commands.toggleTableEditor(!r)}}})}},addExtensions(){return[ZG.configure(this.options.tableRow),JG.configure(this.options.tableHeader),QG.configure(this.options.tableCell),YG.configure(this.options.tableCellBackground)]}}),gX={class:"flex items-center gap-2 px-2"},bX=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}=Ot(),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)=>{var l;return o.openBlock(),o.createBlock(la,{title:(l=i.value)==null?void 0:l.label,"side-offset":5},{default:o.withCtx(()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(r.value,(u,c)=>{var f;return o.openBlock(),o.createBlock(o.unref(kl),{key:c,class:"cursor-pointer",checked:((f=u.isActive)==null?void 0:f.call(u))||!1,onClick:u.action},{default:o.withCtx(()=>[o.createElementVNode("div",gX,[o.createVNode(o.unref(Lt),{name:u.iconName,class:"h3 w-3"},null,8,["name"]),o.createElementVNode("span",null,o.toDisplayString(u.label),1)])]),_:2},1032,["checked","onClick"])}),128))]),_:1},8,["title"])}}}),vX=Je.create({name:"text-bubble",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),toolbar:!1,button:()=>({component:bX,componentProps:{}})}}}),yX=[{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}년"}],wX=t=>{const e=[...t||[],...yX.map(n=>n.pattern)].join("|");return new RegExp(e,"gu")},xX=Je.create({name:"time-highlighter",addOptions(){return{additionalTimeWords:[]}},addStorage(){return{cachedRegex:null,cachedAdditionalWords:null}},addProseMirrorPlugins(){return[new et({props:{decorations:t=>{const e=[];return(this.storage.cachedAdditionalWords!==this.options.additionalTimeWords||!this.storage.cachedRegex)&&(this.storage.cachedAdditionalWords=this.options.additionalTimeWords,this.storage.cachedRegex=wX(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"}))}}),ft.create(t.doc,e)}}})]}}),CX=Je.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(Ae.create(t.doc,r));return e&&e(i.scrollIntoView()),n&&n.focus(),!0}}}});function Bb(t){const e=JSON.stringify(t),n=window.ReactNativeWebView;if(n){n.postMessage(e);return}console.warn("[clipboardBridge] no bridge found")}function EX(){return new Promise(t=>{const e=window.receiveDriverData;window.receiveDriverData=n=>{var i;e&&e(n);let r;try{r=typeof n=="string"?JSON.parse(n):n}catch{return}(r==null?void 0:r.type)==="CLIPBOARD_STATE"&&t(!!((i=r.data)!=null&&i.hasClipboard))},Bb({type:"REQUEST_CLIPBOARD_STATE"})})}function kX(){return new Promise(t=>{const e=window.receiveDriverData;window.receiveDriverData=n=>{var i;e&&e(n);let r;try{r=typeof n=="string"?JSON.parse(n):n}catch{return}(r==null?void 0:r.type)==="PASTE_RESULT"&&t(((i=r.data)==null?void 0:i.text)??null)},Bb({type:"PASTE"})})}function SX(t,e){Bb({type:"COPY",data:{html:t,text:e}})}async function _X(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 TX(){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 AX=Je.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=no.fromSchema(t.schema).serializeFragment(i.content),l=document.createElement("div");l.appendChild(a);const u=l.innerHTML,c=e.doc.textBetween(n,r,`
293
- `);t.storage.deviceEnv.isMobile?SX(u,c):await _X(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 kX():await TX();if(!e)return;const n=new DataTransfer;n.setData("text/html",e),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 EX():await navigator.clipboard.readText())}catch(e){return console.warn("[clipboard] check failed",e),!1}}}}),OX=Je.create({name:"deviceEnv",addOptions(){return{initial:!1}},addStorage(){return{isMobile:this.options.initial}},addCommands(){return{setIsMobile:t=>({editor:e})=>{var n;return e.storage.deviceEnv.isMobile=t,(n=e.storage.spellchecker)==null||n.spellchecker.setIsMobile(t),!0}}}}),Vp=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(mD),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"]))}}),MX={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"},BX={key:0,class:"flex justify-center items-center gap-3 text-s"},IX={key:1,class:"flex justify-between items-center w-full"},RX={class:"flex justify-center items-center gap-3"},LX={class:"text-sm"},PX={class:"flex items-center gap-2"},DX=o.defineComponent({__name:"VideoUploader",props:{...js},setup(t){const e=t,n=o.ref(""),r=o.ref(!1),i=o.ref(),{t:s}=Ot();function a(f){var v;r.value=!0;const p=f.target,m=Array.from((p==null?void 0:p.files)||[]),g=(v=e.editor.extensionManager.extensions.find(w=>w.name==="videoUpload"))==null?void 0:v.options;if(!e.editor||e.editor.isDestroyed||m.length===0||typeof(g==null?void 0:g.upload)!="function")return;const b=m[0];g.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(),r.value=!1})}function l(){e.editor.chain().setVideo({src:n.value,width:640}).deleteRange({from:e.getPos(),to:e.getPos()}).insertContentAt(e.getPos()+1,{type:"paragraph"}).focus().run()}function u(){e.deleteNode()}function c(){var f;(f=i.value)==null||f.click()}return(f,p)=>(o.openBlock(),o.createBlock(o.unref(Ws),{as:"div","data-drag-handle":""},{default:o.withCtx(()=>[o.createVNode(o.unref(na),{"default-open":""},{default:o.withCtx(()=>[o.createVNode(o.unref(bl),{"as-child":""},{default:o.withCtx(()=>[o.createElementVNode("div",MX,[r.value?(o.openBlock(),o.createElementBlock("div",BX,[o.createVNode(o.unref(Lt),{class:"animate-spin w-6 h-6",name:"LoaderCircle"}),o.createElementVNode("span",null,o.toDisplayString(o.unref(s)("editor.video.dialog.uploading"))+"...",1)])):(o.openBlock(),o.createElementBlock("div",IX,[o.createElementVNode("div",RX,[o.createVNode(o.unref(Lt),{name:"Video",class:"w-6 h-6"}),o.createElementVNode("span",LX,o.toDisplayString(o.unref(s)("editor.video.dialog.title")),1)]),o.createVNode(o.unref(Lt),{name:"Trash2",class:"hover:text-ed-foreground",onClick:o.withModifiers(u,["stop"])})]))])]),_:1}),o.createVNode(o.unref(ra),{"trap-focus":"",class:"w-full","on-open-auto-focus":m=>m.preventDefault()},{default:o.withCtx(()=>[o.createVNode(o.unref($1),{"default-value":"upload",class:"w-[300px] sm:w-[400px]","activation-mode":"manual"},{default:o.withCtx(()=>[o.createVNode(o.unref(z1),{class:"grid w-full grid-cols-2"},{default:o.withCtx(()=>[o.createVNode(o.unref(Wu),{value:"upload"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(s)("editor.video.dialog.tab.upload")),1)]),_:1}),o.createVNode(o.unref(Wu),{value:"link",disabled:r.value},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(s)("editor.video.dialog.link")),1)]),_:1},8,["disabled"])]),_:1}),o.createVNode(o.unref(Vp),{value:"upload"},{default:o.withCtx(()=>[o.createVNode(o.unref(wn),{class:"w-full mt-1",size:"sm",disabled:r.value,onClick:c},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(s)("editor.video.dialog.tab.upload")),1)]),_:1},8,["disabled"]),o.createElementVNode("input",{ref_key:"fileInput",ref:i,type:"file",accept:"video/*",hidden:"",onChange:a},null,544)]),_:1}),o.createVNode(o.unref(Vp),{value:"link"},{default:o.withCtx(()=>[o.createElementVNode("div",PX,[o.createVNode(o.unref(gl),{modelValue:n.value,"onUpdate:modelValue":p[0]||(p[0]=m=>n.value=m),type:"url",autofocus:"",required:"",placeholder:o.unref(s)("editor.video.dialog.placeholder")},null,8,["modelValue","placeholder"]),o.createVNode(o.unref(wn),{onClick:l},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(s)("editor.video.dialog.button.apply")),1)]),_:1})])]),_:1})]),_:1})]),_:1},8,["on-open-auto-focus"])]),_:1})]),_:1}))}}),XE=Bt.create({name:"videoUpload",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 qs(DX)},addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),upload:()=>Promise.reject("link video not found"),button:({editor:e,t:n})=>{var r,i;return{component:Ke,componentProps:{action:()=>e.commands.setVideoUpload(),isActive:()=>e.isActive("video")||!1,disabled:!((i=(r=e.can()).setVideo)!=null&&i.call(r,{})),icon:"Video",tooltip:n("editor.video.tooltip")}}}}}});function VX(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 FX(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 YE=Bt.create({name:"video",group:"block",atom:!0,draggable:!0,addOptions(){return{divider:!1,spacer:!1,allowFullscreen:!0,upload:void 0,width:Vd["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?VX(t):null})},width:{default:this.options.width,renderHTML:({width:t})=>({width:an(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: ${an(n)};`;return FX(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)}}}),Ml=new Et("upload-image"),$X=()=>new et({key:Ml,state:{init(){return ft.empty},apply(t,e){e=e.map(t.mapping,t.doc);const n=t.getMeta(Ml);return n!=null&&n.add?n.add.forEach(({id:r,pos:i,src:s})=>{const a=zX(s),l=jt.widget(i,a,{id:r});e=e.add(t.doc,[l])}):n!=null&&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 zX(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 HX(t,e){var i;const r=Ml.getState(t).find(void 0,void 0,s=>s.id===e);return r.length?(i=r[0])==null?void 0:i.from:null}const JE=({validateFn:t,onUpload:e})=>(n,r,i,s)=>{n.forEach(a=>{if(t&&!t(a))return;s||(s=hi(6));const l=r.state.tr;l.selection.empty||l.deleteSelection();let u=null;r.state.doc.descendants((p,m)=>{p.type.name===ms&&p.attrs.id===s&&(u=m)});const c=URL.createObjectURL(a);l.setMeta(Ml,{add:[{id:s,pos:i,src:c}]}),r.dispatch(l);const f=HX(r.state,s)||u;e(a).then(p=>{var k,E;const{schema:m}=r.state;if(f===null)throw new Error("Not found placeholderPos");const g=typeof p=="object"?c:p,b=(k=m.nodes.image)==null?void 0:k.create({src:g}),v=(E=m.nodes.paragraph)==null?void 0:E.create();if(!b||!v)return;const w=r.state.tr.replaceWith(f,f,b).insert(f+b.nodeSize,v).setMeta(Ml,{remove:[s]}),x=f+b.nodeSize+1;w.setSelection(Ae.create(w.doc,x)),r.dispatch(w),r.focus()},()=>{const p=r.state.tr.delete(i,i).setMeta(Ml,{remove:[s]});r.dispatch(p)})})},UX=(t,e,n)=>{var i;const r=Array.from(((i=e.clipboardData)==null?void 0:i.files)||[]);if(r.length){e.preventDefault();const s=t.state.selection.from;return n(r,t,s+1),!0}return!1},WX=(t,e,n,r)=>{var s;const i=Array.from(((s=e.dataTransfer)==null?void 0:s.files)||[]);if(!n&&i.length){e.preventDefault();const a=t.posAtCoords({left:e.clientX,top:e.clientY});if(a)return r(i,t,a.pos+1),!0}return!1},jX={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"},qX={class:"flex items-center justify-between w-full"},KX={class:"flex items-center justify-center gap-3"},GX={class:"text-sm"},XX={class:"flex items-center gap-2"},YX=o.defineComponent({__name:"ImageUploader",props:{...js},setup(t){const e=t,n=o.ref(""),r=o.ref(),{t:i}=Ot(),s=o.inject("isEditable",o.ref(!0));function a(f){var v,w;const p=(v=f==null?void 0:f.target)==null?void 0:v.files;if(!e.editor||e.editor.isDestroyed||p.length===0)return;const m=p[0],g=(w=e.editor.extensionManager.extensions.find(x=>x.name==="imageUpload"))==null?void 0:w.options;JE({validateFn:x=>!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(){s.value&&e.deleteNode()}function c(){var f;(f=r.value)==null||f.click()}return(f,p)=>(o.openBlock(),o.createBlock(o.unref(Ws),{id:f.node.attrs.id,class:"p-0 m-0","data-drag-handle":""},{default:o.withCtx(()=>[o.createVNode(o.unref(na),{"default-open":""},{default:o.withCtx(()=>[o.createVNode(o.unref(bl),{"as-child":""},{default:o.withCtx(()=>[o.createElementVNode("div",jX,[o.createElementVNode("div",qX,[o.createElementVNode("div",KX,[o.createVNode(o.unref(Lt),{name:"ImageUp",class:"w-6 h-6"}),o.createElementVNode("span",GX,o.toDisplayString(o.unref(i)("editor.image.dialog.title")),1)]),o.createVNode(o.unref(Lt),{name:"Trash2",class:"hover:text-ed-foreground",onClick:o.withModifiers(u,["stop"])})])])]),_:1}),o.unref(s)?(o.openBlock(),o.createBlock(o.unref(ra),{key:0,"trap-focus":"",class:"w-full","on-open-auto-focus":m=>m.preventDefault()},{default:o.withCtx(()=>[o.createVNode(o.unref($1),{"default-value":"upload",class:"w-[300px] sm:w-[400px]","activation-mode":"manual"},{default:o.withCtx(()=>[o.createVNode(o.unref(z1),{class:"grid w-full grid-cols-2"},{default:o.withCtx(()=>[o.createVNode(o.unref(Wu),{value:"upload"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(i)("editor.image.dialog.tab.upload")),1)]),_:1}),o.createVNode(o.unref(Wu),{value:"link"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(i)("editor.image.dialog.tab.url")),1)]),_:1})]),_:1}),o.createVNode(o.unref(Vp),{value:"upload"},{default:o.withCtx(()=>[o.createVNode(o.unref(wn),{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(Vp),{value:"link"},{default:o.withCtx(()=>[o.createElementVNode("div",XX,[o.createVNode(o.unref(gl),{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(wn),{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"])):o.createCommentVNode("",!0)]),_:1})]),_:1},8,["id"]))}}),JX=1,ZX=1e6,wi={ADD_TOAST:"ADD_TOAST",UPDATE_TOAST:"UPDATE_TOAST",DISMISS_TOAST:"DISMISS_TOAST",REMOVE_TOAST:"REMOVE_TOAST"};let Ib=0;function QX(){return Ib=(Ib+1)%Number.MAX_VALUE,Ib.toString()}const Rb=new Map;function ZE(t){if(Rb.has(t))return;const e=setTimeout(()=>{Rb.delete(t),vc({type:wi.REMOVE_TOAST,toastId:t})},ZX);Rb.set(t,e)}const bo=o.ref({toasts:[]});function vc(t){switch(t.type){case wi.ADD_TOAST:bo.value.toasts=[t.toast,...bo.value.toasts].slice(0,JX);break;case wi.UPDATE_TOAST:bo.value.toasts=bo.value.toasts.map(e=>e.id===t.toast.id?{...e,...t.toast}:e);break;case wi.DISMISS_TOAST:{const{toastId:e}=t;e?ZE(e):bo.value.toasts.forEach(n=>{ZE(n.id)}),bo.value.toasts=bo.value.toasts.map(n=>n.id===e||e===void 0?{...n,open:!1}:n);break}case wi.REMOVE_TOAST:t.toastId===void 0?bo.value.toasts=[]:bo.value.toasts=bo.value.toasts.filter(e=>e.id!==t.toastId);break}}function Lb(){return{toasts:o.computed(()=>bo.value.toasts),toast:NX,dismiss:t=>vc({type:wi.DISMISS_TOAST,toastId:t})}}function NX(t){const e=QX(),n=i=>vc({type:wi.UPDATE_TOAST,toast:{...i,id:e}}),r=()=>vc({type:wi.DISMISS_TOAST,toastId:e});return vc({type:wi.ADD_TOAST,toast:{...t,id:e,open:!0,onOpenChange:i=>{i||r()}}}),{id:e,dismiss:r,update:n}}const eY={acceptMimes:["image/jpeg","image/gif","image/png","image/jpg"],maxSize:1024*1024*5},tY=t=>`${(t/1024/1024).toFixed(2)}MB`,QE=Bt.create({name:"imageUpload",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:hi(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 qs(YX)},addOptions(){var t;return{...eY,...(t=this.parent)==null?void 0:t.call(this),upload:()=>Promise.reject("Image Upload Function"),button:({editor:e,extension:n,t:r})=>{var i,s;return{component:Ke,componentProps:{action:()=>e.commands.setImageUpload(),disabled:!((s=(i=e.can()).setImage)!=null&&s.call(i,{})),icon:"ImageUp",tooltip:r("editor.image.tooltip")}}}}},addProseMirrorPlugins(){const{toast:t}=Lb(),{t:e}=Ot(),r=JE({validateFn:i=>this.options.acceptMimes.includes(i.type)?i.size>this.options.maxSize?(t({description:`${e("editor.imageUpload.fileSizeTooBig")} ${tY(this.options.maxSize)}.`,duration:2e3}),!1):!0:(t({description:e("editor.imageUpload.fileTypeNotSupported"),duration:2e3}),!1),onUpload:this.options.upload});return[new et({props:{handlePaste:(i,s)=>!s.clipboardData||Array.from(s.clipboardData.items||[]).some(l=>l.type==="text/html")?!1:UX(i,s,r),handleDrop:(i,s,a,l)=>(!(s instanceof DragEvent)||!s.dataTransfer||WX(i,s,l,r),!1)}}),$X()]}}),nY=Je.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}`}}}}}]}}),NE=Je.create({name:"base-kit",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),timeHighlighter:{additionalTimeWords:[]},bubble:{list:zB,defaultBubbleList:Cj,button:({editor:e,extension:n,t:r})=>{var l;const{list:i={},defaultBubbleList:s}=((l=n.options)==null?void 0:l.bubble)??{},a=(s==null?void 0:s(e))??[];return Ej(i,a,{editor:e,extension:n,t:r})}}}},addExtensions(){var n,r,i;const{t}=Ot(),e=[];this.options.placeholder!==!1&&e.push(V8.configure({placeholder:({node:s,pos:a})=>{var u;const l=(u=s==null?void 0:s.type)==null?void 0:u.name;return l==="heading"?`${t(`editor.heading.h${s.attrs.level}.tooltip`)}`:l==="table"||l==="codeBlock"?"":a===0?t("editor.content"):""},...this.options.placeholder})),this.options.focus!==!1&&e.push(cj.configure({className:"focus",...this.options.focus})),this.options.document!==!1&&(this.options.page?(e.push(z8.configure().extend({content:"page+"})),e.push(fK.configure({types:((r=(n=this.options.page)==null?void 0:n.nodesComputedOption)==null?void 0:r.types)??[],slots:o.useSlots()}))):e.push(z8.configure())),this.options.dropcursor!==!1&&e.push(uj.configure({...this.options.dropcursor,width:2,class:"ProseMirror-dropcursor border-black"})),this.options.characterCount!==!1&&e.push(sj.configure(this.options.characterCount)),this.options.paragraph!==!1&&e.push(D8.configure(this.options.paragraph)),this.options.hardBreak!==!1&&e.push(P8.configure(this.options.hardBreak)),this.options.listItem!==!1&&e.push(yj.configure(this.options.listItem)),this.options.textStyle!==!1&&e.push(KU.configure(this.options.textStyle)),this.options.imageUpload!==!1&&e.push(QE.configure(this.options.imageUpload)),this.options.video!==!1&&e.push(YE.configure(this.options.video)),this.options.videoUpload!==!1&&e.push(XE.configure(this.options.videoUpload)),this.options.history!==!1&&e.push(zg.configure(this.options.history)),this.options.fontSize!==!1&&e.push(r8.configure(this.options.fontSize)),this.options.fontFamily!==!1&&e.push(mE.configure(this.options.fontFamily)),this.options.mode!==Be.EDITOR&&e.push(yK),this.options.superText!==!1&&this.options.mode!==Be.PLAIN_TEXT&&this.options.mode!==Be.EDITOR&&(typeof this.options.superText=="boolean"?e.push(xE.configure()):e.push(xE.configure(this.options.superText))),this.options.mode===Be.EDITOR&&(this.options.image!==!1&&e.push(wb.configure()),e.push(t8.configure({spacer:!0}),SC,kC,_C,Vg,Mb,TC,o8.configure({spacer:!0}),n8.configure({types:["heading","paragraph"],spacer:!0}),vE)),this.options.mode!==Be.EDITOR&&this.options.configPlan!==!1&&this.options.mode!==Be.PLAIN_TEXT&&(typeof this.options.configPlan=="boolean"?e.push(EE.configure()):e.push(EE.configure({specialCharModal:(i=this.options.configPlan)==null?void 0:i.specialCharModal}))),this.options.mode!==Be.EDITOR&&this.options.mode!==Be.PLAIN_TEXT&&e.push(xK),(this.options.mode===Be.STRAIGHT||this.options.mode===Be.REPORT||this.options.mode===Be.EDITOR)&&this.options.timeHighlighter&&e.push(xX.configure(this.options.timeHighlighter)),this.options.invalidCharFocus!==!1&&e.push(CX.configure(this.options.invalidCharFocus)),this.options.disabled&&e.push(nY),e.push(wj,F8.configure(),vX.configure(),vj.configure(),xb,vb,pg,AX,OX,i8.configure({multicolor:!0}));for(const s in this.options.excludes)Object.prototype.hasOwnProperty.call(this.options.excludes,s)&&this.options.excludes[s]&&tt.remove(e,({name:l})=>l===s);return e},addStorage(){return{mode:this.options.mode}}}),ek=Vn.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",bt(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()}}}),tk=Vn.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",bt(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()}}}),rY=Je.create({name:"subAndSuperScript",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:e,extension:n,t:r})=>{const i=n.options.subscript,s=n.options.superscript,a={component:Ke,componentProps:{action:()=>e.commands.toggleSubscript(),isActive:()=>e.isActive("subscript")||!1,disabled:!e.can().toggleSubscript(),icon:"Subscript",tooltip:r("editor.subscript.tooltip")}},l={component:Ke,componentProps:{action:()=>e.commands.toggleSuperscript(),isActive:()=>e.isActive("superscript")||!1,disabled:!e.can().toggleSuperscript(),icon:"Superscript",tooltip:r("editor.superscript.tooltip")}},u=[];return i!==!1&&u.push(a),s!==!1&&u.push(l),u}}},addExtensions(){const t=[];return this.options.subscript!==!1&&t.push(ek.configure(this.options.subscript)),this.options.superscript!==!1&&t.push(tk.configure(this.options.superscript)),t}}),oY={class:"ml-1"},iY=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(la,{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(kl),{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(Lt),{key:0,name:s.icon},null,8,["name"])):o.createCommentVNode("",!0),o.createElementVNode("span",oY,o.toDisplayString(s.title),1),s.shortcutKeys?(o.openBlock(),o.createBlock(o.unref(e8),{key:1,class:"ml-auto"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(z6)(s.shortcutKeys)),1)]),_:2},1024)):o.createCommentVNode("",!0)]),_:2},1032,["checked","disabled","onClick"]))),128))]),_:1},8,["icon","tooltip","disabled"]))}}),sY=Je.create({name:"moreMark",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button({editor:e,extension:n,t:r}){const i=n.options.subscript,s=n.options.superscript,a={action:()=>e.commands.toggleSubscript(),isActive:()=>e.isActive("subscript")||!1,disabled:!e.can().toggleSubscript(),icon:"Subscript",title:r("editor.subscript.tooltip"),shortcutKeys:["mod","."]},l={action:()=>e.commands.toggleSuperscript(),isActive:()=>e.isActive("superscript")||!1,disabled:!e.can().toggleSuperscript(),icon:"Superscript",title:r("editor.superscript.tooltip"),shortcutKeys:["mod",","]},u=T0(e,"code"),c=[];if(i!==!1&&c.push(a),s!==!1&&c.push(l),u){const f={action:()=>e.commands.toggleCode(),isActive:()=>e.isActive("code")||!1,disabled:!e.can().toggleCode(),icon:"Code",title:r("editor.code.tooltip"),shortcutKeys:["mod","E"]};u&&c.push(f)}return{component:iY,componentProps:{icon:"Type",tooltip:r("editor.moremark"),disabled:!e.isEditable||c.every(f=>f.disabled),items:c}}}}},addExtensions(){const t=[];return this.options.subscript!==!1&&t.push(ek.configure(this.options.subscript)),this.options.superscript!==!1&&t.push(tk.configure(this.options.superscript)),t}});var ma=(t=>(t[t.max=7]="max",t[t.min=0]="min",t[t.more=1]="more",t[t.less=-1]="less",t))(ma||{});function aY(t,e,n){return t<e?e:t>n?n:t}function lY(t,e,n,r){const{doc:i,selection:s}=t;if(!i||!s||!(s instanceof Ae||s instanceof Ln))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=uY(t,c,e),!1):!n0(u.type.name,r.extensionManager.extensions)}),t}function uY(t,e,n){if(!t.doc)return t;const r=t.doc.nodeAt(e);if(!r)return t;const a=aY((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 nk({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=lY(a,t,e,i),a.docChanged?(r&&r(a),!0):!1}}const cY=Je.create({name:"indent",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),types:["paragraph","heading","blockquote"],minIndent:ma.min,maxIndent:ma.max,button({editor:e,t:n}){var s,a;const{selection:r}=e.state,i=r.$anchor.parent;return[{component:Ke,componentProps:{action:()=>{e.commands.indent()},disabled:((s=i==null?void 0:i.attrs)==null?void 0:s.indent)>=ma.max||!e.can().indent(),shortcutKeys:["Tab"],icon:"IndentIncrease",tooltip:n("editor.indent.tooltip")}},{component:Ke,componentProps:{action:()=>{e.commands.outdent()},shortcutKeys:["Shift","Tab"],disabled:((a=i==null?void 0:i.attrs)==null?void 0:a.indent)<=ma.min||!e.can().outdent(),icon:"IndentDecrease",tooltip:n("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:()=>nk({delta:ma.more,types:this.options.types}),outdent:()=>nk({delta:ma.less,types:this.options.types})}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.indent(),"Shift-Tab":()=>this.editor.commands.outdent()}}});function dY(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:i,allowedPrefixes:s,startOfLine:a,$position:l}=t,u=r&&!i,c=JO(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"),b=((e=l.nodeBefore)===null||e===void 0?void 0:e.isText)&&l.nodeBefore.text;if(!b)return null;const v=l.pos-b.length,w=Array.from(b.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),k=new RegExp(`^[${s==null?void 0:s.join("")}\0]?$`).test(x);if(s!==null&&!k)return null;const E=v+w.index;let C=E+w[0].length;return u&&f.test(b.slice(C-1,C+1))&&(w[0]+=" ",C+=1),E<l.pos&&C>=l.pos?{range:{from:E,to:C},query:w[0].slice(n.length),text:w[0]}:null}const fY=new Et("suggestion");function pY({pluginKey:t=fY,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=dY}){let b;const v=p==null?void 0:p(),w=new et({key:t,view(){return{update:async(x,k)=>{var E,C,_,A,T,L,I;const M=(E=this.key)===null||E===void 0?void 0:E.getState(k),j=(C=this.key)===null||C===void 0?void 0:C.getState(x.state),D=M.active&&j.active&&M.range.from!==j.range.from,Q=!M.active&&j.active,te=M.active&&!j.active,H=!Q&&!te&&M.query!==j.query,F=Q||D&&H,P=H||D,q=te||D&&H;if(!F&&!P&&!q)return;const J=q&&!F?M:j,G=x.dom.querySelector(`[data-decoration-id="${J.decorationId}"]`);b={editor:e,range:J.range,query:J.query,text:J.text,items:[],command:oe=>c({editor:e,range:J.range,props:oe}),decorationNode:G,clientRect:G?()=>{var oe;const{decorationId:xe}=(oe=this.key)===null||oe===void 0?void 0:oe.getState(e.state),Ce=x.dom.querySelector(`[data-decoration-id="${xe}"]`);return(Ce==null?void 0:Ce.getBoundingClientRect())||null}:null},F&&((_=v==null?void 0:v.onBeforeStart)===null||_===void 0||_.call(v,b)),P&&((A=v==null?void 0:v.onBeforeUpdate)===null||A===void 0||A.call(v,b)),(P||F)&&(b.items=await f({editor:e,query:J.query})),q&&((T=v==null?void 0:v.onExit)===null||T===void 0||T.call(v,b)),P&&((L=v==null?void 0:v.onUpdate)===null||L===void 0||L.call(v,b)),F&&((I=v==null?void 0:v.onStart)===null||I===void 0||I.call(v,b))},destroy:()=>{var x;b&&((x=v==null?void 0:v.onExit)===null||x===void 0||x.call(v,b))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(x,k,E,C){const{isEditable:_}=e,{composing:A}=e.view,{selection:T}=x,{empty:L,from:I}=T,M={...k};if(M.composing=A,_&&(L||e.view.composing)){(I<k.range.from||I>k.range.to)&&!A&&!k.composing&&(M.active=!1);const j=g({char:n,allowSpaces:r,allowToIncludeChar:i,allowedPrefixes:s,startOfLine:a,$position:T.$from}),D=`id_${Math.floor(Math.random()*4294967295)}`;j&&m({editor:e,state:C,range:j.range,isActive:k.active})?(M.active=!0,M.decorationId=k.decorationId?k.decorationId:D,M.range=j.range,M.query=j.query,M.text=j.text):M.active=!1}else M.active=!1;return M.active||(M.decorationId=null,M.range={from:0,to:0},M.query=null,M.text=null),M}},props:{handleKeyDown(x,k){var E;const{active:C,range:_}=w.getState(x.state);return C&&((E=v==null?void 0:v.onKeyDown)===null||E===void 0?void 0:E.call(v,{view:x,event:k,range:_}))||!1},decorations(x){const{active:k,range:E,decorationId:C}=w.getState(x);return k?ft.create(x.doc,[jt.inline(E.from,E.to,{nodeName:l,class:u,"data-decoration-id":C})]):null}}});return w}const hY=[{label:"优酷",value:"youku",icon:"Youku"},{label:"哔哩哔哩",value:"bilibili",icon:"BiliBili"},{label:"腾讯视频",value:"qqvideo",icon:"QQVideo"}],mY=[{label:"高德地图",value:"amap",icon:"Gaode"},{label:"百度地图",value:"baidu_map",icon:"Baidu"}],gY=[{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"}],bY=[{label:"CodePen",value:"codepen",icon:"Codepen"}],vY=[{label:"金数据",value:"jinshuju",icon:"Jinshuju"}],yY=[],wY=[...hY,...mY,...gY,...bY,...vY,...yY];function xY(t){const{t:e}=Ot(),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(T0(t,"iframes")){const i=wY;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 CY={key:0,class:"grid grid-cols-1 gap-0.5 min-w-48"},EY={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"},kY=["onClick"],SY=["src"],_Y={key:1,class:"p-3"},TY={class:"text-xs text-gray-800 dark:text-gray-400"},AY=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}=Ot(),a=o.ref([]),l=t;e({onKeyDown:u}),o.watch([()=>n.value,()=>r.value],async()=>{if(!i.value)return;await o.nextTick();const v=r.value*1e3+n.value,w=a.value[v];w&&w.scrollIntoView({behavior:"smooth",block:"nearest"})});function u({event:v}){return v.key==="ArrowUp"?(c(),!0):v.key==="ArrowDown"?(f(),!0):v.key==="Enter"?(p(),!0):!1}function c(){var x;if(!l.items.length)return!1;let v=n.value-1,w=r.value;v<0&&(w=r.value-1,v=((x=l.items[w])==null?void 0:x.commands.length)-1||0),w<0&&(w=l.items.length-1,v=l.items[w].commands.length-1),n.value=v,r.value=w}function f(){if(!l.items.length)return!1;const v=l.items[r.value].commands;let w=n.value+1,x=r.value;v.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(v,w){const x=l.items[v].commands[w];l.command(x)}function g(v,w){m(v,w)}function b(v,w,x){a.value[v*1e3+w]=x}return(v,w)=>{var x;return 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"},[(x=v.items)!=null&&x.length?(o.openBlock(),o.createElementBlock("div",CY,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(v.items,(k,E)=>(o.openBlock(),o.createElementBlock(o.Fragment,{key:k.title},[o.createElementVNode("div",EY,o.toDisplayString(k.title),1),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(k.commands,(C,_)=>(o.openBlock(),o.createElementBlock("button",{ref_for:!0,ref:A=>b(E,_,A),key:_,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===E&&n.value===_?"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:A=>g(E,_)},[C.iconUrl?(o.openBlock(),o.createElementBlock("img",{key:0,class:"w-6 h-6",src:C.iconUrl},null,8,SY)):o.createCommentVNode("",!0),C.iconName?(o.openBlock(),o.createBlock(o.unref(Lt),{key:1,name:C.iconName,class:"mr-1 text-lg"},null,8,["name"])):o.createCommentVNode("",!0),o.createTextVNode(" "+o.toDisplayString(C.label),1)],10,kY))),128))],64))),128))])):(o.openBlock(),o.createElementBlock("div",_Y,[o.createElementVNode("span",TY,o.toDisplayString(o.unref(s)("editor.slash.empty")),1)]))],512)}}}),ga="slashCommand";let Pt;const OY=Je.create({name:ga,priority:200,onCreate(){Pt=Us("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[pY({editor:this.editor,char:"/",allowSpaces:!0,startOfLine:!0,pluginKey:new Et(ga),allow:({state:t,range:e})=>{var c,f,p;const n=t.doc.resolve(e.from),r=n.depth===1,i=n.parent.type.name==="paragraph",s=((c=n.parent.textContent)==null?void 0:c.charAt(0))==="/",a=this.editor.isActive("column"),l=(p=n.parent.textContent)==null?void 0:p.substring((f=n.parent.textContent)==null?void 0:f.indexOf("/")),u=!(l!=null&&l.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})=>xY(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=>{var s;t=new lw(AY,{props:n,editor:n.editor});const{view:r}=n.editor,i=()=>{if(!n.clientRect)return n.editor.storage[ga].rect;const a=n.clientRect();if(!a)return n.editor.storage[ga].rect;let l=a.y;if(t.element instanceof HTMLElement&&a.top+t.element.offsetHeight+40>window.innerHeight){const u=a.top+t.element.offsetHeight-window.innerHeight+40;l=a.y-u}return new DOMRect(a.x,l,a.width,a.height)};e=()=>{Pt==null||Pt[0].setProps({getReferenceClientRect:i})},(s=r.dom.parentElement)==null||s.addEventListener("scroll",e),t.element&&(Pt==null||Pt[0].setProps({getReferenceClientRect:i,appendTo:()=>document.body,content:t.element})),Pt==null||Pt[0].show()},onUpdate(n){var a;t.updateProps(n);const{view:r}=n.editor,i=()=>{if(!n.clientRect)return n.editor.storage[ga].rect;const l=n.clientRect();return l?new DOMRect(l.x,l.y,l.width,l.height):n.editor.storage[ga].rect},s=()=>{Pt==null||Pt[0].setProps({getReferenceClientRect:i})};(a=r.dom.parentElement)==null||a.addEventListener("scroll",s),n.editor.storage[ga].rect=n.clientRect?i():{width:0,height:0,left:0,top:0,right:0,bottom:0},Pt==null||Pt[0].setProps({getReferenceClientRect:i})},onKeyDown(n){var r;return n.event.key==="Escape"?(Pt==null||Pt[0].hide(),!0):(Pt!=null&&Pt[0].state.isShown||Pt==null||Pt[0].show(),(r=t.ref)==null?void 0:r.onKeyDown(n))},onExit(n){var r;if(Pt==null||Pt[0].hide(),e){const{view:i}=n.editor;(r=i.dom.parentElement)==null||r.removeEventListener("scroll",e)}t.destroy()}}}})]},addStorage(){return{rect:{width:0,height:0,left:0,top:0,right:0,bottom:0}}}}),MY=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=xn(),{toast:r}=Lb();function i(){var a,l,u;const s=(l=(a=e.editor.extensionManager.extensions.find(c=>c.name==="AI"))==null?void 0:a.options)==null?void 0:l.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,(u=e.editor)==null||u.commands.focus()}return(s,a)=>(o.openBlock(),o.createBlock(Ke,{action:i,title:"AI",disabled:s.disabled,icon:s.icon,tooltip:s.tooltip},null,8,["disabled","icon","tooltip"]))}}),BY=Bt.create({name:"AI",group:"block",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),toolbar:!1,button:({editor:e,t:n})=>({component:MY,componentProps:{icon:"Sparkles",tooltip:n("editor.AI.ask")}})}}});function IY(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 RY(t,e){return new File([t],e,{type:t.type})}const LY=Je.create({name:"importWord",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),upload:void 0,convert:void 0,limit:1024*1024*10,button:({editor:e,extension:n,t:r})=>({component:Ke,componentProps:{action:()=>{var i;return(i=e.commands)==null?void 0:i.toggleImportWord()},disabled:!e.can().setHorizontalRule(),icon:"Word",tooltip:r("editor.importWord.tooltip")}})}},addCommands(){return{toggleImportWord:()=>({chain:t,editor:e})=>{const{toast:n}=Lb(),{t:r}=Ot();async function i(u){var g;const f=new DOMParser().parseFromString(u,"text/html"),p=f.querySelectorAll("img");if(!p.length)return f.body.innerHTML;if(T0(e,"image")){const b=(g=e.extensionManager.extensions.find(v=>v.name==="importWord"))==null?void 0:g.options;if(b&&typeof b.upload=="function"){const v=[];for(const x of p){const k=x.getAttribute("src"),E=IY(k,"image/jpeg"),C=RY(E,"image.jpeg");v.push(C)}const w=await b.upload(v);for(let x=0;x<p.length;x++){const k=p[x];k.setAttribute("src",w[x].src);const E=k.parentElement;(E==null?void 0:E.tagName)==="P"&&(E.insertAdjacentElement("beforebegin",k),!E.hasChildNodes()&&E.textContent===""&&E.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}=mt.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}}}}),Pb=xn(),PY=Je.create({name:"preview",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({t:e})=>({component:Ke,componentProps:{icon:"Eye",action:()=>{Pb.togglePreview()},tooltip:e("editor.preview.tooltip"),isActive:()=>Pb.state.showPreview}})}},addCommands(){return{togglePreview:()=>()=>(Pb.togglePreview(),!0)}}}),rk=xn(),DY=(t,e,n)=>RegExp(e?t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"):t,n?"gu":"gui");function VY(t,e,n,r){const i=[],s=[];let a=[],l=0;if(!e)return{decorationsToReturn:ft.empty,results:[]};t==null||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:ft.create(t,i),results:s}}const FY=(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))},$Y=(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]},zY=(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=$Y(t,a,i,s);c&&(i=c[0],s=c[1])}r&&r(n)}},HY=new Et("findAndReplacePlugin"),UY=Je.create({name:"findAndReplace",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),searchResultClass:"vdc-editor-search-result",disableRegex:!0,button:({editor:e,extension:n,t:r})=>({component:Ke,componentProps:{icon:"DocSearch",tooltip:r("editor.findAndReplace.tooltip"),action:()=>{rk.toggleFindAndReplace()},isActive:()=>rk.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 FY(r,i,{state:e,dispatch:n}),!1},replaceAll:()=>({editor:t,tr:e,dispatch:n})=>{const{replaceTerm:r,results:i}=t.storage.findAndReplace;return zY(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 et({key:HY,state:{init:()=>ft.empty,apply({doc:a,docChanged:l},u){const{searchTerm:c,lastSearchTerm:f,caseSensitive:p,lastCaseSensitive:m,resultIndex:g,lastResultIndex:b}=t.storage.findAndReplace;if(!l&&f===c&&m===p&&b===g)return u;if(r(c),i(p),s(g),!c)return t.storage.findAndReplace.results=[],ft.empty;const{decorationsToReturn:v,results:w}=VY(a,DY(c,n,p),e,g);return t.storage.findAndReplace.results=w,v}},props:{decorations(a){return this.getState(a)}}})]}}),{togglePrinter:WY,state:jY}=xn(),qY=Je.create({name:"printer",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({t:e})=>({component:Ke,componentProps:{tooltip:e("editor.printer.tooltip"),action:()=>WY(),icon:"Printer",shortcutKeys:["mod","P"],isActive:()=>jY.printer}})}}}),Db="spell-check";class KY{constructor(e,n,r,i=1e3){Xt(this,"debouncedGetMatchAndSetDecorations",tt.debounce(this.getMatchAndSetDecorations.bind(this),300));Xt(this,"debouncedGetMatchAndSetDecorationsList",tt.debounce(this.getMatchAndSetDecorationsList.bind(this),300));Xt(this,"debouncedClickEventsListener",tt.debounce(this.clickEventsListener.bind(this),0));Xt(this,"debouncedAcceptSuggestionEventsListener",tt.debounce(this.acceptSuggestionListener.bind(this),0));Xt(this,"debouncedProofreadChangedNodes",tt.debounce(this.proofreadChangedNodes.bind(this),300));Xt(this,"proofreader");Xt(this,"uiStrings");Xt(this,"showSuggestionsEvent");Xt(this,"decorationSet");Xt(this,"editorView");Xt(this,"isInitialProofreadingDone",!1);Xt(this,"lastOriginalFrom",0);Xt(this,"lastClickedDecoration",null);Xt(this,"suggestionBox");Xt(this,"isEnableSuggestion");Xt(this,"isMobile");Xt(this,"limit",1e3);Xt(this,"_debouncedProofreadDoc",tt.debounce((e,n)=>{this.proofreadDoc(e),n&&n()},500));Xt(this,"_debouncedHandleEnterKey",tt.debounce((e,n,r)=>{this.handleEnterKey(e,n),r&&r()},500));this.proofreader=e,this.uiStrings=n,this.showSuggestionsEvent=r,this.decorationSet=ft.empty,this.limit=i,this.suggestionBox=document.createElement("div"),this.suggestionBox.id="suggestions-box",this.suggestionBox.tabIndex=0,this.isEnableSuggestion=!0,this.isMobile=!1,this.hideSuggestionBox()}get completeProofreadingDone(){return this.isInitialProofreadingDone}getProofreader(){return this.proofreader}toggleIsEnabledSpellCheck(){this.proofreader.toggleIsEnabled()}setEnabledProofreadText(e){this.proofreader.setEnabled(e)}getIsEnabledSpellCheck(){return this.proofreader.getIsEnabled()}setDecorationSet(e){this.decorationSet=e}getDecorationSet(){return this.decorationSet}setEditorView(e){this.editorView=e}getEditorView(){return this.editorView}getSuggestionBox(){return this.suggestionBox}hideSuggestionBox(){this.suggestionBox.textContent="",this.suggestionBox.style.display="none"}setIsEnableSuggestion(e){if(this.isEnableSuggestion=e,this.isEnableSuggestion){this.addEventListenersToDecorations();return}this.hideSuggestionBox(),this.removeEventListenersFromDecorations()}setIsMobile(e){this.isMobile=e}getChangedNodesFromTransaction(e,n=!1,r=!1){const i=[],s=new Set;let a=!1;return e.steps.forEach(l=>{var p,m,g;const u=l;if(u.from===void 0||u.to===void 0||n&&u.structure)return;((m=(p=u.slice)==null?void 0:p.content[0])==null?void 0:m.type.name)===gc&&(a=!0);const c=u.from-(r?1:0);let f=Math.max(u.to,u.from+(((g=u.slice)==null?void 0:g.size)||0))-(r?1:0);f>e.doc.content.size&&(f=e.doc.content.size),e.doc.nodesBetween(c,f,(b,v)=>{b&&(b.isText&&!s.has(v)&&(i.push({node:b,pos:v}),s.add(v)),b.type.name===gc&&(a=!0))})}),{changedNodes:i,isChangedSuperText:a}}debouncedProofreadDoc(e,n){this._debouncedProofreadDoc(e,n)}isSuperTextAlone(e,n){let r=!1;return e.descendants((i,s,a)=>i===n?(a&&a.type.name==="paragraph"&&a.childCount===1&&a.firstChild===n&&(r=!0),!1):!0),r}proofreadDoc(e){let n=[],r=0;e==null||e.descendants((u,c)=>{if(u.isText){const f={text:u.text??"",from:c,to:c+u.nodeSize};return n[r]&&(f.text=n[r].text+f.text,f.from=n[r].from),n[r]=f,r+=1,!1}return u.type.name!==gc}),n=n.filter(Boolean);let i="",s=1;for(const{text:u,from:c,to:f}of n){const p=c-s;p>0&&(i+=Array(p+1).join(`
293
+ `);t.storage.deviceEnv.isMobile?SX(u,c):await _X(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 kX():await TX();if(!e)return;const n=new DataTransfer;n.setData("text/html",e),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 EX():await navigator.clipboard.readText())}catch(e){return console.warn("[clipboard] check failed",e),!1}}}}),OX=Je.create({name:"deviceEnv",addOptions(){return{initial:!1,specialCharModal:void 0}},addStorage(){return{isMobile:this.options.initial,specialCharModal:this.options.specialCharModal}},addCommands(){return{setIsMobile:t=>({editor:e})=>{var n;return e.storage.deviceEnv.isMobile=t,(n=e.storage.spellchecker)==null||n.spellchecker.setIsMobile(t),!0}}}}),Vp=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(mD),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"]))}}),MX={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"},BX={key:0,class:"flex justify-center items-center gap-3 text-s"},IX={key:1,class:"flex justify-between items-center w-full"},RX={class:"flex justify-center items-center gap-3"},LX={class:"text-sm"},PX={class:"flex items-center gap-2"},DX=o.defineComponent({__name:"VideoUploader",props:{...js},setup(t){const e=t,n=o.ref(""),r=o.ref(!1),i=o.ref(),{t:s}=Ot();function a(f){var v;r.value=!0;const p=f.target,m=Array.from((p==null?void 0:p.files)||[]),g=(v=e.editor.extensionManager.extensions.find(w=>w.name==="videoUpload"))==null?void 0:v.options;if(!e.editor||e.editor.isDestroyed||m.length===0||typeof(g==null?void 0:g.upload)!="function")return;const b=m[0];g.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(),r.value=!1})}function l(){e.editor.chain().setVideo({src:n.value,width:640}).deleteRange({from:e.getPos(),to:e.getPos()}).insertContentAt(e.getPos()+1,{type:"paragraph"}).focus().run()}function u(){e.deleteNode()}function c(){var f;(f=i.value)==null||f.click()}return(f,p)=>(o.openBlock(),o.createBlock(o.unref(Ws),{as:"div","data-drag-handle":""},{default:o.withCtx(()=>[o.createVNode(o.unref(na),{"default-open":""},{default:o.withCtx(()=>[o.createVNode(o.unref(bl),{"as-child":""},{default:o.withCtx(()=>[o.createElementVNode("div",MX,[r.value?(o.openBlock(),o.createElementBlock("div",BX,[o.createVNode(o.unref(Lt),{class:"animate-spin w-6 h-6",name:"LoaderCircle"}),o.createElementVNode("span",null,o.toDisplayString(o.unref(s)("editor.video.dialog.uploading"))+"...",1)])):(o.openBlock(),o.createElementBlock("div",IX,[o.createElementVNode("div",RX,[o.createVNode(o.unref(Lt),{name:"Video",class:"w-6 h-6"}),o.createElementVNode("span",LX,o.toDisplayString(o.unref(s)("editor.video.dialog.title")),1)]),o.createVNode(o.unref(Lt),{name:"Trash2",class:"hover:text-ed-foreground",onClick:o.withModifiers(u,["stop"])})]))])]),_:1}),o.createVNode(o.unref(ra),{"trap-focus":"",class:"w-full","on-open-auto-focus":m=>m.preventDefault()},{default:o.withCtx(()=>[o.createVNode(o.unref($1),{"default-value":"upload",class:"w-[300px] sm:w-[400px]","activation-mode":"manual"},{default:o.withCtx(()=>[o.createVNode(o.unref(z1),{class:"grid w-full grid-cols-2"},{default:o.withCtx(()=>[o.createVNode(o.unref(Wu),{value:"upload"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(s)("editor.video.dialog.tab.upload")),1)]),_:1}),o.createVNode(o.unref(Wu),{value:"link",disabled:r.value},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(s)("editor.video.dialog.link")),1)]),_:1},8,["disabled"])]),_:1}),o.createVNode(o.unref(Vp),{value:"upload"},{default:o.withCtx(()=>[o.createVNode(o.unref(wn),{class:"w-full mt-1",size:"sm",disabled:r.value,onClick:c},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(s)("editor.video.dialog.tab.upload")),1)]),_:1},8,["disabled"]),o.createElementVNode("input",{ref_key:"fileInput",ref:i,type:"file",accept:"video/*",hidden:"",onChange:a},null,544)]),_:1}),o.createVNode(o.unref(Vp),{value:"link"},{default:o.withCtx(()=>[o.createElementVNode("div",PX,[o.createVNode(o.unref(gl),{modelValue:n.value,"onUpdate:modelValue":p[0]||(p[0]=m=>n.value=m),type:"url",autofocus:"",required:"",placeholder:o.unref(s)("editor.video.dialog.placeholder")},null,8,["modelValue","placeholder"]),o.createVNode(o.unref(wn),{onClick:l},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(s)("editor.video.dialog.button.apply")),1)]),_:1})])]),_:1})]),_:1})]),_:1},8,["on-open-auto-focus"])]),_:1})]),_:1}))}}),XE=Bt.create({name:"videoUpload",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 qs(DX)},addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),upload:()=>Promise.reject("link video not found"),button:({editor:e,t:n})=>{var r,i;return{component:Ke,componentProps:{action:()=>e.commands.setVideoUpload(),isActive:()=>e.isActive("video")||!1,disabled:!((i=(r=e.can()).setVideo)!=null&&i.call(r,{})),icon:"Video",tooltip:n("editor.video.tooltip")}}}}}});function VX(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 FX(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 YE=Bt.create({name:"video",group:"block",atom:!0,draggable:!0,addOptions(){return{divider:!1,spacer:!1,allowFullscreen:!0,upload:void 0,width:Vd["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?VX(t):null})},width:{default:this.options.width,renderHTML:({width:t})=>({width:an(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: ${an(n)};`;return FX(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)}}}),Ml=new Et("upload-image"),$X=()=>new et({key:Ml,state:{init(){return ft.empty},apply(t,e){e=e.map(t.mapping,t.doc);const n=t.getMeta(Ml);return n!=null&&n.add?n.add.forEach(({id:r,pos:i,src:s})=>{const a=zX(s),l=jt.widget(i,a,{id:r});e=e.add(t.doc,[l])}):n!=null&&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 zX(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 HX(t,e){var i;const r=Ml.getState(t).find(void 0,void 0,s=>s.id===e);return r.length?(i=r[0])==null?void 0:i.from:null}const JE=({validateFn:t,onUpload:e})=>(n,r,i,s)=>{n.forEach(a=>{if(t&&!t(a))return;s||(s=hi(6));const l=r.state.tr;l.selection.empty||l.deleteSelection();let u=null;r.state.doc.descendants((p,m)=>{p.type.name===ms&&p.attrs.id===s&&(u=m)});const c=URL.createObjectURL(a);l.setMeta(Ml,{add:[{id:s,pos:i,src:c}]}),r.dispatch(l);const f=HX(r.state,s)||u;e(a).then(p=>{var k,E;const{schema:m}=r.state;if(f===null)throw new Error("Not found placeholderPos");const g=typeof p=="object"?c:p,b=(k=m.nodes.image)==null?void 0:k.create({src:g}),v=(E=m.nodes.paragraph)==null?void 0:E.create();if(!b||!v)return;const w=r.state.tr.replaceWith(f,f,b).insert(f+b.nodeSize,v).setMeta(Ml,{remove:[s]}),x=f+b.nodeSize+1;w.setSelection(Ae.create(w.doc,x)),r.dispatch(w),r.focus()},()=>{const p=r.state.tr.delete(i,i).setMeta(Ml,{remove:[s]});r.dispatch(p)})})},UX=(t,e,n)=>{var i;const r=Array.from(((i=e.clipboardData)==null?void 0:i.files)||[]);if(r.length){e.preventDefault();const s=t.state.selection.from;return n(r,t,s+1),!0}return!1},WX=(t,e,n,r)=>{var s;const i=Array.from(((s=e.dataTransfer)==null?void 0:s.files)||[]);if(!n&&i.length){e.preventDefault();const a=t.posAtCoords({left:e.clientX,top:e.clientY});if(a)return r(i,t,a.pos+1),!0}return!1},jX={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"},qX={class:"flex items-center justify-between w-full"},KX={class:"flex items-center justify-center gap-3"},GX={class:"text-sm"},XX={class:"flex items-center gap-2"},YX=o.defineComponent({__name:"ImageUploader",props:{...js},setup(t){const e=t,n=o.ref(""),r=o.ref(),{t:i}=Ot(),s=o.inject("isEditable",o.ref(!0));function a(f){var v,w;const p=(v=f==null?void 0:f.target)==null?void 0:v.files;if(!e.editor||e.editor.isDestroyed||p.length===0)return;const m=p[0],g=(w=e.editor.extensionManager.extensions.find(x=>x.name==="imageUpload"))==null?void 0:w.options;JE({validateFn:x=>!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(){s.value&&e.deleteNode()}function c(){var f;(f=r.value)==null||f.click()}return(f,p)=>(o.openBlock(),o.createBlock(o.unref(Ws),{id:f.node.attrs.id,class:"p-0 m-0","data-drag-handle":""},{default:o.withCtx(()=>[o.createVNode(o.unref(na),{"default-open":""},{default:o.withCtx(()=>[o.createVNode(o.unref(bl),{"as-child":""},{default:o.withCtx(()=>[o.createElementVNode("div",jX,[o.createElementVNode("div",qX,[o.createElementVNode("div",KX,[o.createVNode(o.unref(Lt),{name:"ImageUp",class:"w-6 h-6"}),o.createElementVNode("span",GX,o.toDisplayString(o.unref(i)("editor.image.dialog.title")),1)]),o.createVNode(o.unref(Lt),{name:"Trash2",class:"hover:text-ed-foreground",onClick:o.withModifiers(u,["stop"])})])])]),_:1}),o.unref(s)?(o.openBlock(),o.createBlock(o.unref(ra),{key:0,"trap-focus":"",class:"w-full","on-open-auto-focus":m=>m.preventDefault()},{default:o.withCtx(()=>[o.createVNode(o.unref($1),{"default-value":"upload",class:"w-[300px] sm:w-[400px]","activation-mode":"manual"},{default:o.withCtx(()=>[o.createVNode(o.unref(z1),{class:"grid w-full grid-cols-2"},{default:o.withCtx(()=>[o.createVNode(o.unref(Wu),{value:"upload"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(i)("editor.image.dialog.tab.upload")),1)]),_:1}),o.createVNode(o.unref(Wu),{value:"link"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(i)("editor.image.dialog.tab.url")),1)]),_:1})]),_:1}),o.createVNode(o.unref(Vp),{value:"upload"},{default:o.withCtx(()=>[o.createVNode(o.unref(wn),{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(Vp),{value:"link"},{default:o.withCtx(()=>[o.createElementVNode("div",XX,[o.createVNode(o.unref(gl),{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(wn),{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"])):o.createCommentVNode("",!0)]),_:1})]),_:1},8,["id"]))}}),JX=1,ZX=1e6,wi={ADD_TOAST:"ADD_TOAST",UPDATE_TOAST:"UPDATE_TOAST",DISMISS_TOAST:"DISMISS_TOAST",REMOVE_TOAST:"REMOVE_TOAST"};let Ib=0;function QX(){return Ib=(Ib+1)%Number.MAX_VALUE,Ib.toString()}const Rb=new Map;function ZE(t){if(Rb.has(t))return;const e=setTimeout(()=>{Rb.delete(t),vc({type:wi.REMOVE_TOAST,toastId:t})},ZX);Rb.set(t,e)}const bo=o.ref({toasts:[]});function vc(t){switch(t.type){case wi.ADD_TOAST:bo.value.toasts=[t.toast,...bo.value.toasts].slice(0,JX);break;case wi.UPDATE_TOAST:bo.value.toasts=bo.value.toasts.map(e=>e.id===t.toast.id?{...e,...t.toast}:e);break;case wi.DISMISS_TOAST:{const{toastId:e}=t;e?ZE(e):bo.value.toasts.forEach(n=>{ZE(n.id)}),bo.value.toasts=bo.value.toasts.map(n=>n.id===e||e===void 0?{...n,open:!1}:n);break}case wi.REMOVE_TOAST:t.toastId===void 0?bo.value.toasts=[]:bo.value.toasts=bo.value.toasts.filter(e=>e.id!==t.toastId);break}}function Lb(){return{toasts:o.computed(()=>bo.value.toasts),toast:NX,dismiss:t=>vc({type:wi.DISMISS_TOAST,toastId:t})}}function NX(t){const e=QX(),n=i=>vc({type:wi.UPDATE_TOAST,toast:{...i,id:e}}),r=()=>vc({type:wi.DISMISS_TOAST,toastId:e});return vc({type:wi.ADD_TOAST,toast:{...t,id:e,open:!0,onOpenChange:i=>{i||r()}}}),{id:e,dismiss:r,update:n}}const eY={acceptMimes:["image/jpeg","image/gif","image/png","image/jpg"],maxSize:1024*1024*5},tY=t=>`${(t/1024/1024).toFixed(2)}MB`,QE=Bt.create({name:"imageUpload",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:hi(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 qs(YX)},addOptions(){var t;return{...eY,...(t=this.parent)==null?void 0:t.call(this),upload:()=>Promise.reject("Image Upload Function"),button:({editor:e,extension:n,t:r})=>{var i,s;return{component:Ke,componentProps:{action:()=>e.commands.setImageUpload(),disabled:!((s=(i=e.can()).setImage)!=null&&s.call(i,{})),icon:"ImageUp",tooltip:r("editor.image.tooltip")}}}}},addProseMirrorPlugins(){const{toast:t}=Lb(),{t:e}=Ot(),r=JE({validateFn:i=>this.options.acceptMimes.includes(i.type)?i.size>this.options.maxSize?(t({description:`${e("editor.imageUpload.fileSizeTooBig")} ${tY(this.options.maxSize)}.`,duration:2e3}),!1):!0:(t({description:e("editor.imageUpload.fileTypeNotSupported"),duration:2e3}),!1),onUpload:this.options.upload});return[new et({props:{handlePaste:(i,s)=>!s.clipboardData||Array.from(s.clipboardData.items||[]).some(l=>l.type==="text/html")?!1:UX(i,s,r),handleDrop:(i,s,a,l)=>(!(s instanceof DragEvent)||!s.dataTransfer||WX(i,s,l,r),!1)}}),$X()]}}),nY=Je.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}`}}}}}]}}),NE=Je.create({name:"base-kit",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),timeHighlighter:{additionalTimeWords:[]},bubble:{list:zB,defaultBubbleList:Cj,button:({editor:e,extension:n,t:r})=>{var l;const{list:i={},defaultBubbleList:s}=((l=n.options)==null?void 0:l.bubble)??{},a=(s==null?void 0:s(e))??[];return Ej(i,a,{editor:e,extension:n,t:r})}}}},addExtensions(){var n,r,i;const{t}=Ot(),e=[];this.options.placeholder!==!1&&e.push(V8.configure({placeholder:({node:s,pos:a})=>{var u;const l=(u=s==null?void 0:s.type)==null?void 0:u.name;return l==="heading"?`${t(`editor.heading.h${s.attrs.level}.tooltip`)}`:l==="table"||l==="codeBlock"?"":a===0?t("editor.content"):""},...this.options.placeholder})),this.options.focus!==!1&&e.push(cj.configure({className:"focus",...this.options.focus})),this.options.document!==!1&&(this.options.page?(e.push(z8.configure().extend({content:"page+"})),e.push(fK.configure({types:((r=(n=this.options.page)==null?void 0:n.nodesComputedOption)==null?void 0:r.types)??[],slots:o.useSlots()}))):e.push(z8.configure())),this.options.dropcursor!==!1&&e.push(uj.configure({...this.options.dropcursor,width:2,class:"ProseMirror-dropcursor border-black"})),this.options.characterCount!==!1&&e.push(sj.configure(this.options.characterCount)),this.options.paragraph!==!1&&e.push(D8.configure(this.options.paragraph)),this.options.hardBreak!==!1&&e.push(P8.configure(this.options.hardBreak)),this.options.listItem!==!1&&e.push(yj.configure(this.options.listItem)),this.options.textStyle!==!1&&e.push(KU.configure(this.options.textStyle)),this.options.imageUpload!==!1&&e.push(QE.configure(this.options.imageUpload)),this.options.video!==!1&&e.push(YE.configure(this.options.video)),this.options.videoUpload!==!1&&e.push(XE.configure(this.options.videoUpload)),this.options.history!==!1&&e.push(zg.configure(this.options.history)),this.options.fontSize!==!1&&e.push(r8.configure(this.options.fontSize)),this.options.fontFamily!==!1&&e.push(mE.configure(this.options.fontFamily)),this.options.mode!==Be.EDITOR&&e.push(yK),this.options.superText!==!1&&this.options.mode!==Be.PLAIN_TEXT&&this.options.mode!==Be.EDITOR&&(typeof this.options.superText=="boolean"?e.push(xE.configure()):e.push(xE.configure(this.options.superText))),this.options.mode===Be.EDITOR&&(this.options.image!==!1&&e.push(wb.configure()),e.push(t8.configure({spacer:!0}),SC,kC,_C,Vg,Mb,TC,o8.configure({spacer:!0}),n8.configure({types:["heading","paragraph"],spacer:!0}),vE)),this.options.mode!==Be.EDITOR&&this.options.configPlan!==!1&&this.options.mode!==Be.PLAIN_TEXT&&(typeof this.options.configPlan=="boolean"?e.push(EE.configure()):e.push(EE.configure({specialCharModal:(i=this.options.configPlan)==null?void 0:i.specialCharModal}))),this.options.mode!==Be.EDITOR&&this.options.mode!==Be.PLAIN_TEXT&&e.push(xK),(this.options.mode===Be.STRAIGHT||this.options.mode===Be.REPORT||this.options.mode===Be.EDITOR)&&this.options.timeHighlighter&&e.push(xX.configure(this.options.timeHighlighter)),this.options.invalidCharFocus!==!1&&e.push(CX.configure(this.options.invalidCharFocus)),this.options.disabled&&e.push(nY),e.push(wj,F8.configure(),vX.configure(),vj.configure(),xb,vb,pg,AX,OX.configure(this.options.deviceEnv),i8.configure({multicolor:!0}));for(const s in this.options.excludes)Object.prototype.hasOwnProperty.call(this.options.excludes,s)&&this.options.excludes[s]&&tt.remove(e,({name:l})=>l===s);return e},addStorage(){return{mode:this.options.mode}}}),ek=Vn.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",bt(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()}}}),tk=Vn.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",bt(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()}}}),rY=Je.create({name:"subAndSuperScript",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:e,extension:n,t:r})=>{const i=n.options.subscript,s=n.options.superscript,a={component:Ke,componentProps:{action:()=>e.commands.toggleSubscript(),isActive:()=>e.isActive("subscript")||!1,disabled:!e.can().toggleSubscript(),icon:"Subscript",tooltip:r("editor.subscript.tooltip")}},l={component:Ke,componentProps:{action:()=>e.commands.toggleSuperscript(),isActive:()=>e.isActive("superscript")||!1,disabled:!e.can().toggleSuperscript(),icon:"Superscript",tooltip:r("editor.superscript.tooltip")}},u=[];return i!==!1&&u.push(a),s!==!1&&u.push(l),u}}},addExtensions(){const t=[];return this.options.subscript!==!1&&t.push(ek.configure(this.options.subscript)),this.options.superscript!==!1&&t.push(tk.configure(this.options.superscript)),t}}),oY={class:"ml-1"},iY=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(la,{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(kl),{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(Lt),{key:0,name:s.icon},null,8,["name"])):o.createCommentVNode("",!0),o.createElementVNode("span",oY,o.toDisplayString(s.title),1),s.shortcutKeys?(o.openBlock(),o.createBlock(o.unref(e8),{key:1,class:"ml-auto"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(z6)(s.shortcutKeys)),1)]),_:2},1024)):o.createCommentVNode("",!0)]),_:2},1032,["checked","disabled","onClick"]))),128))]),_:1},8,["icon","tooltip","disabled"]))}}),sY=Je.create({name:"moreMark",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button({editor:e,extension:n,t:r}){const i=n.options.subscript,s=n.options.superscript,a={action:()=>e.commands.toggleSubscript(),isActive:()=>e.isActive("subscript")||!1,disabled:!e.can().toggleSubscript(),icon:"Subscript",title:r("editor.subscript.tooltip"),shortcutKeys:["mod","."]},l={action:()=>e.commands.toggleSuperscript(),isActive:()=>e.isActive("superscript")||!1,disabled:!e.can().toggleSuperscript(),icon:"Superscript",title:r("editor.superscript.tooltip"),shortcutKeys:["mod",","]},u=T0(e,"code"),c=[];if(i!==!1&&c.push(a),s!==!1&&c.push(l),u){const f={action:()=>e.commands.toggleCode(),isActive:()=>e.isActive("code")||!1,disabled:!e.can().toggleCode(),icon:"Code",title:r("editor.code.tooltip"),shortcutKeys:["mod","E"]};u&&c.push(f)}return{component:iY,componentProps:{icon:"Type",tooltip:r("editor.moremark"),disabled:!e.isEditable||c.every(f=>f.disabled),items:c}}}}},addExtensions(){const t=[];return this.options.subscript!==!1&&t.push(ek.configure(this.options.subscript)),this.options.superscript!==!1&&t.push(tk.configure(this.options.superscript)),t}});var ma=(t=>(t[t.max=7]="max",t[t.min=0]="min",t[t.more=1]="more",t[t.less=-1]="less",t))(ma||{});function aY(t,e,n){return t<e?e:t>n?n:t}function lY(t,e,n,r){const{doc:i,selection:s}=t;if(!i||!s||!(s instanceof Ae||s instanceof Ln))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=uY(t,c,e),!1):!n0(u.type.name,r.extensionManager.extensions)}),t}function uY(t,e,n){if(!t.doc)return t;const r=t.doc.nodeAt(e);if(!r)return t;const a=aY((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 nk({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=lY(a,t,e,i),a.docChanged?(r&&r(a),!0):!1}}const cY=Je.create({name:"indent",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),types:["paragraph","heading","blockquote"],minIndent:ma.min,maxIndent:ma.max,button({editor:e,t:n}){var s,a;const{selection:r}=e.state,i=r.$anchor.parent;return[{component:Ke,componentProps:{action:()=>{e.commands.indent()},disabled:((s=i==null?void 0:i.attrs)==null?void 0:s.indent)>=ma.max||!e.can().indent(),shortcutKeys:["Tab"],icon:"IndentIncrease",tooltip:n("editor.indent.tooltip")}},{component:Ke,componentProps:{action:()=>{e.commands.outdent()},shortcutKeys:["Shift","Tab"],disabled:((a=i==null?void 0:i.attrs)==null?void 0:a.indent)<=ma.min||!e.can().outdent(),icon:"IndentDecrease",tooltip:n("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:()=>nk({delta:ma.more,types:this.options.types}),outdent:()=>nk({delta:ma.less,types:this.options.types})}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.indent(),"Shift-Tab":()=>this.editor.commands.outdent()}}});function dY(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:i,allowedPrefixes:s,startOfLine:a,$position:l}=t,u=r&&!i,c=JO(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"),b=((e=l.nodeBefore)===null||e===void 0?void 0:e.isText)&&l.nodeBefore.text;if(!b)return null;const v=l.pos-b.length,w=Array.from(b.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),k=new RegExp(`^[${s==null?void 0:s.join("")}\0]?$`).test(x);if(s!==null&&!k)return null;const E=v+w.index;let C=E+w[0].length;return u&&f.test(b.slice(C-1,C+1))&&(w[0]+=" ",C+=1),E<l.pos&&C>=l.pos?{range:{from:E,to:C},query:w[0].slice(n.length),text:w[0]}:null}const fY=new Et("suggestion");function pY({pluginKey:t=fY,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=dY}){let b;const v=p==null?void 0:p(),w=new et({key:t,view(){return{update:async(x,k)=>{var E,C,_,A,T,L,I;const M=(E=this.key)===null||E===void 0?void 0:E.getState(k),j=(C=this.key)===null||C===void 0?void 0:C.getState(x.state),D=M.active&&j.active&&M.range.from!==j.range.from,Q=!M.active&&j.active,te=M.active&&!j.active,H=!Q&&!te&&M.query!==j.query,F=Q||D&&H,P=H||D,q=te||D&&H;if(!F&&!P&&!q)return;const J=q&&!F?M:j,G=x.dom.querySelector(`[data-decoration-id="${J.decorationId}"]`);b={editor:e,range:J.range,query:J.query,text:J.text,items:[],command:oe=>c({editor:e,range:J.range,props:oe}),decorationNode:G,clientRect:G?()=>{var oe;const{decorationId:xe}=(oe=this.key)===null||oe===void 0?void 0:oe.getState(e.state),Ce=x.dom.querySelector(`[data-decoration-id="${xe}"]`);return(Ce==null?void 0:Ce.getBoundingClientRect())||null}:null},F&&((_=v==null?void 0:v.onBeforeStart)===null||_===void 0||_.call(v,b)),P&&((A=v==null?void 0:v.onBeforeUpdate)===null||A===void 0||A.call(v,b)),(P||F)&&(b.items=await f({editor:e,query:J.query})),q&&((T=v==null?void 0:v.onExit)===null||T===void 0||T.call(v,b)),P&&((L=v==null?void 0:v.onUpdate)===null||L===void 0||L.call(v,b)),F&&((I=v==null?void 0:v.onStart)===null||I===void 0||I.call(v,b))},destroy:()=>{var x;b&&((x=v==null?void 0:v.onExit)===null||x===void 0||x.call(v,b))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(x,k,E,C){const{isEditable:_}=e,{composing:A}=e.view,{selection:T}=x,{empty:L,from:I}=T,M={...k};if(M.composing=A,_&&(L||e.view.composing)){(I<k.range.from||I>k.range.to)&&!A&&!k.composing&&(M.active=!1);const j=g({char:n,allowSpaces:r,allowToIncludeChar:i,allowedPrefixes:s,startOfLine:a,$position:T.$from}),D=`id_${Math.floor(Math.random()*4294967295)}`;j&&m({editor:e,state:C,range:j.range,isActive:k.active})?(M.active=!0,M.decorationId=k.decorationId?k.decorationId:D,M.range=j.range,M.query=j.query,M.text=j.text):M.active=!1}else M.active=!1;return M.active||(M.decorationId=null,M.range={from:0,to:0},M.query=null,M.text=null),M}},props:{handleKeyDown(x,k){var E;const{active:C,range:_}=w.getState(x.state);return C&&((E=v==null?void 0:v.onKeyDown)===null||E===void 0?void 0:E.call(v,{view:x,event:k,range:_}))||!1},decorations(x){const{active:k,range:E,decorationId:C}=w.getState(x);return k?ft.create(x.doc,[jt.inline(E.from,E.to,{nodeName:l,class:u,"data-decoration-id":C})]):null}}});return w}const hY=[{label:"优酷",value:"youku",icon:"Youku"},{label:"哔哩哔哩",value:"bilibili",icon:"BiliBili"},{label:"腾讯视频",value:"qqvideo",icon:"QQVideo"}],mY=[{label:"高德地图",value:"amap",icon:"Gaode"},{label:"百度地图",value:"baidu_map",icon:"Baidu"}],gY=[{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"}],bY=[{label:"CodePen",value:"codepen",icon:"Codepen"}],vY=[{label:"金数据",value:"jinshuju",icon:"Jinshuju"}],yY=[],wY=[...hY,...mY,...gY,...bY,...vY,...yY];function xY(t){const{t:e}=Ot(),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(T0(t,"iframes")){const i=wY;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 CY={key:0,class:"grid grid-cols-1 gap-0.5 min-w-48"},EY={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"},kY=["onClick"],SY=["src"],_Y={key:1,class:"p-3"},TY={class:"text-xs text-gray-800 dark:text-gray-400"},AY=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}=Ot(),a=o.ref([]),l=t;e({onKeyDown:u}),o.watch([()=>n.value,()=>r.value],async()=>{if(!i.value)return;await o.nextTick();const v=r.value*1e3+n.value,w=a.value[v];w&&w.scrollIntoView({behavior:"smooth",block:"nearest"})});function u({event:v}){return v.key==="ArrowUp"?(c(),!0):v.key==="ArrowDown"?(f(),!0):v.key==="Enter"?(p(),!0):!1}function c(){var x;if(!l.items.length)return!1;let v=n.value-1,w=r.value;v<0&&(w=r.value-1,v=((x=l.items[w])==null?void 0:x.commands.length)-1||0),w<0&&(w=l.items.length-1,v=l.items[w].commands.length-1),n.value=v,r.value=w}function f(){if(!l.items.length)return!1;const v=l.items[r.value].commands;let w=n.value+1,x=r.value;v.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(v,w){const x=l.items[v].commands[w];l.command(x)}function g(v,w){m(v,w)}function b(v,w,x){a.value[v*1e3+w]=x}return(v,w)=>{var x;return 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"},[(x=v.items)!=null&&x.length?(o.openBlock(),o.createElementBlock("div",CY,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(v.items,(k,E)=>(o.openBlock(),o.createElementBlock(o.Fragment,{key:k.title},[o.createElementVNode("div",EY,o.toDisplayString(k.title),1),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(k.commands,(C,_)=>(o.openBlock(),o.createElementBlock("button",{ref_for:!0,ref:A=>b(E,_,A),key:_,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===E&&n.value===_?"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:A=>g(E,_)},[C.iconUrl?(o.openBlock(),o.createElementBlock("img",{key:0,class:"w-6 h-6",src:C.iconUrl},null,8,SY)):o.createCommentVNode("",!0),C.iconName?(o.openBlock(),o.createBlock(o.unref(Lt),{key:1,name:C.iconName,class:"mr-1 text-lg"},null,8,["name"])):o.createCommentVNode("",!0),o.createTextVNode(" "+o.toDisplayString(C.label),1)],10,kY))),128))],64))),128))])):(o.openBlock(),o.createElementBlock("div",_Y,[o.createElementVNode("span",TY,o.toDisplayString(o.unref(s)("editor.slash.empty")),1)]))],512)}}}),ga="slashCommand";let Pt;const OY=Je.create({name:ga,priority:200,onCreate(){Pt=Us("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[pY({editor:this.editor,char:"/",allowSpaces:!0,startOfLine:!0,pluginKey:new Et(ga),allow:({state:t,range:e})=>{var c,f,p;const n=t.doc.resolve(e.from),r=n.depth===1,i=n.parent.type.name==="paragraph",s=((c=n.parent.textContent)==null?void 0:c.charAt(0))==="/",a=this.editor.isActive("column"),l=(p=n.parent.textContent)==null?void 0:p.substring((f=n.parent.textContent)==null?void 0:f.indexOf("/")),u=!(l!=null&&l.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})=>xY(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=>{var s;t=new lw(AY,{props:n,editor:n.editor});const{view:r}=n.editor,i=()=>{if(!n.clientRect)return n.editor.storage[ga].rect;const a=n.clientRect();if(!a)return n.editor.storage[ga].rect;let l=a.y;if(t.element instanceof HTMLElement&&a.top+t.element.offsetHeight+40>window.innerHeight){const u=a.top+t.element.offsetHeight-window.innerHeight+40;l=a.y-u}return new DOMRect(a.x,l,a.width,a.height)};e=()=>{Pt==null||Pt[0].setProps({getReferenceClientRect:i})},(s=r.dom.parentElement)==null||s.addEventListener("scroll",e),t.element&&(Pt==null||Pt[0].setProps({getReferenceClientRect:i,appendTo:()=>document.body,content:t.element})),Pt==null||Pt[0].show()},onUpdate(n){var a;t.updateProps(n);const{view:r}=n.editor,i=()=>{if(!n.clientRect)return n.editor.storage[ga].rect;const l=n.clientRect();return l?new DOMRect(l.x,l.y,l.width,l.height):n.editor.storage[ga].rect},s=()=>{Pt==null||Pt[0].setProps({getReferenceClientRect:i})};(a=r.dom.parentElement)==null||a.addEventListener("scroll",s),n.editor.storage[ga].rect=n.clientRect?i():{width:0,height:0,left:0,top:0,right:0,bottom:0},Pt==null||Pt[0].setProps({getReferenceClientRect:i})},onKeyDown(n){var r;return n.event.key==="Escape"?(Pt==null||Pt[0].hide(),!0):(Pt!=null&&Pt[0].state.isShown||Pt==null||Pt[0].show(),(r=t.ref)==null?void 0:r.onKeyDown(n))},onExit(n){var r;if(Pt==null||Pt[0].hide(),e){const{view:i}=n.editor;(r=i.dom.parentElement)==null||r.removeEventListener("scroll",e)}t.destroy()}}}})]},addStorage(){return{rect:{width:0,height:0,left:0,top:0,right:0,bottom:0}}}}),MY=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=xn(),{toast:r}=Lb();function i(){var a,l,u;const s=(l=(a=e.editor.extensionManager.extensions.find(c=>c.name==="AI"))==null?void 0:a.options)==null?void 0:l.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,(u=e.editor)==null||u.commands.focus()}return(s,a)=>(o.openBlock(),o.createBlock(Ke,{action:i,title:"AI",disabled:s.disabled,icon:s.icon,tooltip:s.tooltip},null,8,["disabled","icon","tooltip"]))}}),BY=Bt.create({name:"AI",group:"block",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),toolbar:!1,button:({editor:e,t:n})=>({component:MY,componentProps:{icon:"Sparkles",tooltip:n("editor.AI.ask")}})}}});function IY(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 RY(t,e){return new File([t],e,{type:t.type})}const LY=Je.create({name:"importWord",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),upload:void 0,convert:void 0,limit:1024*1024*10,button:({editor:e,extension:n,t:r})=>({component:Ke,componentProps:{action:()=>{var i;return(i=e.commands)==null?void 0:i.toggleImportWord()},disabled:!e.can().setHorizontalRule(),icon:"Word",tooltip:r("editor.importWord.tooltip")}})}},addCommands(){return{toggleImportWord:()=>({chain:t,editor:e})=>{const{toast:n}=Lb(),{t:r}=Ot();async function i(u){var g;const f=new DOMParser().parseFromString(u,"text/html"),p=f.querySelectorAll("img");if(!p.length)return f.body.innerHTML;if(T0(e,"image")){const b=(g=e.extensionManager.extensions.find(v=>v.name==="importWord"))==null?void 0:g.options;if(b&&typeof b.upload=="function"){const v=[];for(const x of p){const k=x.getAttribute("src"),E=IY(k,"image/jpeg"),C=RY(E,"image.jpeg");v.push(C)}const w=await b.upload(v);for(let x=0;x<p.length;x++){const k=p[x];k.setAttribute("src",w[x].src);const E=k.parentElement;(E==null?void 0:E.tagName)==="P"&&(E.insertAdjacentElement("beforebegin",k),!E.hasChildNodes()&&E.textContent===""&&E.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}=mt.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}}}}),Pb=xn(),PY=Je.create({name:"preview",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({t:e})=>({component:Ke,componentProps:{icon:"Eye",action:()=>{Pb.togglePreview()},tooltip:e("editor.preview.tooltip"),isActive:()=>Pb.state.showPreview}})}},addCommands(){return{togglePreview:()=>()=>(Pb.togglePreview(),!0)}}}),rk=xn(),DY=(t,e,n)=>RegExp(e?t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"):t,n?"gu":"gui");function VY(t,e,n,r){const i=[],s=[];let a=[],l=0;if(!e)return{decorationsToReturn:ft.empty,results:[]};t==null||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:ft.create(t,i),results:s}}const FY=(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))},$Y=(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]},zY=(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=$Y(t,a,i,s);c&&(i=c[0],s=c[1])}r&&r(n)}},HY=new Et("findAndReplacePlugin"),UY=Je.create({name:"findAndReplace",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),searchResultClass:"vdc-editor-search-result",disableRegex:!0,button:({editor:e,extension:n,t:r})=>({component:Ke,componentProps:{icon:"DocSearch",tooltip:r("editor.findAndReplace.tooltip"),action:()=>{rk.toggleFindAndReplace()},isActive:()=>rk.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 FY(r,i,{state:e,dispatch:n}),!1},replaceAll:()=>({editor:t,tr:e,dispatch:n})=>{const{replaceTerm:r,results:i}=t.storage.findAndReplace;return zY(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 et({key:HY,state:{init:()=>ft.empty,apply({doc:a,docChanged:l},u){const{searchTerm:c,lastSearchTerm:f,caseSensitive:p,lastCaseSensitive:m,resultIndex:g,lastResultIndex:b}=t.storage.findAndReplace;if(!l&&f===c&&m===p&&b===g)return u;if(r(c),i(p),s(g),!c)return t.storage.findAndReplace.results=[],ft.empty;const{decorationsToReturn:v,results:w}=VY(a,DY(c,n,p),e,g);return t.storage.findAndReplace.results=w,v}},props:{decorations(a){return this.getState(a)}}})]}}),{togglePrinter:WY,state:jY}=xn(),qY=Je.create({name:"printer",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({t:e})=>({component:Ke,componentProps:{tooltip:e("editor.printer.tooltip"),action:()=>WY(),icon:"Printer",shortcutKeys:["mod","P"],isActive:()=>jY.printer}})}}}),Db="spell-check";class KY{constructor(e,n,r,i=1e3){Xt(this,"debouncedGetMatchAndSetDecorations",tt.debounce(this.getMatchAndSetDecorations.bind(this),300));Xt(this,"debouncedGetMatchAndSetDecorationsList",tt.debounce(this.getMatchAndSetDecorationsList.bind(this),300));Xt(this,"debouncedClickEventsListener",tt.debounce(this.clickEventsListener.bind(this),0));Xt(this,"debouncedAcceptSuggestionEventsListener",tt.debounce(this.acceptSuggestionListener.bind(this),0));Xt(this,"debouncedProofreadChangedNodes",tt.debounce(this.proofreadChangedNodes.bind(this),300));Xt(this,"proofreader");Xt(this,"uiStrings");Xt(this,"showSuggestionsEvent");Xt(this,"decorationSet");Xt(this,"editorView");Xt(this,"isInitialProofreadingDone",!1);Xt(this,"lastOriginalFrom",0);Xt(this,"lastClickedDecoration",null);Xt(this,"suggestionBox");Xt(this,"isEnableSuggestion");Xt(this,"isMobile");Xt(this,"limit",1e3);Xt(this,"_debouncedProofreadDoc",tt.debounce((e,n)=>{this.proofreadDoc(e),n&&n()},500));Xt(this,"_debouncedHandleEnterKey",tt.debounce((e,n,r)=>{this.handleEnterKey(e,n),r&&r()},500));this.proofreader=e,this.uiStrings=n,this.showSuggestionsEvent=r,this.decorationSet=ft.empty,this.limit=i,this.suggestionBox=document.createElement("div"),this.suggestionBox.id="suggestions-box",this.suggestionBox.tabIndex=0,this.isEnableSuggestion=!0,this.isMobile=!1,this.hideSuggestionBox()}get completeProofreadingDone(){return this.isInitialProofreadingDone}getProofreader(){return this.proofreader}toggleIsEnabledSpellCheck(){this.proofreader.toggleIsEnabled()}setEnabledProofreadText(e){this.proofreader.setEnabled(e)}getIsEnabledSpellCheck(){return this.proofreader.getIsEnabled()}setDecorationSet(e){this.decorationSet=e}getDecorationSet(){return this.decorationSet}setEditorView(e){this.editorView=e}getEditorView(){return this.editorView}getSuggestionBox(){return this.suggestionBox}hideSuggestionBox(){this.suggestionBox.textContent="",this.suggestionBox.style.display="none"}setIsEnableSuggestion(e){if(this.isEnableSuggestion=e,this.isEnableSuggestion){this.addEventListenersToDecorations();return}this.hideSuggestionBox(),this.removeEventListenersFromDecorations()}setIsMobile(e){this.isMobile=e}getChangedNodesFromTransaction(e,n=!1,r=!1){const i=[],s=new Set;let a=!1;return e.steps.forEach(l=>{var p,m,g;const u=l;if(u.from===void 0||u.to===void 0||n&&u.structure)return;((m=(p=u.slice)==null?void 0:p.content[0])==null?void 0:m.type.name)===gc&&(a=!0);const c=u.from-(r?1:0);let f=Math.max(u.to,u.from+(((g=u.slice)==null?void 0:g.size)||0))-(r?1:0);f>e.doc.content.size&&(f=e.doc.content.size),e.doc.nodesBetween(c,f,(b,v)=>{b&&(b.isText&&!s.has(v)&&(i.push({node:b,pos:v}),s.add(v)),b.type.name===gc&&(a=!0))})}),{changedNodes:i,isChangedSuperText:a}}debouncedProofreadDoc(e,n){this._debouncedProofreadDoc(e,n)}isSuperTextAlone(e,n){let r=!1;return e.descendants((i,s,a)=>i===n?(a&&a.type.name==="paragraph"&&a.childCount===1&&a.firstChild===n&&(r=!0),!1):!0),r}proofreadDoc(e){let n=[],r=0;e==null||e.descendants((u,c)=>{if(u.isText){const f={text:u.text??"",from:c,to:c+u.nodeSize};return n[r]&&(f.text=n[r].text+f.text,f.from=n[r].from),n[r]=f,r+=1,!1}return u.type.name!==gc}),n=n.filter(Boolean);let i="",s=1;for(const{text:u,from:c,to:f}of n){const p=c-s;p>0&&(i+=Array(p+1).join(`
294
294
  `)),s=f,i+=u}const a=mw(i,this.limit),l=this.getMatchAndSetDecorationsList(a.map(u=>({text:u.text,originalFrom:u.offset+1})));this.editorView&&this.dispatch(this.editorView.state.tr.setMeta(Hn.LOADING_TRANSACTION,!0)),l.then(()=>{this.editorView&&this.dispatch(this.editorView.state.tr.setMeta(Hn.LOADING_TRANSACTION,!1))}),this.isInitialProofreadingDone=!0}async proofreadChangedNodes(e){const n=this.isMobile?1:2,i=e.reduce((s,a)=>{if(s.length===0)return s.push({changedNode:a,time:1}),s;const l=s[s.length-1];return a.pos===l.changedNode.pos+l.changedNode.node.nodeSize+n*(l.time-1)?(l.changedNode.node.text+=a.node.text,l.time+=1):s.push({changedNode:a,time:1}),s},[]).map(({changedNode:s})=>{var c;const a=((c=s.node)==null?void 0:c.textContent)||"",l=s.pos;return mw(a,this.limit).map(f=>({text:f.text,originalFrom:l+f.offset}))});this.debouncedGetMatchAndSetDecorationsList(i.flat())}async getMatchAndSetDecorationsList(e){const n=e.map(r=>this.getMatchAndSetDecorations(r.text,r.originalFrom));await Promise.all(n)}async getMatchAndSetDecorations(e,n){const r=await this.proofreader.proofreadText(this.proofreader.normalizeTextForLanguage(e)),i=[];for(const l of r){const u=l.startIndex+n,c=u+l.length,f=await this.proofreader.getSuggestions(l.wrongWord),p={length:l.length,wrongWord:l.wrongWord,suggestions:f};i.push(jt.inline(u,c,{class:"spell-error",nodeName:"span",[Db]:JSON.stringify(p)}))}const s=this.decorationSet.find(n,n+e.length);let a=this.decorationSet.remove(s);this.editorView&&(a=a.add(this.editorView.state.doc,i)),this.setDecorationSet(a),this.editorView&&this.dispatch(this.editorView.state.tr.setMeta(Hn.SPELLCHECKER_TRANSACTION,!0)),this.addEventListenersToDecorations()}removeEventListenersFromDecorations(){var r;const e=(r=this.editorView)==null?void 0:r.domAtPos(this.lastOriginalFrom).node,n=(e==null?void 0:e.querySelectorAll("span.spell-error"))||[];n.length&&n.forEach(i=>{i.removeEventListener("click",this.debouncedClickEventsListener)})}addEventListenersToDecorations(){var e;if(this.isEnableSuggestion)try{const n=(e=this.editorView)==null?void 0:e.domAtPos(this.lastOriginalFrom).node,r=(n==null?void 0:n.querySelectorAll("span.spell-error"))||[];if(!r.length)return;r.forEach(i=>{i.addEventListener("click",this.debouncedClickEventsListener)})}catch{}}addEventListenersToSuggestionBox(){const e=this.suggestionBox.querySelectorAll("li");e.length&&e.forEach(n=>{n.addEventListener("mousedown",this.debouncedAcceptSuggestionEventsListener)})}dispatch(e){this.editorView&&this.editorView.dispatch(e)}findChangedTextNodes(e,n,r,i){if(!e.isBlock)return!1;if(!e.isTextblock)return e.descendants((u,c)=>{this.findChangedTextNodes(u,c,r,i)}),!1;const[s,a]=[n,n+e.nodeSize];if(!(s<=r&&i<=a))return;const l={node:e,pos:n};this.onNodeChanged(l.node.textContent,l.pos+1)}onNodeChanged(e,n){n!==this.lastOriginalFrom?this.getMatchAndSetDecorations(e,n):this.debouncedGetMatchAndSetDecorations(e,n),this.lastOriginalFrom=n}async clickEventsListener(e){var c,f;if(!e.target)return;let n=e.target;for(;n&&!n.classList.contains("spell-error");)n=n.parentElement;if(!n||!n.classList.contains("spell-error"))return;this.lastClickedDecoration=n;const r=(c=n.getAttribute(Db))==null?void 0:c.trim();if(!r){console.error("No match string provided",{spellCheckerAttributes:r});return}const{length:i,wrongWord:s,suggestions:a}=JSON.parse(r),l=((f=this.editorView)==null?void 0:f.posAtDOM(n,0))??0,u=l+i;if(this.editorView){this.addSuggestionsList(a,l,u),this.suggestionBox.style.display="";const p=LK(n);if(!p)return;const m=n.getBoundingClientRect(),g=p.getBoundingClientRect(),b=window.getComputedStyle(p).padding,v=m.left-g.left+3-parseInt(b),w=m.top-g.top+30-parseInt(b);this.suggestionBox.style.left=v+"px",this.suggestionBox.style.top=w+"px",this.showSuggestionsEvent&&this.showSuggestionsEvent(this.proofreader.normalizeTextForLanguage(s))}return this.addEventListenersToSuggestionBox(),!1}acceptSuggestionListener(e){var s;if(!e||!e.target)return;e.preventDefault(),e.stopPropagation();const n=e.target;let r=0,i=0;if(this.lastClickedDecoration&&this.editorView){const a=(s=this.lastClickedDecoration.getAttribute(Db))==null?void 0:s.trim();if(a){const{length:l}=JSON.parse(a);r=this.editorView.posAtDOM(this.lastClickedDecoration,0),i=r+l}}this.editorView&&r>=0&&i>r&&(this.dispatch(this.editorView.state.tr.setMeta(Hn.ACCEPT_SUGGESTION,!0)),this.dispatch(this.editorView.state.tr.insertText(n.textContent||"",r,i))),this.hideSuggestionBox(),this.lastClickedDecoration&&(this.lastClickedDecoration.removeEventListener("click",this.debouncedClickEventsListener),this.lastClickedDecoration=null)}addSuggestionsList(e,n,r){if(this.suggestionBox.textContent="",e.length>0){const i=document.createElement("ul");i.className="suggestion-list",e.forEach(s=>{const a=document.createElement("li");a.innerText=s,a.dataset.from=n+"",a.dataset.to=r+"",i.appendChild(a)}),this.suggestionBox.appendChild(i)}if(e.length===0){const i=document.createElement("b"),s=this.uiStrings&&this.uiStrings.noSuggestions?this.uiStrings.noSuggestions:"No suggestions found";i.textContent=s,this.suggestionBox.appendChild(i)}}isUndoRedo(e,n){return e.getMeta(L8.ADD_TO_HISTORY_TRANSACTION)===!1||e.getMeta(Hn.APPENDED)===!0||n.isUndoRedoOperation}handleUndoRedo(e,n){var s;const r=(s=e.getMeta(L8.HISTORY_TRANSACTION))==null?void 0:s.redo;if(n.isUndoRedoOperation=!1,r)return this.debouncedProofreadDoc(e.doc),this.getDecorationSet();const{changedNodes:i}=this.getChangedNodesFromTransaction(e,!0);return i.length===0?this.getDecorationSet():i.length===1?(this.debouncedProofreadChangedNodes(i),this.getDecorationSet()):(this.debouncedProofreadDoc(e.doc),this.getDecorationSet())}isTextContentChangedOrDeleted(e){let n=!1;return{isTextContentChanged:e.steps.some(i=>{var a,l;const s=(a=i.toJSON)==null?void 0:a.call(i);return(s==null?void 0:s.stepType)==="replace"&&((l=s==null?void 0:s.slice)!=null&&l.content)?s.slice.content.some(u=>u.type==="paragraph"&&u.content&&u.content.length>0):(s==null?void 0:s.stepType)==="replace"&&(!s.slice||!s.slice.content||s.slice.content.length===0)?(n=!0,s.from!==s.to):!1}),isDeleteAction:n}}handleEnterKey(e,n){if(n)return this.debouncedProofreadDoc(e.doc),this.getDecorationSet();const r=e.getMeta(Hn.APPENDED_TRANSACTION);if(!r)return this.getDecorationSet();const s=r.steps[0].to,a=r.before.nodeAt(s-1);if(!(a!=null&&a.isText))return this.getDecorationSet();let l=0;return r.before.descendants((c,f)=>{c.textContent===(a==null?void 0:a.textContent)&&(l=f)}),l+((a==null?void 0:a.nodeSize)||0)===s?this.getDecorationSet():(this.debouncedProofreadDoc(e.doc),this.getDecorationSet())}handleEnterKeyDebounced(e,n,r){this._debouncedHandleEnterKey(e,n,r)}}const ok=xn(),Hn={SPELLCHECKER_TRANSACTION:"spellcheckerTransaction",IS_ACTIVE_SPELLCHECK:"isActiveSpellCheck",LOADING_TRANSACTION:"loading",PREVENT_UPDATE:"preventUpdate",APPENDED:"appended",APPENDED_TRANSACTION:"appendedTransaction",ACCEPT_SUGGESTION:"acceptSuggestion",SKIP_SPELLCHECK:"skipSpellcheck",UI_EVENT:"uiEvent"},GY={DROP:"drop"},ik=Je.create({name:"spellchecker",addOptions(){return{proofreader:void 0,uiStrings:{noSuggestions:""},button:({editor:t,t:e,isMobile:n})=>({component:Ke,componentProps:{action:()=>t.commands.handleActiveSpellCheck(),isActive:()=>{var r,i,s,a;return((a=(s=(i=(r=t==null?void 0:t.extensionStorage)==null?void 0:r.spellchecker)==null?void 0:i.spellchecker)==null?void 0:s.proofreader)==null?void 0:a.enabled)||!1},icon:"SpellCheck",tooltip:"맞춤법 검사",title:n?e("editor.menubar.menu.spelling"):""}})}},addStorage(){return{didPaste:!1,spellchecker:void 0,isUndoRedoOperation:!1,pendingSpellCheck:!1,enterKeyPressed:!1}},addCommands(){return{checkSpelling:()=>({tr:t})=>(this.storage.spellchecker.proofreadDoc(t.doc),!0),selectAll:()=>({state:t,dispatch:e})=>(a9(t,e),!0),copy:()=>()=>(document.execCommand("copy"),!0),handleActiveSpellCheck:(t=!0)=>({editor:e})=>{const n=e.extensionStorage.spellchecker.spellchecker;return n.toggleIsEnabledSpellCheck(),e.view.dispatch(e.state.tr.setMeta(Hn.IS_ACTIVE_SPELLCHECK,n.getIsEnabledSpellCheck())),t&&ok.setSpellCheck(n.getIsEnabledSpellCheck()),!0},setIsEnableSuggestion:t=>()=>(this.storage.spellchecker.setIsEnableSuggestion(t),!0)}},addProseMirrorPlugins(){return[new et({key:new Et("skipMarkPlugin"),view:e=>{const n=e.dispatch;return e.dispatch=r=>(r.steps.some(s=>s instanceof Qo||s instanceof ro)&&r.setMeta(Hn.SKIP_SPELLCHECK,!0),n.call(e,r)),{}}}),new et({key:new Et("spellcheckerPlugin"),props:{decorations(e){return this.getState(e)},handlePaste:()=>{this.storage.didPaste=!0},handleClick:()=>{this.storage.spellchecker.hideSuggestionBox()},handleKeyDown:(e,n)=>((n.ctrlKey||n.metaKey)&&(n.key==="z"||n.key==="y")&&(this.storage.isUndoRedoOperation=!0,this.storage.pendingSpellCheck=!0),this.storage.enterKeyPressed&&(this.storage.pendingSpellCheck=!0),n.key==="Enter"&&(this.storage.enterKeyPressed=!0),!1)},state:{init:(e,n)=>{var i,s;const r=new KY(this.options.proofreader,this.options.uiStrings,this.options.onShowSuggestionsEvent,(i=this.options.proofreader)==null?void 0:i.limit);return this.storage.spellchecker=r,r.setDecorationSet(ft.create(n.doc,[])),ok.setSpellCheck(r.getIsEnabledSpellCheck()),(s=this.options.proofreader)!=null&&s.enabled&&r.proofreadDoc(n.doc),r.getDecorationSet()},apply:(e,n)=>{var s;if(e.getMeta(Hn.SKIP_SPELLCHECK))return n;const r=this.storage.spellchecker,i=e.getMeta(Hn.IS_ACTIVE_SPELLCHECK);if(i!==void 0)return i?r.proofreadDoc(e.doc):r.setDecorationSet(ft.empty),r.getDecorationSet();if(e.getMeta(Hn.SPELLCHECKER_TRANSACTION))return r.getDecorationSet();if(e.docChanged&&e.doc.nodeSize){const l=r.getDecorationSet().map(e.mapping,e.doc);if(r.setDecorationSet(l),e.getMeta(Hn.UI_EVENT)===GY.DROP)return r.debouncedProofreadDoc(e.doc),r.getDecorationSet();if(r.isUndoRedo(e,this.storage))return r.handleUndoRedo(e,this.storage);const{isTextContentChanged:u,isDeleteAction:c}=r.isTextContentChangedOrDeleted(e);if(c){const{changedNodes:g}=r.getChangedNodesFromTransaction(e,!1,!0);return g.length>0&&r.debouncedProofreadChangedNodes([g[0]]),r.getDecorationSet()}if(this.storage.enterKeyPressed)return r.handleEnterKeyDebounced(e,this.storage.pendingSpellCheck,()=>{this.storage.enterKeyPressed=!1,this.storage.pendingSpellCheck=!1}),r.getDecorationSet();if(this.storage.pendingSpellCheck||u)return r.debouncedProofreadDoc(e.doc,()=>{this.storage.pendingSpellCheck=!1}),r.getDecorationSet();if(e.getMeta(wE.UPDATE)||e.updated===0&&((s=e.steps[0])==null?void 0:s.structure)===!0)return r.getDecorationSet();if(e.getMeta(Hn.PREVENT_UPDATE)===!0&&e.before.textContent.length===0)return r.debouncedProofreadDoc(e.doc),r.getDecorationSet();this.storage.didPaste&&(this.storage.didPaste=!1);const{changedNodes:p,isChangedSuperText:m}=r.getChangedNodesFromTransaction(e);if(m)return r.debouncedProofreadDoc(e.doc),r.getDecorationSet();p.length>0&&r.debouncedProofreadChangedNodes(p)}return r.getDecorationSet()}},view:()=>({update:e=>{var r,i;const n=this.storage.spellchecker;n.setEditorView(e),(i=(r=e==null?void 0:e.dom)==null?void 0:r.parentNode)==null||i.appendChild(n.getSuggestionBox())}})})]}});function sk(t,e){return function(){return t.apply(e,arguments)}}const{toString:XY}=Object.prototype,{getPrototypeOf:Vb}=Object,Fp=(t=>e=>{const n=XY.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),vo=t=>(t=t.toLowerCase(),e=>Fp(e)===t),$p=t=>e=>typeof e===t,{isArray:Bl}=Array,yc=$p("undefined");function YY(t){return t!==null&&!yc(t)&&t.constructor!==null&&!yc(t.constructor)&&Er(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const ak=vo("ArrayBuffer");function JY(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&ak(t.buffer),e}const ZY=$p("string"),Er=$p("function"),lk=$p("number"),zp=t=>t!==null&&typeof t=="object",QY=t=>t===!0||t===!1,Hp=t=>{if(Fp(t)!=="object")return!1;const e=Vb(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},NY=vo("Date"),eJ=vo("File"),tJ=vo("Blob"),nJ=vo("FileList"),rJ=t=>zp(t)&&Er(t.pipe),oJ=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||Er(t.append)&&((e=Fp(t))==="formdata"||e==="object"&&Er(t.toString)&&t.toString()==="[object FormData]"))},iJ=vo("URLSearchParams"),[sJ,aJ,lJ,uJ]=["ReadableStream","Request","Response","Headers"].map(vo),cJ=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function wc(t,e,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let r,i;if(typeof t!="object"&&(t=[t]),Bl(t))for(r=0,i=t.length;r<i;r++)e.call(null,t[r],r,t);else{const s=n?Object.getOwnPropertyNames(t):Object.keys(t),a=s.length;let l;for(r=0;r<a;r++)l=s[r],e.call(null,t[l],l,t)}}function uk(t,e){e=e.toLowerCase();const n=Object.keys(t);let r=n.length,i;for(;r-- >0;)if(i=n[r],e===i.toLowerCase())return i;return null}const ba=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,ck=t=>!yc(t)&&t!==ba;function Fb(){const{caseless:t}=ck(this)&&this||{},e={},n=(r,i)=>{const s=t&&uk(e,i)||i;Hp(e[s])&&Hp(r)?e[s]=Fb(e[s],r):Hp(r)?e[s]=Fb({},r):Bl(r)?e[s]=r.slice():e[s]=r};for(let r=0,i=arguments.length;r<i;r++)arguments[r]&&wc(arguments[r],n);return e}const dJ=(t,e,n,{allOwnKeys:r}={})=>(wc(e,(i,s)=>{n&&Er(i)?t[s]=sk(i,n):t[s]=i},{allOwnKeys:r}),t),fJ=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),pJ=(t,e,n,r)=>{t.prototype=Object.create(e.prototype,r),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),n&&Object.assign(t.prototype,n)},hJ=(t,e,n,r)=>{let i,s,a;const l={};if(e=e||{},t==null)return e;do{for(i=Object.getOwnPropertyNames(t),s=i.length;s-- >0;)a=i[s],(!r||r(a,t,e))&&!l[a]&&(e[a]=t[a],l[a]=!0);t=n!==!1&&Vb(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},mJ=(t,e,n)=>{t=String(t),(n===void 0||n>t.length)&&(n=t.length),n-=e.length;const r=t.indexOf(e,n);return r!==-1&&r===n},gJ=t=>{if(!t)return null;if(Bl(t))return t;let e=t.length;if(!lk(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},bJ=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&Vb(Uint8Array)),vJ=(t,e)=>{const r=(t&&t[Symbol.iterator]).call(t);let i;for(;(i=r.next())&&!i.done;){const s=i.value;e.call(t,s[0],s[1])}},yJ=(t,e)=>{let n;const r=[];for(;(n=t.exec(e))!==null;)r.push(n);return r},wJ=vo("HTMLFormElement"),xJ=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,i){return r.toUpperCase()+i}),dk=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),CJ=vo("RegExp"),fk=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),r={};wc(n,(i,s)=>{let a;(a=e(i,s,t))!==!1&&(r[s]=a||i)}),Object.defineProperties(t,r)},EJ=t=>{fk(t,(e,n)=>{if(Er(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=t[n];if(Er(r)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},kJ=(t,e)=>{const n={},r=i=>{i.forEach(s=>{n[s]=!0})};return Bl(t)?r(t):r(String(t).split(e)),n},SJ=()=>{},_J=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function TJ(t){return!!(t&&Er(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}const AJ=t=>{const e=new Array(10),n=(r,i)=>{if(zp(r)){if(e.indexOf(r)>=0)return;if(!("toJSON"in r)){e[i]=r;const s=Bl(r)?[]:{};return wc(r,(a,l)=>{const u=n(a,i+1);!yc(u)&&(s[l]=u)}),e[i]=void 0,s}}return r};return n(t,0)},OJ=vo("AsyncFunction"),MJ=t=>t&&(zp(t)||Er(t))&&Er(t.then)&&Er(t.catch),pk=((t,e)=>t?setImmediate:e?((n,r)=>(ba.addEventListener("message",({source:i,data:s})=>{i===ba&&s===n&&r.length&&r.shift()()},!1),i=>{r.push(i),ba.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Er(ba.postMessage)),BJ=typeof queueMicrotask<"u"?queueMicrotask.bind(ba):typeof process<"u"&&process.nextTick||pk,re={isArray:Bl,isArrayBuffer:ak,isBuffer:YY,isFormData:oJ,isArrayBufferView:JY,isString:ZY,isNumber:lk,isBoolean:QY,isObject:zp,isPlainObject:Hp,isReadableStream:sJ,isRequest:aJ,isResponse:lJ,isHeaders:uJ,isUndefined:yc,isDate:NY,isFile:eJ,isBlob:tJ,isRegExp:CJ,isFunction:Er,isStream:rJ,isURLSearchParams:iJ,isTypedArray:bJ,isFileList:nJ,forEach:wc,merge:Fb,extend:dJ,trim:cJ,stripBOM:fJ,inherits:pJ,toFlatObject:hJ,kindOf:Fp,kindOfTest:vo,endsWith:mJ,toArray:gJ,forEachEntry:vJ,matchAll:yJ,isHTMLForm:wJ,hasOwnProperty:dk,hasOwnProp:dk,reduceDescriptors:fk,freezeMethods:EJ,toObjectSet:kJ,toCamelCase:xJ,noop:SJ,toFiniteNumber:_J,findKey:uk,global:ba,isContextDefined:ck,isSpecCompliantForm:TJ,toJSONObject:AJ,isAsyncFn:OJ,isThenable:MJ,setImmediate:pk,asap:BJ};function rt(t,e,n,r,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),n&&(this.config=n),r&&(this.request=r),i&&(this.response=i,this.status=i.status?i.status:null)}re.inherits(rt,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:re.toJSONObject(this.config),code:this.code,status:this.status}}});const hk=rt.prototype,mk={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{mk[t]={value:t}}),Object.defineProperties(rt,mk),Object.defineProperty(hk,"isAxiosError",{value:!0}),rt.from=(t,e,n,r,i,s)=>{const a=Object.create(hk);return re.toFlatObject(t,a,function(u){return u!==Error.prototype},l=>l!=="isAxiosError"),rt.call(a,t.message,e,n,r,i),a.cause=t,a.name=t.name,s&&Object.assign(a,s),a};const IJ=null;function $b(t){return re.isPlainObject(t)||re.isArray(t)}function gk(t){return re.endsWith(t,"[]")?t.slice(0,-2):t}function bk(t,e,n){return t?t.concat(e).map(function(i,s){return i=gk(i),!n&&s?"["+i+"]":i}).join(n?".":""):e}function RJ(t){return re.isArray(t)&&!t.some($b)}const LJ=re.toFlatObject(re,{},null,function(e){return/^is[A-Z]/.test(e)});function Up(t,e,n){if(!re.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,n=re.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(v,w){return!re.isUndefined(w[v])});const r=n.metaTokens,i=n.visitor||f,s=n.dots,a=n.indexes,u=(n.Blob||typeof Blob<"u"&&Blob)&&re.isSpecCompliantForm(e);if(!re.isFunction(i))throw new TypeError("visitor must be a function");function c(b){if(b===null)return"";if(re.isDate(b))return b.toISOString();if(!u&&re.isBlob(b))throw new rt("Blob is not supported. Use a Buffer instead.");return re.isArrayBuffer(b)||re.isTypedArray(b)?u&&typeof Blob=="function"?new Blob([b]):Buffer.from(b):b}function f(b,v,w){let x=b;if(b&&!w&&typeof b=="object"){if(re.endsWith(v,"{}"))v=r?v:v.slice(0,-2),b=JSON.stringify(b);else if(re.isArray(b)&&RJ(b)||(re.isFileList(b)||re.endsWith(v,"[]"))&&(x=re.toArray(b)))return v=gk(v),x.forEach(function(E,C){!(re.isUndefined(E)||E===null)&&e.append(a===!0?bk([v],C,s):a===null?v:v+"[]",c(E))}),!1}return $b(b)?!0:(e.append(bk(w,v,s),c(b)),!1)}const p=[],m=Object.assign(LJ,{defaultVisitor:f,convertValue:c,isVisitable:$b});function g(b,v){if(!re.isUndefined(b)){if(p.indexOf(b)!==-1)throw Error("Circular reference detected in "+v.join("."));p.push(b),re.forEach(b,function(x,k){(!(re.isUndefined(x)||x===null)&&i.call(e,x,re.isString(k)?k.trim():k,v,m))===!0&&g(x,v?v.concat(k):[k])}),p.pop()}}if(!re.isObject(t))throw new TypeError("data must be an object");return g(t),e}function vk(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function zb(t,e){this._pairs=[],t&&Up(t,this,e)}const yk=zb.prototype;yk.append=function(e,n){this._pairs.push([e,n])},yk.toString=function(e){const n=e?function(r){return e.call(this,r,vk)}:vk;return this._pairs.map(function(i){return n(i[0])+"="+n(i[1])},"").join("&")};function PJ(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function wk(t,e,n){if(!e)return t;const r=n&&n.encode||PJ;re.isFunction(n)&&(n={serialize:n});const i=n&&n.serialize;let s;if(i?s=i(e,n):s=re.isURLSearchParams(e)?e.toString():new zb(e,n).toString(r),s){const a=t.indexOf("#");a!==-1&&(t=t.slice(0,a)),t+=(t.indexOf("?")===-1?"?":"&")+s}return t}class xk{constructor(){this.handlers=[]}use(e,n,r){return this.handlers.push({fulfilled:e,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){re.forEach(this.handlers,function(r){r!==null&&e(r)})}}const Ck={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},DJ={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:zb,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},Hb=typeof window<"u"&&typeof document<"u",Ub=typeof navigator=="object"&&navigator||void 0,VJ=Hb&&(!Ub||["ReactNative","NativeScript","NS"].indexOf(Ub.product)<0),FJ=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",$J=Hb&&window.location.href||"http://localhost",Un={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Hb,hasStandardBrowserEnv:VJ,hasStandardBrowserWebWorkerEnv:FJ,navigator:Ub,origin:$J},Symbol.toStringTag,{value:"Module"})),...DJ};function zJ(t,e){return Up(t,new Un.classes.URLSearchParams,Object.assign({visitor:function(n,r,i,s){return Un.isNode&&re.isBuffer(n)?(this.append(r,n.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},e))}function HJ(t){return re.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function UJ(t){const e={},n=Object.keys(t);let r;const i=n.length;let s;for(r=0;r<i;r++)s=n[r],e[s]=t[s];return e}function Ek(t){function e(n,r,i,s){let a=n[s++];if(a==="__proto__")return!0;const l=Number.isFinite(+a),u=s>=n.length;return a=!a&&re.isArray(i)?i.length:a,u?(re.hasOwnProp(i,a)?i[a]=[i[a],r]:i[a]=r,!l):((!i[a]||!re.isObject(i[a]))&&(i[a]=[]),e(n,r,i[a],s)&&re.isArray(i[a])&&(i[a]=UJ(i[a])),!l)}if(re.isFormData(t)&&re.isFunction(t.entries)){const n={};return re.forEachEntry(t,(r,i)=>{e(HJ(r),i,n,0)}),n}return null}function WJ(t,e,n){if(re.isString(t))try{return(e||JSON.parse)(t),re.trim(t)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(t)}const xc={transitional:Ck,adapter:["xhr","http","fetch"],transformRequest:[function(e,n){const r=n.getContentType()||"",i=r.indexOf("application/json")>-1,s=re.isObject(e);if(s&&re.isHTMLForm(e)&&(e=new FormData(e)),re.isFormData(e))return i?JSON.stringify(Ek(e)):e;if(re.isArrayBuffer(e)||re.isBuffer(e)||re.isStream(e)||re.isFile(e)||re.isBlob(e)||re.isReadableStream(e))return e;if(re.isArrayBufferView(e))return e.buffer;if(re.isURLSearchParams(e))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let l;if(s){if(r.indexOf("application/x-www-form-urlencoded")>-1)return zJ(e,this.formSerializer).toString();if((l=re.isFileList(e))||r.indexOf("multipart/form-data")>-1){const u=this.env&&this.env.FormData;return Up(l?{"files[]":e}:e,u&&new u,this.formSerializer)}}return s||i?(n.setContentType("application/json",!1),WJ(e)):e}],transformResponse:[function(e){const n=this.transitional||xc.transitional,r=n&&n.forcedJSONParsing,i=this.responseType==="json";if(re.isResponse(e)||re.isReadableStream(e))return e;if(e&&re.isString(e)&&(r&&!this.responseType||i)){const a=!(n&&n.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(l){if(a)throw l.name==="SyntaxError"?rt.from(l,rt.ERR_BAD_RESPONSE,this,null,this.response):l}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Un.classes.FormData,Blob:Un.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};re.forEach(["delete","get","head","post","put","patch"],t=>{xc.headers[t]={}});const jJ=re.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),qJ=t=>{const e={};let n,r,i;return t&&t.split(`
295
295
  `).forEach(function(a){i=a.indexOf(":"),n=a.substring(0,i).trim().toLowerCase(),r=a.substring(i+1).trim(),!(!n||e[n]&&jJ[n])&&(n==="set-cookie"?e[n]?e[n].push(r):e[n]=[r]:e[n]=e[n]?e[n]+", "+r:r)}),e},kk=Symbol("internals");function Cc(t){return t&&String(t).trim().toLowerCase()}function Wp(t){return t===!1||t==null?t:re.isArray(t)?t.map(Wp):String(t)}function KJ(t){const e=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(t);)e[r[1]]=r[2];return e}const GJ=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function Wb(t,e,n,r,i){if(re.isFunction(r))return r.call(this,e,n);if(i&&(e=n),!!re.isString(e)){if(re.isString(r))return e.indexOf(r)!==-1;if(re.isRegExp(r))return r.test(e)}}function XJ(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,r)=>n.toUpperCase()+r)}function YJ(t,e){const n=re.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(t,r+n,{value:function(i,s,a){return this[r].call(this,e,i,s,a)},configurable:!0})})}let ur=class{constructor(e){e&&this.set(e)}set(e,n,r){const i=this;function s(l,u,c){const f=Cc(u);if(!f)throw new Error("header name must be a non-empty string");const p=re.findKey(i,f);(!p||i[p]===void 0||c===!0||c===void 0&&i[p]!==!1)&&(i[p||u]=Wp(l))}const a=(l,u)=>re.forEach(l,(c,f)=>s(c,f,u));if(re.isPlainObject(e)||e instanceof this.constructor)a(e,n);else if(re.isString(e)&&(e=e.trim())&&!GJ(e))a(qJ(e),n);else if(re.isHeaders(e))for(const[l,u]of e.entries())s(u,l,r);else e!=null&&s(n,e,r);return this}get(e,n){if(e=Cc(e),e){const r=re.findKey(this,e);if(r){const i=this[r];if(!n)return i;if(n===!0)return KJ(i);if(re.isFunction(n))return n.call(this,i,r);if(re.isRegExp(n))return n.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,n){if(e=Cc(e),e){const r=re.findKey(this,e);return!!(r&&this[r]!==void 0&&(!n||Wb(this,this[r],r,n)))}return!1}delete(e,n){const r=this;let i=!1;function s(a){if(a=Cc(a),a){const l=re.findKey(r,a);l&&(!n||Wb(r,r[l],l,n))&&(delete r[l],i=!0)}}return re.isArray(e)?e.forEach(s):s(e),i}clear(e){const n=Object.keys(this);let r=n.length,i=!1;for(;r--;){const s=n[r];(!e||Wb(this,this[s],s,e,!0))&&(delete this[s],i=!0)}return i}normalize(e){const n=this,r={};return re.forEach(this,(i,s)=>{const a=re.findKey(r,s);if(a){n[a]=Wp(i),delete n[s];return}const l=e?XJ(s):String(s).trim();l!==s&&delete n[s],n[l]=Wp(i),r[l]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const n=Object.create(null);return re.forEach(this,(r,i)=>{r!=null&&r!==!1&&(n[i]=e&&re.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,n])=>e+": "+n).join(`
296
296
  `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...n){const r=new this(e);return n.forEach(i=>r.set(i)),r}static accessor(e){const r=(this[kk]=this[kk]={accessors:{}}).accessors,i=this.prototype;function s(a){const l=Cc(a);r[l]||(YJ(i,a),r[l]=!0)}return re.isArray(e)?e.forEach(s):s(e),this}};ur.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),re.reduceDescriptors(ur.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(r){this[n]=r}}}),re.freezeMethods(ur);function jb(t,e){const n=this||xc,r=e||n,i=ur.from(r.headers);let s=r.data;return re.forEach(t,function(l){s=l.call(n,s,i.normalize(),e?e.status:void 0)}),i.normalize(),s}function Sk(t){return!!(t&&t.__CANCEL__)}function Il(t,e,n){rt.call(this,t??"canceled",rt.ERR_CANCELED,e,n),this.name="CanceledError"}re.inherits(Il,rt,{__CANCEL__:!0});function _k(t,e,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?t(n):e(new rt("Request failed with status code "+n.status,[rt.ERR_BAD_REQUEST,rt.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function JJ(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function ZJ(t,e){t=t||10;const n=new Array(t),r=new Array(t);let i=0,s=0,a;return e=e!==void 0?e:1e3,function(u){const c=Date.now(),f=r[s];a||(a=c),n[i]=u,r[i]=c;let p=s,m=0;for(;p!==i;)m+=n[p++],p=p%t;if(i=(i+1)%t,i===s&&(s=(s+1)%t),c-a<e)return;const g=f&&c-f;return g?Math.round(m*1e3/g):void 0}}function QJ(t,e){let n=0,r=1e3/e,i,s;const a=(c,f=Date.now())=>{n=f,i=null,s&&(clearTimeout(s),s=null),t.apply(null,c)};return[(...c)=>{const f=Date.now(),p=f-n;p>=r?a(c,f):(i=c,s||(s=setTimeout(()=>{s=null,a(i)},r-p)))},()=>i&&a(i)]}const jp=(t,e,n=3)=>{let r=0;const i=ZJ(50,250);return QJ(s=>{const a=s.loaded,l=s.lengthComputable?s.total:void 0,u=a-r,c=i(u),f=a<=l;r=a;const p={loaded:a,total:l,progress:l?a/l:void 0,bytes:u,rate:c||void 0,estimated:c&&l&&f?(l-a)/c:void 0,event:s,lengthComputable:l!=null,[e?"download":"upload"]:!0};t(p)},n)},Tk=(t,e)=>{const n=t!=null;return[r=>e[0]({lengthComputable:n,total:t,loaded:r}),e[1]]},Ak=t=>(...e)=>re.asap(()=>t(...e)),NJ=Un.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,Un.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(Un.origin),Un.navigator&&/(msie|trident)/i.test(Un.navigator.userAgent)):()=>!0,eZ=Un.hasStandardBrowserEnv?{write(t,e,n,r,i,s){const a=[t+"="+encodeURIComponent(e)];re.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),re.isString(r)&&a.push("path="+r),re.isString(i)&&a.push("domain="+i),s===!0&&a.push("secure"),document.cookie=a.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function tZ(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function nZ(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function Ok(t,e,n){let r=!tZ(e);return t&&(r||n==!1)?nZ(t,e):e}const Mk=t=>t instanceof ur?{...t}:t;function va(t,e){e=e||{};const n={};function r(c,f,p,m){return re.isPlainObject(c)&&re.isPlainObject(f)?re.merge.call({caseless:m},c,f):re.isPlainObject(f)?re.merge({},f):re.isArray(f)?f.slice():f}function i(c,f,p,m){if(re.isUndefined(f)){if(!re.isUndefined(c))return r(void 0,c,p,m)}else return r(c,f,p,m)}function s(c,f){if(!re.isUndefined(f))return r(void 0,f)}function a(c,f){if(re.isUndefined(f)){if(!re.isUndefined(c))return r(void 0,c)}else return r(void 0,f)}function l(c,f,p){if(p in e)return r(c,f);if(p in t)return r(void 0,c)}const u={url:s,method:s,data:s,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:l,headers:(c,f,p)=>i(Mk(c),Mk(f),p,!0)};return re.forEach(Object.keys(Object.assign({},t,e)),function(f){const p=u[f]||i,m=p(t[f],e[f],f);re.isUndefined(m)&&p!==l||(n[f]=m)}),n}const Bk=t=>{const e=va({},t);let{data:n,withXSRFToken:r,xsrfHeaderName:i,xsrfCookieName:s,headers:a,auth:l}=e;e.headers=a=ur.from(a),e.url=wk(Ok(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),l&&a.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):"")));let u;if(re.isFormData(n)){if(Un.hasStandardBrowserEnv||Un.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if((u=a.getContentType())!==!1){const[c,...f]=u?u.split(";").map(p=>p.trim()).filter(Boolean):[];a.setContentType([c||"multipart/form-data",...f].join("; "))}}if(Un.hasStandardBrowserEnv&&(r&&re.isFunction(r)&&(r=r(e)),r||r!==!1&&NJ(e.url))){const c=i&&s&&eZ.read(s);c&&a.set(i,c)}return e},rZ=typeof XMLHttpRequest<"u"&&function(t){return new Promise(function(n,r){const i=Bk(t);let s=i.data;const a=ur.from(i.headers).normalize();let{responseType:l,onUploadProgress:u,onDownloadProgress:c}=i,f,p,m,g,b;function v(){g&&g(),b&&b(),i.cancelToken&&i.cancelToken.unsubscribe(f),i.signal&&i.signal.removeEventListener("abort",f)}let w=new XMLHttpRequest;w.open(i.method.toUpperCase(),i.url,!0),w.timeout=i.timeout;function x(){if(!w)return;const E=ur.from("getAllResponseHeaders"in w&&w.getAllResponseHeaders()),_={data:!l||l==="text"||l==="json"?w.responseText:w.response,status:w.status,statusText:w.statusText,headers:E,config:t,request:w};_k(function(T){n(T),v()},function(T){r(T),v()},_),w=null}"onloadend"in w?w.onloadend=x:w.onreadystatechange=function(){!w||w.readyState!==4||w.status===0&&!(w.responseURL&&w.responseURL.indexOf("file:")===0)||setTimeout(x)},w.onabort=function(){w&&(r(new rt("Request aborted",rt.ECONNABORTED,t,w)),w=null)},w.onerror=function(){r(new rt("Network Error",rt.ERR_NETWORK,t,w)),w=null},w.ontimeout=function(){let C=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const _=i.transitional||Ck;i.timeoutErrorMessage&&(C=i.timeoutErrorMessage),r(new rt(C,_.clarifyTimeoutError?rt.ETIMEDOUT:rt.ECONNABORTED,t,w)),w=null},s===void 0&&a.setContentType(null),"setRequestHeader"in w&&re.forEach(a.toJSON(),function(C,_){w.setRequestHeader(_,C)}),re.isUndefined(i.withCredentials)||(w.withCredentials=!!i.withCredentials),l&&l!=="json"&&(w.responseType=i.responseType),c&&([m,b]=jp(c,!0),w.addEventListener("progress",m)),u&&w.upload&&([p,g]=jp(u),w.upload.addEventListener("progress",p),w.upload.addEventListener("loadend",g)),(i.cancelToken||i.signal)&&(f=E=>{w&&(r(!E||E.type?new Il(null,t,w):E),w.abort(),w=null)},i.cancelToken&&i.cancelToken.subscribe(f),i.signal&&(i.signal.aborted?f():i.signal.addEventListener("abort",f)));const k=JJ(i.url);if(k&&Un.protocols.indexOf(k)===-1){r(new rt("Unsupported protocol "+k+":",rt.ERR_BAD_REQUEST,t));return}w.send(s||null)})},oZ=(t,e)=>{const{length:n}=t=t?t.filter(Boolean):[];if(e||n){let r=new AbortController,i;const s=function(c){if(!i){i=!0,l();const f=c instanceof Error?c:this.reason;r.abort(f instanceof rt?f:new Il(f instanceof Error?f.message:f))}};let a=e&&setTimeout(()=>{a=null,s(new rt(`timeout ${e} of ms exceeded`,rt.ETIMEDOUT))},e);const l=()=>{t&&(a&&clearTimeout(a),a=null,t.forEach(c=>{c.unsubscribe?c.unsubscribe(s):c.removeEventListener("abort",s)}),t=null)};t.forEach(c=>c.addEventListener("abort",s));const{signal:u}=r;return u.unsubscribe=()=>re.asap(l),u}},iZ=function*(t,e){let n=t.byteLength;if(n<e){yield t;return}let r=0,i;for(;r<n;)i=r+e,yield t.slice(r,i),r=i},sZ=async function*(t,e){for await(const n of aZ(t))yield*iZ(n,e)},aZ=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}const e=t.getReader();try{for(;;){const{done:n,value:r}=await e.read();if(n)break;yield r}}finally{await e.cancel()}},Ik=(t,e,n,r)=>{const i=sZ(t,e);let s=0,a,l=u=>{a||(a=!0,r&&r(u))};return new ReadableStream({async pull(u){try{const{done:c,value:f}=await i.next();if(c){l(),u.close();return}let p=f.byteLength;if(n){let m=s+=p;n(m)}u.enqueue(new Uint8Array(f))}catch(c){throw l(c),c}},cancel(u){return l(u),i.return()}},{highWaterMark:2})},qp=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",Rk=qp&&typeof ReadableStream=="function",lZ=qp&&(typeof TextEncoder=="function"?(t=>e=>t.encode(e))(new TextEncoder):async t=>new Uint8Array(await new Response(t).arrayBuffer())),Lk=(t,...e)=>{try{return!!t(...e)}catch{return!1}},uZ=Rk&&Lk(()=>{let t=!1;const e=new Request(Un.origin,{body:new ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e}),Pk=64*1024,qb=Rk&&Lk(()=>re.isReadableStream(new Response("").body)),Kp={stream:qb&&(t=>t.body)};qp&&(t=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!Kp[e]&&(Kp[e]=re.isFunction(t[e])?n=>n[e]():(n,r)=>{throw new rt(`Response type '${e}' is not supported`,rt.ERR_NOT_SUPPORT,r)})})})(new Response);const cZ=async t=>{if(t==null)return 0;if(re.isBlob(t))return t.size;if(re.isSpecCompliantForm(t))return(await new Request(Un.origin,{method:"POST",body:t}).arrayBuffer()).byteLength;if(re.isArrayBufferView(t)||re.isArrayBuffer(t))return t.byteLength;if(re.isURLSearchParams(t)&&(t=t+""),re.isString(t))return(await lZ(t)).byteLength},dZ=async(t,e)=>{const n=re.toFiniteNumber(t.getContentLength());return n??cZ(e)},Kb={http:IJ,xhr:rZ,fetch:qp&&(async t=>{let{url:e,method:n,data:r,signal:i,cancelToken:s,timeout:a,onDownloadProgress:l,onUploadProgress:u,responseType:c,headers:f,withCredentials:p="same-origin",fetchOptions:m}=Bk(t);c=c?(c+"").toLowerCase():"text";let g=oZ([i,s&&s.toAbortSignal()],a),b;const v=g&&g.unsubscribe&&(()=>{g.unsubscribe()});let w;try{if(u&&uZ&&n!=="get"&&n!=="head"&&(w=await dZ(f,r))!==0){let _=new Request(e,{method:"POST",body:r,duplex:"half"}),A;if(re.isFormData(r)&&(A=_.headers.get("content-type"))&&f.setContentType(A),_.body){const[T,L]=Tk(w,jp(Ak(u)));r=Ik(_.body,Pk,T,L)}}re.isString(p)||(p=p?"include":"omit");const x="credentials"in Request.prototype;b=new Request(e,{...m,signal:g,method:n.toUpperCase(),headers:f.normalize().toJSON(),body:r,duplex:"half",credentials:x?p:void 0});let k=await fetch(b);const E=qb&&(c==="stream"||c==="response");if(qb&&(l||E&&v)){const _={};["status","statusText","headers"].forEach(I=>{_[I]=k[I]});const A=re.toFiniteNumber(k.headers.get("content-length")),[T,L]=l&&Tk(A,jp(Ak(l),!0))||[];k=new Response(Ik(k.body,Pk,T,()=>{L&&L(),v&&v()}),_)}c=c||"text";let C=await Kp[re.findKey(Kp,c)||"text"](k,t);return!E&&v&&v(),await new Promise((_,A)=>{_k(_,A,{data:C,headers:ur.from(k.headers),status:k.status,statusText:k.statusText,config:t,request:b})})}catch(x){throw v&&v(),x&&x.name==="TypeError"&&/fetch/i.test(x.message)?Object.assign(new rt("Network Error",rt.ERR_NETWORK,t,b),{cause:x.cause||x}):rt.from(x,x&&x.code,t,b)}})};re.forEach(Kb,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const Dk=t=>`- ${t}`,fZ=t=>re.isFunction(t)||t===null||t===!1,Vk={getAdapter:t=>{t=re.isArray(t)?t:[t];const{length:e}=t;let n,r;const i={};for(let s=0;s<e;s++){n=t[s];let a;if(r=n,!fZ(n)&&(r=Kb[(a=String(n)).toLowerCase()],r===void 0))throw new rt(`Unknown adapter '${a}'`);if(r)break;i[a||"#"+s]=r}if(!r){const s=Object.entries(i).map(([l,u])=>`adapter ${l} `+(u===!1?"is not supported by the environment":"is not available in the build"));let a=e?s.length>1?`since :
@@ -299,7 +299,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`),oe=P,G=q),J===void 0&&
299
299
  `+s):r.stack=s}catch{}}throw r}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=va(this.defaults,n);const{transitional:r,paramsSerializer:i,headers:s}=n;r!==void 0&&Xp.assertOptions(r,{silentJSONParsing:qo.transitional(qo.boolean),forcedJSONParsing:qo.transitional(qo.boolean),clarifyTimeoutError:qo.transitional(qo.boolean)},!1),i!=null&&(re.isFunction(i)?n.paramsSerializer={serialize:i}:Xp.assertOptions(i,{encode:qo.function,serialize:qo.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Xp.assertOptions(n,{baseUrl:qo.spelling("baseURL"),withXsrfToken:qo.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let a=s&&re.merge(s.common,s[n.method]);s&&re.forEach(["delete","get","head","post","put","patch","common"],b=>{delete s[b]}),n.headers=ur.concat(a,s);const l=[];let u=!0;this.interceptors.request.forEach(function(v){typeof v.runWhen=="function"&&v.runWhen(n)===!1||(u=u&&v.synchronous,l.unshift(v.fulfilled,v.rejected))});const c=[];this.interceptors.response.forEach(function(v){c.push(v.fulfilled,v.rejected)});let f,p=0,m;if(!u){const b=[Fk.bind(this),void 0];for(b.unshift.apply(b,l),b.push.apply(b,c),m=b.length,f=Promise.resolve(n);p<m;)f=f.then(b[p++],b[p++]);return f}m=l.length;let g=n;for(p=0;p<m;){const b=l[p++],v=l[p++];try{g=b(g)}catch(w){v.call(this,w);break}}try{f=Fk.call(this,g)}catch(b){return Promise.reject(b)}for(p=0,m=c.length;p<m;)f=f.then(c[p++],c[p++]);return f}getUri(e){e=va(this.defaults,e);const n=Ok(e.baseURL,e.url,e.allowAbsoluteUrls);return wk(n,e.params,e.paramsSerializer)}};re.forEach(["delete","get","head","options"],function(e){ya.prototype[e]=function(n,r){return this.request(va(r||{},{method:e,url:n,data:(r||{}).data}))}}),re.forEach(["post","put","patch"],function(e){function n(r){return function(s,a,l){return this.request(va(l||{},{method:e,headers:r?{"Content-Type":"multipart/form-data"}:{},url:s,data:a}))}}ya.prototype[e]=n(),ya.prototype[e+"Form"]=n(!0)});let hZ=class V_{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(s){n=s});const r=this;this.promise.then(i=>{if(!r._listeners)return;let s=r._listeners.length;for(;s-- >0;)r._listeners[s](i);r._listeners=null}),this.promise.then=i=>{let s;const a=new Promise(l=>{r.subscribe(l),s=l}).then(i);return a.cancel=function(){r.unsubscribe(s)},a},e(function(s,a,l){r.reason||(r.reason=new Il(s,a,l),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const e=new AbortController,n=r=>{e.abort(r)};return this.subscribe(n),e.signal.unsubscribe=()=>this.unsubscribe(n),e.signal}static source(){let e;return{token:new V_(function(i){e=i}),cancel:e}}};function mZ(t){return function(n){return t.apply(null,n)}}function gZ(t){return re.isObject(t)&&t.isAxiosError===!0}const Xb={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Xb).forEach(([t,e])=>{Xb[e]=t});function Hk(t){const e=new ya(t),n=sk(ya.prototype.request,e);return re.extend(n,ya.prototype,e,{allOwnKeys:!0}),re.extend(n,e,null,{allOwnKeys:!0}),n.create=function(i){return Hk(va(t,i))},n}const on=Hk(xc);on.Axios=ya,on.CanceledError=Il,on.CancelToken=hZ,on.isCancel=Sk,on.VERSION=$k,on.toFormData=Up,on.AxiosError=rt,on.Cancel=on.CanceledError,on.all=function(e){return Promise.all(e)},on.spread=mZ,on.isAxiosError=gZ,on.mergeConfig=va,on.AxiosHeaders=ur,on.formToJSON=t=>Ek(re.isHTMLForm(t)?new FormData(t):t),on.getAdapter=Vk.getAdapter,on.HttpStatusCode=Xb,on.default=on;const{Axios:Rae,AxiosError:Lae,CanceledError:Pae,isCancel:Dae,CancelToken:Vae,VERSION:Fae,all:$ae,Cancel:zae,isAxiosError:Hae,spread:Uae,toFormData:Wae,AxiosHeaders:jae,HttpStatusCode:qae,formToJSON:Kae,getAdapter:Gae,mergeConfig:Xae}=on,bZ=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 on.post(this.getApi(),{value:t}),r=this.transfer(n.data);e=(r==null?void 0:r.map(i=>i.errorText))||[],this!=null&&this.setSuggestions&&this.setSuggestions(r)}catch(n){console.error(n)}return e};class Uk{constructor({api:e,limit:n,transfer:r,enabled:i}){Xt(this,"suggestions",[]);Xt(this,"api","");Xt(this,"enabled",!0);Xt(this,"limit");Xt(this,"transfer");this.suggestions=[],this.api=e,this.limit=n,this.transfer=r,this.enabled=i??!0}setSuggestions(e){this.suggestions=e}getSuggestions(e){var n;return Promise.resolve(((n=this.suggestions.find(r=>r.errorText.wrongWord===e))==null?void 0:n.spellData.correctWord)??[])}getApi(){return this.api}normalizeTextForLanguage(e){return e}proofreadText(e){return Promise.resolve(bZ.call(this,e))}toggleIsEnabled(){this.enabled=!this.enabled}setEnabled(e){this.enabled=e}getIsEnabled(){return this.enabled}}const vZ=Object.freeze(Object.defineProperty({__proto__:null,AI:BY,BaseKit:NE,Blockquote:vW,Bold:kC,BulletList:uW,Clear:pg,Code:pH,CodeBlock:MU,Color:o8,Columns:xb,FindAndReplace:UY,FontFamily:mE,FontSize:r8,FormatPainter:vb,Fullscreen:ij,Heading:t8,Highlight:oW,History:zg,HorizontalRule:XW,Image:wb,ImageUpload:QE,ImportWord:LY,Indent:cY,Italic:SC,LineHeight:vE,Link:Vg,MoreMark:sY,OrderedList:pW,Preview:PY,Printer:qY,Proofreader:Uk,SlashCommand:OY,SpellcheckerExtension:ik,Strike:TC,SubAndSuperScript:rY,Table:Mb,TaskList:gW,TextAlign:n8,Underline:_C,Video:YE,VideoUpload:XE},Symbol.toStringTag,{value:"Module"})),yZ='<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 wZ(){const t=window.localStorage.getItem("content"),e=o.ref(t||yZ),n=o.computed(()=>[NE.configure({placeholder:{showOnlyCurrent:!0},characterCount:{limit:5e4},excludes:{}}),zg,xb,vb,pg,Vg,wb,Mb]),r=mt.useEventBus(lr.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 xZ(){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 wa(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}}const CZ={class:"flex items-center h-[32px] hover:bg-ed-muted rounded-md"},EZ={class:"text-sm flex items-center justify-center"},kZ={width:"18px",height:"18px",viewBox:"0 0 256 256",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},SZ={id:"icon/填充色",stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},_Z={id:"icon/背景颜色"},TZ=["fill"],Wk=o.defineComponent({__name:"HighlightActionButton",props:{editor:{},tooltip:{default:void 0},disabled:{type:Boolean,default:!1},action:{type:Function,default:void 0},isActive:{type:Function,default:void 0},tooltipOptions:{default:void 0}},setup(t){const e=t,n=o.ref(void 0),{state:r}=xn();function i(a){var l;(l=e.action)==null||l.call(e,a)}function s(a){var l;(l=e.action)==null||l.call(e,n.value)}return o.watchEffect(()=>{const{color:a}=e.editor.getAttributes("highlight");r.highlight=a}),(a,l)=>(o.openBlock(),o.createElementBlock("div",CZ,[o.createVNode(Ke,{id:"highlight",tooltip:a.tooltip,disabled:a.disabled,action:s,"tooltip-options":a.tooltipOptions},{icon:o.withCtx(()=>[o.createElementVNode("span",EZ,[(o.openBlock(),o.createElementBlock("svg",kZ,[o.createElementVNode("g",SZ,[o.createElementVNode("g",_Z,[l[1]||(l[1]=o.createElementVNode("g",{id:"编组",fill:"currentColor"},[o.createElementVNode("g",{id:"矩形",transform:"translate(119.502295, 137.878331) rotate(-135.000000) translate(-119.502295, -137.878331) translate(48.002295, 31.757731)"},[o.createElementVNode("path",{d:"M100.946943,60.8084699 L43.7469427,60.8084699 C37.2852111,60.8084699 32.0469427,66.0467383 32.0469427,72.5084699 L32.0469427,118.70847 C32.0469427,125.170201 37.2852111,130.40847 43.7469427,130.40847 L100.946943,130.40847 C107.408674,130.40847 112.646943,125.170201 112.646943,118.70847 L112.646943,72.5084699 C112.646943,66.0467383 107.408674,60.8084699 100.946943,60.8084699 Z M93.646,79.808 L93.646,111.408 L51.046,111.408 L51.046,79.808 L93.646,79.808 Z","fill-rule":"nonzero"}),o.createElementVNode("path",{d:"M87.9366521,16.90916 L87.9194966,68.2000001 C87.9183543,69.4147389 86.9334998,70.399264 85.7187607,70.4 L56.9423078,70.4 C55.7272813,70.4 54.7423078,69.4150264 54.7423078,68.2 L54.7423078,39.4621057 C54.7423078,37.2523513 55.5736632,35.1234748 57.0711706,33.4985176 L76.4832996,12.4342613 C78.9534987,9.75382857 83.1289108,9.5834005 85.8093436,12.0535996 C87.1658473,13.303709 87.9372691,15.0644715 87.9366521,16.90916 Z","fill-rule":"evenodd"}),o.createElementVNode("path",{d:"M131.3,111.241199 L11.7,111.241199 C5.23826843,111.241199 0,116.479467 0,122.941199 L0,200.541199 C0,207.002931 5.23826843,212.241199 11.7,212.241199 L131.3,212.241199 C137.761732,212.241199 143,207.002931 143,200.541199 L143,122.941199 C143,116.479467 137.761732,111.241199 131.3,111.241199 Z M124,130.241 L124,193.241 L19,193.241 L19,130.241 L124,130.241 Z","fill-rule":"nonzero"})])],-1)),o.createElementVNode("path",{id:"矩形",d:"M51,218 L205,218 C211.075132,218 216,222.924868 216,229 C216,235.075132 211.075132,240 205,240 L51,240 C44.9248678,240 40,235.075132 40,229 C40,222.924868 44.9248678,218 51,218 Z",fill:n.value||"#FBDE28"},null,8,TZ)])])]))])]),_:1},8,["tooltip","disabled","tooltip-options"]),o.createVNode(gC,{modelValue:n.value,"onUpdate:modelValue":l[0]||(l[0]=u=>n.value=u),highlight:"",disabled:a.disabled,onChange:i},{default:o.withCtx(()=>[o.createVNode(o.unref(wn),{variant:"ghost",size:"icon",class:"w-3 h-[32px] rounded-l-none hover:bg-ed-muted-foreground/20",disabled:a.disabled},{default:o.withCtx(()=>[o.createVNode(o.unref(Lt),{class:"w-3 h-3 text-zinc-500",name:"MenuDown"})]),_:1},8,["disabled"])]),_:1},8,["modelValue","disabled"])]))}}),AZ={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"},Yp=o.defineComponent({__name:"TableBubbleMenu",props:{editor:{}},setup(t){const e=t,n=()=>document.body,r=({editor:w})=>{var x;return w.isActive("table")&&(((x=w.storage.table)==null?void 0:x.isTableEditorOpen)??!1)},{t:i}=Ot();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(){var w;(w=e.editor)==null||w.chain().focus().splitCell().run()}function g(){e.editor.chain().focus().deleteTable().run()}function b(w){e.editor.chain().focus().setTableCellBackground(w).run()}const v=()=>{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(Tu),{editor:w.editor,"plugin-key":"table","update-delay":0,"should-show":r,"tippy-options":{zIndex:9999,maxWidth:"auto",getReferenceClientRect:v,appendTo:n}},{default:o.withCtx(()=>{var k,E,C,_,A,T,L,I,M;return[o.createElementVNode("div",AZ,[o.createVNode(Ke,{icon:"TablerColumnInsertLeft","icon-class":"w-5 h-5",tooltip:o.unref(i)("editor.table.menu.insertColumnBefore"),action:s,"tooltip-options":{sideOffset:15},disabled:!((k=w.editor)!=null&&k.can().addColumnBefore())},null,8,["tooltip","disabled"]),o.createVNode(Ke,{icon:"TablerColumnInsertRight",tooltip:o.unref(i)("editor.table.menu.insertColumnAfter"),"icon-class":"w-5 h-5",action:a,"tooltip-options":{sideOffset:15},disabled:!((E=w.editor)!=null&&E.can().addColumnAfter())},null,8,["tooltip","disabled"]),o.createVNode(Ke,{icon:"TablerColumnRemove",action:l,"icon-class":"w-5 h-5",tooltip:o.unref(i)("editor.table.menu.deleteColumn"),"tooltip-options":{sideOffset:15},disabled:!((C=w.editor)!=null&&C.can().deleteColumn())},null,8,["tooltip","disabled"]),o.createVNode(o.unref(di),{orientation:"vertical",class:"mx-1 me-2 h-[16px]"}),o.createVNode(Ke,{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)!=null&&_.can().addRowBefore())},null,8,["tooltip","disabled"]),o.createVNode(Ke,{icon:"TablerRowInsertBottom",action:c,"icon-class":"w-5 h-5",tooltip:o.unref(i)("editor.table.menu.insertRowBelow"),"tooltip-options":{sideOffset:15},disabled:!((A=w.editor)!=null&&A.can().addRowAfter())},null,8,["tooltip","disabled"]),o.createVNode(Ke,{icon:"TablerRowRemove",action:f,"icon-class":"w-5 h-5",tooltip:o.unref(i)("editor.table.menu.deleteRow"),"tooltip-options":{sideOffset:15},disabled:!((T=w.editor)!=null&&T.can().deleteRow())},null,8,["tooltip","disabled"]),o.createVNode(o.unref(di),{orientation:"vertical",class:"mx-1 me-2 h-[16px]"}),o.createVNode(Ke,{icon:"TableCellsMerge",action:p,"icon-class":"w-5 h-5",tooltip:o.unref(i)("editor.table.menu.mergeCells"),"tooltip-options":{sideOffset:15},disabled:!((L=w.editor)!=null&&L.can().mergeCells())},null,8,["tooltip","disabled"]),o.createVNode(Ke,{icon:"TableCellsSplit",action:m,"icon-class":"w-5 h-5",tooltip:o.unref(i)("editor.table.menu.splitCells"),"tooltip-options":{sideOffset:15},disabled:!((I=w.editor)!=null&&I.can().splitCell())},null,8,["tooltip","disabled"]),o.createVNode(o.unref(di),{orientation:"vertical",class:"mx-1 me-2 h-[16px]"}),o.createVNode(Wk,{editor:w.editor,tooltip:o.unref(i)("editor.table.menu.setCellsBgColor"),action:b,"tooltip-options":{sideOffset:15}},null,8,["editor","tooltip"]),o.createVNode(Ke,{icon:"Trash2",tooltip:o.unref(i)("editor.table.menu.deleteTable"),"icon-class":"w-5 h-5",action:g,"tooltip-options":{sideOffset:15},disabled:!((M=w.editor)!=null&&M.can().deleteTable())},null,8,["tooltip","disabled"])])]}),_:1},8,["editor","tippy-options"]))}}),OZ={class:"p-2 bg-white border rounded-lg shadow-sm dark:bg-black border-neutral-200 dark:border-neutral-800"},MZ={class:"flex items-center gap-1"},Jp=o.defineComponent({__name:"ColumnsBubbleMenu",props:{editor:{},disabled:{type:Boolean,default:!1}},setup(t){const e=t,n=({editor:l})=>t0(l.view.state,"columns"),r=()=>{const l=mC(e.editor,"columns");return(l==null?void 0:l.getBoundingClientRect())||new DOMRect(-1e3,-1e3,0,0)},i=()=>{e.editor.chain().focus().setLayout(pa.SidebarLeft).run()},s=()=>{e.editor.chain().focus().setLayout(pa.SidebarRight).run()},a=()=>{e.editor.chain().focus().setLayout(pa.TwoColumn).run()};return(l,u)=>(o.openBlock(),o.createBlock(o.unref(Tu),{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(MB)],sticky:"popper"}},{default:o.withCtx(()=>[o.createElementVNode("div",OZ,[o.createElementVNode("div",MZ,[o.createVNode(Ke,{id:"panel-left",title:"ok",icon:"PanelLeft",tooltip:"tooltip",action:i,"is-active":()=>l.editor.isActive("columns",{layout:o.unref(pa).SidebarLeft}),"tooltip-options":{sideOffset:15}},null,8,["is-active"]),o.createVNode(Ke,{id:"columns",title:"ok",icon:"Columns",tooltip:"tooltip",action:a,"is-active":()=>l.editor.isActive("columns",{layout:o.unref(pa).TwoColumn}),"tooltip-options":{sideOffset:15}},null,8,["is-active"]),o.createVNode(Ke,{id:"panel-right",title:"ok",icon:"PanelRight",tooltip:"tooltip",action:s,"is-active":()=>l.editor.isActive("columns",{layout:o.unref(pa).SidebarRight}),"tooltip-options":{sideOffset:15}},null,8,["is-active"])])])]),_:1},8,["editor","tippy-options"]))}}),BZ={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"},IZ=["href"],RZ={class:"flex flex-nowrap"},LZ=o.defineComponent({__name:"LinkViewBlock",props:{editor:{},link:{default:void 0}},emits:["clear","edit"],setup(t,{emit:e}){const{t:n}=Ot(),r=e;function i(){r("clear")}function s(){r("edit")}return(a,l)=>(o.openBlock(),o.createElementBlock("div",BZ,[o.createElementVNode("a",{href:a.link,target:"_blank",rel:"noopener noreferrer",class:"text-sm underline break-all"},o.toDisplayString(o.unref(tt.truncate)(a.link,{length:50,omission:"…"})),9,IZ),a.link?(o.openBlock(),o.createBlock(o.unref(di),{key:0,orientation:"vertical",class:"h-4"})):o.createCommentVNode("",!0),o.createElementVNode("div",RZ,[o.createVNode(Ke,{icon:"Pencil",tooltip:o.unref(n)("editor.link.edit.tooltip"),action:s,"tooltip-options":{sideOffset:15}},null,8,["tooltip"]),o.createVNode(Ke,{icon:"Unlink",tooltip:o.unref(n)("editor.link.unlink.tooltip"),action:i,"tooltip-options":{sideOffset:15}},null,8,["tooltip"])])]))}}),Zp=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(Tu),{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(na),{open:n.value,"onUpdate:open":u[1]||(u[1]=c=>n.value=c)},{default:o.withCtx(()=>[o.createVNode(o.unref(fP),null,{default:o.withCtx(()=>[n.value?o.createCommentVNode("",!0):(o.openBlock(),o.createBlock(LZ,{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(ra),{class:"p-0 border-0 w-fit shadow-none",align:"start",side:"bottom"},{default:o.withCtx(()=>[o.createVNode(T8,{class:"p-4",editor:l.editor,onOnSetLink:s},null,8,["editor"])]),_:1})]),_:1},8,["open"])]),_:1},8,["editor","tippy-options"])),[[o.vShow,i.value]])}}),Yb=o.defineComponent({__name:"Badge",props:{variant:{},class:{}},setup(t){const e=t;return(n,r)=>(o.openBlock(),o.createElementBlock("div",{class:o.normalizeClass(o.unref(ke)(o.unref(PZ)({variant:e.variant}),e.class))},[o.renderSlot(n.$slots,"default")],2))}}),PZ=W1("inline-flex items-center rounded-full border px-2.5 py-0.5 font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-ed-primary text-ed-primary-foreground hover:bg-ed-primary/80",secondary:"border-transparent bg-ed-secondary text-ed-secondary-foreground hover:bg-ed-secondary/80",destructive:"border-transparent bg-ed-destructive text-ed-destructive-foreground hover:bg-ed-destructive/80",outline:"text-ed-foreground"}},defaultVariants:{variant:"default"}}),jk=(t,e,n,r,i)=>{const s=o.ref(0),a=mt.useEventBus(lr.RENDER_SUPER_TEXT),l=_=>{if(!e.value||!t)return;const A=e.value.index,T=e.value.id,{state:L}=t,{tr:I}=L;let M=!1;L.doc.descendants((j,D)=>{var Q,te;if(((Q=j.attrs)==null?void 0:Q[Ze.ID])===T){(te=j.attrs[Ze.TEXT])!=null&&te.trim();const H=_.trim();if(Mp(H))return I.delete(D,D+1),M=!0,!1;const{[Ze.ELEMENT_ID]:F,...P}=j.attrs;return I.setNodeMarkup(D,void 0,{...P,[Ze.TEXT]:H}),M=!0,!1}return!0}),M&&t&&t.view.dispatch(I),A!==-1&&(n.value[A].text=_,n.value[A].textOriginal=_)},u=o.ref(new Map),c=()=>{if(!(t!=null&&t.view.dom))return[];const _=[],A=t==null?void 0:t.view.dom.querySelectorAll("[node-id]"),T=new Map;return u.value.clear(),A.forEach(L=>{const I=L.getBoundingClientRect().top;T.set(I,L),u.value.set(L.getAttribute("node-id")||"unknown",0)}),_.push(...T.values()),_},f=_=>{const A=_.closest(`#${r}`);if(!A)return;const T=A.getBoundingClientRect().top,L=A==null?void 0:A.scrollTop;return _.getBoundingClientRect().top-(T-L)},p=(_,A)=>{const T=n.value.findIndex(L=>L.id===_);T>-1&&(n.value[T].status=A)},m=_=>_.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 _=i.value,A=new Set(n.value.map(I=>I.id)),T=_.map(I=>({isHidden:I.classList.contains("hidden"),isTruncated:I.classList.contains("super-text-truncate")}));_.forEach(I=>{I.classList.remove("hidden"),I.classList.remove("super-text-truncate")});for(const I of u.value.keys())A.has(I)||u.value.delete(I);_.forEach(I=>{const M=I.getAttribute("book-mark-id");if(!M)return;const j=I.offsetTop+I.offsetHeight,D=u.value.get(M)||0;u.value.set(M,Math.max(j,D))}),_.forEach((I,M)=>{T[M].isHidden&&I.classList.add("hidden"),T[M].isTruncated&&I.classList.add("super-text-truncate")});let L=0;for(const I of u.value.values())I>L&&(L=I);s.value=L},b=async()=>{await o.nextTick();const A=c().map(T=>{const L=T.getAttribute("node-id"),I=T.getAttribute("book-mark-content"),M=T.getAttribute("page-id"),j=T.getAttribute("page-number"),D=T.getBoundingClientRect(),Q=T.getAttribute("line-id"),te=T.getAttribute("element-id");return{position:D,text:m(I),id:L,pageId:M,pageNumber:j,visiblePosition:f(T),status:0,lineId:Q,elementId:te,textOriginal:m(I)}});n.value=A},v=(_,A)=>{const T=_.bottom<=A.top,L=_.top>=A.bottom;return!(T||L)};async function w(){const _=i.value;if(!_||_.length===0){g();return}_.sort((A,T)=>{const L=Number(A.getAttribute("index")),I=Number(T.getAttribute("index"));return L-I}),_.forEach(A=>A.classList.remove("super-text-truncate")),_.forEach((A,T)=>{const L=A.getBoundingClientRect();_.slice(T+1).forEach(I=>{const M=I.getBoundingClientRect();v(L,M)&&A.classList.add("super-text-truncate")})}),g()}const x=async _=>{await o.nextTick();const A=t==null?void 0:t.view.dom.querySelector(`[node-id='${_.dataId}']`),T=i.value.find(M=>{const j=M.getBoundingClientRect().top,D=A==null?void 0:A.getBoundingClientRect().top;if(D==null)return!1;const Q=D-j;return Math.abs(Q-9)<=2});if(!T)return;const L=Number(T.getAttribute("index"));if(!_.text){T.querySelector(".super-text-lines").innerHTML=n.value[L].textOriginal,i.value.forEach(M=>M.classList.remove("hidden")),w();return}T.querySelector(".super-text-lines").innerHTML=m(_.text),T.classList.remove("super-text-truncate");const I=T.getBoundingClientRect();i.value.forEach((M,j)=>{if(j!==L){const D=M.getBoundingClientRect();v(I,D)&&M.classList.add("hidden")}}),g()},k=_=>{switch(_.action){case"hover":x(_.payload);break;case"status":p(_.payload.id,_.payload.status);break;case"render":b();break;default:console.log("There is no action")}},E=(_,A)=>{const T=_.currentTarget;T.classList.remove("super-text-truncate");const L=T.getBoundingClientRect();i.value.forEach((I,M)=>{if(M!==A){const j=I.getBoundingClientRect();v(L,j)&&I.classList.add("hidden")}}),g()},C=()=>{i.value.forEach(_=>_.classList.remove("hidden")),w()};return o.onBeforeMount(()=>{a.on(k),window.addEventListener("resize",b)}),o.onBeforeUnmount(()=>{a.off(k),window.removeEventListener("resize",b)}),o.watch(()=>n,async()=>{await o.nextTick(),w()},{deep:!0}),{onUpdate:l,hanldeTruncateSuperTexts:w,eventListener:k,handleMouseOver:E,handleMouseLeave:C,wrapperMinHeight:s}},DZ=["index","book-mark-id","line-id","onMouseover"],VZ=["innerHTML"],FZ=Io(o.defineComponent({__name:"SuperTextView",props:{editor:{},superPreviewCustomClass:{},minChars:{},fontSize:{}},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("canEditSuper",o.ref(!0)),{onUpdate:f,handleMouseOver:p,handleMouseLeave:m,wrapperMinHeight:g}=jk(n.editor,l,i,"editor-container",r),b=(E,C)=>{c.value&&(l.value={id:E.id,text:E.text,elementId:E.elementId,index:C},s.value=!0,u&&(a.value=!0))},v=E=>{var C,_;return Hc(E?((C=n.superPreviewCustomClass)==null?void 0:C.completedSuper)??"bg-black":((_=n.superPreviewCustomClass)==null?void 0:_.unproducedSuper)??"bg-red-500")},w=o.computed(()=>n.fontSize??""),{contentInner:x,measuredMinWidth:k}=$d({minChars:n.minChars,fontSize:w});return e({measuredMinWidthComment:k}),(E,C)=>{var A;const _=Lt;return o.openBlock(),o.createElementBlock("div",{id:"super-text-view-wrapper",ref_key:"contentInner",ref:x,style:o.normalizeStyle({width:`${Number(o.unref(k))+25}px`,minHeight:`${o.unref(g)}px`}),class:o.normalizeClass(o.unref(ke)("relative border border-ed-gray-400 dark:bg-black rounded-[3px] mr-2.5",((A=E.superPreviewCustomClass)==null?void 0:A.overall)??"bg-ed-gray-50"))},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(i.value,(T,L)=>{var I,M,j;return o.openBlock(),o.createElementBlock("div",{key:T.id,ref_for:!0,ref_key:"superTextRefs",ref:r,index:L,"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||((I=T.position)==null?void 0:I.top)}px`}),onMouseover:D=>o.unref(p)(D,L),onMouseleave:C[0]||(C[0]=(...D)=>o.unref(m)&&o.unref(m)(...D))},[o.createVNode(o.unref(Yb),{role:"text",variant:"outline",class:o.normalizeClass(o.unref(ke)("wrap-anywhere whitespace-normal w-full !font-normal px-1 pt-0 m-0 !leading-tight rounded-sm text-white border-transparent cursor-pointer",T.elementId?((M=E.superPreviewCustomClass)==null?void 0:M.completedSuper)??"bg-black":((j=E.superPreviewCustomClass)==null?void 0:j.unproducedSuper)??"bg-red-500",{"cursor-default":!o.unref(c)})),onDblclick:D=>b(T,L)},{default:o.withCtx(()=>[o.createElementVNode("div",{class:"super-text-lines",innerHTML:T.text},null,8,VZ),o.createVNode(_,{name:"triangle",class:o.normalizeClass(["absolute top-[0.4em] rotate-90 w-3 h-3 right-0",v(T.elementId)])},null,8,["class"])]),_:2},1032,["class","onDblclick"])],46,DZ)}),128)),!o.unref(u)&&l.value?(o.openBlock(),o.createBlock(mc,{key:0,open:s.value,editor:n.editor,"super-text-init":l.value.text,"super-text-element-id":l.value.elementId,onClose:C[1]||(C[1]=T=>s.value=!1),onSave:o.unref(f)},null,8,["open","editor","super-text-init","super-text-element-id","onSave"])):o.createCommentVNode("",!0)],6)}}}),[["__scopeId","data-v-18e941f3"]]),$Z=["index","book-mark-id","line-id","onMouseover"],zZ=["innerHTML"],HZ=Io(o.defineComponent({__name:"SuperTextViewComment",props:{editor:{},disableSuperInput:{type:Boolean},superPreviewCustomClass:{}},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("isEditable",o.ref(!0)),{onUpdate:c,handleMouseOver:f,handleMouseLeave:p,wrapperMinHeight:m}=jk(e.editor,a,r,"editor-container-comment",n),g=(w,x)=>{u.value&&(a.value={id:w.id,text:w.text,elementId:w.elementId,index:x},e.disableSuperInput||(i.value=!0),l&&(s.value=!0))},b=w=>{var x,k;return Hc(w?((x=e.superPreviewCustomClass)==null?void 0:x.completedSuper)??"bg-black":((k=e.superPreviewCustomClass)==null?void 0:k.unproducedSuper)??"bg-red-500")},v=o.inject("measuredMinWidthComment",0);return(w,x)=>{var E;const k=Lt;return o.openBlock(),o.createElementBlock("div",{id:"super-text-view-wrapper",style:o.normalizeStyle({width:`${Number(o.unref(v))+25}px`,minHeight:`${o.unref(m)}px`}),class:o.normalizeClass(o.unref(ke)("relative border border-ed-gray-400 dark:bg-black rounded-[3px] mr-2.5",((E=w.superPreviewCustomClass)==null?void 0:E.overall)??"bg-ed-gray-50"))},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(r.value,(C,_)=>{var A,T,L;return o.openBlock(),o.createElementBlock("div",{key:C.id,ref_for:!0,ref_key:"superTextRefs",ref:n,index:_,"book-mark-id":C.id,"line-id":C.lineId,class:o.normalizeClass(o.unref(ke)("super-text-view","absolute w-full px-2 translate-y-[-10px] group",{})),style:o.normalizeStyle({top:`${C.visiblePosition||((A=C.position)==null?void 0:A.top)}px`}),onMouseover:I=>o.unref(f)(I,_),onMouseleave:x[0]||(x[0]=(...I)=>o.unref(p)&&o.unref(p)(...I))},[o.createVNode(o.unref(Yb),{role:"text",variant:"outline",class:o.normalizeClass(o.unref(ke)("wrap-anywhere whitespace-normal w-full !font-normal px-1 pt-0 m-0 !leading-tight rounded-sm text-white border-transparent cursor-pointer",C.elementId?((T=w.superPreviewCustomClass)==null?void 0:T.completedSuper)??"bg-black":((L=w.superPreviewCustomClass)==null?void 0:L.unproducedSuper)??"bg-red-500",{"cursor-default":!o.unref(u)})),onDblclick:I=>g(C,_)},{default:o.withCtx(()=>[o.createElementVNode("div",{class:"super-text-lines",innerHTML:C.text},null,8,zZ),o.createVNode(k,{name:"triangle",class:o.normalizeClass(["absolute top-[0.4em] rotate-90 w-3 h-3 right-0",b(C.elementId)])},null,8,["class"])]),_:2},1032,["class","onDblclick"])],46,$Z)}),128)),!o.unref(l)&&a.value&&!w.disableSuperInput?(o.openBlock(),o.createBlock(mc,{key:0,open:i.value,editor:e.editor,"super-text-init":a.value.text,"super-text-element-id":a.value.elementId,onClose:x[1]||(x[1]=C=>i.value=!1),onSave:o.unref(c)},null,8,["open","editor","super-text-init","super-text-element-id","onSave"])):o.createCommentVNode("",!0)],6)}}}),[["__scopeId","data-v-9e49a79c"]]),qk=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,`
300
300
  `).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(`<p>${l}</p>`):i.push(l)}let s=i.join("");return s=s.replace(/<p\b[^>]*>/gi,"<p>"),s},UZ=xn(),Qp=t=>{const e=o.computed(()=>UZ.state.spellCheck);o.watch(()=>e.value,n=>{t.view.dispatch(t.state.tr.setMeta(Hn.IS_ACTIVE_SPELLCHECK,n))},{immediate:!0})},WZ={id:"editor-container-comment",class:"flex flex-col"},jZ={class:"flex flex-1"},qZ={id:"editor-panel",class:"flex-1 p-2.5 border border-ed-gray-400 rounded-[3px] focus-within:border-ed-input-focus"},KZ=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:{},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}},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=mt.useEventBus(lr.RENDER_SUPER_TEXT),a=o.useAttrs(),l=xn(),{isReady:u,editor:c,updateEditorState:f,superTextStore:p,checkSpellStore:m,setEditorContextMenuRef:g}=l,b=o.inject("isEditable",o.ref(!0)),v=new Oo({enablePasteRules:!1,enableInputRules:!1,content:pn(r.modelValue,r.disabled),editorProps:{attributes:{id:ir.COMMENT,[ir.DISABLE_SUPER_INPUT]:`${r.disableSuperInput}`},handleKeyDown:tt.throttle((C,_)=>_.key==="Enter"&&a.enter&&!_.shiftKey?(i("enter"),!0):!1,Bo),transformPastedHTML:C=>qk(C),handlePaste:(C,_)=>{const A=_.clipboardData;if(!A)return!1;const T=r.mode,L=A.getData("text/plain")||"",I=Array.from(A.items).some(M=>M.type.startsWith("image/"));return(T===Be.STRAIGHT||T===Be.REPORT)&&I?(_.preventDefault(),!0):T===Be.PLAIN_TEXT?(_.preventDefault(),C.dispatch(C.state.tr.insertText(L,C.state.selection.from)),!0):!1},clipboardTextParser:(C,_)=>{const A=C.split(/(?:\r\n?|\n)/),T=[];A.forEach(I=>{let M={type:"paragraph"};I.length>0&&(M.content=[{type:"text",text:I}]);let j=to.fromJSON(_.doc.type.schema,M);T.push(j)});const L=fe.fromArray(T);return Ee.maxOpen(L)}},onCreate:({editor:C})=>{f(C)},onUpdate:tt.throttle(({editor:C})=>{u.value=!0;const _=x(C,r.output);i("update:modelValue",_),i("change",{editor:C,output:_}),f(C),w()},Bo),extensions:r.extensions,editable:b.value,onFocus:()=>{g(k.value)}});o.computed(()=>r.mode===Be.EDITOR);async function w(){await o.nextTick(),s.emit({action:"render"})}function x(C,_){if(!C)return"";if(C.isEmpty)return _==="json"?{}:"";switch(_){case"html":return C.getHTML();case"json":return C.getJSON();case"text":return C.getText();default:return""}}o.watch(()=>r.disableSuperInput,()=>{const C=document.getElementById(ir.COMMENT);C==null||C.setAttribute(ir.DISABLE_SUPER_INPUT,`${r.disableSuperInput}`)}),o.watch(()=>m.languages,()=>{v.commands.checkSpelling()}),o.watch(()=>r.modelValue,C=>{if(!v||tt.isEqual(x(v,r.output),C))return;const{from:_,to:A}=v.state.selection;v.commands.setTextSelection({from:_,to:A}),v.commands.setContent(pn(C,r.disabled),!1),w()},{deep:!0}),o.watch(()=>b.value,C=>{var _;v==null||v.setEditable(C),(_=v==null?void 0:v.commands)!=null&&_.setIsEnableSuggestion&&v.commands.setIsEnableSuggestion(C)},{immediate:!0}),o.watch(()=>c.value,()=>{c.value&&c.value.on("selectionUpdate",({editor:C})=>{i("changed:selection",{editor:C})})}),o.onUnmounted(()=>v==null?void 0:v.destroy()),Qu(Au.SAVE,()=>{localStorage.setItem("comment",x(v,"html"))});const k=o.ref(null);function E(C){C===Be.REPORT&&g(k.value)}return o.onMounted(()=>{E(r.mode)}),o.watch(()=>r.mode,C=>{E(C)}),Qp(v),e({editor:v}),(C,_)=>(o.openBlock(),o.createElementBlock("div",WZ,[o.createElementVNode("div",jZ,[o.withDirectives(o.createVNode(HZ,{"disable-super-input":C.disableSuperInput,editor:o.unref(v),"super-preview-custom-class":C.superPreviewCustomClass},null,8,["disable-super-input","editor","super-preview-custom-class"]),[[o.vShow,C.isOpenSuperView]]),o.createElementVNode("div",qZ,[o.createVNode(bb,{ref_key:"selectContextMenuRef",ref:k,"disable-super-input":C.disableSuperInput,editor:o.unref(v),mode:C.mode,"super-text-store":o.unref(p)},{default:o.withCtx(()=>[o.createVNode(o.unref(Xn),{editor:o.unref(v),spellcheck:"true",class:"h-full break-all"},null,8,["editor"])]),_:1},8,["disable-super-input","editor","mode","super-text-store"])])])]))}});function GZ(t,e,n=!1,r=200){const{height:i}=mt.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===Be.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}}const XZ={class:"flex flex-1"},Np=o.defineComponent({__name:"CoreEditorV2",props:{isMobile:{type:Boolean},superTextArea:{default:{view:!0,button:!0}},mode:{},modelValue:{default:""},comment:{default:""},commentCuesheet:{default:""},hideComment:{type:Boolean,default:!1},disableSuperInput:{type:Boolean,default:!1},fontSizeDefault:{default:"14px"},fontFamilyDefault:{default:""},isOpenSuperView:{type:Boolean},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:{default:null},fieldNameCommentCuesheet:{default:null},fieldNameContent:{default:null},fieldNameSuper:{},isScreenSplit:{},isShowLineNumber:{type:Boolean},hideMenubar:{type:Boolean},disableBubble:{type:Boolean,default:!1},hideBubble:{type:Boolean,default:!1},maxWidth:{default:void 0},minHeight:{default:200},maxHeight:{default:void 0},height:{default:void 0},extensions:{default:()=>[]},editorClass:{default:void 0},contentClass:{default:void 0},isCompare:{type:Boolean},autoHeight:{type:Boolean,default:!1},textAlert:{},customClassToolbar:{default:""},readonly:{type:Boolean,default:!1},canEditSuperReadOnly:{type:Boolean,default:!1},autoFocus:{type:Boolean},superPreviewCustomClass:{default:()=>({overall:"bg-ed-gray-50",unproducedSuper:"bg-red-500",completedSuper:"bg-black"})},minChar:{default:()=>({superPreview:29,content:26})},isAccordion:{type:Boolean},contentAutoCopied:{},isEditorView:{type:Boolean},isEditorViewSplitContent:{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=mt.useEventBus(lr.RENDER_SUPER_TEXT),a=mt.useEventBus(lr.INCREASE_DECREASE_FONTSIZE),l=o.useAttrs(),u=xn(),{state:c,isFullscreen:f,isReady:p,editor:m,updateEditorState:g,superTextStore:b,checkSpellStore:v,setEditorContextMenuRef:w}=u,x=o.computed(()=>!(r.disabled||r.readonly));o.provide("isEditable",x);const k=o.computed(()=>x.value?!0:r.canEditSuperReadOnly);o.provide("canEditSuper",k);const E=o.computed(()=>[...c.extensions,...tt.differenceBy(r.extensions,c.extensions,"name")].map((ve,Re)=>{var We;return((We=ve.configure)==null?void 0:We.call(ve,{sort:Re}))||ve})),C=o.computed(()=>r.mode===Be.EDITOR),_=o.ref(r.fontSizeDefault),A=o.ref(r.fontFamilyDefault);o.provide("fontSize",_),o.provide("fontFamily",A);const T=o.computed(()=>{const N={height:"auto",minHeight:r.minHeight?an(r.minHeight):void 0,maxHeight:r.maxHeight?an(r.maxHeight):void 0,overflowY:"auto"};return C.value&&!r.autoHeight?{}:C.value&&r.autoHeight?N:!C.value&&r.autoHeight?{...N,fontFamily:A.value,fontSize:_.value}:{fontFamily:A.value,fontSize:_.value}});o.watch(()=>[T.value,r.disabled],async()=>{P()}),o.onMounted(()=>{P()});const L=N=>{const ve=parseInt(_.value||"16px"),Re=N?ve+2:ve-2;_.value=Re+"px"};o.onBeforeMount(()=>{r.disabled||a.on(L)}),o.onBeforeUnmount(()=>{r.disabled||a.off(L)});const I=o.computed(()=>({...o.unref(f)?{height:"100%"}:{minHeight:r.minHeight?an(r.minHeight):void 0,maxHeight:r.maxHeight?an(r.maxHeight):void 0,height:r.height?an(r.height):void 0},maxWidth:an(r.maxWidth),width:r.maxWidth?"100%":void 0,margin:r.maxWidth?"0 auto":void 0})),M=new Oo({enablePasteRules:!1,enableInputRules:!1,content:pn(r.modelValue,r.disabled,r.mode),editorProps:{handleKeyDown:tt.throttle((N,ve)=>ve.key==="Enter"&&l.enter&&!ve.shiftKey?(i("enter"),!0):!1,Bo),transformPastedHTML:N=>qk(N),handlePaste:(N,ve)=>{const Re=ve.clipboardData;if(!Re)return!1;const We=r.mode,pt=Array.from(Re.items),kt=pt.some(V=>V.type.startsWith("image/")),z=pt.some(V=>V.type.startsWith("video/"));return(We===Be.STRAIGHT||We===Be.REPORT)&&(kt||z)?(ve.preventDefault(),!0):z?(ve.preventDefault(),J(["video"])&&pt.forEach(async V=>{var X;if(!V.type.startsWith("video/"))return;const le=V.getAsFile();if(!le)return;const be=M.extensionManager.extensions.find(W=>W.name==="video"),Le=(X=be==null?void 0:be.options)==null?void 0:X.upload,Qe=Le?await Le(le):URL.createObjectURL(le);M.commands.focus(),M.commands.setVideo({src:Qe})}),!0):!1},clipboardTextParser:(N,ve)=>{const Re=N.split(/(?:\r\n?|\n)/),We=[];Re.forEach(kt=>{let z={type:"paragraph"};kt.length>0&&(z.content=[{type:"text",text:kt}]);let V=to.fromJSON(ve.doc.type.schema,z);We.push(V)});const pt=fe.fromArray(We);return Ee.maxOpen(pt)}},onCreate:({editor:N})=>{g(N)},onUpdate:tt.throttle(({editor:N})=>{p.value=!0;const ve=q(N,r.output);i("update:modelValue",ve),i("change",{editor:N,output:ve}),g(N),P(),Q()},Bo),extensions:tt.uniqBy(tt.reverse(o.unref(E)),"name"),editable:x.value,onFocus:N=>{w(Z.value),i("onFocus",N)},onBlur:N=>i("onBlur",N),parseOptions:{preserveWhitespace:"full"}});o.provide("minCharSuperInput",r.minChar.superPreview);const{contentInner:j,measuredMinWidth:D,measure:Q}=$d({minChars:r.minChar.content,fontSize:_,editor:M}),te=o.ref(null),H=o.computed(()=>{var N;return(N=te.value)==null?void 0:N.measuredMinWidthComment});o.provide("measuredMinWidthComment",H);const F=o.computed(()=>C.value?0:G.value?Number(D==null?void 0:D.value)+Number(H==null?void 0:H.value)+30:Number(D==null?void 0:D.value));async function P(){await o.nextTick(),s.emit({action:"render"})}function q(N,ve){if(!N)return"";if(N.isEmpty)return ve==="json"?{}:"";if(r.mode===Be.PLAIN_TEXT)return N.getText({blockSeparator:`
301
301
  `});switch(ve){case"html":return N.getHTML();case"json":return N.getJSON();case"text":return N.getText({blockSeparator:`
302
- `});default:return""}}function J(N){return N.every(ve=>M==null?void 0:M.extensionManager.extensions.find(Re=>Re.name===ve))}o.watch(()=>v.languages,()=>{M.commands.checkSpelling()}),o.watch(()=>r.modelValue,N=>{if(!M||tt.isEqual(q(M,r.output),N))return;const{from:ve,to:Re}=M.state.selection;M.commands.setTextSelection({from:ve,to:Re}),M.commands.setContent(pn(N,r.disabled,r.mode),!1,{preserveWhitespace:"full"}),P()},{deep:!0}),o.watch(()=>x.value,N=>{var ve;M==null||M.setEditable(N),(ve=M==null?void 0:M.commands)!=null&&ve.setIsEnableSuggestion&&M.commands.setIsEnableSuggestion(N)},{immediate:!0}),o.watch(()=>m.value,()=>{m.value&&m.value.on("selectionUpdate",({editor:N})=>{i("changed:selection",{editor:N})})}),o.onUnmounted(()=>M==null?void 0:M.destroy()),Qu(Au.SAVE,()=>{localStorage.setItem("content",q(M,"html"))});const G=o.computed(()=>{var We;if(!((We=M==null?void 0:M.storage)!=null&&We.superText))return!1;const{enable:N}=M.storage.superText,ve=[Be.EDITOR,Be.PLAIN_TEXT].includes(r.mode),Re=r.disabled;return N&&!ve&&!Re}),oe=o.ref(null),xe=o.computed(()=>r.mode),{commentHeight:Ce,contentHeight:He,minHeight:Oe,minHeightComment:De}=GZ(oe,xe,r.autoHeight,typeof r.minHeight=="string"?parseInt(r.minHeight):r.minHeight),Z=o.ref(null);function ne(N){N===Be.STRAIGHT&&w(Z.value)}o.onMounted(()=>{ne(r.mode)}),o.watch(()=>r.mode,N=>{ne(N)});const ce=o.ref(null),de=()=>{var ve;(ve=ce.value)!=null&&ve.editor.commands.focusInvalidChar()||M.commands.focusInvalidChar()};u.focusFirstInvalidChar.value=de,o.onActivated(()=>{u.focusFirstInvalidChar.value=de});const ge=o.computed(()=>{var ve,Re,We;const N=((ve=r.fieldNameComment)==null?void 0:ve.label)||((Re=r.fieldNameCommentCuesheet)==null?void 0:Re.label)||((We=r.fieldNameContent)==null?void 0:We.label);return r.disabled&&N});return e({editor:M}),(N,ve)=>{var le;const Re=Zp,We=Jp,pt=Yp,kt=Bf,z=f$,V=QB;return o.unref(M)?(o.openBlock(),o.createElementBlock("div",{key:0,id:"vdc-editor",class:o.normalizeClass(["vdc-editor w-full flex flex-col",[N.editorClass,{"outline-ed-primary":o.unref(M).isFocused,"outline-ed-border":!o.unref(M).isFocused}]]),style:o.normalizeStyle(I.value)},[!N.hideBubble&&!N.disabled&&x.value?(o.openBlock(),o.createElementBlock(o.Fragment,{key:0},[J([o.unref(pc)])?(o.openBlock(),o.createBlock(Re,{key:0,editor:o.unref(M)},null,8,["editor"])):o.createCommentVNode("",!0),J([o.unref(fa)])?(o.openBlock(),o.createBlock(We,{key:1,editor:o.unref(M)},null,8,["editor"])):o.createCommentVNode("",!0),J([o.unref(ps)])?(o.openBlock(),o.createBlock(pt,{key:2,editor:o.unref(M)},null,8,["editor"])):o.createCommentVNode("",!0),J([o.unref(hs),o.unref(ms)])?(o.openBlock(),o.createBlock(kt,{key:3,editor:o.unref(M)},null,8,["editor"])):o.createCommentVNode("",!0)],64)):o.createCommentVNode("",!0),N.hideToolbar?o.createCommentVNode("",!0):(o.openBlock(),o.createBlock(z,{key:1,editor:o.unref(M),"editor-comment":(le=ce.value)==null?void 0:le.editor,mode:N.mode,class:"mb-2","custom-class-toolbar":N.customClassToolbar},null,8,["editor","editor-comment","mode","custom-class-toolbar"])),o.createElementVNode("div",{ref_key:"editorWrapRef",ref:oe,class:o.normalizeClass(["space-y-2 flex-1 flex flex-col break-keep",!C.value&&"[&_*]:!font-inherit [&_*]:!text-font-size-inherit",A.value&&!C.value?"[&_*]:!font-inherit":"",_.value&&!C.value?"[&_*]:!text-font-size-inherit":""]),style:o.normalizeStyle(T.value)},[ge.value?(o.openBlock(),o.createBlock(V,{key:0,extensions:N.extensions,mode:N.mode,"hide-comment":N.hideComment,"field-name-comment":N.fieldNameComment,"field-name-comment-cuesheet":N.fieldNameCommentCuesheet,"field-name-content":N.fieldNameContent,comment:N.comment,"comment-cuesheet":N.commentCuesheet,content:N.modelValue,"min-chars":N.minChar.content,"font-size":_.value},null,8,["extensions","mode","hide-comment","field-name-comment","field-name-comment-cuesheet","field-name-content","comment","comment-cuesheet","content","min-chars","font-size"])):(o.openBlock(),o.createElementBlock("div",{key:1,class:"space-y-2 flex-1 flex flex-col",style:o.normalizeStyle({minWidth:`${F.value}px`})},[N.mode===o.unref(Be).REPORT&&!N.hideComment?(o.openBlock(),o.createBlock(KZ,{key:0,ref_key:"editorCommentRef",ref:ce,mode:o.unref(Be).REPORT,extensions:N.extensions,"model-value":r.comment,disabled:r.disabled,"disable-super-input":N.disableSuperInput,"is-open-super-view":G.value,"super-preview-custom-class":N.superPreviewCustomClass,"min-char":N.minChar,"font-size":_.value,style:o.normalizeStyle(r.autoHeight?{height:"auto",minHeight:o.unref(an)(o.unref(De))}:{height:o.unref(an)(o.unref(Ce)),minHeight:o.unref(an)(o.unref(Oe))}),class:"relative overflow-y-auto","onUpdate:modelValue":ve[0]||(ve[0]=be=>i("update:comment",be))},null,8,["mode","extensions","model-value","disabled","disable-super-input","is-open-super-view","super-preview-custom-class","min-char","font-size","style"])):o.createCommentVNode("",!0),o.createElementVNode("div",{id:"editor-container",class:"relative overflow-y-auto flex flex-col",style:o.normalizeStyle(r.autoHeight?{height:"auto",minHeight:o.unref(an)(o.unref(Oe))}:{height:o.unref(an)(o.unref(He))})},[o.createElementVNode("div",XZ,[o.withDirectives(o.createVNode(FZ,{ref_key:"superTextViewRef",ref:te,editor:o.unref(M),"super-preview-custom-class":N.superPreviewCustomClass,"min-chars":N.minChar.superPreview,"font-size":_.value},null,8,["editor","super-preview-custom-class","min-chars","font-size"]),[[o.vShow,G.value]]),o.createElementVNode("div",{id:"editor-panel",ref_key:"contentInner",ref:j,class:"flex-1 p-2.5 border border-ed-gray-400 rounded-[3px] focus-within:border-ed-input-focus"},[o.createVNode(bb,{ref_key:"selectContextMenuRef",ref:Z,editor:o.unref(M),mode:N.mode,"super-text-store":o.unref(b)},{default:o.withCtx(()=>[o.createVNode(o.unref(Xn),{editor:o.unref(M),spellcheck:"true",class:o.normalizeClass(o.unref(ke)("h-full break-all",N.mode===o.unref(Be).PLAIN_TEXT&&"plain-text"))},null,8,["editor","class"])]),_:1},8,["editor","mode","super-text-store"])],512)])],4)],4))],6)],6)):o.createCommentVNode("",!0)}}}),YZ=o.defineComponent({__name:"Switch",props:{defaultChecked:{type:Boolean},checked:{type:Boolean},disabled:{type:Boolean},required:{type:Boolean},name:{},id:{},value:{},asChild:{type:Boolean},as:{},class:{},customClassThumb:{}},emits:["update:checked"],setup(t,{emit:e}){const n=t,r=e,i=o.computed(()=>{const{class:a,customClassThumb:l,...u}=n;return u}),s=It(i,r);return(a,l)=>(o.openBlock(),o.createBlock(o.unref(cD),o.mergeProps(o.unref(s),{class:o.unref(ke)("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ed-ring focus-visible:ring-offset-2 focus-visible:ring-offset-ed-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-ed-primary data-[state=unchecked]:bg-ed-input",n.class)}),{default:o.withCtx(()=>[o.createVNode(o.unref(dD),{class:o.normalizeClass(o.unref(ke)("pointer-events-none block h-4 w-4 rounded-full bg-ed-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0",n.customClassThumb))},null,8,["class"])]),_:1},16,["class"]))}}),JZ={class:"text-red-500 relative -top-1"},Ec=o.defineComponent({__name:"EditorFieldName",props:{fieldName:{},disabled:{type:Boolean,default:!1},isRequired:{type:Boolean,default:!1}},setup(t){return(e,n)=>(o.openBlock(),o.createElementBlock("div",{class:o.normalizeClass(o.unref(ke)("label-large",e.fieldName.customClass))},[o.createElementVNode("span",null,o.toDisplayString(e.fieldName.label),1),o.withDirectives(o.createElementVNode("span",JZ," •",512),[[o.vShow,e.fieldName.isRequired]])],2))}}),eh={__name:"splitpanes",props:{horizontal:{type:Boolean,default:!1},pushOtherPanes:{type:Boolean,default:!0},maximizePanes:{type:Boolean,default:!0},rtl:{type:Boolean,default:!1},firstSplitter:{type:Boolean,default:!1}},emits:["ready","resize","resized","pane-click","pane-maximize","pane-add","pane-remove","splitter-click","splitter-dblclick"],setup(t,{emit:e}){const n=e,r=t,i=o.useSlots(),s=o.ref([]),a=o.computed(()=>s.value.reduce((Z,ne)=>(Z[~~ne.id]=ne)&&Z,{})),l=o.computed(()=>s.value.length),u=o.ref(null),c=o.ref(!1),f=o.ref({mouseDown:!1,dragging:!1,activeSplitter:null,cursorOffset:0}),p=o.ref({splitter:null,timeoutId:null}),m=o.computed(()=>({[`splitpanes splitpanes--${r.horizontal?"horizontal":"vertical"}`]:!0,"splitpanes--dragging":f.value.dragging})),g=()=>{document.addEventListener("mousemove",w,{passive:!1}),document.addEventListener("mouseup",x),"ontouchstart"in window&&(document.addEventListener("touchmove",w,{passive:!1}),document.addEventListener("touchend",x))},b=()=>{document.removeEventListener("mousemove",w,{passive:!1}),document.removeEventListener("mouseup",x),"ontouchstart"in window&&(document.removeEventListener("touchmove",w,{passive:!1}),document.removeEventListener("touchend",x))},v=(Z,ne)=>{const ce=Z.target.closest(".splitpanes__splitter");if(ce){const{left:de,top:ge}=ce.getBoundingClientRect(),{clientX:N,clientY:ve}="ontouchstart"in window&&Z.touches?Z.touches[0]:Z;f.value.cursorOffset=r.horizontal?ve-ge:N-de}g(),f.value.mouseDown=!0,f.value.activeSplitter=ne},w=Z=>{f.value.mouseDown&&(Z.preventDefault(),f.value.dragging=!0,requestAnimationFrame(()=>{T(_(Z)),Oe("resize",{event:Z},!0)}))},x=Z=>{f.value.dragging&&(window.getSelection().removeAllRanges(),Oe("resized",{event:Z},!0)),f.value.mouseDown=!1,f.value.activeSplitter=null,setTimeout(()=>{f.value.dragging=!1,b()},100)},k=(Z,ne)=>{"ontouchstart"in window&&(Z.preventDefault(),p.value.splitter===ne?(clearTimeout(p.value.timeoutId),p.value.timeoutId=null,E(Z,ne),p.value.splitter=null):(p.value.splitter=ne,p.value.timeoutId=setTimeout(()=>p.value.splitter=null,500))),f.value.dragging||Oe("splitter-click",{event:Z,index:ne},!0)},E=(Z,ne)=>{if(Oe("splitter-dblclick",{event:Z,index:ne},!0),r.maximizePanes){let ce=0;s.value=s.value.map((de,ge)=>(de.size=ge===ne?de.max:de.min,ge!==ne&&(ce+=de.min),de)),s.value[ne].size-=ce,Oe("pane-maximize",{event:Z,index:ne,pane:s.value[ne]}),Oe("resized",{event:Z,index:ne},!0)}},C=(Z,ne)=>{Oe("pane-click",{event:Z,index:a.value[ne].index,pane:a.value[ne]})},_=Z=>{const ne=u.value.getBoundingClientRect(),{clientX:ce,clientY:de}="ontouchstart"in window&&Z.touches?Z.touches[0]:Z;return{x:ce-(r.horizontal?0:f.value.cursorOffset)-ne.left,y:de-(r.horizontal?f.value.cursorOffset:0)-ne.top}},A=Z=>{Z=Z[r.horizontal?"y":"x"];const ne=u.value[r.horizontal?"clientHeight":"clientWidth"];return r.rtl&&!r.horizontal&&(Z=ne-Z),Z*100/ne},T=Z=>{const ne=f.value.activeSplitter;let ce={prevPanesSize:I(ne),nextPanesSize:M(ne),prevReachedMinPanes:0,nextReachedMinPanes:0};const de=0+(r.pushOtherPanes?0:ce.prevPanesSize),ge=100-(r.pushOtherPanes?0:ce.nextPanesSize),N=Math.max(Math.min(A(Z),ge),de);let ve=[ne,ne+1],Re=s.value[ve[0]]||null,We=s.value[ve[1]]||null;const pt=Re.max<100&&N>=Re.max+ce.prevPanesSize,kt=We.max<100&&N<=100-(We.max+M(ne+1));if(pt||kt){pt?(Re.size=Re.max,We.size=Math.max(100-Re.max-ce.prevPanesSize-ce.nextPanesSize,0)):(Re.size=Math.max(100-We.max-ce.prevPanesSize-M(ne+1),0),We.size=We.max);return}if(r.pushOtherPanes){const z=L(ce,N);if(!z)return;({sums:ce,panesToResize:ve}=z),Re=s.value[ve[0]]||null,We=s.value[ve[1]]||null}Re!==null&&(Re.size=Math.min(Math.max(N-ce.prevPanesSize-ce.prevReachedMinPanes,Re.min),Re.max)),We!==null&&(We.size=Math.min(Math.max(100-N-ce.nextPanesSize-ce.nextReachedMinPanes,We.min),We.max))},L=(Z,ne)=>{const ce=f.value.activeSplitter,de=[ce,ce+1];return ne<Z.prevPanesSize+s.value[de[0]].min&&(de[0]=j(ce).index,Z.prevReachedMinPanes=0,de[0]<ce&&s.value.forEach((ge,N)=>{N>de[0]&&N<=ce&&(ge.size=ge.min,Z.prevReachedMinPanes+=ge.min)}),Z.prevPanesSize=I(de[0]),de[0]===void 0)?(Z.prevReachedMinPanes=0,s.value[0].size=s.value[0].min,s.value.forEach((ge,N)=>{N>0&&N<=ce&&(ge.size=ge.min,Z.prevReachedMinPanes+=ge.min)}),s.value[de[1]].size=100-Z.prevReachedMinPanes-s.value[0].min-Z.prevPanesSize-Z.nextPanesSize,null):ne>100-Z.nextPanesSize-s.value[de[1]].min&&(de[1]=D(ce).index,Z.nextReachedMinPanes=0,de[1]>ce+1&&s.value.forEach((ge,N)=>{N>ce&&N<de[1]&&(ge.size=ge.min,Z.nextReachedMinPanes+=ge.min)}),Z.nextPanesSize=M(de[1]-1),de[1]===void 0)?(Z.nextReachedMinPanes=0,s.value.forEach((ge,N)=>{N<l.value-1&&N>=ce+1&&(ge.size=ge.min,Z.nextReachedMinPanes+=ge.min)}),s.value[de[0]].size=100-Z.prevPanesSize-M(de[0]-1),null):{sums:Z,panesToResize:de}},I=Z=>s.value.reduce((ne,ce,de)=>ne+(de<Z?ce.size:0),0),M=Z=>s.value.reduce((ne,ce,de)=>ne+(de>Z+1?ce.size:0),0),j=Z=>[...s.value].reverse().find(ne=>ne.index<Z&&ne.size>ne.min)||{},D=Z=>s.value.find(ne=>ne.index>Z+1&&ne.size>ne.min)||{},Q=()=>{var Z;const ne=Array.from(((Z=u.value)==null?void 0:Z.children)||[]);for(const ce of ne){const de=ce.classList.contains("splitpanes__pane"),ge=ce.classList.contains("splitpanes__splitter");!de&&!ge&&(ce.remove(),console.warn("Splitpanes: Only <pane> elements are allowed at the root of <splitpanes>. One of your DOM nodes was removed."))}},te=(Z,ne,ce=!1)=>{const de=Z-1,ge=document.createElement("div");ge.classList.add("splitpanes__splitter"),ce||(ge.onmousedown=N=>v(N,de),typeof window<"u"&&"ontouchstart"in window&&(ge.ontouchstart=N=>v(N,de)),ge.onclick=N=>k(N,de+1)),ge.ondblclick=N=>E(N,de+1),ne.parentNode.insertBefore(ge,ne)},H=Z=>{Z.onmousedown=void 0,Z.onclick=void 0,Z.ondblclick=void 0,Z.remove()},F=()=>{var Z;const ne=Array.from(((Z=u.value)==null?void 0:Z.children)||[]);for(const de of ne)de.className.includes("splitpanes__splitter")&&H(de);let ce=0;for(const de of ne)de.className.includes("splitpanes__pane")&&(!ce&&r.firstSplitter?te(ce,de,!0):ce&&te(ce,de),ce++)},P=({uid:Z,...ne})=>{const ce=a.value[Z];for(const[de,ge]of Object.entries(ne))ce[de]=ge},q=Z=>{var ne;let ce=-1;Array.from(((ne=u.value)==null?void 0:ne.children)||[]).some(de=>(de.className.includes("splitpanes__pane")&&ce++,de.isSameNode(Z.el))),s.value.splice(ce,0,{...Z,index:ce}),s.value.forEach((de,ge)=>de.index=ge),c.value&&o.nextTick(()=>{F(),G({addedPane:s.value[ce]}),Oe("pane-add",{pane:s.value[ce]})})},J=Z=>{const ne=s.value.findIndex(de=>de.id===Z);s.value[ne].el=null;const ce=s.value.splice(ne,1)[0];s.value.forEach((de,ge)=>de.index=ge),o.nextTick(()=>{F(),Oe("pane-remove",{pane:ce}),G({removedPane:{...ce}})})},G=(Z={})=>{!Z.addedPane&&!Z.removedPane?xe():s.value.some(ne=>ne.givenSize!==null||ne.min||ne.max<100)?Ce(Z):oe(),c.value&&Oe("resized")},oe=()=>{const Z=100/l.value;let ne=0;const ce=[],de=[];for(const ge of s.value)ge.size=Math.max(Math.min(Z,ge.max),ge.min),ne-=ge.size,ge.size>=ge.max&&ce.push(ge.id),ge.size<=ge.min&&de.push(ge.id);ne>.1&&He(ne,ce,de)},xe=()=>{let Z=100;const ne=[],ce=[];let de=0;for(const N of s.value)Z-=N.size,N.givenSize!==null&&de++,N.size>=N.max&&ne.push(N.id),N.size<=N.min&&ce.push(N.id);let ge=100;if(Z>.1){for(const N of s.value)N.givenSize===null&&(N.size=Math.max(Math.min(Z/(l.value-de),N.max),N.min)),ge-=N.size;ge>.1&&He(ge,ne,ce)}},Ce=({addedPane:Z,removedPane:ne}={})=>{let ce=100/l.value,de=0;const ge=[],N=[];((Z==null?void 0:Z.givenSize)??null)!==null&&(ce=(100-Z.givenSize)/(l.value-1));for(const ve of s.value)de-=ve.size,ve.size>=ve.max&&ge.push(ve.id),ve.size<=ve.min&&N.push(ve.id);if(!(Math.abs(de)<.1)){for(const ve of s.value)(Z==null?void 0:Z.givenSize)!==null&&(Z==null?void 0:Z.id)===ve.id||(ve.size=Math.max(Math.min(ce,ve.max),ve.min)),de-=ve.size,ve.size>=ve.max&&ge.push(ve.id),ve.size<=ve.min&&N.push(ve.id);de>.1&&He(de,ge,N)}},He=(Z,ne,ce)=>{let de;Z>0?de=Z/(l.value-ne.length):de=Z/(l.value-ce.length),s.value.forEach((ge,N)=>{if(Z>0&&!ne.includes(ge.id)){const ve=Math.max(Math.min(ge.size+de,ge.max),ge.min),Re=ve-ge.size;Z-=Re,ge.size=ve}else if(!ce.includes(ge.id)){const ve=Math.max(Math.min(ge.size+de,ge.max),ge.min),Re=ve-ge.size;Z-=Re,ge.size=ve}}),Math.abs(Z)>.1&&o.nextTick(()=>{c.value&&console.warn("Splitpanes: Could not resize panes correctly due to their constraints.")})},Oe=(Z,ne=void 0,ce=!1)=>{const de=(ne==null?void 0:ne.index)??f.value.activeSplitter??null;n(Z,{...ne,...de!==null&&{index:de},...ce&&de!==null&&{prevPane:s.value[de-(r.firstSplitter?1:0)],nextPane:s.value[de+(r.firstSplitter?0:1)]},panes:s.value.map(ge=>({min:ge.min,max:ge.max,size:ge.size}))})};o.watch(()=>r.firstSplitter,()=>F()),o.onMounted(()=>{Q(),F(),G(),Oe("ready"),c.value=!0}),o.onBeforeUnmount(()=>c.value=!1);const De=()=>{var Z;return o.h("div",{ref:u,class:m.value},(Z=i.default)==null?void 0:Z.call(i))};return o.provide("panes",s),o.provide("indexedPanes",a),o.provide("horizontal",o.computed(()=>r.horizontal)),o.provide("requestUpdate",P),o.provide("onPaneAdd",q),o.provide("onPaneRemove",J),o.provide("onPaneClick",C),(Z,ne)=>(o.openBlock(),o.createBlock(o.resolveDynamicComponent(De)))}},Ko={__name:"pane",props:{size:{type:[Number,String]},minSize:{type:[Number,String],default:0},maxSize:{type:[Number,String],default:100}},setup(t){var e;const n=t,r=o.inject("requestUpdate"),i=o.inject("onPaneAdd"),s=o.inject("horizontal"),a=o.inject("onPaneRemove"),l=o.inject("onPaneClick"),u=(e=o.getCurrentInstance())==null?void 0:e.uid,c=o.inject("indexedPanes"),f=o.computed(()=>c.value[u]),p=o.ref(null),m=o.computed(()=>{const w=isNaN(n.size)||n.size===void 0?0:parseFloat(n.size);return Math.max(Math.min(w,b.value),g.value)}),g=o.computed(()=>{const w=parseFloat(n.minSize);return isNaN(w)?0:w}),b=o.computed(()=>{const w=parseFloat(n.maxSize);return isNaN(w)?100:w}),v=o.computed(()=>{var w;return`${s.value?"height":"width"}: ${(w=f.value)==null?void 0:w.size}%`});return o.watch(()=>m.value,w=>r({uid:u,size:w})),o.watch(()=>g.value,w=>r({uid:u,min:w})),o.watch(()=>b.value,w=>r({uid:u,max:w})),o.onMounted(()=>{i({id:u,el:p.value,min:g.value,max:b.value,givenSize:n.size===void 0?null:m.value,size:m.value})}),o.onBeforeUnmount(()=>a(u)),(w,x)=>(o.openBlock(),o.createElementBlock("div",{ref_key:"paneEl",ref:p,class:"splitpanes__pane",onClick:x[0]||(x[0]=k=>o.unref(l)(k,w._.uid)),style:o.normalizeStyle(v.value)},[o.renderSlot(w.$slots,"default")],4))}},ZZ={class:"px-5 py-2.5"},QZ={key:0,class:"px-5 py-2.5"},NZ={key:1,class:"px-5 py-2.5"},eQ={key:2,class:"px-5 py-2.5"},tQ={class:"px-5 py-2.5"},nQ=o.defineComponent({__name:"EditorViewMobile",props:{extensions:{},mode:{},hideComment:{type:Boolean},fieldNameComment:{},fieldNameCommentCuesheet:{},fieldNameContent:{},comment:{},commentCuesheet:{},content:{},isEditorViewSplitContent:{type:Boolean}},setup(t){const e=t,n=o.computed(()=>{var v;return(v=e.extensions)==null?void 0:v.filter(w=>w.name!=="spellchecker")}),r=o.ref(),i=o.ref(),s=o.ref();o.onBeforeUnmount(()=>{r.value&&r.value.destroy(),i.value&&i.value.destroy(),s.value&&s.value.destroy()});function a(v){return new Oo({extensions:n.value,content:v,editable:!1,parseOptions:{preserveWhitespace:"full"}})}r.value=a(pn(e.comment,!0,e.mode)),i.value=a(pn(e.commentCuesheet,!0,e.mode)),s.value=a(pn(e.content,!0,e.mode));function l(v,w){if(!v)return;const x=pn(w,!0,e.mode);tt.isEqual(v.getHTML(),x)||v.commands.setContent(x,!1,{preserveWhitespace:"full"})}o.watch(()=>e.comment,v=>{l(r.value,v)}),o.watch(()=>e.commentCuesheet,v=>{l(i.value,v)}),o.watch(()=>e.content,v=>{l(s.value,v)});const{isScrolling:u,handleScroll:c}=wa(),{isScrolling:f,handleScroll:p}=wa(),m=o.computed(()=>e.mode!==Be.EDITOR?!0:!e.hideComment),g=o.computed(()=>e.mode!==Be.REPORT?!0:e.mode===Be.REPORT&&!e.hideComment),b=o.computed(()=>e.mode===Be.STRAIGHT||e.mode===Be.PLAIN_TEXT||!m.value);return(v,w)=>{const x=Ec;return o.openBlock(),o.createBlock(o.unref(eh),{horizontal:"",class:"flex-1"},{default:o.withCtx(()=>[o.unref(b)?(o.openBlock(),o.createBlock(o.unref(Ko),{key:0,class:o.normalizeClass(o.unref(ke)("!overflow-y-auto border border-ed-gray rounded-md",!v.isEditorViewSplitContent&&"border-none",!o.unref(f)&&"scrollbar-thumb-transparent")),onScroll:o.unref(p)},{default:o.withCtx(()=>[o.createElementVNode("div",ZZ,[v.fieldNameContent?(o.openBlock(),o.createBlock(x,{key:0,"field-name":v.fieldNameContent,class:"leading-7 font-medium text-blue-500"},null,8,["field-name"])):o.createCommentVNode("",!0),o.createVNode(o.unref(Xn),{editor:o.unref(s)},null,8,["editor"])])]),_:1},8,["class","onScroll"])):(o.openBlock(),o.createElementBlock(o.Fragment,{key:1},[o.unref(m)?(o.openBlock(),o.createBlock(o.unref(Ko),{key:0,class:o.normalizeClass(o.unref(ke)("!overflow-y-auto border border-ed-gray rounded-md",!v.isEditorViewSplitContent&&"border-none",!o.unref(u)&&"scrollbar-thumb-transparent")),onScroll:o.unref(c)},{default:o.withCtx(()=>[o.createElementVNode("div",{class:o.normalizeClass(o.unref(ke)("divide-y divide-ed-gray divide-dashed"))},[o.unref(g)?(o.openBlock(),o.createElementBlock("div",QZ,[v.fieldNameComment?(o.openBlock(),o.createBlock(x,{key:0,"field-name":v.fieldNameComment,class:"leading-7 font-medium text-blue-500"},null,8,["field-name"])):o.createCommentVNode("",!0),o.createVNode(o.unref(Xn),{editor:o.unref(r)},null,8,["editor"])])):o.createCommentVNode("",!0),v.mode===o.unref(Be).REPORT?(o.openBlock(),o.createElementBlock("div",NZ,[v.fieldNameCommentCuesheet?(o.openBlock(),o.createBlock(x,{key:0,"field-name":v.fieldNameCommentCuesheet,class:"leading-7 font-medium text-blue-500"},null,8,["field-name"])):o.createCommentVNode("",!0),o.createVNode(o.unref(Xn),{editor:o.unref(i)},null,8,["editor"])])):o.createCommentVNode("",!0),v.isEditorViewSplitContent?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("div",eQ,[v.fieldNameContent?(o.openBlock(),o.createBlock(x,{key:0,"field-name":v.fieldNameContent,class:"leading-7 font-medium text-blue-500"},null,8,["field-name"])):o.createCommentVNode("",!0),o.createVNode(o.unref(Xn),{editor:o.unref(s)},null,8,["editor"])]))],2)]),_:1},8,["class","onScroll"])):o.createCommentVNode("",!0),v.isEditorViewSplitContent?(o.openBlock(),o.createBlock(o.unref(Ko),{key:1,class:o.normalizeClass(o.unref(ke)("!overflow-y-auto border border-ed-gray rounded-md",!o.unref(f)&&"scrollbar-thumb-transparent")),onScroll:o.unref(p)},{default:o.withCtx(()=>[o.createElementVNode("div",tQ,[v.fieldNameContent?(o.openBlock(),o.createBlock(x,{key:0,"field-name":v.fieldNameContent,class:"leading-7 font-medium text-blue-500"},null,8,["field-name"])):o.createCommentVNode("",!0),o.createVNode(o.unref(Xn),{editor:o.unref(s)},null,8,["editor"])])]),_:1},8,["class","onScroll"])):o.createCommentVNode("",!0)],64))]),_:1})}}}),rQ={class:"flex gap-2 items-center overflow-x-auto overflow-y-hidden min-h-11 scrollbar-hide"},oQ=o.defineComponent({__name:"ToolbarFormat",props:{editor:{},disabled:{type:Boolean,default:!1},mode:{},activeExtensions:{default:()=>[]}},setup(t){const{t:e}=Ot(),n=t,r=["fontSize","fontFamily","superText","spellchecker",dE],i=o.computed(()=>{const l=[...n.editor.extensionManager.extensions];let u=[];for(const c of l){const{button:f,divider:p=!1,spacer:m=!1,toolbar:g=!0}=c.options;if(!f||!_0(f)||!g)continue;const b=f({editor:n.editor,extension:c,t:o.unref(e),isMobile:!0});if(Array.isArray(b)){const v=b.map((w,x)=>({id:`${c.name}`,button:w,divider:x===b.length-1?p:!1,spacer:x===0?m:!1}));u=[...u,...v];continue}u.push({button:b,divider:p,spacer:m,id:`${c.name}`})}return n.activeExtensions.length?u.filter(c=>c.id&&n.activeExtensions.includes(c.id)):(r.length&&(u=u.filter(c=>c.id&&!r.includes(c.id))),u)}),s=l=>l.id==="spellchecker"?"!text-ed-blue !bg-white !font-normal rounded [&>div>svg]:w-[19px] [&>div>svg]:h-[19px] h-[26px] gap-x-1 whitespace-nowrap":l.button.componentProps.customClass,a=l=>l.id==="spellchecker"?"Spellchecker":l.button.componentProps.icon;return(l,u)=>(o.openBlock(),o.createElementBlock("div",{id:"tool-bar-format",class:o.normalizeClass(o.unref(ke)("bg-white border border-gray-100 dark:bg-ed-gray-500 dark:border-ed-muted rounded-full shadow-elevation2 px-2.5",!i.value.length&&"hidden"))},[o.createElementVNode("div",rQ,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(i.value,(c,f)=>{var p;return o.openBlock(),o.createBlock(o.resolveDynamicComponent(c.button.component),o.mergeProps({key:f,id:c.id,ref_for:!0},c.button.componentProps,{editor:l.editor,disabled:l.disabled||((p=c.button.componentProps)==null?void 0:p.disabled),"custom-class":s(c),icon:a(c)}),o.createSlots({_:2},[o.renderList(c.button.componentSlots,(m,g,b)=>({name:`${g}`,fn:o.withCtx(v=>[(o.openBlock(),o.createBlock(o.resolveDynamicComponent(m),o.mergeProps({ref_for:!0},v==null?void 0:v.props,{id:c.id}),null,16,["id"]))])}))]),1040,["id","editor","disabled","custom-class","icon"])}),128))])],2))}}),iQ={class:"flex gap-2 items-center overflow-x-auto"},Kk=o.defineComponent({__name:"ToolbarMobile",props:{editor:{},disabled:{type:Boolean,default:!1},mode:{},activeExtensions:{default:()=>[cE,hc,ub]},customClassToolbar:{}},setup(t){const{t:e}=Ot(),n=t,r=o.inject("isEditable",o.ref(!0)),i=o.computed(()=>{const u=[...n.editor.extensionManager.extensions],c=u.find(m=>m.name===ub);let f=u.sort((m,g)=>m.name==="spellchecker"?-1:g.name==="spellchecker"||m.name==="superText"?1:g.name==="superText"?-1:0);c&&(f=u.sort((m,g)=>m.name==="configPlan"?1:g.name==="configPlan"?-1:0));let p=[];for(const m of f){const{button:g,divider:b=!1,spacer:v=!1,toolbar:w=!0}=m.options;if(!g||!_0(g)||!w)continue;const x=g({editor:n.editor,extension:m,t:o.unref(e),isMobile:!0});if(Array.isArray(x)){const k=x.map((E,C)=>({id:`${m.name}`,button:E,divider:C===x.length-1?b:!1,spacer:C===0?v:!1}));p=[...p,...k];continue}p.push({button:x,divider:b,spacer:v,id:`${m.name}`})}if(!r.value){const m=p.find(g=>g.id==="superText");m&&(m.button.componentProps.disabled=!0)}return n.activeExtensions.length?p.filter(m=>m.id&&n.activeExtensions.includes(m.id)):p}),s=u=>u.id==="spellchecker"?"!text-ed-blue data-[state=off]:bg-white dark:data-[state=off]:bg-ed-accent/40 !font-normal rounded [&>div>svg]:w-[19px] [&>div>svg]:h-[19px] h-[26px] gap-x-1 whitespace-nowrap":u.button.componentProps.customClass,a=u=>u.id==="spellchecker"?"Spellchecker":u.button.componentProps.icon,l=o.ref(!1);return(u,c)=>{const f=fE;return o.openBlock(),o.createElementBlock("div",{id:"tool-bar",class:o.normalizeClass(o.unref(ke)("z-10 border border-ed-input rounded-[5px] px-2.5 py-[5px] leading-none",!i.value.length&&"hidden",u.customClassToolbar))},[o.createElementVNode("div",iQ,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(i.value,(p,m)=>{var g,b,v;return o.openBlock(),o.createElementBlock(o.Fragment,{key:m},[p.spacer&&m!==0?(o.openBlock(),o.createBlock(o.unref(di),{key:0,orientation:"vertical",class:"h-[16px] mx-[10px]"})):o.createCommentVNode("",!0),(o.openBlock(),o.createBlock(o.resolveDynamicComponent(p.button.component),o.mergeProps({id:p.id,ref_for:!0},p.button.componentProps,{editor:u.editor,disabled:u.disabled||((g=p.button.componentProps)==null?void 0:g.disabled),"custom-class":s(p),icon:a(p)}),o.createSlots({_:2},[o.renderList(p.button.componentSlots,(w,x,k)=>({name:`${x}`,fn:o.withCtx(E=>[(o.openBlock(),o.createBlock(o.resolveDynamicComponent(w),o.mergeProps({ref_for:!0},E==null?void 0:E.props,{id:p.id}),null,16,["id"]))])}))]),1040,["id","editor","disabled","custom-class","icon"])),p.id===hc&&o.unref(l)?(o.openBlock(),o.createBlock(f,{key:1,class:"bg-white border-inherit w-[26px] h-[26px] shadow-none",checked:(v=(b=p.button.componentProps).isActive)==null?void 0:v.call(b),"onUpdate:checked":w=>{var x,k;return(k=(x=p.button.componentProps).action)==null?void 0:k.call(x)}},null,8,["checked","onUpdate:checked"])):o.createCommentVNode("",!0),p.divider?(o.openBlock(),o.createBlock(o.unref(di),{key:2,orientation:"vertical",class:"mx-2 h-auto"})):o.createCommentVNode("",!0)],64)}),128))])],2)}}}),sQ={class:"flex w-fit rounded-md bg-ed-gray-600 text-white max-w-full overflow-x-auto"},aQ=Io(o.defineComponent({__name:"MainBubbleMenuList",props:{editor:{},mode:{},disableSuperInput:{type:Boolean},hasClipboard:{type:Boolean}},emits:["close-long-press-menu"],setup(t,{emit:e}){var f;const n=t,r=e,{t:i}=Ot(),s=o.computed(()=>[...n.editor.extensionManager.extensions].find(m=>m.name==="superText")),a=o.ref(!1),l=(f=n.editor.extensionManager.extensions.find(p=>p.name==="superText"))==null?void 0:f.options.specialCharModal,u=p=>{const{state:m}=n.editor,{from:g}=m.selection;n.editor.commands.insertContentAt(g,p)},c=()=>{n.editor.chain().focus().toggleSuperInputMoblie().run(),r("close-long-press-menu");const p=PK(n.editor);n.editor.commands.setSuperTextContent(p)};return(p,m)=>{var g,b,v;return o.openBlock(),o.createElementBlock(o.Fragment,null,[o.createElementVNode("div",sQ,[o.unref(s)&&!p.disableSuperInput&&p.mode!==o.unref(Be).EDITOR?(o.openBlock(),o.createElementBlock("button",{key:0,class:"bubble-menu-item",onClick:c},o.toDisplayString(o.unref(i)("editor.super")),1)):o.createCommentVNode("",!0),o.createElementVNode("button",{class:"bubble-menu-item",onClick:m[0]||(m[0]=w=>a.value=!0)},o.toDisplayString(o.unref(i)("editor.insertSpecial")),1),p.hasClipboard?(o.openBlock(),o.createElementBlock("button",{key:1,class:"bubble-menu-item",onClick:m[1]||(m[1]=w=>p.editor.chain().focus().pasteContent().run())},o.toDisplayString(o.unref(i)("editor.paste")),1)):o.createCommentVNode("",!0),o.createElementVNode("button",{class:"bubble-menu-item",onClick:m[2]||(m[2]=w=>p.editor.chain().focus().cutContent().run())},o.toDisplayString(o.unref(i)("editor.cut")),1),o.createElementVNode("button",{class:"bubble-menu-item",onClick:m[3]||(m[3]=()=>{p.editor.chain().focus().copyContent().setTextSelection(0).blur().run(),r("close-long-press-menu")})},o.toDisplayString(o.unref(i)("editor.copy")),1),o.createElementVNode("button",{class:"bubble-menu-item",onClick:m[4]||(m[4]=w=>p.editor.chain().focus().selectAll().run())},o.toDisplayString(o.unref(i)("editor.selectAll")),1)]),(o.openBlock(),o.createBlock(o.Teleport,{to:"body"},[(o.openBlock(),o.createBlock(o.resolveDynamicComponent((g=o.unref(l))==null?void 0:g.component),{"is-open":o.unref(a),open:o.unref(a),class:o.normalizeClass((v=(b=o.unref(l))==null?void 0:b.componentProps)==null?void 0:v.class),onSelectedChar:u,onClose:m[5]||(m[5]=w=>a.value=!1)},null,40,["is-open","open","class"]))]))],64)}}}),[["__scopeId","data-v-e8f0c575"]]);class Gk{isNativeWebViewAvailable(){return window.ReactNativeWebView!==void 0}getDevicePlatform(){var r;if(!this.isNativeWebViewAvailable())return;if(typeof window.webkit=="object"&&typeof((r=window.webkit)==null?void 0:r.messageHandlers)=="object")return E0.IOS;const n=navigator.userAgent.toLowerCase();if(n.includes("android"))return E0.ANDROID;if(n.includes("iphone")||n.includes("ipad")||n.includes("ipod"))return E0.IOS}sendToNative(e,n){if(window.ReactNativeWebView){const r={type:e,data:n};window.ReactNativeWebView.postMessage(JSON.stringify(r)),console.log(`Sent message to native: ${e}`)}else console.log("ReactNativeWebView not available")}receiveDataFromNative(e,n){const r=window.receiveDriverData;window.receiveDriverData=i=>{try{const s=JSON.parse(i);s.type===e?(console.log(`Received data from native ${e}`),n(s.data)):r&&r(i)}catch(s){console.log("Error parsing data from native",s)}}}}const Xk=o.defineComponent({__name:"MainBubbleMenu",props:{editor:{},mode:{},disableSuperInput:{type:Boolean}},setup(t){const e=t,n=new Gk,r=o.ref(!1),i=async()=>{var g,b;const m=await((b=(g=e.editor).hasClipboard)==null?void 0:b.call(g));r.value=!!m},s={duration:200,placement:"bottom",appendTo:()=>document.body.querySelector(".splitpanes__pane"),onShow:()=>{i(),n.sendToNative("hideIOSEditMenu")},getReferenceClientRect:()=>{if(e.editor&&!e.editor.isDestroyed){const{view:m,state:g}=e.editor,{from:b,to:v}=g.selection,w=m.dom.getBoundingClientRect(),x=m.coordsAtPos(b),k=m.coordsAtPos(v),E=Math.min(x.top,k.top),_=Math.max(x.bottom,k.bottom)-E;return new DOMRect(w.left,E,w.width,_)}return null}},a=o.ref(null),l=o.ref(!1),u=({editor:m,state:g})=>["image","superText","link"].some(w=>m.isActive(w))?!1:!g.selection.empty||l.value;function c(m){return f(m)&&m.touches.length>0?{x:m.touches[0].clientX,y:m.touches[0].clientY}:f(m)&&m.changedTouches.length>0?{x:m.changedTouches[0].clientX,y:m.changedTouches[0].clientY}:m instanceof MouseEvent?{x:m.clientX,y:m.clientY}:window.PointerEvent&&m instanceof PointerEvent?{x:m.clientX,y:m.clientY}:null}function f(m){return"touches"in m}function p(m){if(!e.editor)return;const g=c(m);if(!g)return;const b=e.editor.view,v=b.state,w=b.posAtCoords({left:g.x,top:g.y});if(!w||w.inside===-1)return;const x=w.pos,k=v.doc.content.size,E=Math.min(x+1,k);let C=v.tr;C=C.setSelection(Ae.create(v.doc,x,E)),b.dispatch(C),requestAnimationFrame(()=>{const _=b.state.tr.setSelection(Ae.create(b.state.doc,x,x));b.dispatch(_),b.focus()})}return o.onMounted(()=>{const m=e.editor.view.dom;mt.onLongPress(o.ref(m),v=>{l.value=!0,p(v)},{delay:500,modifiers:{prevent:!1}});const g=()=>{e.editor.state.selection.empty&&(l.value=!1)};m.addEventListener("pointerdown",g);const b=({transaction:v})=>{l.value&&v.docChanged&&(l.value=!1,o.nextTick(()=>{var w;try{const x=(w=a.value)==null?void 0:w.$el;x&&x._tippy&&typeof x._tippy.hide=="function"&&x._tippy.hide()}catch{const k=e.editor.view,E=k.state,C=E.selection.from,_=E.doc.content.size,A=Math.min(C+1,_);k.dispatch(E.tr.setSelection(Ae.create(E.doc,C,A))),requestAnimationFrame(()=>{k.dispatch(k.state.tr.setSelection(Ae.create(k.state.doc,C,C)))})}}))};e.editor.on("transaction",b),o.onUnmounted(()=>{m.removeEventListener("pointerdown",g),e.editor.off("transaction",b)})}),(m,g)=>(o.openBlock(),o.createBlock(o.unref(Tu),{ref_key:"bubbleMenuRef",ref:a,editor:m.editor,"tippy-options":s,"should-show":u},{default:o.withCtx(()=>[o.createVNode(aQ,{editor:m.editor,mode:m.mode,disableSuperInput:m.disableSuperInput,hasClipboard:o.unref(r),onCloseLongPressMenu:g[0]||(g[0]=b=>l.value=!1)},null,8,["editor","mode","disableSuperInput","hasClipboard"])]),_:1},8,["editor"]))}}),lQ={class:"flex items-center justify-between label-large mb-2"},uQ={class:"mb-5"},cQ={class:"flex gap-x-3"},dQ=o.defineComponent({__name:"SuperInputBottomSheet",props:{editor:{},open:{type:Boolean},bottomSheetComponent:{}},emits:["save","close"],setup(t,{emit:e}){const n=t,r=e,i=o.ref(""),s=o.ref(""),a=o.computed(()=>Mp(i.value)),l=()=>{i.value="",s.value="",n.editor.commands.setSuperTextContent(i.value,s.value)},u=()=>{l(),r("close")};o.watch(()=>n.open,()=>{n.open&&(i.value=n.editor.storage.superText.superTextContent,s.value=n.editor.storage.superText.superTextPosition)});const c=()=>{i.value=n.editor.storage.superText.superTextContent},f=()=>{r("save",i.value,s.value),l()};return(p,m)=>{var b;const g=Lt;return o.openBlock(),o.createBlock(o.resolveDynamicComponent((b=p.bottomSheetComponent)==null?void 0:b.component),{"is-open":p.open,type:"bottom",title:"수퍼 입력",onOnClose:u},{customContent:o.withCtx(()=>{var v;return[o.createElementVNode("div",lQ,[m[2]||(m[2]=o.createElementVNode("span",null,"내용",-1)),(o.openBlock(),o.createBlock(o.resolveDynamicComponent((v=p.bottomSheetComponent)==null?void 0:v.button),{class:"w-fit [&_svg]:size-6 text-blue",variant:"ghost",size:"icon",onClick:c},{default:o.withCtx(()=>[o.createVNode(g,{name:"reset",class:"h-5 w-5"}),m[1]||(m[1]=o.createElementVNode("span",null,"초기화",-1))]),_:1}))])]}),body:o.withCtx(()=>[o.createElementVNode("div",uQ,[o.createVNode(gb,{modelValue:o.unref(i),"onUpdate:modelValue":m[0]||(m[0]=v=>o.isRef(i)?i.value=v:null),"parent-editor":p.editor,"spellcheck-enabled":!1,autofocus:"end"},null,8,["modelValue","parent-editor"])])]),footer:o.withCtx(()=>{var v,w;return[o.createElementVNode("div",cQ,[(o.openBlock(),o.createBlock(o.resolveDynamicComponent((v=p.bottomSheetComponent)==null?void 0:v.button),{variant:"outline",onClick:u},{default:o.withCtx(()=>m[3]||(m[3]=[o.createTextVNode(" 취소 ")])),_:1})),(o.openBlock(),o.createBlock(o.resolveDynamicComponent((w=p.bottomSheetComponent)==null?void 0:w.button),{disabled:o.unref(a),variant:o.unref(a)?"disabled":"default",onClick:f},{default:o.withCtx(()=>m[4]||(m[4]=[o.createTextVNode(" 입력 ")])),_:1},8,["disabled","variant"]))])]}),_:1},40,["is-open"])}}}),Yk=Vn.create({name:"diffDel",parseHTML(){return[{tag:"span.diff-del"}]},renderHTML({HTMLAttributes:t}){return["span",{class:"diff-del",...t},0]}}),fQ=o.defineComponent({__name:"EditorCommentMoblie",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:{},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},canEditSuperReadOnly:{type:Boolean},autoFocus:{type:Boolean,default:!0},superPreviewCustomClass:{},minChar:{},isAccordion:{type:Boolean},contentAutoCopied:{},isEditorView:{type:Boolean},isEditorViewSplitContent:{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=o.useAttrs(),a=xn(),{isReady:l,editor:u,updateEditorState:c,checkSpellStore:f}=a,p=o.inject("isEditable",o.ref(!0)),m=new Oo({enablePasteRules:!1,enableInputRules:!1,content:pn(r.modelValue,r.disabled),editorProps:{attributes:{id:ir.COMMENT,[ir.DISABLE_SUPER_INPUT]:`${r.disableSuperInput}`},handleKeyDown:tt.throttle((x,k)=>k.key==="Enter"&&s.enter&&!k.shiftKey?(i("enter"),!0):!1,Bo),transformPastedHTML:x=>(x=x.replace(/\s*style="[^"]*"/g,""),x)},onCreate:({editor:x})=>{c(x)},onUpdate:tt.throttle(({editor:x})=>{l.value=!0;const k=b(x,r.output);i("update:modelValue",k),i("change",{editor:x,output:k}),c(x)},Bo),extensions:[Yk,...tt.uniqBy(tt.reverse(o.unref(r.extensions)),"name")],editable:p.value,onFocus:()=>{g()},onBlur:({editor:x,event:k})=>{i("onBlurEditor",k)}});function g(){i("setEditorSelected",m)}g();function b(x,k){if(!x)return"";if(x.isEmpty)return k==="json"?{}:"";switch(k){case"html":return x.getHTML();case"json":return x.getJSON();case"text":return x.getText();default:return""}}function v(x){return x.every(k=>m==null?void 0:m.extensionManager.extensions.find(E=>E.name===k))}o.watch(()=>f.languages,()=>{m.commands.checkSpelling()}),o.watch(()=>r.modelValue,x=>{if(!m||tt.isEqual(b(m,r.output),x))return;const{from:k,to:E}=m.state.selection;m.commands.setTextSelection({from:k,to:E}),m.commands.setContent(pn(x,r.disabled),!1)},{deep:!0}),o.watch(()=>u.value,()=>{u.value&&u.value.on("selectionUpdate",({editor:x})=>{i("changed:selection",{editor:x})})}),o.watch(()=>r.disableSuperInput,()=>{const x=document.getElementById(ir.COMMENT);x==null||x.setAttribute(ir.DISABLE_SUPER_INPUT,`${r.disableSuperInput}`)}),o.onUnmounted(()=>m==null?void 0:m.destroy()),Qu(Au.SAVE,()=>{localStorage.setItem("comment",b(m,"html"))});function w(x){m.commands.focus("end"),g()}return Qp(m),o.onMounted(()=>{var x;r.autoFocus&&w(r.mode),(x=m==null?void 0:m.commands)!=null&&x.setIsMobile&&m.commands.setIsMobile(!0)}),o.watch(()=>r.mode,x=>{r.autoFocus&&w()}),o.watch(()=>p.value,x=>{var k;m==null||m.setEditable(x),(k=m==null?void 0:m.commands)!=null&&k.setIsEnableSuggestion&&m.commands.setIsEnableSuggestion(x)},{immediate:!0}),e({editor:m}),(x,k)=>{const E=Xk,C=Zp,_=Jp,A=Yp,T=Bf;return o.openBlock(),o.createElementBlock(o.Fragment,null,[!x.hideBubble&&!x.disabled&&o.unref(p)?(o.openBlock(),o.createElementBlock(o.Fragment,{key:0},[o.createVNode(E,{editor:o.unref(m),mode:x.mode,"disable-super-input":x.disableSuperInput},null,8,["editor","mode","disable-super-input"]),v([o.unref(pc)])?(o.openBlock(),o.createBlock(C,{key:0,editor:o.unref(m)},null,8,["editor"])):o.createCommentVNode("",!0),v([o.unref(fa)])?(o.openBlock(),o.createBlock(_,{key:1,editor:o.unref(m)},null,8,["editor"])):o.createCommentVNode("",!0),v([o.unref(ps)])?(o.openBlock(),o.createBlock(A,{key:2,editor:o.unref(m)},null,8,["editor"])):o.createCommentVNode("",!0),v([o.unref(hs),o.unref(ms)])?(o.openBlock(),o.createBlock(T,{key:3,editor:o.unref(m)},null,8,["editor"])):o.createCommentVNode("",!0)],64)):o.createCommentVNode("",!0),o.createVNode(o.unref(Xn),{id:"editor-panel",editor:o.unref(m),spellcheck:"true",class:o.normalizeClass(["flex-1 flex-col relative"])},null,8,["editor"])],64)}}}),Jk=o.defineComponent({__name:"ToolbarTitle",props:{titleBar:{},customClass:{}},setup(t){return(e,n)=>(o.openBlock(),o.createElementBlock("h3",{class:o.normalizeClass(o.unref(ke)("rounded-[5px] px-2.5 py-[5px] min-h-[32px] flex items-center bg-ed-gray-500",[e.customClass],[e.titleBar.bgClass]))},o.toDisplayString(e.titleBar.title),3))}});function Zk(t=!1,e=10){const n=e,r=90,i=50,s=n+1,a=o.ref(!0),l=o.ref(!0),u=o.ref(i),c=o.ref(i);return{HEADER_ONLY_SIZE:n,FULL_SIZE:r,SPLIT_SIZE:i,pane1ContentVisible:a,pane2ContentVisible:l,pane1Size:u,pane2Size:c,togglePane:m=>{if(o.unref(t)){l.value?(l.value=!1,c.value=n):(l.value=!0,c.value=r+n);return}if(m==="pane1"){a.value&&l.value?(a.value=!1,u.value=n,c.value=r):a.value&&!l.value?(a.value=!1,l.value=!0,u.value=n,c.value=r):!a.value&&l.value?(a.value=!0,u.value=i,c.value=i):(a.value=!0,u.value=r,c.value=n);return}m==="pane2"&&(a.value&&l.value?(l.value=!1,u.value=r,c.value=n):l.value&&!a.value?(l.value=!1,a.value=!0,u.value=r,c.value=n):!l.value&&a.value?(l.value=!0,u.value=i,c.value=i):(l.value=!0,u.value=n,c.value=r))},handlePaneResize:m=>{const g=m.panes;if(g&&g.length>=2){const b=g[0].size,v=g[1].size;u.value=b,c.value=v,b>n&&!a.value&&(a.value=!0),v>n&&!l.value&&(l.value=!0),b<=s&&a.value&&(a.value=!1),v<=s&&l.value&&(l.value=!1)}}}}const pQ={class:"flex justify-between items-center relative"},kc=o.defineComponent({__name:"CoreEditorMoblie",props:{isMobile:{type:Boolean},superTextArea:{default:{view:!0,button:!0}},mode:{},modelValue:{default:""},comment:{default:""},commentCuesheet:{default:""},hideComment:{type:Boolean,default:!1},disableSuperInput:{type:Boolean,default:!1},fontSizeDefault:{default:"14px"},fontFamilyDefault:{default:""},isOpenSuperView:{type:Boolean},output:{default:"html"},dark:{type:Boolean,default:void 0},disabled:{type:Boolean,default:!1},hideToolbar:{type:Boolean,default:!1},isShowFormatControlBar:{type:Boolean,default:!1},customClassFormatControlBar:{default:""},titleBarComment:{default:null},titleBarContent:{default:null},fieldNameComment:{default:null},fieldNameCommentCuesheet:{},fieldNameContent:{default:null},fieldNameSuper:{},isScreenSplit:{default:!1},isShowLineNumber:{type:Boolean,default:!1},hideMenubar:{type:Boolean},disableBubble:{type:Boolean,default:!1},hideBubble:{type:Boolean,default:!1},maxWidth:{default:void 0},minHeight:{default:200},maxHeight:{default:void 0},height:{default:void 0},extensions:{default:()=>[]},editorClass:{default:void 0},contentClass:{default:void 0},isCompare:{type:Boolean},autoHeight:{type:Boolean},textAlert:{},customClassToolbar:{default:""},readonly:{type:Boolean,default:!1},canEditSuperReadOnly:{type:Boolean},autoFocus:{type:Boolean,default:!0},superPreviewCustomClass:{},minChar:{},isAccordion:{type:Boolean},contentAutoCopied:{},isEditorView:{type:Boolean,default:!1},isEditorViewSplitContent:{type:Boolean,default:!1}},emits:["enter","change","update:modelValue","update:comment","onFocusEditor","changed:selection","setEditorSelected","onBlurEditor","lineFocus","onFocus","onBlur"],setup(t,{expose:e,emit:n}){var Qe;const r=t,i=n,s=new Gk;o.provide("isMobile",!0);const a=mt.useEventBus(lr.INCREASE_DECREASE_FONTSIZE),l=o.useAttrs(),u=xn(),{state:c,isFullscreen:f,isReady:p,editor:m,updateEditorState:g,checkSpellStore:b,setImageAttachment:v,setEditorContentMobile:w}=u,{markAsFocused:x,insertHtml:k}=xZ(),E=o.ref(!r.disabled&&!r.readonly);o.provide("isEditable",E),o.computed(()=>[...c.extensions,...tt.differenceBy(r.extensions,c.extensions,"name")].map((X,W)=>X.configure({sort:W})));const C=o.ref(r.fontSizeDefault),_=o.ref(r.fontFamilyDefault);o.provide("fontSize",C),o.provide("fontFamily",_);const A=o.computed(()=>({fontFamily:_.value,fontSize:C.value})),T=o.ref(),{height:L}=mt.useWindowSize(),I=o.computed(()=>{var W;if(F.value)return{bottom:"15px"};const X=((W=T.value)==null?void 0:W.getBoundingClientRect().bottom)||0;return{bottom:`${L.value-X+10}px`}}),M=X=>{const W=parseInt(C.value||"12px"),se=X?W+2:W-2;C.value=se+"px"};o.onBeforeMount(()=>{a.on(M)}),o.onBeforeUnmount(()=>{a.off(M)});const j=o.computed(()=>({...o.unref(f)?{height:"100%"}:{minHeight:r.minHeight?an(r.minHeight):void 0,maxHeight:r.maxHeight?an(r.maxHeight):void 0,height:r.height?an(r.height):void 0},maxWidth:an(r.maxWidth),width:r.maxWidth?"100%":void 0,margin:r.maxWidth?"0 auto":void 0})),D=new Oo({enablePasteRules:!1,enableInputRules:!1,content:pn(r.modelValue,r.disabled,r.mode),editorProps:{handleKeyDown:tt.throttle((X,W)=>W.key==="Enter"&&l.enter&&!W.shiftKey?(i("enter"),!0):!1,Bo),transformPastedHTML:X=>(X=X.replace(/\s*style="[^"]*"/g,""),X),handlePaste(X,W){var Fe;if(r.mode!==Be.PLAIN_TEXT)return!1;W.preventDefault();const se=((Fe=W.clipboardData)==null?void 0:Fe.getData("text/plain"))||"",{tr:ae,selection:ye}=X.state;return X.dispatch(ae.insertText(se,ye.from)),!0}},onCreate:({editor:X})=>{g(X)},onUpdate:tt.throttle(({editor:X})=>{p.value=!0;const W=xe(X,r.output);i("update:modelValue",W),i("change",{editor:X,output:W}),g(X),Q(X)},Bo),extensions:[Yk,...tt.uniqBy(tt.reverse(o.unref(r.extensions)),"name")],editable:E.value,onFocus:X=>{G(),i("onFocus",X),x()},onBlur:X=>i("onBlur",X),parseOptions:{preserveWhitespace:"full"}});function Q(X){const W=[];X.state.doc.descendants(se=>{se.type.name==="image"&&W.push({id:se.attrs.id,src:se.attrs.src})}),v(W)}const te=o.ref(),H=o.ref(!0),F=o.ref(!1);function P(){s.isNativeWebViewAvailable()&&(s.receiveDataFromNative("keyboardDidShow",X=>{F.value=!0}),s.receiveDataFromNative("keyboardDidHide",X=>{F.value=!1}))}function q(X){const W=document.querySelectorAll('[contenteditable="true"]:not(.tiptap), .simple-editor, input, textarea'),se=Array.from(W).some(ae=>ae.contains(X.target));if(X.type==="focusout"){H.value=!0;return}H.value=!se}mt.useEventListener(document,"focusin",q),mt.useEventListener(document,"focusout",q),o.onMounted(()=>{G(D),w(D),P()});const J=o.computed(()=>r.isShowFormatControlBar&&H.value&&!F.value);function G(X){te.value=X??D,u.setEditorSelectedMobile(te.value)}const oe=o.computed(()=>D.storage.superText.isShowSuperInputMoblie);function xe(X,W){if(!X)return"";if(X.isEmpty)return W==="json"?{}:"";if(r.mode===Be.PLAIN_TEXT)return X.getText({blockSeparator:`
302
+ `});default:return""}}function J(N){return N.every(ve=>M==null?void 0:M.extensionManager.extensions.find(Re=>Re.name===ve))}o.watch(()=>v.languages,()=>{M.commands.checkSpelling()}),o.watch(()=>r.modelValue,N=>{if(!M||tt.isEqual(q(M,r.output),N))return;const{from:ve,to:Re}=M.state.selection;M.commands.setTextSelection({from:ve,to:Re}),M.commands.setContent(pn(N,r.disabled,r.mode),!1,{preserveWhitespace:"full"}),P()},{deep:!0}),o.watch(()=>x.value,N=>{var ve;M==null||M.setEditable(N),(ve=M==null?void 0:M.commands)!=null&&ve.setIsEnableSuggestion&&M.commands.setIsEnableSuggestion(N)},{immediate:!0}),o.watch(()=>m.value,()=>{m.value&&m.value.on("selectionUpdate",({editor:N})=>{i("changed:selection",{editor:N})})}),o.onUnmounted(()=>M==null?void 0:M.destroy()),Qu(Au.SAVE,()=>{localStorage.setItem("content",q(M,"html"))});const G=o.computed(()=>{var We;if(!((We=M==null?void 0:M.storage)!=null&&We.superText))return!1;const{enable:N}=M.storage.superText,ve=[Be.EDITOR,Be.PLAIN_TEXT].includes(r.mode),Re=r.disabled;return N&&!ve&&!Re}),oe=o.ref(null),xe=o.computed(()=>r.mode),{commentHeight:Ce,contentHeight:He,minHeight:Oe,minHeightComment:De}=GZ(oe,xe,r.autoHeight,typeof r.minHeight=="string"?parseInt(r.minHeight):r.minHeight),Z=o.ref(null);function ne(N){N===Be.STRAIGHT&&w(Z.value)}o.onMounted(()=>{ne(r.mode)}),o.watch(()=>r.mode,N=>{ne(N)});const ce=o.ref(null),de=()=>{var ve;(ve=ce.value)!=null&&ve.editor.commands.focusInvalidChar()||M.commands.focusInvalidChar()};u.focusFirstInvalidChar.value=de,o.onActivated(()=>{u.focusFirstInvalidChar.value=de});const ge=o.computed(()=>{var ve,Re,We;const N=((ve=r.fieldNameComment)==null?void 0:ve.label)||((Re=r.fieldNameCommentCuesheet)==null?void 0:Re.label)||((We=r.fieldNameContent)==null?void 0:We.label);return r.disabled&&N});return e({editor:M}),(N,ve)=>{var le;const Re=Zp,We=Jp,pt=Yp,kt=Bf,z=f$,V=QB;return o.unref(M)?(o.openBlock(),o.createElementBlock("div",{key:0,id:"vdc-editor",class:o.normalizeClass(["vdc-editor w-full flex flex-col",[N.editorClass,{"outline-ed-primary":o.unref(M).isFocused,"outline-ed-border":!o.unref(M).isFocused}]]),style:o.normalizeStyle(I.value)},[!N.hideBubble&&!N.disabled&&x.value?(o.openBlock(),o.createElementBlock(o.Fragment,{key:0},[J([o.unref(pc)])?(o.openBlock(),o.createBlock(Re,{key:0,editor:o.unref(M)},null,8,["editor"])):o.createCommentVNode("",!0),J([o.unref(fa)])?(o.openBlock(),o.createBlock(We,{key:1,editor:o.unref(M)},null,8,["editor"])):o.createCommentVNode("",!0),J([o.unref(ps)])?(o.openBlock(),o.createBlock(pt,{key:2,editor:o.unref(M)},null,8,["editor"])):o.createCommentVNode("",!0),J([o.unref(hs),o.unref(ms)])?(o.openBlock(),o.createBlock(kt,{key:3,editor:o.unref(M)},null,8,["editor"])):o.createCommentVNode("",!0)],64)):o.createCommentVNode("",!0),N.hideToolbar?o.createCommentVNode("",!0):(o.openBlock(),o.createBlock(z,{key:1,editor:o.unref(M),"editor-comment":(le=ce.value)==null?void 0:le.editor,mode:N.mode,class:"mb-2","custom-class-toolbar":N.customClassToolbar},null,8,["editor","editor-comment","mode","custom-class-toolbar"])),o.createElementVNode("div",{ref_key:"editorWrapRef",ref:oe,class:o.normalizeClass(["space-y-2 flex-1 flex flex-col break-keep",!C.value&&"[&_*]:!font-inherit [&_*]:!text-font-size-inherit",A.value&&!C.value?"[&_*]:!font-inherit":"",_.value&&!C.value?"[&_*]:!text-font-size-inherit":""]),style:o.normalizeStyle(T.value)},[ge.value?(o.openBlock(),o.createBlock(V,{key:0,extensions:N.extensions,mode:N.mode,"hide-comment":N.hideComment,"field-name-comment":N.fieldNameComment,"field-name-comment-cuesheet":N.fieldNameCommentCuesheet,"field-name-content":N.fieldNameContent,comment:N.comment,"comment-cuesheet":N.commentCuesheet,content:N.modelValue,"min-chars":N.minChar.content,"font-size":_.value},null,8,["extensions","mode","hide-comment","field-name-comment","field-name-comment-cuesheet","field-name-content","comment","comment-cuesheet","content","min-chars","font-size"])):(o.openBlock(),o.createElementBlock("div",{key:1,class:"space-y-2 flex-1 flex flex-col",style:o.normalizeStyle({minWidth:`${F.value}px`})},[N.mode===o.unref(Be).REPORT&&!N.hideComment?(o.openBlock(),o.createBlock(KZ,{key:0,ref_key:"editorCommentRef",ref:ce,mode:o.unref(Be).REPORT,extensions:N.extensions,"model-value":r.comment,disabled:r.disabled,"disable-super-input":N.disableSuperInput,"is-open-super-view":G.value,"super-preview-custom-class":N.superPreviewCustomClass,"min-char":N.minChar,"font-size":_.value,style:o.normalizeStyle(r.autoHeight?{height:"auto",minHeight:o.unref(an)(o.unref(De))}:{height:o.unref(an)(o.unref(Ce)),minHeight:o.unref(an)(o.unref(Oe))}),class:"relative overflow-y-auto","onUpdate:modelValue":ve[0]||(ve[0]=be=>i("update:comment",be))},null,8,["mode","extensions","model-value","disabled","disable-super-input","is-open-super-view","super-preview-custom-class","min-char","font-size","style"])):o.createCommentVNode("",!0),o.createElementVNode("div",{id:"editor-container",class:"relative overflow-y-auto flex flex-col",style:o.normalizeStyle(r.autoHeight?{height:"auto",minHeight:o.unref(an)(o.unref(Oe))}:{height:o.unref(an)(o.unref(He))})},[o.createElementVNode("div",XZ,[o.withDirectives(o.createVNode(FZ,{ref_key:"superTextViewRef",ref:te,editor:o.unref(M),"super-preview-custom-class":N.superPreviewCustomClass,"min-chars":N.minChar.superPreview,"font-size":_.value},null,8,["editor","super-preview-custom-class","min-chars","font-size"]),[[o.vShow,G.value]]),o.createElementVNode("div",{id:"editor-panel",ref_key:"contentInner",ref:j,class:"flex-1 p-2.5 border border-ed-gray-400 rounded-[3px] focus-within:border-ed-input-focus"},[o.createVNode(bb,{ref_key:"selectContextMenuRef",ref:Z,editor:o.unref(M),mode:N.mode,"super-text-store":o.unref(b)},{default:o.withCtx(()=>[o.createVNode(o.unref(Xn),{editor:o.unref(M),spellcheck:"true",class:o.normalizeClass(o.unref(ke)("h-full break-all",N.mode===o.unref(Be).PLAIN_TEXT&&"plain-text"))},null,8,["editor","class"])]),_:1},8,["editor","mode","super-text-store"])],512)])],4)],4))],6)],6)):o.createCommentVNode("",!0)}}}),YZ=o.defineComponent({__name:"Switch",props:{defaultChecked:{type:Boolean},checked:{type:Boolean},disabled:{type:Boolean},required:{type:Boolean},name:{},id:{},value:{},asChild:{type:Boolean},as:{},class:{},customClassThumb:{}},emits:["update:checked"],setup(t,{emit:e}){const n=t,r=e,i=o.computed(()=>{const{class:a,customClassThumb:l,...u}=n;return u}),s=It(i,r);return(a,l)=>(o.openBlock(),o.createBlock(o.unref(cD),o.mergeProps(o.unref(s),{class:o.unref(ke)("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ed-ring focus-visible:ring-offset-2 focus-visible:ring-offset-ed-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-ed-primary data-[state=unchecked]:bg-ed-input",n.class)}),{default:o.withCtx(()=>[o.createVNode(o.unref(dD),{class:o.normalizeClass(o.unref(ke)("pointer-events-none block h-4 w-4 rounded-full bg-ed-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0",n.customClassThumb))},null,8,["class"])]),_:1},16,["class"]))}}),JZ={class:"text-red-500 relative -top-1"},Ec=o.defineComponent({__name:"EditorFieldName",props:{fieldName:{},disabled:{type:Boolean,default:!1},isRequired:{type:Boolean,default:!1}},setup(t){return(e,n)=>(o.openBlock(),o.createElementBlock("div",{class:o.normalizeClass(o.unref(ke)("label-large",e.fieldName.customClass))},[o.createElementVNode("span",null,o.toDisplayString(e.fieldName.label),1),o.withDirectives(o.createElementVNode("span",JZ," •",512),[[o.vShow,e.fieldName.isRequired]])],2))}}),eh={__name:"splitpanes",props:{horizontal:{type:Boolean,default:!1},pushOtherPanes:{type:Boolean,default:!0},maximizePanes:{type:Boolean,default:!0},rtl:{type:Boolean,default:!1},firstSplitter:{type:Boolean,default:!1}},emits:["ready","resize","resized","pane-click","pane-maximize","pane-add","pane-remove","splitter-click","splitter-dblclick"],setup(t,{emit:e}){const n=e,r=t,i=o.useSlots(),s=o.ref([]),a=o.computed(()=>s.value.reduce((Z,ne)=>(Z[~~ne.id]=ne)&&Z,{})),l=o.computed(()=>s.value.length),u=o.ref(null),c=o.ref(!1),f=o.ref({mouseDown:!1,dragging:!1,activeSplitter:null,cursorOffset:0}),p=o.ref({splitter:null,timeoutId:null}),m=o.computed(()=>({[`splitpanes splitpanes--${r.horizontal?"horizontal":"vertical"}`]:!0,"splitpanes--dragging":f.value.dragging})),g=()=>{document.addEventListener("mousemove",w,{passive:!1}),document.addEventListener("mouseup",x),"ontouchstart"in window&&(document.addEventListener("touchmove",w,{passive:!1}),document.addEventListener("touchend",x))},b=()=>{document.removeEventListener("mousemove",w,{passive:!1}),document.removeEventListener("mouseup",x),"ontouchstart"in window&&(document.removeEventListener("touchmove",w,{passive:!1}),document.removeEventListener("touchend",x))},v=(Z,ne)=>{const ce=Z.target.closest(".splitpanes__splitter");if(ce){const{left:de,top:ge}=ce.getBoundingClientRect(),{clientX:N,clientY:ve}="ontouchstart"in window&&Z.touches?Z.touches[0]:Z;f.value.cursorOffset=r.horizontal?ve-ge:N-de}g(),f.value.mouseDown=!0,f.value.activeSplitter=ne},w=Z=>{f.value.mouseDown&&(Z.preventDefault(),f.value.dragging=!0,requestAnimationFrame(()=>{T(_(Z)),Oe("resize",{event:Z},!0)}))},x=Z=>{f.value.dragging&&(window.getSelection().removeAllRanges(),Oe("resized",{event:Z},!0)),f.value.mouseDown=!1,f.value.activeSplitter=null,setTimeout(()=>{f.value.dragging=!1,b()},100)},k=(Z,ne)=>{"ontouchstart"in window&&(Z.preventDefault(),p.value.splitter===ne?(clearTimeout(p.value.timeoutId),p.value.timeoutId=null,E(Z,ne),p.value.splitter=null):(p.value.splitter=ne,p.value.timeoutId=setTimeout(()=>p.value.splitter=null,500))),f.value.dragging||Oe("splitter-click",{event:Z,index:ne},!0)},E=(Z,ne)=>{if(Oe("splitter-dblclick",{event:Z,index:ne},!0),r.maximizePanes){let ce=0;s.value=s.value.map((de,ge)=>(de.size=ge===ne?de.max:de.min,ge!==ne&&(ce+=de.min),de)),s.value[ne].size-=ce,Oe("pane-maximize",{event:Z,index:ne,pane:s.value[ne]}),Oe("resized",{event:Z,index:ne},!0)}},C=(Z,ne)=>{Oe("pane-click",{event:Z,index:a.value[ne].index,pane:a.value[ne]})},_=Z=>{const ne=u.value.getBoundingClientRect(),{clientX:ce,clientY:de}="ontouchstart"in window&&Z.touches?Z.touches[0]:Z;return{x:ce-(r.horizontal?0:f.value.cursorOffset)-ne.left,y:de-(r.horizontal?f.value.cursorOffset:0)-ne.top}},A=Z=>{Z=Z[r.horizontal?"y":"x"];const ne=u.value[r.horizontal?"clientHeight":"clientWidth"];return r.rtl&&!r.horizontal&&(Z=ne-Z),Z*100/ne},T=Z=>{const ne=f.value.activeSplitter;let ce={prevPanesSize:I(ne),nextPanesSize:M(ne),prevReachedMinPanes:0,nextReachedMinPanes:0};const de=0+(r.pushOtherPanes?0:ce.prevPanesSize),ge=100-(r.pushOtherPanes?0:ce.nextPanesSize),N=Math.max(Math.min(A(Z),ge),de);let ve=[ne,ne+1],Re=s.value[ve[0]]||null,We=s.value[ve[1]]||null;const pt=Re.max<100&&N>=Re.max+ce.prevPanesSize,kt=We.max<100&&N<=100-(We.max+M(ne+1));if(pt||kt){pt?(Re.size=Re.max,We.size=Math.max(100-Re.max-ce.prevPanesSize-ce.nextPanesSize,0)):(Re.size=Math.max(100-We.max-ce.prevPanesSize-M(ne+1),0),We.size=We.max);return}if(r.pushOtherPanes){const z=L(ce,N);if(!z)return;({sums:ce,panesToResize:ve}=z),Re=s.value[ve[0]]||null,We=s.value[ve[1]]||null}Re!==null&&(Re.size=Math.min(Math.max(N-ce.prevPanesSize-ce.prevReachedMinPanes,Re.min),Re.max)),We!==null&&(We.size=Math.min(Math.max(100-N-ce.nextPanesSize-ce.nextReachedMinPanes,We.min),We.max))},L=(Z,ne)=>{const ce=f.value.activeSplitter,de=[ce,ce+1];return ne<Z.prevPanesSize+s.value[de[0]].min&&(de[0]=j(ce).index,Z.prevReachedMinPanes=0,de[0]<ce&&s.value.forEach((ge,N)=>{N>de[0]&&N<=ce&&(ge.size=ge.min,Z.prevReachedMinPanes+=ge.min)}),Z.prevPanesSize=I(de[0]),de[0]===void 0)?(Z.prevReachedMinPanes=0,s.value[0].size=s.value[0].min,s.value.forEach((ge,N)=>{N>0&&N<=ce&&(ge.size=ge.min,Z.prevReachedMinPanes+=ge.min)}),s.value[de[1]].size=100-Z.prevReachedMinPanes-s.value[0].min-Z.prevPanesSize-Z.nextPanesSize,null):ne>100-Z.nextPanesSize-s.value[de[1]].min&&(de[1]=D(ce).index,Z.nextReachedMinPanes=0,de[1]>ce+1&&s.value.forEach((ge,N)=>{N>ce&&N<de[1]&&(ge.size=ge.min,Z.nextReachedMinPanes+=ge.min)}),Z.nextPanesSize=M(de[1]-1),de[1]===void 0)?(Z.nextReachedMinPanes=0,s.value.forEach((ge,N)=>{N<l.value-1&&N>=ce+1&&(ge.size=ge.min,Z.nextReachedMinPanes+=ge.min)}),s.value[de[0]].size=100-Z.prevPanesSize-M(de[0]-1),null):{sums:Z,panesToResize:de}},I=Z=>s.value.reduce((ne,ce,de)=>ne+(de<Z?ce.size:0),0),M=Z=>s.value.reduce((ne,ce,de)=>ne+(de>Z+1?ce.size:0),0),j=Z=>[...s.value].reverse().find(ne=>ne.index<Z&&ne.size>ne.min)||{},D=Z=>s.value.find(ne=>ne.index>Z+1&&ne.size>ne.min)||{},Q=()=>{var Z;const ne=Array.from(((Z=u.value)==null?void 0:Z.children)||[]);for(const ce of ne){const de=ce.classList.contains("splitpanes__pane"),ge=ce.classList.contains("splitpanes__splitter");!de&&!ge&&(ce.remove(),console.warn("Splitpanes: Only <pane> elements are allowed at the root of <splitpanes>. One of your DOM nodes was removed."))}},te=(Z,ne,ce=!1)=>{const de=Z-1,ge=document.createElement("div");ge.classList.add("splitpanes__splitter"),ce||(ge.onmousedown=N=>v(N,de),typeof window<"u"&&"ontouchstart"in window&&(ge.ontouchstart=N=>v(N,de)),ge.onclick=N=>k(N,de+1)),ge.ondblclick=N=>E(N,de+1),ne.parentNode.insertBefore(ge,ne)},H=Z=>{Z.onmousedown=void 0,Z.onclick=void 0,Z.ondblclick=void 0,Z.remove()},F=()=>{var Z;const ne=Array.from(((Z=u.value)==null?void 0:Z.children)||[]);for(const de of ne)de.className.includes("splitpanes__splitter")&&H(de);let ce=0;for(const de of ne)de.className.includes("splitpanes__pane")&&(!ce&&r.firstSplitter?te(ce,de,!0):ce&&te(ce,de),ce++)},P=({uid:Z,...ne})=>{const ce=a.value[Z];for(const[de,ge]of Object.entries(ne))ce[de]=ge},q=Z=>{var ne;let ce=-1;Array.from(((ne=u.value)==null?void 0:ne.children)||[]).some(de=>(de.className.includes("splitpanes__pane")&&ce++,de.isSameNode(Z.el))),s.value.splice(ce,0,{...Z,index:ce}),s.value.forEach((de,ge)=>de.index=ge),c.value&&o.nextTick(()=>{F(),G({addedPane:s.value[ce]}),Oe("pane-add",{pane:s.value[ce]})})},J=Z=>{const ne=s.value.findIndex(de=>de.id===Z);s.value[ne].el=null;const ce=s.value.splice(ne,1)[0];s.value.forEach((de,ge)=>de.index=ge),o.nextTick(()=>{F(),Oe("pane-remove",{pane:ce}),G({removedPane:{...ce}})})},G=(Z={})=>{!Z.addedPane&&!Z.removedPane?xe():s.value.some(ne=>ne.givenSize!==null||ne.min||ne.max<100)?Ce(Z):oe(),c.value&&Oe("resized")},oe=()=>{const Z=100/l.value;let ne=0;const ce=[],de=[];for(const ge of s.value)ge.size=Math.max(Math.min(Z,ge.max),ge.min),ne-=ge.size,ge.size>=ge.max&&ce.push(ge.id),ge.size<=ge.min&&de.push(ge.id);ne>.1&&He(ne,ce,de)},xe=()=>{let Z=100;const ne=[],ce=[];let de=0;for(const N of s.value)Z-=N.size,N.givenSize!==null&&de++,N.size>=N.max&&ne.push(N.id),N.size<=N.min&&ce.push(N.id);let ge=100;if(Z>.1){for(const N of s.value)N.givenSize===null&&(N.size=Math.max(Math.min(Z/(l.value-de),N.max),N.min)),ge-=N.size;ge>.1&&He(ge,ne,ce)}},Ce=({addedPane:Z,removedPane:ne}={})=>{let ce=100/l.value,de=0;const ge=[],N=[];((Z==null?void 0:Z.givenSize)??null)!==null&&(ce=(100-Z.givenSize)/(l.value-1));for(const ve of s.value)de-=ve.size,ve.size>=ve.max&&ge.push(ve.id),ve.size<=ve.min&&N.push(ve.id);if(!(Math.abs(de)<.1)){for(const ve of s.value)(Z==null?void 0:Z.givenSize)!==null&&(Z==null?void 0:Z.id)===ve.id||(ve.size=Math.max(Math.min(ce,ve.max),ve.min)),de-=ve.size,ve.size>=ve.max&&ge.push(ve.id),ve.size<=ve.min&&N.push(ve.id);de>.1&&He(de,ge,N)}},He=(Z,ne,ce)=>{let de;Z>0?de=Z/(l.value-ne.length):de=Z/(l.value-ce.length),s.value.forEach((ge,N)=>{if(Z>0&&!ne.includes(ge.id)){const ve=Math.max(Math.min(ge.size+de,ge.max),ge.min),Re=ve-ge.size;Z-=Re,ge.size=ve}else if(!ce.includes(ge.id)){const ve=Math.max(Math.min(ge.size+de,ge.max),ge.min),Re=ve-ge.size;Z-=Re,ge.size=ve}}),Math.abs(Z)>.1&&o.nextTick(()=>{c.value&&console.warn("Splitpanes: Could not resize panes correctly due to their constraints.")})},Oe=(Z,ne=void 0,ce=!1)=>{const de=(ne==null?void 0:ne.index)??f.value.activeSplitter??null;n(Z,{...ne,...de!==null&&{index:de},...ce&&de!==null&&{prevPane:s.value[de-(r.firstSplitter?1:0)],nextPane:s.value[de+(r.firstSplitter?0:1)]},panes:s.value.map(ge=>({min:ge.min,max:ge.max,size:ge.size}))})};o.watch(()=>r.firstSplitter,()=>F()),o.onMounted(()=>{Q(),F(),G(),Oe("ready"),c.value=!0}),o.onBeforeUnmount(()=>c.value=!1);const De=()=>{var Z;return o.h("div",{ref:u,class:m.value},(Z=i.default)==null?void 0:Z.call(i))};return o.provide("panes",s),o.provide("indexedPanes",a),o.provide("horizontal",o.computed(()=>r.horizontal)),o.provide("requestUpdate",P),o.provide("onPaneAdd",q),o.provide("onPaneRemove",J),o.provide("onPaneClick",C),(Z,ne)=>(o.openBlock(),o.createBlock(o.resolveDynamicComponent(De)))}},Ko={__name:"pane",props:{size:{type:[Number,String]},minSize:{type:[Number,String],default:0},maxSize:{type:[Number,String],default:100}},setup(t){var e;const n=t,r=o.inject("requestUpdate"),i=o.inject("onPaneAdd"),s=o.inject("horizontal"),a=o.inject("onPaneRemove"),l=o.inject("onPaneClick"),u=(e=o.getCurrentInstance())==null?void 0:e.uid,c=o.inject("indexedPanes"),f=o.computed(()=>c.value[u]),p=o.ref(null),m=o.computed(()=>{const w=isNaN(n.size)||n.size===void 0?0:parseFloat(n.size);return Math.max(Math.min(w,b.value),g.value)}),g=o.computed(()=>{const w=parseFloat(n.minSize);return isNaN(w)?0:w}),b=o.computed(()=>{const w=parseFloat(n.maxSize);return isNaN(w)?100:w}),v=o.computed(()=>{var w;return`${s.value?"height":"width"}: ${(w=f.value)==null?void 0:w.size}%`});return o.watch(()=>m.value,w=>r({uid:u,size:w})),o.watch(()=>g.value,w=>r({uid:u,min:w})),o.watch(()=>b.value,w=>r({uid:u,max:w})),o.onMounted(()=>{i({id:u,el:p.value,min:g.value,max:b.value,givenSize:n.size===void 0?null:m.value,size:m.value})}),o.onBeforeUnmount(()=>a(u)),(w,x)=>(o.openBlock(),o.createElementBlock("div",{ref_key:"paneEl",ref:p,class:"splitpanes__pane",onClick:x[0]||(x[0]=k=>o.unref(l)(k,w._.uid)),style:o.normalizeStyle(v.value)},[o.renderSlot(w.$slots,"default")],4))}},ZZ={class:"px-5 py-2.5"},QZ={key:0,class:"px-5 py-2.5"},NZ={key:1,class:"px-5 py-2.5"},eQ={key:2,class:"px-5 py-2.5"},tQ={class:"px-5 py-2.5"},nQ=o.defineComponent({__name:"EditorViewMobile",props:{extensions:{},mode:{},hideComment:{type:Boolean},fieldNameComment:{},fieldNameCommentCuesheet:{},fieldNameContent:{},comment:{},commentCuesheet:{},content:{},isEditorViewSplitContent:{type:Boolean}},setup(t){const e=t,n=o.computed(()=>{var v;return(v=e.extensions)==null?void 0:v.filter(w=>w.name!=="spellchecker")}),r=o.ref(),i=o.ref(),s=o.ref();o.onBeforeUnmount(()=>{r.value&&r.value.destroy(),i.value&&i.value.destroy(),s.value&&s.value.destroy()});function a(v){return new Oo({extensions:n.value,content:v,editable:!1,parseOptions:{preserveWhitespace:"full"}})}r.value=a(pn(e.comment,!0,e.mode)),i.value=a(pn(e.commentCuesheet,!0,e.mode)),s.value=a(pn(e.content,!0,e.mode));function l(v,w){if(!v)return;const x=pn(w,!0,e.mode);tt.isEqual(v.getHTML(),x)||v.commands.setContent(x,!1,{preserveWhitespace:"full"})}o.watch(()=>e.comment,v=>{l(r.value,v)}),o.watch(()=>e.commentCuesheet,v=>{l(i.value,v)}),o.watch(()=>e.content,v=>{l(s.value,v)});const{isScrolling:u,handleScroll:c}=wa(),{isScrolling:f,handleScroll:p}=wa(),m=o.computed(()=>e.mode!==Be.EDITOR?!0:!e.hideComment),g=o.computed(()=>e.mode!==Be.REPORT?!0:e.mode===Be.REPORT&&!e.hideComment),b=o.computed(()=>e.mode===Be.STRAIGHT||e.mode===Be.PLAIN_TEXT||!m.value);return(v,w)=>{const x=Ec;return o.openBlock(),o.createBlock(o.unref(eh),{horizontal:"",class:"flex-1"},{default:o.withCtx(()=>[o.unref(b)?(o.openBlock(),o.createBlock(o.unref(Ko),{key:0,class:o.normalizeClass(o.unref(ke)("!overflow-y-auto border border-ed-gray rounded-md",!v.isEditorViewSplitContent&&"border-none",!o.unref(f)&&"scrollbar-thumb-transparent")),onScroll:o.unref(p)},{default:o.withCtx(()=>[o.createElementVNode("div",ZZ,[v.fieldNameContent?(o.openBlock(),o.createBlock(x,{key:0,"field-name":v.fieldNameContent,class:"leading-7 font-medium text-blue-500"},null,8,["field-name"])):o.createCommentVNode("",!0),o.createVNode(o.unref(Xn),{editor:o.unref(s)},null,8,["editor"])])]),_:1},8,["class","onScroll"])):(o.openBlock(),o.createElementBlock(o.Fragment,{key:1},[o.unref(m)?(o.openBlock(),o.createBlock(o.unref(Ko),{key:0,class:o.normalizeClass(o.unref(ke)("!overflow-y-auto border border-ed-gray rounded-md",!v.isEditorViewSplitContent&&"border-none",!o.unref(u)&&"scrollbar-thumb-transparent")),onScroll:o.unref(c)},{default:o.withCtx(()=>[o.createElementVNode("div",{class:o.normalizeClass(o.unref(ke)("divide-y divide-ed-gray divide-dashed"))},[o.unref(g)?(o.openBlock(),o.createElementBlock("div",QZ,[v.fieldNameComment?(o.openBlock(),o.createBlock(x,{key:0,"field-name":v.fieldNameComment,class:"leading-7 font-medium text-blue-500"},null,8,["field-name"])):o.createCommentVNode("",!0),o.createVNode(o.unref(Xn),{editor:o.unref(r)},null,8,["editor"])])):o.createCommentVNode("",!0),v.mode===o.unref(Be).REPORT?(o.openBlock(),o.createElementBlock("div",NZ,[v.fieldNameCommentCuesheet?(o.openBlock(),o.createBlock(x,{key:0,"field-name":v.fieldNameCommentCuesheet,class:"leading-7 font-medium text-blue-500"},null,8,["field-name"])):o.createCommentVNode("",!0),o.createVNode(o.unref(Xn),{editor:o.unref(i)},null,8,["editor"])])):o.createCommentVNode("",!0),v.isEditorViewSplitContent?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("div",eQ,[v.fieldNameContent?(o.openBlock(),o.createBlock(x,{key:0,"field-name":v.fieldNameContent,class:"leading-7 font-medium text-blue-500"},null,8,["field-name"])):o.createCommentVNode("",!0),o.createVNode(o.unref(Xn),{editor:o.unref(s)},null,8,["editor"])]))],2)]),_:1},8,["class","onScroll"])):o.createCommentVNode("",!0),v.isEditorViewSplitContent?(o.openBlock(),o.createBlock(o.unref(Ko),{key:1,class:o.normalizeClass(o.unref(ke)("!overflow-y-auto border border-ed-gray rounded-md",!o.unref(f)&&"scrollbar-thumb-transparent")),onScroll:o.unref(p)},{default:o.withCtx(()=>[o.createElementVNode("div",tQ,[v.fieldNameContent?(o.openBlock(),o.createBlock(x,{key:0,"field-name":v.fieldNameContent,class:"leading-7 font-medium text-blue-500"},null,8,["field-name"])):o.createCommentVNode("",!0),o.createVNode(o.unref(Xn),{editor:o.unref(s)},null,8,["editor"])])]),_:1},8,["class","onScroll"])):o.createCommentVNode("",!0)],64))]),_:1})}}}),rQ={class:"flex gap-2 items-center overflow-x-auto overflow-y-hidden min-h-11 scrollbar-hide"},oQ=o.defineComponent({__name:"ToolbarFormat",props:{editor:{},disabled:{type:Boolean,default:!1},mode:{},activeExtensions:{default:()=>[]}},setup(t){const{t:e}=Ot(),n=t,r=["fontSize","fontFamily","superText","spellchecker",dE],i=o.computed(()=>{const l=[...n.editor.extensionManager.extensions];let u=[];for(const c of l){const{button:f,divider:p=!1,spacer:m=!1,toolbar:g=!0}=c.options;if(!f||!_0(f)||!g)continue;const b=f({editor:n.editor,extension:c,t:o.unref(e),isMobile:!0});if(Array.isArray(b)){const v=b.map((w,x)=>({id:`${c.name}`,button:w,divider:x===b.length-1?p:!1,spacer:x===0?m:!1}));u=[...u,...v];continue}u.push({button:b,divider:p,spacer:m,id:`${c.name}`})}return n.activeExtensions.length?u.filter(c=>c.id&&n.activeExtensions.includes(c.id)):(r.length&&(u=u.filter(c=>c.id&&!r.includes(c.id))),u)}),s=l=>l.id==="spellchecker"?"!text-ed-blue !bg-white !font-normal rounded [&>div>svg]:w-[19px] [&>div>svg]:h-[19px] h-[26px] gap-x-1 whitespace-nowrap":l.button.componentProps.customClass,a=l=>l.id==="spellchecker"?"Spellchecker":l.button.componentProps.icon;return(l,u)=>(o.openBlock(),o.createElementBlock("div",{id:"tool-bar-format",class:o.normalizeClass(o.unref(ke)("bg-white border border-gray-100 dark:bg-ed-gray-500 dark:border-ed-muted rounded-full shadow-elevation2 px-2.5",!i.value.length&&"hidden"))},[o.createElementVNode("div",rQ,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(i.value,(c,f)=>{var p;return o.openBlock(),o.createBlock(o.resolveDynamicComponent(c.button.component),o.mergeProps({key:f,id:c.id,ref_for:!0},c.button.componentProps,{editor:l.editor,disabled:l.disabled||((p=c.button.componentProps)==null?void 0:p.disabled),"custom-class":s(c),icon:a(c)}),o.createSlots({_:2},[o.renderList(c.button.componentSlots,(m,g,b)=>({name:`${g}`,fn:o.withCtx(v=>[(o.openBlock(),o.createBlock(o.resolveDynamicComponent(m),o.mergeProps({ref_for:!0},v==null?void 0:v.props,{id:c.id}),null,16,["id"]))])}))]),1040,["id","editor","disabled","custom-class","icon"])}),128))])],2))}}),iQ={class:"flex gap-2 items-center overflow-x-auto"},Kk=o.defineComponent({__name:"ToolbarMobile",props:{editor:{},disabled:{type:Boolean,default:!1},mode:{},activeExtensions:{default:()=>[cE,hc,ub]},customClassToolbar:{}},setup(t){const{t:e}=Ot(),n=t,r=o.inject("isEditable",o.ref(!0)),i=o.computed(()=>{const u=[...n.editor.extensionManager.extensions],c=u.find(m=>m.name===ub);let f=u.sort((m,g)=>m.name==="spellchecker"?-1:g.name==="spellchecker"||m.name==="superText"?1:g.name==="superText"?-1:0);c&&(f=u.sort((m,g)=>m.name==="configPlan"?1:g.name==="configPlan"?-1:0));let p=[];for(const m of f){const{button:g,divider:b=!1,spacer:v=!1,toolbar:w=!0}=m.options;if(!g||!_0(g)||!w)continue;const x=g({editor:n.editor,extension:m,t:o.unref(e),isMobile:!0});if(Array.isArray(x)){const k=x.map((E,C)=>({id:`${m.name}`,button:E,divider:C===x.length-1?b:!1,spacer:C===0?v:!1}));p=[...p,...k];continue}p.push({button:x,divider:b,spacer:v,id:`${m.name}`})}if(!r.value){const m=p.find(g=>g.id==="superText");m&&(m.button.componentProps.disabled=!0)}return n.activeExtensions.length?p.filter(m=>m.id&&n.activeExtensions.includes(m.id)):p}),s=u=>u.id==="spellchecker"?"!text-ed-blue data-[state=off]:bg-white dark:data-[state=off]:bg-ed-accent/40 !font-normal rounded [&>div>svg]:w-[19px] [&>div>svg]:h-[19px] h-[26px] gap-x-1 whitespace-nowrap":u.button.componentProps.customClass,a=u=>u.id==="spellchecker"?"Spellchecker":u.button.componentProps.icon,l=o.ref(!1);return(u,c)=>{const f=fE;return o.openBlock(),o.createElementBlock("div",{id:"tool-bar",class:o.normalizeClass(o.unref(ke)("z-10 border border-ed-input rounded-[5px] px-2.5 py-[5px] leading-none",!i.value.length&&"hidden",u.customClassToolbar))},[o.createElementVNode("div",iQ,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(i.value,(p,m)=>{var g,b,v;return o.openBlock(),o.createElementBlock(o.Fragment,{key:m},[p.spacer&&m!==0?(o.openBlock(),o.createBlock(o.unref(di),{key:0,orientation:"vertical",class:"h-[16px] mx-[10px]"})):o.createCommentVNode("",!0),(o.openBlock(),o.createBlock(o.resolveDynamicComponent(p.button.component),o.mergeProps({id:p.id,ref_for:!0},p.button.componentProps,{editor:u.editor,disabled:u.disabled||((g=p.button.componentProps)==null?void 0:g.disabled),"custom-class":s(p),icon:a(p)}),o.createSlots({_:2},[o.renderList(p.button.componentSlots,(w,x,k)=>({name:`${x}`,fn:o.withCtx(E=>[(o.openBlock(),o.createBlock(o.resolveDynamicComponent(w),o.mergeProps({ref_for:!0},E==null?void 0:E.props,{id:p.id}),null,16,["id"]))])}))]),1040,["id","editor","disabled","custom-class","icon"])),p.id===hc&&o.unref(l)?(o.openBlock(),o.createBlock(f,{key:1,class:"bg-white border-inherit w-[26px] h-[26px] shadow-none",checked:(v=(b=p.button.componentProps).isActive)==null?void 0:v.call(b),"onUpdate:checked":w=>{var x,k;return(k=(x=p.button.componentProps).action)==null?void 0:k.call(x)}},null,8,["checked","onUpdate:checked"])):o.createCommentVNode("",!0),p.divider?(o.openBlock(),o.createBlock(o.unref(di),{key:2,orientation:"vertical",class:"mx-2 h-auto"})):o.createCommentVNode("",!0)],64)}),128))])],2)}}}),sQ={class:"flex w-fit rounded-md bg-ed-gray-600 text-white max-w-full overflow-x-auto"},aQ=Io(o.defineComponent({__name:"MainBubbleMenuList",props:{editor:{},mode:{},disableSuperInput:{type:Boolean},hasClipboard:{type:Boolean}},emits:["close-long-press-menu"],setup(t,{emit:e}){const n=t,r=e,{t:i}=Ot(),s=o.computed(()=>[...n.editor.extensionManager.extensions].find(p=>p.name==="superText")),a=o.ref(!1),l=o.computed(()=>n.editor.storage.deviceEnv.specialCharModal),u=f=>{const{state:p}=n.editor,{from:m}=p.selection;n.editor.commands.insertContentAt(m,f)},c=()=>{n.editor.chain().focus().toggleSuperInputMoblie().run(),r("close-long-press-menu");const f=PK(n.editor);n.editor.commands.setSuperTextContent(f)};return(f,p)=>{var m,g,b;return o.openBlock(),o.createElementBlock(o.Fragment,null,[o.createElementVNode("div",sQ,[o.unref(s)&&!f.disableSuperInput&&f.mode!==o.unref(Be).EDITOR?(o.openBlock(),o.createElementBlock("button",{key:0,class:"bubble-menu-item",onClick:c},o.toDisplayString(o.unref(i)("editor.super")),1)):o.createCommentVNode("",!0),o.createElementVNode("button",{class:"bubble-menu-item",onClick:p[0]||(p[0]=v=>a.value=!0)},o.toDisplayString(o.unref(i)("editor.insertSpecial")),1),f.hasClipboard?(o.openBlock(),o.createElementBlock("button",{key:1,class:"bubble-menu-item",onClick:p[1]||(p[1]=v=>f.editor.chain().focus().pasteContent().run())},o.toDisplayString(o.unref(i)("editor.paste")),1)):o.createCommentVNode("",!0),o.createElementVNode("button",{class:"bubble-menu-item",onClick:p[2]||(p[2]=v=>f.editor.chain().focus().cutContent().run())},o.toDisplayString(o.unref(i)("editor.cut")),1),o.createElementVNode("button",{class:"bubble-menu-item",onClick:p[3]||(p[3]=()=>{f.editor.chain().focus().copyContent().setTextSelection(0).blur().run(),r("close-long-press-menu")})},o.toDisplayString(o.unref(i)("editor.copy")),1),o.createElementVNode("button",{class:"bubble-menu-item",onClick:p[4]||(p[4]=v=>f.editor.chain().focus().selectAll().run())},o.toDisplayString(o.unref(i)("editor.selectAll")),1)]),(o.openBlock(),o.createBlock(o.Teleport,{to:"body"},[(o.openBlock(),o.createBlock(o.resolveDynamicComponent((m=o.unref(l))==null?void 0:m.component),{"is-open":o.unref(a),open:o.unref(a),class:o.normalizeClass((b=(g=o.unref(l))==null?void 0:g.componentProps)==null?void 0:b.class),onSelectedChar:u,onClose:p[5]||(p[5]=v=>a.value=!1)},null,40,["is-open","open","class"]))]))],64)}}}),[["__scopeId","data-v-edf74589"]]);class Gk{isNativeWebViewAvailable(){return window.ReactNativeWebView!==void 0}getDevicePlatform(){var r;if(!this.isNativeWebViewAvailable())return;if(typeof window.webkit=="object"&&typeof((r=window.webkit)==null?void 0:r.messageHandlers)=="object")return E0.IOS;const n=navigator.userAgent.toLowerCase();if(n.includes("android"))return E0.ANDROID;if(n.includes("iphone")||n.includes("ipad")||n.includes("ipod"))return E0.IOS}sendToNative(e,n){if(window.ReactNativeWebView){const r={type:e,data:n};window.ReactNativeWebView.postMessage(JSON.stringify(r)),console.log(`Sent message to native: ${e}`)}else console.log("ReactNativeWebView not available")}receiveDataFromNative(e,n){const r=window.receiveDriverData;window.receiveDriverData=i=>{try{const s=JSON.parse(i);s.type===e?(console.log(`Received data from native ${e}`),n(s.data)):r&&r(i)}catch(s){console.log("Error parsing data from native",s)}}}}const Xk=o.defineComponent({__name:"MainBubbleMenu",props:{editor:{},mode:{},disableSuperInput:{type:Boolean}},setup(t){const e=t,n=new Gk,r=o.ref(!1),i=async()=>{var g,b;const m=await((b=(g=e.editor).hasClipboard)==null?void 0:b.call(g));r.value=!!m},s={duration:200,placement:"bottom",appendTo:()=>document.body.querySelector(".splitpanes__pane"),onShow:()=>{i(),n.sendToNative("hideIOSEditMenu")},getReferenceClientRect:()=>{if(e.editor&&!e.editor.isDestroyed){const{view:m,state:g}=e.editor,{from:b,to:v}=g.selection,w=m.dom.getBoundingClientRect(),x=m.coordsAtPos(b),k=m.coordsAtPos(v),E=Math.min(x.top,k.top),_=Math.max(x.bottom,k.bottom)-E;return new DOMRect(w.left,E,w.width,_)}return null}},a=o.ref(null),l=o.ref(!1),u=({editor:m,state:g})=>["image","superText","link"].some(w=>m.isActive(w))?!1:!g.selection.empty||l.value;function c(m){return f(m)&&m.touches.length>0?{x:m.touches[0].clientX,y:m.touches[0].clientY}:f(m)&&m.changedTouches.length>0?{x:m.changedTouches[0].clientX,y:m.changedTouches[0].clientY}:m instanceof MouseEvent?{x:m.clientX,y:m.clientY}:window.PointerEvent&&m instanceof PointerEvent?{x:m.clientX,y:m.clientY}:null}function f(m){return"touches"in m}function p(m){if(!e.editor)return;const g=c(m);if(!g)return;const b=e.editor.view,v=b.state,w=b.posAtCoords({left:g.x,top:g.y});if(!w||w.inside===-1)return;const x=w.pos,k=v.doc.content.size,E=Math.min(x+1,k);let C=v.tr;C=C.setSelection(Ae.create(v.doc,x,E)),b.dispatch(C),requestAnimationFrame(()=>{const _=b.state.tr.setSelection(Ae.create(b.state.doc,x,x));b.dispatch(_),b.focus()})}return o.onMounted(()=>{const m=e.editor.view.dom;mt.onLongPress(o.ref(m),v=>{l.value=!0,p(v)},{delay:500,modifiers:{prevent:!1}});const g=()=>{e.editor.state.selection.empty&&(l.value=!1)};m.addEventListener("pointerdown",g);const b=({transaction:v})=>{l.value&&v.docChanged&&(l.value=!1,o.nextTick(()=>{var w;try{const x=(w=a.value)==null?void 0:w.$el;x&&x._tippy&&typeof x._tippy.hide=="function"&&x._tippy.hide()}catch{const k=e.editor.view,E=k.state,C=E.selection.from,_=E.doc.content.size,A=Math.min(C+1,_);k.dispatch(E.tr.setSelection(Ae.create(E.doc,C,A))),requestAnimationFrame(()=>{k.dispatch(k.state.tr.setSelection(Ae.create(k.state.doc,C,C)))})}}))};e.editor.on("transaction",b),o.onUnmounted(()=>{m.removeEventListener("pointerdown",g),e.editor.off("transaction",b)})}),(m,g)=>(o.openBlock(),o.createBlock(o.unref(Tu),{ref_key:"bubbleMenuRef",ref:a,editor:m.editor,"tippy-options":s,"should-show":u},{default:o.withCtx(()=>[o.createVNode(aQ,{editor:m.editor,mode:m.mode,disableSuperInput:m.disableSuperInput,hasClipboard:o.unref(r),onCloseLongPressMenu:g[0]||(g[0]=b=>l.value=!1)},null,8,["editor","mode","disableSuperInput","hasClipboard"])]),_:1},8,["editor"]))}}),lQ={class:"flex items-center justify-between label-large mb-2"},uQ={class:"mb-5"},cQ={class:"flex gap-x-3"},dQ=o.defineComponent({__name:"SuperInputBottomSheet",props:{editor:{},open:{type:Boolean},bottomSheetComponent:{}},emits:["save","close"],setup(t,{emit:e}){const n=t,r=e,i=o.ref(""),s=o.ref(""),a=o.computed(()=>Mp(i.value)),l=()=>{i.value="",s.value="",n.editor.commands.setSuperTextContent(i.value,s.value)},u=()=>{l(),r("close")};o.watch(()=>n.open,()=>{n.open&&(i.value=n.editor.storage.superText.superTextContent,s.value=n.editor.storage.superText.superTextPosition)});const c=()=>{i.value=n.editor.storage.superText.superTextContent},f=()=>{r("save",i.value,s.value),l()};return(p,m)=>{var b;const g=Lt;return o.openBlock(),o.createBlock(o.resolveDynamicComponent((b=p.bottomSheetComponent)==null?void 0:b.component),{"is-open":p.open,type:"bottom",title:"수퍼 입력",onOnClose:u},{customContent:o.withCtx(()=>{var v;return[o.createElementVNode("div",lQ,[m[2]||(m[2]=o.createElementVNode("span",null,"내용",-1)),(o.openBlock(),o.createBlock(o.resolveDynamicComponent((v=p.bottomSheetComponent)==null?void 0:v.button),{class:"w-fit [&_svg]:size-6 text-blue",variant:"ghost",size:"icon",onClick:c},{default:o.withCtx(()=>[o.createVNode(g,{name:"reset",class:"h-5 w-5"}),m[1]||(m[1]=o.createElementVNode("span",null,"초기화",-1))]),_:1}))])]}),body:o.withCtx(()=>[o.createElementVNode("div",uQ,[o.createVNode(gb,{modelValue:o.unref(i),"onUpdate:modelValue":m[0]||(m[0]=v=>o.isRef(i)?i.value=v:null),"parent-editor":p.editor,"spellcheck-enabled":!1,autofocus:"end"},null,8,["modelValue","parent-editor"])])]),footer:o.withCtx(()=>{var v,w;return[o.createElementVNode("div",cQ,[(o.openBlock(),o.createBlock(o.resolveDynamicComponent((v=p.bottomSheetComponent)==null?void 0:v.button),{variant:"outline",onClick:u},{default:o.withCtx(()=>m[3]||(m[3]=[o.createTextVNode(" 취소 ")])),_:1})),(o.openBlock(),o.createBlock(o.resolveDynamicComponent((w=p.bottomSheetComponent)==null?void 0:w.button),{disabled:o.unref(a),variant:o.unref(a)?"disabled":"default",onClick:f},{default:o.withCtx(()=>m[4]||(m[4]=[o.createTextVNode(" 입력 ")])),_:1},8,["disabled","variant"]))])]}),_:1},40,["is-open"])}}}),Yk=Vn.create({name:"diffDel",parseHTML(){return[{tag:"span.diff-del"}]},renderHTML({HTMLAttributes:t}){return["span",{class:"diff-del",...t},0]}}),fQ=o.defineComponent({__name:"EditorCommentMoblie",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:{},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},canEditSuperReadOnly:{type:Boolean},autoFocus:{type:Boolean,default:!0},superPreviewCustomClass:{},minChar:{},isAccordion:{type:Boolean},contentAutoCopied:{},isEditorView:{type:Boolean},isEditorViewSplitContent:{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=o.useAttrs(),a=xn(),{isReady:l,editor:u,updateEditorState:c,checkSpellStore:f}=a,p=o.inject("isEditable",o.ref(!0)),m=new Oo({enablePasteRules:!1,enableInputRules:!1,content:pn(r.modelValue,r.disabled),editorProps:{attributes:{id:ir.COMMENT,[ir.DISABLE_SUPER_INPUT]:`${r.disableSuperInput}`},handleKeyDown:tt.throttle((x,k)=>k.key==="Enter"&&s.enter&&!k.shiftKey?(i("enter"),!0):!1,Bo),transformPastedHTML:x=>(x=x.replace(/\s*style="[^"]*"/g,""),x)},onCreate:({editor:x})=>{c(x)},onUpdate:tt.throttle(({editor:x})=>{l.value=!0;const k=b(x,r.output);i("update:modelValue",k),i("change",{editor:x,output:k}),c(x)},Bo),extensions:[Yk,...tt.uniqBy(tt.reverse(o.unref(r.extensions)),"name")],editable:p.value,onFocus:()=>{g()},onBlur:({editor:x,event:k})=>{i("onBlurEditor",k)}});function g(){i("setEditorSelected",m)}g();function b(x,k){if(!x)return"";if(x.isEmpty)return k==="json"?{}:"";switch(k){case"html":return x.getHTML();case"json":return x.getJSON();case"text":return x.getText();default:return""}}function v(x){return x.every(k=>m==null?void 0:m.extensionManager.extensions.find(E=>E.name===k))}o.watch(()=>f.languages,()=>{m.commands.checkSpelling()}),o.watch(()=>r.modelValue,x=>{if(!m||tt.isEqual(b(m,r.output),x))return;const{from:k,to:E}=m.state.selection;m.commands.setTextSelection({from:k,to:E}),m.commands.setContent(pn(x,r.disabled),!1)},{deep:!0}),o.watch(()=>u.value,()=>{u.value&&u.value.on("selectionUpdate",({editor:x})=>{i("changed:selection",{editor:x})})}),o.watch(()=>r.disableSuperInput,()=>{const x=document.getElementById(ir.COMMENT);x==null||x.setAttribute(ir.DISABLE_SUPER_INPUT,`${r.disableSuperInput}`)}),o.onUnmounted(()=>m==null?void 0:m.destroy()),Qu(Au.SAVE,()=>{localStorage.setItem("comment",b(m,"html"))});function w(x){m.commands.focus("end"),g()}return Qp(m),o.onMounted(()=>{var x;r.autoFocus&&w(r.mode),(x=m==null?void 0:m.commands)!=null&&x.setIsMobile&&m.commands.setIsMobile(!0)}),o.watch(()=>r.mode,x=>{r.autoFocus&&w()}),o.watch(()=>p.value,x=>{var k;m==null||m.setEditable(x),(k=m==null?void 0:m.commands)!=null&&k.setIsEnableSuggestion&&m.commands.setIsEnableSuggestion(x)},{immediate:!0}),e({editor:m}),(x,k)=>{const E=Xk,C=Zp,_=Jp,A=Yp,T=Bf;return o.openBlock(),o.createElementBlock(o.Fragment,null,[!x.hideBubble&&!x.disabled&&o.unref(p)?(o.openBlock(),o.createElementBlock(o.Fragment,{key:0},[o.createVNode(E,{editor:o.unref(m),mode:x.mode,"disable-super-input":x.disableSuperInput},null,8,["editor","mode","disable-super-input"]),v([o.unref(pc)])?(o.openBlock(),o.createBlock(C,{key:0,editor:o.unref(m)},null,8,["editor"])):o.createCommentVNode("",!0),v([o.unref(fa)])?(o.openBlock(),o.createBlock(_,{key:1,editor:o.unref(m)},null,8,["editor"])):o.createCommentVNode("",!0),v([o.unref(ps)])?(o.openBlock(),o.createBlock(A,{key:2,editor:o.unref(m)},null,8,["editor"])):o.createCommentVNode("",!0),v([o.unref(hs),o.unref(ms)])?(o.openBlock(),o.createBlock(T,{key:3,editor:o.unref(m)},null,8,["editor"])):o.createCommentVNode("",!0)],64)):o.createCommentVNode("",!0),o.createVNode(o.unref(Xn),{id:"editor-panel",editor:o.unref(m),spellcheck:"true",class:o.normalizeClass(["flex-1 flex-col relative"])},null,8,["editor"])],64)}}}),Jk=o.defineComponent({__name:"ToolbarTitle",props:{titleBar:{},customClass:{}},setup(t){return(e,n)=>(o.openBlock(),o.createElementBlock("h3",{class:o.normalizeClass(o.unref(ke)("rounded-[5px] px-2.5 py-[5px] min-h-[32px] flex items-center bg-ed-gray-500",[e.customClass],[e.titleBar.bgClass]))},o.toDisplayString(e.titleBar.title),3))}});function Zk(t=!1,e=10){const n=e,r=90,i=50,s=n+1,a=o.ref(!0),l=o.ref(!0),u=o.ref(i),c=o.ref(i);return{HEADER_ONLY_SIZE:n,FULL_SIZE:r,SPLIT_SIZE:i,pane1ContentVisible:a,pane2ContentVisible:l,pane1Size:u,pane2Size:c,togglePane:m=>{if(o.unref(t)){l.value?(l.value=!1,c.value=n):(l.value=!0,c.value=r+n);return}if(m==="pane1"){a.value&&l.value?(a.value=!1,u.value=n,c.value=r):a.value&&!l.value?(a.value=!1,l.value=!0,u.value=n,c.value=r):!a.value&&l.value?(a.value=!0,u.value=i,c.value=i):(a.value=!0,u.value=r,c.value=n);return}m==="pane2"&&(a.value&&l.value?(l.value=!1,u.value=r,c.value=n):l.value&&!a.value?(l.value=!1,a.value=!0,u.value=r,c.value=n):!l.value&&a.value?(l.value=!0,u.value=i,c.value=i):(l.value=!0,u.value=n,c.value=r))},handlePaneResize:m=>{const g=m.panes;if(g&&g.length>=2){const b=g[0].size,v=g[1].size;u.value=b,c.value=v,b>n&&!a.value&&(a.value=!0),v>n&&!l.value&&(l.value=!0),b<=s&&a.value&&(a.value=!1),v<=s&&l.value&&(l.value=!1)}}}}const pQ={class:"flex justify-between items-center relative"},kc=o.defineComponent({__name:"CoreEditorMoblie",props:{isMobile:{type:Boolean},superTextArea:{default:{view:!0,button:!0}},mode:{},modelValue:{default:""},comment:{default:""},commentCuesheet:{default:""},hideComment:{type:Boolean,default:!1},disableSuperInput:{type:Boolean,default:!1},fontSizeDefault:{default:"14px"},fontFamilyDefault:{default:""},isOpenSuperView:{type:Boolean},output:{default:"html"},dark:{type:Boolean,default:void 0},disabled:{type:Boolean,default:!1},hideToolbar:{type:Boolean,default:!1},isShowFormatControlBar:{type:Boolean,default:!1},customClassFormatControlBar:{default:""},titleBarComment:{default:null},titleBarContent:{default:null},fieldNameComment:{default:null},fieldNameCommentCuesheet:{},fieldNameContent:{default:null},fieldNameSuper:{},isScreenSplit:{default:!1},isShowLineNumber:{type:Boolean,default:!1},hideMenubar:{type:Boolean},disableBubble:{type:Boolean,default:!1},hideBubble:{type:Boolean,default:!1},maxWidth:{default:void 0},minHeight:{default:200},maxHeight:{default:void 0},height:{default:void 0},extensions:{default:()=>[]},editorClass:{default:void 0},contentClass:{default:void 0},isCompare:{type:Boolean},autoHeight:{type:Boolean},textAlert:{},customClassToolbar:{default:""},readonly:{type:Boolean,default:!1},canEditSuperReadOnly:{type:Boolean},autoFocus:{type:Boolean,default:!0},superPreviewCustomClass:{},minChar:{},isAccordion:{type:Boolean},contentAutoCopied:{},isEditorView:{type:Boolean,default:!1},isEditorViewSplitContent:{type:Boolean,default:!1}},emits:["enter","change","update:modelValue","update:comment","onFocusEditor","changed:selection","setEditorSelected","onBlurEditor","lineFocus","onFocus","onBlur"],setup(t,{expose:e,emit:n}){var Qe;const r=t,i=n,s=new Gk;o.provide("isMobile",!0);const a=mt.useEventBus(lr.INCREASE_DECREASE_FONTSIZE),l=o.useAttrs(),u=xn(),{state:c,isFullscreen:f,isReady:p,editor:m,updateEditorState:g,checkSpellStore:b,setImageAttachment:v,setEditorContentMobile:w}=u,{markAsFocused:x,insertHtml:k}=xZ(),E=o.ref(!r.disabled&&!r.readonly);o.provide("isEditable",E),o.computed(()=>[...c.extensions,...tt.differenceBy(r.extensions,c.extensions,"name")].map((X,W)=>X.configure({sort:W})));const C=o.ref(r.fontSizeDefault),_=o.ref(r.fontFamilyDefault);o.provide("fontSize",C),o.provide("fontFamily",_);const A=o.computed(()=>({fontFamily:_.value,fontSize:C.value})),T=o.ref(),{height:L}=mt.useWindowSize(),I=o.computed(()=>{var W;if(F.value)return{bottom:"15px"};const X=((W=T.value)==null?void 0:W.getBoundingClientRect().bottom)||0;return{bottom:`${L.value-X+10}px`}}),M=X=>{const W=parseInt(C.value||"12px"),se=X?W+2:W-2;C.value=se+"px"};o.onBeforeMount(()=>{a.on(M)}),o.onBeforeUnmount(()=>{a.off(M)});const j=o.computed(()=>({...o.unref(f)?{height:"100%"}:{minHeight:r.minHeight?an(r.minHeight):void 0,maxHeight:r.maxHeight?an(r.maxHeight):void 0,height:r.height?an(r.height):void 0},maxWidth:an(r.maxWidth),width:r.maxWidth?"100%":void 0,margin:r.maxWidth?"0 auto":void 0})),D=new Oo({enablePasteRules:!1,enableInputRules:!1,content:pn(r.modelValue,r.disabled,r.mode),editorProps:{handleKeyDown:tt.throttle((X,W)=>W.key==="Enter"&&l.enter&&!W.shiftKey?(i("enter"),!0):!1,Bo),transformPastedHTML:X=>(X=X.replace(/\s*style="[^"]*"/g,""),X),handlePaste(X,W){var Fe;if(r.mode!==Be.PLAIN_TEXT)return!1;W.preventDefault();const se=((Fe=W.clipboardData)==null?void 0:Fe.getData("text/plain"))||"",{tr:ae,selection:ye}=X.state;return X.dispatch(ae.insertText(se,ye.from)),!0}},onCreate:({editor:X})=>{g(X)},onUpdate:tt.throttle(({editor:X})=>{p.value=!0;const W=xe(X,r.output);i("update:modelValue",W),i("change",{editor:X,output:W}),g(X),Q(X)},Bo),extensions:[Yk,...tt.uniqBy(tt.reverse(o.unref(r.extensions)),"name")],editable:E.value,onFocus:X=>{G(),i("onFocus",X),x()},onBlur:X=>i("onBlur",X),parseOptions:{preserveWhitespace:"full"}});function Q(X){const W=[];X.state.doc.descendants(se=>{se.type.name==="image"&&W.push({id:se.attrs.id,src:se.attrs.src})}),v(W)}const te=o.ref(),H=o.ref(!0),F=o.ref(!1);function P(){s.isNativeWebViewAvailable()&&(s.receiveDataFromNative("keyboardDidShow",X=>{F.value=!0}),s.receiveDataFromNative("keyboardDidHide",X=>{F.value=!1}))}function q(X){const W=document.querySelectorAll('[contenteditable="true"]:not(.tiptap), .simple-editor, input, textarea'),se=Array.from(W).some(ae=>ae.contains(X.target));if(X.type==="focusout"){H.value=!0;return}H.value=!se}mt.useEventListener(document,"focusin",q),mt.useEventListener(document,"focusout",q),o.onMounted(()=>{G(D),w(D),P()});const J=o.computed(()=>r.isShowFormatControlBar&&H.value&&!F.value);function G(X){te.value=X??D,u.setEditorSelectedMobile(te.value)}const oe=o.computed(()=>D.storage.superText.isShowSuperInputMoblie);function xe(X,W){if(!X)return"";if(X.isEmpty)return W==="json"?{}:"";if(r.mode===Be.PLAIN_TEXT)return X.getText({blockSeparator:`
303
303
  `});switch(W){case"html":return X.getHTML();case"json":return X.getJSON();case"text":return X.getText({blockSeparator:`
304
304
  `});default:return""}}function Ce(X){return X.every(W=>D==null?void 0:D.extensionManager.extensions.find(se=>se.name===W))}o.watch(()=>b.languages,()=>{D.commands.checkSpelling()}),o.watch(()=>r.modelValue,X=>{if(!D||tt.isEqual(xe(D,r.output),X))return;const{from:W,to:se}=D.state.selection;D.commands.setTextSelection({from:W,to:se}),D.commands.setContent(pn(X,r.disabled,r.mode),!1,{preserveWhitespace:"full"})},{deep:!0}),o.watch([()=>r.disabled,()=>r.readonly],()=>{E.value=!r.disabled&&!r.readonly},{immediate:!0}),o.watch(()=>E.value,X=>{var W;D==null||D.setEditable(X),(W=D==null?void 0:D.commands)!=null&&W.setIsEnableSuggestion&&D.commands.setIsEnableSuggestion(X)},{immediate:!0}),o.watch(()=>m.value,()=>{m.value&&m.value.on("selectionUpdate",({editor:X})=>{i("changed:selection",{editor:X})})}),o.onUnmounted(()=>{var X;D==null||D.destroy(),(X=te.value)==null||X.destroy()}),Qu(Au.SAVE,()=>{localStorage.setItem("content",xe(D,"html"))});const He=(X,W)=>{const se=D;if(se){if(W){const ae=se.state.doc.nodeAt(+W),{[Ze.ELEMENT_ID]:ye,...Fe}=(ae==null?void 0:ae.attrs)||{};se.view.dispatch(se.state.tr.setNodeMarkup(+W,void 0,{...Fe,[Ze.TEXT]:X}))}else{const{from:ae}=se.view.state.selection;se.commands.insertContentAt(ae,{type:"superText",attrs:{"data-id":hi(6),"data-text":X}})}se.commands.toggleSuperInputMoblie(),se.storage.superText.addToast({type:"success",message:"수퍼가 수정되었습니다"})}},Oe=X=>{var se;const W=te.value??D;if(W){const{from:ae}=W.view.state.selection;W.commands.insertContentAt(ae,{type:"configPlan",attrs:{"data-id":hi(6),"data-text":X}})}(se=te.value)==null||se.commands.toggleConfigPlanInput()};function De(X){X===Be.STRAIGHT&&D.commands.focus("end"),X===Be.EDITOR&&D.commands.focus("end")}const Z=o.computed(()=>E.value&&r.mode===Be.STRAIGHT||E.value&&r.mode===Be.REPORT);o.onMounted(()=>{var X,W;r.autoFocus&&De(r.mode),(X=D==null?void 0:D.commands)!=null&&X.setIsMobile&&D.commands.setIsMobile(!0),E.value&&((W=D.storage.superText)!=null&&W.enable)&&D.commands.toggleSuperTextView()}),o.watch(()=>r.mode,X=>{r.autoFocus&&De(X)});const ne=(Qe=D.extensionManager.extensions.find(X=>X.name==="superText"))==null?void 0:Qe.options.bottomSheetComponent,ce=o.computed(()=>{const X=r.mode===Be.REPORT,W=r.mode===Be.EDITOR&&r.isScreenSplit,se=!r.hideComment;return(X||W)&&se}),de=o.computed(()=>!ce.value),{HEADER_ONLY_SIZE:ge,pane1ContentVisible:N,pane2ContentVisible:ve,pane1Size:Re,pane2Size:We,togglePane:pt,handlePaneResize:kt}=Zk(de);function z(){if(!r.contentAutoCopied)return;const X=mT(r.contentAutoCopied,".super-text");k(D,X)}const{isScrolling:V,handleScroll:le}=wa(),{isScrolling:be,handleScroll:Le}=wa();return e({editor:D}),(X,W)=>{var ht,hn,Mn,Kr;const se=Xk,ae=Zp,ye=Jp,Fe=Yp,ot=Bf,St=Kk,Kt=oQ,yo=nQ,ie=Ef,Ie=YZ,Ue=Lt,yt=wn;return o.openBlock(),o.createElementBlock(o.Fragment,null,[o.unref(te)?(o.openBlock(),o.createElementBlock("div",{key:0,id:"vdc-editor",ref_key:"editorRef",ref:T,style:o.normalizeStyle(o.unref(j)),class:o.normalizeClass(o.unref(ke)("vdc-editor mobile relative w-full flex flex-col overflow-y-auto",!r.height&&"flex-1",X.editorClass,X.disabled&&"disabled",X.mode!==o.unref(Be).EDITOR&&X.isShowLineNumber&&"editor-line"))},[!X.hideBubble&&!X.disabled&&o.unref(E)?(o.openBlock(),o.createElementBlock(o.Fragment,{key:0},[o.createVNode(se,{editor:o.unref(D),mode:X.mode},null,8,["editor","mode"]),Ce([o.unref(pc)])?(o.openBlock(),o.createBlock(ae,{key:0,editor:o.unref(D)},null,8,["editor"])):o.createCommentVNode("",!0),Ce([o.unref(fa)])?(o.openBlock(),o.createBlock(ye,{key:1,editor:o.unref(D)},null,8,["editor"])):o.createCommentVNode("",!0),Ce([o.unref(ps)])?(o.openBlock(),o.createBlock(Fe,{key:2,editor:o.unref(D)},null,8,["editor"])):o.createCommentVNode("",!0),Ce([o.unref(hs),o.unref(ms)])?(o.openBlock(),o.createBlock(ot,{key:3,editor:o.unref(D)},null,8,["editor"])):o.createCommentVNode("",!0)],64)):o.createCommentVNode("",!0),!X.hideToolbar&&!r.isEditorView?(o.openBlock(),o.createBlock(St,{key:1,editor:o.unref(te),mode:X.mode,disabled:X.disabled,class:"mb-[3px]","custom-class-toolbar":X.customClassToolbar,"active-extensions":X.mode===o.unref(Be).EDITOR?[hc]:void 0},null,8,["editor","mode","disabled","custom-class-toolbar","active-extensions"])):o.createCommentVNode("",!0),(o.openBlock(),o.createBlock(o.Teleport,{to:"body"},[X.isShowFormatControlBar&&X.mode===o.unref(Be).EDITOR&&o.unref(E)&&!r.isEditorView?(o.openBlock(),o.createElementBlock("div",{key:0,style:o.normalizeStyle({...o.unref(I),visibility:o.unref(H)?"visible":"hidden",pointerEvents:o.unref(H)?"auto":"none"}),class:o.normalizeClass(o.unref(ke)("absolute left-5 right-5 z-[12]",o.unref(F)&&"fixed",X.customClassFormatControlBar))},[o.createVNode(Kt,{editor:o.unref(te),mode:X.mode,disabled:!o.unref(E)||X.disabled},null,8,["editor","mode","disabled"])],6)):o.createCommentVNode("",!0)])),r.isEditorView?(o.openBlock(),o.createBlock(yo,{key:2,"is-editor-view-split-content":r.isEditorViewSplitContent,extensions:X.extensions,mode:X.mode,"hide-comment":X.hideComment,"field-name-comment":X.fieldNameComment,"field-name-comment-cuesheet":X.fieldNameCommentCuesheet,"field-name-content":X.fieldNameContent,comment:X.comment,"comment-cuesheet":X.commentCuesheet,content:X.modelValue,style:o.normalizeStyle(o.unref(A))},null,8,["is-editor-view-split-content","extensions","mode","hide-comment","field-name-comment","field-name-comment-cuesheet","field-name-content","comment","comment-cuesheet","content","style"])):(o.openBlock(),o.createBlock(o.unref(eh),{key:3,class:o.normalizeClass(o.unref(ke)("flex-1 basis-0 flex-col",o.unref(J)&&"pb-16")),style:o.normalizeStyle(o.unref(A)),horizontal:"",onResize:o.unref(kt)},{default:o.withCtx(()=>[o.unref(ce)?(o.openBlock(),o.createBlock(o.unref(Ko),{key:0,size:o.unref(Re),"min-size":o.unref(ge),class:"flex flex-col"},{default:o.withCtx(()=>{var kr,Qn;return[(kr=X.titleBarComment)!=null&&kr.title?(o.openBlock(),o.createBlock(Jk,{key:0,"title-bar":X.titleBarComment,class:"mb-[3px]"},null,8,["title-bar"])):o.createCommentVNode("",!0),(Qn=X.fieldNameComment)!=null&&Qn.label?(o.openBlock(),o.createElementBlock("div",{key:1,class:o.normalizeClass(o.unref(ke)("flex justify-between items-center py-1.5 mb-1 active:bg-ed-accent",!X.isAccordion&&"pointer-events-none")),onClick:W[0]||(W[0]=Sr=>o.unref(pt)("pane1"))},[o.createVNode(Ec,{"field-name":X.fieldNameComment},null,8,["field-name"]),X.isAccordion?(o.openBlock(),o.createBlock(o.resolveDynamicComponent(o.unref(N)?o.unref(cg):o.unref(tc)),{key:0,class:"h-5 w-5"})):o.createCommentVNode("",!0)],2)):o.createCommentVNode("",!0),o.withDirectives(o.createElementVNode("div",{class:o.normalizeClass(o.unref(ke)("flex-1 !overflow-y-auto overflow-x-hidden basis-0 flex h-full flex-col",!o.unref(V)&&"scrollbar-thumb-transparent",X.contentClass)),onScroll:W[2]||(W[2]=(...Sr)=>o.unref(le)&&o.unref(le)(...Sr))},[o.createVNode(fQ,{ref:"editorCommentRef",mode:X.mode,extensions:X.extensions,"model-value":r.comment,disabled:r.disabled,"disable-super-input":X.disableSuperInput,"field-name-comment":X.fieldNameComment,"is-show-format-control-bar":X.isShowFormatControlBar,"auto-focus":X.autoFocus,"onUpdate:modelValue":W[1]||(W[1]=Sr=>i("update:comment",Sr)),onSetEditorSelected:G},null,8,["mode","extensions","model-value","disabled","disable-super-input","field-name-comment","is-show-format-control-bar","auto-focus"])],34),[[o.vShow,o.unref(N)]])]}),_:1},8,["size","min-size"])):o.createCommentVNode("",!0),o.createVNode(o.unref(Ko),{size:o.unref(We),"min-size":o.unref(ge),class:"flex flex-col"},{default:o.withCtx(()=>{var kr,Qn,Sr;return[(kr=X.titleBarContent)!=null&&kr.title?(o.openBlock(),o.createBlock(Jk,{key:0,"title-bar":X.titleBarContent,class:"mb-[3px]"},null,8,["title-bar"])):o.createCommentVNode("",!0),o.createElementVNode("div",pQ,[(Qn=X.fieldNameContent)!=null&&Qn.label?(o.openBlock(),o.createElementBlock("div",{key:0,class:o.normalizeClass(o.unref(ke)("flex justify-between items-center py-1.5 mb-1 active:bg-ed-accent flex-1",!X.isAccordion&&"pointer-events-none")),onClick:W[3]||(W[3]=Go=>o.unref(pt)("pane2"))},[o.createVNode(Ec,{"field-name":X.fieldNameContent},null,8,["field-name"]),X.isAccordion?(o.openBlock(),o.createBlock(o.resolveDynamicComponent(o.unref(ve)?o.unref(cg):o.unref(tc)),{key:0,class:"h-5 w-5"})):o.createCommentVNode("",!0)],2)):o.createCommentVNode("",!0),o.unref(Z)?(o.openBlock(),o.createElementBlock("div",{key:1,class:o.normalizeClass(o.unref(ke)("flex items-center gap-x-2 absolute right-9 top-1.5 z-10",!((Sr=X.fieldNameContent)!=null&&Sr.label)&&"static ml-auto"))},[o.createVNode(ie,{for:"superView",class:"body-medium"},{default:o.withCtx(()=>W[8]||(W[8]=[o.createTextVNode("수퍼")])),_:1}),o.createVNode(Ie,{id:"superView",checked:o.unref(D).storage.superText.enable,class:"w-8 h-5 data-[state=checked]:bg-blue-500","custom-class-thumb":"w-4 h-4 data-[state=checked]:translate-x-3","onUpdate:checked":W[4]||(W[4]=Go=>o.unref(D).commands.toggleSuperTextView())},null,8,["checked"])],2)):o.createCommentVNode("",!0),X.contentAutoCopied?(o.openBlock(),o.createBlock(yt,{key:2,disabled:o.unref(Mp)(X.contentAutoCopied),variant:"ghost",class:"w-fit h-fit p-0 gap-x-1 label-large text-blue-500",onClick:z},{default:o.withCtx(()=>[o.createVNode(Ue,{name:"autoCopy",class:"size-5"}),W[9]||(W[9]=o.createTextVNode("자동복사"))]),_:1},8,["disabled"])):o.createCommentVNode("",!0)]),o.withDirectives(o.createElementVNode("div",{class:o.normalizeClass(o.unref(ke)("flex-1 !overflow-y-auto overflow-x-hidden basis-0 flex flex-col",!o.unref(be)&&"scrollbar-thumb-transparent",X.contentClass)),onScroll:W[5]||(W[5]=(...Go)=>o.unref(Le)&&o.unref(Le)(...Go))},[o.createVNode(o.unref(Xn),{id:"editor-panel",editor:o.unref(D),class:o.normalizeClass(["flex-1 flex-col relative break-all",X.mode===o.unref(Be).PLAIN_TEXT&&"plain-text"])},null,8,["editor","class"])],34),[[o.vShow,o.unref(ve)]])]}),_:1},8,["size","min-size"])]),_:1},8,["class","style","onResize"]))],6)):o.createCommentVNode("",!0),(ht=o.unref(D))!=null&&ht.storage.superText&&o.unref(ne)?(o.openBlock(),o.createBlock(dQ,{key:1,open:o.unref(oe),editor:o.unref(D),"bottom-sheet-component":o.unref(ne),onClose:W[6]||(W[6]=kr=>o.unref(D).commands.toggleSuperInputMoblie()),onSave:He},null,8,["open","editor","bottom-sheet-component"])):o.createCommentVNode("",!0),(hn=o.unref(te))!=null&&hn.storage.configPlan?(o.openBlock(),o.createBlock(CE,{key:2,open:(Mn=o.unref(te))==null?void 0:Mn.storage.configPlan.isShowConfigPlanInput,"is-view-mode":!((Kr=o.unref(te))!=null&&Kr.storage.configPlan.isShowConfigPlanInput),editor:o.unref(te),title:X.$t("editor.configPlan"),onClose:W[7]||(W[7]=kr=>o.unref(te).commands.toggleConfigPlanInput()),onSave:Oe},null,8,["open","is-view-mode","editor","title"])):o.createCommentVNode("",!0)],64)}}}),hQ=o.defineComponent({__name:"ArticleEditor",props:{mode:{default:Be.STRAIGHT},isMobile:{type:Boolean},superTextArea:{},modelValue:{},comment:{},commentCuesheet:{},hideComment:{type:Boolean},disableSuperInput:{type:Boolean},fontSizeDefault:{},fontFamilyDefault:{},isOpenSuperView:{type:Boolean},output:{},dark:{type:Boolean},disabled:{type:Boolean},hideToolbar:{type:Boolean},isShowFormatControlBar:{type:Boolean},customClassFormatControlBar:{},titleBarComment:{},titleBarContent:{},fieldNameComment:{},fieldNameCommentCuesheet:{},fieldNameContent:{},fieldNameSuper:{},isScreenSplit:{},isShowLineNumber:{type:Boolean},hideMenubar:{type:Boolean},disableBubble:{type:Boolean},hideBubble:{type:Boolean},maxWidth:{},minHeight:{},maxHeight:{},height:{},extensions:{},editorClass:{},contentClass:{},isCompare:{type:Boolean},autoHeight:{type:Boolean},textAlert:{},customClassToolbar:{},readonly:{type:Boolean},canEditSuperReadOnly:{type:Boolean},autoFocus:{type:Boolean,default:!0},superPreviewCustomClass:{},minChar:{},isAccordion:{type:Boolean},contentAutoCopied:{},isEditorView:{type:Boolean},isEditorViewSplitContent:{type:Boolean}},setup(t){const e=t,n=xn();return o.onMounted(()=>{n.setTextAlert(e.textAlert||"")}),(r,i)=>e.isMobile?(o.openBlock(),o.createBlock(kc,o.mergeProps({key:1},e,{"onUpdate:modelValue":i[2]||(i[2]=s=>r.$emit("update:modelValue",s)),"onUpdate:comment":i[3]||(i[3]=s=>r.$emit("update:comment",s))}),null,16)):(o.openBlock(),o.createBlock(Np,o.mergeProps({key:0},e,{"onUpdate:modelValue":i[0]||(i[0]=s=>r.$emit("update:modelValue",s)),"onUpdate:comment":i[1]||(i[1]=s=>r.$emit("update:comment",s))}),null,16))}}),mQ=o.defineComponent({__name:"DigitalNewsEditor",props:{mode:{default:Be.EDITOR},isMobile:{type:Boolean},superTextArea:{},modelValue:{},comment:{},commentCuesheet:{},hideComment:{type:Boolean},disableSuperInput:{type:Boolean},fontSizeDefault:{},fontFamilyDefault:{},isOpenSuperView:{type:Boolean},output:{},dark:{type:Boolean},disabled:{type:Boolean},hideToolbar:{type:Boolean},isShowFormatControlBar:{type:Boolean},customClassFormatControlBar:{},titleBarComment:{},titleBarContent:{},fieldNameComment:{},fieldNameCommentCuesheet:{},fieldNameContent:{},fieldNameSuper:{},isScreenSplit:{},isShowLineNumber:{type:Boolean},hideMenubar:{type:Boolean},disableBubble:{type:Boolean},hideBubble:{type:Boolean},maxWidth:{},minHeight:{},maxHeight:{},height:{},extensions:{},editorClass:{},contentClass:{},isCompare:{type:Boolean},autoHeight:{type:Boolean},textAlert:{},customClassToolbar:{},readonly:{type:Boolean},canEditSuperReadOnly:{type:Boolean},autoFocus:{type:Boolean,default:!0},superPreviewCustomClass:{},minChar:{},isAccordion:{type:Boolean},contentAutoCopied:{},isEditorView:{type:Boolean},isEditorViewSplitContent:{type:Boolean}},setup(t){const e=t;return(n,r)=>{const i=Np,s=kc;return e.isMobile?(o.openBlock(),o.createBlock(s,o.mergeProps({key:1},e,{"onUpdate:modelValue":r[1]||(r[1]=a=>n.$emit("update:modelValue",a)),"onUpdate:comment":r[2]||(r[2]=a=>n.$emit("update:comment",a))}),null,16)):(o.openBlock(),o.createBlock(i,o.mergeProps({key:0},e,{"onUpdate:modelValue":r[0]||(r[0]=a=>n.$emit("update:modelValue",a))}),null,16))}}});var Qk={exports:{}};(function(t){(function(){function e(H){return H===">"}function n(H){return H==="<"}function r(H){return/^\s+$/.test(H)}function i(H){var F=H.match(/^\s*<([^!>][^>]*)>\s*$/);return!!F&&F[1].trim().split(" ")[0]}function s(H){return!i(H)}function a(H){return/^<!--/.test(H)}function l(H){return/--\>$/.test(H)}var u,c=new RegExp("^<(iframe|object|math|svg|script|video|head|style|a)");function f(H){var F=u.exec(H);return F&&F[1]}function p(H,F){return H.substring(H.length-F.length-2)==="</"+F}function m(H){return/^\s*<[^>]+\/>\s*$/.test(H)}function g(H){var F=/^<img[\s>]/.test(H);return F||s(H)||f(H)||m(H)}function b(H){return{string:H,key:x(H)}}function v(H,F,P,q){this.segment=q,this.length=P,this.startInBefore=H+q.beforeIndex,this.startInAfter=F+q.afterIndex,this.endInBefore=this.startInBefore+this.length-1,this.endInAfter=this.startInAfter+this.length-1,this.segmentStartInBefore=H,this.segmentStartInAfter=F,this.segmentEndInBefore=this.segmentStartInBefore+this.length-1,this.segmentEndInAfter=this.segmentStartInAfter+this.length-1}function w(H){for(var F="char",P="",q="",J=[],G=0;G<H.length;G++){var oe=H[G];switch(F){case"tag":var xe=f(P);xe?(F="atomic_tag",q=xe,P+=oe):a(P)?(F="html_comment",P+=oe):e(oe)?(P+=">",J.push(b(P)),P="",r(oe)?F="whitespace":F="char"):P+=oe;break;case"atomic_tag":e(oe)&&p(P,q)?(P+=">",J.push(b(P)),P="",q="",F="char"):P+=oe;break;case"html_comment":P+=oe,l(P)&&(P="",F="char");break;case"char":n(oe)?(P&&J.push(b(P)),P="<",F="tag"):/\s/.test(oe)?(P&&J.push(b(P)),P=oe,F="whitespace"):/[\w\d\#@]/.test(oe)?P+=oe:/&/.test(oe)?(P&&J.push(b(P)),P=oe):(P+=oe,J.push(b(P)),P="");break;case"whitespace":n(oe)?(P&&J.push(b(P)),P="<",F="tag"):r(oe)?P+=oe:(P&&J.push(b(P)),P=oe,F="char");break;default:throw new Error("Unknown mode "+F)}}return P&&J.push(b(P)),J}function x(H){var F=/^<img.*src=['"]([^"']*)['"].*>$/.exec(H);if(F)return'<img src="'+F[1]+'">';var P=/^<a.*href=['"]([^"']*)['"]/.exec(H);if(P)return'<a href="'+P[1]+'"></a>';var q=/^<object.*data=['"]([^"']*)['"]/.exec(H);if(q)return'<object src="'+q[1]+'"></object>';if(/^<(svg|math|video)[\s>]/.test(H)){var J=H.indexOf('data-uuid="');if(J!==-1){var G=H.slice(0,J),oe=H.slice(J+44);return G+oe}else return H}var xe=/^<iframe.*src=['"]([^"']*)['"].*>/.exec(H);if(xe)return'<iframe src="'+xe[1]+'"></iframe>';var Ce=/<([^\s>]+)[\s>]/.exec(H);return Ce?"<"+Ce[1].toLowerCase()+">":H&&H.replace(/(\s+|&nbsp;|&#160;)/g," ")}function k(H){return H.reduce(function(F,P,q){return F[P.key]?F[P.key].push(q):F[P.key]=[q],F},Object.create(null))}function E(H,F){return F.endInBefore<H.startInBefore&&F.endInAfter<H.startInAfter?-1:F.startInBefore>H.endInBefore&&F.startInAfter>H.endInAfter?1:0}function C(){this._root=null}C.prototype={add:function(H){var F={value:H,left:null,right:null},P=this._root;if(P)for(;;){var q=E(P.value,H);if(q===-1)if(P.left)P=P.left;else{P.left=F;break}else if(q===1)if(P.right)P=P.right;else{P.right=F;break}else break}else this._root=F},toArray:function(){function H(F,P){return F&&(H(F.left,P),P.push(F.value),H(F.right,P)),P}return H(this._root,[])}};function _(H){for(var F=H.beforeTokens,P=H.afterMap,q=null,J=null,G=0;G<F.length;G++){var oe=!1,xe=F.length-G;if(J&&xe<J.length)break;var Ce=F[G];if(Ce.key===" "){q=G;continue}q===G-1&&(oe=!0);var He=P[Ce.key];He&&He.forEach(function(Oe){var De=J?J.length:0,Z=A(H,G,Oe,De,oe);Z&&Z.length>De&&(J=Z)})}return J}function A(H,F,P,q,J){var G=H.beforeTokens,oe=H.afterTokens,xe=F+q,Ce=P+q;if(!(xe>=G.length||Ce>=oe.length)){if(q){var He=G[xe].key,Oe=oe[Ce].key;if(He!==Oe)return}for(var De=!0,Z=1,ne=F+Z,ce=P+Z;De&&ne<G.length&&ce<oe.length;){var de=G[ne].key,ge=oe[ce].key;de===ge?(Z++,ne=F+Z,ce=P+Z):De=!1}if(J&&F>0&&P>0){var N=G[F-1].key,ve=oe[P-1].key;N===" "&&ve===" "&&(F--,P--,Z++)}return new v(F,P,Z,H)}}function T(H,F,P,q){return{beforeTokens:H,afterTokens:F,beforeMap:k(H),afterMap:k(F),beforeIndex:P,afterIndex:q}}function L(H){for(var F=new C,P,q=[H];q.length;)if(H=q.pop(),P=_(H),P&&P.length){if(P.segmentStartInBefore>0&&P.segmentStartInAfter>0){var J=H.beforeTokens.slice(0,P.segmentStartInBefore),G=H.afterTokens.slice(0,P.segmentStartInAfter);q.push(T(J,G,H.beforeIndex,H.afterIndex))}var oe=H.beforeTokens.slice(P.segmentEndInBefore+1),xe=H.afterTokens.slice(P.segmentEndInAfter+1),Ce=H.beforeIndex+P.segmentEndInBefore+1,He=H.afterIndex+P.segmentEndInAfter+1;oe.length&&xe.length&&q.push(T(oe,xe,Ce,He)),F.add(P)}return F.toArray()}function I(H,F){if(!H)throw new Error("Missing beforeTokens");if(!F)throw new Error("Missing afterTokens");var P=0,q=0,J=[],G=T(H,F,0,0),oe=L(G);oe.push(new v(H.length,F.length,0,G));for(var xe=0;xe<oe.length;xe++){var Ce=oe[xe],He="none";P===Ce.startInBefore?q!==Ce.startInAfter&&(He="insert"):(He="delete",q!==Ce.startInAfter&&(He="replace")),He!=="none"&&J.push({action:He,startInBefore:P,endInBefore:He!=="insert"?Ce.startInBefore-1:null,startInAfter:q,endInAfter:He!=="delete"?Ce.startInAfter-1:null}),Ce.length!==0&&J.push({action:"equal",startInBefore:Ce.startInBefore,endInBefore:Ce.endInBefore,startInAfter:Ce.startInAfter,endInAfter:Ce.endInAfter}),P=Ce.endInBefore+1,q=Ce.endInAfter+1}var Oe=[],De={action:"none"};function Z(de){return de.action!=="equal"||de.endInBefore-de.startInBefore!==0?!1:/^\s$/.test(H.slice(de.startInBefore,de.endInBefore+1))}for(var ne=0;ne<J.length;ne++){var ce=J[ne];Z(ce)&&De.action==="replace"||ce.action==="replace"&&De.action==="replace"?(De.endInBefore=ce.endInBefore,De.endInAfter=ce.endInAfter):(Oe.push(ce),De=ce)}return Oe}function M(H){this.tokens=H,this.notes=H.reduce(function(F,P,q){F.notes.push({isWrappable:g(P),insertedTag:!1});var J=!m(P)&&i(P),G=F.tagStack[F.tagStack.length-1];return J&&(G&&"/"+G.tag===J?(F.notes[G.position].insertedTag=!0,F.tagStack.pop()):F.tagStack.push({tag:J,position:q})),F},{notes:[],tagStack:[]}).notes}M.prototype.combine=function(H,F){var P=this.notes,q=this.tokens.slice(),J=q.reduce(function(G,oe,xe){P[xe].insertedTag&&(q[xe]=F(q[xe])),G.status===null&&(G.status=P[xe].isWrappable);var Ce=P[xe].isWrappable;return Ce!==G.status&&(G.list.push({isWrappable:G.status,tokens:q.slice(G.lastIndex,xe)}),G.lastIndex=xe,G.status=Ce),xe===q.length-1&&G.list.push({isWrappable:G.status,tokens:q.slice(G.lastIndex,xe+1)}),G},{list:[],status:null,lastIndex:0}).list;return J.map(H).join("")};function j(H,F,P,q,J){var G=new M(F);q=q?q+"-":"";var oe=" data-"+q+'operation-index="'+P+'"';return J&&(oe+=' class="'+J+'"'),G.combine(function(xe){if(xe.isWrappable){var Ce=xe.tokens.join("");if(Ce.trim())return"<"+H+oe+">"+Ce+"</"+H+">"}else return xe.tokens.join("");return""},function(xe){var Ce=' data-diff-node="'+H+'"';return Ce+=" data-"+q+'operation-index="'+P+'"',xe.replace(/>\s*$/,Ce+"$&")})}var D={equal:function(H,F,P,q,J,G){var oe=P.slice(H.startInAfter,H.endInAfter+1);return oe.reduce(function(xe,Ce){return xe+Ce.string},"")},insert:function(H,F,P,q,J,G){var oe=P.slice(H.startInAfter,H.endInAfter+1),xe=oe.map(function(Ce){return Ce.string});return j("ins",xe,q,J,G)},delete:function(H,F,P,q,J,G){var oe=F.slice(H.startInBefore,H.endInBefore+1),xe=oe.map(function(Ce){return Ce.string});return j("del",xe,q,J,G)},replace:function(){return D.delete.apply(null,arguments)+D.insert.apply(null,arguments)}};function Q(H,F,P,q,J){return P.reduce(function(G,oe,xe){return G+D[oe.action](oe,H,F,xe,q,J)},"")}function te(H,F,P,q,J){if(H===F)return H;J?u=new RegExp("^<("+J.replace(/\s*/g,"").replace(/,/g,"|")+")"):u=c,H=w(H),F=w(F);var G=I(H,F);return Q(H,F,G,q,P)}te.htmlToTokens=w,te.findMatchingBlocks=L,L.findBestMatch=_,L.createMap=k,L.createToken=b,L.createSegment=T,L.getKeyForToken=x,te.calculateOperations=I,te.renderOperations=Q,t!==null?t.exports=te:this.htmldiff=te}).call(el)})(Qk);var gQ=Qk.exports;const bQ=jB(gQ),Nk=(t,e,n)=>{let r="";{const i=pn(t,n),s=pn(e,n);r=bQ(i,s,null,null,"button")}return r=r.replace(/<del[^>]*>/g,'<span class="diff-del">').replace(/<\/del>/g,"</span>").replace(/<ins[^>]*>/g,'<mark style="background:#FEF3C7;">').replace(/<\/ins>/g,"</mark>"),r},vQ={key:0,class:"px-2 min-h-[24px] flex items-center justify-between gap-1 mb-1.5"},yQ={class:"flex items-center gap-2"},wQ={class:"body-small text-gray-600 px-[6px] py-[2px] shrink-0 rounded-[4px] bg-gray-100"},xQ={class:"label-large text-gray-800 line-clamp-1"},CQ={class:"flex items-center gap-1 shrink-0"},EQ={class:"mt-[2px]"},kQ={class:"body-small text-gray-400"},SQ={class:"border border-ed-gray rounded-[5px] p-2.5 my-2 h-full"},_Q={key:0,class:"px-2 min-h-[24px] flex items-center justify-between gap-1 mb-1.5"},TQ={class:"flex items-center gap-2"},AQ={class:"body-small text-blue-500 px-[6px] py-[2px] shrink-0 rounded-[4px] bg-blue-50"},OQ={class:"label-large text-gray-800 line-clamp-1"},MQ={class:"flex items-center gap-1 shrink-0"},BQ={class:"mt-[2px]"},IQ={class:"body-small text-gray-400"},RQ=Io(o.defineComponent({__name:"ArticleCompareEditor",props:{originalData:{},changedData:{},extensions:{},editorClass:{}},setup(t){const e=t,n=o.ref(!1),r=o.computed(()=>!e.originalData||!e.changedData?{comment:"",content:""}:{comment:Nk(e.originalData.comment,e.changedData.comment,!0),content:Nk(e.originalData.content,e.changedData.content,!0)}),{HEADER_ONLY_SIZE:i,pane1ContentVisible:s,pane2ContentVisible:a,pane1Size:l,pane2Size:u,handlePaneResize:c}=Zk(!1,6),{isScrolling:f,handleScroll:p}=wa(),{isScrolling:m,handleScroll:g}=wa();return(b,v)=>{const w=Lt;return o.openBlock(),o.createElementBlock("div",{class:o.normalizeClass(o.unref(ke)("h-full",b.editorClass))},[o.createVNode(o.unref(eh),{horizontal:"",onResize:o.unref(c)},{default:o.withCtx(()=>[o.createVNode(o.unref(Ko),{size:o.unref(l),"min-size":o.unref(i),class:"flex flex-col"},{default:o.withCtx(()=>{var x,k,E,C,_,A,T,L,I,M,j;return[(k=(x=b.originalData)==null?void 0:x.titleBar)!=null&&k.title?(o.openBlock(),o.createElementBlock("div",vQ,[o.createElementVNode("div",yQ,[o.createElementVNode("div",wQ,o.toDisplayString(b.$t("기준")),1),o.createElementVNode("h3",xQ,o.toDisplayString((C=(E=b.originalData)==null?void 0:E.titleBar)==null?void 0:C.title),1)]),o.createElementVNode("div",CQ,[o.createElementVNode("div",EQ,[o.createVNode(w,{name:"Clock",class:"w-[13px] h-[13px] text-gray-400"})]),o.createElementVNode("div",kQ,o.toDisplayString((A=(_=b.originalData)==null?void 0:_.titleBar)==null?void 0:A.time),1)])])):o.createCommentVNode("",!0),o.withDirectives(o.createElementVNode("div",{class:o.normalizeClass(o.unref(ke)("border border-gray-50 rounded-md py-[10px] px-4 flex-1 overflow-y-auto",!o.unref(f)&&"scrollbar-thumb-transparent")),onScroll:v[0]||(v[0]=(...D)=>o.unref(p)&&o.unref(p)(...D))},[o.createVNode(kc,{"editor-class":"h-full",mode:o.unref(Be).REPORT,disabled:"","hide-toolbar":"",extensions:b.extensions,"field-name-comment":(T=b.originalData)==null?void 0:T.fieldNameComment,"field-name-content":(L=b.originalData)==null?void 0:L.fieldNameContent,comment:(I=b.originalData)==null?void 0:I.comment,"model-value":(M=b.originalData)==null?void 0:M.content,"hide-comment":(j=b.originalData)==null?void 0:j.hideComment},null,8,["mode","extensions","field-name-comment","field-name-content","comment","model-value","hide-comment"])],34),[[o.vShow,o.unref(s)]])]}),_:1},8,["size","min-size"]),o.unref(n)?(o.openBlock(),o.createBlock(o.unref(Ko),{key:0},{default:o.withCtx(()=>{var x,k,E,C,_;return[o.createElementVNode("div",SQ,[o.createVNode(kc,{"editor-class":"h-full",mode:o.unref(Be).REPORT,disabled:"","hide-toolbar":"",extensions:b.extensions,"field-name-comment":(x=b.changedData)==null?void 0:x.fieldNameComment,"field-name-content":(k=b.changedData)==null?void 0:k.fieldNameContent,comment:(E=b.changedData)==null?void 0:E.comment,"model-value":(C=b.changedData)==null?void 0:C.content,"hide-comment":(_=b.changedData)==null?void 0:_.hideComment},null,8,["mode","extensions","field-name-comment","field-name-content","comment","model-value","hide-comment"])])]}),_:1})):o.createCommentVNode("",!0),o.createVNode(o.unref(Ko),{size:o.unref(u),"min-size":o.unref(i),class:"flex flex-col"},{default:o.withCtx(()=>{var x,k,E,C,_,A,T,L,I;return[(k=(x=b.changedData)==null?void 0:x.titleBar)!=null&&k.title?(o.openBlock(),o.createElementBlock("div",_Q,[o.createElementVNode("div",TQ,[o.createElementVNode("div",AQ,o.toDisplayString(b.$t("대상")),1),o.createElementVNode("h3",OQ,o.toDisplayString((C=(E=b.changedData)==null?void 0:E.titleBar)==null?void 0:C.title),1)]),o.createElementVNode("div",MQ,[o.createElementVNode("div",BQ,[o.createVNode(w,{name:"Clock",class:"w-[13px] h-[13px] text-gray-400"})]),o.createElementVNode("div",IQ,o.toDisplayString((A=(_=b.changedData)==null?void 0:_.titleBar)==null?void 0:A.time),1)])])):o.createCommentVNode("",!0),o.withDirectives(o.createElementVNode("div",{class:o.normalizeClass(o.unref(ke)("border border-gray-50 bg-dark-blue-600 rounded-md py-[10px] px-4 flex-1 overflow-y-auto",!o.unref(m)&&"scrollbar-thumb-transparent")),onScroll:v[1]||(v[1]=(...M)=>o.unref(g)&&o.unref(g)(...M))},[o.createVNode(kc,{"editor-class":"h-full",mode:o.unref(Be).REPORT,disabled:"","hide-toolbar":"",extensions:b.extensions,"field-name-comment":(T=b.changedData)==null?void 0:T.fieldNameComment,"field-name-content":(L=b.changedData)==null?void 0:L.fieldNameContent,comment:o.unref(r).comment,"model-value":o.unref(r).content,"hide-comment":(I=b.changedData)==null?void 0:I.hideComment},null,8,["mode","extensions","field-name-comment","field-name-content","comment","model-value","hide-comment"])],34),[[o.vShow,o.unref(a)]])]}),_:1},8,["size","min-size"])]),_:1},8,["onResize"])],2)}}}),[["__scopeId","data-v-cff36561"]]),e5=t=>{if(!t)return-1;const{from:e}=t.state.selection;let n=0;return t.state.doc.descendants((r,i)=>{r.type.name===xp&&i<e&&n++}),n},LQ=o.defineComponent({__name:"SuperViewMobileSuperEditor",props:{isMobile:{type:Boolean},superTextArea:{},mode:{},modelValue:{default:""},comment:{},commentCuesheet:{},hideComment:{type:Boolean},disableSuperInput:{type:Boolean,default:!1},fontSizeDefault:{},fontFamilyDefault:{},isOpenSuperView:{type:Boolean},output:{default:"html"},dark:{type:Boolean,default:void 0},disabled:{type:Boolean},hideToolbar:{type:Boolean,default:!1},isShowFormatControlBar:{type:Boolean},customClassFormatControlBar:{},titleBarComment:{},titleBarContent:{},fieldNameComment:{},fieldNameCommentCuesheet:{},fieldNameContent:{},fieldNameSuper:{default:null},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:{},contentClass:{},isCompare:{type:Boolean},autoHeight:{type:Boolean},textAlert:{},customClassToolbar:{},readonly:{type:Boolean},canEditSuperReadOnly:{type:Boolean},autoFocus:{type:Boolean},superPreviewCustomClass:{},minChar:{},isAccordion:{type:Boolean},contentAutoCopied:{},isEditorView:{type:Boolean},isEditorViewSplitContent:{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;o.computed(()=>r.mode===Be.EDITOR);const s=mt.useEventBus(lr.RENDER_SUPER_TEXT),a=xn(),{isReady:l,editor:u,updateEditorState:c,checkSpellStore:f}=a,p=o.ref(!1);o.provide("isEditable",p);const m=o.ref(pw(r.modelValue));function g(C){if(r.disabled||r.readonly)return;const _=e5(C);i("lineFocus",{lineIndex:_})}function b(){i("lineFocus",{lineIndex:void 0})}const v=new Oo({enablePasteRules:!1,enableInputRules:!1,content:m.value,onCreate:({editor:C})=>{c(C)},onUpdate:tt.throttle(({editor:C})=>{l.value=!0;const _=E(C,r.output);i("update:modelValue",_),i("change",{editor:C,output:_}),c(C)},Bo),extensions:tt.uniqBy(tt.reverse(o.unref(r.extensions)),"name"),editable:p.value,onFocus:()=>{x(),w.value=!0,g(v)},onBlur:()=>{w.value=!1,b()},onSelectionUpdate:()=>{g(v)}}),w=o.ref(!1);function x(){i("setEditorSelected",v)}function k(){s.emit({action:"render"})}function E(C,_){if(!C)return"";if(C.isEmpty)return _==="json"?{}:"";switch(_){case"html":return C.getHTML();case"json":return C.getJSON();case"text":return C.getText();default:return""}}return o.watch(()=>f.languages,()=>{v.commands.checkSpelling()}),o.watch(()=>r.modelValue,C=>{if(!v||tt.isEqual(E(v,r.output),C))return;const{from:_,to:A}=v.state.selection;v.commands.setTextSelection({from:_,to:A}),k(),m.value=pw(C)},{deep:!0}),o.watch(()=>u.value,()=>{u.value&&u.value.on("selectionUpdate",({editor:C})=>{i("changed:selection",{editor:C})})}),o.watch(()=>r.disableSuperInput,()=>{const C=document.getElementById(ir.COMMENT);C==null||C.setAttribute(ir.DISABLE_SUPER_INPUT,`${r.disableSuperInput}`)}),o.onUnmounted(()=>v==null?void 0:v.destroy()),Qp(v),o.onMounted(()=>{var C,_;(C=v==null?void 0:v.commands)!=null&&C.setIsEnableSuggestion&&v.commands.setIsEnableSuggestion(!1),(_=v==null?void 0:v.commands)!=null&&_.setIsMobile&&v.commands.setIsMobile(!0)}),e({editor:v}),(C,_)=>{var T;const A=Ec;return o.openBlock(),o.createElementBlock(o.Fragment,null,[(T=C.fieldNameSuper)!=null&&T.label?(o.openBlock(),o.createBlock(A,{key:0,"field-name":C.fieldNameSuper,mode:C.mode,disabled:C.disabled,class:"mb-1",intent:"secondary"},null,8,["field-name","mode","disabled"])):o.createCommentVNode("",!0),o.createVNode(o.unref(Xn),{editor:o.unref(v),spellcheck:"true",class:o.normalizeClass(["flex-1 flex-col"])},null,8,["editor"])],64)}}}),PQ=(t,e)=>{let n=null;return t.state.doc.descendants((r,i)=>{if(r.type.name==="paragraph"&&Number(r.attrs["number-line"])===e)return n={node:r,pos:i},!1}),n},t5="focused-line";async function n5({lineIndex:t,editor:e}){if(e.state.doc.descendants((l,u)=>{if(l.attrs.class===t5){const c=e.state.tr.setNodeMarkup(u,void 0,{...l.attrs,class:""});return e.view.dispatch(c),!1}}),await o.nextTick(),!t)return;const n=PQ(e,t);if(!n)return;const{node:r,pos:i}=n,s=e.state.tr.setNodeMarkup(i,void 0,{...r.attrs,class:t5});e.view.dispatch(s),await o.nextTick(),e.view.nodeDOM(i).scrollIntoView({behavior:"smooth"})}const DQ=o.defineComponent({__name:"SuperViewMobileEditor",props:{isMobile:{type:Boolean},superTextArea:{},mode:{},modelValue:{default:""},comment:{default:""},commentCuesheet:{},hideComment:{type:Boolean},disableSuperInput:{type:Boolean},fontSizeDefault:{default:"12px"},fontFamilyDefault:{default:""},isOpenSuperView:{type:Boolean},output:{default:"html"},dark:{type:Boolean},disabled:{type:Boolean,default:!1},hideToolbar:{type:Boolean,default:!1},isShowFormatControlBar:{type:Boolean},customClassFormatControlBar:{},titleBarComment:{},titleBarContent:{},fieldNameComment:{},fieldNameCommentCuesheet:{},fieldNameContent:{default:null},fieldNameSuper:{default:null},isScreenSplit:{},isShowLineNumber:{type:Boolean},hideMenubar:{type:Boolean},disableBubble:{type:Boolean},hideBubble:{type:Boolean,default:!1},maxWidth:{default:void 0},minHeight:{default:200},maxHeight:{default:void 0},height:{default:void 0},extensions:{default:()=>[]},editorClass:{default:void 0},contentClass:{default:void 0},isCompare:{type:Boolean},autoHeight:{type:Boolean},textAlert:{},customClassToolbar:{default:""},readonly:{type:Boolean,default:!1},canEditSuperReadOnly:{type:Boolean},autoFocus:{type:Boolean},superPreviewCustomClass:{},minChar:{},isAccordion:{type:Boolean},contentAutoCopied:{},isEditorView:{type:Boolean},isEditorViewSplitContent:{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;o.provide("isMobile",!0),o.computed(()=>r.mode===Be.EDITOR);const s=mt.useEventBus(lr.INCREASE_DECREASE_FONTSIZE);o.useAttrs();const a=xn(),{state:l,isFullscreen:u,isReady:c,editor:f,updateEditorState:p,checkSpellStore:m}=a,g=o.ref(!1);o.provide("isEditable",g);const b=o.ref(void 0),v=o.ref(),w=o.computed(()=>[...l.extensions,...tt.differenceBy(r.extensions,l.extensions,"name")].map((F,P)=>F.configure({sort:P}))),x=o.ref(r.fontSizeDefault),k=o.ref(r.fontFamilyDefault);o.provide("fontSize",x),o.provide("fontFamily",k);const E=o.computed(()=>({fontFamily:k.value,fontSize:x.value})),C=o.ref(),_=F=>{const P=parseInt(x.value||"12px"),q=F?P+2:P-2;x.value=q+"px"};o.onBeforeMount(()=>{s.on(_)}),o.onBeforeUnmount(()=>{s.off(_)});const A=o.computed(()=>({...o.unref(u)?{height:"100%"}:{minHeight:r.minHeight?an(r.minHeight):void 0,maxHeight:r.maxHeight?an(r.maxHeight):void 0,height:r.height?an(r.height):void 0},maxWidth:an(r.maxWidth),width:r.maxWidth?"100%":void 0,margin:r.maxWidth?"0 auto":void 0}));function T(F){if(r.disabled||r.readonly)return;const P=e5(F);b.value=P}function L(){b.value=void 0}const I=new Oo({enablePasteRules:!1,enableInputRules:!1,content:pn(r.modelValue,r.disabled,r.mode),onCreate:({editor:F})=>{p(F)},onUpdate:tt.throttle(({editor:F})=>{c.value=!0;const P=te(F,r.output);i("update:modelValue",P),i("change",{editor:F,output:P}),p(F)},Bo),extensions:tt.uniqBy(tt.reverse(o.unref(w)),"name"),editable:g.value,onFocus:()=>{Q(),M.value=!0,T(I)},onBlur:()=>{M.value=!1,L()},onSelectionUpdate:()=>{T(I)}}),M=o.ref(!1),j=o.ref();o.onMounted(()=>{j.value=I});const D=({lineIndex:F})=>{var q;I&&n5({lineIndex:F,editor:I});const P=(q=v.value)==null?void 0:q.editor;P&&n5({lineIndex:F,editor:P})};o.watch(()=>b.value,F=>{i("lineFocus",{lineIndex:F}),D({lineIndex:F})},{immediate:!0});function Q(F){j.value=I}function te(F,P){if(!F)return"";if(F.isEmpty)return P==="json"?{}:"";switch(P){case"html":return F.getHTML();case"json":return F.getJSON();case"text":return F.getText({blockSeparator:`
305
305
  `});default:return""}}function H(F){return F.every(P=>I==null?void 0:I.extensionManager.extensions.find(q=>q.name===P))}return o.watch(()=>m.languages,()=>{I.commands.checkSpelling()}),o.watch(()=>r.modelValue,F=>{if(!I||tt.isEqual(te(I,r.output),F))return;const{from:P,to:q}=I.state.selection;I.commands.setTextSelection({from:P,to:q}),I.commands.setContent(pn(F,r.disabled,r.mode),!1)},{deep:!0}),o.watch(()=>f.value,()=>{f.value&&f.value.on("selectionUpdate",({editor:F})=>{i("changed:selection",{editor:F})})}),o.onUnmounted(()=>{var F;I==null||I.destroy(),(F=j.value)==null||F.destroy()}),Qu(Au.SAVE,()=>{localStorage.setItem("content",te(I,"html"))}),o.onMounted(()=>{var F,P;(F=I==null?void 0:I.commands)!=null&&F.setIsEnableSuggestion&&I.commands.setIsEnableSuggestion(!1),(P=I==null?void 0:I.commands)!=null&&P.setIsMobile&&I.commands.setIsMobile(!0)}),Qp(I),e({editor:I}),(F,P)=>{const q=Zp,J=Jp,G=Yp,oe=Bf,xe=Kk,Ce=Ec;return j.value?(o.openBlock(),o.createElementBlock("div",{key:0,id:"vdc-editor",ref_key:"editorRef",ref:C,style:o.normalizeStyle(A.value),class:o.normalizeClass(o.unref(ke)("vdc-editor mobile relative w-full flex flex-col editor-line-number editor-line",!r.height&&"flex-1",F.editorClass))},[!F.hideBubble&&!F.disabled&&g.value?(o.openBlock(),o.createElementBlock(o.Fragment,{key:0},[H([o.unref(pc)])?(o.openBlock(),o.createBlock(q,{key:0,editor:o.unref(I)},null,8,["editor"])):o.createCommentVNode("",!0),H([o.unref(fa)])?(o.openBlock(),o.createBlock(J,{key:1,editor:o.unref(I)},null,8,["editor"])):o.createCommentVNode("",!0),H([o.unref(ps)])?(o.openBlock(),o.createBlock(G,{key:2,editor:o.unref(I)},null,8,["editor"])):o.createCommentVNode("",!0),H([o.unref(hs),o.unref(ms)])?(o.openBlock(),o.createBlock(oe,{key:3,editor:o.unref(I)},null,8,["editor"])):o.createCommentVNode("",!0)],64)):o.createCommentVNode("",!0),F.hideToolbar?o.createCommentVNode("",!0):(o.openBlock(),o.createBlock(xe,{key:1,editor:j.value,mode:F.mode,disabled:F.disabled,class:"mb-[3px]","custom-class-toolbar":F.customClassToolbar,"active-extensions":[hc]},null,8,["editor","mode","disabled","custom-class-toolbar","active-extensions"])),o.createVNode(o.unref(eh),{class:o.normalizeClass(o.unref(ke)("flex flex-col")),style:o.normalizeStyle({...E.value}),horizontal:""},{default:o.withCtx(()=>[o.createVNode(o.unref(Ko),{size:50,class:"border-none p-0 flex flex-col bg-[#EEEEEE]"},{default:o.withCtx(()=>{var He;return[o.createElementVNode("div",{class:o.normalizeClass(o.unref(ke)("flex-1 !overflow-y-auto scrollbar-hide basis-0 flex flex-col pt-1.5 p-2.5 border border-ed-gray rounded-[5px]",F.contentClass))},[(He=F.fieldNameContent)!=null&&He.label?(o.openBlock(),o.createBlock(Ce,{key:0,"field-name":F.fieldNameContent,mode:F.mode,disabled:F.disabled,class:"mb-1"},null,8,["field-name","mode","disabled"])):o.createCommentVNode("",!0),o.createVNode(o.unref(Xn),{editor:o.unref(I),spellcheck:"true",class:o.normalizeClass(["flex-1 flex-col"])},null,8,["editor"])],2)]}),_:1}),o.createVNode(o.unref(Ko),{size:50,class:"border-none p-0 flex flex-col"},{default:o.withCtx(()=>[o.createElementVNode("div",{class:o.normalizeClass(o.unref(ke)("flex-1 overflow-y-auto scrollbar-hide flex flex-col pt-1.5 p-2.5 border border-ed-gray rounded-[5px]",M.value&&"border-ed-blue",F.disabled&&"border-transparent",F.contentClass))},[o.createVNode(LQ,{ref_key:"superEditorRef",ref:v,mode:F.mode,"field-name-super":F.fieldNameSuper,extensions:F.extensions,"model-value":F.modelValue,disabled:F.disabled,readonly:F.readonly,onLineFocus:D},null,8,["mode","field-name-super","extensions","model-value","disabled","readonly"])],2)]),_:1})]),_:1},8,["class","style"])],6)):o.createCommentVNode("",!0)}}}),r5={"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.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"},o5={"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.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":"확인"},VQ=e$({legacy:!1,locale:"en",fallbackLocale:"en",messages:{en:r5,ko:o5}});hC();const i5={install(t){t.use(VQ),t.component("vdc-editor",Np)}},FQ=mt.useEventBus(lr.RENDER_SUPER_TEXT);function $Q(){FQ.emit({action:"render"})}const zQ={class:"min-h-[188px] flex flex-col items-center justify-center gap-y-2 text-sm"},HQ=o.defineComponent({__name:"BulkSpellCheckerFail",setup(t){return(e,n)=>(o.openBlock(),o.createElementBlock("div",zQ,[o.createVNode(o.unref(xU),{class:"h-12 w-12 text-red-500"}),n[0]||(n[0]=o.createElementVNode("div",null,"맞춤법 검사에 실패했습니다",-1)),n[1]||(n[1]=o.createElementVNode("p",{class:"text-xs font-normal text-gray-600 dark:text-gray-400"},"다시 검사하기 버튼을 눌러 재시도 해주세요",-1))]))}}),UQ={class:"min-h-[188px] flex flex-col items-center justify-center gap-y-2 text-sm"},WQ=o.defineComponent({__name:"BulkSpellCheckerNotWrongWord",setup(t){return(e,n)=>(o.openBlock(),o.createElementBlock("div",UQ,[o.createVNode(o.unref(CU),{class:"h-12 w-12 text-blue-500"}),n[0]||(n[0]=o.createElementVNode("div",null,"맞춤법 오류가 없습니다",-1))]))}}),jQ={class:"relative"},qQ=["innerHTML"],KQ={class:"border-b border-gray-500"},GQ=o.defineComponent({__name:"BulkSpellCheckerHelpText",props:{text:{}},setup(t){const e=o.ref(!1),n=o.ref(!1),r=o.ref(null);function i(){e.value=!e.value}return o.onMounted(async()=>{await o.nextTick(),r.value&&r.value.scrollHeight>32&&(n.value=!0)}),(s,a)=>(o.openBlock(),o.createElementBlock("div",jQ,[o.createElementVNode("div",{ref_key:"helpRef",ref:r,class:o.normalizeClass(["text-gray-700 dark:text-gray-400 transition-all",o.unref(e)?"max-h-none":"max-h-[32px] overflow-hidden"]),innerHTML:s.text},null,10,qQ),o.unref(n)?(o.openBlock(),o.createElementBlock("div",{key:0,class:o.normalizeClass(["",o.unref(ke)("w-32 flex items-end justify-end bg-gradient-to-l from-white via-white to-transparent dark:from-ed-background dark:via-ed-background",o.unref(e)?"ml-auto opacity-60":"absolute bottom-0 right-0")])},[o.createElementVNode("button",{class:"flex items-center gap-1",onClick:o.withModifiers(i,["stop"])},[o.createElementVNode("span",KQ,o.toDisplayString(o.unref(e)?"접기":"자세히"),1),o.createVNode(o.unref(tc),{class:o.normalizeClass(["w-4 h-4 transition-transform",o.unref(e)?"rotate-180":""])},null,8,["class"])])],2)):o.createCommentVNode("",!0)]))}}),Jb=new Et("bulk-spellcheck-highlight");function XQ(t,e,n=`