vdc-editor 0.1.283 → 0.1.284
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/BulkSpellChecker-D7aiZpot.mjs +5 -0
- package/lib/BulkSpellChecker-D7aiZpot.mjs.map +1 -0
- package/lib/{index-C51bIxfa.mjs → index-D9tSccpX.mjs} +4733 -4729
- package/lib/{index-C51bIxfa.mjs.map → index-D9tSccpX.mjs.map} +1 -1
- package/lib/vdc-editor.mjs +1 -1
- package/lib/vdc-editor.umd.js +1 -1
- package/lib/vdc-editor.umd.js.map +1 -1
- package/package.json +1 -1
- package/lib/BulkSpellChecker-DgIhy1y0.mjs +0 -5
- package/lib/BulkSpellChecker-DgIhy1y0.mjs.map +0 -1
package/lib/vdc-editor.umd.js
CHANGED
|
@@ -342,7 +342,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`),X=R,q=H),L===void 0&&(
|
|
|
342
342
|
`}),O=getComputedStyle(b.value);k.font=O.font;const M=20,$=()=>Math.max(0,(v.value||0)-M);function V(F,R){let H=1,L=F.length,q=0;for(;H<=L;){const X=Math.floor((H+L)/2);k.measureText(F.slice(0,X)).width<=R?(q=X,H=X+1):L=X-1}return q}let G="";const ee=[];for(const F of D){if(F===`
|
|
343
343
|
`){ee.push(G),G="";continue}if(G+=F,k.measureText(G).width>$())for(;k.measureText(G).width>$();){const R=V(G,$());R<=0?(ee.push(G.charAt(0)),G=G.slice(1)):(ee.push(G.slice(0,R)),G=G.slice(R))}}return ee.push(G),ee.map(F=>`<p>${F}</p>`).join("")}const _=o.computed(()=>{var O,M,$;const D=($=(M=(O=r.parentEditor)==null?void 0:O.storage.superText.superInputModal)==null?void 0:M.props)==null?void 0:$.guidelineLeftOffset;return s.value||!D?{}:{backgroundImage:"linear-gradient(to right, #d1d5db 1px, transparent 1px)",backgroundSize:"1px 100%",backgroundRepeat:"no-repeat",backgroundPosition:rn(D)}}),{isScrolling:T,handleScroll:A}=Xl();return e({insertSpecialCharater:m,isChecked:u,toggleSpellCheck:g,wrapText:C,editor:p}),(D,O)=>(o.openBlock(),o.createElementBlock("div",{ref_key:"contentInner",ref:b,style:o.normalizeStyle([o.unref(x),o.unref(_)]),onScroll:O[0]||(O[0]=(...M)=>o.unref(A)&&o.unref(A)(...M)),class:o.normalizeClass(o.unref(Se)("h-40 overflow-y-auto border focus-within:border-ed-input-focus rounded-[3px] p-2.5 relative",D.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(T)&&"scrollbar-thumb-transparent"))},[o.createVNode(o.unref(Qn),{id:"editor-panel",editor:o.unref(p),class:o.normalizeClass(o.unref(Se)("vdc-editor relative h-full"))},null,8,["editor","class"])],38))}}),KJ={class:"sr-only"},GJ={class:"grid m-2.5 p-2.5 gap-y-2.5 rounded border border-gray-200"},XJ={class:"grid grid-cols-[60px,1fr] gap-x-2"},YJ={class:"flex items-center space-x-2 text-xs font-normal [&>input[type='checkbox']]:h-[20px] [&>input[type='checkbox']]:w-[20px] [&>input[type='checkbox']]:!border-ed-border [&>input[type='checkbox']]:shadow"},JJ=["checked"],ZJ={for:"spellcheck",class:"select-none whitespace-nowrap"},QJ={class:"flex gap-x-1"},NJ={class:"ml-auto"},eZ={class:"grid grid-cols-[60px,1fr] gap-x-2"},tZ={class:"text-right text-sm p-2"},nZ={class:"grid grid-cols-[60px,1fr] gap-x-2"},ck=5,Wc=o.defineComponent({__name:"SuperInputDialog",props:{editor:{},open:{type:Boolean},superTextInit:{},superTextElementId:{}},emits:["close","save"],setup(t,{emit:e}){var F,R;const n=e,r=t,{t:i}=Tt(),s=o.ref(""),a=o.ref(""),l=o.ref(null),u=o.ref(!1),c=Ne.useLocalStorage("superInputModalPosition",null),f=o.reactive({x:0,y:0}),p=o.ref(!1),m={x:0,y:0},g=o.ref(!1),b=o.ref(!1),v=o.ref(!1),y=H=>{p.value=!0;const L=H.currentTarget.closest(".draggable-dialog").getBoundingClientRect();m.x=H.clientX-L.left,m.y=H.clientY-L.top,document.addEventListener("mousemove",x),document.addEventListener("mouseup",E)},x=H=>{p.value&&(f.x=H.clientX-m.x,f.y=H.clientY-m.y)},E=()=>{p.value=!1,c.value={x:f.x,y:f.y},document.removeEventListener("mousemove",x),document.removeEventListener("mouseup",E)};o.watch(()=>r.open,async H=>{if(!H)return;b.value=!1,r.superTextInit&&(s.value=r.superTextInit,r.superTextElementId&&(a.value=r.superTextElementId)),await o.nextTick();const L=document.querySelector(".draggable-dialog");if(!L)return;L.getBoundingClientRect();const q=window.innerWidth,X=window.innerHeight;c.value&&c.value.x!==void 0&&c.value.y!==void 0?(f.x=c.value.x,f.y=c.value.y):(f.x=Math.max((q-L.offsetWidth)/2,0),f.y=Math.max((X-L.offsetHeight)/2,0))});const k=()=>{n("close"),s.value="",a.value="",u.value=!1},C=()=>{var L;if((L=l.value)==null?void 0:L.editor.commands.hasInvalidChar()){v.value=!0;return}s.value=l.value.wrapText(),a.value="",b.value?g.value=!0:n("close"),n("save",s.value),s.value=""},_=()=>{g.value=!1,n("close")},T=(R=(F=r.editor)==null?void 0:F.extensionManager.extensions.find(H=>H.name==="superText"))==null?void 0:R.options.specialCharModal,A=o.inject("fontFamily",""),D=o.computed(()=>{var H,L,q;return np(r.editor,uc)&&o.unref(A)?o.unref(A):(q=(L=(H=r.editor)==null?void 0:H.storage.superText.superInputModal)==null?void 0:L.props)==null?void 0:q.fontFamily}),O=Ne.useLocalStorage("recentSpecialChars",[]),M=H=>{if(!H)return;const L=(O.value??[]).filter(q=>q!==H);L.unshift(H),O.value=L.slice(0,ck)},$=H=>{var L;(L=l.value)==null||L.insertSpecialCharater(H)},V=(H,L)=>{var q;L&&((q=l.value)==null||q.insertSpecialCharater(H),M(H))},G=o.computed(()=>{var H;return(H=l.value)==null?void 0:H.isChecked}),ee=()=>{var H;(H=l.value)==null||H.toggleSpellCheck()};o.onUnmounted(()=>{document.removeEventListener("mousemove",x),document.removeEventListener("mouseup",E)}),o.watch(s,H=>{!r.superTextElementId||r.superTextElementId===""||(b.value=H!==(r.superTextInit??""))});const W=o.computed(()=>{var H;return(H=l.value)==null?void 0:H.editor});return(H,L)=>{const q=dh,X=ch,le=uh,pe=lh,_e=lk,re=iv,be=Vc,Y=Pc,te=SX;return o.openBlock(),o.createElementBlock(o.Fragment,null,[o.createVNode(Y,{open:H.open},{default:o.withCtx(()=>[o.createVNode(o.unref(F1),null,{default:o.withCtx(()=>[o.createVNode(o.unref(j1),{class:"!pointer-events-none bg-black/30"}),o.createVNode(be,{"is-overlay-transparent":"",class:"p-0 gap-0 !animate-none !transition-none max-w-max","as-child":""},{default:o.withCtx(()=>{var ne,oe;return[o.createElementVNode("div",{class:"draggable-dialog fixed z-[70] pointer-events-auto",style:o.normalizeStyle({top:"0px",left:"0px",transform:`translate(${f.x}px, ${f.y}px)`,fontFamily:o.unref(D)})},[o.createVNode(le,{class:"bg-blue-500 text-white p-2.5 rounded-t-[5px] cursor-move",onMousedown:o.withModifiers(y,["prevent"])},{default:o.withCtx(()=>[o.createVNode(q,null,{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(i)("editor.superinput")),1)]),_:1}),o.createVNode(X,{class:"absolute right-3 top-3 text-white",onClick:k},{default:o.withCtx(()=>[o.createVNode(o.unref(kc),{class:"w-5 h-5"}),o.createElementVNode("span",KJ,o.toDisplayString(H.$t("editor.close")),1)]),_:1})]),_:1}),o.createVNode(pe),o.createElementVNode("div",GJ,[o.createElementVNode("div",XJ,[L[5]||(L[5]=o.createElementVNode("label",null," ",-1)),o.createElementVNode("div",{class:o.normalizeClass(o.unref(Se)("flex gap-x-6",o.unref(O).length===ck&&"gap-x-4"))},[o.createVNode(vn,{class:"text-[#65558F] bg-[#ECE6F0] hover:bg-[#ECE6F0]/90 shadow text-xs rounded font-normal h-[25px] px-3",onClick:L[0]||(L[0]=ce=>u.value=!0)},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(i)("editor.insert.symbol")),1)]),_:1}),o.createElementVNode("div",YJ,[o.createElementVNode("input",{id:"spellcheck",type:"checkbox",class:"shrink-0",checked:o.unref(G),onChange:ee},null,40,JJ),o.createElementVNode("label",ZJ,o.toDisplayString(o.unref(i)("editor.menubar.menu.spellCheck")),1)]),o.createElementVNode("div",QJ,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(o.unref(O),ce=>(o.openBlock(),o.createBlock(vn,{key:ce,variant:"outline",size:"xs",class:"h-[25px] w-[25px] p-0",onClick:Ae=>$(ce)},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(ce),1)]),_:2},1032,["onClick"]))),128))]),o.createElementVNode("div",NJ,[o.unref(W)?(o.openBlock(),o.createBlock(_e,{key:0,editor:o.unref(W),isEnableSpellCheckRealTime:(ne=o.unref(W))==null?void 0:ne.extensionStorage.spellchecker.spellchecker.proofreader.enabled,align:"left"},null,8,["editor","isEnableSpellCheckRealTime"])):o.createCommentVNode("",!0)])],2),u.value?(o.openBlock(),o.createBlock(o.resolveDynamicComponent((oe=o.unref(T))==null?void 0:oe.component),o.mergeProps({key:0,"custom-class":"!z-[70] !pointer-events-auto","font-family":o.unref(D)},o.unref(T).props,{onSelectedChar:V,onClose:L[1]||(L[1]=ce=>u.value=!1)}),null,16,["font-family"])):o.createCommentVNode("",!0)]),o.createElementVNode("div",eZ,[o.createElementVNode("label",tZ,o.toDisplayString(o.unref(i)("editor.detail")),1),o.createVNode(Ev,{ref_key:"simpleEditorRef",ref:l,modelValue:s.value,"onUpdate:modelValue":L[2]||(L[2]=ce=>s.value=ce),"parent-editor":H.editor,class:""},null,8,["modelValue","parent-editor"])]),o.createElementVNode("div",nZ,[L[6]||(L[6]=o.createElementVNode("label",{class:"text-right text-sm p-2"},"ID",-1)),o.createVNode(hs,{modelValue:a.value,"onUpdate:modelValue":L[3]||(L[3]=ce=>a.value=ce),class:"rounded-none","default-value":a.value,disabled:""},null,8,["modelValue","default-value"])])]),o.createVNode(re,{class:"sm:justify-center pb-3.5 pt-1"},{default:o.withCtx(()=>[o.createVNode(vn,{as:"button",variant:"default",class:"bg-blue-500 hover:bg-blue-500/90",onClick:C},{default:o.withCtx(()=>[o.createVNode(o.unref(cb),{class:"w-5 h-5 mr-2"}),o.createTextVNode(" "+o.toDisplayString(o.unref(i)("editor.check")),1)]),_:1}),o.createVNode(vn,{as:"button",variant:"destructive",onClick:k},{default:o.withCtx(()=>[o.createVNode(o.unref(kc),{class:"w-5 h-5 mr-2"}),o.createTextVNode(" "+o.toDisplayString(H.$t("editor.close")),1)]),_:1})]),_:1})],4)]}),_:1})]),_:1})]),_:1},8,["open"]),o.createVNode(te,{open:g.value,onClose:_},null,8,["open"]),o.createVNode(te,{title:"Information",message:"{ 과 } 는 입력이 제한된 문자열 입니다.",iconName:"MessageCircleWarning",confirmText:"Ok",open:v.value,onClose:L[4]||(L[4]=ne=>v.value=!1)},null,8,["open"])],64)}}}),kv=o.defineComponent({__name:"SelectContextMenu",props:{editor:{},mode:{},superTextStore:{},disabled:{type:Boolean},disableSuperInput:{type:Boolean}},setup(t,{expose:e}){const n=t,{t:r}=Tt(),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===Me.EDITOR||n.mode===Me.PLAIN_TEXT||!l.value||n.disableSuperInput);function c(){if(!n.editor)return"";const{from:E,to:k}=n.editor.state.selection,C=n.editor.state.doc.cut(E,k),T=Pr.fromSchema(n.editor.schema).serializeFragment(C.content),A=document.createElement("div");return A.appendChild(T),A.innerHTML}const f=()=>{const{view:E}=n.editor,{from:k,to:C}=E.state.selection,_=c();s.text=_,s.from=k,s.to=C},p=()=>i.value=!i.value,m=()=>{u.value||(i.value=!0,f())},g=()=>i.value=!1,b=E=>{const k=n==null?void 0:n.superTextStore.addMoreSuperText(E);n.editor&&n.editor.commands.insertContentAt(s.from,{type:"superText",attrs:{"data-id":k,"data-text":E}}),i.value=!1,requestAnimationFrame(()=>{n.editor.commands.setTextSelection(s.from+1),n.editor.view.focus()})},v=o.ref(!1),y=async E=>{var k,C;if(E){const _=await((C=(k=n.editor).hasClipboard)==null?void 0:C.call(k));v.value=!!_}},x=()=>{if(u.value||!n.editor)return;const{view:E,state:k}=n.editor,{from:C,to:_}=k.selection;s.from=C,s.to=_,s.text="",E.dom.blur(),i.value=!0};return e({toggleDialog:p,openDialog:m,closeDialog:g}),(E,k)=>{const C=Wc,_=ov,T=rv,A=nv,D=tv;return o.openBlock(),o.createElementBlock(o.Fragment,null,[o.createVNode(C,{open:i.value,editor:E.editor,"super-text-init":s.text,onClose:p,onSave:b},null,8,["open","editor","super-text-init"]),o.createVNode(D,{"onUpdate:open":y},{default:o.withCtx(()=>[o.createVNode(_,{as:"template",class:"relative",disabled:o.unref(u),onDblclick:o.withModifiers(x,["prevent","stop"])},{default:o.withCtx(()=>[o.renderSlot(E.$slots,"default")]),_:3},8,["disabled"]),o.createVNode(A,null,{default:o.withCtx(()=>[E.disableSuperInput?o.createCommentVNode("",!0):(o.openBlock(),o.createBlock(T,{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(T,{key:1,onSelect:k[0]||(k[0]=O=>{var M;return(M=E.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(T,{key:2,onSelect:k[1]||(k[1]=O=>{var M;return(M=E.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(T,{key:3,disabled:!v.value,onSelect:k[2]||(k[2]=O=>{var M;return(M=E.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)}}}),rZ={id:"editor-panel",class:"flex relative w-full h-full"},oZ=uo(o.defineComponent({__name:"PageNode",props:na,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===Me.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=Ne.useEventBus(fr.SUPER_VIEW_PAGE);return o.watch(()=>t.node.attrs,v=>{b.emit(v.pageNumber)},{immediate:!0}),(v,y)=>{var E,k,C,_;const x=kv;return o.openBlock(),o.createBlock(o.unref(ta),{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":((E=o.unref(a))==null?void 0:E.top)??"0","--umo-page-margin-bottom":((k=o.unref(a))==null?void 0:k.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",rZ,[o.createVNode(x,{mode:c.value?o.unref(Me).REPORT:o.unref(Me).EDITOR,editor:v.editor,"super-text-store":o.unref(r)},{default:o.withCtx(()=>[o.createVNode(o.unref(e6),{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 dk(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 iZ=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:i})=>{const{selection:s,doc:a}=e,{$from:l,$to:u}=s,c=i.extensionManager.attributes,f=kh(c,l.node().type.name,l.node().attrs);if(f.id=ev(),f.extend&&(f.extend=!1),s instanceof Ve&&s.node.isBlock)return!l.parentOffset||!yr(a,l.pos)?!1:(r&&(t&&dk(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 Pe&&e.deleteSelection();const m=l.depth===0?void 0:e4(l.node(-1).contentMatchAt(l.indexAfter(-1)));let g=p&&m?[{type:m,attrs:f}]:void 0,b=yr(e.doc,e.mapping.map(l.pos),1,g);if(!g&&!b&&yr(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()),y=e.doc.resolve(v);l.node(-1).canReplaceWith(y.index(),y.index()+1,m)&&e.setNodeMarkup(e.mapping.map(l.before()),m)}t&&dk(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return!0},sZ=t=>({tr:e,state:n,dispatch:r,editor:i})=>{var v;const s=yn(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 y=ge.empty;const x=a.index(-1)?1:a.index(-2)?2:3;for(let A=a.depth-x;A>=a.depth-3;A-=1)y=ge.from(a.node(A).copy(y));const E=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,k=kh(f,a.node().type.name,a.node().attrs),C=((v=s.contentMatch.defaultType)==null?void 0:v.createAndFill(k))??void 0;y=y.append(ge.from(s.createAndFill(null,C)??void 0));const _=a.before(a.depth-(x-1));e.replace(_,a.after(-E),new Te(y,4-x,0));let T=-1;e.doc.nodesBetween(_,e.doc.content.size,(A,D)=>{if(T>-1)return!1;A.isTextblock&&A.content.size===0&&(T=D+1)}),T>-1&&e.setSelection(Pe.near(e.doc.resolve(T))),e.scrollIntoView()}return!0}const p=l.pos===a.end()?c.contentMatchAt(0).defaultType:null,m=kh(f,c.type.name,c.attrs),g=kh(f,a.node().type.name,a.node().attrs);m.id=ev(),g.id=ev(),e.delete(a.pos,l.pos);const b=p?[{type:s,attrs:m},{type:p,attrs:g}]:[{type:s,attrs:m}];if(!yr(e.doc,a.pos,2))return!1;if(r){const{selection:y,storedMarks:x}=n,{splittableMarks:E}=i.extensionManager,k=x??(y.$to.parentOffset&&y.$from.marks());if(e.split(a.pos,2,b).scrollIntoView(),!k||!r)return!0;const C=k.filter(_=>E.includes(_.type.name));e.ensureMarks(C)}return!0},aZ=[Yf,Xf,Jf,_g,Zf,ds,Ag,Bl,Og,Ig,Mg,ma,Il,bi,Bg,Rg,Tg,Gr],lZ=Lt.create({priority:200,name:`${Gr}`,content:"block*",group:`${Gr}`,isolating:!0,selectable:!1,draggable:!1,isLeaf:!0,addOptions(){return{SystemAttributes:{},nodesComputed:{},View:ra(oZ),types:[],slots:{}}},addAttributes(){return{HTMLAttributes:{},id:{default:Xr(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",{...yt(e),"data-type":this.name},0]},addCommands(){return{splitBlock:iZ,splitListItem:sZ,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:aZ.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=je.atStart(a).from===c;return!l||!p||!f.type.isTextblock||f.textContent.length?!1:r.clearNodes()}),()=>fk(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(je.atEnd(l).from===c&&!u.parentOffset)return r.deleteNode(Gr);const f=li(p=>p.type.name===Gr)(a);if(f){if(!f.node.firstChild)return r.deleteNode(Gr);const p=f.node.firstChild.type;if(f.start+je.atStart(f.node).from===c){const g=Pe.create(l,f.start-2,f.start-2),b=li(v=>v.type.name===Gr)(g);if(b){const v=je.atEnd(b.node).from+b.start,y=Pe.create(l,v,v);if(p===b.node.lastChild.type){const{parent:x}=y.$anchor;return yX(x,i.schema)?s.setSelection(y):s.step(new gn(v,c,Te.empty)),!0}s.setSelection(y)}return!0}}return!1})]),Delete:()=>this.editor.commands.first(({commands:r})=>[()=>fk(r),()=>r.command(({tr:i})=>{const{selection:s,doc:a}=i,{$anchor:l}=s,u=l.node(),c=li(f=>f.type.name===Bl)(s);return c&&c.start+je.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(je.atEnd(a).from===u)return r.deleteNode(Gr);const c=li(f=>f.type.name===Gr)(s);if(c&&c.start+je.atEnd(c.node).from===u){const p=Pe.create(a,u+2,u+2),m=li(g=>g.type.name===Gr)(p);if(m){const g=je.atStart(m.node).from+m.start,b=Pe.create(a,g,g);if(li(y=>y.attrs.extend)(b))return i.step(new gn(u,g,Te.empty)),!0}}return!1})]),Tab:()=>this.editor.commands.first(({commands:r})=>[()=>!0]),"Mod-Enter":()=>this.editor.commands.setPageBreak()}},addNodeView(){return this.options.View}});function kh(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const i=t.find(s=>s.type===e&&s.name===r);return i?i.attribute.keepOnSplit:!1}))}const fk=t=>t.command(({tr:e})=>{const{selection:n,doc:r}=e,i=t4(r,{from:n.from,to:n.to},s=>s.type.name===Bl);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()}),uZ=et.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()}}}),cZ=["data-font"],dZ=o.defineComponent({__name:"FontFamilyMenuButton",props:{editor:{},disabled:{type:Boolean,default:!1},color:{default:void 0},shortcutKeys:{default:void 0},maxHeight:{default:void 0},tooltip:{default:""},items:{default:()=>[]},customClass:{default:""},showDefaultDivider:{type:Boolean,default:!1}},setup(t){const e=t,n=o.computed(()=>e.editor.extensionStorage["base-kit"].mode===Me.EDITOR),{t:r}=Tt(),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;let m=[];return kt.isEmpty(p.fontFamilyList)?m=i:m=p.fontFamilyList.filter(g=>g.enabled!==!1).map(g=>({label:g.label,value:g.value})),[{label:r("editor.fontFamily.default"),value:r("editor.fontFamily.default")},...m]}),l=o.computed(()=>{const p={label:r("editor.fontFamily.default"),value:r("editor.fontFamily.default")};return n.value?L0(e.editor.state,"textStyle").fontFamily||p.value:s.value||p.value}),u=Ne.useEventBus("fontFamily");function c(p){p.value===l.value||p.value===r("editor.fontFamily.default")?(e.editor.chain().focus().unsetFontFamily().run(),s.value=null):(s.value=p.value,e.editor.chain().focus().setFontFamily(p.value).run(),u.emit()),e.editor.commands.setForceCloseBubble(!0)}e.editor.on("selectionUpdate",({editor:p})=>{p.state.selection.empty&&e.editor.commands.resetForceCloseBubble()});const f=o.computed(()=>{var m,g;const p=((m=a.value[0])==null?void 0:m.label)||r("editor.fontFamily.default");return((g=a.value.find(b=>b.value===l.value))==null?void 0:g.label)||p});return(p,m)=>(o.openBlock(),o.createBlock(ka,{disabled:p.disabled,tooltip:p.tooltip,title:f.value,btn_class:`min-w-20 ${p.customClass}`,class:"inside-toolbar"},{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($l),{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,cZ)]),_:2},1032,["checked","onClick"]),g.label===o.unref(r)("editor.fontFamily.default")&&p.showDefaultDivider?(o.openBlock(),o.createBlock(o.unref(pb),{key:0})):o.createCommentVNode("",!0)],64))),128))]),_:1},8,["disabled","tooltip","title","btn_class"]))}}),pk=uZ.extend({name:"fontFamily",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),types:["textStyle"],fontFamilyList:[],button({editor:e,extension:n,t:r}){return{component:dZ,componentProps:{editor:e,disabled:!e.can().setFontFamily(""),tooltip:r("editor.fontFamily.tooltip")}}}}},addGlobalAttributes(){return[{types:["paragraph","heading","textStyle"],attributes:{style:{default:null,parseHTML:t=>t.style.fontFamily||null,renderHTML:t=>t.style?{style:`font-family: ${t.style}`}:{}},fontFamily:{default:null,parseHTML:t=>t.style.fontFamily.replace(/['"]/g,""),renderHTML:t=>t.fontFamily?{style:`font-family: ${t.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:t=>({chain:e})=>e().setMark("textStyle",{fontFamily:t}).run(),unsetFontFamily:()=>({chain:t})=>t().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}},addStorage(){return{value:null}},onUpdate(){this.storage.value=this.editor.getAttributes("textStyle").fontFamily}}),fZ=et.create({name:"fontWeight",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),types:["textStyle"]}},addGlobalAttributes(){return[{types:["paragraph","textStyle"],attributes:{fontWeight:{default:null,parseHTML:t=>t.style.fontWeight||null,renderHTML:t=>t.fontWeight?{style:`font-weight: ${t.fontWeight}`}:{}}}}]},addCommands(){return{setFontWeight:t=>({chain:e})=>e().setMark("textStyle",{fontWeight:t}).run(),unsetFontWeight:()=>({chain:t})=>t().setMark("textStyle",{fontWeight:null}).removeEmptyTextStyle().run()}},addStorage(){return{value:null}},onUpdate(){this.storage.value=this.editor.getAttributes("textStyle").fontWeight}}),pZ={class:"flex gap-2"},hZ=["disabled"],mZ=uo(o.defineComponent({__name:"FontSizeIncreaseDecrease",props:{editor:Object},setup(t){const e=o.inject("fontSize"),n=o.computed(()=>e.value?parseInt(e.value)===parseInt(l1[0])||parseInt(e.value)<parseInt(l1[0]):!1),r=Ne.useEventBus(fr.INCREASE_DECREASE_FONTSIZE),i=s=>{r.emit(s)};return(s,a)=>{const l=va,u=ba,c=ya;return o.openBlock(),o.createElementBlock("div",pZ,[o.createVNode(c,null,{default:o.withCtx(()=>[o.createVNode(u,{"delay-duration":0},{default:o.withCtx(()=>[o.createVNode(l,null,{default:o.withCtx(()=>[o.createElementVNode("button",{class:"btn",onClick:a[0]||(a[0]=f=>i(!0))},[o.createVNode(o.unref(Ot),{name:"Plus",class:"w-6 h-6"})])]),_:1}),o.createVNode(o.unref(ms),null,{default:o.withCtx(()=>a[2]||(a[2]=[o.createTextVNode(" 글꼴 크기 크게 ")])),_:1})]),_:1})]),_:1}),o.createVNode(c,null,{default:o.withCtx(()=>[o.createVNode(u,{"delay-duration":0},{default:o.withCtx(()=>[o.createVNode(l,null,{default:o.withCtx(()=>[o.createElementVNode("button",{class:"btn",onClick:a[1]||(a[1]=f=>i(!1)),disabled:o.unref(n)},[o.createVNode(o.unref(Ot),{name:"Minus",class:"w-6 h-6"})],8,hZ)]),_:1}),o.createVNode(o.unref(ms),null,{default:o.withCtx(()=>a[3]||(a[3]=[o.createTextVNode(" 글꼴 크기 작게 ")])),_:1})]),_:1})]),_:1})])}}}),[["__scopeId","data-v-250d04b3"]]),gZ=zn.create({name:"fontSizeIncreaseDecrease",addOptions(){return{defaultSize:"14px",button({editor:t}){return{component:mZ,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})}}}),Sv=et.create({name:"painter",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:e,extension:n,t:r})=>({component:Xe,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 nt({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}}}})]}}),_v=()=>Xr(10),hk=new Et("attrkey"),bZ=t=>new nt({key:hk,state:{init:()=>!1,apply:n=>n.getMeta("initSplit")},appendTransaction(n,r,i){const{tr:s}=i;let a=!1;const l=hk.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)?_v():b.id||_v();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}}),mk=[Yf,Xf,Jf,_g,Zf,ds,Ag,Bl,Og,Ig,Mg,ma,Il,bi,Bg,Rg,Tg,Gr],vZ=et.create({name:"autoId",addGlobalAttributes(){return[{types:mk.concat(this.options.types||[]),attributes:{id:{default:_v()},extend:{default:!1},class:{default:null},"number-line":{default:null}}}]},addProseMirrorPlugins(){return[bZ(mk.concat(this.options.types||[]))]}}),yZ=["paragraph","heading","list_item","todo_item"];function wZ(t,e){const{selection:n,doc:r}=t;if(!n||!r||!(n instanceof Pe||n instanceof Fn))return t;const{from:i,to:s}=n,a=[],l=e&&e!==s6?e:null;return r.nodesBetween(i,s,(u,c)=>{const f=u.type;return yZ.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 xZ(t){return({state:e,dispatch:n})=>{const{selection:r}=e;let{tr:i}=e;return i=i.setSelection(r),i=wZ(i,t),i.docChanged?(n&&n(i),!0):!1}}const CZ=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}=Tt();function n(l){return parseFloat(l.replace("%",""))/100}const r=o.computed(()=>{const c=s.editor.extensionManager.extensions.find(f=>f.name==="lineHeight").options.lineHeights.map(f=>({label:n(f),value:f}));return c.unshift({label:o.unref(e)("editor.default"),value:"default"}),c}),i=o.ref("default"),s=t;function a(l){l==="default"?s.editor.chain().focus().unsetLineHeight().run():s.editor.chain().focus().setLineHeight(l).run(),i.value=l}return(l,u)=>(o.openBlock(),o.createBlock(ka,{icon:l.icon,tooltip:l.tooltip,disabled:l.disabled,class:"inside-toolbar"},{default:o.withCtx(()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(r.value,(c,f)=>(o.openBlock(),o.createBlock(o.unref($l),{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"]))}}),gk=et.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:s6,button({editor:e,t:n}){return{component:CZ,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=>xZ(t),unsetLineHeight:()=>({commands:t})=>this.options.types.every(e=>t.resetAttributes(e,"lineHeight"))}}}),EZ=Lt.create({name:"column",content:"block+",isolating:!0,addAttributes(){return{position:{default:"",parseHTML:t=>t.getAttribute("data-position"),renderHTML:t=>({"data-position":t.position})}}},renderHTML({HTMLAttributes:t}){return["div",yt(t,{"data-type":"column"}),0]},parseHTML(){return[{tag:'div[data-type="column"]'}]}});var Ba=(t=>(t.SidebarLeft="sidebar-left",t.SidebarRight="sidebar-right",t.TwoColumn="two-column",t))(Ba||{});const Tv=Lt.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[EZ.configure(this.options.columnOptions)]}}),kZ={class:"flex gap-x-2 items-center"},SZ={class:"sr-only"},_Z={class:"flex justify-end gap-x-2.5 flex-1"},TZ=["disabled"],bk=uo(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}=Tt(),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=dh,y=ch,x=uh,E=lh,k=iv,C=Vc,_=Pc;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",kZ,[o.withDirectives(o.createElementVNode("button",{onClick:m},[o.createVNode(o.unref(Gg),{icon:"lucide:edit-2"})],512),[[o.vShow,l.value]]),o.createVNode(y,{class:"outline-none",onClick:f},{default:o.withCtx(()=>[o.createVNode(o.unref(kc),{class:"w-5 h-5"}),o.createElementVNode("span",SZ,o.toDisplayString(o.unref(i)("editor.close")),1)]),_:1})])]),_:1}),o.createVNode(E,{class:"hidden"}),o.createVNode(Ev,{isReadOnly:l.value,modelValue:s.value,"onUpdate:modelValue":b[0]||(b[0]=T=>s.value=T),"parent-editor":g.editor,"spellcheck-enabled":!1},null,8,["isReadOnly","modelValue","parent-editor"]),o.createVNode(k,{class:"flex-row justify-between"},{default:o.withCtx(()=>[o.withDirectives(o.createElementVNode("button",{onClick:b[1]||(b[1]=T=>n("delete"))},o.toDisplayString(o.unref(i)("editor.delete")),513),[[o.vShow,u.value]]),o.withDirectives(o.createElementVNode("div",_Z,[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,TZ)],512),[[o.vShow,u.value||!l.value]])]),_:1})]),_:1})]),_:1},8,["open"])}}}),[["__scopeId","data-v-2f4982a0"]]),AZ=["innerHTML"],MZ=["book-mark-node-id","page-id","page-number","book-mark-content","node-id","line-id"],OZ=o.defineComponent({__name:"ConfigPlan",props:na,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=Ne.useEventBus(fr.RENDER_SUPER_TEXT),c=o.computed(()=>{var _,T;const x=s.resolve(i.from),E=x==null?void 0:x.node(-1),k=(_=E==null?void 0:E.attrs)==null?void 0:_.id,C=(T=E==null?void 0:E.attrs)==null?void 0:T.pageNumber;return{pageId:k,pageNumber:C}}),f=o.computed(()=>{const x=e.getPos(),E=e.editor.state.doc.resolve(x);for(let k=E.depth;k>0;k--){const C=E.node(k);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 E=e.node.attrs[rt.TEXT],k=e.node.attrs[rt.ID],_={lineId:x.target.querySelector(`[node-id="${k}"]`).getAttribute("line-id"),text:E};u.emit({action:"hover",payload:_})}function b(x){const E=e.node.attrs[rt.ID],C={lineId:x.target.querySelector(`[node-id="${E}"]`).getAttribute("line-id"),text:""};u.emit({action:"hover",payload:C})}function v(){const{getPos:x,node:E,editor:k}=e,C=x(),_=C+1;k.commands.deleteRange({from:C,to:_})}function y(){n.value=!0,a&&(l.value=!0)}return(x,E)=>{const k=vn,C=ov,_=rv,T=nv,A=tv,D=Wc;return o.openBlock(),o.createBlock(o.unref(ta),{as:"span",class:o.normalizeClass(["w-fit text-inherit super-text align-middle",{"!leading-[9px] [&_*]:!leading-[9px]":o.unref(a)}]),"data-drag-handle":"",draggable:"true",contenteditable:"false"},{default:o.withCtx(()=>[o.createVNode(A,null,{default:o.withCtx(()=>[o.createVNode(C,{as:"template",class:"relative"},{default:o.withCtx(()=>[o.createVNode(k,{variant:"ghost",class:"!p-0 !m-0 !h-fit font-normal !text-ed-blue",onClick:y,onMouseenter:g,onMouseleave:b},{default:o.withCtx(()=>[o.createVNode(o.unref(Ot),{name:"plan",class:o.normalizeClass({"w-[18px] h-auto pr-1":o.unref(a)})},null,8,["class"]),E[3]||(E[3]=o.createTextVNode(" [")),o.createElementVNode("span",{class:"[&_*]:inline",innerHTML:e.node.attrs[o.unref(rt).TEXT]},null,8,AZ),E[4]||(E[4]=o.createTextVNode("] ")),o.createElementVNode("div",{ref_key:"bookMarkRef",ref:r,"book-mark-node-id":e.node.attrs[o.unref(rt).ID],"page-id":c.value.pageId,"page-number":c.value.pageNumber,"book-mark-content":e.node.attrs[o.unref(rt).TEXT],"node-id":e.node.attrs[o.unref(rt).ID],"line-id":p.value},null,8,MZ)]),_:1})]),_:1}),o.createVNode(T,null,{default:o.withCtx(()=>[o.createVNode(_,{onSelect:E[0]||(E[0]=O=>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(bk,{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(rt).TEXT],"super-text-id":e.node.attrs[o.unref(rt).ID],onClose:E[2]||(E[2]=O=>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(D,{key:0,open:n.value,editor:e.editor,"super-text-init":e.node.attrs[o.unref(rt).TEXT],"super-text-element-id":e.node.attrs[o.unref(rt).ELEMENT_ID],onClose:E[1]||(E[1]=O=>n.value=!1),onSave:m},null,8,["open","editor","super-text-init","super-text-element-id"]))]),_:1},8,["class"])}}}),vk=Lt.create({name:"configPlan",inline:!0,group:"inline",atom:!0,draggable:!0,addStorage(){return{isShowConfigPlanInput:!1}},addOptions(){return{specialCharModal:null,button:({editor:t,t:e,isMobile:n})=>[...n?[{component:Xe,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",yt(t,{class:"config-plan"})]},addNodeView(){return ra(OZ)},addProseMirrorPlugins(){return[new nt({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 Av,Mv;if(typeof WeakMap<"u"){let t=new WeakMap;Av=e=>t.get(e),Mv=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;Av=r=>{for(let i=0;i<t.length;i+=2)if(t[i]==r)return t[i+1]},Mv=(r,i)=>(n==10&&(n=0),t[n++]=r,t[n++]=i)}var ln=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 Av(t)||Mv(t,BZ(t))}};function BZ(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=IZ(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:y,rowspan:x,colwidth:E}=v.attrs;for(let k=0;k<x;k++){if(k+c>=n){(s||(s=[])).push({type:"overlong_rowspan",pos:f,n:x-k});break}const C=i+k*e;for(let _=0;_<y;_++){r[C+_]==0?r[C+_]=f:(s||(s=[])).push({type:"collision",row:c,pos:f,n:y-_});const T=E&&E[_];if(T){const A=(C+_)%e*2,D=a[A];D==null||D!=T&&a[A+1]==1?(a[A]=T,a[A+1]=1):D==T&&a[A+1]++}}}i+=y,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 ln(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&&RZ(l,a,t),l}function IZ(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 RZ(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=LZ(u)))[c]=p)}l&&t.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:l})}}function LZ(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function Kn(t){let e=t.cached.tableNodeTypes;if(!e){e=t.cached.tableNodeTypes={};for(const n in t.nodes){const r=t.nodes[n],i=r.spec.tableRole;i&&(e[i]=r)}}return e}var _s=new Et("selectingCells");function Kl(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 DZ(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 Eo(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 Sh(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=Kl(e.$head)||PZ(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function PZ(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 Ov(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function VZ(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function Bv(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function yk(t,e,n){const r=t.node(-1),i=ln.get(r),s=t.start(-1),a=i.nextCell(t.pos-s,e,n);return a==null?null:t.node(0).resolve(s+a)}function Ia(t,e,n=1){const r={...t,colspan:t.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,n),r.colwidth.some(i=>i>0)||(r.colwidth=null)),r}function wk(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 FZ(t,e,n){const r=Kn(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 Wt=class Di extends je{constructor(e,n=e){const r=e.node(-1),i=ln.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 s3(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(Ov(r)&&Ov(i)&&Bv(r,i)){const s=this.$anchorCell.node(-1)!=r.node(-1);return s&&this.isRowSelection()?Di.rowSelection(r,i):s&&this.isColSelection()?Di.colSelection(r,i):new Di(r,i)}return Pe.between(r,i)}content(){const e=this.$anchorCell.node(-1),n=ln.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,y=g.right-i.right;if(v>0||y>0){let x=b.attrs;if(v>0&&(x=Ia(x,0,v)),y>0&&(x=Ia(x,x.colspan-y,y)),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(ge.from(c)))}const l=this.isColSelection()&&this.isRowSelection()?e:a;return new Te(ge.from(l),1,1)}replace(e,n=Te.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?Te.empty:n)}const s=je.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);s&&e.setSelection(s)}replaceWith(e,n){this.replace(e,new Te(ge.from(n),0,0))}forEachCell(e){const n=this.$anchorCell.node(-1),r=ln.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=ln.get(r),s=e.start(-1),a=i.findCell(e.pos-s),l=i.findCell(n.pos-s),u=e.node(0);return a.top<=l.top?(a.top>0&&(e=u.resolve(s+i.map[a.left])),l.bottom<i.height&&(n=u.resolve(s+i.map[i.width*(i.height-1)+l.right-1]))):(l.top>0&&(n=u.resolve(s+i.map[l.left])),a.bottom<i.height&&(e=u.resolve(s+i.map[i.width*(i.height-1)+a.right-1]))),new Di(e,n)}isRowSelection(){const e=this.$anchorCell.node(-1),n=ln.get(e),r=this.$anchorCell.start(-1),i=n.colCount(this.$anchorCell.pos-r),s=n.colCount(this.$headCell.pos-r);if(Math.min(i,s)>0)return!1;const a=i+this.$anchorCell.nodeAfter.attrs.colspan,l=s+this.$headCell.nodeAfter.attrs.colspan;return Math.max(a,l)==n.width}eq(e){return e instanceof Di&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),i=ln.get(r),s=e.start(-1),a=i.findCell(e.pos-s),l=i.findCell(n.pos-s),u=e.node(0);return a.left<=l.left?(a.left>0&&(e=u.resolve(s+i.map[a.top*i.width])),l.right<i.width&&(n=u.resolve(s+i.map[i.width*(l.top+1)-1]))):(l.left>0&&(n=u.resolve(s+i.map[l.top*i.width])),a.right<i.width&&(e=u.resolve(s+i.map[i.width*(a.top+1)-1]))),new Di(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new Di(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){return new Di(e.resolve(n),e.resolve(r))}getBookmark(){return new $Z(this.$anchorCell.pos,this.$headCell.pos)}};Wt.prototype.visible=!1,je.jsonID("cell",Wt);var $Z=class Y9{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Y9(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&&Bv(n,r)?new Wt(n,r):je.near(r,1)}};function HZ(t){if(!(t.selection instanceof Wt))return null;const e=[];return t.selection.forEachCell((n,r)=>{e.push(qt.node(r,r+n.nodeSize,{class:"selectedCell"}))}),ut.create(t.doc,e)}function zZ({$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 UZ({$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 WZ(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=Wt.create(i,r.from);else if(a=="row"){const l=i.resolve(r.from+1);s=Wt.rowSelection(l,l)}else if(!n){const l=ln.get(r.node),u=r.from+1,c=u+l.map[l.width*l.height-1];s=Wt.create(i,u+1,c)}}else r instanceof Pe&&zZ(r)?s=Pe.create(i,r.from):r instanceof Pe&&UZ(r)&&(s=Pe.create(i,r.$from.start(),r.$from.end()));return s&&(e||(e=t.tr)).setSelection(s),e}var jZ=new Et("fix-tables");function xk(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)?xk(t.child(l),u,n+1,r):u.nodesBetween(0,u.content.size,r,n+1),n+=u.nodeSize}}function Ck(t,e){let n;const r=(i,s)=>{i.type.spec.tableRole=="table"&&(n=qZ(t,i,s,n))};return e?e.doc!=t.doc&&xk(e.doc,t.doc,0,r):t.doc.descendants(r),n}function qZ(t,e,n,r){const i=ln.get(e);if(!i.problems)return r;r||(r=t.tr);const s=[];for(let u=0;u<i.height;u++)s.push(0);for(let u=0;u<i.problems.length;u++){const c=i.problems[u];if(c.type=="collision"){const f=e.nodeAt(c.pos);if(!f)continue;const p=f.attrs;for(let m=0;m<p.rowspan;m++)s[c.row+m]+=c.n;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,Ia(p,p.colspan-c.n,c.n))}else if(c.type=="missing")s[c.row]+=c.n;else if(c.type=="overlong_rowspan"){const f=e.nodeAt(c.pos);if(!f)continue;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,{...f.attrs,rowspan:f.attrs.rowspan-c.n})}else if(c.type=="colwidth mismatch"){const f=e.nodeAt(c.pos);if(!f)continue;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,{...f.attrs,colwidth:c.colwidth})}else if(c.type=="zero_sized"){const f=r.mapping.map(n);r.delete(f,f+e.nodeSize)}}let a,l;for(let u=0;u<s.length;u++)s[u]&&(a==null&&(a=u),l=u);for(let u=0,c=n+1;u<i.height;u++){const f=e.child(u),p=c+f.nodeSize,m=s[u];if(m>0){let g="cell";f.firstChild&&(g=f.firstChild.type.spec.tableRole);const b=[];for(let y=0;y<m;y++){const x=Kn(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(jZ,{fixTables:!0})}function Jo(t){const e=t.selection,n=Sh(t),r=n.node(-1),i=n.start(-1),s=ln.get(r);return{...e instanceof Wt?s.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):s.findCell(n.pos-i),tableStart:i,map:s,table:r}}function Ek(t,{map:e,tableStart:n,table:r},i){let s=i>0?-1:0;FZ(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,wk(c.attrs,i-e.colCount(u))),a+=c.attrs.rowspan-1}else{const u=s==null?Kn(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 KZ(t,e){if(!Eo(t))return!1;if(e){const n=Jo(t);e(Ek(t.tr,n,n.left))}return!0}function GZ(t,e){if(!Eo(t))return!1;if(e){const n=Jo(t);e(Ek(t.tr,n,n.right))}return!0}function XZ(t,{map:e,table:n,tableStart:r},i){const s=t.mapping.maps.length;for(let a=0;a<e.height;){const l=a*e.width+i,u=e.map[l],c=n.nodeAt(u),f=c.attrs;if(i>0&&e.map[l-1]==u||i<e.width-1&&e.map[l+1]==u)t.setNodeMarkup(t.mapping.slice(s).map(r+u),null,Ia(f,i-e.colCount(u)));else{const p=t.mapping.slice(s).map(r+u);t.delete(p,p+c.nodeSize)}a+=f.rowspan}}function YZ(t,e){if(!Eo(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;XZ(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=ln.get(s)}e(r)}return!0}function JZ(t,e,n){var r;const i=Kn(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 kk(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;JZ(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?Kn(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,Kn(r.type.schema).row.create(null,l)),t}function ZZ(t,e){if(!Eo(t))return!1;if(e){const n=Jo(t);e(kk(t.tr,n,n.top))}return!0}function QZ(t,e){if(!Eo(t))return!1;if(e){const n=Jo(t);e(kk(t.tr,n,n.bottom))}return!0}function NZ(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 eQ(t,e){if(!Eo(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;NZ(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=ln.get(n.table)}e(r)}return!0}function Sk(t){const e=t.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function tQ({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 _k(t,e){const n=t.selection;if(!(n instanceof Wt)||n.$anchorCell.pos==n.$headCell.pos)return!1;const r=Jo(t),{map:i}=r;if(tQ(i,r))return!1;if(e){const s=t.tr,a={};let l=ge.empty,u,c;for(let f=r.top;f<r.bottom;f++)for(let p=r.left;p<r.right;p++){const m=i.map[f*i.width+p],g=r.table.nodeAt(m);if(!(a[m]||!g))if(a[m]=!0,u==null)u=m,c=g;else{Sk(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,{...wk(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=Sk(c)?u+1:f;s.replaceWith(p+r.tableStart,f+r.tableStart,l)}s.setSelection(new Wt(s.doc.resolve(u+r.tableStart))),e(s)}return!0}function Tk(t,e){const n=Kn(t.schema);return nQ(({node:r})=>n[r.type.spec.tableRole])(t,e)}function nQ(t){return(e,n)=>{var r;const i=e.selection;let s,a;if(i instanceof Wt){if(i.$anchorCell.pos!=i.$headCell.pos)return!1;s=i.$anchorCell.nodeAfter,a=i.$anchorCell.pos}else{if(s=DZ(i.$from),!s)return!1;a=(r=Kl(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,y=0;v<f.right;v++,y++)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[y]))}p.setNodeMarkup(a,t({node:s,row:f.top,col:f.left}),u[0]),i instanceof Wt&&p.setSelection(new Wt(p.doc.resolve(i.$anchorCell.pos),m?p.doc.resolve(m):void 0)),n(p)}return!0}}function rQ(t,e){return function(n,r){if(!Eo(n))return!1;const i=Sh(n);if(i.nodeAfter.attrs[t]===e)return!1;if(r){const s=n.tr;n.selection instanceof Wt?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 oQ(t){return function(e,n){if(!Eo(e))return!1;if(n){const r=Kn(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 Ak(t,e,n){const r=e.map.cellsInRect({left:0,top:0,right:t=="row"?e.map.width:1,bottom:t=="column"?e.map.height:1});for(let i=0;i<r.length;i++){const s=e.table.nodeAt(r[i]);if(s&&s.type!==n.header_cell)return!1}return!0}function jc(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?oQ(t):function(n,r){if(!Eo(n))return!1;if(r){const i=Kn(n.schema),s=Jo(n),a=n.tr,l=Ak("row",s,i),u=Ak("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}}jc("row",{useDeprecatedLogic:!0}),jc("column",{useDeprecatedLogic:!0});var iQ=jc("cell",{useDeprecatedLogic:!0});function sQ(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 Mk(t){return function(e,n){if(!Eo(e))return!1;const r=sQ(Sh(e),t);if(r==null)return!1;if(n){const i=e.doc.resolve(r);n(e.tr.setSelection(Pe.between(i,VZ(i))).scrollIntoView())}return!0}}function aQ(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 _h(t,e){const n=t.selection;if(!(n instanceof Wt))return!1;if(e){const r=t.tr,i=Kn(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 Te(i,0,0))}),r.docChanged&&e(r)}return!0}function lQ(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=Iv(Kn(a).row,new Te(c,f,p)).content),l.push(c)}else if(s=="cell"||s=="header_cell")l.push(n||r?Iv(Kn(a).row,new Te(e,n,r)).content:e);else return null;return uQ(a,l)}function uQ(t,e){const n=[];for(let i=0;i<e.length;i++){const s=e[i];for(let a=s.childCount-1;a>=0;a--){const{rowspan:l,colspan:u}=s.child(a).attrs;for(let c=i;c<i+l;c++)n[c]=(n[c]||0)+u}}let r=0;for(let i=0;i<n.length;i++)r=Math.max(r,n[i]);for(let i=0;i<n.length;i++)if(i>=e.length&&e.push(ge.empty),n[i]<r){const s=Kn(t).cell.createAndFill(),a=[];for(let l=n[i];l<r;l++)a.push(s);e[i]=e[i].append(ge.from(a))}return{height:e.length,width:r,rows:e}}function Iv(t,e){const n=t.createAndFill();return new Km(n).replace(0,n.content.size,e).doc}function cQ({width:t,height:e,rows:n},r,i){if(t!=r){const s=[],a=[];for(let l=0;l<n.length;l++){const u=n[l],c=[];for(let f=s[l]||0,p=0;f<r;p++){let m=u.child(p%u.childCount);f+m.attrs.colspan>r&&(m=m.type.createChecked(Ia(m.attrs,m.attrs.colspan,f+m.attrs.colspan-r),m.content)),c.push(m),f+=m.attrs.colspan;for(let g=1;g<m.attrs.rowspan;g++)s[l+g]=(s[l+g]||0)+m.attrs.colspan}a.push(ge.from(c))}n=a,t=r}if(e!=i){const s=[];for(let a=0,l=0;a<i;a++,l++){const u=[],c=n[l%e];for(let f=0;f<c.childCount;f++){let p=c.child(f);a+p.attrs.rowspan>i&&(p=p.type.create({...p.attrs,rowspan:Math.max(1,i-p.attrs.rowspan)},p.content)),u.push(p)}s.push(ge.from(u))}n=s,e=i}return{width:t,height:e,rows:n}}function dQ(t,e,n,r,i,s,a){const l=t.doc.type.schema,u=Kn(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 y=e.width;y<i;y++)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 y=b>=e.width?!1:n.nodeAt(e.map[v+b]).type==u.header_cell;p.push(y?f||(f=u.header_cell.createAndFill()):c||(c=u.cell.createAndFill()))}const m=u.row.create(null,ge.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 Ok(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 Bk(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,Ia(m.attrs,a-g,m.attrs.colspan-(a-g))),t.insert(b+m.nodeSize,m.type.createAndFill(Ia(m.attrs,0,a-g))),c+=m.attrs.rowspan-1}}return u}function Ik(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=ln.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=ln.get(s),m=p.mapping.maps.length}dQ(p,a,s,n,c,f,m)&&g(),Ok(p,a,s,n,u,c,l,m)&&g(),Ok(p,a,s,n,u,c,f,m)&&g(),Bk(p,a,s,n,l,f,u,m)&&g(),Bk(p,a,s,n,l,f,c,m)&&g();for(let b=l;b<f;b++){const v=a.positionAt(b,u,s),y=a.positionAt(b,c,s);p.replace(p.mapping.slice(m).map(v+n),p.mapping.slice(m).map(y+n),new Te(i.rows[b-l],0,0))}g(),p.setSelection(new Wt(p.doc.resolve(n+a.positionAt(l,u,s)),p.doc.resolve(n+a.positionAt(f-1,c-1,s)))),e(p)}var fQ=E0({ArrowLeft:Ah("horiz",-1),ArrowRight:Ah("horiz",1),ArrowUp:Ah("vert",-1),ArrowDown:Ah("vert",1),"Shift-ArrowLeft":Mh("horiz",-1),"Shift-ArrowRight":Mh("horiz",1),"Shift-ArrowUp":Mh("vert",-1),"Shift-ArrowDown":Mh("vert",1),Backspace:_h,"Mod-Backspace":_h,Delete:_h,"Mod-Delete":_h});function Th(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function Ah(t,e){return(n,r,i)=>{if(!i)return!1;const s=n.selection;if(s instanceof Wt)return Th(n,r,je.near(s.$headCell,e));if(t!="horiz"&&!s.empty)return!1;const a=Rk(i,t,e);if(a==null)return!1;if(t=="horiz")return Th(n,r,je.near(n.doc.resolve(s.head+e),e));{const l=n.doc.resolve(a),u=yk(l,t,e);let c;return u?c=je.near(u,1):e<0?c=je.near(n.doc.resolve(l.before(-1)),-1):c=je.near(n.doc.resolve(l.after(-1)),1),Th(n,r,c)}}}function Mh(t,e){return(n,r,i)=>{if(!i)return!1;const s=n.selection;let a;if(s instanceof Wt)a=s;else{const u=Rk(i,t,e);if(u==null)return!1;a=new Wt(n.doc.resolve(u))}const l=yk(a.$headCell,t,e);return l?Th(n,r,new Wt(a.$anchorCell,l)):!1}}function pQ(t,e){const n=t.state.doc,r=Kl(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new Wt(r))),!0):!1}function hQ(t,e,n){if(!Eo(t.state))return!1;let r=lQ(n);const i=t.state.selection;if(i instanceof Wt){r||(r={width:1,height:1,rows:[ge.from(Iv(Kn(t.state.schema).cell,n))]});const s=i.$anchorCell.node(-1),a=i.$anchorCell.start(-1),l=ln.get(s).rectBetween(i.$anchorCell.pos-a,i.$headCell.pos-a);return r=cQ(r,l.right-l.left,l.bottom-l.top),Ik(t.state,t.dispatch,a,l,r),!0}else if(r){const s=Sh(t.state),a=s.start(-1);return Ik(t.state,t.dispatch,a,ln.get(s.node(-1)).findCell(s.pos-a),r),!0}else return!1}function mQ(t,e){var n;if(e.ctrlKey||e.metaKey)return;const r=Lk(t,e.target);let i;if(e.shiftKey&&t.state.selection instanceof Wt)s(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(i=Kl(t.state.selection.$anchor))!=null&&((n=Rv(t,e))==null?void 0:n.pos)!=i.pos)s(i,e),e.preventDefault();else if(!r)return;function s(u,c){let f=Rv(t,c);const p=_s.getState(t.state)==null;if(!f||!Bv(u,f))if(p)f=u;else return;const m=new Wt(u,f);if(p||!t.state.selection.eq(m)){const g=t.state.tr.setSelection(m);p&&g.setMeta(_s,u.pos),t.dispatch(g)}}function a(){t.root.removeEventListener("mouseup",a),t.root.removeEventListener("dragstart",a),t.root.removeEventListener("mousemove",l),_s.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(_s,-1))}function l(u){const c=u,f=_s.getState(t.state);let p;if(f!=null)p=t.state.doc.resolve(f);else if(Lk(t,c.target)!=r&&(p=Rv(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 Rk(t,e,n){if(!(t.state.selection instanceof Pe))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 Lk(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function Rv(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});return n&&n?Kl(t.state.doc.resolve(n.pos)):null}var gQ=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")),Lv(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,Lv(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function Lv(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 y=i==m?s:b&&b[v],x=y?y+"px":"";if(l+=y||r,y||(u=!1),c)c.style.width!=x&&(c.style.width=x),c=c.nextSibling;else{const E=document.createElement("col");E.style.width=x,e.appendChild(E)}}}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 Ar=new Et("tableColumnResizing");function bQ({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:r=gQ,lastColumnResizable:i=!0}={}){const s=new nt({key:Ar,state:{init(a,l){var u,c;const f=(c=(u=s.spec)==null?void 0:u.props)==null?void 0:c.nodeViews,p=Kn(l.schema).table.name;return r&&f&&(f[p]=(m,g)=>new r(m,n,g)),new vQ(-1,!1)},apply(a,l){return l.apply(a)}},props:{attributes:a=>{const l=Ar.getState(a);return l&&l.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(a,l)=>{yQ(a,l,t,i)},mouseleave:a=>{wQ(a)},mousedown:(a,l)=>{xQ(a,l,e,n)}},decorations:a=>{const l=Ar.getState(a);if(l&&l.activeHandle>-1)return _Q(a,l.activeHandle)},nodeViews:{}}});return s}var vQ=class Mm{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta(Ar);if(r&&r.setHandle!=null)return new Mm(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new Mm(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let i=e.mapping.map(n.activeHandle,-1);return Ov(e.doc.resolve(i))||(i=-1),new Mm(i,n.dragging)}return n}};function yQ(t,e,n,r){if(!t.editable)return;const i=Ar.getState(t.state);if(i&&!i.dragging){const s=EQ(e.target);let a=-1;if(s){const{left:l,right:u}=s.getBoundingClientRect();e.clientX-l<=n?a=Dk(t,e,"left",n):u-e.clientX<=n&&(a=Dk(t,e,"right",n))}if(a!=i.activeHandle){if(!r&&a!==-1){const l=t.state.doc.resolve(a),u=l.node(-1),c=ln.get(u),f=l.start(-1);if(c.colCount(l.pos-f)+l.nodeAfter.attrs.colspan-1==c.width-1)return}Vk(t,a)}}}function wQ(t){if(!t.editable)return;const e=Ar.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&Vk(t,-1)}function xQ(t,e,n,r){var i;if(!t.editable)return!1;const s=(i=t.dom.ownerDocument.defaultView)!=null?i:window,a=Ar.getState(t.state);if(!a||a.activeHandle==-1||a.dragging)return!1;const l=t.state.doc.nodeAt(a.activeHandle),u=CQ(t,a.activeHandle,l.attrs);t.dispatch(t.state.tr.setMeta(Ar,{setDragging:{startX:e.clientX,startWidth:u}}));function c(p){s.removeEventListener("mouseup",c),s.removeEventListener("mousemove",f);const m=Ar.getState(t.state);m!=null&&m.dragging&&(kQ(t,m.activeHandle,Pk(m.dragging,p,n)),t.dispatch(t.state.tr.setMeta(Ar,{setDragging:null})))}function f(p){if(!p.which)return c(p);const m=Ar.getState(t.state);if(m&&m.dragging){const g=Pk(m.dragging,p,n);Fk(t,m.activeHandle,g,r)}}return Fk(t,a.activeHandle,u,r),s.addEventListener("mouseup",c),s.addEventListener("mousemove",f),e.preventDefault(),!0}function CQ(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 EQ(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function Dk(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=Kl(t.state.doc.resolve(a));if(!l)return-1;if(n=="right")return l.pos;const u=ln.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 Pk(t,e,n){const r=e.clientX-t.startX;return Math.max(n,t.startWidth+r)}function Vk(t,e){t.dispatch(t.state.tr.setMeta(Ar,{setHandle:e}))}function kQ(t,e,n){const r=t.state.doc.resolve(e),i=r.node(-1),s=ln.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():SQ(m.colspan);b[g]=n,u.setNodeMarkup(a+p,null,{...m,colwidth:b})}u.docChanged&&t.dispatch(u)}function Fk(t,e,n,r){const i=t.state.doc.resolve(e),s=i.node(-1),a=i.start(-1),l=ln.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&&Lv(s,u.firstChild,u,r,l,n)}function SQ(t){return Array(t).fill(0)}function _Q(t,e){var n;const r=[],i=t.doc.resolve(e),s=i.node(-1);if(!s)return ut.empty;const a=ln.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=Ar.getState(t))!=null&&n.dragging&&r.push(qt.node(l+p,l+p+s.nodeAt(p).nodeSize,{class:"column-resize-dragging"})),r.push(qt.widget(m,g))}}return ut.create(t.doc,r)}function TQ({allowTableNodeSelection:t=!1}={}){return new nt({key:_s,state:{init(){return null},apply(e,n){const r=e.getMeta(_s);if(r!=null)return r==-1?null:r;if(n==null||!e.docChanged)return n;const{deleted:i,pos:s}=e.mapping.mapResult(n);return i?null:s}},props:{decorations:HZ,handleDOMEvents:{mousedown:mQ},createSelectionBetween(e){return _s.getState(e.state)!=null?e.state.selection:null},handleTripleClick:pQ,handleKeyDown:fQ,handlePaste:hQ},appendTransaction(e,n,r){return WZ(r,Ck(r,n),t)}})}const AQ=(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)},MQ=(t,e,n)=>{const{doc:r,selection:i}=t;return!r||!i||!(i instanceof Wt)||i.forEachCell((s,a)=>{t=AQ(t,a,n)}),t},$k=(t,e)=>({tr:n,state:r,dispatch:i})=>{const{selection:s}=r;return n=n.setSelection(s),n=MQ(n,e,t),n.docChanged?(i==null||i(n),!0):!1},OQ=et.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=>$k(t,this.options),unsetTableCellBackground:()=>$k("",this.options)}}}),BQ=Lt.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",yt(this.options.HTMLAttributes,t),0]}}),IQ=Lt.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",yt(this.options.HTMLAttributes,t),0]}}),RQ=Lt.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",yt(this.options.HTMLAttributes,t),0]}});function Dv(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function Hk(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 y=i===m?s:b&&b[v],x=y?`${y}px`:"";if(l+=y||r,y||(u=!1),c){if(c.style.width!==x){const[E,k]=Dv(r,y);c.style.setProperty(E,k)}c=c.nextSibling}else{const E=document.createElement("col"),[k,C]=Dv(r,y);E.style.setProperty(k,C),e.appendChild(E)}}}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 LQ{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")),Hk(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,Hk(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){return e.type==="attributes"&&(e.target===this.table||this.colgroup.contains(e.target))}}function DQ(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 y=n===m?r:b&&b[v];i+=y||e,y||(s=!1);const[x,E]=Dv(e,y);a.push(["col",{style:`${x}: ${E}`}])}}const u=s?`${i}px`:"",c=s?"":`${i}px`;return{colgroup:["colgroup",{},...a],tableWidth:u,tableMinWidth:c}}function zk(t,e){return t.createAndFill()}function PQ(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 VQ(t,e,n,r,i){const s=PQ(t),a=[],l=[];for(let c=0;c<n;c+=1){const f=zk(s.cell);if(f&&l.push(f),r){const p=zk(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 FQ(t){return t instanceof Wt}const Oh=({editor:t})=>{const{selection:e}=t.state;if(!FQ(e))return!1;let n=0;const r=n4(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},$Q=Lt.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,handleWidth:5,cellMinWidth:25,View:LQ,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}=DQ(t,this.options.cellMinWidth);return["table",yt(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=VQ(s.schema,t,e,n);if(i){const l=r.selection.from+1;r.replaceSelectionWith(a).scrollIntoView().setSelection(Pe.near(r.doc.resolve(l)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>KZ(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>GZ(t,e),deleteColumn:()=>({state:t,dispatch:e})=>YZ(t,e),addRowBefore:()=>({state:t,dispatch:e})=>ZZ(t,e),addRowAfter:()=>({state:t,dispatch:e})=>QZ(t,e),deleteRow:()=>({state:t,dispatch:e})=>eQ(t,e),deleteTable:()=>({state:t,dispatch:e})=>aQ(t,e),mergeCells:()=>({state:t,dispatch:e})=>_k(t,e),splitCell:()=>({state:t,dispatch:e})=>Tk(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>jc("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>jc("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>iQ(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>_k(t,e)?!0:Tk(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>rQ(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>Mk(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>Mk(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&Ck(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const r=Wt.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:Oh,"Mod-Backspace":Oh,Delete:Oh,"Mod-Delete":Oh}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[bQ({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],TQ({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:pt(He(t,"tableRole",e))}}}),HQ=/(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,zQ=/CrOS/,UQ=/android|ipad|playbook|silk/i;function Uk(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:!!(HQ.test(e)&&!zQ.test(e)||t.tablet&&UQ.test(e)||t.tablet&&t.featureDetect&&navigator&&navigator.maxTouchPoints>1&&e.includes("Macintosh")&&e.includes("Safari"))}const WQ=["disabled"],jQ={"content-class":"table-grid-size-editor","content-style":"padding:0"},qQ={class:"flex flex-col flex-wrap gap-1 justify-between"},KQ=["onMouseover","onMousedown"],GQ={class:"text-center text-sm text-zinc-600 mt-2"},XQ=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:Uk()?sf:of,cols:Uk()?sf:of}),a=o.reactive({rows:af,cols:af});function l(g,b){g===s.rows&&(s.rows=Math.min(g+1,sf)),b===s.cols&&(s.cols=Math.min(b+1,sf)),a.rows=g,a.cols=b}function u(g,b){n("create-table",{rows:g,cols:b,withHeaderRow:o.unref(i)}),c()}function c(){r.value=!1,i.value=!1,s.rows=of,s.cols=of,a.rows=af,a.cols=af}const f=o.inject("isMobile",!1),{isOpen:p}=yp({scrollEl:"tool-bar-format-scroll",ignoreSelector:"[data-radix-popper-content-wrapper]"}),m=o.computed(()=>f?{modal:!1,open:p.value,"onUpdate:open":g=>p.value=g}:{});return(g,b)=>(o.openBlock(),o.createBlock(o.unref(fs),o.normalizeProps(o.guardReactiveProps(o.unref(m))),{default:o.withCtx(()=>[o.createVNode(o.unref(ga),{"as-child":""},{default:o.withCtx(()=>[o.createElementVNode("button",{disabled:t.disabled,class:"m-0 p-0"},[o.renderSlot(g.$slots,"trigger")],8,WQ)]),_:3}),o.createVNode(o.unref(ps),{class:"w-full",align:"start",side:"bottom"},{default:o.withCtx(()=>[o.createElementVNode("div",jQ,[o.createElementVNode("div",qQ,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(s.rows,v=>(o.openBlock(),o.createElementBlock("div",{key:"r"+v,class:"flex gap-1"},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(s.cols,y=>(o.openBlock(),o.createElementBlock("div",{key:"c"+y,class:o.normalizeClass([[y<=a.cols&&v<=a.rows&&"bg-ed-foreground border-ed-border","cursor-pointer"],"pa-1"]),onMouseover:x=>l(v,y),onMousedown:x=>u(v,y)},b[0]||(b[0]=[o.createElementVNode("div",{class:"w-4 h-4 p-1 border box-border"},null,-1)]),42,KQ))),128))]))),128))]),o.createElementVNode("div",GQ,o.toDisplayString(a.rows)+" x "+o.toDisplayString(a.cols),1)])]),_:1})]),_:3},16))}}),YQ={style:{display:"flex"}},JQ=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(XQ,{disabled:r.editor.isActive("table"),onCreateTable:n},{trigger:o.withCtx(()=>[o.createElementVNode("div",YQ,[o.createVNode(Xe,{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"]))}}),Pv=$Q.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:JQ,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[IQ.configure(this.options.tableRow),BQ.configure(this.options.tableHeader),RQ.configure(this.options.tableCell),OQ.configure(this.options.tableCellBackground)]}}),ZQ={class:"flex items-center gap-2 px-2"},QQ=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}=Tt(),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(ka,{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($l),{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",ZQ,[o.createVNode(o.unref(Ot),{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"])}}}),NQ=et.create({name:"text-bubble",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),toolbar:!1,button:()=>({component:QQ,componentProps:{}})}}}),eN=[{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}년"}],tN=t=>{const e=[...t||[],...eN.map(n=>n.pattern)].join("|");return new RegExp(e,"gu")},nN=et.create({name:ep,addOptions(){return{additionalTimeWords:[],enabled:!0}},addStorage(){return{cachedRegex:null,cachedAdditionalWords:null,enabled:this.options.enabled}},addProseMirrorPlugins(){return[new nt({props:{decorations:t=>{if(!this.storage.enabled)return ut.empty;const e=[];return(this.storage.cachedAdditionalWords!==this.options.additionalTimeWords||!this.storage.cachedRegex)&&(this.storage.cachedAdditionalWords=this.options.additionalTimeWords,this.storage.cachedRegex=tN(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(qt.inline(a,l,{class:"time-highlight"}))}}),ut.create(t.doc,e)}}})]},addCommands(){return{toggleTimeHighlight:()=>({editor:t})=>{const e=t.storage[ep];return e.enabled=!e.enabled,t.view.dispatch(t.state.tr),!0}}}});function Vv(t){const e=JSON.stringify(t),n=window.ReactNativeWebView;if(n){n.postMessage(e);return}console.warn("[clipboardBridge] no bridge found")}function rN(){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))},Vv({type:"REQUEST_CLIPBOARD_STATE"})})}function oN(){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)},Vv({type:"PASTE"})})}function iN(t,e){Vv({type:"COPY",data:{html:t,text:e}})}async function sN(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 aN(){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 lN=et.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=Pr.fromSchema(t.schema).serializeFragment(i.content),l=document.createElement("div");l.appendChild(a);const u=l.innerHTML,c=e.doc.textBetween(n,r,`
|
|
344
344
|
`);t.storage.deviceEnv.isMobile?iN(u,c):await sN(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 oN():await aN();if(!e)return;let n="",r="";if(IJ(e)){n=e;const a=document.createElement("div");a.innerHTML=e,r=a.innerText}else r=e,n=e.replace(/\n/g,"<br>");const i=new DataTransfer;i.setData("text/html",n),i.setData("text/plain",r);const s=new ClipboardEvent("paste",{bubbles:!0,cancelable:!0});Object.defineProperty(s,"clipboardData",{value:i}),t.view.dom.dispatchEvent(s)}catch(e){console.warn("Clipboard paste failed:",e)}})(),!0)}},onCreate(){const t=this.editor;t.hasClipboard=async()=>{try{return!!(t.storage.deviceEnv.isMobile?await rN():await navigator.clipboard.readText())}catch(e){return console.warn("[clipboard] check failed",e),!1}}}}),uN=et.create({name:"deviceEnv",addOptions(){return{initial:!1,specialCharModal:void 0}},addStorage(){return{isMobile:this.options.initial,specialCharModal:this.options.specialCharModal,isForceCloseBubble:!1}},addCommands(){return{setIsMobile:t=>({editor:e})=>{var n;return e.storage.deviceEnv.isMobile=t,(n=e.storage.spellchecker)==null||n.spellchecker.setIsMobile(t),!0},setForceCloseBubble:t=>({editor:e})=>(e.storage.deviceEnv.isForceCloseBubble=t,!0),resetForceCloseBubble:()=>({editor:t})=>(t.storage.deviceEnv.isForceCloseBubble=!1,!0)}}}),Bh=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(FV),o.mergeProps({class:o.unref(Se)("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"]))}}),cN={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"},dN={key:0,class:"flex justify-center items-center gap-3 text-s"},fN={key:1,class:"flex justify-between items-center w-full"},pN={class:"flex justify-center items-center gap-3"},hN={class:"text-sm"},mN={class:"flex items-center gap-2"},gN=o.defineComponent({__name:"VideoUploader",props:{...na},setup(t){const e=t,n=o.inject("isEditable",o.ref(!0)),r=o.ref(""),i=o.ref(!1),s=o.ref(),{t:a}=Tt();function l(p){var y;i.value=!0;const m=p.target,g=Array.from((m==null?void 0:m.files)||[]),b=(y=e.editor.extensionManager.extensions.find(x=>x.name==="videoUpload"))==null?void 0:y.options;if(!e.editor||e.editor.isDestroyed||g.length===0||typeof(b==null?void 0:b.upload)!="function")return;const v=g[0];b.upload(v).then(x=>{e.editor.chain().setVideo({src:x}).deleteRange({from:e.getPos(),to:e.getPos()}).insertContentAt(e.getPos()+1,{type:"paragraph"}).focus().run(),i.value=!1})}function u(){e.editor.chain().setVideo({src:r.value,width:640}).deleteRange({from:e.getPos(),to:e.getPos()}).insertContentAt(e.getPos()+1,{type:"paragraph"}).focus().run()}function c(){e.deleteNode()}function f(){var p;(p=s.value)==null||p.click()}return(p,m)=>(o.openBlock(),o.createBlock(o.unref(ta),{as:"div","data-drag-handle":"",class:o.normalizeClass(o.unref(Se)(!o.unref(n)&&"pointer-events-none"))},{default:o.withCtx(()=>[o.createVNode(o.unref(fs),{"default-open":o.unref(n)},{default:o.withCtx(()=>[o.createVNode(o.unref(ga),{"as-child":""},{default:o.withCtx(()=>[o.createElementVNode("div",cN,[i.value?(o.openBlock(),o.createElementBlock("div",dN,[o.createVNode(o.unref(Ot),{class:"animate-spin w-6 h-6",name:"LoaderCircle"}),o.createElementVNode("span",null,o.toDisplayString(o.unref(a)("editor.video.dialog.uploading"))+"...",1)])):(o.openBlock(),o.createElementBlock("div",fN,[o.createElementVNode("div",pN,[o.createVNode(o.unref(Ot),{name:"Video",class:"w-6 h-6"}),o.createElementVNode("span",hN,o.toDisplayString(o.unref(a)("editor.video.dialog.title")),1)]),o.createVNode(o.unref(Ot),{name:"Trash2",class:"hover:text-ed-foreground",onClick:o.withModifiers(c,["stop"])})]))])]),_:1}),o.createVNode(o.unref(ps),{"trap-focus":"",class:"w-full","on-open-auto-focus":g=>g.preventDefault()},{default:o.withCtx(()=>[o.createVNode(o.unref(rp),{"default-value":"upload",class:"w-[300px] sm:w-[400px]","activation-mode":"manual"},{default:o.withCtx(()=>[o.createVNode(o.unref(op),{class:"grid w-full grid-cols-2"},{default:o.withCtx(()=>[o.createVNode(o.unref(Rl),{value:"upload"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(a)("editor.video.dialog.tab.upload")),1)]),_:1}),o.createVNode(o.unref(Rl),{value:"link",disabled:i.value},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(a)("editor.video.dialog.link")),1)]),_:1},8,["disabled"])]),_:1}),o.createVNode(o.unref(Bh),{value:"upload"},{default:o.withCtx(()=>[o.createVNode(o.unref(vn),{class:"w-full mt-1",size:"sm",disabled:i.value,onClick:f},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(a)("editor.video.dialog.tab.upload")),1)]),_:1},8,["disabled"]),o.createElementVNode("input",{ref_key:"fileInput",ref:s,type:"file",accept:"video/*",hidden:"",onChange:l},null,544)]),_:1}),o.createVNode(o.unref(Bh),{value:"link"},{default:o.withCtx(()=>[o.createElementVNode("div",mN,[o.createVNode(o.unref(hs),{modelValue:r.value,"onUpdate:modelValue":m[0]||(m[0]=g=>r.value=g),type:"url",autofocus:"",required:"",placeholder:o.unref(a)("editor.video.dialog.placeholder")},null,8,["modelValue","placeholder"]),o.createVNode(o.unref(vn),{onClick:u},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(a)("editor.video.dialog.button.apply")),1)]),_:1})])]),_:1})]),_:1})]),_:1},8,["on-open-auto-focus"])]),_:1},8,["default-open"])]),_:1},8,["class"]))}}),Wk=Lt.create({name:sc,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 ra(gN)},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:Xe,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 bN(t){return t=t.replace("https://youtu.be/","https://www.youtube.com/watch?v=").replace("watch?v=","embed/"),t=t.replace("https://vimeo.com/","https://player.vimeo.com/video/"),/^https?:\/\/www.bilibili.com\/video\/.*/i.test(t)&&(t=t.replace(/\?.*$/i,"").replace("https://www.bilibili.com/video/","https://player.bilibili.com/player.html?bvid=")),t.includes("drive.google.com")&&(t=t.replace("/view","/preview")),t}function vN(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 jk=Lt.create({name:"video",group:"block",atom:!0,draggable:!0,addOptions(){return{divider:!1,spacer:!1,allowFullscreen:!0,upload:void 0,width:lf["size-medium"],controls:!0,autoplay:!1,HTMLAttributes:{class:"iframe-wrapper",style:"display: flex;justify-content: center;"}}},addAttributes(){return{src:{default:null,renderHTML:({src:t})=>({src:t?bN(t):null})},width:{default:this.options.width,renderHTML:({width:t})=>({width:rn(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: ${rn(n)};`;return vN(e)?["iframe",{src:e,style:s,...i&&{allowfullscreen:i}}]:["video",{src:e?e.replace(/\\/g,"/"):"",style:s,...r&&{controls:r}}]},addCommands(){return{setVideo:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t}),updateVideo:t=>({commands:e})=>e.updateAttributes(this.name,t)}}}),Gl=new Et("upload-image"),yN=()=>new nt({key:Gl,state:{init(){return ut.empty},apply(t,e){e=e.map(t.mapping,t.doc);const n=t.getMeta(Gl);if(n!=null&&n.add){const r=n.add.map(({id:i,pos:s,src:a})=>{const l=wN(a);return qt.widget(s,l,{id:i,side:-1})});e=e.add(t.doc,r)}return 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 wN(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 xN(t,e){var i;const r=Gl.getState(t).find(void 0,void 0,s=>s.id===e);return r.length?(i=r[0])==null?void 0:i.from:null}const qk=({validateFn:t,onUpload:e})=>async(n,r,i)=>{const s=[];for(const a of n){if(t&&!t(a))continue;const l=Xr(6),u=URL.createObjectURL(a);s.push({file:a,id:l,preview:u})}s.length!==0&&(r.dispatch(r.state.tr.setMeta(Gl,{add:s.map(({id:a,preview:l})=>({id:a,pos:i,src:l}))})),await Promise.all(s.map(async({file:a,id:l,preview:u})=>{var c,f;try{const p=await e(a),m=xN(r.state,l);if(m===null)return;const{schema:g}=r.state,b=typeof p=="object"?u:p,v=(c=g.nodes.image)==null?void 0:c.create({src:b}),y=(f=g.nodes.paragraph)==null?void 0:f.create();if(!v||!y)return;r.dispatch(r.state.tr.replaceWith(m,m,v).insert(m+v.nodeSize,y).setMeta(Gl,{remove:[l]}))}catch{r.dispatch(r.state.tr.setMeta(Gl,{remove:[l]}))}})))},CN=(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},EN=(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},kN={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"},SN={class:"flex items-center justify-between w-full"},_N={class:"flex items-center justify-center gap-3"},TN={class:"text-sm"},AN={class:"flex items-center gap-2"},MN=o.defineComponent({__name:"ImageUploader",props:{...na},setup(t){const e=t,n=o.ref(""),r=o.ref(),{t:i}=Tt(),s=o.inject("isEditable",o.ref(!0));function a(f){var v,y;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=Array.from(p),g=(y=e.editor.extensionManager.extensions.find(x=>x.name==="imageUpload"))==null?void 0:y.options;qk({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(){e.deleteNode()}function c(){var f;(f=r.value)==null||f.click()}return(f,p)=>(o.openBlock(),o.createBlock(o.unref(ta),{id:f.node.attrs.id,"data-drag-handle":"",class:o.normalizeClass(o.unref(Se)(!o.unref(s)&&"pointer-events-none"))},{default:o.withCtx(()=>[o.createVNode(o.unref(fs),{"default-open":o.unref(s)},{default:o.withCtx(()=>[o.createVNode(o.unref(ga),{"as-child":""},{default:o.withCtx(()=>[o.createElementVNode("div",kN,[o.createElementVNode("div",SN,[o.createElementVNode("div",_N,[o.createVNode(o.unref(Ot),{name:"ImageUp",class:"w-6 h-6"}),o.createElementVNode("span",TN,o.toDisplayString(o.unref(i)("editor.image.dialog.title")),1)]),o.createVNode(o.unref(Ot),{name:"Trash2",class:"hover:text-ed-foreground",onClick:o.withModifiers(u,["stop"])})])])]),_:1}),o.createVNode(o.unref(ps),{"trap-focus":"",class:"w-full","on-open-auto-focus":m=>m.preventDefault()},{default:o.withCtx(()=>[o.createVNode(o.unref(rp),{"default-value":"upload",class:"w-[300px] sm:w-[400px]","activation-mode":"manual"},{default:o.withCtx(()=>[o.createVNode(o.unref(op),{class:"grid w-full grid-cols-2"},{default:o.withCtx(()=>[o.createVNode(o.unref(Rl),{value:"upload"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(i)("editor.image.dialog.tab.upload")),1)]),_:1}),o.createVNode(o.unref(Rl),{value:"link"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(i)("editor.image.dialog.tab.url")),1)]),_:1})]),_:1}),o.createVNode(o.unref(Bh),{value:"upload"},{default:o.withCtx(()=>[o.createVNode(o.unref(vn),{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(Bh),{value:"link"},{default:o.withCtx(()=>[o.createElementVNode("div",AN,[o.createVNode(o.unref(hs),{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(vn),{onClick:l},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(i)("editor.image.dialog.button.apply")),1)]),_:1})])]),_:1})]),_:1})]),_:1},8,["on-open-auto-focus"])]),_:1},8,["default-open"])]),_:1},8,["id","class"]))}}),ON=1,BN=1e6,Si={ADD_TOAST:"ADD_TOAST",UPDATE_TOAST:"UPDATE_TOAST",DISMISS_TOAST:"DISMISS_TOAST",REMOVE_TOAST:"REMOVE_TOAST"};let Fv=0;function IN(){return Fv=(Fv+1)%Number.MAX_VALUE,Fv.toString()}const $v=new Map;function Kk(t){if($v.has(t))return;const e=setTimeout(()=>{$v.delete(t),qc({type:Si.REMOVE_TOAST,toastId:t})},BN);$v.set(t,e)}const ko=o.ref({toasts:[]});function qc(t){switch(t.type){case Si.ADD_TOAST:ko.value.toasts=[t.toast,...ko.value.toasts].slice(0,ON);break;case Si.UPDATE_TOAST:ko.value.toasts=ko.value.toasts.map(e=>e.id===t.toast.id?{...e,...t.toast}:e);break;case Si.DISMISS_TOAST:{const{toastId:e}=t;e?Kk(e):ko.value.toasts.forEach(n=>{Kk(n.id)}),ko.value.toasts=ko.value.toasts.map(n=>n.id===e||e===void 0?{...n,open:!1}:n);break}case Si.REMOVE_TOAST:t.toastId===void 0?ko.value.toasts=[]:ko.value.toasts=ko.value.toasts.filter(e=>e.id!==t.toastId);break}}function Hv(){return{toasts:o.computed(()=>ko.value.toasts),toast:RN,dismiss:t=>qc({type:Si.DISMISS_TOAST,toastId:t})}}function RN(t){const e=IN(),n=i=>qc({type:Si.UPDATE_TOAST,toast:{...i,id:e}}),r=()=>qc({type:Si.DISMISS_TOAST,toastId:e});return qc({type:Si.ADD_TOAST,toast:{...t,id:e,open:!0,onOpenChange:i=>{i||r()}}}),{id:e,dismiss:r,update:n}}const LN={acceptMimes:["image/jpeg","image/gif","image/png","image/jpg"],maxSize:1024*1024*5},DN=t=>`${(t/1024/1024).toFixed(2)}MB`,Gk=Lt.create({name:bi,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:Xr(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 ra(MN)},addOptions(){var t;return{...LN,...(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:Xe,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}=Hv(),{t:e}=Tt(),r=qk({validateFn:i=>this.options.acceptMimes.includes(i.type)?i.size>this.options.maxSize?(t({description:`${e("editor.imageUpload.fileSizeTooBig")} ${DN(this.options.maxSize)}.`,duration:2e3}),!1):!0:(t({description:e("editor.imageUpload.fileTypeNotSupported"),duration:2e3}),!1),onUpload:this.options.upload});return[new nt({props:{handlePaste:(i,s)=>!s.clipboardData||Array.from(s.clipboardData.items||[]).some(l=>l.type==="text/html")?!1:CN(i,s,r),handleDrop:(i,s,a,l)=>!(s instanceof DragEvent)||!s.dataTransfer||!Array.from(s.dataTransfer.files||[]).some(f=>this.options.acceptMimes.includes(f.type))?!1:EN(i,s,l,r)}}),yN()]}}),PN=et.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}`}}}}}]}}),VN=o.defineComponent({__name:"SpecialCharacterButton",props:{editor:l4},setup(t){const e=t,{t:n}=Tt(),r=xn(),i=o.computed(()=>{var p;return(p=e.editor)==null?void 0:p.storage.specialCharacter.specialCharModal}),s=o.ref(!1);let a=null;function l(){const p=document.activeElement;if(p instanceof HTMLInputElement){a={type:"input",el:p};return}r.editorFocusedInstance.value&&(a={type:"editor"})}const u=()=>{if(!i.value||!i.value.component){console.error("Please configure specialCharModal!");return}s.value=!s.value};document.addEventListener("focusin",p=>{var b,v;if(!s.value)return;const m=p.target;if(m instanceof HTMLInputElement){a={type:"input",el:m};return}const g=r.editorFocusedInstance.value;(v=(b=g==null?void 0:g.view)==null?void 0:b.dom)!=null&&v.contains(m)&&(a={type:"editor"})});function c(p,m){const g=p.selectionStart??p.value.length,b=p.selectionEnd??p.value.length;p.value=p.value.slice(0,g)+m+p.value.slice(b);const v=g+m.length;p.setSelectionRange(v,v),p.dispatchEvent(new Event("input",{bubbles:!0})),p.focus()}const f=(p,m)=>{if(m){if((a==null?void 0:a.type)==="input"){c(a.el,p);return}if((a==null?void 0:a.type)==="editor"){const g=r.editorFocusedInstance.value;if(!g)return;const{view:b}=g,{from:v}=b.state.selection;g.commands.insertContentAt(v,p),g.commands.focus()}}};return(p,m)=>{const g=va,b=ms,v=ba,y=ya;return o.openBlock(),o.createBlock(y,null,{default:o.withCtx(()=>[o.createVNode(v,{"delay-duration":0},{default:o.withCtx(()=>[o.createVNode(g,null,{default:o.withCtx(()=>[o.createVNode(vn,{class:"text-[#65558F] hover:bg-[#ECE6F0]/90 text-xs rounded-none font-normal h-[26px] px-3 border border-gray-300 bg-ed-gray-50 dark:bg-black dark:text-white dark:hover:bg-gray-700 transition-all",onPointerdown:l,onClick:u},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(n)("editor.insert.symbol")),1)]),_:1})]),_:1}),o.createVNode(b,null,{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(n)("editor.insert.symbol")),1)]),_:1})]),_:1}),(o.openBlock(),o.createBlock(o.Teleport,{to:"body"},[o.unref(s)?(o.openBlock(),o.createBlock(o.resolveDynamicComponent(o.unref(i).component),o.mergeProps({key:0},o.unref(i).props,{"custom-class":"!z-[70] !pointer-events-auto",onClose:m[0]||(m[0]=x=>s.value=!1),onSelectedChar:f}),null,16)):o.createCommentVNode("",!0)]))]),_:1})}}}),FN=et.create({name:tp,addOptions(){return{button:({editor:t})=>({component:VN,componentProps:{editor:t}}),specialCharModal:void 0}},addStorage(){return{specialCharModal:this.options.specialCharModal}}}),Xk=et.create({name:"base-kit",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),timeHighlighter:{additionalTimeWords:[]},bubble:{list:ZI,defaultBubbleList:RG,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 LG(i,a,{editor:e,extension:n,t:r})}}}},addExtensions(){var n,r,i;const{t}=Tt(),e=[];this.options.placeholder!==!1&&e.push(Y5.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(xG.configure({className:"focus",...this.options.focus})),this.options.document!==!1&&(this.options.page?(e.push(Q5.configure().extend({content:"page+"})),e.push(lZ.configure({types:((r=(n=this.options.page)==null?void 0:n.nodesComputedOption)==null?void 0:r.types)??[],slots:o.useSlots()}))):e.push(Q5.configure())),this.options.dropcursor!==!1&&e.push(wG.configure({...this.options.dropcursor,width:2,class:"ProseMirror-dropcursor border-black"})),this.options.characterCount!==!1&&e.push(bG.configure(this.options.characterCount)),this.options.paragraph!==!1&&e.push(X5.configure(this.options.paragraph)),this.options.hardBreak!==!1&&e.push(G5.configure(this.options.hardBreak)),this.options.listItem!==!1&&e.push(OG.configure(this.options.listItem)),this.options.textStyle!==!1&&e.push(BG.configure(this.options.textStyle)),this.options.imageUpload!==!1&&e.push(Gk.configure(this.options.imageUpload)),this.options.video!==!1&&e.push(jk.configure(this.options.video)),this.options.videoUpload!==!1&&e.push(Wk.configure(this.options.videoUpload)),this.options.history!==!1&&e.push(zb.configure(this.options.history)),this.options.fontFamily!==!1&&e.push(pk.configure(this.options.fontFamily)),this.options.fontSize!==!1&&e.push(m5.configure(this.options.fontSize)),this.options.fontWeight!==!1&&e.push(fZ.configure(this.options.fontWeight)),this.options.mode!==Me.EDITOR&&e.push(FN.configure(this.options.specialCharacter)),this.options.mode!==Me.EDITOR&&e.push(gZ),this.options.superText!==!1&&this.options.mode!==Me.PLAIN_TEXT&&this.options.mode!==Me.EDITOR&&(typeof this.options.superText=="boolean"?e.push(ik.configure()):e.push(ik.configure(this.options.superText))),this.options.mode===Me.EDITOR&&(this.options.image!==!1&&e.push(qu.configure()),e.push(p5.configure({spacer:!0}),V8,P8,F8,Fb,Pv,$8,g5.configure({spacer:!0}),h5.configure({types:["heading","paragraph","tableCell","tableHeader"],spacer:!0}),gk)),this.options.mode!==Me.EDITOR&&this.options.configPlan!==!1&&this.options.mode!==Me.PLAIN_TEXT&&(typeof this.options.configPlan=="boolean"?e.push(vk.configure()):e.push(vk.configure({specialCharModal:(i=this.options.configPlan)==null?void 0:i.specialCharModal}))),this.options.mode!==Me.EDITOR&&this.options.mode!==Me.PLAIN_TEXT&&e.push(vZ),(this.options.mode===Me.STRAIGHT||this.options.mode===Me.REPORT||this.options.mode===Me.EDITOR)&&this.options.timeHighlighter&&e.push(nN.configure(this.options.timeHighlighter)),this.options.invalidCharFocus!==!1&&e.push(uk.configure(this.options.invalidCharFocus)),this.options.disabled&&e.push(PN),e.push(N5,J5.configure(),NQ.configure(),MG.configure(),Tv,Sv,hb,lN,uN.configure(this.options.deviceEnv),b5.configure({multicolor:!0}));for(const s in this.options.excludes)Object.prototype.hasOwnProperty.call(this.options.excludes,s)&&this.options.excludes[s]&&kt.remove(e,({name:l})=>l===s);return e},addStorage(){return{mode:this.options.mode}}}),Yk=zn.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",yt(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()}}}),Jk=zn.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",yt(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()}}}),$N=et.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:Xe,componentProps:{action:()=>e.commands.toggleSubscript(),isActive:()=>e.isActive("subscript")||!1,disabled:!e.can().toggleSubscript(),icon:"Subscript",tooltip:r("editor.subscript.tooltip")}},l={component:Xe,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(Yk.configure(this.options.subscript)),this.options.superscript!==!1&&t.push(Jk.configure(this.options.superscript)),t}}),HN={class:"ml-1"},zN=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(ka,{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($l),{key:a,checked:n.value.title===s.title,disabled:s.disabled,class:"flex gap-3 items-center",onClick:s.action},{default:o.withCtx(()=>[s.icon?(o.openBlock(),o.createBlock(o.unref(Ot),{key:0,name:s.icon},null,8,["name"])):o.createCommentVNode("",!0),o.createElementVNode("span",HN,o.toDisplayString(s.title),1),s.shortcutKeys?(o.openBlock(),o.createBlock(o.unref(f5),{key:1,class:"ml-auto"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(KC)(s.shortcutKeys)),1)]),_:2},1024)):o.createCommentVNode("",!0)]),_:2},1032,["checked","disabled","onClick"]))),128))]),_:1},8,["icon","tooltip","disabled"]))}}),UN=et.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=p1(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:zN,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(Yk.configure(this.options.subscript)),this.options.superscript!==!1&&t.push(Jk.configure(this.options.superscript)),t}});var Ra=(t=>(t[t.max=7]="max",t[t.min=0]="min",t[t.more=1]="more",t[t.less=-1]="less",t))(Ra||{});function WN(t,e,n){return t<e?e:t>n?n:t}function jN(t,e,n,r){const{doc:i,selection:s}=t;if(!i||!s||!(s instanceof Pe||s instanceof Fn))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=qN(t,c,e),!1):!$0(u.type.name,r.extensionManager.extensions)}),t}function qN(t,e,n){if(!t.doc)return t;const r=t.doc.nodeAt(e);if(!r)return t;const a=WN((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 Zk({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=jN(a,t,e,i),a.docChanged?(r&&r(a),!0):!1}}const KN=et.create({name:"indent",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),types:["paragraph","heading","blockquote"],minIndent:Ra.min,maxIndent:Ra.max,button({editor:e,t:n}){var s,a;const{selection:r}=e.state,i=r.$anchor.parent;return[{component:Xe,componentProps:{action:()=>{e.commands.indent()},disabled:((s=i==null?void 0:i.attrs)==null?void 0:s.indent)>=Ra.max||!e.can().indent(),shortcutKeys:["Tab"],icon:"IndentIncrease",tooltip:n("editor.indent.tooltip")}},{component:Xe,componentProps:{action:()=>{e.commands.outdent()},shortcutKeys:["Shift","Tab"],disabled:((a=i==null?void 0:i.attrs)==null?void 0:a.indent)<=Ra.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:()=>Zk({delta:Ra.more,types:this.options.types}),outdent:()=>Zk({delta:Ra.less,types:this.options.types})}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.indent(),"Shift-Tab":()=>this.editor.commands.outdent()}}});function GN(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:i,allowedPrefixes:s,startOfLine:a,$position:l}=t,u=r&&!i,c=aB(n),f=new RegExp(`\\s${c}$`),p=a?"^":"",m=i?"":c,g=u?new RegExp(`${p}${c}.*?(?=\\s${m}|$)`,"gm"):new RegExp(`${p}(?:^)?${c}[^\\s${m}]*`,"gm"),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,y=Array.from(b.matchAll(g)).pop();if(!y||y.input===void 0||y.index===void 0)return null;const x=y.input.slice(Math.max(0,y.index-1),y.index),E=new RegExp(`^[${s==null?void 0:s.join("")}\0]?$`).test(x);if(s!==null&&!E)return null;const k=v+y.index;let C=k+y[0].length;return u&&f.test(b.slice(C-1,C+1))&&(y[0]+=" ",C+=1),k<l.pos&&C>=l.pos?{range:{from:k,to:C},query:y[0].slice(n.length),text:y[0]}:null}const XN=new Et("suggestion");function YN({pluginKey:t=XN,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=GN}){let b;const v=p==null?void 0:p(),y=new nt({key:t,view(){return{update:async(x,E)=>{var k,C,_,T,A,D,O;const M=(k=this.key)===null||k===void 0?void 0:k.getState(E),$=(C=this.key)===null||C===void 0?void 0:C.getState(x.state),V=M.active&&$.active&&M.range.from!==$.range.from,G=!M.active&&$.active,ee=M.active&&!$.active,W=!G&&!ee&&M.query!==$.query,F=G||V&&W,R=W||V,H=ee||V&&W;if(!F&&!R&&!H)return;const L=H&&!F?M:$,q=x.dom.querySelector(`[data-decoration-id="${L.decorationId}"]`);b={editor:e,range:L.range,query:L.query,text:L.text,items:[],command:X=>c({editor:e,range:L.range,props:X}),decorationNode:q,clientRect:q?()=>{var X;const{decorationId:le}=(X=this.key)===null||X===void 0?void 0:X.getState(e.state),pe=x.dom.querySelector(`[data-decoration-id="${le}"]`);return(pe==null?void 0:pe.getBoundingClientRect())||null}:null},F&&((_=v==null?void 0:v.onBeforeStart)===null||_===void 0||_.call(v,b)),R&&((T=v==null?void 0:v.onBeforeUpdate)===null||T===void 0||T.call(v,b)),(R||F)&&(b.items=await f({editor:e,query:L.query})),H&&((A=v==null?void 0:v.onExit)===null||A===void 0||A.call(v,b)),R&&((D=v==null?void 0:v.onUpdate)===null||D===void 0||D.call(v,b)),F&&((O=v==null?void 0:v.onStart)===null||O===void 0||O.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,E,k,C){const{isEditable:_}=e,{composing:T}=e.view,{selection:A}=x,{empty:D,from:O}=A,M={...E};if(M.composing=T,_&&(D||e.view.composing)){(O<E.range.from||O>E.range.to)&&!T&&!E.composing&&(M.active=!1);const $=g({char:n,allowSpaces:r,allowToIncludeChar:i,allowedPrefixes:s,startOfLine:a,$position:A.$from}),V=`id_${Math.floor(Math.random()*4294967295)}`;$&&m({editor:e,state:C,range:$.range,isActive:E.active})?(M.active=!0,M.decorationId=E.decorationId?E.decorationId:V,M.range=$.range,M.query=$.query,M.text=$.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,E){var k;const{active:C,range:_}=y.getState(x.state);return C&&((k=v==null?void 0:v.onKeyDown)===null||k===void 0?void 0:k.call(v,{view:x,event:E,range:_}))||!1},decorations(x){const{active:E,range:k,decorationId:C}=y.getState(x);return E?ut.create(x.doc,[qt.inline(k.from,k.to,{nodeName:l,class:u,"data-decoration-id":C})]):null}}});return y}const JN=[{label:"优酷",value:"youku",icon:"Youku"},{label:"哔哩哔哩",value:"bilibili",icon:"BiliBili"},{label:"腾讯视频",value:"qqvideo",icon:"QQVideo"}],ZN=[{label:"高德地图",value:"amap",icon:"Gaode"},{label:"百度地图",value:"baidu_map",icon:"Baidu"}],QN=[{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"}],NN=[{label:"CodePen",value:"codepen",icon:"Codepen"}],eee=[{label:"金数据",value:"jinshuju",icon:"Jinshuju"}],tee=[],nee=[...JN,...ZN,...QN,...NN,...eee,...tee];function ree(t){const{t:e}=Tt(),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(p1(t,"iframes")){const i=nee;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 oee={key:0,class:"grid grid-cols-1 gap-0.5 min-w-48"},iee={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"},see=["onClick"],aee=["src"],lee={key:1,class:"p-3"},uee={class:"text-xs text-gray-800 dark:text-gray-400"},cee=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}=Tt(),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,y=a.value[v];y&&y.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,y=r.value;v<0&&(y=r.value-1,v=((x=l.items[y])==null?void 0:x.commands.length)-1||0),y<0&&(y=l.items.length-1,v=l.items[y].commands.length-1),n.value=v,r.value=y}function f(){if(!l.items.length)return!1;const v=l.items[r.value].commands;let y=n.value+1,x=r.value;v.length-1<y&&(y=0,x=r.value+1),l.items.length-1<x&&(x=0),n.value=y,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,y){const x=l.items[v].commands[y];l.command(x)}function g(v,y){m(v,y)}function b(v,y,x){a.value[v*1e3+y]=x}return(v,y)=>{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",oee,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(v.items,(E,k)=>(o.openBlock(),o.createElementBlock(o.Fragment,{key:E.title},[o.createElementVNode("div",iee,o.toDisplayString(E.title),1),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(E.commands,(C,_)=>(o.openBlock(),o.createElementBlock("button",{ref_for:!0,ref:T=>b(k,_,T),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===k&&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:T=>g(k,_)},[C.iconUrl?(o.openBlock(),o.createElementBlock("img",{key:0,class:"w-6 h-6",src:C.iconUrl},null,8,aee)):o.createCommentVNode("",!0),C.iconName?(o.openBlock(),o.createBlock(o.unref(Ot),{key:1,name:C.iconName,class:"mr-1 text-lg"},null,8,["name"])):o.createCommentVNode("",!0),o.createTextVNode(" "+o.toDisplayString(C.label),1)],10,see))),128))],64))),128))])):(o.openBlock(),o.createElementBlock("div",lee,[o.createElementVNode("span",uee,o.toDisplayString(o.unref(s)("editor.slash.empty")),1)]))],512)}}}),La="slashCommand";let Vt;const dee=et.create({name:La,priority:200,onCreate(){Vt=ea("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[YN({editor:this.editor,char:"/",allowSpaces:!0,startOfLine:!0,pluginKey:new Et(La),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})=>ree(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 t6(cee,{props:n,editor:n.editor});const{view:r}=n.editor,i=()=>{if(!n.clientRect)return n.editor.storage[La].rect;const a=n.clientRect();if(!a)return n.editor.storage[La].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=()=>{Vt==null||Vt[0].setProps({getReferenceClientRect:i})},(s=r.dom.parentElement)==null||s.addEventListener("scroll",e),t.element&&(Vt==null||Vt[0].setProps({getReferenceClientRect:i,appendTo:()=>document.body,content:t.element})),Vt==null||Vt[0].show()},onUpdate(n){var a;t.updateProps(n);const{view:r}=n.editor,i=()=>{if(!n.clientRect)return n.editor.storage[La].rect;const l=n.clientRect();return l?new DOMRect(l.x,l.y,l.width,l.height):n.editor.storage[La].rect},s=()=>{Vt==null||Vt[0].setProps({getReferenceClientRect:i})};(a=r.dom.parentElement)==null||a.addEventListener("scroll",s),n.editor.storage[La].rect=n.clientRect?i():{width:0,height:0,left:0,top:0,right:0,bottom:0},Vt==null||Vt[0].setProps({getReferenceClientRect:i})},onKeyDown(n){var r;return n.event.key==="Escape"?(Vt==null||Vt[0].hide(),!0):(Vt!=null&&Vt[0].state.isShown||Vt==null||Vt[0].show(),(r=t.ref)==null?void 0:r.onKeyDown(n))},onExit(n){var r;if(Vt==null||Vt[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}}}}),fee=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}=Hv();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(Xe,{action:i,title:"AI",disabled:s.disabled,icon:s.icon,tooltip:s.tooltip},null,8,["disabled","icon","tooltip"]))}}),pee=Lt.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:fee,componentProps:{icon:"Sparkles",tooltip:n("editor.AI.ask")}})}}});function hee(t,e){const n=atob(t.split(",")[1]),r=new Array(n.length);for(let s=0;s<n.length;s++)r[s]=n.charCodeAt(s);const i=new Uint8Array(r);return new Blob([i],{type:e})}function mee(t,e){return new File([t],e,{type:t.type})}const gee=et.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:Xe,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}=Hv(),{t:r}=Tt();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(p1(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 E=x.getAttribute("src"),k=hee(E,"image/jpeg"),C=mee(k,"image.jpeg");v.push(C)}const y=await b.upload(v);for(let x=0;x<p.length;x++){const E=p[x];E.setAttribute("src",y[x].src);const k=E.parentElement;(k==null?void 0:k.tagName)==="P"&&(k.insertAdjacentElement("beforebegin",E),!k.hasChildNodes()&&k.textContent===""&&k.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}=Ne.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}}}}),zv=xn(),bee=et.create({name:"preview",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({t:e})=>({component:Xe,componentProps:{icon:"Eye",action:()=>{zv.togglePreview()},tooltip:e("editor.preview.tooltip"),isActive:()=>zv.state.showPreview}})}},addCommands(){return{togglePreview:()=>()=>(zv.togglePreview(),!0)}}}),Qk=xn(),vee=(t,e,n)=>RegExp(e?t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"):t,n?"gu":"gui");function yee(t,e,n,r){const i=[],s=[];let a=[],l=0;if(!e)return{decorationsToReturn:ut.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=qt.inline(c.from,c.to,{class:f});i.push(p)}return{decorationsToReturn:ut.create(t,i),results:s}}const wee=(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))},xee=(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]},Cee=(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=xee(t,a,i,s);c&&(i=c[0],s=c[1])}r&&r(n)}},Eee=new Et("findAndReplacePlugin"),kee=et.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:Xe,componentProps:{icon:"DocSearch",tooltip:r("editor.findAndReplace.tooltip"),action:()=>{Qk.toggleFindAndReplace()},isActive:()=>Qk.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 wee(r,i,{state:e,dispatch:n}),!1},replaceAll:()=>({editor:t,tr:e,dispatch:n})=>{const{replaceTerm:r,results:i}=t.storage.findAndReplace;return Cee(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 nt({key:Eee,state:{init:()=>ut.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=[],ut.empty;const{decorationsToReturn:v,results:y}=yee(a,vee(c,n,p),e,g);return t.storage.findAndReplace.results=y,v}},props:{decorations(a){return this.getState(a)}}})]}}),{togglePrinter:See,state:_ee}=xn(),Tee=et.create({name:"printer",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({t:e})=>({component:Xe,componentProps:{tooltip:e("editor.printer.tooltip"),action:()=>See(),icon:"Printer",shortcutKeys:["mod","P"],isActive:()=>_ee.printer}})}}}),Aee=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 an.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 Nk{constructor({api:e,limit:n,transfer:r,enabled:i}){Ft(this,"suggestions",[]);Ft(this,"api","");Ft(this,"enabled",!0);Ft(this,"limit");Ft(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(Aee.call(this,e))}toggleIsEnabled(){this.enabled=!this.enabled}setEnabled(e){this.enabled=e}getIsEnabled(){return this.enabled}}const Mee=Object.freeze(Object.defineProperty({__proto__:null,AI:pee,BaseKit:Xk,Blockquote:MK,Bold:P8,BulletList:wK,Clear:hb,Code:Tj,CodeBlock:jq,Color:g5,Columns:Tv,FindAndReplace:kee,FontFamily:pk,FontSize:m5,FormatPainter:Sv,Fullscreen:gG,Heading:p5,Highlight:mK,History:zb,HorizontalRule:iG,Image:qu,ImageUpload:Gk,ImportWord:gee,Indent:KN,Italic:V8,LineHeight:gk,Link:Fb,MoreMark:UN,OrderedList:kK,Preview:bee,Printer:Tee,Proofreader:Nk,SlashCommand:dee,SpellcheckerExtension:ak,Strike:$8,SubAndSuperScript:$N,Table:Pv,TaskList:TK,TextAlign:h5,Underline:F8,Video:jk,VideoUpload:Wk},Symbol.toStringTag,{value:"Module"})),Oee='<page id="ft6nbbxs" extend="false" pagenumber="1" force="false"><h1 id="tk6n64mj" extend=""false""><strong>Introduction(English)</strong></h1><p id="s864ng1o" extend=""false"">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=""false""><strong>소개(국문)</strong></h1><p id="0qei01hl" extend=""false"">마이마이 에디터는 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 Bee(){const t=window.localStorage.getItem("content"),e=o.ref(t||Oee),n=o.computed(()=>[Xk.configure({placeholder:{showOnlyCurrent:!0},characterCount:{limit:1e5},excludes:{}}),zb,Tv,Sv,hb,Fb,qu,Pv]),r=Ne.useEventBus(fr.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 Iee(){const t=o.ref(!1);return{hasEverFocused:t,markAsFocused:()=>{t.value=!0},insertHtml:(r,i)=>{const{state:s}=r,{doc:a,selection:l}=s,u=l.$from,c=a.firstChild,f=r.isEmpty;if(!t.value){if(f&&c){r.chain().insertContentAt({from:0,to:c.nodeSize},i).focus().run();return}const m=a.content.size;r.chain().insertContentAt(m,i).focus().run();return}const p=u.parent;if(p.type.name==="paragraph"&&p.textContent.trim().length===0){const m=u.before();r.chain().insertContentAt({from:m,to:m+p.nodeSize},i).focus().run();return}if(u.parentOffset===0&&p.type.name==="paragraph"&&p.content.size>0){const m=u.before();r.chain().insertContentAt(m,i).focus().run();return}r.chain().insertContentAt(r.state.selection,i).focus().run()}}}function Xl(t=250){const e=o.ref(!1);let n=null;const r=()=>{e.value=!0,n&&clearTimeout(n),n=setTimeout(()=>{e.value=!1},t)};return o.onUnmounted(()=>{n&&clearTimeout(n)}),{isScrolling:e,handleScroll:r}}function Ree(){const t=o.ref(!1);let e=!1;function n(){const l=Array.from(document.querySelectorAll(".inside-toolbar")),u=document.querySelector("#tool-bar-format"),c=document.querySelector("#tool-bar-image"),f=Array.from(document.querySelectorAll('[contenteditable="true"].tiptap:not(.simple-editor)'));return{popupInsideToolbars:l,toolBarFormat:u,toolBarImage:c,tiptapEditors:f}}function r(l){if(!l)return!1;const{popupInsideToolbars:u,toolBarFormat:c,toolBarImage:f,tiptapEditors:p}=n();return u.some(m=>m.contains(l))||((c==null?void 0:c.contains(l))??!1)||((f==null?void 0:f.contains(l))??!1)||p.some(m=>m.contains(l))}function i(l){e=r(l.target)}function s(l){const u=l.target;u&&r(u)&&(t.value=!0)}function a(l){const u=l.relatedTarget;r(u)||e&&u===null||(t.value=!1)}return Ne.useEventListener(document,"mousedown",i,{capture:!0}),Ne.useEventListener(document,"touchstart",i,{capture:!0}),Ne.useEventListener(document,"focusin",s),Ne.useEventListener(document,"focusout",a),{isShowToolBarBaseOnEditor:t}}const Lee={class:"flex items-center h-[32px] hover:bg-ed-muted rounded-md"},Dee={class:"text-sm flex items-center justify-center"},Pee={width:"18px",height:"18px",viewBox:"0 0 256 256",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},Vee={id:"icon/填充色",stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},Fee={id:"icon/背景颜色"},$ee=["fill"],eS=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",Lee,[o.createVNode(Xe,{id:"highlight",tooltip:a.tooltip,disabled:a.disabled,action:s,"tooltip-options":a.tooltipOptions},{icon:o.withCtx(()=>[o.createElementVNode("span",Dee,[(o.openBlock(),o.createElementBlock("svg",Pee,[o.createElementVNode("g",Vee,[o.createElementVNode("g",Fee,[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,$ee)])])]))])]),_:1},8,["tooltip","disabled","tooltip-options"]),o.createVNode(A8,{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(vn),{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(Ot),{class:"w-3 h-3 text-zinc-500",name:"MenuDown"})]),_:1},8,["disabled"])]),_:1},8,["modelValue","disabled"])]))}}),Hee={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"},Ih=o.defineComponent({__name:"TableBubbleMenu",props:{editor:{}},setup(t){const e=t,n=()=>document.body,r=({editor:y})=>{var x;return y.isActive("table")&&(((x=y.storage.table)==null?void 0:x.isTableEditorOpen)??!1)},{t:i}=Tt();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 y;(y=e.editor)==null||y.chain().focus().splitCell().run()}function g(){e.editor.chain().focus().deleteTable().run()}function b(y){e.editor.chain().focus().setTableCellBackground(y).run()}const v=()=>{const y=document.querySelector(".vdc-editor");if(!y)return new DOMRect(-1e3,-1e3,0,0);const x=y.getBoundingClientRect();return new DOMRect(x.left,x.top+10,x.width,0)};return(y,x)=>(o.openBlock(),o.createBlock(o.unref(Wu),{editor:y.editor,"plugin-key":"table","update-delay":0,"should-show":r,"tippy-options":{zIndex:9999,maxWidth:"auto",getReferenceClientRect:v,appendTo:n}},{default:o.withCtx(()=>{var E,k,C,_,T,A,D,O,M;return[o.createElementVNode("div",Hee,[o.createVNode(Xe,{icon:"TablerColumnInsertLeft","icon-class":"w-5 h-5",tooltip:o.unref(i)("editor.table.menu.insertColumnBefore"),action:s,"tooltip-options":{sideOffset:15},disabled:!((E=y.editor)!=null&&E.can().addColumnBefore())},null,8,["tooltip","disabled"]),o.createVNode(Xe,{icon:"TablerColumnInsertRight",tooltip:o.unref(i)("editor.table.menu.insertColumnAfter"),"icon-class":"w-5 h-5",action:a,"tooltip-options":{sideOffset:15},disabled:!((k=y.editor)!=null&&k.can().addColumnAfter())},null,8,["tooltip","disabled"]),o.createVNode(Xe,{icon:"TablerColumnRemove",action:l,"icon-class":"w-5 h-5",tooltip:o.unref(i)("editor.table.menu.deleteColumn"),"tooltip-options":{sideOffset:15},disabled:!((C=y.editor)!=null&&C.can().deleteColumn())},null,8,["tooltip","disabled"]),o.createVNode(o.unref(mo),{orientation:"vertical",class:"mx-1 me-2 h-[16px]"}),o.createVNode(Xe,{icon:"TablerRowInsertTop",action:u,"icon-class":"w-5 h-5",tooltip:o.unref(i)("editor.table.menu.insertRowAbove"),"tooltip-options":{sideOffset:15},disabled:!((_=y.editor)!=null&&_.can().addRowBefore())},null,8,["tooltip","disabled"]),o.createVNode(Xe,{icon:"TablerRowInsertBottom",action:c,"icon-class":"w-5 h-5",tooltip:o.unref(i)("editor.table.menu.insertRowBelow"),"tooltip-options":{sideOffset:15},disabled:!((T=y.editor)!=null&&T.can().addRowAfter())},null,8,["tooltip","disabled"]),o.createVNode(Xe,{icon:"TablerRowRemove",action:f,"icon-class":"w-5 h-5",tooltip:o.unref(i)("editor.table.menu.deleteRow"),"tooltip-options":{sideOffset:15},disabled:!((A=y.editor)!=null&&A.can().deleteRow())},null,8,["tooltip","disabled"]),o.createVNode(o.unref(mo),{orientation:"vertical",class:"mx-1 me-2 h-[16px]"}),o.createVNode(Xe,{icon:"TableCellsMerge",action:p,"icon-class":"w-5 h-5",tooltip:o.unref(i)("editor.table.menu.mergeCells"),"tooltip-options":{sideOffset:15},disabled:!((D=y.editor)!=null&&D.can().mergeCells())},null,8,["tooltip","disabled"]),o.createVNode(Xe,{icon:"TableCellsSplit",action:m,"icon-class":"w-5 h-5",tooltip:o.unref(i)("editor.table.menu.splitCells"),"tooltip-options":{sideOffset:15},disabled:!((O=y.editor)!=null&&O.can().splitCell())},null,8,["tooltip","disabled"]),o.createVNode(o.unref(mo),{orientation:"vertical",class:"mx-1 me-2 h-[16px]"}),o.createVNode(eS,{editor:y.editor,tooltip:o.unref(i)("editor.table.menu.setCellsBgColor"),action:b,"tooltip-options":{sideOffset:15}},null,8,["editor","tooltip"]),o.createVNode(Xe,{icon:"Trash2",tooltip:o.unref(i)("editor.table.menu.deleteTable"),"icon-class":"w-5 h-5",action:g,"tooltip-options":{sideOffset:15},disabled:!((M=y.editor)!=null&&M.can().deleteTable())},null,8,["tooltip","disabled"])])]}),_:1},8,["editor","tippy-options"]))}}),zee={class:"p-2 bg-white border rounded-lg shadow-sm dark:bg-black border-neutral-200 dark:border-neutral-800"},Uee={class:"flex items-center gap-1"},Rh=o.defineComponent({__name:"ColumnsBubbleMenu",props:{editor:{},disabled:{type:Boolean,default:!1}},setup(t){const e=t,n=({editor:l})=>F0(l.view.state,"columns"),r=()=>{const l=x8(e.editor,"columns");return(l==null?void 0:l.getBoundingClientRect())||new DOMRect(-1e3,-1e3,0,0)},i=()=>{e.editor.chain().focus().setLayout(Ba.SidebarLeft).run()},s=()=>{e.editor.chain().focus().setLayout(Ba.SidebarRight).run()},a=()=>{e.editor.chain().focus().setLayout(Ba.TwoColumn).run()};return(l,u)=>(o.openBlock(),o.createBlock(o.unref(Wu),{editor:l.editor,"plugin-key":"columns","should-show":n,"update-delay":0,"tippy-options":{offset:[0,8],popperOptions:{modifiers:[{name:"flip",enabled:!1}]},getReferenceClientRect:r,plugins:[o.unref(zI)],sticky:"popper"}},{default:o.withCtx(()=>[o.createElementVNode("div",zee,[o.createElementVNode("div",Uee,[o.createVNode(Xe,{id:"panel-left",title:"ok",icon:"PanelLeft",tooltip:"tooltip",action:i,"is-active":()=>l.editor.isActive("columns",{layout:o.unref(Ba).SidebarLeft}),"tooltip-options":{sideOffset:15}},null,8,["is-active"]),o.createVNode(Xe,{id:"columns",title:"ok",icon:"Columns",tooltip:"tooltip",action:a,"is-active":()=>l.editor.isActive("columns",{layout:o.unref(Ba).TwoColumn}),"tooltip-options":{sideOffset:15}},null,8,["is-active"]),o.createVNode(Xe,{id:"panel-right",title:"ok",icon:"PanelRight",tooltip:"tooltip",action:s,"is-active":()=>l.editor.isActive("columns",{layout:o.unref(Ba).SidebarRight}),"tooltip-options":{sideOffset:15}},null,8,["is-active"])])])]),_:1},8,["editor","tippy-options"]))}}),Wee={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"},jee=["href"],qee={class:"flex flex-nowrap"},Kee=o.defineComponent({__name:"LinkViewBlock",props:{editor:{},link:{default:void 0}},emits:["clear","edit"],setup(t,{emit:e}){const{t:n}=Tt(),r=e;function i(){r("clear")}function s(){r("edit")}return(a,l)=>(o.openBlock(),o.createElementBlock("div",Wee,[o.createElementVNode("a",{href:a.link,target:"_blank",rel:"noopener noreferrer",class:"text-sm underline break-all"},o.toDisplayString(o.unref(kt.truncate)(a.link,{length:50,omission:"…"})),9,jee),a.link?(o.openBlock(),o.createBlock(o.unref(mo),{key:0,orientation:"vertical",class:"h-4"})):o.createCommentVNode("",!0),o.createElementVNode("div",qee,[o.createVNode(Xe,{icon:"Pencil",tooltip:o.unref(n)("editor.link.edit.tooltip"),action:s,"tooltip-options":{sideOffset:15}},null,8,["tooltip"]),o.createVNode(Xe,{icon:"Unlink",tooltip:o.unref(n)("editor.link.unlink.tooltip"),action:i,"tooltip-options":{sideOffset:15}},null,8,["tooltip"])])]))}}),Lh=o.defineComponent({__name:"LinkBubbleMenu",props:{editor:{},disabled:{type:Boolean,default:!1}},setup(t){const e=t,n=o.ref(!1),r=o.computed(()=>{const{href:l}=e.editor.getAttributes("link");return l}),i=o.computed(()=>e.editor.isActive("link"));function s(l,u,c){e.editor.chain().extendMarkRange("link").insertContent({type:"text",text:u,marks:[{type:"link",attrs:{href:l,target:c?"_blank":""}}]}).setLink({href:l}).focus().run(),n.value=!1}function a(){e.editor.chain().extendMarkRange("link").unsetLink().focus().run(),n.value=!1}return(l,u)=>o.withDirectives((o.openBlock(),o.createBlock(o.unref(Wu),{editor:l.editor,"update-delay":0,"tippy-options":{popperOptions:{modifiers:[{name:"flip",enabled:!0}]},appendTo:"parent",placement:"bottom-start",offset:[-2,16],zIndex:9999,onHidden:()=>{n.value=!1}}},{default:o.withCtx(()=>[o.createVNode(o.unref(fs),{open:n.value,"onUpdate:open":u[1]||(u[1]=c=>n.value=c)},{default:o.withCtx(()=>[o.createVNode(o.unref(DP),null,{default:o.withCtx(()=>[n.value?o.createCommentVNode("",!0):(o.openBlock(),o.createBlock(Kee,{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(ps),{class:"p-0 border-0 w-fit shadow-none",align:"start",side:"bottom"},{default:o.withCtx(()=>[o.createVNode($5,{class:"p-4",editor:l.editor,onOnSetLink:s},null,8,["editor"])]),_:1})]),_:1},8,["open"])]),_:1},8,["editor","tippy-options"])),[[o.vShow,i.value]])}}),tS=(t,e,n,r,i)=>{const s=o.ref(0),a=Ne.useEventBus(fr.RENDER_SUPER_TEXT),l=_=>{if(!e.value||!t)return;const T=e.value.index,A=e.value.id,{state:D}=t,{tr:O}=D;let M=!1;D.doc.descendants(($,V)=>{var G,ee;if(((G=$.attrs)==null?void 0:G[rt.ID])===A){(ee=$.attrs[rt.TEXT])!=null&&ee.trim();const W=_.trim();if(Eh(W))return O.delete(V,V+1),M=!0,!1;const{[rt.ELEMENT_ID]:F,...R}=$.attrs;return O.setNodeMarkup(V,void 0,{...R,[rt.TEXT]:W}),M=!0,!1}return!0}),M&&t&&t.view.dispatch(O),T!==-1&&(n.value[T].text=_,n.value[T].textOriginal=_)},u=o.ref(new Map),c=()=>{if(!(t!=null&&t.view.dom))return[];const _=[],T=t==null?void 0:t.view.dom.querySelectorAll("[node-id]"),A=new Map;return u.value.clear(),T.forEach(D=>{const O=D.getBoundingClientRect().top;A.has(O)||A.set(O,D),u.value.set(D.getAttribute("node-id")||"unknown",0)}),_.push(...A.values()),_},f=_=>{const T=_.closest(`#${r}`);if(!T)return;const A=T.getBoundingClientRect().top,D=T==null?void 0:T.scrollTop;return _.getBoundingClientRect().top-(A-D)},p=(_,T)=>{const A=n.value.findIndex(D=>D.id===_);A>-1&&(n.value[A].status=T)},m=_=>_.replace(/<p><\/p>/g,"<p> </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,T=new Set(n.value.map(O=>O.id)),A=_.map(O=>({isHidden:O.classList.contains("hidden"),isTruncated:O.classList.contains("super-text-truncate")}));_.forEach(O=>{O.classList.remove("hidden"),O.classList.remove("super-text-truncate")});for(const O of u.value.keys())T.has(O)||u.value.delete(O);_.forEach(O=>{const M=O.getAttribute("book-mark-id");if(!M)return;const $=O.offsetTop+O.offsetHeight,V=u.value.get(M)||0;u.value.set(M,Math.max($,V))}),_.forEach((O,M)=>{A[M].isHidden&&O.classList.add("hidden"),A[M].isTruncated&&O.classList.add("super-text-truncate")});let D=0;for(const O of u.value.values())O>D&&(D=O);s.value=D},b=async()=>{await o.nextTick();const T=c().map(A=>{const D=A.getAttribute("node-id"),O=A.getAttribute("book-mark-content"),M=A.getAttribute("page-id"),$=A.getAttribute("page-number"),V=A.getBoundingClientRect(),G=A.getAttribute("line-id"),ee=A.getAttribute("element-id");return{position:V,text:m(O),id:D,pageId:M,pageNumber:$,visiblePosition:f(A),status:0,lineId:G,elementId:ee,textOriginal:m(O)}});n.value=T},v=(_,T)=>{const A=_.bottom<=T.top,D=_.top>=T.bottom;return!(A||D)};async function y(){const _=i.value;if(!_||_.length===0){g();return}_.sort((T,A)=>{const D=Number(T.getAttribute("index")),O=Number(A.getAttribute("index"));return D-O}),_.forEach(T=>T.classList.remove("super-text-truncate")),_.forEach((T,A)=>{const D=T.getBoundingClientRect();_.slice(A+1).forEach(O=>{const M=O.getBoundingClientRect();v(D,M)&&T.classList.add("super-text-truncate")})}),g()}const x=async _=>{await o.nextTick();const T=t==null?void 0:t.view.dom.querySelector(`[node-id='${_.dataId}']`),A=i.value.find(M=>{const $=M.getBoundingClientRect().top,V=T==null?void 0:T.getBoundingClientRect().top;if(V==null)return!1;const G=V-$;return Math.abs(G-9)<=2});if(!A)return;const D=Number(A.getAttribute("index"));if(!_.text){A.querySelector(".super-text-lines").innerHTML=n.value[D].textOriginal,i.value.forEach(M=>M.classList.remove("hidden")),y();return}A.querySelector(".super-text-lines").innerHTML=m(_.text),A.classList.remove("super-text-truncate");const O=A.getBoundingClientRect();i.value.forEach((M,$)=>{if($!==D){const V=M.getBoundingClientRect();v(O,V)&&M.classList.add("hidden")}}),g()},E=_=>{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")}},k=(_,T)=>{const A=_.currentTarget;A.classList.remove("super-text-truncate");const D=A.getBoundingClientRect();i.value.forEach((O,M)=>{if(M!==T){const $=O.getBoundingClientRect();v(D,$)&&O.classList.add("hidden")}}),g()},C=()=>{i.value.forEach(_=>_.classList.remove("hidden")),y()};return o.onBeforeMount(()=>{a.on(E),window.addEventListener("resize",b)}),o.onBeforeUnmount(()=>{a.off(E),window.removeEventListener("resize",b)}),o.watch(()=>n,async()=>{await o.nextTick(),y()},{deep:!0}),{onUpdate:l,hanldeTruncateSuperTexts:y,eventListener:E,handleMouseOver:k,handleMouseLeave:C,wrapperMinHeight:s}},Gee=["index","book-mark-id","line-id","onMouseover"],Xee=["innerHTML"],Yee=uo(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}=tS(n.editor,l,i,"editor-container",r),b=(k,C)=>{c.value&&(l.value={id:k.id,text:k.text,elementId:k.elementId,index:C},s.value=!0,u&&(a.value=!0))},v=k=>{var C,_;return cd(k?((C=n.superPreviewCustomClass)==null?void 0:C.completedSuper)??"bg-black":((_=n.superPreviewCustomClass)==null?void 0:_.unproducedSuper)??"bg-red-500")},y=o.computed(()=>n.fontSize??""),{contentInner:x,measuredMinWidth:E}=df({minChars:n.minChars,fontSize:y});return e({measuredMinWidthComment:E}),(k,C)=>{var T;const _=Ot;return o.openBlock(),o.createElementBlock("div",{id:"super-text-view-wrapper",ref_key:"contentInner",ref:x,style:o.normalizeStyle({width:`${Number(o.unref(E))+25}px`,minHeight:`${o.unref(g)}px`}),class:o.normalizeClass(o.unref(Se)("relative border border-ed-gray-400 dark:bg-black rounded-[3px] mr-2.5",((T=k.superPreviewCustomClass)==null?void 0:T.overall)??"bg-ed-gray-50"))},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(i.value,(A,D)=>{var O,M,$;return o.openBlock(),o.createElementBlock("div",{key:A.id,ref_for:!0,ref_key:"superTextRefs",ref:r,index:D,"book-mark-id":A.id,"line-id":A.lineId,class:o.normalizeClass(o.unref(Se)("super-text-view","absolute w-full px-2 translate-y-[-10px] group",{})),style:o.normalizeStyle({top:`${A.visiblePosition||((O=A.position)==null?void 0:O.top)}px`}),onMouseover:V=>o.unref(p)(V,D),onMouseleave:C[0]||(C[0]=(...V)=>o.unref(m)&&o.unref(m)(...V))},[o.createVNode(o.unref(uv),{role:"text",variant:"outline",class:o.normalizeClass(o.unref(Se)("wrap-anywhere whitespace-normal w-full !font-normal px-1 pt-0 m-0 !leading-tight rounded-sm text-white border-transparent cursor-pointer",A.elementId?((M=k.superPreviewCustomClass)==null?void 0:M.completedSuper)??"bg-black":(($=k.superPreviewCustomClass)==null?void 0:$.unproducedSuper)??"bg-red-500",{"cursor-default":!o.unref(c)})),onDblclick:V=>b(A,D)},{default:o.withCtx(()=>[o.createElementVNode("div",{class:"super-text-lines",innerHTML:A.text},null,8,Xee),o.createVNode(_,{name:"triangle",class:o.normalizeClass(["absolute top-[0.4em] rotate-90 w-3 h-3 right-0",v(A.elementId)])},null,8,["class"])]),_:2},1032,["class","onDblclick"])],46,Gee)}),128)),!o.unref(u)&&l.value?(o.openBlock(),o.createBlock(Wc,{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]=A=>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"]]),Jee=["index","book-mark-id","line-id","onMouseover"],Zee=["innerHTML"],Qee=uo(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}=tS(e.editor,a,r,"editor-container-comment",n),g=(y,x)=>{u.value&&(a.value={id:y.id,text:y.text,elementId:y.elementId,index:x},e.disableSuperInput||(i.value=!0),l&&(s.value=!0))},b=y=>{var x,E;return cd(y?((x=e.superPreviewCustomClass)==null?void 0:x.completedSuper)??"bg-black":((E=e.superPreviewCustomClass)==null?void 0:E.unproducedSuper)??"bg-red-500")},v=o.inject("measuredMinWidthComment",0);return(y,x)=>{var k;const E=Ot;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(Se)("relative border border-ed-gray-400 dark:bg-black rounded-[3px] mr-2.5",((k=y.superPreviewCustomClass)==null?void 0:k.overall)??"bg-ed-gray-50"))},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(r.value,(C,_)=>{var T,A,D;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(Se)("super-text-view","absolute w-full px-2 translate-y-[-10px] group",{})),style:o.normalizeStyle({top:`${C.visiblePosition||((T=C.position)==null?void 0:T.top)}px`}),onMouseover:O=>o.unref(f)(O,_),onMouseleave:x[0]||(x[0]=(...O)=>o.unref(p)&&o.unref(p)(...O))},[o.createVNode(o.unref(uv),{role:"text",variant:"outline",class:o.normalizeClass(o.unref(Se)("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?((A=y.superPreviewCustomClass)==null?void 0:A.completedSuper)??"bg-black":((D=y.superPreviewCustomClass)==null?void 0:D.unproducedSuper)??"bg-red-500",{"cursor-default":!o.unref(u)})),onDblclick:O=>g(C,_)},{default:o.withCtx(()=>[o.createElementVNode("div",{class:"super-text-lines",innerHTML:C.text},null,8,Zee),o.createVNode(E,{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,Jee)}),128)),!o.unref(l)&&a.value&&!y.disableSuperInput?(o.openBlock(),o.createBlock(Wc,{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"]]),nS=t=>{console.log(t),t=t.replace(/\s*style="[^"]*"/g,""),t=t.replace(/<iframe\b[\s\S]*?<\/iframe\s*>/gi,"");const e=t.match(/<!--StartFragment-->([\s\S]*?)<!--EndFragment-->/),r=(e?e[1]:t).replace(/<br\s*\/?>/gi,`
|
|
345
|
-
`).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},Uv=t=>/^https?:\/\/[^\s]+$/i.test(t.trim()),Wv=(t,e)=>{const{tr:n,selection:r,schema:i}=t.state,s=i.marks.link.create({href:e});return r.empty?(t.dispatch(n.insertText(e,r.from).addMark(r.from,r.from+e.length,s)),!0):(t.dispatch(n.addMark(r.from,r.to,s)),!0)},Nee=(t,e)=>{const{tr:n,schema:r}=t.state,i=e.split(/(?:\r\n?|\n)/),s=[];if(i.forEach(u=>{let c={type:"paragraph"};u.length>0&&(c.content=[{type:"text",text:u}]);let f=Dr.fromJSON(r,c);s.push(f)}),s.length===0)return!1;const a=ge.fromArray(s),l=Te.maxOpen(a);return t.dispatch(n.replaceSelection(l)),!0},ete=xn(),Dh=t=>{const e=o.computed(()=>ete.state.spellCheck);o.watch(()=>e.value,n=>{t.view.dispatch(t.state.tr.setMeta(qn.IS_ACTIVE_SPELLCHECK,n)),t.extensionStorage.spellchecker.spellchecker.hideSuggestionBox(),WC(t)&&t.commands.focus()},{immediate:!0})},tte={id:"editor-container-comment",class:"flex flex-col"},nte={class:"flex flex-1"},rte={id:"editor-panel",class:"flex-1 p-2.5 border border-ed-gray-400 rounded-[3px] focus-within:border-ed-input-focus"},ote=o.defineComponent({__name:"EditorComment",props:{isMobile:{type:Boolean},superTextArea:{default:{view:!0,button:!0}},mode:{},modelValue:{default:""},comment:{},commentCuesheet:{},hideComment:{type:Boolean},disableSuperInput:{type:Boolean,default:!1},fontSizeDefault:{},fontFamilyDefault:{},fontWeightDefault:{},contentTextStyle:{},isOpenSuperView:{type:Boolean,default:!0},output:{default:"html"},dark:{type:Boolean,default:void 0},disabled:{type:Boolean,default:!1},hideToolbar:{type:Boolean,default:!1},isShowFormatControlBar:{type:Boolean},customClassFormatControlBar:{},titleBarComment:{},titleBarContent:{},fieldNameComment:{},fieldNameCommentCuesheet:{},fieldNameContent:{},fieldNameSuper:{},isScreenSplit:{},isShowLineNumber:{type:Boolean},hideMenubar:{type:Boolean},disableBubble:{type:Boolean,default:!1},hideBubble:{type:Boolean,default:!1},maxWidth:{default:void 0},minHeight:{default:600},maxHeight:{default:void 0},height:{},extensions:{default:()=>[]},editorClass:{default:void 0},contentClass:{default:void 0},isCompare:{type:Boolean},autoHeight:{type:Boolean},textAlert:{},customClassToolbar:{},readonly:{type:Boolean,default:!1},canEditSuperReadOnly:{type:Boolean},autoFocus:{type:Boolean},superPreviewCustomClass:{default:void 0},minChar:{},isAccordion:{type:Boolean},contentAutoCopied:{},isEditorView:{type:Boolean},isEditorViewSplitContent:{type:Boolean},editorContentInstance:{},toolbarExtensionOrder:{},watermarkOverlay:{},bottomOffset:{},characterCountLimit:{}},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=Ne.useEventBus(fr.RENDER_SUPER_TEXT),a=o.useAttrs(),l=xn(),{isReady:u,editor:c,updateEditorState:f,superTextStore:p,checkSpellStore:m,setEditorContextMenuRef:g,setEditorFocusedInstance:b}=l,v=o.inject("isEditable",o.ref(!0)),y=new Lo({enablePasteRules:!1,enableInputRules:!1,content:bn(r.modelValue,r.disabled),editorProps:{attributes:{id:lr.COMMENT,[lr.DISABLE_SUPER_INPUT]:`${r.disableSuperInput}`},handleKeyDown:kt.throttle((T,A)=>A.key==="Enter"&&a.enter&&!A.shiftKey?(i("enter"),!0):!1,Vo),transformPastedHTML:T=>nS(T),handlePaste:(T,A)=>{const D=A.clipboardData;if(!D)return!1;const O=r.mode,M=D.getData("text/plain")||"",$=Array.from(D.items).some(V=>V.type.startsWith("image/"));return(O===Me.STRAIGHT||O===Me.REPORT)&&$?(A.preventDefault(),!0):O===Me.PLAIN_TEXT?(A.preventDefault(),T.dispatch(T.state.tr.insertText(M,T.state.selection.from)),!0):!1},clipboardTextParser:(T,A)=>{const D=T.split(/(?:\r\n?|\n)/),O=[];D.forEach($=>{let V={type:"paragraph"};$.length>0&&(V.content=[{type:"text",text:$}]);let G=Dr.fromJSON(A.doc.type.schema,V);O.push(G)});const M=ge.fromArray(O);return Te.maxOpen(M)}},onCreate:({editor:T})=>{f(T)},onUpdate:kt.throttle(({editor:T})=>{u.value=!0;const A=E(T,r.output);i("update:modelValue",A),i("change",{editor:T,output:A}),f(T),x()},Vo),extensions:r.extensions,editable:v.value,onFocus:T=>{g(k.value),b(T.editor)}});async function x(){await o.nextTick(),s.emit({action:"render"})}function E(T,A){if(!T)return"";if(T.isEmpty)return A==="json"?{}:"";switch(A){case"html":return T.getHTML();case"json":return T.getJSON();case"text":return T.getText();default:return""}}o.watch(()=>r.disableSuperInput,()=>{const T=document.getElementById(lr.COMMENT);T==null||T.setAttribute(lr.DISABLE_SUPER_INPUT,`${r.disableSuperInput}`)}),o.watch(()=>m.languages,()=>{y.commands.checkSpelling()}),o.watch(()=>r.modelValue,T=>{if(!y||kt.isEqual(E(y,r.output),T))return;const{from:A,to:D}=y.state.selection;y.commands.setTextSelection({from:A,to:D}),y.commands.setContent(bn(T,r.disabled),!1),x()},{deep:!0}),o.watch(()=>v.value,T=>{var A;y==null||y.setEditable(T),(A=y==null?void 0:y.commands)!=null&&A.setIsEnableSuggestion&&y.commands.setIsEnableSuggestion(T)},{immediate:!0}),o.watch(()=>c.value,()=>{c.value&&c.value.on("selectionUpdate",({editor:T})=>{i("changed:selection",{editor:T})})}),o.onUnmounted(()=>y==null?void 0:y.destroy()),wc(ju.SAVE,()=>{localStorage.setItem("comment",E(y,"html"))});const k=o.ref(null);function C(T){T===Me.REPORT&&g(k.value)}function _(T){T===Me.REPORT&&b(y)}return o.onMounted(()=>{C(r.mode),_(r.mode)}),o.watch(()=>r.mode,T=>{C(T),_(T)}),o.watch(()=>{var T,A;return(A=(T=r.editorContentInstance)==null?void 0:T.storage[ep])==null?void 0:A.enabled},()=>{y.commands.toggleTimeHighlight()}),Dh(y),e({editor:y}),(T,A)=>(o.openBlock(),o.createElementBlock("div",tte,[o.createElementVNode("div",nte,[o.withDirectives(o.createVNode(Qee,{"disable-super-input":T.disableSuperInput,editor:o.unref(y),"super-preview-custom-class":T.superPreviewCustomClass},null,8,["disable-super-input","editor","super-preview-custom-class"]),[[o.vShow,T.isOpenSuperView]]),o.createElementVNode("div",rte,[o.createVNode(kv,{ref_key:"selectContextMenuRef",ref:k,"disable-super-input":T.disableSuperInput,editor:o.unref(y),mode:T.mode,"super-text-store":o.unref(p)},{default:o.withCtx(()=>[o.createVNode(o.unref(Qn),{editor:o.unref(y),spellcheck:"true",class:"h-full break-all"},null,8,["editor"])]),_:1},8,["disable-super-input","editor","mode","super-text-store"])])])]))}});function ite(t,e,n=!1,r=200){const{height:i}=Ne.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===Me.REPORT?(s.value=f/3,a.value=n?"auto":f-s.value,l.value=r/3*2,u.value=r/3):(s.value=0,a.value=n?"auto":i.value)};return n||o.watch(()=>i.value,c),o.onMounted(()=>{c()}),{commentHeight:s,contentHeight:a,minHeight:l,minHeightComment:u}}var ste={exports:{}};(function(t){(function(){var e=["ㄱ","ㄲ","ㄴ","ㄷ","ㄸ","ㄹ","ㅁ","ㅂ","ㅃ","ㅅ","ㅆ","ㅇ","ㅈ","ㅉ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"],n=["ㅏ","ㅐ","ㅑ","ㅒ","ㅓ","ㅔ","ㅕ","ㅖ","ㅗ",["ㅗ","ㅏ"],["ㅗ","ㅐ"],["ㅗ","ㅣ"],"ㅛ","ㅜ",["ㅜ","ㅓ"],["ㅜ","ㅔ"],["ㅜ","ㅣ"],"ㅠ","ㅡ",["ㅡ","ㅣ"],"ㅣ"],r=["","ㄱ","ㄲ",["ㄱ","ㅅ"],"ㄴ",["ㄴ","ㅈ"],["ㄴ","ㅎ"],"ㄷ","ㄹ",["ㄹ","ㄱ"],["ㄹ","ㅁ"],["ㄹ","ㅂ"],["ㄹ","ㅅ"],["ㄹ","ㅌ"],["ㄹ","ㅍ"],["ㄹ","ㅎ"],"ㅁ","ㅂ",["ㅂ","ㅅ"],"ㅅ","ㅆ","ㅇ","ㅈ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"],i=44032,s=["ㄱ","ㄲ","ㄳ","ㄴ","ㄵ","ㄶ","ㄷ","ㄸ","ㄹ","ㄺ","ㄻ","ㄼ","ㄽ","ㄾ","ㄿ","ㅀ","ㅁ","ㅂ","ㅃ","ㅄ","ㅅ","ㅆ","ㅇ","ㅈ","ㅉ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"],a=["ㄱ","ㄲ","ㄴ","ㄷ","ㄸ","ㄹ","ㅁ","ㅂ","ㅃ","ㅅ","ㅆ","ㅇ","ㅈ","ㅉ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"],l=["ㅏ","ㅐ","ㅑ","ㅒ","ㅓ","ㅔ","ㅕ","ㅖ","ㅗ","ㅘ","ㅙ","ㅚ","ㅛ","ㅜ","ㅝ","ㅞ","ㅟ","ㅠ","ㅡ","ㅢ","ㅣ"],u=["","ㄱ","ㄲ","ㄳ","ㄴ","ㄵ","ㄶ","ㄷ","ㄹ","ㄺ","ㄻ","ㄼ","ㄽ","ㄾ","ㄿ","ㅀ","ㅁ","ㅂ","ㅄ","ㅅ","ㅆ","ㅇ","ㅈ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"],c=[["ㄱ","ㅅ","ㄳ"],["ㄴ","ㅈ","ㄵ"],["ㄴ","ㅎ","ㄶ"],["ㄹ","ㄱ","ㄺ"],["ㄹ","ㅁ","ㄻ"],["ㄹ","ㅂ","ㄼ"],["ㄹ","ㅅ","ㄽ"],["ㄹ","ㅌ","ㄾ"],["ㄹ","ㅍ","ㄿ"],["ㄹ","ㅎ","ㅀ"],["ㅂ","ㅅ","ㅄ"]],f=[["ㅗ","ㅏ","ㅘ"],["ㅗ","ㅐ","ㅙ"],["ㅗ","ㅣ","ㅚ"],["ㅜ","ㅓ","ㅝ"],["ㅜ","ㅔ","ㅞ"],["ㅜ","ㅣ","ㅟ"],["ㅡ","ㅣ","ㅢ"]],p,m,g,b,v,y;function x(L){for(var q=L.length,X={0:0},le=0;le<q;le++)L[le]&&(X[L[le].charCodeAt(0)]=le);return X}p=x(s),m=x(a),g=x(l),b=x(u);function E(L){for(var q=L.length,X={},le,pe,_e=0;_e<q;_e++)le=L[_e][0].charCodeAt(0),pe=L[_e][1].charCodeAt(0),typeof X[le]>"u"&&(X[le]={}),X[le][pe]=L[_e][2].charCodeAt(0);return X}v=E(c),y=E(f);function k(L){return typeof p[L]<"u"}function C(L){return typeof m[L]<"u"}function _(L){return typeof g[L]<"u"}function T(L){return typeof b[L]<"u"}function A(L){return 44032<=L&&L<=55203}function D(L,q){return y[L]&&y[L][q]?y[L][q]:!1}function O(L,q){return v[L]&&v[L][q]?v[L][q]:!1}var M=function(L,q){if(L===null)throw new Error("Arguments cannot be null");typeof L=="object"&&(L=L.join(""));for(var X=[],le=L.length,pe,_e,re,be,Y,te=0;te<le;te++){var ne=[];be=L.charCodeAt(te),A(be)?(be-=i,re=be%28,_e=(be-re)/28%21,pe=parseInt((be-re)/28/21),ne.push(e[pe]),typeof n[_e]=="object"?ne=ne.concat(n[_e]):ne.push(n[_e]),re>0&&(typeof r[re]=="object"?ne=ne.concat(r[re]):ne.push(r[re]))):k(be)?(C(be)?Y=e[m[be]]:Y=r[b[be]],typeof Y=="string"?ne.push(Y):ne=ne.concat(Y)):_(be)?(Y=n[g[be]],typeof Y=="string"?ne.push(Y):ne=ne.concat(Y)):ne.push(L.charAt(te)),q?X.push(ne):X=X.concat(ne)}return X},$=function(L){return typeof L!="string"?"":(L=M(L),L.join(""))},V=function(L){typeof L=="string"&&(L=M(L));var q=[],X=L.length,le,pe=0,_e=-1,re,be=!1;function Y(ne){var oe,ce,Ae,Be=0,We,Ge="";if(be=!1,!(_e+1>ne))for(var Ke=1;;Ke++){if(Ke===1){if(oe=L[_e+Ke].charCodeAt(0),_(oe))if(_e+Ke+1<=ne&&_(ce=L[_e+Ke+1].charCodeAt(0))){q.push(String.fromCharCode(D(oe,ce))),_e=ne;return}else{q.push(L[_e+Ke]),_e=ne;return}else if(!C(oe)){q.push(L[_e+Ke]),_e=ne;return}Ge=L[_e+Ke]}else if(Ke===2)if(ce=L[_e+Ke].charCodeAt(0),C(ce)){oe=O(oe,ce),Ge=String.fromCharCode(oe),q.push(Ge),_e=ne;return}else Ge=String.fromCharCode((m[oe]*21+g[ce])*28+i);else Ke===3?(Ae=L[_e+Ke].charCodeAt(0),D(ce,Ae)?ce=D(ce,Ae):Be=Ae,Ge=String.fromCharCode((m[oe]*21+g[ce])*28+b[Be]+i)):Ke===4?(We=L[_e+Ke].charCodeAt(0),O(Be,We)?Be=O(Be,We):Be=We,Ge=String.fromCharCode((m[oe]*21+g[ce])*28+b[Be]+i)):Ke===5&&(We=L[_e+Ke].charCodeAt(0),Be=O(Be,We),Ge=String.fromCharCode((m[oe]*21+g[ce])*28+b[Be]+i));if(_e+Ke>=ne){q.push(Ge),_e=ne;return}}}for(var te=0;te<X;te++){if(le=L[te].charCodeAt(0),!C(le)&&!_(le)&&!T(le)){Y(te-1),Y(te),pe=0;continue}pe===0?C(le)?pe=1:_(le)&&(pe=4):pe==1?_(le)?pe=2:O(re,le)?pe=5:Y(te-1):pe==2?T(le)?pe=3:_(le)?D(re,le)||(Y(te-1),pe=4):(Y(te-1),pe=1):pe==3?T(le)?!be&&O(re,le)?be=!0:(Y(te-1),pe=1):C(le)?(Y(te-1),pe=1):_(le)&&(Y(te-2),pe=2):pe==4?_(le)?D(re,le)?(Y(te),pe=0):Y(te-1):(Y(te-1),pe=1):pe==5&&(_(le)?(Y(te-2),pe=2):(Y(te-1),pe=1)),re=le}return Y(te-1),q.join("")},G=function(L,q){var X=M(L).join(""),le=M(q).join("");return X.indexOf(le)},ee=function(L,q){var X=M(L).join(""),le=M(q).join(""),pe=M(L,!0),_e=new RegExp(le,"gi"),re=[],be;if(!q.length)return[];for(;be=_e.exec(X);)re.push(be.index);function Y(ne){for(var oe=0,ce=0;oe<pe.length;++oe)if(ce+=pe[oe].length,ne<ce)return oe}function te(ne){for(var oe=0,ce=0;oe<pe.length;++oe)if(ce+=pe[oe].length,ne+le.length<=ce)return oe}return re.map(function(ne){return[Y(ne),te(ne)]})};function W(L){this.string=L,this.disassembled=M(L).join("")}W.prototype.search=function(L){return M(L).join("").indexOf(this.disassembled)};var F=function(L){typeof L=="object"&&(L=L.join(""));var q=L.charCodeAt(L.length-1);if(A(q)){q-=i;var X=q%28;if(X>0)return!0}else if(k(q))return!0;return!1},R=function(L,q){return M(L).pop()===q},H={disassemble:M,d:M,disassembleToString:$,ds:$,assemble:V,a:V,search:G,rangeSearch:ee,Searcher:W,endsWithConsonant:F,endsWith:R,isHangul:function(L){return typeof L=="string"&&(L=L.charCodeAt(0)),A(L)},isComplete:function(L){return typeof L=="string"&&(L=L.charCodeAt(0)),A(L)},isConsonant:function(L){return typeof L=="string"&&(L=L.charCodeAt(0)),k(L)},isVowel:function(L){return typeof L=="string"&&(L=L.charCodeAt(0)),_(L)},isCho:function(L){return typeof L=="string"&&(L=L.charCodeAt(0)),C(L)},isJong:function(L){return typeof L=="string"&&(L=L.charCodeAt(0)),T(L)},isHangulAll:function(L){if(typeof L!="string")return!1;for(var q=0;q<L.length;q++)if(!A(L.charCodeAt(q)))return!1;return!0},isCompleteAll:function(L){if(typeof L!="string")return!1;for(var q=0;q<L.length;q++)if(!A(L.charCodeAt(q)))return!1;return!0},isConsonantAll:function(L){if(typeof L!="string")return!1;for(var q=0;q<L.length;q++)if(!k(L.charCodeAt(q)))return!1;return!0},isVowelAll:function(L){if(typeof L!="string")return!1;for(var q=0;q<L.length;q++)if(!_(L.charCodeAt(q)))return!1;return!0},isChoAll:function(L){if(typeof L!="string")return!1;for(var q=0;q<L.length;q++)if(!C(L.charCodeAt(q)))return!1;return!0},isJongAll:function(L){if(typeof L!="string")return!1;for(var q=0;q<L.length;q++)if(!T(L.charCodeAt(q)))return!1;return!0}};t.exports=H})()})(ste);const Yl=new Et("searchHighlight");function Ph(t,e,n){const r=[];if(!e)return r;const i=n.caseSensitive?e.normalize("NFC"):e.normalize("NFC").toLowerCase(),{doc:s}=t.state,a=l=>/[0-9A-Za-z가-힣_]/.test(l);return s.descendants((l,u)=>{if(!l.isText||!l.text)return;let c=l.text.normalize("NFC");n.caseSensitive||(c=c.toLowerCase());let f=0,p=c.indexOf(i,f);for(;p!==-1;){const m=p,g=p+i.length-1;if(n.wholeWord){const b=m>0?c[m-1]:"",v=g+1<c.length?c[g+1]:"";if(b&&a(b)||v&&a(v)){f=p+1,p=c.indexOf(i,f);continue}}r.push({from:u+m,to:u+g+1}),f=p+i.length,p=c.indexOf(i,f)}}),r}function jv(t){return t.state.selection.from}function rS(t){if(t.state.plugins.find(r=>r.spec.key===Yl))return;const n=new nt({key:Yl,state:{init(){return ut.empty},apply(r,i){const s=r.getMeta(Yl);return s!==void 0?s:i.map(r.mapping,r.doc)}},props:{decorations(r){return Yl.getState(r)}}});t.registerPlugin(n)}function oS(t,e,n){rS(t);const r=e.map((a,l)=>qt.inline(a.from,a.to,{class:l===n?"search-match-active":"search-match"})),i=ut.create(t.state.doc,r),s=t.state.tr.setMeta(Yl,i);t.view.dispatch(s)}function Jl(t){rS(t);const e=t.state.tr.setMeta(Yl,ut.empty);t.view.dispatch(e)}function ate(t){const e=o.ref(-1),n=o.ref([]),r=o.computed(()=>n.value.length);function i(p){var x;const m=t.value;if(!m||n.value.length===0)return;const g=n.value.length;e.value=(p%g+g)%g,oS(m,n.value,e.value);const b=n.value[e.value],y=m.view.domAtPos(b.from).node;(x=y==null?void 0:y.scrollIntoView)==null||x.call(y,{block:"nearest",behavior:"smooth"}),m.chain().setTextSelection({from:b.from,to:b.to}).scrollIntoView().run()}function s(p){const m=t.value;if(!m)return;if(n.value=Ph(m,p.find,p),n.value.length===0){e.value=-1,Jl(m);return}const g=jv(m),b=n.value.findIndex(v=>v.from>g);i(b===-1?0:b)}function a(p){const m=t.value;if(!m)return;if(n.value=Ph(m,p.find,p),n.value.length===0){e.value=-1,Jl(m);return}const g=jv(m);let b=-1;for(let v=n.value.length-1;v>=0;v--)if(n.value[v].to<g){b=v;break}i(b===-1?n.value.length-1:b)}function l(p){const m=t.value;if(!m||e.value===-1||n.value.length===0)return;const g=n.value[e.value],{state:b}=m,v=b.doc.textBetween(g.from,g.to);if(!(p.caseSensitive?v===p.find:v.toLowerCase()===p.find.toLowerCase())){s(p);return}m.chain().focus().setTextSelection({from:g.from,to:g.to}).insertContent(p.replace).run(),s(p)}function u(p){const m=t.value;if(!m)return;const g=Ph(m,p.find,p);if(g.length===0)return;const b=m.chain().focus();[...g].reverse().forEach(v=>{b.setTextSelection({from:v.from,to:v.to}).insertContent(p.replace)}),b.run(),n.value=[],e.value=-1,Jl(m)}function c(p){const m=t.value;if(!m)return;if(!p.find){n.value=[],e.value=-1,Jl(m);return}if(n.value=Ph(m,p.find,p),n.value.length===0){e.value=-1,Jl(m);return}const g=jv(m),b=n.value.findIndex(y=>y.from>=g),v=b===-1?0:b;e.value=v,i(v),oS(m,n.value,v)}function f(){const p=t.value;p&&(n.value=[],e.value=-1,Jl(p))}return{searchUp:a,searchDown:s,replaceCurrent:l,replaceAll:u,totalMatches:r,currentMatchIndex:o.readonly(e),refreshMatches:c,clearSearch:f}}const iS=o.defineComponent({__name:"Checkbox",props:{defaultChecked:{type:Boolean},checked:{type:[Boolean,String]},disabled:{type:Boolean},required:{type:Boolean},name:{},value:{},id:{},asChild:{type:Boolean},as:{},class:{}},emits:["update:checked"],setup(t,{emit:e}){const n=t,r=e,i=o.computed(()=>{const{class:a,...l}=n;return l}),s=Dt(i,r);return(a,l)=>(o.openBlock(),o.createBlock(o.unref(LD),o.mergeProps(o.unref(s),{class:o.unref(Se)("peer h-5 w-5 shrink-0 rounded-sm border border-ed-border shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ed-ring disabled:cursor-not-allowed disabled:opacity-50 text-ed-blue",n.class)}),{default:o.withCtx(()=>[o.createVNode(o.unref(DD),{class:"flex h-full w-full items-center justify-center"},{default:o.withCtx(()=>[o.renderSlot(a.$slots,"default",{},()=>[o.createVNode(o.unref(Gg),{icon:"fa-solid:check"})])]),_:3})]),_:3},16,["class"]))}}),lte={class:"flex items-center justify-between px-5 pt-4 pb-2 cursor-move bg-[#F6FAFE]"},ute={class:"text-base font-semibold text-gray-800"},cte={class:"px-5 pt-[20px] pb-4 flex flex-col gap-y-3 bg-white"},dte={class:"grid grid-cols-[60px,1fr] gap-x-3 items-center"},fte={class:"text-right text-sm text-gray-600"},pte={class:"relative"},hte={key:0,class:"absolute right-3 top-1/2 -translate-y-1/2 text-xs text-gray-400 pointer-events-none"},mte={class:"grid grid-cols-[60px,1fr] gap-x-3 items-center"},gte={class:"text-right text-sm text-gray-600"},bte={class:"grid grid-cols-[60px,1fr] gap-x-3"},vte={class:"flex gap-x-5"},yte={class:"flex items-center space-x-2 text-sm"},wte={for:"caseSensitive",class:"select-none text-gray-700"},xte={class:"grid grid-cols-[60px,1fr] gap-x-3"},Cte={class:"flex gap-x-2"},Ete=uo(o.defineComponent({__name:"BatchReplaceDialog",props:{modelValue:{type:Boolean},totalMatches:{default:0},currentMatchIndex:{default:-1}},emits:["update:modelValue","search-down","search-up","replace","replace-all","refresh"],setup(t,{emit:e}){const n=t,r=e;function i(){return{find:s.value,replace:a.value,caseSensitive:u.value,wholeWord:c.value}}const s=o.ref(""),a=o.ref(""),l=o.ref(null),u=o.ref(!1),c=o.ref(!1),f=o.computed(()=>s.value?n.totalMatches===0?"No matches":`${n.currentMatchIndex+1} / ${n.totalMatches}`:""),p=Ne.useLocalStorage("findReplaceDialogPosition",null),m=o.reactive({x:0,y:0}),g=o.ref(!1),b={x:0,y:0},v=O=>{const M=O.target;if(M.closest("input")||M.closest("button")||M.closest("label")||M.closest(".content-area"))return;g.value=!0;const $=document.querySelector(".find-replace-dialog");if(!$)return;const V=$.getBoundingClientRect();b.x=O.clientX-V.left,b.y=O.clientY-V.top,document.addEventListener("mousemove",y),document.addEventListener("mouseup",x)},y=O=>{g.value&&(m.x=O.clientX-b.x,m.y=O.clientY-b.y)},x=()=>{g.value=!1,p.value={x:m.x,y:m.y},document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",x)};o.onUnmounted(()=>{document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",x)}),o.watch(()=>n.modelValue,async O=>{var G,ee;if(!O)return;await o.nextTick();const M=document.querySelector(".find-replace-dialog");if(!M)return;const $=window.innerWidth,V=window.innerHeight;p.value&&p.value.x!==void 0&&p.value.y!==void 0?(m.x=p.value.x,m.y=p.value.y):(m.x=Math.max(($-M.offsetWidth)/2,0),m.y=Math.max((V-M.offsetHeight)/2,0)),s.value&&r("refresh",i()),await o.nextTick(),(ee=(G=l.value)==null?void 0:G.$el)==null||ee.focus()});const E=()=>{r("update:modelValue",!1)},k=()=>{s.value&&r("search-down",i())},C=()=>{s.value&&r("search-up",i())},_=()=>{r("replace",{find:s.value,replace:a.value,caseSensitive:u.value,wholeWord:c.value})},T=()=>{r("replace-all",{find:s.value,replace:a.value,caseSensitive:u.value,wholeWord:c.value})};function A(O){const M=O.target.value;s.value=M,r("refresh",i())}function D(O){const $=O.target.value+(O.data??"");r("refresh",{find:$,replace:a.value,caseSensitive:u.value,wholeWord:c.value})}return(O,M)=>{const $=hs,V=iS,G=vn,ee=Vc,W=Pc;return o.openBlock(),o.createBlock(W,{open:O.modelValue},{default:o.withCtx(()=>[o.createVNode(ee,{"is-overlay-transparent":"",class:"p-0 gap-0 !animate-none !transition-none max-w-max","as-child":""},{default:o.withCtx(()=>[o.createElementVNode("div",{class:"find-replace-dialog fixed z-[70] pointer-events-auto w-[460px] rounded-[10px] overflow-hidden bg-white shadow-xl",style:o.normalizeStyle({top:"0px",left:"0px",transform:`translate(${m.x}px, ${m.y}px)`}),onMousedown:v},[o.createElementVNode("div",lte,[o.createElementVNode("span",ute,o.toDisplayString(O.$t("찾기 및 바꾸기")),1),o.createElementVNode("button",{class:"bg-transparent text-gray-400 hover:text-gray-600 transition-colors p-1",onClick:E},[o.createVNode(o.unref(kc),{class:"w-5 h-5"})])]),o.createElementVNode("div",cte,[o.createElementVNode("div",dte,[o.createElementVNode("label",fte,o.toDisplayString(O.$t("검색")),1),o.createElementVNode("div",pte,[o.createVNode($,{ref_key:"findInputRef",ref:l,modelValue:s.value,"onUpdate:modelValue":M[0]||(M[0]=F=>s.value=F),class:"rounded-md h-[36px] text-sm pr-[90px] !border-gray-300 focus:!border-blue-500 focus:!ring-0 outline-none",onInput:A,onCompositionupdate:D,onKeydown:o.withKeys(o.withModifiers(k,["prevent"]),["enter"])},null,8,["modelValue","onKeydown"]),o.unref(f)?(o.openBlock(),o.createElementBlock("span",hte,o.toDisplayString(o.unref(f)),1)):o.createCommentVNode("",!0)])]),o.createElementVNode("div",mte,[o.createElementVNode("label",gte,o.toDisplayString(O.$t("바꾸기")),1),o.createVNode($,{modelValue:a.value,"onUpdate:modelValue":M[1]||(M[1]=F=>a.value=F),class:"rounded-md h-[36px] text-sm !border-gray-300 focus:!border-blue-500 focus:!ring-0 outline-none"},null,8,["modelValue"])]),o.createElementVNode("div",bte,[M[3]||(M[3]=o.createElementVNode("div",null,null,-1)),o.createElementVNode("div",vte,[o.createElementVNode("div",yte,[o.createVNode(V,{id:"caseSensitive",checked:u.value,"onUpdate:checked":M[2]||(M[2]=F=>{u.value=!!F})},null,8,["checked"]),o.createElementVNode("label",wte,o.toDisplayString(O.$t("대소문자 일치")),1)])])]),o.createElementVNode("div",xte,[M[4]||(M[4]=o.createElementVNode("div",null,null,-1)),o.createElementVNode("div",Cte,[o.createVNode(G,{variant:"outline",class:"h-[36px] text-sm flex-1 rounded-md border-blue-500 text-blue-600 hover:bg-blue-50",onClick:_},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(O.$t("바꾸기")),1)]),_:1}),o.createVNode(G,{variant:"outline",class:"h-[36px] text-sm flex-1 rounded-md border-blue-500 text-blue-600 hover:bg-blue-50",onClick:T},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(O.$t("모두 바꾸기")),1)]),_:1}),o.createVNode(G,{class:"h-[36px] text-sm flex-1 rounded-md bg-blue-500 hover:bg-blue-600",disabled:!s.value,onClick:C},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(O.$t("이전")),1)]),_:1},8,["disabled"]),o.createVNode(G,{class:"h-[36px] text-sm flex-1 rounded-md bg-blue-500 hover:bg-blue-600",disabled:!s.value,onClick:k},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(O.$t("다음")),1)]),_:1},8,["disabled"])])])])],36)]),_:1})]),_:1},8,["open"])}}}),[["__scopeId","data-v-5ec84714"]]),kte={class:"flex flex-1"},Vh=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:"NanumGothicCoding"},fontWeightDefault:{default:void 0},contentTextStyle:{},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},editorContentInstance:{},toolbarExtensionOrder:{default:void 0},watermarkOverlay:{},bottomOffset:{},characterCountLimit:{}},emits:["enter","change","update:modelValue","update:comment","onFocusEditor","changed:selection","setEditorSelected","onBlurEditor","lineFocus","onFocus","onBlur","open-batch-replace"],setup(t,{expose:e,emit:n}){const r=t,i=n,s=Ne.useEventBus(fr.RENDER_SUPER_TEXT),a=Ne.useEventBus(fr.INCREASE_DECREASE_FONTSIZE),l=o.useAttrs(),u=xn(),{isFullscreen:c,isReady:f,editor:p,updateEditorState:m,superTextStore:g,checkSpellStore:b,setEditorContextMenuRef:v,setEditorContentInstance:y,setEditorFocusedInstance:x}=u,E=o.computed(()=>!(r.disabled||r.readonly));o.provide("isEditable",E);const k=o.computed(()=>E.value?!0:r.canEditSuperReadOnly);o.provide("canEditSuper",k);const C=o.computed(()=>r.mode===Me.EDITOR),_=o.ref(r.fontSizeDefault),T=o.ref(r.fontFamilyDefault),A=o.ref(r.fontWeightDefault);o.provide("fontSize",_),o.provide("fontFamily",T),o.provide("fontWeight",A);const D=ie=>{(ie.ctrlKey||ie.metaKey)&&ie.key.toLowerCase()==="h"&&(ie.preventDefault(),ie.stopPropagation(),ie.stopImmediatePropagation(),$.value=!0)};o.onMounted(()=>{We(),window.addEventListener("keydown",D,!0)}),o.onUnmounted(()=>{window.removeEventListener("keydown",D,!0)});const O=ie=>{const Ie=parseInt(_.value||"16px"),st=ie?Ie+2:Ie-2;_.value=st+"px"};o.onBeforeMount(()=>{r.disabled||a.on(O)}),o.onBeforeUnmount(()=>{r.disabled||a.off(O)});const M=o.computed(()=>({...o.unref(c)?{height:"100%"}:{minHeight:r.minHeight?rn(r.minHeight):void 0,maxHeight:r.maxHeight?rn(r.maxHeight):void 0,height:r.height?rn(r.height):void 0},maxWidth:rn(r.maxWidth),width:r.maxWidth?"100%":void 0,margin:r.maxWidth?"0 auto":void 0})),$=o.ref(!1),{searchUp:V,searchDown:G,replaceCurrent:ee,replaceAll:W,totalMatches:F,currentMatchIndex:R,refreshMatches:H,clearSearch:L}=ate(p);o.watch($,ie=>{ie||L()});const q=ie=>{H(ie)},X=ie=>{G(ie)},le=ie=>{V(ie)},pe=ie=>{ee(ie)},_e=ie=>{W(ie)},re=new Lo({enablePasteRules:!1,enableInputRules:!1,content:bn(r.modelValue,r.disabled,r.mode),editorProps:{handleKeyDown:kt.throttle((ie,Ie)=>Ie.key==="Enter"&&l.enter&&!Ie.shiftKey?(i("enter"),!0):!1,Vo),transformPastedHTML:ie=>r.mode===Me.EDITOR?nR(ie):nS(ie),handlePaste:(ie,Ie)=>{var ot;const st=Ie.clipboardData;if(!st)return!1;const Yt=r.mode,ae=Array.from(st.items),Le=ae.some(At=>At.type.startsWith("image/")),ze=ae.some(At=>At.type.startsWith("video/"));if((Yt===Me.STRAIGHT||Yt===Me.REPORT)&&(Le||ze))return Ie.preventDefault(),!0;if(ze)return Ie.preventDefault(),Ke(["video"])&&ae.forEach(async At=>{var Ts;if(!At.type.startsWith("video/"))return;const dn=At.getAsFile();if(!dn)return;const fn=re.extensionManager.extensions.find(As=>As.name==="video"),pr=(Ts=fn==null?void 0:fn.options)==null?void 0:Ts.upload,An=pr?await pr(dn):URL.createObjectURL(dn);re.commands.focus(),re.commands.setVideo({src:An})}),!0;const at=((ot=Ie.clipboardData)==null?void 0:ot.getData("text/plain"))||"";return r.mode===Me.EDITOR&&Uv(at)?(Ie.preventDefault(),Wv(ie,at.trim())):!1},clipboardTextParser:(ie,Ie)=>{const st=ie.split(/(?:\r\n?|\n)/),Yt=[];st.forEach(Le=>{let ze={type:"paragraph"};Le.length>0&&(ze.content=[{type:"text",text:Le}]);let at=Dr.fromJSON(Ie.doc.type.schema,ze);Yt.push(at)});const ae=ge.fromArray(Yt);return Te.maxOpen(ae)}},onCreate:({editor:ie})=>{m(ie)},onUpdate:kt.throttle(({editor:ie})=>{f.value=!0;const Ie=Ge(ie,r.output);i("update:modelValue",Ie),i("change",{editor:ie,output:Ie}),m(ie),o.nextTick(()=>{We()}),oe()},Vo),extensions:kt.uniqBy(qC(r.extensions,r),"name"),editable:E.value,onFocus:ie=>{v(we.value),x(ie.editor),i("onFocus",ie)},onBlur:ie=>i("onBlur",ie),parseOptions:{preserveWhitespace:"full"}}),be=o.computed(()=>r.mode===Me.REPORT||r.mode===Me.STRAIGHT||r.mode===Me.PLAIN_TEXT),Y=o.computed(()=>{const ie={height:"auto",minHeight:r.minHeight?rn(r.minHeight):void 0,maxHeight:r.maxHeight?rn(r.maxHeight):void 0,overflowY:"auto"},Ie={fontFamily:np(re,uc)&&T.value||r.fontFamilyDefault,fontSize:np(re,Qf)&&_.value||r.fontSizeDefault,...np(re,HC)&&(A.value||r.fontWeightDefault)?{fontWeight:A.value||r.fontWeightDefault}:{}};return C.value&&!r.autoHeight?{}:C.value&&r.autoHeight?ie:!C.value&&r.autoHeight?{...ie,...Ie}:Ie});o.watch(()=>[Y.value,r.disabled],async()=>{We()}),o.provide("minCharSuperInput",r.minChar.superPreview);const{contentInner:te,measuredMinWidth:ne,measure:oe}=df({minChars:r.minChar.content,fontSize:_,editor:re}),ce=o.ref(null),Ae=o.computed(()=>{var ie;return(ie=ce.value)==null?void 0:ie.measuredMinWidthComment});o.provide("measuredMinWidthComment",Ae);const Be=o.computed(()=>C.value?0:Bt.value?Number(ne==null?void 0:ne.value)+Number(Ae==null?void 0:Ae.value)+30:Number(ne==null?void 0:ne.value));async function We(){await o.nextTick(),s.emit({action:"render"})}function Ge(ie,Ie){if(!ie)return"";if(ie.isEmpty)return Ie==="json"?{}:"";if(r.mode===Me.PLAIN_TEXT)return ie.getText({blockSeparator:`
|
|
345
|
+
`).split(/\r?\n/),i=[];for(const a of r){const l=a.trim();if(l==="")i.push("<p></p>");else if(/^<br\s*\/?>/i.test(l)){const u=l.replace(/^<br\s*\/?>/i,"").trim();i.push(`<p>${u}</p>`)}else if(/^<\/BR>/i.test(l)){const u=l.replace(/^<\/BR>/i,"").trim();i.push(`<p>${u}</p>`)}else/^<(?!p\b)[^>]+>/i.test(l)?i.push(`<p>${l}</p>`):i.push(l)}let s=i.join("");return s=s.replace(/<p\b[^>]*>/gi,"<p>"),s},Uv=t=>/^https?:\/\/[^\s]+$/i.test(t.trim()),Wv=(t,e)=>{const{tr:n,selection:r,schema:i}=t.state,s=i.marks.link.create({href:e});return r.empty?(t.dispatch(n.insertText(e,r.from).addMark(r.from,r.from+e.length,s)),!0):(t.dispatch(n.addMark(r.from,r.to,s)),!0)},Nee=(t,e)=>{const{tr:n,schema:r}=t.state,i=e.split(/(?:\r\n?|\n)/),s=[];if(i.forEach(u=>{let c={type:"paragraph"};u.length>0&&(c.content=[{type:"text",text:u}]);let f=Dr.fromJSON(r,c);s.push(f)}),s.length===0)return!1;const a=ge.fromArray(s),l=Te.maxOpen(a);return t.dispatch(n.replaceSelection(l)),!0},ete=xn(),Dh=t=>{const e=o.computed(()=>ete.state.spellCheck);o.watch(()=>e.value,n=>{t.view.dispatch(t.state.tr.setMeta(qn.IS_ACTIVE_SPELLCHECK,n)),t.extensionStorage.spellchecker.spellchecker.hideSuggestionBox(),WC(t)&&t.commands.focus()},{immediate:!0})},tte={id:"editor-container-comment",class:"flex flex-col"},nte={class:"flex flex-1"},rte={id:"editor-panel",class:"flex-1 p-2.5 border border-ed-gray-400 rounded-[3px] focus-within:border-ed-input-focus"},ote=o.defineComponent({__name:"EditorComment",props:{isMobile:{type:Boolean},superTextArea:{default:{view:!0,button:!0}},mode:{},modelValue:{default:""},comment:{},commentCuesheet:{},hideComment:{type:Boolean},disableSuperInput:{type:Boolean,default:!1},fontSizeDefault:{},fontFamilyDefault:{},fontWeightDefault:{},contentTextStyle:{},isOpenSuperView:{type:Boolean,default:!0},output:{default:"html"},dark:{type:Boolean,default:void 0},disabled:{type:Boolean,default:!1},hideToolbar:{type:Boolean,default:!1},isShowFormatControlBar:{type:Boolean},customClassFormatControlBar:{},titleBarComment:{},titleBarContent:{},fieldNameComment:{},fieldNameCommentCuesheet:{},fieldNameContent:{},fieldNameSuper:{},isScreenSplit:{},isShowLineNumber:{type:Boolean},hideMenubar:{type:Boolean},disableBubble:{type:Boolean,default:!1},hideBubble:{type:Boolean,default:!1},maxWidth:{default:void 0},minHeight:{default:600},maxHeight:{default:void 0},height:{},extensions:{default:()=>[]},editorClass:{default:void 0},contentClass:{default:void 0},isCompare:{type:Boolean},autoHeight:{type:Boolean},textAlert:{},customClassToolbar:{},readonly:{type:Boolean,default:!1},canEditSuperReadOnly:{type:Boolean},autoFocus:{type:Boolean},superPreviewCustomClass:{default:void 0},minChar:{},isAccordion:{type:Boolean},contentAutoCopied:{},isEditorView:{type:Boolean},isEditorViewSplitContent:{type:Boolean},editorContentInstance:{},toolbarExtensionOrder:{},watermarkOverlay:{},bottomOffset:{},characterCountLimit:{}},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=Ne.useEventBus(fr.RENDER_SUPER_TEXT),a=o.useAttrs(),l=xn(),{isReady:u,editor:c,updateEditorState:f,superTextStore:p,checkSpellStore:m,setEditorContextMenuRef:g,setEditorFocusedInstance:b}=l,v=o.inject("isEditable",o.ref(!0)),y=new Lo({enablePasteRules:!1,enableInputRules:!1,content:bn(r.modelValue,r.disabled),editorProps:{attributes:{id:lr.COMMENT,[lr.DISABLE_SUPER_INPUT]:`${r.disableSuperInput}`},handleKeyDown:kt.throttle((T,A)=>A.key==="Enter"&&a.enter&&!A.shiftKey?(i("enter"),!0):!1,Vo),transformPastedHTML:T=>nS(T),handlePaste:(T,A)=>{const D=A.clipboardData;if(!D)return!1;const O=r.mode,M=D.getData("text/plain")||"",$=Array.from(D.items).some(V=>V.type.startsWith("image/"));return(O===Me.STRAIGHT||O===Me.REPORT)&&$?(A.preventDefault(),!0):O===Me.PLAIN_TEXT?(A.preventDefault(),T.dispatch(T.state.tr.insertText(M,T.state.selection.from)),!0):!1},clipboardTextParser:(T,A)=>{const D=T.split(/(?:\r\n?|\n)/),O=[];D.forEach($=>{let V={type:"paragraph"};$.length>0&&(V.content=[{type:"text",text:$}]);let G=Dr.fromJSON(A.doc.type.schema,V);O.push(G)});const M=ge.fromArray(O);return Te.maxOpen(M)}},onCreate:({editor:T})=>{f(T)},onUpdate:kt.throttle(({editor:T})=>{u.value=!0;const A=E(T,r.output);i("update:modelValue",A),i("change",{editor:T,output:A}),f(T),x()},Vo),extensions:r.extensions,editable:v.value,onFocus:T=>{g(k.value),b(T.editor)}});async function x(){await o.nextTick(),s.emit({action:"render"})}function E(T,A){if(!T)return"";if(T.isEmpty)return A==="json"?{}:"";switch(A){case"html":return T.getHTML();case"json":return T.getJSON();case"text":return T.getText();default:return""}}o.watch(()=>r.disableSuperInput,()=>{const T=document.getElementById(lr.COMMENT);T==null||T.setAttribute(lr.DISABLE_SUPER_INPUT,`${r.disableSuperInput}`)}),o.watch(()=>m.languages,()=>{y.commands.checkSpelling()}),o.watch(()=>r.modelValue,T=>{if(!y||kt.isEqual(E(y,r.output),T))return;const{from:A,to:D}=y.state.selection;y.commands.setTextSelection({from:A,to:D}),y.commands.setContent(bn(T,r.disabled),!1),x()},{deep:!0}),o.watch(()=>v.value,T=>{var A;y==null||y.setEditable(T),(A=y==null?void 0:y.commands)!=null&&A.setIsEnableSuggestion&&y.commands.setIsEnableSuggestion(T)},{immediate:!0}),o.watch(()=>c.value,()=>{c.value&&c.value.on("selectionUpdate",({editor:T})=>{i("changed:selection",{editor:T})})}),o.onUnmounted(()=>y==null?void 0:y.destroy()),wc(ju.SAVE,()=>{localStorage.setItem("comment",E(y,"html"))});const k=o.ref(null);function C(T){T===Me.REPORT&&g(k.value)}function _(T){T===Me.REPORT&&b(y)}return o.onMounted(()=>{C(r.mode),_(r.mode)}),o.watch(()=>r.mode,T=>{C(T),_(T)}),o.watch(()=>{var T,A;return(A=(T=r.editorContentInstance)==null?void 0:T.storage[ep])==null?void 0:A.enabled},()=>{y.commands.toggleTimeHighlight()}),Dh(y),e({editor:y}),(T,A)=>(o.openBlock(),o.createElementBlock("div",tte,[o.createElementVNode("div",nte,[o.withDirectives(o.createVNode(Qee,{"disable-super-input":T.disableSuperInput,editor:o.unref(y),"super-preview-custom-class":T.superPreviewCustomClass},null,8,["disable-super-input","editor","super-preview-custom-class"]),[[o.vShow,T.isOpenSuperView]]),o.createElementVNode("div",rte,[o.createVNode(kv,{ref_key:"selectContextMenuRef",ref:k,"disable-super-input":T.disableSuperInput,editor:o.unref(y),mode:T.mode,"super-text-store":o.unref(p)},{default:o.withCtx(()=>[o.createVNode(o.unref(Qn),{editor:o.unref(y),spellcheck:"true",class:"h-full break-all"},null,8,["editor"])]),_:1},8,["disable-super-input","editor","mode","super-text-store"])])])]))}});function ite(t,e,n=!1,r=200){const{height:i}=Ne.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===Me.REPORT?(s.value=f/3,a.value=n?"auto":f-s.value,l.value=r/3*2,u.value=r/3):(s.value=0,a.value=n?"auto":i.value)};return n||o.watch(()=>i.value,c),o.onMounted(()=>{c()}),{commentHeight:s,contentHeight:a,minHeight:l,minHeightComment:u}}var ste={exports:{}};(function(t){(function(){var e=["ㄱ","ㄲ","ㄴ","ㄷ","ㄸ","ㄹ","ㅁ","ㅂ","ㅃ","ㅅ","ㅆ","ㅇ","ㅈ","ㅉ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"],n=["ㅏ","ㅐ","ㅑ","ㅒ","ㅓ","ㅔ","ㅕ","ㅖ","ㅗ",["ㅗ","ㅏ"],["ㅗ","ㅐ"],["ㅗ","ㅣ"],"ㅛ","ㅜ",["ㅜ","ㅓ"],["ㅜ","ㅔ"],["ㅜ","ㅣ"],"ㅠ","ㅡ",["ㅡ","ㅣ"],"ㅣ"],r=["","ㄱ","ㄲ",["ㄱ","ㅅ"],"ㄴ",["ㄴ","ㅈ"],["ㄴ","ㅎ"],"ㄷ","ㄹ",["ㄹ","ㄱ"],["ㄹ","ㅁ"],["ㄹ","ㅂ"],["ㄹ","ㅅ"],["ㄹ","ㅌ"],["ㄹ","ㅍ"],["ㄹ","ㅎ"],"ㅁ","ㅂ",["ㅂ","ㅅ"],"ㅅ","ㅆ","ㅇ","ㅈ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"],i=44032,s=["ㄱ","ㄲ","ㄳ","ㄴ","ㄵ","ㄶ","ㄷ","ㄸ","ㄹ","ㄺ","ㄻ","ㄼ","ㄽ","ㄾ","ㄿ","ㅀ","ㅁ","ㅂ","ㅃ","ㅄ","ㅅ","ㅆ","ㅇ","ㅈ","ㅉ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"],a=["ㄱ","ㄲ","ㄴ","ㄷ","ㄸ","ㄹ","ㅁ","ㅂ","ㅃ","ㅅ","ㅆ","ㅇ","ㅈ","ㅉ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"],l=["ㅏ","ㅐ","ㅑ","ㅒ","ㅓ","ㅔ","ㅕ","ㅖ","ㅗ","ㅘ","ㅙ","ㅚ","ㅛ","ㅜ","ㅝ","ㅞ","ㅟ","ㅠ","ㅡ","ㅢ","ㅣ"],u=["","ㄱ","ㄲ","ㄳ","ㄴ","ㄵ","ㄶ","ㄷ","ㄹ","ㄺ","ㄻ","ㄼ","ㄽ","ㄾ","ㄿ","ㅀ","ㅁ","ㅂ","ㅄ","ㅅ","ㅆ","ㅇ","ㅈ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"],c=[["ㄱ","ㅅ","ㄳ"],["ㄴ","ㅈ","ㄵ"],["ㄴ","ㅎ","ㄶ"],["ㄹ","ㄱ","ㄺ"],["ㄹ","ㅁ","ㄻ"],["ㄹ","ㅂ","ㄼ"],["ㄹ","ㅅ","ㄽ"],["ㄹ","ㅌ","ㄾ"],["ㄹ","ㅍ","ㄿ"],["ㄹ","ㅎ","ㅀ"],["ㅂ","ㅅ","ㅄ"]],f=[["ㅗ","ㅏ","ㅘ"],["ㅗ","ㅐ","ㅙ"],["ㅗ","ㅣ","ㅚ"],["ㅜ","ㅓ","ㅝ"],["ㅜ","ㅔ","ㅞ"],["ㅜ","ㅣ","ㅟ"],["ㅡ","ㅣ","ㅢ"]],p,m,g,b,v,y;function x(L){for(var q=L.length,X={0:0},le=0;le<q;le++)L[le]&&(X[L[le].charCodeAt(0)]=le);return X}p=x(s),m=x(a),g=x(l),b=x(u);function E(L){for(var q=L.length,X={},le,pe,_e=0;_e<q;_e++)le=L[_e][0].charCodeAt(0),pe=L[_e][1].charCodeAt(0),typeof X[le]>"u"&&(X[le]={}),X[le][pe]=L[_e][2].charCodeAt(0);return X}v=E(c),y=E(f);function k(L){return typeof p[L]<"u"}function C(L){return typeof m[L]<"u"}function _(L){return typeof g[L]<"u"}function T(L){return typeof b[L]<"u"}function A(L){return 44032<=L&&L<=55203}function D(L,q){return y[L]&&y[L][q]?y[L][q]:!1}function O(L,q){return v[L]&&v[L][q]?v[L][q]:!1}var M=function(L,q){if(L===null)throw new Error("Arguments cannot be null");typeof L=="object"&&(L=L.join(""));for(var X=[],le=L.length,pe,_e,re,be,Y,te=0;te<le;te++){var ne=[];be=L.charCodeAt(te),A(be)?(be-=i,re=be%28,_e=(be-re)/28%21,pe=parseInt((be-re)/28/21),ne.push(e[pe]),typeof n[_e]=="object"?ne=ne.concat(n[_e]):ne.push(n[_e]),re>0&&(typeof r[re]=="object"?ne=ne.concat(r[re]):ne.push(r[re]))):k(be)?(C(be)?Y=e[m[be]]:Y=r[b[be]],typeof Y=="string"?ne.push(Y):ne=ne.concat(Y)):_(be)?(Y=n[g[be]],typeof Y=="string"?ne.push(Y):ne=ne.concat(Y)):ne.push(L.charAt(te)),q?X.push(ne):X=X.concat(ne)}return X},$=function(L){return typeof L!="string"?"":(L=M(L),L.join(""))},V=function(L){typeof L=="string"&&(L=M(L));var q=[],X=L.length,le,pe=0,_e=-1,re,be=!1;function Y(ne){var oe,ce,Ae,Be=0,We,Ge="";if(be=!1,!(_e+1>ne))for(var Ke=1;;Ke++){if(Ke===1){if(oe=L[_e+Ke].charCodeAt(0),_(oe))if(_e+Ke+1<=ne&&_(ce=L[_e+Ke+1].charCodeAt(0))){q.push(String.fromCharCode(D(oe,ce))),_e=ne;return}else{q.push(L[_e+Ke]),_e=ne;return}else if(!C(oe)){q.push(L[_e+Ke]),_e=ne;return}Ge=L[_e+Ke]}else if(Ke===2)if(ce=L[_e+Ke].charCodeAt(0),C(ce)){oe=O(oe,ce),Ge=String.fromCharCode(oe),q.push(Ge),_e=ne;return}else Ge=String.fromCharCode((m[oe]*21+g[ce])*28+i);else Ke===3?(Ae=L[_e+Ke].charCodeAt(0),D(ce,Ae)?ce=D(ce,Ae):Be=Ae,Ge=String.fromCharCode((m[oe]*21+g[ce])*28+b[Be]+i)):Ke===4?(We=L[_e+Ke].charCodeAt(0),O(Be,We)?Be=O(Be,We):Be=We,Ge=String.fromCharCode((m[oe]*21+g[ce])*28+b[Be]+i)):Ke===5&&(We=L[_e+Ke].charCodeAt(0),Be=O(Be,We),Ge=String.fromCharCode((m[oe]*21+g[ce])*28+b[Be]+i));if(_e+Ke>=ne){q.push(Ge),_e=ne;return}}}for(var te=0;te<X;te++){if(le=L[te].charCodeAt(0),!C(le)&&!_(le)&&!T(le)){Y(te-1),Y(te),pe=0;continue}pe===0?C(le)?pe=1:_(le)&&(pe=4):pe==1?_(le)?pe=2:O(re,le)?pe=5:Y(te-1):pe==2?T(le)?pe=3:_(le)?D(re,le)||(Y(te-1),pe=4):(Y(te-1),pe=1):pe==3?T(le)?!be&&O(re,le)?be=!0:(Y(te-1),pe=1):C(le)?(Y(te-1),pe=1):_(le)&&(Y(te-2),pe=2):pe==4?_(le)?D(re,le)?(Y(te),pe=0):Y(te-1):(Y(te-1),pe=1):pe==5&&(_(le)?(Y(te-2),pe=2):(Y(te-1),pe=1)),re=le}return Y(te-1),q.join("")},G=function(L,q){var X=M(L).join(""),le=M(q).join("");return X.indexOf(le)},ee=function(L,q){var X=M(L).join(""),le=M(q).join(""),pe=M(L,!0),_e=new RegExp(le,"gi"),re=[],be;if(!q.length)return[];for(;be=_e.exec(X);)re.push(be.index);function Y(ne){for(var oe=0,ce=0;oe<pe.length;++oe)if(ce+=pe[oe].length,ne<ce)return oe}function te(ne){for(var oe=0,ce=0;oe<pe.length;++oe)if(ce+=pe[oe].length,ne+le.length<=ce)return oe}return re.map(function(ne){return[Y(ne),te(ne)]})};function W(L){this.string=L,this.disassembled=M(L).join("")}W.prototype.search=function(L){return M(L).join("").indexOf(this.disassembled)};var F=function(L){typeof L=="object"&&(L=L.join(""));var q=L.charCodeAt(L.length-1);if(A(q)){q-=i;var X=q%28;if(X>0)return!0}else if(k(q))return!0;return!1},R=function(L,q){return M(L).pop()===q},H={disassemble:M,d:M,disassembleToString:$,ds:$,assemble:V,a:V,search:G,rangeSearch:ee,Searcher:W,endsWithConsonant:F,endsWith:R,isHangul:function(L){return typeof L=="string"&&(L=L.charCodeAt(0)),A(L)},isComplete:function(L){return typeof L=="string"&&(L=L.charCodeAt(0)),A(L)},isConsonant:function(L){return typeof L=="string"&&(L=L.charCodeAt(0)),k(L)},isVowel:function(L){return typeof L=="string"&&(L=L.charCodeAt(0)),_(L)},isCho:function(L){return typeof L=="string"&&(L=L.charCodeAt(0)),C(L)},isJong:function(L){return typeof L=="string"&&(L=L.charCodeAt(0)),T(L)},isHangulAll:function(L){if(typeof L!="string")return!1;for(var q=0;q<L.length;q++)if(!A(L.charCodeAt(q)))return!1;return!0},isCompleteAll:function(L){if(typeof L!="string")return!1;for(var q=0;q<L.length;q++)if(!A(L.charCodeAt(q)))return!1;return!0},isConsonantAll:function(L){if(typeof L!="string")return!1;for(var q=0;q<L.length;q++)if(!k(L.charCodeAt(q)))return!1;return!0},isVowelAll:function(L){if(typeof L!="string")return!1;for(var q=0;q<L.length;q++)if(!_(L.charCodeAt(q)))return!1;return!0},isChoAll:function(L){if(typeof L!="string")return!1;for(var q=0;q<L.length;q++)if(!C(L.charCodeAt(q)))return!1;return!0},isJongAll:function(L){if(typeof L!="string")return!1;for(var q=0;q<L.length;q++)if(!T(L.charCodeAt(q)))return!1;return!0}};t.exports=H})()})(ste);const Yl=new Et("searchHighlight");function Ph(t,e,n){const r=[];if(!e)return r;const i=n.caseSensitive?e.normalize("NFC"):e.normalize("NFC").toLowerCase(),{doc:s}=t.state,a=l=>/[0-9A-Za-z가-힣_]/.test(l);return s.descendants((l,u)=>{if(!l.isText||!l.text)return;let c=l.text.normalize("NFC");n.caseSensitive||(c=c.toLowerCase());let f=0,p=c.indexOf(i,f);for(;p!==-1;){const m=p,g=p+i.length-1;if(n.wholeWord){const b=m>0?c[m-1]:"",v=g+1<c.length?c[g+1]:"";if(b&&a(b)||v&&a(v)){f=p+1,p=c.indexOf(i,f);continue}}r.push({from:u+m,to:u+g+1}),f=p+i.length,p=c.indexOf(i,f)}}),r}function jv(t){return t.state.selection.from}function rS(t){if(t.state.plugins.find(r=>r.spec.key===Yl))return;const n=new nt({key:Yl,state:{init(){return ut.empty},apply(r,i){const s=r.getMeta(Yl);return s!==void 0?s:i.map(r.mapping,r.doc)}},props:{decorations(r){return Yl.getState(r)}}});t.registerPlugin(n)}function oS(t,e,n){rS(t);const r=e.map((a,l)=>qt.inline(a.from,a.to,{class:l===n?"search-match-active":"search-match"})),i=ut.create(t.state.doc,r),s=t.state.tr.setMeta(Yl,i);t.view.dispatch(s)}function Jl(t){rS(t);const e=t.state.tr.setMeta(Yl,ut.empty);t.view.dispatch(e)}function ate(t){const e=o.ref(-1),n=o.ref([]),r=o.computed(()=>n.value.length);function i(p){var x;const m=t.value;if(!m||n.value.length===0)return;const g=n.value.length;e.value=(p%g+g)%g,oS(m,n.value,e.value);const b=n.value[e.value],y=m.view.domAtPos(b.from).node;(x=y==null?void 0:y.scrollIntoView)==null||x.call(y,{block:"nearest",behavior:"smooth"}),m.chain().setTextSelection({from:b.from,to:b.to}).scrollIntoView().run()}function s(p){const m=t.value;if(!m)return;if(n.value=Ph(m,p.find,p),n.value.length===0){e.value=-1,Jl(m);return}const g=jv(m),b=n.value.findIndex(v=>v.from>g);i(b===-1?0:b)}function a(p){const m=t.value;if(!m)return;if(n.value=Ph(m,p.find,p),n.value.length===0){e.value=-1,Jl(m);return}const g=jv(m);let b=-1;for(let v=n.value.length-1;v>=0;v--)if(n.value[v].to<g){b=v;break}i(b===-1?n.value.length-1:b)}function l(p){const m=t.value;if(!m||e.value===-1||n.value.length===0)return;const g=n.value[e.value],{state:b}=m,v=b.doc.textBetween(g.from,g.to);if(!(p.caseSensitive?v===p.find:v.toLowerCase()===p.find.toLowerCase())){s(p);return}m.chain().focus().setTextSelection({from:g.from,to:g.to}).insertContent(p.replace).run(),s(p)}function u(p){const m=t.value;if(!m)return;const g=Ph(m,p.find,p);if(g.length===0)return;const b=m.chain().focus();[...g].reverse().forEach(v=>{b.setTextSelection({from:v.from,to:v.to}).insertContent(p.replace)}),b.run(),n.value=[],e.value=-1,Jl(m)}function c(p){const m=t.value;if(!m)return;if(!p.find){n.value=[],e.value=-1,Jl(m);return}if(n.value=Ph(m,p.find,p),n.value.length===0){e.value=-1,Jl(m);return}const g=jv(m),b=n.value.findIndex(y=>y.from>=g),v=b===-1?0:b;e.value=v,i(v),oS(m,n.value,v)}function f(){const p=t.value;p&&(n.value=[],e.value=-1,Jl(p))}return{searchUp:a,searchDown:s,replaceCurrent:l,replaceAll:u,totalMatches:r,currentMatchIndex:o.readonly(e),refreshMatches:c,clearSearch:f}}const iS=o.defineComponent({__name:"Checkbox",props:{defaultChecked:{type:Boolean},checked:{type:[Boolean,String]},disabled:{type:Boolean},required:{type:Boolean},name:{},value:{},id:{},asChild:{type:Boolean},as:{},class:{}},emits:["update:checked"],setup(t,{emit:e}){const n=t,r=e,i=o.computed(()=>{const{class:a,...l}=n;return l}),s=Dt(i,r);return(a,l)=>(o.openBlock(),o.createBlock(o.unref(LD),o.mergeProps(o.unref(s),{class:o.unref(Se)("peer h-5 w-5 shrink-0 rounded-sm border border-ed-border shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ed-ring disabled:cursor-not-allowed disabled:opacity-50 text-ed-blue",n.class)}),{default:o.withCtx(()=>[o.createVNode(o.unref(DD),{class:"flex h-full w-full items-center justify-center"},{default:o.withCtx(()=>[o.renderSlot(a.$slots,"default",{},()=>[o.createVNode(o.unref(Gg),{icon:"fa-solid:check"})])]),_:3})]),_:3},16,["class"]))}}),lte={class:"flex items-center justify-between px-5 pt-4 pb-2 cursor-move bg-[#F6FAFE]"},ute={class:"text-base font-semibold text-gray-800"},cte={class:"px-5 pt-[20px] pb-4 flex flex-col gap-y-3 bg-white"},dte={class:"grid grid-cols-[60px,1fr] gap-x-3 items-center"},fte={class:"text-right text-sm text-gray-600"},pte={class:"relative"},hte={key:0,class:"absolute right-3 top-1/2 -translate-y-1/2 text-xs text-gray-400 pointer-events-none"},mte={class:"grid grid-cols-[60px,1fr] gap-x-3 items-center"},gte={class:"text-right text-sm text-gray-600"},bte={class:"grid grid-cols-[60px,1fr] gap-x-3"},vte={class:"flex gap-x-5"},yte={class:"flex items-center space-x-2 text-sm"},wte={for:"caseSensitive",class:"select-none text-gray-700"},xte={class:"grid grid-cols-[60px,1fr] gap-x-3"},Cte={class:"flex gap-x-2"},Ete=uo(o.defineComponent({__name:"BatchReplaceDialog",props:{modelValue:{type:Boolean},totalMatches:{default:0},currentMatchIndex:{default:-1}},emits:["update:modelValue","search-down","search-up","replace","replace-all","refresh"],setup(t,{emit:e}){const n=t,r=e;function i(){return{find:s.value,replace:a.value,caseSensitive:u.value,wholeWord:c.value}}const s=o.ref(""),a=o.ref(""),l=o.ref(null),u=o.ref(!1),c=o.ref(!1),f=o.computed(()=>s.value?n.totalMatches===0?"No matches":`${n.currentMatchIndex+1} / ${n.totalMatches}`:""),p=Ne.useLocalStorage("findReplaceDialogPosition",null),m=o.reactive({x:0,y:0}),g=o.ref(!1),b={x:0,y:0},v=O=>{const M=O.target;if(M.closest("input")||M.closest("button")||M.closest("label")||M.closest(".content-area"))return;g.value=!0;const $=document.querySelector(".find-replace-dialog");if(!$)return;const V=$.getBoundingClientRect();b.x=O.clientX-V.left,b.y=O.clientY-V.top,document.addEventListener("mousemove",y),document.addEventListener("mouseup",x)},y=O=>{g.value&&(m.x=O.clientX-b.x,m.y=O.clientY-b.y)},x=()=>{g.value=!1,p.value={x:m.x,y:m.y},document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",x)};o.onUnmounted(()=>{document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",x)}),o.watch(()=>n.modelValue,async O=>{var G,ee;if(!O)return;await o.nextTick();const M=document.querySelector(".find-replace-dialog");if(!M)return;const $=window.innerWidth,V=window.innerHeight;p.value&&p.value.x!==void 0&&p.value.y!==void 0?(m.x=p.value.x,m.y=p.value.y):(m.x=Math.max(($-M.offsetWidth)/2,0),m.y=Math.max((V-M.offsetHeight)/2,0)),s.value&&r("refresh",i()),await o.nextTick(),(ee=(G=l.value)==null?void 0:G.$el)==null||ee.focus()});const E=()=>{r("update:modelValue",!1)},k=()=>{s.value&&r("search-down",i())},C=()=>{s.value&&r("search-up",i())},_=()=>{r("replace",{find:s.value,replace:a.value,caseSensitive:u.value,wholeWord:c.value})},T=()=>{r("replace-all",{find:s.value,replace:a.value,caseSensitive:u.value,wholeWord:c.value})};function A(O){const M=O.target.value;s.value=M,r("refresh",i())}function D(O){const $=O.target.value+(O.data??"");r("refresh",{find:$,replace:a.value,caseSensitive:u.value,wholeWord:c.value})}return(O,M)=>{const $=hs,V=iS,G=vn,ee=Vc,W=Pc;return o.openBlock(),o.createBlock(W,{open:O.modelValue},{default:o.withCtx(()=>[o.createVNode(ee,{"is-overlay-transparent":"",class:"p-0 gap-0 !animate-none !transition-none max-w-max","as-child":""},{default:o.withCtx(()=>[o.createElementVNode("div",{class:"find-replace-dialog fixed z-[70] pointer-events-auto w-[460px] rounded-[10px] overflow-hidden bg-white shadow-xl",style:o.normalizeStyle({top:"0px",left:"0px",transform:`translate(${m.x}px, ${m.y}px)`}),onMousedown:v},[o.createElementVNode("div",lte,[o.createElementVNode("span",ute,o.toDisplayString(O.$t("찾기 및 바꾸기")),1),o.createElementVNode("button",{class:"bg-transparent text-gray-400 hover:text-gray-600 transition-colors p-1",onClick:E},[o.createVNode(o.unref(kc),{class:"w-5 h-5"})])]),o.createElementVNode("div",cte,[o.createElementVNode("div",dte,[o.createElementVNode("label",fte,o.toDisplayString(O.$t("검색")),1),o.createElementVNode("div",pte,[o.createVNode($,{ref_key:"findInputRef",ref:l,modelValue:s.value,"onUpdate:modelValue":M[0]||(M[0]=F=>s.value=F),class:"rounded-md h-[36px] text-sm pr-[90px] !border-gray-300 focus:!border-blue-500 focus:!ring-0 outline-none",onInput:A,onCompositionupdate:D,onKeydown:o.withKeys(o.withModifiers(k,["prevent"]),["enter"])},null,8,["modelValue","onKeydown"]),o.unref(f)?(o.openBlock(),o.createElementBlock("span",hte,o.toDisplayString(o.unref(f)),1)):o.createCommentVNode("",!0)])]),o.createElementVNode("div",mte,[o.createElementVNode("label",gte,o.toDisplayString(O.$t("바꾸기")),1),o.createVNode($,{modelValue:a.value,"onUpdate:modelValue":M[1]||(M[1]=F=>a.value=F),class:"rounded-md h-[36px] text-sm !border-gray-300 focus:!border-blue-500 focus:!ring-0 outline-none"},null,8,["modelValue"])]),o.createElementVNode("div",bte,[M[3]||(M[3]=o.createElementVNode("div",null,null,-1)),o.createElementVNode("div",vte,[o.createElementVNode("div",yte,[o.createVNode(V,{id:"caseSensitive",checked:u.value,"onUpdate:checked":M[2]||(M[2]=F=>{u.value=!!F})},null,8,["checked"]),o.createElementVNode("label",wte,o.toDisplayString(O.$t("대소문자 일치")),1)])])]),o.createElementVNode("div",xte,[M[4]||(M[4]=o.createElementVNode("div",null,null,-1)),o.createElementVNode("div",Cte,[o.createVNode(G,{variant:"outline",class:"h-[36px] text-sm flex-1 rounded-md border-blue-500 text-blue-600 hover:bg-blue-50",onClick:_},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(O.$t("바꾸기")),1)]),_:1}),o.createVNode(G,{variant:"outline",class:"h-[36px] text-sm flex-1 rounded-md border-blue-500 text-blue-600 hover:bg-blue-50",onClick:T},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(O.$t("모두 바꾸기")),1)]),_:1}),o.createVNode(G,{class:"h-[36px] text-sm flex-1 rounded-md bg-blue-500 hover:bg-blue-600",disabled:!s.value,onClick:C},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(O.$t("이전")),1)]),_:1},8,["disabled"]),o.createVNode(G,{class:"h-[36px] text-sm flex-1 rounded-md bg-blue-500 hover:bg-blue-600",disabled:!s.value,onClick:k},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(O.$t("다음")),1)]),_:1},8,["disabled"])])])])],36)]),_:1})]),_:1},8,["open"])}}}),[["__scopeId","data-v-5ec84714"]]),kte={class:"flex flex-1"},Vh=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:"NanumGothicCoding"},fontWeightDefault:{default:void 0},contentTextStyle:{},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},editorContentInstance:{},toolbarExtensionOrder:{default:void 0},watermarkOverlay:{},bottomOffset:{},characterCountLimit:{}},emits:["enter","change","update:modelValue","update:comment","onFocusEditor","changed:selection","setEditorSelected","onBlurEditor","lineFocus","onFocus","onBlur","open-batch-replace"],setup(t,{expose:e,emit:n}){const r=t,i=n,s=Ne.useEventBus(fr.RENDER_SUPER_TEXT),a=Ne.useEventBus(fr.INCREASE_DECREASE_FONTSIZE),l=o.useAttrs(),u=xn(),{isFullscreen:c,isReady:f,editor:p,updateEditorState:m,superTextStore:g,checkSpellStore:b,setEditorContextMenuRef:v,setEditorContentInstance:y,setEditorFocusedInstance:x}=u,E=o.computed(()=>!(r.disabled||r.readonly));o.provide("isEditable",E);const k=o.computed(()=>E.value?!0:r.canEditSuperReadOnly);o.provide("canEditSuper",k);const C=o.computed(()=>r.mode===Me.EDITOR),_=o.ref(r.fontSizeDefault),T=o.ref(r.fontFamilyDefault),A=o.ref(r.fontWeightDefault);o.provide("fontSize",_),o.provide("fontFamily",T),o.provide("fontWeight",A);const D=ie=>{!E.value||!((ie.ctrlKey||ie.metaKey)&&ie.key.toLowerCase()==="h")||(ie.preventDefault(),ie.stopPropagation(),ie.stopImmediatePropagation(),$.value=!0)};o.onMounted(()=>{We(),window.addEventListener("keydown",D,!0)}),o.onUnmounted(()=>{window.removeEventListener("keydown",D,!0)}),o.onActivated(()=>{window.addEventListener("keydown",D,!0)}),o.onDeactivated(()=>{window.removeEventListener("keydown",D,!0)});const O=ie=>{const Ie=parseInt(_.value||"16px"),st=ie?Ie+2:Ie-2;_.value=st+"px"};o.onBeforeMount(()=>{r.disabled||a.on(O)}),o.onBeforeUnmount(()=>{r.disabled||a.off(O)});const M=o.computed(()=>({...o.unref(c)?{height:"100%"}:{minHeight:r.minHeight?rn(r.minHeight):void 0,maxHeight:r.maxHeight?rn(r.maxHeight):void 0,height:r.height?rn(r.height):void 0},maxWidth:rn(r.maxWidth),width:r.maxWidth?"100%":void 0,margin:r.maxWidth?"0 auto":void 0})),$=o.ref(!1),{searchUp:V,searchDown:G,replaceCurrent:ee,replaceAll:W,totalMatches:F,currentMatchIndex:R,refreshMatches:H,clearSearch:L}=ate(p);o.watch($,ie=>{ie||L()});const q=ie=>{H(ie)},X=ie=>{G(ie)},le=ie=>{V(ie)},pe=ie=>{ee(ie)},_e=ie=>{W(ie)},re=new Lo({enablePasteRules:!1,enableInputRules:!1,content:bn(r.modelValue,r.disabled,r.mode),editorProps:{handleKeyDown:kt.throttle((ie,Ie)=>Ie.key==="Enter"&&l.enter&&!Ie.shiftKey?(i("enter"),!0):!1,Vo),transformPastedHTML:ie=>r.mode===Me.EDITOR?nR(ie):nS(ie),handlePaste:(ie,Ie)=>{var ot;const st=Ie.clipboardData;if(!st)return!1;const Yt=r.mode,ae=Array.from(st.items),Le=ae.some(At=>At.type.startsWith("image/")),ze=ae.some(At=>At.type.startsWith("video/"));if((Yt===Me.STRAIGHT||Yt===Me.REPORT)&&(Le||ze))return Ie.preventDefault(),!0;if(ze)return Ie.preventDefault(),Ke(["video"])&&ae.forEach(async At=>{var Ts;if(!At.type.startsWith("video/"))return;const dn=At.getAsFile();if(!dn)return;const fn=re.extensionManager.extensions.find(As=>As.name==="video"),pr=(Ts=fn==null?void 0:fn.options)==null?void 0:Ts.upload,An=pr?await pr(dn):URL.createObjectURL(dn);re.commands.focus(),re.commands.setVideo({src:An})}),!0;const at=((ot=Ie.clipboardData)==null?void 0:ot.getData("text/plain"))||"";return r.mode===Me.EDITOR&&Uv(at)?(Ie.preventDefault(),Wv(ie,at.trim())):!1},clipboardTextParser:(ie,Ie)=>{const st=ie.split(/(?:\r\n?|\n)/),Yt=[];st.forEach(Le=>{let ze={type:"paragraph"};Le.length>0&&(ze.content=[{type:"text",text:Le}]);let at=Dr.fromJSON(Ie.doc.type.schema,ze);Yt.push(at)});const ae=ge.fromArray(Yt);return Te.maxOpen(ae)}},onCreate:({editor:ie})=>{m(ie)},onUpdate:kt.throttle(({editor:ie})=>{f.value=!0;const Ie=Ge(ie,r.output);i("update:modelValue",Ie),i("change",{editor:ie,output:Ie}),m(ie),o.nextTick(()=>{We()}),oe()},Vo),extensions:kt.uniqBy(qC(r.extensions,r),"name"),editable:E.value,onFocus:ie=>{v(we.value),x(ie.editor),i("onFocus",ie)},onBlur:ie=>i("onBlur",ie),parseOptions:{preserveWhitespace:"full"}}),be=o.computed(()=>r.mode===Me.REPORT||r.mode===Me.STRAIGHT||r.mode===Me.PLAIN_TEXT),Y=o.computed(()=>{const ie={height:"auto",minHeight:r.minHeight?rn(r.minHeight):void 0,maxHeight:r.maxHeight?rn(r.maxHeight):void 0,overflowY:"auto"},Ie={fontFamily:np(re,uc)&&T.value||r.fontFamilyDefault,fontSize:np(re,Qf)&&_.value||r.fontSizeDefault,...np(re,HC)&&(A.value||r.fontWeightDefault)?{fontWeight:A.value||r.fontWeightDefault}:{}};return C.value&&!r.autoHeight?{}:C.value&&r.autoHeight?ie:!C.value&&r.autoHeight?{...ie,...Ie}:Ie});o.watch(()=>[Y.value,r.disabled],async()=>{We()}),o.provide("minCharSuperInput",r.minChar.superPreview);const{contentInner:te,measuredMinWidth:ne,measure:oe}=df({minChars:r.minChar.content,fontSize:_,editor:re}),ce=o.ref(null),Ae=o.computed(()=>{var ie;return(ie=ce.value)==null?void 0:ie.measuredMinWidthComment});o.provide("measuredMinWidthComment",Ae);const Be=o.computed(()=>C.value?0:Bt.value?Number(ne==null?void 0:ne.value)+Number(Ae==null?void 0:Ae.value)+30:Number(ne==null?void 0:ne.value));async function We(){await o.nextTick(),s.emit({action:"render"})}function Ge(ie,Ie){if(!ie)return"";if(ie.isEmpty)return Ie==="json"?{}:"";if(r.mode===Me.PLAIN_TEXT)return ie.getText({blockSeparator:`
|
|
346
346
|
`});switch(Ie){case"html":return h1(ie,{removeNodes:[sc,bi]});case"json":return ie.getJSON();case"text":return ie.getText({blockSeparator:`
|
|
347
347
|
`});default:return""}}function Ke(ie){return ie.every(Ie=>re==null?void 0:re.extensionManager.extensions.find(st=>st.name===Ie))}o.watch(()=>b.languages,()=>{re.commands.checkSpelling()}),o.watch(()=>r.modelValue,ie=>{if(!re||kt.isEqual(Ge(re,r.output),ie))return;const{from:Ie,to:st}=re.state.selection;re.commands.setTextSelection({from:Ie,to:st}),re.commands.setContent(bn(ie,r.disabled,r.mode),!1,{preserveWhitespace:"full"}),We()},{deep:!0}),o.watch(()=>E.value,ie=>{var Ie;re==null||re.setEditable(ie),(Ie=re==null?void 0:re.commands)!=null&&Ie.setIsEnableSuggestion&&re.commands.setIsEnableSuggestion(ie)},{immediate:!0}),o.watch(()=>p.value,()=>{p.value&&p.value.on("selectionUpdate",({editor:ie})=>{i("changed:selection",{editor:ie})})}),o.onUnmounted(()=>re==null?void 0:re.destroy()),wc(ju.SAVE,()=>{localStorage.setItem("content",Ge(re,"html"))});const Bt=o.computed(()=>{var Yt;if(!((Yt=re==null?void 0:re.storage)!=null&&Yt.superText))return!1;const{enable:ie}=re.storage.superText,Ie=[Me.EDITOR,Me.PLAIN_TEXT].includes(r.mode),st=r.disabled;return ie&&!Ie&&!st}),j=o.ref(null),z=o.computed(()=>r.mode),{commentHeight:he,contentHeight:Ee,minHeight:$e,minHeightComment:Q}=ite(j,z,r.autoHeight,typeof r.minHeight=="string"?parseInt(r.minHeight):r.minHeight),we=o.ref(null);function N(ie){ie===Me.STRAIGHT&&v(we.value)}function me(ie){ie!==Me.REPORT&&x(re)}o.onMounted(()=>{N(r.mode),me(r.mode),y(re)}),o.watch(()=>r.mode,ie=>{N(ie),me(ie)});const de=o.ref(null),Ce=()=>{var Ie;(Ie=de.value)!=null&&Ie.editor.commands.focusInvalidChar()||re.commands.focusInvalidChar()};u.focusFirstInvalidChar.value=Ce,o.onActivated(()=>{u.focusFirstInvalidChar.value=Ce});const qe=o.computed(()=>{var Ie,st,Yt;const ie=((Ie=r.fieldNameComment)==null?void 0:Ie.label)||((st=r.fieldNameCommentCuesheet)==null?void 0:st.label)||((Yt=r.fieldNameContent)==null?void 0:Yt.label);return r.disabled&&ie});return e({editor:re}),(ie,Ie)=>{var ot;const st=Lh,Yt=Rh,ae=Ih,Le=C8,ze=mz,at=xR;return o.unref(re)?(o.openBlock(),o.createElementBlock("div",{key:0,id:"vdc-editor",class:o.normalizeClass(["vdc-editor w-full flex flex-col",[ie.editorClass,{"outline-ed-primary":o.unref(re).isFocused,"outline-ed-border":!o.unref(re).isFocused}]]),style:o.normalizeStyle(o.unref(M))},[!ie.hideBubble&&!ie.disabled&&o.unref(E)?(o.openBlock(),o.createElementBlock(o.Fragment,{key:0},[Ke([o.unref(ac)])?(o.openBlock(),o.createBlock(st,{key:0,editor:o.unref(re)},null,8,["editor"])):o.createCommentVNode("",!0),Ke([o.unref(ma)])?(o.openBlock(),o.createBlock(Yt,{key:1,editor:o.unref(re)},null,8,["editor"])):o.createCommentVNode("",!0),Ke([o.unref(ds)])?(o.openBlock(),o.createBlock(ae,{key:2,editor:o.unref(re)},null,8,["editor"])):o.createCommentVNode("",!0),Ke([o.unref(Il),o.unref(bi)])?(o.openBlock(),o.createBlock(Le,{key:3,editor:o.unref(re)},null,8,["editor"])):o.createCommentVNode("",!0)],64)):o.createCommentVNode("",!0),ie.hideToolbar?o.createCommentVNode("",!0):(o.openBlock(),o.createBlock(ze,{key:1,editor:o.unref(re),"editor-comment":(ot=o.unref(de))==null?void 0:ot.editor,mode:ie.mode,class:"mb-2","custom-class-toolbar":ie.customClassToolbar,"toolbar-extension-order":ie.toolbarExtensionOrder},null,8,["editor","editor-comment","mode","custom-class-toolbar","toolbar-extension-order"])),o.createElementVNode("div",{ref_key:"editorWrapRef",ref:j,class:o.normalizeClass(o.unref(Se)("space-y-2 flex-1 flex flex-col break-keep",o.unref(be)&&"[&_*]:!font-inherit",o.unref(be)&&"[&_*]:!text-font-size-inherit")),style:o.normalizeStyle(o.unref(Y))},[o.unref(qe)?(o.openBlock(),o.createBlock(at,{key:0,extensions:ie.extensions,mode:ie.mode,"hide-comment":ie.hideComment,"field-name-comment":ie.fieldNameComment,"field-name-comment-cuesheet":ie.fieldNameCommentCuesheet,"field-name-content":ie.fieldNameContent,comment:ie.comment,"comment-cuesheet":ie.commentCuesheet,content:ie.modelValue,"min-chars":ie.minChar.content,"font-size":o.unref(_)},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:`${o.unref(Be)}px`})},[ie.mode===o.unref(Me).REPORT&&!ie.hideComment?(o.openBlock(),o.createBlock(ote,{key:0,ref_key:"editorCommentRef",ref:de,mode:o.unref(Me).REPORT,extensions:ie.extensions,"model-value":r.comment,disabled:r.disabled,"disable-super-input":ie.disableSuperInput,"is-open-super-view":o.unref(Bt),"super-preview-custom-class":ie.superPreviewCustomClass,"min-char":ie.minChar,"font-size":o.unref(_),style:o.normalizeStyle(r.autoHeight?{height:"auto",minHeight:o.unref(rn)(o.unref(Q))}:{height:o.unref(rn)(o.unref(he)),minHeight:o.unref(rn)(o.unref($e))}),"editor-content-instance":o.unref(re),class:"relative overflow-y-auto","onUpdate:modelValue":Ie[0]||(Ie[0]=At=>i("update:comment",At))},null,8,["mode","extensions","model-value","disabled","disable-super-input","is-open-super-view","super-preview-custom-class","min-char","font-size","style","editor-content-instance"])):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(rn)(o.unref($e))}:{height:o.unref(rn)(o.unref(Ee))})},[o.createElementVNode("div",kte,[o.withDirectives(o.createVNode(Yee,{ref_key:"superTextViewRef",ref:ce,editor:o.unref(re),"super-preview-custom-class":ie.superPreviewCustomClass,"min-chars":ie.minChar.superPreview,"font-size":o.unref(_)},null,8,["editor","super-preview-custom-class","min-chars","font-size"]),[[o.vShow,o.unref(Bt)]]),o.createElementVNode("div",{id:"editor-panel",ref_key:"contentInner",ref:te,class:"flex-1 p-2.5 border border-ed-gray-400 rounded-[3px] focus-within:border-ed-input-focus"},[o.createVNode(kv,{ref_key:"selectContextMenuRef",ref:we,editor:o.unref(re),mode:ie.mode,"super-text-store":o.unref(g)},{default:o.withCtx(()=>[o.createVNode(o.unref(Qn),{editor:o.unref(re),spellcheck:"true",class:o.normalizeClass(o.unref(Se)("h-full break-all",ie.mode===o.unref(Me).PLAIN_TEXT&&"plain-text"))},null,8,["editor","class"])]),_:1},8,["editor","mode","super-text-store"])],512)])],4)],4))],6),o.createVNode(Ete,{modelValue:o.unref($),"onUpdate:modelValue":Ie[1]||(Ie[1]=At=>o.isRef($)?$.value=At:null),"total-matches":o.unref(F),"current-match-index":o.unref(R),onSearchDown:X,onSearchUp:le,onReplace:pe,onReplaceAll:_e,onRefresh:q},null,8,["modelValue","total-matches","current-match-index"])],6)):o.createCommentVNode("",!0)}}}),Ste={class:"relative px-2.5"},_te={key:0,class:"w-12 rounded-tl-full rounded-bl-full pointer-events-none absolute inset-y-0 left-0 bg-white-fade-left z-10","aria-hidden":"true"},Tte={key:1,class:"w-12 rounded-tr-full rounded-br-full pointer-events-none absolute inset-y-0 right-0 bg-white-fade-right z-10","aria-hidden":"true"},Ate=o.defineComponent({__name:"ToolbarFormat",props:{editor:{},disabled:{type:Boolean,default:!1},mode:{},activeExtensions:{default:()=>[]},threshold:{default:5}},setup(t){const{t:e}=Tt(),n=t,r=[Yf,lc,vi,Nf],i=o.computed(()=>{const m=[...n.editor.extensionManager.extensions],g=jC(m,{[zC]:0});let b=[];for(const v of g){const{button:y,divider:x=!1,spacer:E=!1,toolbar:k=!0}=v.options;if(!y||!f1(y)||!k)continue;const C=y({editor:n.editor,extension:v,t:o.unref(e),isMobile:!0});if(Array.isArray(C)){const _=C.map((T,A)=>({id:`${v.name}`,button:T,divider:A===C.length-1?x:!1,spacer:A===0?E:!1,buttonName:T.buttonName}));b=[...b,..._];continue}b.push({button:C,divider:x,spacer:E,id:`${v.name}`})}return n.activeExtensions.length?b.filter(v=>v.id&&n.activeExtensions.includes(v.id)):(r.length&&(b=b.filter(v=>v.id&&!r.includes(v.id))),b=b.map(v=>{const y=["videoUpload","heading","strike","color","fontSize","fontFamily"],x=["redo"],E=b.some(_=>_.id==="imageUpload"),k=b.some(_=>_.id==="videoUpload");k||y.push("imageUpload"),!E&&!k&&y.push("link");const C=y.includes(v.id??"")||x.includes(v.buttonName??"");return{...v,separator:C}}),b)}),s=m=>m.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":m.button.componentProps.customClass,a=m=>m.id==="spellchecker"?"Spellchecker":m.button.componentProps.icon,l=o.ref(null),u=o.ref(!1),c=o.ref(!1);function f(){const m=l.value;if(!m)return;const{scrollLeft:g,scrollWidth:b,clientWidth:v}=m;if(!(b>v+1)){u.value=!1,c.value=!1;return}const x=g<=n.threshold,E=g+v>=b-n.threshold;u.value=!x,c.value=!E}const p=Ne.useThrottleFn(f,10);return Ne.useEventListener(l,"scroll",p),Ne.useResizeObserver(l,p),Ne.useEventListener(window,"resize",p),(m,g)=>(o.openBlock(),o.createElementBlock("div",{id:"tool-bar-format",class:o.normalizeClass(o.unref(Se)("bg-white border border-gray-100 dark:bg-ed-gray-500 dark:border-ed-muted rounded-full shadow-elevation2",!i.value.length&&"hidden"))},[o.createElementVNode("div",Ste,[o.unref(u)?(o.openBlock(),o.createElementBlock("div",_te)):o.createCommentVNode("",!0),o.unref(c)?(o.openBlock(),o.createElementBlock("div",Tte)):o.createCommentVNode("",!0),o.createElementVNode("div",{ref_key:"scrollEl",ref:l,id:"tool-bar-format-scroll",class:"text-ed-gray-700 flex gap-2 items-center overflow-x-auto overflow-y-hidden min-h-11 scrollbar-hide overflow-scrolling-touch relative"},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(i.value,(b,v)=>{var y;return o.openBlock(),o.createElementBlock(o.Fragment,{key:v},[(o.openBlock(),o.createBlock(o.resolveDynamicComponent(b.button.component),o.mergeProps({id:b.id,ref_for:!0},b.button.componentProps,{editor:m.editor,disabled:m.disabled||((y=b.button.componentProps)==null?void 0:y.disabled),"custom-class":s(b),icon:a(b)}),o.createSlots({_:2},[o.renderList(b.button.componentSlots,(x,E,k)=>({name:`${E}`,fn:o.withCtx(C=>[(o.openBlock(),o.createBlock(o.resolveDynamicComponent(x),o.mergeProps({ref_for:!0},C==null?void 0:C.props,{id:b.id}),null,16,["id"]))])}))]),1040,["id","editor","disabled","custom-class","icon"])),b.separator?(o.openBlock(),o.createBlock(o.unref(mo),{key:0,orientation:"vertical",class:"h-5"})):o.createCommentVNode("",!0)],64)}),128))],512)])],2))}}),Mte={class:"relative px-2.5"},Ote={key:0,class:"w-12 rounded-tl-full rounded-bl-full pointer-events-none absolute inset-y-0 left-0 bg-white-fade-left z-10","aria-hidden":"true"},Bte={key:1,class:"w-12 rounded-tr-full rounded-br-full pointer-events-none absolute inset-y-0 right-0 bg-white-fade-right z-10","aria-hidden":"true"},Ite={class:"flex items-center gap-2"},Rte={class:"mt-3"},Lte=o.defineComponent({__name:"ToolbarImage",props:{editor:{},disabled:{type:Boolean,default:!1},threshold:{default:10}},setup(t){const e=t,{t:n}=Tt(),r=o.ref("100"),i=o.ref(),s=o.ref(),a=o.ref(),l=["left","center","right"],u={left:"AlignLeft",center:"AlignCenter",right:"AlignRight"};function c(G){G==null||G.preventDefault(),e.editor.getAttributes("image").src&&(e.editor.commands.updateImage({width:i.value?`${i.value}px`:null}),cf())}function f(G){const ee=Math.max(0,Math.min(100,parseInt(r.value)));e.editor.commands.updateImage({width:`${ee}%`}),cf()}function p(G){e.editor.commands.updateAttributes("image",{textAlign:G})}o.watch(r,()=>{r.value&&f()}),o.watch(()=>e.editor.getAttributes("image"),G=>{G&&(i.value=Math.round(parseFloat(G.originWidth)),s.value=Math.round(parseFloat(G.originHeight)),a.value=G.originWidth/G.originHeight)});function m(){s.value&&a.value?i.value=Math.max(30,Math.round(s.value*a.value)):i.value=null}function g(){i.value&&a.value?s.value=Math.max(20,Math.round(i.value/a.value)):s.value=null}function b(G){p(G)}function v(){const G=e.editor.getAttributes("image"),{flipX:ee}=G;e.editor.commands.updateImage({flipX:!ee})}function y(){const G=e.editor.getAttributes("image"),{flipY:ee}=G;e.editor.commands.updateImage({flipY:!ee})}function x(){const{state:G,dispatch:ee}=e.editor.view;ol(G,ee)}function E(){const{state:G,dispatch:ee}=e.editor.view,{tr:W,selection:F}=G;if(!(F instanceof Ve))return;const R=F.from,H=G.doc.nodeAt(R);if(!H)return;const q=G.doc.resolve(R).nodeBefore;if(!q)return;const X=R-q.nodeSize,le=W.delete(R,R+H.nodeSize).insert(X,H).setSelection(Ve.create(W.doc,X));ee(le)}function k(){const{state:G,dispatch:ee}=e.editor.view,{tr:W,doc:F,selection:R}=G;if(!(R instanceof Ve))return;const H=R.from,L=F.nodeAt(H);if(!L)return;const q=H+L.nodeSize;if(q>=F.content.size)return;const X=F.nodeAt(q);if(!X)return;const le=q+X.nodeSize-L.nodeSize,pe=H+X.nodeSize,_e=W.delete(H,H+L.nodeSize).insert(le,L).setSelection(Ve.create(W.doc,pe));ee(_e)}const C=o.ref(null),_=o.ref(!1),T=o.ref(!1);function A(){const G=C.value;if(!G)return;const{scrollLeft:ee,scrollWidth:W,clientWidth:F}=G;if(!(W>F+1)){_.value=!1,T.value=!1;return}const H=ee<=e.threshold,L=ee+F>=W-e.threshold;_.value=!H,T.value=!L}const D=Ne.useThrottleFn(A,10);Ne.useEventListener(C,"scroll",D),Ne.useResizeObserver(C,D),Ne.useEventListener(window,"resize",D);const O=o.inject("isMobile",!1),M=`dropdown-trigger-${Xr(10)}`,{isOpen:$}=yp({scrollEl:"tool-bar-image-scroll",ignoreSelector:`[data-radix-popper-content-wrapper], .${M}`}),V=o.computed(()=>O?{modal:!1,open:$.value,"onUpdate:open":G=>$.value=G}:{});return(G,ee)=>{const W=Xe,F=mo,R=ga,H=cc,L=hs,q=Rl,X=op,le=rp,pe=ps,_e=fs;return o.openBlock(),o.createElementBlock("div",{id:"tool-bar-image",class:o.normalizeClass(o.unref(Se)("bg-white border border-gray-100 dark:bg-ed-gray-500 dark:border-ed-muted rounded-full shadow-elevation2"))},[o.createElementVNode("div",Mte,[_.value?(o.openBlock(),o.createElementBlock("div",Ote)):o.createCommentVNode("",!0),T.value?(o.openBlock(),o.createElementBlock("div",Bte)):o.createCommentVNode("",!0),o.createElementVNode("div",{ref_key:"scrollEl",ref:C,id:"tool-bar-image-scroll",class:"text-ed-gray-700 flex gap-1.5 items-center overflow-x-auto overflow-y-hidden min-h-11 scrollbar-hide overflow-scrolling-touch relative whitespace-nowrap"},[o.createVNode(W,{tooltip:o.unref(n)("editor.image.menu.flipX"),icon:"FlipVertical",action:v},null,8,["tooltip"]),o.createVNode(W,{tooltip:o.unref(n)("editor.image.menu.flipY"),icon:"FlipHorizontal",action:y},null,8,["tooltip"]),o.createVNode(F,{orientation:"vertical",class:"h-5"}),o.createVNode(W,{tooltip:o.unref(n)("editor.image.menu.moveUp"),icon:"MoveUp",action:E,disabled:!G.editor.isEditable},null,8,["tooltip","disabled"]),o.createVNode(W,{tooltip:o.unref(n)("editor.image.menu.moveDown"),icon:"MoveDown",action:k,disabled:!G.editor.isEditable},null,8,["tooltip","disabled"]),o.createVNode(F,{orientation:"vertical",class:"h-5"}),o.createVNode(_e,o.normalizeProps(o.guardReactiveProps(o.unref(V))),{default:o.withCtx(()=>[o.createVNode(R,{class:o.normalizeClass(M)},{default:o.withCtx(()=>[o.createVNode(W,{title:o.unref(n)("editor.image.menu.size"),icon:"ImageSize"},null,8,["title"])]),_:1}),o.createVNode(pe,{class:"w-84 inside-toolbar"},{default:o.withCtx(()=>[o.createElementVNode("div",Ite,[o.createVNode(H,{for:"maxWidth",class:"whitespace-nowrap"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(n)("editor.image.menu.size.width")),1)]),_:1}),o.createVNode(L,{id:"maxWidth",modelValue:i.value,"onUpdate:modelValue":ee[0]||(ee[0]=re=>i.value=re),type:"number",class:"w-20 h-8 [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",onInput:g,onKeyup:o.withKeys(c,["enter"])},null,8,["modelValue"]),o.createVNode(H,{for:"maxWidth",class:"whitespace-nowrap"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(n)("editor.image.menu.size.height")),1)]),_:1}),o.createVNode(L,{id:"maxWidth",modelValue:s.value,"onUpdate:modelValue":ee[1]||(ee[1]=re=>s.value=re),type:"number",class:"w-20 h-8 [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",onInput:m,onKeyup:o.withKeys(c,["enter"])},null,8,["modelValue"])]),o.createElementVNode("div",Rte,[o.createVNode(le,{"model-value":r.value,"onUpdate:modelValue":[ee[2]||(ee[2]=re=>r.value=re),ee[3]||(ee[3]=re=>{r.value=re})]},{default:o.withCtx(()=>[o.createVNode(X,null,{default:o.withCtx(()=>[(o.openBlock(),o.createElementBlock(o.Fragment,null,o.renderList(["25","50","75","100"],re=>o.createVNode(q,{key:re,value:re},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(re)+"% ",1)]),_:2},1032,["value"])),64))]),_:1})]),_:1},8,["model-value"])])]),_:1})]),_:1},16),o.createVNode(F,{orientation:"vertical",class:"h-5"}),(o.openBlock(),o.createElementBlock(o.Fragment,null,o.renderList(l,(re,be)=>o.createVNode(W,{key:be,tooltip:o.unref(n)(`editor.textalign.${re}.tooltip`),icon:u[re],action:()=>b(re),disabled:!G.editor.can().setTextAlign(re),"is-active":()=>G.editor.isActive({textAlign:re})||!1},null,8,["tooltip","icon","action","disabled","is-active"])),64)),o.createVNode(F,{orientation:"vertical",class:"h-5"}),o.createVNode(W,{tooltip:o.unref(n)("editor.remove"),icon:"Trash2",action:x,disabled:!G.editor.isEditable},null,8,["tooltip","disabled"])],512)])],2)}}}),Dte=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=Dt(i,r);return(a,l)=>(o.openBlock(),o.createBlock(o.unref(RV),o.mergeProps(o.unref(s),{class:o.unref(Se)("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(LV),{class:o.normalizeClass(o.unref(Se)("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"]))}}),Pte={class:"text-red-500 relative -top-1"},Kc=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(Se)("label-large",e.fieldName.customClass))},[o.createElementVNode("span",null,o.toDisplayString(e.fieldName.label),1),o.withDirectives(o.createElementVNode("span",Pte," •",512),[[o.vShow,e.fieldName.isRequired]])],2))}}),Fh={__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((Y,te)=>(Y[~~te.id]=te)&&Y,{})),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",y,{passive:!1}),document.addEventListener("mouseup",x),"ontouchstart"in window&&(document.addEventListener("touchmove",y,{passive:!1}),document.addEventListener("touchend",x))},b=()=>{document.removeEventListener("mousemove",y,{passive:!1}),document.removeEventListener("mouseup",x),"ontouchstart"in window&&(document.removeEventListener("touchmove",y,{passive:!1}),document.removeEventListener("touchend",x))},v=(Y,te)=>{const ne=Y.target.closest(".splitpanes__splitter");if(ne){const{left:oe,top:ce}=ne.getBoundingClientRect(),{clientX:Ae,clientY:Be}="ontouchstart"in window&&Y.touches?Y.touches[0]:Y;f.value.cursorOffset=r.horizontal?Be-ce:Ae-oe}g(),f.value.mouseDown=!0,f.value.activeSplitter=te},y=Y=>{f.value.mouseDown&&(Y.preventDefault(),f.value.dragging=!0,requestAnimationFrame(()=>{A(_(Y)),re("resize",{event:Y},!0)}))},x=Y=>{f.value.dragging&&(window.getSelection().removeAllRanges(),re("resized",{event:Y},!0)),f.value.mouseDown=!1,f.value.activeSplitter=null,setTimeout(()=>{f.value.dragging=!1,b()},100)},E=(Y,te)=>{"ontouchstart"in window&&(Y.preventDefault(),p.value.splitter===te?(clearTimeout(p.value.timeoutId),p.value.timeoutId=null,k(Y,te),p.value.splitter=null):(p.value.splitter=te,p.value.timeoutId=setTimeout(()=>p.value.splitter=null,500))),f.value.dragging||re("splitter-click",{event:Y,index:te},!0)},k=(Y,te)=>{if(re("splitter-dblclick",{event:Y,index:te},!0),r.maximizePanes){let ne=0;s.value=s.value.map((oe,ce)=>(oe.size=ce===te?oe.max:oe.min,ce!==te&&(ne+=oe.min),oe)),s.value[te].size-=ne,re("pane-maximize",{event:Y,index:te,pane:s.value[te]}),re("resized",{event:Y,index:te},!0)}},C=(Y,te)=>{re("pane-click",{event:Y,index:a.value[te].index,pane:a.value[te]})},_=Y=>{const te=u.value.getBoundingClientRect(),{clientX:ne,clientY:oe}="ontouchstart"in window&&Y.touches?Y.touches[0]:Y;return{x:ne-(r.horizontal?0:f.value.cursorOffset)-te.left,y:oe-(r.horizontal?f.value.cursorOffset:0)-te.top}},T=Y=>{Y=Y[r.horizontal?"y":"x"];const te=u.value[r.horizontal?"clientHeight":"clientWidth"];return r.rtl&&!r.horizontal&&(Y=te-Y),Y*100/te},A=Y=>{const te=f.value.activeSplitter;let ne={prevPanesSize:O(te),nextPanesSize:M(te),prevReachedMinPanes:0,nextReachedMinPanes:0};const oe=0+(r.pushOtherPanes?0:ne.prevPanesSize),ce=100-(r.pushOtherPanes?0:ne.nextPanesSize),Ae=Math.max(Math.min(T(Y),ce),oe);let Be=[te,te+1],We=s.value[Be[0]]||null,Ge=s.value[Be[1]]||null;const Ke=We.max<100&&Ae>=We.max+ne.prevPanesSize,Bt=Ge.max<100&&Ae<=100-(Ge.max+M(te+1));if(Ke||Bt){Ke?(We.size=We.max,Ge.size=Math.max(100-We.max-ne.prevPanesSize-ne.nextPanesSize,0)):(We.size=Math.max(100-Ge.max-ne.prevPanesSize-M(te+1),0),Ge.size=Ge.max);return}if(r.pushOtherPanes){const j=D(ne,Ae);if(!j)return;({sums:ne,panesToResize:Be}=j),We=s.value[Be[0]]||null,Ge=s.value[Be[1]]||null}We!==null&&(We.size=Math.min(Math.max(Ae-ne.prevPanesSize-ne.prevReachedMinPanes,We.min),We.max)),Ge!==null&&(Ge.size=Math.min(Math.max(100-Ae-ne.nextPanesSize-ne.nextReachedMinPanes,Ge.min),Ge.max))},D=(Y,te)=>{const ne=f.value.activeSplitter,oe=[ne,ne+1];return te<Y.prevPanesSize+s.value[oe[0]].min&&(oe[0]=$(ne).index,Y.prevReachedMinPanes=0,oe[0]<ne&&s.value.forEach((ce,Ae)=>{Ae>oe[0]&&Ae<=ne&&(ce.size=ce.min,Y.prevReachedMinPanes+=ce.min)}),Y.prevPanesSize=O(oe[0]),oe[0]===void 0)?(Y.prevReachedMinPanes=0,s.value[0].size=s.value[0].min,s.value.forEach((ce,Ae)=>{Ae>0&&Ae<=ne&&(ce.size=ce.min,Y.prevReachedMinPanes+=ce.min)}),s.value[oe[1]].size=100-Y.prevReachedMinPanes-s.value[0].min-Y.prevPanesSize-Y.nextPanesSize,null):te>100-Y.nextPanesSize-s.value[oe[1]].min&&(oe[1]=V(ne).index,Y.nextReachedMinPanes=0,oe[1]>ne+1&&s.value.forEach((ce,Ae)=>{Ae>ne&&Ae<oe[1]&&(ce.size=ce.min,Y.nextReachedMinPanes+=ce.min)}),Y.nextPanesSize=M(oe[1]-1),oe[1]===void 0)?(Y.nextReachedMinPanes=0,s.value.forEach((ce,Ae)=>{Ae<l.value-1&&Ae>=ne+1&&(ce.size=ce.min,Y.nextReachedMinPanes+=ce.min)}),s.value[oe[0]].size=100-Y.prevPanesSize-M(oe[0]-1),null):{sums:Y,panesToResize:oe}},O=Y=>s.value.reduce((te,ne,oe)=>te+(oe<Y?ne.size:0),0),M=Y=>s.value.reduce((te,ne,oe)=>te+(oe>Y+1?ne.size:0),0),$=Y=>[...s.value].reverse().find(te=>te.index<Y&&te.size>te.min)||{},V=Y=>s.value.find(te=>te.index>Y+1&&te.size>te.min)||{},G=()=>{var Y;const te=Array.from(((Y=u.value)==null?void 0:Y.children)||[]);for(const ne of te){const oe=ne.classList.contains("splitpanes__pane"),ce=ne.classList.contains("splitpanes__splitter");!oe&&!ce&&(ne.remove(),console.warn("Splitpanes: Only <pane> elements are allowed at the root of <splitpanes>. One of your DOM nodes was removed."))}},ee=(Y,te,ne=!1)=>{const oe=Y-1,ce=document.createElement("div");ce.classList.add("splitpanes__splitter"),ne||(ce.onmousedown=Ae=>v(Ae,oe),typeof window<"u"&&"ontouchstart"in window&&(ce.ontouchstart=Ae=>v(Ae,oe)),ce.onclick=Ae=>E(Ae,oe+1)),ce.ondblclick=Ae=>k(Ae,oe+1),te.parentNode.insertBefore(ce,te)},W=Y=>{Y.onmousedown=void 0,Y.onclick=void 0,Y.ondblclick=void 0,Y.remove()},F=()=>{var Y;const te=Array.from(((Y=u.value)==null?void 0:Y.children)||[]);for(const oe of te)oe.className.includes("splitpanes__splitter")&&W(oe);let ne=0;for(const oe of te)oe.className.includes("splitpanes__pane")&&(!ne&&r.firstSplitter?ee(ne,oe,!0):ne&&ee(ne,oe),ne++)},R=({uid:Y,...te})=>{const ne=a.value[Y];for(const[oe,ce]of Object.entries(te))ne[oe]=ce},H=Y=>{var te;let ne=-1;Array.from(((te=u.value)==null?void 0:te.children)||[]).some(oe=>(oe.className.includes("splitpanes__pane")&&ne++,oe.isSameNode(Y.el))),s.value.splice(ne,0,{...Y,index:ne}),s.value.forEach((oe,ce)=>oe.index=ce),c.value&&o.nextTick(()=>{F(),q({addedPane:s.value[ne]}),re("pane-add",{pane:s.value[ne]})})},L=Y=>{const te=s.value.findIndex(oe=>oe.id===Y);s.value[te].el=null;const ne=s.value.splice(te,1)[0];s.value.forEach((oe,ce)=>oe.index=ce),o.nextTick(()=>{F(),re("pane-remove",{pane:ne}),q({removedPane:{...ne}})})},q=(Y={})=>{!Y.addedPane&&!Y.removedPane?le():s.value.some(te=>te.givenSize!==null||te.min||te.max<100)?pe(Y):X(),c.value&&re("resized")},X=()=>{const Y=100/l.value;let te=0;const ne=[],oe=[];for(const ce of s.value)ce.size=Math.max(Math.min(Y,ce.max),ce.min),te-=ce.size,ce.size>=ce.max&&ne.push(ce.id),ce.size<=ce.min&&oe.push(ce.id);te>.1&&_e(te,ne,oe)},le=()=>{let Y=100;const te=[],ne=[];let oe=0;for(const Ae of s.value)Y-=Ae.size,Ae.givenSize!==null&&oe++,Ae.size>=Ae.max&&te.push(Ae.id),Ae.size<=Ae.min&&ne.push(Ae.id);let ce=100;if(Y>.1){for(const Ae of s.value)Ae.givenSize===null&&(Ae.size=Math.max(Math.min(Y/(l.value-oe),Ae.max),Ae.min)),ce-=Ae.size;ce>.1&&_e(ce,te,ne)}},pe=({addedPane:Y,removedPane:te}={})=>{let ne=100/l.value,oe=0;const ce=[],Ae=[];((Y==null?void 0:Y.givenSize)??null)!==null&&(ne=(100-Y.givenSize)/(l.value-1));for(const Be of s.value)oe-=Be.size,Be.size>=Be.max&&ce.push(Be.id),Be.size<=Be.min&&Ae.push(Be.id);if(!(Math.abs(oe)<.1)){for(const Be of s.value)(Y==null?void 0:Y.givenSize)!==null&&(Y==null?void 0:Y.id)===Be.id||(Be.size=Math.max(Math.min(ne,Be.max),Be.min)),oe-=Be.size,Be.size>=Be.max&&ce.push(Be.id),Be.size<=Be.min&&Ae.push(Be.id);oe>.1&&_e(oe,ce,Ae)}},_e=(Y,te,ne)=>{let oe;Y>0?oe=Y/(l.value-te.length):oe=Y/(l.value-ne.length),s.value.forEach((ce,Ae)=>{if(Y>0&&!te.includes(ce.id)){const Be=Math.max(Math.min(ce.size+oe,ce.max),ce.min),We=Be-ce.size;Y-=We,ce.size=Be}else if(!ne.includes(ce.id)){const Be=Math.max(Math.min(ce.size+oe,ce.max),ce.min),We=Be-ce.size;Y-=We,ce.size=Be}}),Math.abs(Y)>.1&&o.nextTick(()=>{c.value&&console.warn("Splitpanes: Could not resize panes correctly due to their constraints.")})},re=(Y,te=void 0,ne=!1)=>{const oe=(te==null?void 0:te.index)??f.value.activeSplitter??null;n(Y,{...te,...oe!==null&&{index:oe},...ne&&oe!==null&&{prevPane:s.value[oe-(r.firstSplitter?1:0)],nextPane:s.value[oe+(r.firstSplitter?0:1)]},panes:s.value.map(ce=>({min:ce.min,max:ce.max,size:ce.size}))})};o.watch(()=>r.firstSplitter,()=>F()),o.onMounted(()=>{G(),F(),q(),re("ready"),c.value=!0}),o.onBeforeUnmount(()=>c.value=!1);const be=()=>{var Y;return o.h("div",{ref:u,class:m.value},(Y=i.default)==null?void 0:Y.call(i))};return o.provide("panes",s),o.provide("indexedPanes",a),o.provide("horizontal",o.computed(()=>r.horizontal)),o.provide("requestUpdate",R),o.provide("onPaneAdd",H),o.provide("onPaneRemove",L),o.provide("onPaneClick",C),(Y,te)=>(o.openBlock(),o.createBlock(o.resolveDynamicComponent(be)))}},Zo={__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 y=isNaN(n.size)||n.size===void 0?0:parseFloat(n.size);return Math.max(Math.min(y,b.value),g.value)}),g=o.computed(()=>{const y=parseFloat(n.minSize);return isNaN(y)?0:y}),b=o.computed(()=>{const y=parseFloat(n.maxSize);return isNaN(y)?100:y}),v=o.computed(()=>{var y;return`${s.value?"height":"width"}: ${(y=f.value)==null?void 0:y.size}%`});return o.watch(()=>m.value,y=>r({uid:u,size:y})),o.watch(()=>g.value,y=>r({uid:u,min:y})),o.watch(()=>b.value,y=>r({uid:u,max:y})),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)),(y,x)=>(o.openBlock(),o.createElementBlock("div",{ref_key:"paneEl",ref:p,class:"splitpanes__pane",onClick:x[0]||(x[0]=E=>o.unref(l)(E,y._.uid)),style:o.normalizeStyle(v.value)},[o.renderSlot(y.$slots,"default")],4))}},Vte={class:"px-5 py-2.5"},Fte=["innerHTML"],$te={key:0,class:"px-5 py-2.5"},Hte=["innerHTML"],zte={key:1,class:"px-5 py-2.5"},Ute=["innerHTML"],Wte={key:2,class:"px-5 py-2.5"},jte=["innerHTML"],qte={class:"px-5 py-2.5"},Kte=["innerHTML"],Gte=o.defineComponent({__name:"EditorViewMobile",props:{extensions:{},mode:{},hideComment:{type:Boolean},fieldNameComment:{},fieldNameCommentCuesheet:{},fieldNameContent:{},comment:{},commentCuesheet:{},content:{},isEditorViewSplitContent:{type:Boolean},contentTextStyle:{}},setup(t){const e=t,n=o.computed(()=>{var A;const T=((A=e.extensions)==null?void 0:A.filter(D=>D.name!=="spellchecker"))||[];return T.some(D=>D.name==="image")||T.push(qu.configure()),T}),r=o.computed(()=>oa(e.comment)),i=o.computed(()=>oa(e.commentCuesheet)),s=o.computed(()=>oa(e.content));function a(T){return u1(T).replace(/<script\b[\s\S]*?<\/script\s*>/gi,"")}const l=o.computed(()=>r.value?a(e.comment):""),u=o.computed(()=>i.value?a(e.commentCuesheet):""),c=o.computed(()=>s.value?a(e.content):""),f=o.ref(),p=o.ref(),m=o.ref();o.onBeforeUnmount(()=>{f.value&&f.value.destroy(),p.value&&p.value.destroy(),m.value&&m.value.destroy()});function g(T){return new Lo({extensions:n.value,content:T,editable:!1,parseOptions:{preserveWhitespace:"full"}})}r.value||(f.value=g(bn(e.comment,!0,e.mode))),i.value||(p.value=g(bn(e.commentCuesheet,!0,e.mode))),s.value||(m.value=g(bn(e.content,!0,e.mode)));function b(T,A){if(!T)return;const D=bn(A,!0,e.mode);kt.isEqual(T.getHTML(),D)||T.commands.setContent(D,!1,{preserveWhitespace:"full"})}o.watch(()=>e.comment,T=>{r.value||b(f.value,T)}),o.watch(()=>e.commentCuesheet,T=>{i.value||b(p.value,T)}),o.watch(()=>e.content,T=>{s.value||b(m.value,T)});const{isScrolling:v,handleScroll:y}=Xl(),{isScrolling:x,handleScroll:E}=Xl(),k=o.computed(()=>e.mode!==Me.EDITOR?!0:!e.hideComment),C=o.computed(()=>e.mode!==Me.REPORT?!0:e.mode===Me.REPORT&&!e.hideComment),_=o.computed(()=>e.mode===Me.STRAIGHT||e.mode===Me.PLAIN_TEXT||!k.value);return(T,A)=>{const D=Kc;return o.openBlock(),o.createBlock(o.unref(Fh),{horizontal:"",class:o.normalizeClass(o.unref(Se)("flex-1 text-sm"))},{default:o.withCtx(()=>[o.unref(_)?(o.openBlock(),o.createBlock(o.unref(Zo),{key:0,class:o.normalizeClass(o.unref(Se)("!overflow-y-auto border border-ed-gray rounded-md",!T.isEditorViewSplitContent&&"border-none",!o.unref(x)&&"scrollbar-thumb-transparent",T.contentTextStyle)),onScroll:o.unref(E)},{default:o.withCtx(()=>[o.createElementVNode("div",Vte,[T.fieldNameContent?(o.openBlock(),o.createBlock(D,{key:0,"field-name":T.fieldNameContent,class:"leading-7 font-medium text-blue-500"},null,8,["field-name"])):o.createCommentVNode("",!0),o.unref(s)?(o.openBlock(),o.createElementBlock("div",{key:1,class:"ProseMirror",innerHTML:o.unref(c)},null,8,Fte)):(o.openBlock(),o.createBlock(o.unref(Qn),{key:2,editor:o.unref(m)},null,8,["editor"]))])]),_:1},8,["class","onScroll"])):(o.openBlock(),o.createElementBlock(o.Fragment,{key:1},[o.unref(k)?(o.openBlock(),o.createBlock(o.unref(Zo),{key:0,class:o.normalizeClass(o.unref(Se)("!overflow-y-auto border border-ed-gray rounded-md",!T.isEditorViewSplitContent&&"border-none",!o.unref(v)&&"scrollbar-thumb-transparent")),onScroll:o.unref(y)},{default:o.withCtx(()=>[o.createElementVNode("div",{class:o.normalizeClass(o.unref(Se)("divide-y divide-ed-gray divide-dashed"))},[o.unref(C)?(o.openBlock(),o.createElementBlock("div",$te,[T.fieldNameComment?(o.openBlock(),o.createBlock(D,{key:0,"field-name":T.fieldNameComment,class:"leading-7 font-medium text-blue-500"},null,8,["field-name"])):o.createCommentVNode("",!0),o.unref(r)?(o.openBlock(),o.createElementBlock("div",{key:1,class:"ProseMirror",innerHTML:o.unref(l)},null,8,Hte)):(o.openBlock(),o.createBlock(o.unref(Qn),{key:2,editor:o.unref(f)},null,8,["editor"]))])):o.createCommentVNode("",!0),T.mode===o.unref(Me).REPORT?(o.openBlock(),o.createElementBlock("div",zte,[T.fieldNameCommentCuesheet?(o.openBlock(),o.createBlock(D,{key:0,"field-name":T.fieldNameCommentCuesheet,class:"leading-7 font-medium text-blue-500"},null,8,["field-name"])):o.createCommentVNode("",!0),o.unref(i)?(o.openBlock(),o.createElementBlock("div",{key:1,class:"ProseMirror",innerHTML:o.unref(u)},null,8,Ute)):(o.openBlock(),o.createBlock(o.unref(Qn),{key:2,editor:o.unref(p)},null,8,["editor"]))])):o.createCommentVNode("",!0),T.isEditorViewSplitContent?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("div",Wte,[T.fieldNameContent?(o.openBlock(),o.createBlock(D,{key:0,"field-name":T.fieldNameContent,class:"leading-7 font-medium text-blue-500"},null,8,["field-name"])):o.createCommentVNode("",!0),o.unref(s)?(o.openBlock(),o.createElementBlock("div",{key:1,class:"ProseMirror",innerHTML:o.unref(c)},null,8,jte)):(o.openBlock(),o.createBlock(o.unref(Qn),{key:2,editor:o.unref(m)},null,8,["editor"]))]))],2)]),_:1},8,["class","onScroll"])):o.createCommentVNode("",!0),T.isEditorViewSplitContent?(o.openBlock(),o.createBlock(o.unref(Zo),{key:1,class:o.normalizeClass(o.unref(Se)("!overflow-y-auto border border-ed-gray rounded-md",!o.unref(x)&&"scrollbar-thumb-transparent",T.contentTextStyle)),onScroll:o.unref(E)},{default:o.withCtx(()=>[o.createElementVNode("div",qte,[T.fieldNameContent?(o.openBlock(),o.createBlock(D,{key:0,"field-name":T.fieldNameContent,class:"leading-7 font-medium text-blue-500"},null,8,["field-name"])):o.createCommentVNode("",!0),o.unref(s)?(o.openBlock(),o.createElementBlock("div",{key:1,class:"ProseMirror",innerHTML:o.unref(c)},null,8,Kte)):(o.openBlock(),o.createBlock(o.unref(Qn),{key:2,editor:o.unref(m)},null,8,["editor"]))])]),_:1},8,["class","onScroll"])):o.createCommentVNode("",!0)],64))]),_:1},8,["class"])}}}),Xte={class:"flex gap-2 items-center overflow-x-auto"},sS=o.defineComponent({__name:"ToolbarMobile",props:{editor:{},disabled:{type:Boolean,default:!1},mode:{},activeExtensions:{default:()=>[lc,vi,Lg]},customClassToolbar:{}},setup(t){const{t:e}=Tt(),n=t,r=o.inject("isEditable",o.ref(!0)),i=o.computed(()=>{const u=[...n.editor.extensionManager.extensions],c=u.find(m=>m.name===Lg);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:y=!0}=m.options;if(!g||!f1(g)||!y)continue;const x=g({editor:n.editor,extension:m,t:o.unref(e),isMobile:!0});if(Array.isArray(x)){const E=x.map((k,C)=>({id:`${m.name}`,button:k,divider:C===x.length-1?b:!1,spacer:C===0?v:!1}));p=[...p,...E];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=iS;return o.openBlock(),o.createElementBlock("div",{id:"tool-bar",class:o.normalizeClass(o.unref(Se)("z-10 border border-ed-input rounded-[5px] px-2.5 py-[5px] leading-none",!i.value.length&&"hidden",u.customClassToolbar))},[o.createElementVNode("div",Xte,[(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(mo),{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,(y,x,E)=>({name:`${x}`,fn:o.withCtx(k=>[(o.openBlock(),o.createBlock(o.resolveDynamicComponent(y),o.mergeProps({ref_for:!0},k==null?void 0:k.props,{id:p.id}),null,16,["id"]))])}))]),1040,["id","editor","disabled","custom-class","icon"])),p.id===vi&&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":y=>{var x,E;return(E=(x=p.button.componentProps).action)==null?void 0:E.call(x)}},null,8,["checked","onUpdate:checked"])):o.createCommentVNode("",!0),p.divider?(o.openBlock(),o.createBlock(o.unref(mo),{key:2,orientation:"vertical",class:"mx-2 h-auto"})):o.createCommentVNode("",!0)],64)}),128))])],2)}}}),Yte={class:"flex w-fit rounded-md bg-ed-gray-600 text-white text-sm max-w-full overflow-x-auto"},Jte=uo(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}=Tt(),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=BJ(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",Yte,[o.unref(s)&&!f.disableSuperInput&&f.mode!==o.unref(Me).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(),r("close-long-press-menu")))},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-b4e2ce28"]]),aS=o.defineComponent({__name:"MainBubbleMenu",props:{editor:{},mode:{},disableSuperInput:{type:Boolean}},setup(t){const e=t,n=new c1,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,y=m.dom.getBoundingClientRect(),x=m.coordsAtPos(b),E=m.coordsAtPos(v),k=Math.min(x.top,E.top),_=Math.max(x.bottom,E.bottom)-k;return new DOMRect(y.left,k,y.width,_)}return null}},a=o.ref(null),l=o.ref(!1),u=({editor:m,state:g})=>{if(e.editor.storage.deviceEnv.isForceCloseBubble||e.editor.isActive("link"))return!1;const{selection:b}=g,v=!b.empty&&jd(b)||l.value;return v&&m.extensionStorage.spellchecker.spellchecker.hideSuggestionBox(),v};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,y=b.posAtCoords({left:g.x,top:g.y});if(!y||y.inside===-1)return;const x=y.pos,E=v.doc.content.size,k=Math.min(x+1,E);let C=v.tr;C=C.setSelection(Pe.create(v.doc,x,k)),b.dispatch(C),requestAnimationFrame(()=>{const _=b.state.tr.setSelection(Pe.create(b.state.doc,x,x));b.dispatch(_),b.focus()})}return o.onMounted(()=>{const m=e.editor.view.dom;Ne.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 y;try{const x=(y=a.value)==null?void 0:y.$el;x&&x._tippy&&typeof x._tippy.hide=="function"&&x._tippy.hide()}catch{const E=e.editor.view,k=E.state,C=k.selection.from,_=k.doc.content.size,T=Math.min(C+1,_);E.dispatch(k.tr.setSelection(Pe.create(k.doc,C,T))),requestAnimationFrame(()=>{E.dispatch(E.state.tr.setSelection(Pe.create(E.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(Wu),{ref_key:"bubbleMenuRef",ref:a,editor:m.editor,"tippy-options":s,"should-show":u},{default:o.withCtx(()=>[o.createVNode(Jte,{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"]))}}),Zte={class:"flex items-center justify-between label-large mb-2"},Qte={class:"mb-5"},Nte={class:"flex gap-x-3"},ene=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(()=>Eh(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=Ot;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",Zte,[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",Qte,[o.createVNode(Ev,{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,y;return[o.createElementVNode("div",Nte,[(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((y=p.bottomSheetComponent)==null?void 0:y.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"])}}}),lS=zn.create({name:"diffDel",parseHTML(){return[{tag:"span.diff-del"}]},renderHTML({HTMLAttributes:t}){return["span",{class:"diff-del",...t},0]}});function uS(t=100){let e=null,n=!0;function r(s){let a=s==null?void 0:s.parentElement;for(;a;){if(a.id==="comment-wrap-scroll"){a=a.parentElement;continue}const u=getComputedStyle(a).overflowY;if(u==="auto"||u==="scroll")return a;a=a.parentElement}return window}function i(s){if(n){n=!1;return}e&&cancelAnimationFrame(e),e=requestAnimationFrame(()=>{const{view:a,state:l}=s,{from:u}=l.selection,c=a.coordsAtPos(u),f=r(a.dom),p=o.unref(t);if(f===window){const y=window.innerHeight;c.top>y-p&&window.scrollBy({top:c.top-(y-p),behavior:"smooth"});return}const m=f,g=m.getBoundingClientRect(),b=c.top-g.top,v=m.clientHeight;b>v-p&&m.scrollBy({top:b-(v-p),behavior:"smooth"})})}return{scrollCaretNearBottom:i}}const tne=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:{},fontWeightDefault:{},contentTextStyle:{},isOpenSuperView:{type:Boolean,default:!0},output:{default:"html"},dark:{type:Boolean,default:void 0},disabled:{type:Boolean,default:!1},hideToolbar:{type:Boolean,default:!1},isShowFormatControlBar:{type:Boolean},customClassFormatControlBar:{},titleBarComment:{},titleBarContent:{},fieldNameComment:{},fieldNameCommentCuesheet:{},fieldNameContent:{},fieldNameSuper:{},isScreenSplit:{},isShowLineNumber:{type:Boolean},hideMenubar:{type:Boolean},disableBubble:{type:Boolean,default:!1},hideBubble:{type:Boolean,default:!1},maxWidth:{default:void 0},minHeight:{default:600},maxHeight:{default:void 0},height:{},extensions:{default:()=>[]},editorClass:{default:void 0},contentClass:{default:void 0},isCompare:{type:Boolean},autoHeight:{type:Boolean},textAlert:{},customClassToolbar:{},readonly:{type:Boolean},canEditSuperReadOnly:{type:Boolean},autoFocus:{type:Boolean,default:!0},superPreviewCustomClass:{},minChar:{},isAccordion:{type:Boolean},contentAutoCopied:{},isEditorView:{type:Boolean},isEditorViewSplitContent:{type:Boolean},editorContentInstance:{},toolbarExtensionOrder:{},watermarkOverlay:{},bottomOffset:{},characterCountLimit:{}},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,{scrollCaretNearBottom:p}=uS(r.bottomOffset),m=o.inject("isEditable",o.ref(!0)),g=new Lo({enablePasteRules:!1,enableInputRules:!1,content:bn(r.modelValue,r.disabled),editorProps:{attributes:{id:lr.COMMENT,[lr.DISABLE_SUPER_INPUT]:`${r.disableSuperInput}`},handleKeyDown:kt.throttle((E,k)=>k.key==="Enter"&&s.enter&&!k.shiftKey?(i("enter"),!0):!1,Vo),transformPastedHTML:E=>(E=E.replace(/\s*style="[^"]*"/g,""),E),handlePaste(E,k){var _;const C=((_=k.clipboardData)==null?void 0:_.getData("text/plain"))||"";return r.mode===Me.EDITOR&&Uv(C)?(k.preventDefault(),Wv(E,C.trim())):!1}},onCreate:({editor:E})=>{c(E)},onUpdate:kt.throttle(({editor:E})=>{l.value=!0;const k=v(E,r.output);i("update:modelValue",k),i("change",{editor:E,output:k}),c(E)},Vo),extensions:[lS,...kt.uniqBy(r.extensions,"name")],editable:m.value,onFocus:()=>{b()},onBlur:({editor:E,event:k})=>{i("onBlurEditor",k)},onSelectionUpdate:({editor:E})=>{m.value&&p(E)}});function b(){i("setEditorSelected",g)}b();function v(E,k){if(!E)return"";if(E.isEmpty)return k==="json"?{}:"";switch(k){case"html":return h1(E,{removeNodes:[sc,bi]});case"json":return E.getJSON();case"text":return E.getText();default:return""}}function y(E){return E.every(k=>g==null?void 0:g.extensionManager.extensions.find(C=>C.name===k))}o.watch(()=>f.languages,()=>{g.commands.checkSpelling()}),o.watch(()=>r.modelValue,E=>{if(!g||kt.isEqual(v(g,r.output),E))return;const{from:k,to:C}=g.state.selection;g.commands.setTextSelection({from:k,to:C}),g.commands.setContent(bn(E,r.disabled),!1)},{deep:!0}),o.watch(()=>u.value,()=>{u.value&&u.value.on("selectionUpdate",({editor:E})=>{i("changed:selection",{editor:E})})}),o.watch(()=>r.disableSuperInput,()=>{const E=document.getElementById(lr.COMMENT);E==null||E.setAttribute(lr.DISABLE_SUPER_INPUT,`${r.disableSuperInput}`)}),o.onUnmounted(()=>g==null?void 0:g.destroy()),wc(ju.SAVE,()=>{localStorage.setItem("comment",v(g,"html"))});function x(E){g.commands.focus("end"),b()}return Dh(g),o.onMounted(()=>{var E;r.autoFocus&&x(r.mode),(E=g==null?void 0:g.commands)!=null&&E.setIsMobile&&g.commands.setIsMobile(!0)}),o.watch(()=>r.mode,E=>{r.autoFocus&&x()}),o.watch(()=>m.value,E=>{var k;g==null||g.setEditable(E),(k=g==null?void 0:g.commands)!=null&&k.setIsEnableSuggestion&&g.commands.setIsEnableSuggestion(E)},{immediate:!0}),e({editor:g}),(E,k)=>{const C=aS,_=Lh,T=Rh,A=Ih;return o.openBlock(),o.createElementBlock(o.Fragment,null,[!E.hideBubble&&!E.disabled&&o.unref(m)?(o.openBlock(),o.createElementBlock(o.Fragment,{key:0},[o.createVNode(C,{editor:o.unref(g),mode:E.mode,"disable-super-input":E.disableSuperInput},null,8,["editor","mode","disable-super-input"]),y([o.unref(ac)])?(o.openBlock(),o.createBlock(_,{key:0,editor:o.unref(g)},null,8,["editor"])):o.createCommentVNode("",!0),y([o.unref(ma)])?(o.openBlock(),o.createBlock(T,{key:1,editor:o.unref(g)},null,8,["editor"])):o.createCommentVNode("",!0),y([o.unref(ds)])?(o.openBlock(),o.createBlock(A,{key:2,editor:o.unref(g)},null,8,["editor"])):o.createCommentVNode("",!0)],64)):o.createCommentVNode("",!0),o.createVNode(o.unref(Qn),{id:"editor-panel",editor:o.unref(g),spellcheck:"true",class:"flex-1 relative"},null,8,["editor"])],64)}}}),cS=o.defineComponent({__name:"ToolbarTitle",props:{titleBar:{},customClass:{}},setup(t){return(e,n)=>(o.openBlock(),o.createElementBlock("h3",{class:o.normalizeClass(o.unref(Se)("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 dS(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 nne={class:"flex justify-between items-center relative gap-x-3"},rne={class:"flex items-center gap-x-4"},Gc=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:""},fontFamilyDefault:{default:""},fontWeightDefault:{default:void 0},contentTextStyle:{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:{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},editorContentInstance:{},toolbarExtensionOrder:{},watermarkOverlay:{},bottomOffset:{},characterCountLimit:{}},emits:["enter","change","update:modelValue","update:comment","onFocusEditor","changed:selection","setEditorSelected","onBlurEditor","lineFocus","onFocus","onBlur"],setup(t,{expose:e,emit:n}){var $e;const r=t,i=n,s=new c1;o.provide("isMobile",!0),Ne.useEventBus(fr.INCREASE_DECREASE_FONTSIZE);const a=o.useAttrs(),l=xn(),{state:u,isFullscreen:c,isReady:f,editor:p,updateEditorState:m,checkSpellStore:g,setImageAttachment:b,setEditorContentMobile:v,footerTargetRef:y}=l,{markAsFocused:x,insertHtml:E}=Iee(),k=o.computed(()=>F.value?100:40),{scrollCaretNearBottom:C}=uS(k),_=o.ref(!r.disabled&&!r.readonly);o.provide("isEditable",_);const T=o.ref(r.fontSizeDefault),A=o.ref(r.fontFamilyDefault),D=o.ref(r.fontWeightDefault);o.provide("fontSize",T),o.provide("fontFamily",A),o.provide("fontWeight",D);const O=o.computed(()=>({...o.unref(c)?{height:"100%"}:{minHeight:r.minHeight?rn(r.minHeight):void 0,maxHeight:r.maxHeight?rn(r.maxHeight):void 0,height:r.height?rn(r.height):void 0},maxWidth:rn(r.maxWidth),width:r.maxWidth?"100%":void 0,margin:r.maxWidth?"0 auto":void 0})),M=new Lo({enablePasteRules:!1,enableInputRules:!1,content:bn(r.modelValue,r.disabled,r.mode),editorProps:{handleKeyDown:kt.throttle((Q,we)=>we.key==="Enter"&&a.enter&&!we.shiftKey?(i("enter"),!0):!1,Vo),transformPastedHTML:Q=>(Q=Q.replace(/\s*style="[^"]*"/g,""),Q),handlePaste(Q,we){var me;const N=((me=we.clipboardData)==null?void 0:me.getData("text/plain"))||"";return r.mode===Me.EDITOR&&Uv(N)?(we.preventDefault(),Wv(Q,N.trim())):r.mode===Me.PLAIN_TEXT?(we.preventDefault(),Nee(Q,N)):!1}},onCreate:({editor:Q})=>{m(Q)},onUpdate:kt.throttle(({editor:Q})=>{f.value=!0;const we=L(Q,r.output);i("update:modelValue",we),i("change",{editor:Q,output:we}),m(Q),$(Q)},Vo),extensions:kt.uniqBy(qC(r.extensions,r),"name"),editable:_.value,onFocus:Q=>{R(),i("onFocus",Q),x()},onBlur:Q=>i("onBlur",Q),parseOptions:{preserveWhitespace:"full"},onSelectionUpdate:({editor:Q})=>{_.value&&C(Q)}});function $(Q){const we=[];Q.state.doc.descendants(N=>{N.type.name==="image"&&we.push({id:N.attrs.id,src:N.attrs.src})}),b(we)}const V=o.ref(),{isShowToolBarBaseOnEditor:G}=Ree(),ee=o.ref(!1);function W(){s.isNativeWebViewAvailable()&&(s.receiveDataFromNative(s1.KEYBOARD_DID_SHOW,Q=>{ee.value=!0}),s.receiveDataFromNative(s1.KEYBOARD_DID_HIDE,Q=>{ee.value=!1}))}o.watch(ee,Q=>{Q&&C(V.value)}),o.onMounted(()=>{R(M),v(M),W()});const F=o.computed(()=>r.isShowFormatControlBar&&r.mode===Me.EDITOR&&_&&!r.isEditorView);function R(Q){V.value=Q??M,l.setEditorSelectedMobile(V.value)}const H=o.computed(()=>M.storage.superText.isShowSuperInputMoblie);function L(Q,we){if(!Q)return"";if(Q.isEmpty)return we==="json"?{}:"";if(r.mode===Me.PLAIN_TEXT)return Q.getText({blockSeparator:`
|
|
348
348
|
`});switch(we){case"html":return h1(Q,{removeNodes:[sc,bi]});case"json":return Q.getJSON();case"text":return Q.getText({blockSeparator:`
|