@telepath-computer/television 0.1.24 → 0.1.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/artifact-runtime/index.js +1 -1
- package/dist/cli.cjs +3 -3
- package/dist/electron.cjs +3 -3
- package/package.json +1 -1
|
@@ -945,7 +945,7 @@ l0,-`+(n+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
|
|
|
945
945
|
d="m644-428-58-58q9-47-27-88t-93-32l-58-58q17-8 34.5-12t37.5-4q75 0 127.5 52.5T660-500q0 20-4 37.5T644-428Zm128 126-58-56q38-29 67.5-63.5T832-500q-50-101-143.5-160.5T480-720q-29 0-57 4t-55 12l-62-62q41-17 84-25.5t90-8.5q151 0 269 83.5T920-500q-23 59-60.5 109.5T772-302Zm20 246L624-222q-35 11-70.5 16.5T480-200q-151 0-269-83.5T40-500q21-53 53-98.5t73-81.5L56-792l56-56 736 736-56 56ZM222-624q-29 26-53 57t-41 67q50 101 143.5 160.5T480-280q20 0 39-2.5t39-5.5l-36-38q-11 3-21 4.5t-21 1.5q-75 0-127.5-52.5T300-500q0-11 1.5-21t4.5-21l-84-82Zm319 93Zm-151 75Z"
|
|
946
946
|
/>
|
|
947
947
|
</svg>
|
|
948
|
-
`,o_e={[Wt.CodeMirror]:{theme:Pce,languages:pce,expandIcon:GX,searchIcon:mD,clearSearchIcon:lD,searchPlaceholder:"Search language",noResultText:"No result",previewToggleIcon:t=>t?HX:yD}},a_e=xt([],"FeaturesCtx"),s_e=xt({},"CrepeCtx");function l_e(t){return t.get("CrepeCtx")}function Th(t){return t.use("FeaturesCtx")}function Ma(t){return e=>{Th(e).update(n=>n.includes(t)?n:[...n,t])}}function bD(t){return t.$from.parent.type.name==="code_block"}function SD(t){var e;const n=(e=t.$from.node(t.$from.depth-1))==null?void 0:e.type;return(n==null?void 0:n.name)==="list_item"}var vD=t=>{throw TypeError(t)},wD=(t,e,n)=>e.has(t)||vD("Cannot "+n),kg=(t,e,n)=>(wD(t,e,"read from private field"),n?n.call(t):e.get(t)),kD=(t,e,n)=>e.has(t)?vD("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),O_e=(t,e,n,r)=>(wD(t,e,"write to private field"),e.set(t,n),n),_h,av;class t7{constructor(){kD(this,_h,[]),this.clear=()=>(O_e(this,_h,[]),this),kD(this,av,e=>{const n={group:e,addItem:(r,i)=>{const o={...i,key:r};return e.items.push(o),n},clear:()=>(e.items=[],n)};return n}),this.addGroup=(e,n)=>{const i={key:e,label:n,items:[]};return kg(this,_h).push(i),kg(this,av).call(this,i)},this.getGroup=e=>{const n=kg(this,_h).find(r=>r.key===e);if(!n)throw new Error(`Group with key ${e} not found`);return kg(this,av).call(this,n)},this.build=()=>kg(this,_h)}}_h=new WeakMap,av=new WeakMap;function af(...t){}function c_e(t,e,n){var r,i,o,a,s,l,O,c,u,f,d,h,p,m,g,Q,b,P,v,w,k,X,T,C,W,I,F,E,D,G,M,K,ae,z,te,we,q,wt,ie,ke,et,dt,Rt,rn,ir,U,N,ee,le,ce,fe,Se,Qe,pe,ue,Ge,Pe,Re,De,H,oe,Te,Ue,it,Je,wn,Qn,Kn,qt,Zt,dr,sn,xp,ba,dO,Yc,hr,Hf,Tp,Kt,rs,Kf,Vc,Wc,Sa,io,is,li,Cr,Jf,Uc,as,zi,Nr,ed,Ac,td,ll,nd,Fe,j,ge,Me,ln,or,Xn,_,Y,ne,_e,Xe,kt,At,Oi,Ci,Ic,_ne,Xne,Rne;const _p=n&&Th(n).get(),BGe=_p==null?void 0:_p.includes(Wt.Latex),FGe=_p==null?void 0:_p.includes(Wt.ImageBlock),HGe=_p==null?void 0:_p.includes(Wt.Table),X1=new t7;if((e==null?void 0:e.textGroup)!==null){const on=X1.addGroup("text",(i=(r=e==null?void 0:e.textGroup)==null?void 0:r.label)!=null?i:"Text");((o=e==null?void 0:e.textGroup)==null?void 0:o.text)!==null&&on.addItem("text",{label:(l=(s=(a=e==null?void 0:e.textGroup)==null?void 0:a.text)==null?void 0:s.label)!=null?l:"Text",icon:(u=(c=(O=e==null?void 0:e.textGroup)==null?void 0:O.text)==null?void 0:c.icon)!=null?u:i_e,onRun:nt=>{const ot=nt.get(Ce),Jt=go.type(nt);ot.call(Ir.key),ot.call(Fo.key,{nodeType:Jt})}}),((f=e==null?void 0:e.textGroup)==null?void 0:f.h1)!==null&&on.addItem("h1",{label:(p=(h=(d=e==null?void 0:e.textGroup)==null?void 0:d.h1)==null?void 0:h.label)!=null?p:"Heading 1",icon:(Q=(g=(m=e==null?void 0:e.textGroup)==null?void 0:m.h1)==null?void 0:g.icon)!=null?Q:H4e,onRun:nt=>{const ot=nt.get(Ce),Jt=gi.type(nt);ot.call(Ir.key),ot.call(Fo.key,{nodeType:Jt,attrs:{level:1}})}}),((b=e==null?void 0:e.textGroup)==null?void 0:b.h2)!==null&&on.addItem("h2",{label:(w=(v=(P=e==null?void 0:e.textGroup)==null?void 0:P.h2)==null?void 0:v.label)!=null?w:"Heading 2",icon:(T=(X=(k=e==null?void 0:e.textGroup)==null?void 0:k.h2)==null?void 0:X.icon)!=null?T:K4e,onRun:nt=>{const ot=nt.get(Ce),Jt=gi.type(nt);ot.call(Ir.key),ot.call(Fo.key,{nodeType:Jt,attrs:{level:2}})}}),((C=e==null?void 0:e.textGroup)==null?void 0:C.h3)!==null&&on.addItem("h3",{label:(F=(I=(W=e==null?void 0:e.textGroup)==null?void 0:W.h3)==null?void 0:I.label)!=null?F:"Heading 3",icon:(G=(D=(E=e==null?void 0:e.textGroup)==null?void 0:E.h3)==null?void 0:D.icon)!=null?G:J4e,onRun:nt=>{const ot=nt.get(Ce),Jt=gi.type(nt);ot.call(Ir.key),ot.call(Fo.key,{nodeType:Jt,attrs:{level:3}})}}),((M=e==null?void 0:e.textGroup)==null?void 0:M.h4)!==null&&on.addItem("h4",{label:(z=(ae=(K=e==null?void 0:e.textGroup)==null?void 0:K.h4)==null?void 0:ae.label)!=null?z:"Heading 4",icon:(q=(we=(te=e==null?void 0:e.textGroup)==null?void 0:te.h4)==null?void 0:we.icon)!=null?q:e_e,onRun:nt=>{const ot=nt.get(Ce),Jt=gi.type(nt);ot.call(Ir.key),ot.call(Fo.key,{nodeType:Jt,attrs:{level:4}})}}),((wt=e==null?void 0:e.textGroup)==null?void 0:wt.h5)!==null&&on.addItem("h5",{label:(et=(ke=(ie=e==null?void 0:e.textGroup)==null?void 0:ie.h5)==null?void 0:ke.label)!=null?et:"Heading 5",icon:(rn=(Rt=(dt=e==null?void 0:e.textGroup)==null?void 0:dt.h5)==null?void 0:Rt.icon)!=null?rn:t_e,onRun:nt=>{const ot=nt.get(Ce),Jt=gi.type(nt);ot.call(Ir.key),ot.call(Fo.key,{nodeType:Jt,attrs:{level:5}})}}),((ir=e==null?void 0:e.textGroup)==null?void 0:ir.h6)!==null&&on.addItem("h6",{label:(ee=(N=(U=e==null?void 0:e.textGroup)==null?void 0:U.h6)==null?void 0:N.label)!=null?ee:"Heading 6",icon:(fe=(ce=(le=e==null?void 0:e.textGroup)==null?void 0:le.h6)==null?void 0:ce.icon)!=null?fe:n_e,onRun:nt=>{const ot=nt.get(Ce),Jt=gi.type(nt);ot.call(Ir.key),ot.call(Fo.key,{nodeType:Jt,attrs:{level:6}})}}),((Se=e==null?void 0:e.textGroup)==null?void 0:Se.quote)!==null&&on.addItem("quote",{label:(ue=(pe=(Qe=e==null?void 0:e.textGroup)==null?void 0:Qe.quote)==null?void 0:pe.label)!=null?ue:"Quote",icon:(Re=(Pe=(Ge=e==null?void 0:e.textGroup)==null?void 0:Ge.quote)==null?void 0:Pe.icon)!=null?Re:pD,onRun:nt=>{const ot=nt.get(Ce),Jt=_u.type(nt);ot.call(Ir.key),ot.call(Tl.key,{nodeType:Jt})}}),((De=e==null?void 0:e.textGroup)==null?void 0:De.divider)!==null&&on.addItem("divider",{label:(Te=(oe=(H=e==null?void 0:e.textGroup)==null?void 0:H.divider)==null?void 0:oe.label)!=null?Te:"Divider",icon:(Je=(it=(Ue=e==null?void 0:e.textGroup)==null?void 0:Ue.divider)==null?void 0:it.icon)!=null?Je:cD,onRun:nt=>{const ot=nt.get(Ce),Jt=zu.type(nt);ot.call(Ir.key),ot.call(_l.key,{nodeType:Jt})}})}if((e==null?void 0:e.listGroup)!==null){const on=X1.addGroup("list",(Qn=(wn=e==null?void 0:e.listGroup)==null?void 0:wn.label)!=null?Qn:"List");((Kn=e==null?void 0:e.listGroup)==null?void 0:Kn.bulletList)!==null&&on.addItem("bullet-list",{label:(dr=(Zt=(qt=e==null?void 0:e.listGroup)==null?void 0:qt.bulletList)==null?void 0:Zt.label)!=null?dr:"Bullet List",icon:(ba=(xp=(sn=e==null?void 0:e.listGroup)==null?void 0:sn.bulletList)==null?void 0:xp.icon)!=null?ba:sD,onRun:nt=>{const ot=nt.get(Ce),Jt=LO.type(nt);ot.call(Ir.key),ot.call(Tl.key,{nodeType:Jt})}}),((dO=e==null?void 0:e.listGroup)==null?void 0:dO.orderedList)!==null&&on.addItem("ordered-list",{label:(Hf=(hr=(Yc=e==null?void 0:e.listGroup)==null?void 0:Yc.orderedList)==null?void 0:hr.label)!=null?Hf:"Ordered List",icon:(rs=(Kt=(Tp=e==null?void 0:e.listGroup)==null?void 0:Tp.orderedList)==null?void 0:Kt.icon)!=null?rs:hD,onRun:nt=>{const ot=nt.get(Ce),Jt=GO.type(nt);ot.call(Ir.key),ot.call(Tl.key,{nodeType:Jt})}}),((Kf=e==null?void 0:e.listGroup)==null?void 0:Kf.taskList)!==null&&on.addItem("task-list",{label:(Sa=(Wc=(Vc=e==null?void 0:e.listGroup)==null?void 0:Vc.taskList)==null?void 0:Wc.label)!=null?Sa:"Task List",icon:(li=(is=(io=e==null?void 0:e.listGroup)==null?void 0:io.taskList)==null?void 0:is.icon)!=null?li:QD,onRun:nt=>{const ot=nt.get(Ce),Jt=Bo.type(nt);ot.call(Ir.key),ot.call(Tl.key,{nodeType:Jt,attrs:{checked:!1}})}})}if((e==null?void 0:e.advancedGroup)!==null){const on=X1.addGroup("advanced",(Jf=(Cr=e==null?void 0:e.advancedGroup)==null?void 0:Cr.label)!=null?Jf:"Advanced");((Uc=e==null?void 0:e.advancedGroup)==null?void 0:Uc.image)!==null&&FGe&&on.addItem("image",{label:(Nr=(zi=(as=e==null?void 0:e.advancedGroup)==null?void 0:as.image)==null?void 0:zi.label)!=null?Nr:"Image",icon:(td=(Ac=(ed=e==null?void 0:e.advancedGroup)==null?void 0:ed.image)==null?void 0:Ac.icon)!=null?td:ov,onRun:nt=>{const ot=nt.get(Ce),Jt=I0.type(nt);ot.call(Ir.key),ot.call(_l.key,{nodeType:Jt})}}),((ll=e==null?void 0:e.advancedGroup)==null?void 0:ll.codeBlock)!==null&&on.addItem("code",{label:(j=(Fe=(nd=e==null?void 0:e.advancedGroup)==null?void 0:nd.codeBlock)==null?void 0:Fe.label)!=null?j:"Code",icon:(ln=(Me=(ge=e==null?void 0:e.advancedGroup)==null?void 0:ge.codeBlock)==null?void 0:Me.icon)!=null?ln:BX,onRun:nt=>{const ot=nt.get(Ce),Jt=Go.type(nt);ot.call(Ir.key),ot.call(Fo.key,{nodeType:Jt})}}),((or=e==null?void 0:e.advancedGroup)==null?void 0:or.table)!==null&&HGe&&on.addItem("table",{label:(Y=(_=(Xn=e==null?void 0:e.advancedGroup)==null?void 0:Xn.table)==null?void 0:_.label)!=null?Y:"Table",icon:(Xe=(_e=(ne=e==null?void 0:e.advancedGroup)==null?void 0:ne.table)==null?void 0:_e.icon)!=null?Xe:$D,onRun:nt=>{const ot=nt.get(Ce),Jt=nt.get(Nt);ot.call(Ir.key);const{from:KGe}=Jt.state.selection;ot.call(_l.key,{nodeType:Vb(nt,3,3)}),ot.call(b4.key,{pos:KGe})}}),((kt=e==null?void 0:e.advancedGroup)==null?void 0:kt.math)!==null&&BGe&&on.addItem("math",{label:(Ci=(Oi=(At=e==null?void 0:e.advancedGroup)==null?void 0:At.math)==null?void 0:Oi.label)!=null?Ci:"Math",icon:(Xne=(_ne=(Ic=e==null?void 0:e.advancedGroup)==null?void 0:Ic.math)==null?void 0:_ne.icon)!=null?Xne:e7,onRun:nt=>{const ot=nt.get(Ce),Jt=Go.type(nt);ot.call(Ir.key),ot.call(_l.key,{nodeType:Jt,attrs:{language:"LaTeX"}})}})}(Rne=e==null?void 0:e.buildMenu)==null||Rne.call(e,X1);let R1=X1.build();t&&(R1=R1.map(on=>{const nt=on.items.filter(ot=>ot.label.toLowerCase().includes(t.toLowerCase()));return{...on,items:nt}}).filter(on=>on.items.length>0));const zne=R1.flatMap(on=>on.items);return zne.forEach((on,nt)=>{Object.assign(on,{index:nt})}),R1.reduce((on,nt)=>{const ot=on+nt.items.length;return Object.assign(nt,{range:[on,ot]}),ot},0),{groups:R1,size:zne.length}}af(B);const u_e=kr({props:{ctx:{type:Object,required:!0},show:{type:Object,required:!0},filter:{type:Object,required:!0},hide:{type:Function,required:!0},config:{type:Object,required:!1}},setup({ctx:t,show:e,filter:n,hide:r,config:i}){const o=je(),a=Iu(()=>c_e(n.value,i,t)),s=je(0),l=je({x:-999,y:-999}),O=p=>{const{x:m,y:g}=p;l.value={x:m,y:g}};Wu([a,e],()=>{const{size:p}=a.value;p===0&&e.value?r():s.value>=p&&(s.value=0)});const c=(p,m)=>{const g=s.value,Q=typeof p=="function"?p(g):p;m==null||m(Q),s.value=Q},u=p=>{var m,g;const Q=(m=o.value)==null?void 0:m.querySelector(`[data-index="${p}"]`),b=(g=o.value)==null?void 0:g.querySelector(".menu-groups");!Q||!b||(b.scrollTop=Q.offsetTop-b.offsetTop)},f=p=>{const m=a.value.groups.flatMap(g=>g.items).at(p);m!=null&&m.onRun&&t&&m.onRun(t),r()},d=p=>{const{size:m,groups:g}=a.value;if(p.key==="Escape"){p.preventDefault(),r==null||r();return}if(p.key==="ArrowDown")return p.preventDefault(),c(Q=>Q<m-1?Q+1:Q,u);if(p.key==="ArrowUp")return p.preventDefault(),c(Q=>Q<=0?Q:Q-1,u);if(p.key==="ArrowLeft")return p.preventDefault(),c(Q=>{const b=g.find(v=>v.range[0]<=Q&&v.range[1]>Q);if(!b)return Q;const P=g[g.indexOf(b)-1];return P?P.range[1]-1:Q},u);if(p.key==="ArrowRight")return p.preventDefault(),c(Q=>{const b=g.find(v=>v.range[0]<=Q&&v.range[1]>Q);if(!b)return Q;const P=g[g.indexOf(b)+1];return P?P.range[0]:Q},u);p.key==="Enter"&&(p.preventDefault(),f(s.value))},h=p=>m=>{const g=l.value;if(!g)return;const{x:Q,y:b}=m;Q===g.x&&b===g.y||c(p)};return Dd(()=>{e.value?window.addEventListener("keydown",d,{capture:!0}):window.removeEventListener("keydown",d,{capture:!0})}),Gd(()=>{window.removeEventListener("keydown",d,{capture:!0})}),()=>B("div",{ref:o,onPointerdown:p=>p.preventDefault()},B("nav",{class:"tab-group"},B("ul",null,a.value.groups.map(p=>B("li",{key:p.key,onPointerdown:()=>c(p.range[0],u),class:s.value>=p.range[0]&&s.value<p.range[1]?"selected":""},p.label)))),B("div",{class:"menu-groups",onPointermove:O},a.value.groups.map(p=>B("div",{key:p.key,class:"menu-group"},B("h6",null,p.label),B("ul",null,p.items.map(m=>B("li",{key:m.key,"data-index":m.index,class:s.value===m.index?"hover":"",onPointerenter:h(m.index),onPointerdown:()=>{var g,Q;(Q=(g=o.value)==null?void 0:g.querySelector(`[data-index="${m.index}"]`))==null||Q.classList.add("active")},onPointerup:()=>{var g,Q;(Q=(g=o.value)==null?void 0:g.querySelector(`[data-index="${m.index}"]`))==null||Q.classList.remove("active"),f(m.index)}},B(JO,{icon:m.icon}),B("span",null,m.label))))))))}});var PD=t=>{throw TypeError(t)},xD=(t,e,n)=>e.has(t)||PD("Cannot "+n),Na=(t,e,n)=>(xD(t,e,"read from private field"),n?n.call(t):e.get(t)),Pg=(t,e,n)=>e.has(t)?PD("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),sf=(t,e,n,r)=>(xD(t,e,"write to private field"),e.set(t,n),n),xg,sv,lv,Nl,Xh;const TD=AQe("CREPE_MENU"),n7=Lt({show:()=>{},hide:()=>{}},"menuAPICtx");function f_e(t,e){t.set(TD.key,{view:n=>new d_e(t,n,e)})}class d_e{constructor(e,n,r){Pg(this,xg),Pg(this,sv),Pg(this,lv),Pg(this,Nl),Pg(this,Xh,null),this.update=c=>{Na(this,Nl).update(c)},this.show=c=>{sf(this,Xh,c),Na(this,lv).value="",Na(this,Nl).show()},this.hide=()=>{sf(this,Xh,null),Na(this,Nl).hide()},this.destroy=()=>{Na(this,Nl).destroy(),Na(this,sv).unmount(),Na(this,xg).remove()};const i=document.createElement("div");i.classList.add("milkdown-slash-menu");const o=je(!1),a=je("");sf(this,lv,a);const s=this.hide,l=Ho(u_e,{ctx:e,config:r,show:o,filter:a,hide:s});sf(this,sv,l),l.mount(i),sf(this,xg,i);const O=this;sf(this,Nl,new IQe({content:Na(this,xg),debounce:20,shouldShow(c){if(bD(c.state.selection)||SD(c.state.selection))return!1;const u=this.getContent(c,d=>["paragraph","heading"].includes(d.type.name));if(u==null||!h_e(c.state.selection))return!1;const f=Na(O,Xh);if(a.value=u.startsWith("/")?u.slice(1):u,typeof f=="number"){const d=c.state.doc.nodeSize-2,h=Math.min(f,d);return c.state.doc.resolve(h).node()!==c.state.doc.resolve(c.state.selection.from).node()?(sf(O,Xh,null),!1):!0}return!!u.startsWith("/")},offset:10})),Na(this,Nl).onShow=()=>{o.value=!0},Na(this,Nl).onHide=()=>{o.value=!1},this.update(n),e.set(n7.key,{show:c=>this.show(c),hide:()=>this.hide()})}}xg=new WeakMap,sv=new WeakMap,lv=new WeakMap,Nl=new WeakMap,Xh=new WeakMap;function h_e(t){if(!(t instanceof Le))return!1;const{$head:e}=t,n=e.parent;return e.parentOffset===n.content.size}af(B,mn);const p_e=kr({props:{onAdd:{type:Function,required:!0},addIcon:{type:String,required:!0},handleIcon:{type:String,required:!0}},setup(t){const e=je();return()=>B(mn,null,B("div",{ref:e,class:"operation-item",onPointerdown:n=>{var r;n.preventDefault(),n.stopPropagation(),(r=e.value)==null||r.classList.add("active")},onPointerup:n=>{var r;n.preventDefault(),n.stopPropagation(),(r=e.value)==null||r.classList.remove("active"),t.onAdd()}},B(JO,{icon:t.addIcon})),B("div",{class:"operation-item"},B(JO,{icon:t.handleIcon})))}});var _D=t=>{throw TypeError(t)},XD=(t,e,n)=>e.has(t)||_D("Cannot "+n),lf=(t,e,n)=>(XD(t,e,"read from private field"),n?n.call(t):e.get(t)),Ov=(t,e,n)=>e.has(t)?_D("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),cv=(t,e,n,r)=>(XD(t,e,"write to private field"),e.set(t,n),n),uv,Of,fv,dv;class m_e{constructor(e,n){Ov(this,uv),Ov(this,Of),Ov(this,fv),Ov(this,dv),this.update=()=>{lf(this,Of).update()},this.destroy=()=>{lf(this,Of).destroy(),lf(this,uv).remove(),lf(this,fv).unmount()},this.onAdd=()=>{const O=lf(this,dv),c=O.get(Nt);c.hasFocus()||c.focus();const{state:u,dispatch:f}=c,d=lf(this,Of).active;if(!d)return;const p=d.$pos.pos+d.node.nodeSize;let m=u.tr.insert(p,go.type(O).create());m=m.setSelection(Le.near(m.doc.resolve(p))),f(m.scrollIntoView()),lf(this,Of).hide(),O.get(n7.key).show(m.selection.from)};var r,i,o;cv(this,dv,e);const a=document.createElement("div");a.classList.add("milkdown-block-handle");const s=Ho(p_e,{onAdd:this.onAdd,addIcon:(r=n==null?void 0:n.handleAddIcon)!=null?r:KX,handleIcon:(i=n==null?void 0:n.handleDragIcon)!=null?i:r_e});s.mount(a),cv(this,fv,s),cv(this,uv,a);const l=(o=n==null?void 0:n.blockHandle)!=null?o:{};cv(this,Of,new Rge({ctx:e,content:a,getOffset:()=>16,getPlacement:({active:O,blockDom:c})=>{if(O.node.type.name==="heading")return"left";let u=0;O.node.descendants(P=>{u+=P.childCount});const f=O.el,d=f.getBoundingClientRect(),h=c.getBoundingClientRect(),p=window.getComputedStyle(f),m=Number.parseInt(p.paddingTop,10)||0,g=Number.parseInt(p.paddingBottom,10)||0,Q=d.height-m-g,b=h.height;return u>2||b<Q?"left-start":"left"},...l})),this.update()}}uv=new WeakMap,Of=new WeakMap,fv=new WeakMap,dv=new WeakMap;function g_e(t,e){t.set(Gy.key,{filterNodes:n=>!Ss(i=>["table","blockquote","math_inline"].includes(i.type.name))(n)}),t.set(Hy.key,{view:()=>new m_e(t,e)})}const $_e=(t,e)=>{t.config(Ma(Wt.BlockEdit)).config(n=>g_e(n,e)).config(n=>f_e(n,e)).use(n7).use(Hy).use(TD)},Q_e=(t,e={})=>{t.config(Ma(Wt.CodeMirror)).config(n=>{const{languages:r=[],theme:i}=e,o=[eu.of(ZI.concat(Mwe)),LPe];i&&o.push(i),e.extensions&&o.push(...e.extensions),n.update(H0.key,a=>{var s;return{extensions:o,languages:r,expandIcon:e.expandIcon||GX,searchIcon:e.searchIcon||mD,clearSearchIcon:e.clearSearchIcon||lD,searchPlaceholder:e.searchPlaceholder||"Search language",copyText:e.copyText||"Copy",copyIcon:e.copyIcon||OD,onCopy:e.onCopy||(()=>{}),noResultText:e.noResultText||"No result",renderLanguage:e.renderLanguage||a.renderLanguage,renderPreview:e.renderPreview||a.renderPreview,previewToggleButton:l=>{var O,c;const u=((O=e.previewToggleIcon)==null?void 0:O.call(e,l))||(l?HX:yD),f=((c=e.previewToggleText)==null?void 0:c.call(e,l))||(l?"Edit":"Hide");return[u,f].map(d=>d.trim()).join(" ")},previewLabel:e.previewLabel||a.previewLabel,previewLoading:e.previewLoading||a.previewLoading,previewOnlyByDefault:(s=e.previewOnlyByDefault)!=null?s:a.previewOnlyByDefault}})}).use(dke)},y_e=(t,e)=>{if(t.config(Ma(Wt.Cursor)).config(r=>{r.update(lS.key,()=>{var i,o;return{class:"crepe-drop-cursor",width:(i=e==null?void 0:e.width)!=null?i:4,color:(o=e==null?void 0:e.color)!=null?o:!1}})}).use(fxe),(e==null?void 0:e.virtual)===!1)return;const n=dxe();t.use(Gn(()=>n))},b_e=(t,e)=>{t.config(Ma(Wt.ImageBlock)).config(n=>{n.update(OS.key,r=>{var i,o,a,s,l,O;return{uploadButton:(i=e==null?void 0:e.inlineUploadButton)!=null?i:"Upload",imageIcon:(o=e==null?void 0:e.inlineImageIcon)!=null?o:ov,confirmButton:(a=e==null?void 0:e.inlineConfirmButton)!=null?a:FX,uploadPlaceholderText:(s=e==null?void 0:e.inlineUploadPlaceholderText)!=null?s:"or paste link",onUpload:(O=(l=e==null?void 0:e.inlineOnUpload)!=null?l:e==null?void 0:e.onUpload)!=null?O:r.onUpload,proxyDomURL:e==null?void 0:e.proxyDomURL}}),n.update(A0.key,r=>{var i,o,a,s,l,O,c,u,f;return{uploadButton:(i=e==null?void 0:e.blockUploadButton)!=null?i:"Upload file",imageIcon:(o=e==null?void 0:e.blockImageIcon)!=null?o:ov,captionIcon:(a=e==null?void 0:e.blockCaptionIcon)!=null?a:L4e,confirmButton:(s=e==null?void 0:e.blockConfirmButton)!=null?s:"Confirm",captionPlaceholderText:(l=e==null?void 0:e.blockCaptionPlaceholderText)!=null?l:"Write Image Caption",uploadPlaceholderText:(O=e==null?void 0:e.blockUploadPlaceholderText)!=null?O:"or paste link",onUpload:(u=(c=e==null?void 0:e.blockOnUpload)!=null?c:e==null?void 0:e.onUpload)!=null?u:r.onUpload,proxyDomURL:e==null?void 0:e.proxyDomURL,onImageLoadError:(f=e==null?void 0:e.onImageLoadError)!=null?f:r.onImageLoadError,maxWidth:e==null?void 0:e.maxWidth,maxHeight:e==null?void 0:e.maxHeight}})}).use(Xye).use(Pxe)},S_e=Go.extendSchema(t=>e=>{const n=t(e);return{...n,toMarkdown:{match:n.toMarkdown.match,runner:(r,i)=>{var o,a;if(((o=i.attrs.language)!=null?o:"").toLowerCase()==="latex")r.addNode("math",void 0,((a=i.content.firstChild)==null?void 0:a.text)||"");else return n.toMarkdown.runner(r,i)}}}}),Tg="math_inline",_g=nr(Tg,()=>({group:"inline",inline:!0,draggable:!0,atom:!0,attrs:{value:{default:""}},parseDOM:[{tag:`span[data-type="${Tg}"]`,getAttrs:t=>{var e;return{value:(e=t.dataset.value)!=null?e:""}}}],toDOM:t=>{const e=t.attrs.value,n=document.createElement("span");return n.dataset.type=Tg,n.dataset.value=e,hN.render(e,n,{throwOnError:!1}),n},parseMarkdown:{match:t=>t.type==="inlineMath",runner:(t,e,n)=>{t.addNode(n,{value:e.value})}},toMarkdown:{match:t=>t.type.name===Tg,runner:(t,e)=>{t.addNode("inlineMath",void 0,e.attrs.value)}}})),RD=ut("ToggleLatex",t=>()=>(e,n)=>{const{hasNode:r,pos:i,target:o}=fq(e,_g.type(t)),{selection:a,doc:s,tr:l}=e;if(!r){const d=s.textBetween(a.from,a.to);let h=l.replaceSelectionWith(_g.type(t).create({value:d}));return n&&n(h.setSelection(tt.create(h.doc,a.from))),!0}const{from:O,to:c}=a;if(!o||i<0)return!1;let u=l.delete(i,i+1);const f=o.attrs.value;return u=u.insertText(f,i),n&&n(u.setSelection(Le.create(u.doc,O,c+f.length-1))),!0}),zD=AS("INLINE_LATEX");af(B);const v_e=kr({props:{config:{type:Object,required:!0},innerView:{type:Object,required:!0},updateValue:{type:Object,required:!0}},setup(t){const e=r=>{if(!(!r||!(r instanceof HTMLElement))){for(;r.firstChild;)r.removeChild(r.firstChild);t.innerView.value&&r.appendChild(t.innerView.value.dom)}},n=r=>{r.preventDefault(),t.updateValue.value()};return()=>B("div",{class:"container"},t.innerView&&B("div",{ref:e}),B("button",{type:"button",onPointerdown:n},B(JO,{icon:t.config.inlineEditConfirm})))}});var CD=t=>{throw TypeError(t)},ED=(t,e,n)=>e.has(t)||CD("Cannot "+n),_r=(t,e,n)=>(ED(t,e,"read from private field"),n?n.call(t):e.get(t)),$c=(t,e,n)=>e.has(t)?CD("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),hv=(t,e,n,r)=>(ED(t,e,"write to private field"),e.set(t,n),n),Xg,Rh,pv,cf,Rg,zg,r7,i7;class w_e{constructor(e,n,r){this.ctx=e,$c(this,Xg),$c(this,Rh),$c(this,pv),$c(this,cf,Ob(null)),$c(this,Rg,Ob(()=>{})),$c(this,zg),$c(this,r7,()=>{_r(this,cf).value&&(_r(this,cf).value.destroy(),_r(this,cf).value=null)}),$c(this,i7,o=>{const s=(()=>{const{selection:l,schema:O}=o.state;if(l.empty||!(l instanceof tt))return!1;const c=l.node;if(c.type.name!==Tg)return!1;const u=l.from,f=O.nodes.paragraph.create(null,O.text(c.attrs.value)),d=new hT(_r(this,pv),{state:uu.create({doc:f,schema:new $E({nodes:{doc:{content:"block+"},paragraph:{content:"inline*",group:"block",parseDOM:[{tag:"p"}],toDOM(){return["p",0]}},text:{group:"inline"}}}),plugins:[TZ({"Mod-z":Lb,"Mod-Z":oh,"Mod-y":oh,Enter:()=>(_r(this,Rg).value(),!0)})]})});return _r(this,cf).value=d,_r(this,Rg).value=()=>{const{tr:h}=o.state;h.setNodeAttribute(u,"value",d.state.doc.textContent),o.dispatch(h),requestAnimationFrame(()=>{o.focus()})},!0})();return s||_r(this,r7).call(this),s}),this.update=(o,a)=>{_r(this,Rh).update(o,a)},this.destroy=()=>{_r(this,zg).unmount(),_r(this,Rh).destroy(),_r(this,Xg).remove()};const i=document.createElement("div");i.className="milkdown-latex-inline-edit",hv(this,Xg,i),hv(this,zg,Ho(v_e,{config:r,innerView:_r(this,cf),updateValue:_r(this,Rg)})),_r(this,zg).mount(i),hv(this,Rh,new US({debounce:0,content:_r(this,Xg),shouldShow:_r(this,i7),offset:10,floatingUIOptions:{placement:"bottom"}})),_r(this,Rh).update(n),hv(this,pv,document.createElement("div"))}}Xg=new WeakMap,Rh=new WeakMap,pv=new WeakMap,cf=new WeakMap,Rg=new WeakMap,zg=new WeakMap,r7=new WeakMap,i7=new WeakMap;const k_e=Jr(t=>Iue(/(?:\$)([^$]+)(?:\$)$/,_g.type(t),{getAttr:e=>{var n;return{value:(n=e[1])!=null?n:""}}})),P_e=Jr(t=>r5(/^\$\$[\s\n]$/,Go.type(t),()=>({language:"LaTeX"}))),x_e=xs("remarkMath",()=>kTe);function T_e(t){return CO(t,"math",(e,n,r)=>{const{value:i}=e,o={type:"code",lang:"LaTeX",value:i};r.children.splice(n,1,o)})}const __e=xs("remarkMathBlock",()=>()=>T_e),X_e=(t,e)=>{t.config(Ma(Wt.Latex)).config(n=>{if(!Th(n).get().includes(Wt.CodeMirror))throw new Error("You need to enable CodeMirror to use LaTeX feature");n.update(H0.key,o=>({...o,renderPreview:(a,s,l)=>{if(a.toLowerCase()==="latex"&&s.length>0)return R_e(s,e==null?void 0:e.katexOptions);const O=o.renderPreview;return O(a,s,l)}})),n.set(zD.key,{view:o=>{var a;return new w_e(n,o,{inlineEditConfirm:(a=e==null?void 0:e.inlineEditConfirm)!=null?a:FX,...e})}})}).use(x_e).use(__e).use(_g).use(zD).use(k_e).use(P_e).use(S_e).use(RD)};function R_e(t,e){return hN.renderToString(t,{...e,throwOnError:!1,displayMode:!0})}const z_e=(t,e)=>{t.config(Ma(Wt.LinkTooltip)).config(JTe).config(n=>{n.update(kh.key,r=>{var i,o,a,s,l,O;return{...r,linkIcon:(i=e==null?void 0:e.linkIcon)!=null?i:OD,editButton:(o=e==null?void 0:e.editButton)!=null?o:HX,removeButton:(a=e==null?void 0:e.removeButton)!=null?a:JX,confirmButton:(s=e==null?void 0:e.confirmButton)!=null?s:FX,inputPlaceholder:(l=e==null?void 0:e.inputPlaceholder)!=null?l:"Paste link...",onCopyLink:(O=e==null?void 0:e.onCopyLink)!=null?O:()=>{}}})}).use(e4e)};function C_e(t,e){t.set(ev.key,{renderLabel:({label:n,listType:r,checked:i})=>{var o,a,s;return i==null?r==="bullet"?(o=e==null?void 0:e.bulletIcon)!=null?o:D4e:n:i?(a=e==null?void 0:e.checkBoxCheckedIcon)!=null?a:G4e:(s=e==null?void 0:e.checkBoxUncheckedIcon)!=null?s:B4e}})}const E_e=(t,e)=>{t.config(Ma(Wt.ListItem)).config(n=>C_e(n,e)).use(a4e)};function q_e(t){var e;return t.childCount<=1&&!((e=t.firstChild)!=null&&e.content.size)}function Z_e(t,e){const{selection:n}=t;if(!n.empty)return null;const r=n.$anchor,i=r.parent;if(i.content.size>0||Ss(s=>s.type.name==="table")(r))return null;const a=r.before();return tr.node(a,a+i.nodeSize,{class:"crepe-placeholder","data-placeholder":e})}const o7=Lt({text:"Please enter...",mode:"block"},"placeholderConfigCtx"),Y_e=Gn(t=>new dn({key:new hn("CREPE_PLACEHOLDER"),props:{decorations:e=>{var n;if(l_e(t).readonly)return null;const i=t.get(o7.key);if(i.mode==="doc"&&!q_e(e.doc)||bD(e.selection)||SD(e.selection))return null;const o=(n=i.text)!=null?n:"Please enter...",a=Z_e(e,o);return a?cn.create(e.doc,[a]):null}}})),V_e=(t,e)=>{t.config(Ma(Wt.Placeholder)).config(n=>{e&&n.update(o7.key,r=>({...r,...e}))}).use(Y_e).use(o7)},W_e=(t,e)=>{t.config(Ma(Wt.Table)).config(n=>{n.update(tv.key,r=>({...r,renderButton:i=>{var o,a,s,l,O,c,u,f,d;switch(i){case"add_row":return(o=e==null?void 0:e.addRowIcon)!=null?o:KX;case"add_col":return(a=e==null?void 0:e.addColIcon)!=null?a:KX;case"delete_row":return(s=e==null?void 0:e.deleteRowIcon)!=null?s:JX;case"delete_col":return(l=e==null?void 0:e.deleteColIcon)!=null?l:JX;case"align_col_left":return(O=e==null?void 0:e.alignLeftIcon)!=null?O:M4e;case"align_col_center":return(c=e==null?void 0:e.alignCenterIcon)!=null?c:j4e;case"align_col_right":return(u=e==null?void 0:e.alignRightIcon)!=null?u:N4e;case"col_drag_handle":return(f=e==null?void 0:e.colDragHandleIcon)!=null?f:uD;case"row_drag_handle":return(d=e==null?void 0:e.rowDragHandleIcon)!=null?d:uD}}}))}).use(z4e)};function U_e(t,e){var n,r,i,o,a,s,l;const O=new t7;O.addGroup("formatting","Formatting").addItem("bold",{icon:(n=t==null?void 0:t.boldIcon)!=null?n:aD,active:d=>d.get(Ce).call(Cu.key,Tu.type(d)),onRun:d=>{d.get(Ce).call(f0.key)}}).addItem("italic",{icon:(r=t==null?void 0:t.italicIcon)!=null?r:fD,active:d=>d.get(Ce).call(Cu.key,NO.type(d)),onRun:d=>{d.get(Ce).call(u0.key)}}).addItem("strikethrough",{icon:(i=t==null?void 0:t.strikethroughIcon)!=null?i:gD,active:d=>d.get(Ce).call(Cu.key,Nu.type(d)),onRun:d=>{d.get(Ce).call(M0.key)}});const c=O.addGroup("function","Function");c.addItem("code",{icon:(o=t==null?void 0:t.codeIcon)!=null?o:BX,active:d=>d.get(Ce).call(Cu.key,Ca.type(d)),onRun:d=>{d.get(Ce).call(d0.key)}});const u=e&&Th(e).get();return(u==null?void 0:u.includes(Wt.Latex))&&c.addItem("latex",{icon:(a=t==null?void 0:t.latexIcon)!=null?a:e7,active:d=>d.get(Ce).call(DV.key,_g.type(d)),onRun:d=>{d.get(Ce).call(RD.key)}}),c.addItem("link",{icon:(s=t==null?void 0:t.linkIcon)!=null?s:dD,active:d=>d.get(Ce).call(Cu.key,mo.type(d)),onRun:d=>{d.get(Ce).call(qX.key)}}),(l=t==null?void 0:t.buildToolbar)==null||l.call(t,O),O.build()}af(B,mn);const A_e=kr({props:{ctx:{type:Object,required:!0},hide:{type:Function,required:!0},show:{type:Object,required:!0},selection:{type:Object,required:!0},config:{type:Object,required:!1}},setup(t){const{ctx:e,config:n}=t,r=a=>s=>{s.preventDefault(),e&&(a==null||a(e))};function i(a){return af(t.selection.value),e.get(Ty).status!==Kr.Created?!1:a(e)}const o=Iu(()=>U_e(n,e));return()=>B(mn,null,o.value.map(a=>a.items.map(s=>B("button",{type:"button",class:Pr("toolbar-item",e&&i(s.active)&&"active"),onPointerdown:r(s.onRun)},B(JO,{icon:s.icon})))).reduce((a,s,l)=>(l===0?a.push(...s):a.push(B("div",{class:"divider"}),...s),a),[]))}});var qD=t=>{throw TypeError(t)},ZD=(t,e,n)=>e.has(t)||qD("Cannot "+n),ko=(t,e,n)=>(ZD(t,e,"read from private field"),n?n.call(t):e.get(t)),Cg=(t,e,n)=>e.has(t)?qD("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),mv=(t,e,n,r)=>(ZD(t,e,"write to private field"),e.set(t,n),n),Qc,Eg,gv,qg,Zg;const YD=AS("CREPE_TOOLBAR");class I_e{constructor(e,n,r){Cg(this,Qc),Cg(this,Eg),Cg(this,gv),Cg(this,qg),Cg(this,Zg,je(!1)),this.update=(a,s)=>{ko(this,Qc).update(a,s),ko(this,qg).value=a.state.selection},this.destroy=()=>{ko(this,Qc).destroy(),ko(this,gv).unmount(),ko(this,Eg).remove()},this.hide=()=>{ko(this,Qc).hide()};const i=document.createElement("div");i.className="milkdown-toolbar",mv(this,qg,Ob(n.state.selection));const o=Ho(A_e,{ctx:e,hide:this.hide,config:r,selection:ko(this,qg),show:ko(this,Zg)});o.mount(i),mv(this,Eg,i),mv(this,gv,o),mv(this,Qc,new US({content:ko(this,Eg),debounce:20,offset:10,shouldShow(a){const{doc:s,selection:l}=a.state,{empty:O,from:c,to:u}=l,f=!s.textBetween(c,u).length&&l instanceof Le,d=!(l instanceof Le),h=a.dom.getRootNode().activeElement,p=i.contains(h),m=!a.hasFocus()&&!p,g=!a.editable;return!(m||d||O||f||g)}})),ko(this,Qc).onShow=()=>{ko(this,Zg).value=!0},ko(this,Qc).onHide=()=>{ko(this,Zg).value=!1},this.update(n)}}Qc=new WeakMap,Eg=new WeakMap,gv=new WeakMap,qg=new WeakMap,Zg=new WeakMap;const j_e=(t,e)=>{t.config(Ma(Wt.Toolbar)).config(n=>{n.set(YD.key,{view:r=>new I_e(n,r,e)})}).use(YD)},VD=[{label:"Paragraph",level:null},{label:"Heading 1",level:1},{label:"Heading 2",level:2},{label:"Heading 3",level:3},{label:"Heading 4",level:4},{label:"Heading 5",level:5},{label:"Heading 6",level:6}];function M_e(t,e){var n,r;const i=e??VD,o=t.get(Nt),{$from:a}=o.state.selection,s=a.parent,l=(n=i.find(O=>O.level===null))!=null?n:i[0];if(s.type===gi.type(t)){const O=s.attrs.level;return(r=i.find(c=>c.level===O))!=null?r:l}return l}function N_e(t,e){const n=t.get(Ce);if(e==null){const r=go.type(t);n.call(Fo.key,{nodeType:r})}else{const r=gi.type(t);n.call(Fo.key,{nodeType:r,attrs:{level:e}})}}function uf(t,e){if(t.get(Ce).call(Cu.key,e))return!0;const i=t.get(Nt),{state:o}=i;if(o.storedMarks)return o.storedMarks.some(a=>a.type===e);if(o.selection instanceof Le){const{$cursor:a}=o.selection;if(a)return a.marks().some(s=>s.type===e)}return!1}function D_e(t,e){const n=t??VD;return{icon:"",active:()=>!1,selector:{chevronIcon:e??GX,activeLabel:r=>M_e(r,n).label,options:n.map(r=>({label:r.label,onSelect:i=>N_e(i,r.level)}))}}}function L_e(t,e){var n,r,i,o,a,s,l,O,c,u,f,d,h,p,m;const g=e&&Th(e).get(),Q=g==null?void 0:g.includes(Wt.Latex),b=g==null?void 0:g.includes(Wt.ImageBlock),P=g==null?void 0:g.includes(Wt.Table),v=new t7;v.addGroup("heading","Heading").addItem("heading-selector",{...D_e(t==null?void 0:t.headingOptions,t==null?void 0:t.chevronDownIcon)}),v.addGroup("formatting","Formatting").addItem("bold",{icon:(n=t==null?void 0:t.boldIcon)!=null?n:aD,active:X=>uf(X,Tu.type(X)),onRun:X=>{X.get(Ce).call(f0.key)}}).addItem("italic",{icon:(r=t==null?void 0:t.italicIcon)!=null?r:fD,active:X=>uf(X,NO.type(X)),onRun:X=>{X.get(Ce).call(u0.key)}}).addItem("strikethrough",{icon:(i=t==null?void 0:t.strikethroughIcon)!=null?i:gD,active:X=>uf(X,Nu.type(X)),onRun:X=>{X.get(Ce).call(M0.key)}}).addItem("code",{icon:(o=t==null?void 0:t.codeIcon)!=null?o:BX,active:X=>uf(X,Ca.type(X)),onRun:X=>{const T=X.get(Nt),{state:C}=T;if(C.selection.empty){const W=Ca.type(X);uf(X,W)?T.dispatch(C.tr.removeStoredMark(W)):T.dispatch(C.tr.addStoredMark(W.create()))}else X.get(Ce).call(d0.key)}}),v.addGroup("list","List").addItem("bullet-list",{icon:(a=t==null?void 0:t.bulletListIcon)!=null?a:sD,active:()=>!1,onRun:X=>{const T=X.get(Ce),C=LO.type(X);T.call(Tl.key,{nodeType:C})}}).addItem("ordered-list",{icon:(s=t==null?void 0:t.orderedListIcon)!=null?s:hD,active:()=>!1,onRun:X=>{const T=X.get(Ce),C=GO.type(X);T.call(Tl.key,{nodeType:C})}}).addItem("task-list",{icon:(l=t==null?void 0:t.taskListIcon)!=null?l:QD,active:()=>!1,onRun:X=>{const T=X.get(Ce),C=Bo.type(X);T.call(Tl.key,{nodeType:C,attrs:{checked:!1}})}});const w=v.addGroup("insert","Insert");w.addItem("link",{icon:(O=t==null?void 0:t.linkIcon)!=null?O:dD,active:X=>uf(X,mo.type(X)),onRun:X=>{const T=X.get(Nt),{state:C}=T,W=mo.type(X);if(C.selection.empty&&uf(X,W)){T.dispatch(C.tr.removeStoredMark(W));return}X.get(Ce).call(qX.key)}}),b&&w.addItem("image",{icon:(c=t==null?void 0:t.imageIcon)!=null?c:ov,active:()=>!1,onRun:X=>{const T=X.get(Ce),C=I0.type(X);T.call(_l.key,{nodeType:C})}}),P&&w.addItem("table",{icon:(u=t==null?void 0:t.tableIcon)!=null?u:$D,active:()=>!1,onRun:X=>{const T=X.get(Ce),C=X.get(Nt),{from:W}=C.state.selection;T.call(_l.key,{nodeType:Vb(X,3,3)}),T.call(b4.key,{pos:W})}});const k=v.addGroup("block","Block");return k.addItem("code-block",{icon:(f=t==null?void 0:t.codeBlockIcon)!=null?f:F4e,active:()=>!1,onRun:X=>{const T=X.get(Ce),C=Go.type(X);T.call(Fo.key,{nodeType:C})}}),Q&&k.addItem("math",{icon:(d=t==null?void 0:t.mathIcon)!=null?d:e7,active:()=>!1,onRun:X=>{const T=X.get(Ce),C=Go.type(X);T.call(_l.key,{nodeType:C,attrs:{language:"LaTeX"}})}}),v.addGroup("more","More").addItem("quote",{icon:(h=t==null?void 0:t.quoteIcon)!=null?h:pD,active:()=>!1,onRun:X=>{const T=X.get(Ce),C=_u.type(X);T.call(Tl.key,{nodeType:C})}}).addItem("hr",{icon:(p=t==null?void 0:t.hrIcon)!=null?p:cD,active:()=>!1,onRun:X=>{const T=X.get(Ce),C=zu.type(X);T.call(_l.key,{nodeType:C})}}),(m=t==null?void 0:t.buildTopBar)==null||m.call(t,v),v.build()}af(B,mn);const G_e=kr({props:{ctx:{type:Object,required:!0},version:{type:Object,required:!0},config:{type:Object,required:!1}},setup(t){const{ctx:e,config:n}=t,r=je(null),i=h=>p=>{p.preventDefault(),e&&h(e)};function o(){return e.get(Ty).status===Kr.Created}function a(){af(t.version.value)}function s(h){return a(),o()?h(e):!1}function l(h){var p,m;return a(),o()?h.activeLabel(e):(m=(p=h.options[0])==null?void 0:p.label)!=null?m:""}function O(h,p){p.preventDefault(),p.stopPropagation(),r.value=r.value===h?null:h}const c=h=>{h.target.closest(".top-bar-heading-selector")||(r.value=null)};Ld(()=>{window.addEventListener("pointerdown",c)}),Gd(()=>{window.removeEventListener("pointerdown",c)});const u=Iu(()=>L_e(n,e));function f(h,p){const m=r.value===h,g=l(p);return B("div",{key:h,class:"top-bar-heading-selector"},B("button",{type:"button",class:"top-bar-heading-button",onPointerdown:Q=>O(h,Q)},B("span",{class:"top-bar-heading-label"},g),p.chevronIcon&&B("span",{class:"top-bar-chevron"},B(JO,{icon:p.chevronIcon}))),m&&B("div",{class:"top-bar-heading-dropdown"},p.options.map((Q,b)=>B("button",{key:`${h}-${b}`,type:"button",class:Pr("top-bar-heading-option",g===Q.label&&"active"),onPointerdown:P=>{P.preventDefault(),P.stopPropagation(),r.value=null,Q.onSelect(e)}},Q.label))))}function d(h){return B("button",{key:h.key,type:"button",class:Pr("top-bar-item",s(h.active)&&"active"),onPointerdown:i(h.onRun)},B(JO,{icon:h.icon}))}return()=>{const h=o()?e.get(Nt):null;return(h?!h.editable:!1)?null:B("div",{class:"top-bar-inner"},u.value.map(m=>m.items.map(g=>g.selector?f(g.key,g.selector):g.onRun?d(g):null)).reduce((m,g,Q)=>{var b,P;if(Q===0)m.push(...g);else{const v=(P=(b=u.value[Q])==null?void 0:b.key)!=null?P:Q;m.push(B("div",{key:`divider-${v}`,class:"top-bar-divider"}),...g)}return m},[]))}}});var WD=t=>{throw TypeError(t)},UD=(t,e,n)=>e.has(t)||WD("Cannot "+n),Yg=(t,e,n)=>(UD(t,e,"read from private field"),n?n.call(t):e.get(t)),a7=(t,e,n)=>e.has(t)?WD("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),s7=(t,e,n,r)=>(UD(t,e,"write to private field"),e.set(t,n),n),Vg,$v,Wg;const B_e=new hn("CREPE_TOP_BAR");class F_e{constructor(e,n,r){a7(this,Vg),a7(this,$v),a7(this,Wg),this.update=(s,l)=>{Yg(this,Vg).style.display=s.editable?"":"none",Yg(this,Wg).value++},this.destroy=()=>{Yg(this,$v).unmount(),Yg(this,Vg).remove()},s7(this,Wg,je(0));const i=document.createElement("div");i.className="milkdown-top-bar";const o=Ho(G_e,{ctx:e,config:r,version:Yg(this,Wg)});o.mount(i),s7(this,Vg,i),s7(this,$v,o);const a=n.dom.parentElement;a&&a.insertBefore(i,a.firstChild),this.update(n)}}Vg=new WeakMap,$v=new WeakMap,Wg=new WeakMap;const l7=Lt({view:()=>({update:()=>{},destroy:()=>{}})},"topBarConfig"),H_e=Gn(t=>{const e=t.get(l7.key);return new dn({key:B_e,view:e.view})}),K_e=(t,e)=>{t.config(Ma(Wt.TopBar)).config(n=>{n.set(l7.key,{view:r=>new F_e(n,r,e)})}).use(l7).use(H_e)};function J_e(t,e,n){switch(t){case Wt.CodeMirror:return Q_e(e,n);case Wt.ListItem:return E_e(e,n);case Wt.LinkTooltip:return z_e(e,n);case Wt.ImageBlock:return b_e(e,n);case Wt.Cursor:return y_e(e,n);case Wt.BlockEdit:return $_e(e,n);case Wt.Placeholder:return V_e(e,n);case Wt.Toolbar:return j_e(e,n);case Wt.Table:return W_e(e,n);case Wt.Latex:return X_e(e,n);case Wt.TopBar:return K_e(e,n)}}var AD=t=>{throw TypeError(t)},ID=(t,e,n)=>e.has(t)||AD("Cannot "+n),Po=(t,e,n)=>(ID(t,e,"read from private field"),n?n.call(t):e.get(t)),O7=(t,e,n)=>e.has(t)?AD("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),c7=(t,e,n,r)=>(ID(t,e,"write to private field"),e.set(t,n),n),xo,Qv,Ug;class e2e{constructor({root:e,defaultValue:n=""}={}){O7(this,xo),O7(this,Qv),O7(this,Ug,!0),this.addFeature=(i,o)=>(i(Po(this,xo),o),this),this.create=()=>Po(this,xo).create(),this.destroy=()=>Po(this,xo).destroy(),this.setReadonly=i=>(c7(this,Ug,!i),Po(this,xo).action(o=>{Po(this,xo).status===Kr.Created&&o.get(Nt).setProps({editable:()=>!i})}),this),this.getMarkdown=()=>Po(this,xo).action(M0e()),this.on=i=>Po(this,xo).status!==Kr.Created?(Po(this,xo).config(o=>{const a=o.get(iv);i(a)}),this):(Po(this,xo).action(o=>{const a=o.get(iv);i(a)}),this);var r;c7(this,Qv,(r=typeof e=="string"?document.querySelector(e):e)!=null?r:document.body),c7(this,xo,A0e.make().config(i=>{i.inject(s_e,this),i.inject(a_e,[])}).config(i=>{i.set(Zy,Po(this,Qv)),i.set(zy,n),i.set(o0,{editable:()=>Po(this,Ug)}),i.update(rv.key,o=>({...o,size:4})),i.update(xh.key,o=>({...o,uploader:async(a,s,l)=>{const c=Th(l).get().includes(Wt.ImageBlock),u=c?s.nodes["image-block"]:s.nodes.image;if(!u)return[];const f=c?l.get(A0.key).onUpload:void 0,d=[];for(let p=0;p<a.length;p++){const m=a.item(p);m&&m.type.includes("image")&&d.push(m)}return await Promise.all(d.map(async p=>{const m=f?await f(p):URL.createObjectURL(p);return u.createAndFill({src:m})}))}}))}).use(n$e).use(rD).use(E4e).use(Z4e).use(V4e).use(JN).use(A4e).use(zve))}get editor(){return Po(this,xo)}get readonly(){return!Po(this,Ug)}}xo=new WeakMap,Qv=new WeakMap,Ug=new WeakMap;class jD extends e2e{constructor({features:e={},featureConfigs:n={},...r}={}){super(r);const i=eae(n,o_e);Object.entries({...I4e,...e}).filter(([,a])=>a).map(([a])=>a).forEach(a=>{const s=i[a];J_e(a,this.editor,s)})}}jD.Feature=Wt;class t2e{constructor(e){kn(this,"root");kn(this,"onChange");kn(this,"content");kn(this,"readOnly");kn(this,"crepe",null);kn(this,"suppressChanges",!1);this.root=e.root,this.onChange=e.onChange,this.content=e.content,this.readOnly=e.readOnly}async mount(){await this.render(this.content),this.setReadOnly(this.readOnly)}async replaceContent(e){if(e===this.content)return;this.content=e;const n=this.readOnly;await this.render(e),this.setReadOnly(n)}setReadOnly(e){var n;this.readOnly=e,(n=this.crepe)==null||n.setReadonly(e)}async render(e){this.suppressChanges=!0,this.crepe&&(await this.crepe.destroy(),this.root.innerHTML=""),this.crepe=new jD({root:this.root,defaultValue:e}),this.crepe.on(n=>{n.markdownUpdated((r,i)=>{this.content=i,this.suppressChanges||this.onChange(i)})}),await this.crepe.create(),this.suppressChanges=!1,this.content=e}}class n2e extends HTMLElement{constructor(){super(...arguments);kn(this,"bootstrap",null);kn(this,"client",pre({createSocket:()=>{var n;return new WebSocket(((n=this.bootstrap)==null?void 0:n.websocketUrl)??"")}}));kn(this,"editor",null);kn(this,"saveTimer",null);kn(this,"titleText","Markdown");kn(this,"statusText","Connecting...");kn(this,"overlayVisible",!0);kn(this,"overlayText","Connecting to the markdown session...")}connectedCallback(){if(this.bootstrap={artifactId:this.dataset.artifactId??"",websocketUrl:this.dataset.websocketUrl??""},!this.bootstrap)throw new Error("Editable markdown bootstrap config missing");if(!this.bootstrap.artifactId||!this.bootstrap.websocketUrl)throw new Error("Editable markdown element is missing required bootstrap data attributes");this.client.addEventListener("document-ready",r=>{var i;this.titleText=r.title,(i=this.editor)==null||i.replaceContent(r.content),this.updateView()}),this.client.addEventListener("document-update",r=>{var i;typeof r.title=="string"&&(this.titleText=r.title),typeof r.content=="string"&&((i=this.editor)==null||i.replaceContent(r.content)),this.updateView()}),this.client.addEventListener("document-saved",r=>{this.statusText=`Saved ${new Date(r.savedAt).toLocaleTimeString()}`,this.updateView()}),this.client.addEventListener("error",r=>{const i=document.createElement("div");i.className="editable-markdown-flash",i.textContent=r.message,document.body.append(i),window.setTimeout(()=>i.remove(),4e3)}),this.client.addEventListener("connection",r=>{var i,o,a;switch(r.state){case"connecting":this.statusText="Connecting...",this.overlayVisible=!0,this.overlayText="Connecting to the markdown session...",(i=this.editor)==null||i.setReadOnly(!0);break;case"connected":this.statusText="Live",this.overlayVisible=!1,(o=this.editor)==null||o.setReadOnly(!1);break;case"disconnected":this.statusText=r.retryInMs===null?"Disconnected":`Retrying in ${Math.ceil(r.retryInMs/1e3)}s`,this.overlayVisible=!0,this.overlayText=r.retryInMs===null?"The connection is unavailable.":`Retrying in ${Math.ceil(r.retryInMs/1e3)} second${Math.ceil(r.retryInMs/1e3)===1?"":"s"}.`,(a=this.editor)==null||a.setReadOnly(!0);break}this.updateView()}),this.updateView();const n=this.querySelector(".editable-markdown-editor-root");if(!n)throw new Error("Editable markdown root missing");this.editor=new t2e({root:n,content:"",readOnly:!0,onChange:r=>{this.saveTimer!==null&&clearTimeout(this.saveTimer),this.saveTimer=window.setTimeout(()=>{this.saveTimer=null,this.client.sendDocument(r)},300)}}),this.editor.mount(),this.client.connect()}disconnectedCallback(){this.client.disconnect()}updateView(){nre(Bne`
|
|
948
|
+
`,o_e={[Wt.CodeMirror]:{theme:Pce,languages:pce,expandIcon:GX,searchIcon:mD,clearSearchIcon:lD,searchPlaceholder:"Search language",noResultText:"No result",previewToggleIcon:t=>t?HX:yD}},a_e=xt([],"FeaturesCtx"),s_e=xt({},"CrepeCtx");function l_e(t){return t.get("CrepeCtx")}function Th(t){return t.use("FeaturesCtx")}function Ma(t){return e=>{Th(e).update(n=>n.includes(t)?n:[...n,t])}}function bD(t){return t.$from.parent.type.name==="code_block"}function SD(t){var e;const n=(e=t.$from.node(t.$from.depth-1))==null?void 0:e.type;return(n==null?void 0:n.name)==="list_item"}var vD=t=>{throw TypeError(t)},wD=(t,e,n)=>e.has(t)||vD("Cannot "+n),kg=(t,e,n)=>(wD(t,e,"read from private field"),n?n.call(t):e.get(t)),kD=(t,e,n)=>e.has(t)?vD("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),O_e=(t,e,n,r)=>(wD(t,e,"write to private field"),e.set(t,n),n),_h,av;class t7{constructor(){kD(this,_h,[]),this.clear=()=>(O_e(this,_h,[]),this),kD(this,av,e=>{const n={group:e,addItem:(r,i)=>{const o={...i,key:r};return e.items.push(o),n},clear:()=>(e.items=[],n)};return n}),this.addGroup=(e,n)=>{const i={key:e,label:n,items:[]};return kg(this,_h).push(i),kg(this,av).call(this,i)},this.getGroup=e=>{const n=kg(this,_h).find(r=>r.key===e);if(!n)throw new Error(`Group with key ${e} not found`);return kg(this,av).call(this,n)},this.build=()=>kg(this,_h)}}_h=new WeakMap,av=new WeakMap;function af(...t){}function c_e(t,e,n){var r,i,o,a,s,l,O,c,u,f,d,h,p,m,g,Q,b,P,v,w,k,X,T,C,W,I,F,E,D,G,M,K,ae,z,te,we,q,wt,ie,ke,et,dt,Rt,rn,ir,U,N,ee,le,ce,fe,Se,Qe,pe,ue,Ge,Pe,Re,De,H,oe,Te,Ue,it,Je,wn,Qn,Kn,qt,Zt,dr,sn,xp,ba,dO,Yc,hr,Hf,Tp,Kt,rs,Kf,Vc,Wc,Sa,io,is,li,Cr,Jf,Uc,as,zi,Nr,ed,Ac,td,ll,nd,Fe,j,ge,Me,ln,or,Xn,_,Y,ne,_e,Xe,kt,At,Oi,Ci,Ic,_ne,Xne,Rne;const _p=n&&Th(n).get(),BGe=_p==null?void 0:_p.includes(Wt.Latex),FGe=_p==null?void 0:_p.includes(Wt.ImageBlock),HGe=_p==null?void 0:_p.includes(Wt.Table),X1=new t7;if((e==null?void 0:e.textGroup)!==null){const on=X1.addGroup("text",(i=(r=e==null?void 0:e.textGroup)==null?void 0:r.label)!=null?i:"Text");((o=e==null?void 0:e.textGroup)==null?void 0:o.text)!==null&&on.addItem("text",{label:(l=(s=(a=e==null?void 0:e.textGroup)==null?void 0:a.text)==null?void 0:s.label)!=null?l:"Text",icon:(u=(c=(O=e==null?void 0:e.textGroup)==null?void 0:O.text)==null?void 0:c.icon)!=null?u:i_e,onRun:nt=>{const ot=nt.get(Ce),Jt=go.type(nt);ot.call(Ir.key),ot.call(Fo.key,{nodeType:Jt})}}),((f=e==null?void 0:e.textGroup)==null?void 0:f.h1)!==null&&on.addItem("h1",{label:(p=(h=(d=e==null?void 0:e.textGroup)==null?void 0:d.h1)==null?void 0:h.label)!=null?p:"Heading 1",icon:(Q=(g=(m=e==null?void 0:e.textGroup)==null?void 0:m.h1)==null?void 0:g.icon)!=null?Q:H4e,onRun:nt=>{const ot=nt.get(Ce),Jt=gi.type(nt);ot.call(Ir.key),ot.call(Fo.key,{nodeType:Jt,attrs:{level:1}})}}),((b=e==null?void 0:e.textGroup)==null?void 0:b.h2)!==null&&on.addItem("h2",{label:(w=(v=(P=e==null?void 0:e.textGroup)==null?void 0:P.h2)==null?void 0:v.label)!=null?w:"Heading 2",icon:(T=(X=(k=e==null?void 0:e.textGroup)==null?void 0:k.h2)==null?void 0:X.icon)!=null?T:K4e,onRun:nt=>{const ot=nt.get(Ce),Jt=gi.type(nt);ot.call(Ir.key),ot.call(Fo.key,{nodeType:Jt,attrs:{level:2}})}}),((C=e==null?void 0:e.textGroup)==null?void 0:C.h3)!==null&&on.addItem("h3",{label:(F=(I=(W=e==null?void 0:e.textGroup)==null?void 0:W.h3)==null?void 0:I.label)!=null?F:"Heading 3",icon:(G=(D=(E=e==null?void 0:e.textGroup)==null?void 0:E.h3)==null?void 0:D.icon)!=null?G:J4e,onRun:nt=>{const ot=nt.get(Ce),Jt=gi.type(nt);ot.call(Ir.key),ot.call(Fo.key,{nodeType:Jt,attrs:{level:3}})}}),((M=e==null?void 0:e.textGroup)==null?void 0:M.h4)!==null&&on.addItem("h4",{label:(z=(ae=(K=e==null?void 0:e.textGroup)==null?void 0:K.h4)==null?void 0:ae.label)!=null?z:"Heading 4",icon:(q=(we=(te=e==null?void 0:e.textGroup)==null?void 0:te.h4)==null?void 0:we.icon)!=null?q:e_e,onRun:nt=>{const ot=nt.get(Ce),Jt=gi.type(nt);ot.call(Ir.key),ot.call(Fo.key,{nodeType:Jt,attrs:{level:4}})}}),((wt=e==null?void 0:e.textGroup)==null?void 0:wt.h5)!==null&&on.addItem("h5",{label:(et=(ke=(ie=e==null?void 0:e.textGroup)==null?void 0:ie.h5)==null?void 0:ke.label)!=null?et:"Heading 5",icon:(rn=(Rt=(dt=e==null?void 0:e.textGroup)==null?void 0:dt.h5)==null?void 0:Rt.icon)!=null?rn:t_e,onRun:nt=>{const ot=nt.get(Ce),Jt=gi.type(nt);ot.call(Ir.key),ot.call(Fo.key,{nodeType:Jt,attrs:{level:5}})}}),((ir=e==null?void 0:e.textGroup)==null?void 0:ir.h6)!==null&&on.addItem("h6",{label:(ee=(N=(U=e==null?void 0:e.textGroup)==null?void 0:U.h6)==null?void 0:N.label)!=null?ee:"Heading 6",icon:(fe=(ce=(le=e==null?void 0:e.textGroup)==null?void 0:le.h6)==null?void 0:ce.icon)!=null?fe:n_e,onRun:nt=>{const ot=nt.get(Ce),Jt=gi.type(nt);ot.call(Ir.key),ot.call(Fo.key,{nodeType:Jt,attrs:{level:6}})}}),((Se=e==null?void 0:e.textGroup)==null?void 0:Se.quote)!==null&&on.addItem("quote",{label:(ue=(pe=(Qe=e==null?void 0:e.textGroup)==null?void 0:Qe.quote)==null?void 0:pe.label)!=null?ue:"Quote",icon:(Re=(Pe=(Ge=e==null?void 0:e.textGroup)==null?void 0:Ge.quote)==null?void 0:Pe.icon)!=null?Re:pD,onRun:nt=>{const ot=nt.get(Ce),Jt=_u.type(nt);ot.call(Ir.key),ot.call(Tl.key,{nodeType:Jt})}}),((De=e==null?void 0:e.textGroup)==null?void 0:De.divider)!==null&&on.addItem("divider",{label:(Te=(oe=(H=e==null?void 0:e.textGroup)==null?void 0:H.divider)==null?void 0:oe.label)!=null?Te:"Divider",icon:(Je=(it=(Ue=e==null?void 0:e.textGroup)==null?void 0:Ue.divider)==null?void 0:it.icon)!=null?Je:cD,onRun:nt=>{const ot=nt.get(Ce),Jt=zu.type(nt);ot.call(Ir.key),ot.call(_l.key,{nodeType:Jt})}})}if((e==null?void 0:e.listGroup)!==null){const on=X1.addGroup("list",(Qn=(wn=e==null?void 0:e.listGroup)==null?void 0:wn.label)!=null?Qn:"List");((Kn=e==null?void 0:e.listGroup)==null?void 0:Kn.bulletList)!==null&&on.addItem("bullet-list",{label:(dr=(Zt=(qt=e==null?void 0:e.listGroup)==null?void 0:qt.bulletList)==null?void 0:Zt.label)!=null?dr:"Bullet List",icon:(ba=(xp=(sn=e==null?void 0:e.listGroup)==null?void 0:sn.bulletList)==null?void 0:xp.icon)!=null?ba:sD,onRun:nt=>{const ot=nt.get(Ce),Jt=LO.type(nt);ot.call(Ir.key),ot.call(Tl.key,{nodeType:Jt})}}),((dO=e==null?void 0:e.listGroup)==null?void 0:dO.orderedList)!==null&&on.addItem("ordered-list",{label:(Hf=(hr=(Yc=e==null?void 0:e.listGroup)==null?void 0:Yc.orderedList)==null?void 0:hr.label)!=null?Hf:"Ordered List",icon:(rs=(Kt=(Tp=e==null?void 0:e.listGroup)==null?void 0:Tp.orderedList)==null?void 0:Kt.icon)!=null?rs:hD,onRun:nt=>{const ot=nt.get(Ce),Jt=GO.type(nt);ot.call(Ir.key),ot.call(Tl.key,{nodeType:Jt})}}),((Kf=e==null?void 0:e.listGroup)==null?void 0:Kf.taskList)!==null&&on.addItem("task-list",{label:(Sa=(Wc=(Vc=e==null?void 0:e.listGroup)==null?void 0:Vc.taskList)==null?void 0:Wc.label)!=null?Sa:"Task List",icon:(li=(is=(io=e==null?void 0:e.listGroup)==null?void 0:io.taskList)==null?void 0:is.icon)!=null?li:QD,onRun:nt=>{const ot=nt.get(Ce),Jt=Bo.type(nt);ot.call(Ir.key),ot.call(Tl.key,{nodeType:Jt,attrs:{checked:!1}})}})}if((e==null?void 0:e.advancedGroup)!==null){const on=X1.addGroup("advanced",(Jf=(Cr=e==null?void 0:e.advancedGroup)==null?void 0:Cr.label)!=null?Jf:"Advanced");((Uc=e==null?void 0:e.advancedGroup)==null?void 0:Uc.image)!==null&&FGe&&on.addItem("image",{label:(Nr=(zi=(as=e==null?void 0:e.advancedGroup)==null?void 0:as.image)==null?void 0:zi.label)!=null?Nr:"Image",icon:(td=(Ac=(ed=e==null?void 0:e.advancedGroup)==null?void 0:ed.image)==null?void 0:Ac.icon)!=null?td:ov,onRun:nt=>{const ot=nt.get(Ce),Jt=I0.type(nt);ot.call(Ir.key),ot.call(_l.key,{nodeType:Jt})}}),((ll=e==null?void 0:e.advancedGroup)==null?void 0:ll.codeBlock)!==null&&on.addItem("code",{label:(j=(Fe=(nd=e==null?void 0:e.advancedGroup)==null?void 0:nd.codeBlock)==null?void 0:Fe.label)!=null?j:"Code",icon:(ln=(Me=(ge=e==null?void 0:e.advancedGroup)==null?void 0:ge.codeBlock)==null?void 0:Me.icon)!=null?ln:BX,onRun:nt=>{const ot=nt.get(Ce),Jt=Go.type(nt);ot.call(Ir.key),ot.call(Fo.key,{nodeType:Jt})}}),((or=e==null?void 0:e.advancedGroup)==null?void 0:or.table)!==null&&HGe&&on.addItem("table",{label:(Y=(_=(Xn=e==null?void 0:e.advancedGroup)==null?void 0:Xn.table)==null?void 0:_.label)!=null?Y:"Table",icon:(Xe=(_e=(ne=e==null?void 0:e.advancedGroup)==null?void 0:ne.table)==null?void 0:_e.icon)!=null?Xe:$D,onRun:nt=>{const ot=nt.get(Ce),Jt=nt.get(Nt);ot.call(Ir.key);const{from:KGe}=Jt.state.selection;ot.call(_l.key,{nodeType:Vb(nt,3,3)}),ot.call(b4.key,{pos:KGe})}}),((kt=e==null?void 0:e.advancedGroup)==null?void 0:kt.math)!==null&&BGe&&on.addItem("math",{label:(Ci=(Oi=(At=e==null?void 0:e.advancedGroup)==null?void 0:At.math)==null?void 0:Oi.label)!=null?Ci:"Math",icon:(Xne=(_ne=(Ic=e==null?void 0:e.advancedGroup)==null?void 0:Ic.math)==null?void 0:_ne.icon)!=null?Xne:e7,onRun:nt=>{const ot=nt.get(Ce),Jt=Go.type(nt);ot.call(Ir.key),ot.call(_l.key,{nodeType:Jt,attrs:{language:"LaTeX"}})}})}(Rne=e==null?void 0:e.buildMenu)==null||Rne.call(e,X1);let R1=X1.build();t&&(R1=R1.map(on=>{const nt=on.items.filter(ot=>ot.label.toLowerCase().includes(t.toLowerCase()));return{...on,items:nt}}).filter(on=>on.items.length>0));const zne=R1.flatMap(on=>on.items);return zne.forEach((on,nt)=>{Object.assign(on,{index:nt})}),R1.reduce((on,nt)=>{const ot=on+nt.items.length;return Object.assign(nt,{range:[on,ot]}),ot},0),{groups:R1,size:zne.length}}af(B);const u_e=kr({props:{ctx:{type:Object,required:!0},show:{type:Object,required:!0},filter:{type:Object,required:!0},hide:{type:Function,required:!0},config:{type:Object,required:!1}},setup({ctx:t,show:e,filter:n,hide:r,config:i}){const o=je(),a=Iu(()=>c_e(n.value,i,t)),s=je(0),l=je({x:-999,y:-999}),O=p=>{const{x:m,y:g}=p;l.value={x:m,y:g}};Wu([a,e],()=>{const{size:p}=a.value;p===0&&e.value?r():s.value>=p&&(s.value=0)});const c=(p,m)=>{const g=s.value,Q=typeof p=="function"?p(g):p;m==null||m(Q),s.value=Q},u=p=>{var m,g;const Q=(m=o.value)==null?void 0:m.querySelector(`[data-index="${p}"]`),b=(g=o.value)==null?void 0:g.querySelector(".menu-groups");!Q||!b||(b.scrollTop=Q.offsetTop-b.offsetTop)},f=p=>{const m=a.value.groups.flatMap(g=>g.items).at(p);m!=null&&m.onRun&&t&&m.onRun(t),r()},d=p=>{const{size:m,groups:g}=a.value;if(p.key==="Escape"){p.preventDefault(),r==null||r();return}if(p.key==="ArrowDown")return p.preventDefault(),c(Q=>Q<m-1?Q+1:Q,u);if(p.key==="ArrowUp")return p.preventDefault(),c(Q=>Q<=0?Q:Q-1,u);if(p.key==="ArrowLeft")return p.preventDefault(),c(Q=>{const b=g.find(v=>v.range[0]<=Q&&v.range[1]>Q);if(!b)return Q;const P=g[g.indexOf(b)-1];return P?P.range[1]-1:Q},u);if(p.key==="ArrowRight")return p.preventDefault(),c(Q=>{const b=g.find(v=>v.range[0]<=Q&&v.range[1]>Q);if(!b)return Q;const P=g[g.indexOf(b)+1];return P?P.range[0]:Q},u);p.key==="Enter"&&(p.preventDefault(),f(s.value))},h=p=>m=>{const g=l.value;if(!g)return;const{x:Q,y:b}=m;Q===g.x&&b===g.y||c(p)};return Dd(()=>{e.value?window.addEventListener("keydown",d,{capture:!0}):window.removeEventListener("keydown",d,{capture:!0})}),Gd(()=>{window.removeEventListener("keydown",d,{capture:!0})}),()=>B("div",{ref:o,onPointerdown:p=>p.preventDefault()},B("nav",{class:"tab-group"},B("ul",null,a.value.groups.map(p=>B("li",{key:p.key,onPointerdown:()=>c(p.range[0],u),class:s.value>=p.range[0]&&s.value<p.range[1]?"selected":""},p.label)))),B("div",{class:"menu-groups",onPointermove:O},a.value.groups.map(p=>B("div",{key:p.key,class:"menu-group"},B("h6",null,p.label),B("ul",null,p.items.map(m=>B("li",{key:m.key,"data-index":m.index,class:s.value===m.index?"hover":"",onPointerenter:h(m.index),onPointerdown:()=>{var g,Q;(Q=(g=o.value)==null?void 0:g.querySelector(`[data-index="${m.index}"]`))==null||Q.classList.add("active")},onPointerup:()=>{var g,Q;(Q=(g=o.value)==null?void 0:g.querySelector(`[data-index="${m.index}"]`))==null||Q.classList.remove("active"),f(m.index)}},B(JO,{icon:m.icon}),B("span",null,m.label))))))))}});var PD=t=>{throw TypeError(t)},xD=(t,e,n)=>e.has(t)||PD("Cannot "+n),Na=(t,e,n)=>(xD(t,e,"read from private field"),n?n.call(t):e.get(t)),Pg=(t,e,n)=>e.has(t)?PD("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),sf=(t,e,n,r)=>(xD(t,e,"write to private field"),e.set(t,n),n),xg,sv,lv,Nl,Xh;const TD=AQe("CREPE_MENU"),n7=Lt({show:()=>{},hide:()=>{}},"menuAPICtx");function f_e(t,e){t.set(TD.key,{view:n=>new d_e(t,n,e)})}class d_e{constructor(e,n,r){Pg(this,xg),Pg(this,sv),Pg(this,lv),Pg(this,Nl),Pg(this,Xh,null),this.update=c=>{Na(this,Nl).update(c)},this.show=c=>{sf(this,Xh,c),Na(this,lv).value="",Na(this,Nl).show()},this.hide=()=>{sf(this,Xh,null),Na(this,Nl).hide()},this.destroy=()=>{Na(this,Nl).destroy(),Na(this,sv).unmount(),Na(this,xg).remove()};const i=document.createElement("div");i.classList.add("milkdown-slash-menu");const o=je(!1),a=je("");sf(this,lv,a);const s=this.hide,l=Ho(u_e,{ctx:e,config:r,show:o,filter:a,hide:s});sf(this,sv,l),l.mount(i),sf(this,xg,i);const O=this;sf(this,Nl,new IQe({content:Na(this,xg),debounce:20,shouldShow(c){if(bD(c.state.selection)||SD(c.state.selection))return!1;const u=this.getContent(c,d=>["paragraph","heading"].includes(d.type.name));if(u==null||!h_e(c.state.selection))return!1;const f=Na(O,Xh);if(a.value=u.startsWith("/")?u.slice(1):u,typeof f=="number"){const d=c.state.doc.nodeSize-2,h=Math.min(f,d);return c.state.doc.resolve(h).node()!==c.state.doc.resolve(c.state.selection.from).node()?(sf(O,Xh,null),!1):!0}return!!u.startsWith("/")},offset:10})),Na(this,Nl).onShow=()=>{o.value=!0},Na(this,Nl).onHide=()=>{o.value=!1},this.update(n),e.set(n7.key,{show:c=>this.show(c),hide:()=>this.hide()})}}xg=new WeakMap,sv=new WeakMap,lv=new WeakMap,Nl=new WeakMap,Xh=new WeakMap;function h_e(t){if(!(t instanceof Le))return!1;const{$head:e}=t,n=e.parent;return e.parentOffset===n.content.size}af(B,mn);const p_e=kr({props:{onAdd:{type:Function,required:!0},addIcon:{type:String,required:!0},handleIcon:{type:String,required:!0}},setup(t){const e=je();return()=>B(mn,null,B("div",{ref:e,class:"operation-item",onPointerdown:n=>{var r;n.preventDefault(),n.stopPropagation(),(r=e.value)==null||r.classList.add("active")},onPointerup:n=>{var r;n.preventDefault(),n.stopPropagation(),(r=e.value)==null||r.classList.remove("active"),t.onAdd()}},B(JO,{icon:t.addIcon})),B("div",{class:"operation-item"},B(JO,{icon:t.handleIcon})))}});var _D=t=>{throw TypeError(t)},XD=(t,e,n)=>e.has(t)||_D("Cannot "+n),lf=(t,e,n)=>(XD(t,e,"read from private field"),n?n.call(t):e.get(t)),Ov=(t,e,n)=>e.has(t)?_D("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),cv=(t,e,n,r)=>(XD(t,e,"write to private field"),e.set(t,n),n),uv,Of,fv,dv;class m_e{constructor(e,n){Ov(this,uv),Ov(this,Of),Ov(this,fv),Ov(this,dv),this.update=()=>{lf(this,Of).update()},this.destroy=()=>{lf(this,Of).destroy(),lf(this,uv).remove(),lf(this,fv).unmount()},this.onAdd=()=>{const O=lf(this,dv),c=O.get(Nt);c.hasFocus()||c.focus();const{state:u,dispatch:f}=c,d=lf(this,Of).active;if(!d)return;const p=d.$pos.pos+d.node.nodeSize;let m=u.tr.insert(p,go.type(O).create());m=m.setSelection(Le.near(m.doc.resolve(p))),f(m.scrollIntoView()),lf(this,Of).hide(),O.get(n7.key).show(m.selection.from)};var r,i,o;cv(this,dv,e);const a=document.createElement("div");a.classList.add("milkdown-block-handle");const s=Ho(p_e,{onAdd:this.onAdd,addIcon:(r=n==null?void 0:n.handleAddIcon)!=null?r:KX,handleIcon:(i=n==null?void 0:n.handleDragIcon)!=null?i:r_e});s.mount(a),cv(this,fv,s),cv(this,uv,a);const l=(o=n==null?void 0:n.blockHandle)!=null?o:{};cv(this,Of,new Rge({ctx:e,content:a,getOffset:()=>16,getPlacement:({active:O,blockDom:c})=>{if(O.node.type.name==="heading")return"left";let u=0;O.node.descendants(P=>{u+=P.childCount});const f=O.el,d=f.getBoundingClientRect(),h=c.getBoundingClientRect(),p=window.getComputedStyle(f),m=Number.parseInt(p.paddingTop,10)||0,g=Number.parseInt(p.paddingBottom,10)||0,Q=d.height-m-g,b=h.height;return u>2||b<Q?"left-start":"left"},...l})),this.update()}}uv=new WeakMap,Of=new WeakMap,fv=new WeakMap,dv=new WeakMap;function g_e(t,e){t.set(Gy.key,{filterNodes:n=>!Ss(i=>["table","blockquote","math_inline"].includes(i.type.name))(n)}),t.set(Hy.key,{view:()=>new m_e(t,e)})}const $_e=(t,e)=>{t.config(Ma(Wt.BlockEdit)).config(n=>g_e(n,e)).config(n=>f_e(n,e)).use(n7).use(Hy).use(TD)},Q_e=(t,e={})=>{t.config(Ma(Wt.CodeMirror)).config(n=>{const{languages:r=[],theme:i}=e,o=[eu.of(ZI.concat(Mwe)),LPe];i&&o.push(i),e.extensions&&o.push(...e.extensions),n.update(H0.key,a=>{var s;return{extensions:o,languages:r,expandIcon:e.expandIcon||GX,searchIcon:e.searchIcon||mD,clearSearchIcon:e.clearSearchIcon||lD,searchPlaceholder:e.searchPlaceholder||"Search language",copyText:e.copyText||"Copy",copyIcon:e.copyIcon||OD,onCopy:e.onCopy||(()=>{}),noResultText:e.noResultText||"No result",renderLanguage:e.renderLanguage||a.renderLanguage,renderPreview:e.renderPreview||a.renderPreview,previewToggleButton:l=>{var O,c;const u=((O=e.previewToggleIcon)==null?void 0:O.call(e,l))||(l?HX:yD),f=((c=e.previewToggleText)==null?void 0:c.call(e,l))||(l?"Edit":"Hide");return[u,f].map(d=>d.trim()).join(" ")},previewLabel:e.previewLabel||a.previewLabel,previewLoading:e.previewLoading||a.previewLoading,previewOnlyByDefault:(s=e.previewOnlyByDefault)!=null?s:a.previewOnlyByDefault}})}).use(dke)},y_e=(t,e)=>{if(t.config(Ma(Wt.Cursor)).config(r=>{r.update(lS.key,()=>{var i,o;return{class:"crepe-drop-cursor",width:(i=e==null?void 0:e.width)!=null?i:4,color:(o=e==null?void 0:e.color)!=null?o:!1}})}).use(fxe),(e==null?void 0:e.virtual)===!1)return;const n=dxe();t.use(Gn(()=>n))},b_e=(t,e)=>{t.config(Ma(Wt.ImageBlock)).config(n=>{n.update(OS.key,r=>{var i,o,a,s,l,O;return{uploadButton:(i=e==null?void 0:e.inlineUploadButton)!=null?i:"Upload",imageIcon:(o=e==null?void 0:e.inlineImageIcon)!=null?o:ov,confirmButton:(a=e==null?void 0:e.inlineConfirmButton)!=null?a:FX,uploadPlaceholderText:(s=e==null?void 0:e.inlineUploadPlaceholderText)!=null?s:"or paste link",onUpload:(O=(l=e==null?void 0:e.inlineOnUpload)!=null?l:e==null?void 0:e.onUpload)!=null?O:r.onUpload,proxyDomURL:e==null?void 0:e.proxyDomURL}}),n.update(A0.key,r=>{var i,o,a,s,l,O,c,u,f;return{uploadButton:(i=e==null?void 0:e.blockUploadButton)!=null?i:"Upload file",imageIcon:(o=e==null?void 0:e.blockImageIcon)!=null?o:ov,captionIcon:(a=e==null?void 0:e.blockCaptionIcon)!=null?a:L4e,confirmButton:(s=e==null?void 0:e.blockConfirmButton)!=null?s:"Confirm",captionPlaceholderText:(l=e==null?void 0:e.blockCaptionPlaceholderText)!=null?l:"Write Image Caption",uploadPlaceholderText:(O=e==null?void 0:e.blockUploadPlaceholderText)!=null?O:"or paste link",onUpload:(u=(c=e==null?void 0:e.blockOnUpload)!=null?c:e==null?void 0:e.onUpload)!=null?u:r.onUpload,proxyDomURL:e==null?void 0:e.proxyDomURL,onImageLoadError:(f=e==null?void 0:e.onImageLoadError)!=null?f:r.onImageLoadError,maxWidth:e==null?void 0:e.maxWidth,maxHeight:e==null?void 0:e.maxHeight}})}).use(Xye).use(Pxe)},S_e=Go.extendSchema(t=>e=>{const n=t(e);return{...n,toMarkdown:{match:n.toMarkdown.match,runner:(r,i)=>{var o,a;if(((o=i.attrs.language)!=null?o:"").toLowerCase()==="latex")r.addNode("math",void 0,((a=i.content.firstChild)==null?void 0:a.text)||"");else return n.toMarkdown.runner(r,i)}}}}),Tg="math_inline",_g=nr(Tg,()=>({group:"inline",inline:!0,draggable:!0,atom:!0,attrs:{value:{default:""}},parseDOM:[{tag:`span[data-type="${Tg}"]`,getAttrs:t=>{var e;return{value:(e=t.dataset.value)!=null?e:""}}}],toDOM:t=>{const e=t.attrs.value,n=document.createElement("span");return n.dataset.type=Tg,n.dataset.value=e,hN.render(e,n,{throwOnError:!1}),n},parseMarkdown:{match:t=>t.type==="inlineMath",runner:(t,e,n)=>{t.addNode(n,{value:e.value})}},toMarkdown:{match:t=>t.type.name===Tg,runner:(t,e)=>{t.addNode("inlineMath",void 0,e.attrs.value)}}})),RD=ut("ToggleLatex",t=>()=>(e,n)=>{const{hasNode:r,pos:i,target:o}=fq(e,_g.type(t)),{selection:a,doc:s,tr:l}=e;if(!r){const d=s.textBetween(a.from,a.to);let h=l.replaceSelectionWith(_g.type(t).create({value:d}));return n&&n(h.setSelection(tt.create(h.doc,a.from))),!0}const{from:O,to:c}=a;if(!o||i<0)return!1;let u=l.delete(i,i+1);const f=o.attrs.value;return u=u.insertText(f,i),n&&n(u.setSelection(Le.create(u.doc,O,c+f.length-1))),!0}),zD=AS("INLINE_LATEX");af(B);const v_e=kr({props:{config:{type:Object,required:!0},innerView:{type:Object,required:!0},updateValue:{type:Object,required:!0}},setup(t){const e=r=>{if(!(!r||!(r instanceof HTMLElement))){for(;r.firstChild;)r.removeChild(r.firstChild);t.innerView.value&&r.appendChild(t.innerView.value.dom)}},n=r=>{r.preventDefault(),t.updateValue.value()};return()=>B("div",{class:"container"},t.innerView&&B("div",{ref:e}),B("button",{type:"button",onPointerdown:n},B(JO,{icon:t.config.inlineEditConfirm})))}});var CD=t=>{throw TypeError(t)},ED=(t,e,n)=>e.has(t)||CD("Cannot "+n),_r=(t,e,n)=>(ED(t,e,"read from private field"),n?n.call(t):e.get(t)),$c=(t,e,n)=>e.has(t)?CD("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),hv=(t,e,n,r)=>(ED(t,e,"write to private field"),e.set(t,n),n),Xg,Rh,pv,cf,Rg,zg,r7,i7;class w_e{constructor(e,n,r){this.ctx=e,$c(this,Xg),$c(this,Rh),$c(this,pv),$c(this,cf,Ob(null)),$c(this,Rg,Ob(()=>{})),$c(this,zg),$c(this,r7,()=>{_r(this,cf).value&&(_r(this,cf).value.destroy(),_r(this,cf).value=null)}),$c(this,i7,o=>{const s=(()=>{const{selection:l,schema:O}=o.state;if(l.empty||!(l instanceof tt))return!1;const c=l.node;if(c.type.name!==Tg)return!1;const u=l.from,f=O.nodes.paragraph.create(null,O.text(c.attrs.value)),d=new hT(_r(this,pv),{state:uu.create({doc:f,schema:new $E({nodes:{doc:{content:"block+"},paragraph:{content:"inline*",group:"block",parseDOM:[{tag:"p"}],toDOM(){return["p",0]}},text:{group:"inline"}}}),plugins:[TZ({"Mod-z":Lb,"Mod-Z":oh,"Mod-y":oh,Enter:()=>(_r(this,Rg).value(),!0)})]})});return _r(this,cf).value=d,_r(this,Rg).value=()=>{const{tr:h}=o.state;h.setNodeAttribute(u,"value",d.state.doc.textContent),o.dispatch(h),requestAnimationFrame(()=>{o.focus()})},!0})();return s||_r(this,r7).call(this),s}),this.update=(o,a)=>{_r(this,Rh).update(o,a)},this.destroy=()=>{_r(this,zg).unmount(),_r(this,Rh).destroy(),_r(this,Xg).remove()};const i=document.createElement("div");i.className="milkdown-latex-inline-edit",hv(this,Xg,i),hv(this,zg,Ho(v_e,{config:r,innerView:_r(this,cf),updateValue:_r(this,Rg)})),_r(this,zg).mount(i),hv(this,Rh,new US({debounce:0,content:_r(this,Xg),shouldShow:_r(this,i7),offset:10,floatingUIOptions:{placement:"bottom"}})),_r(this,Rh).update(n),hv(this,pv,document.createElement("div"))}}Xg=new WeakMap,Rh=new WeakMap,pv=new WeakMap,cf=new WeakMap,Rg=new WeakMap,zg=new WeakMap,r7=new WeakMap,i7=new WeakMap;const k_e=Jr(t=>Iue(/(?:\$)([^$]+)(?:\$)$/,_g.type(t),{getAttr:e=>{var n;return{value:(n=e[1])!=null?n:""}}})),P_e=Jr(t=>r5(/^\$\$[\s\n]$/,Go.type(t),()=>({language:"LaTeX"}))),x_e=xs("remarkMath",()=>kTe);function T_e(t){return CO(t,"math",(e,n,r)=>{const{value:i}=e,o={type:"code",lang:"LaTeX",value:i};r.children.splice(n,1,o)})}const __e=xs("remarkMathBlock",()=>()=>T_e),X_e=(t,e)=>{t.config(Ma(Wt.Latex)).config(n=>{if(!Th(n).get().includes(Wt.CodeMirror))throw new Error("You need to enable CodeMirror to use LaTeX feature");n.update(H0.key,o=>({...o,renderPreview:(a,s,l)=>{if(a.toLowerCase()==="latex"&&s.length>0)return R_e(s,e==null?void 0:e.katexOptions);const O=o.renderPreview;return O(a,s,l)}})),n.set(zD.key,{view:o=>{var a;return new w_e(n,o,{inlineEditConfirm:(a=e==null?void 0:e.inlineEditConfirm)!=null?a:FX,...e})}})}).use(x_e).use(__e).use(_g).use(zD).use(k_e).use(P_e).use(S_e).use(RD)};function R_e(t,e){return hN.renderToString(t,{...e,throwOnError:!1,displayMode:!0})}const z_e=(t,e)=>{t.config(Ma(Wt.LinkTooltip)).config(JTe).config(n=>{n.update(kh.key,r=>{var i,o,a,s,l,O;return{...r,linkIcon:(i=e==null?void 0:e.linkIcon)!=null?i:OD,editButton:(o=e==null?void 0:e.editButton)!=null?o:HX,removeButton:(a=e==null?void 0:e.removeButton)!=null?a:JX,confirmButton:(s=e==null?void 0:e.confirmButton)!=null?s:FX,inputPlaceholder:(l=e==null?void 0:e.inputPlaceholder)!=null?l:"Paste link...",onCopyLink:(O=e==null?void 0:e.onCopyLink)!=null?O:()=>{}}})}).use(e4e)};function C_e(t,e){t.set(ev.key,{renderLabel:({label:n,listType:r,checked:i})=>{var o,a,s;return i==null?r==="bullet"?(o=e==null?void 0:e.bulletIcon)!=null?o:D4e:n:i?(a=e==null?void 0:e.checkBoxCheckedIcon)!=null?a:G4e:(s=e==null?void 0:e.checkBoxUncheckedIcon)!=null?s:B4e}})}const E_e=(t,e)=>{t.config(Ma(Wt.ListItem)).config(n=>C_e(n,e)).use(a4e)};function q_e(t){var e;return t.childCount<=1&&!((e=t.firstChild)!=null&&e.content.size)}function Z_e(t,e){const{selection:n}=t;if(!n.empty)return null;const r=n.$anchor,i=r.parent;if(i.content.size>0||Ss(s=>s.type.name==="table")(r))return null;const a=r.before();return tr.node(a,a+i.nodeSize,{class:"crepe-placeholder","data-placeholder":e})}const o7=Lt({text:"Please enter...",mode:"block"},"placeholderConfigCtx"),Y_e=Gn(t=>new dn({key:new hn("CREPE_PLACEHOLDER"),props:{decorations:e=>{var n;if(l_e(t).readonly)return null;const i=t.get(o7.key);if(i.mode==="doc"&&!q_e(e.doc)||bD(e.selection)||SD(e.selection))return null;const o=(n=i.text)!=null?n:"Please enter...",a=Z_e(e,o);return a?cn.create(e.doc,[a]):null}}})),V_e=(t,e)=>{t.config(Ma(Wt.Placeholder)).config(n=>{e&&n.update(o7.key,r=>({...r,...e}))}).use(Y_e).use(o7)},W_e=(t,e)=>{t.config(Ma(Wt.Table)).config(n=>{n.update(tv.key,r=>({...r,renderButton:i=>{var o,a,s,l,O,c,u,f,d;switch(i){case"add_row":return(o=e==null?void 0:e.addRowIcon)!=null?o:KX;case"add_col":return(a=e==null?void 0:e.addColIcon)!=null?a:KX;case"delete_row":return(s=e==null?void 0:e.deleteRowIcon)!=null?s:JX;case"delete_col":return(l=e==null?void 0:e.deleteColIcon)!=null?l:JX;case"align_col_left":return(O=e==null?void 0:e.alignLeftIcon)!=null?O:M4e;case"align_col_center":return(c=e==null?void 0:e.alignCenterIcon)!=null?c:j4e;case"align_col_right":return(u=e==null?void 0:e.alignRightIcon)!=null?u:N4e;case"col_drag_handle":return(f=e==null?void 0:e.colDragHandleIcon)!=null?f:uD;case"row_drag_handle":return(d=e==null?void 0:e.rowDragHandleIcon)!=null?d:uD}}}))}).use(z4e)};function U_e(t,e){var n,r,i,o,a,s,l;const O=new t7;O.addGroup("formatting","Formatting").addItem("bold",{icon:(n=t==null?void 0:t.boldIcon)!=null?n:aD,active:d=>d.get(Ce).call(Cu.key,Tu.type(d)),onRun:d=>{d.get(Ce).call(f0.key)}}).addItem("italic",{icon:(r=t==null?void 0:t.italicIcon)!=null?r:fD,active:d=>d.get(Ce).call(Cu.key,NO.type(d)),onRun:d=>{d.get(Ce).call(u0.key)}}).addItem("strikethrough",{icon:(i=t==null?void 0:t.strikethroughIcon)!=null?i:gD,active:d=>d.get(Ce).call(Cu.key,Nu.type(d)),onRun:d=>{d.get(Ce).call(M0.key)}});const c=O.addGroup("function","Function");c.addItem("code",{icon:(o=t==null?void 0:t.codeIcon)!=null?o:BX,active:d=>d.get(Ce).call(Cu.key,Ca.type(d)),onRun:d=>{d.get(Ce).call(d0.key)}});const u=e&&Th(e).get();return(u==null?void 0:u.includes(Wt.Latex))&&c.addItem("latex",{icon:(a=t==null?void 0:t.latexIcon)!=null?a:e7,active:d=>d.get(Ce).call(DV.key,_g.type(d)),onRun:d=>{d.get(Ce).call(RD.key)}}),c.addItem("link",{icon:(s=t==null?void 0:t.linkIcon)!=null?s:dD,active:d=>d.get(Ce).call(Cu.key,mo.type(d)),onRun:d=>{d.get(Ce).call(qX.key)}}),(l=t==null?void 0:t.buildToolbar)==null||l.call(t,O),O.build()}af(B,mn);const A_e=kr({props:{ctx:{type:Object,required:!0},hide:{type:Function,required:!0},show:{type:Object,required:!0},selection:{type:Object,required:!0},config:{type:Object,required:!1}},setup(t){const{ctx:e,config:n}=t,r=a=>s=>{s.preventDefault(),e&&(a==null||a(e))};function i(a){return af(t.selection.value),e.get(Ty).status!==Kr.Created?!1:a(e)}const o=Iu(()=>U_e(n,e));return()=>B(mn,null,o.value.map(a=>a.items.map(s=>B("button",{type:"button",class:Pr("toolbar-item",e&&i(s.active)&&"active"),onPointerdown:r(s.onRun)},B(JO,{icon:s.icon})))).reduce((a,s,l)=>(l===0?a.push(...s):a.push(B("div",{class:"divider"}),...s),a),[]))}});var qD=t=>{throw TypeError(t)},ZD=(t,e,n)=>e.has(t)||qD("Cannot "+n),ko=(t,e,n)=>(ZD(t,e,"read from private field"),n?n.call(t):e.get(t)),Cg=(t,e,n)=>e.has(t)?qD("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),mv=(t,e,n,r)=>(ZD(t,e,"write to private field"),e.set(t,n),n),Qc,Eg,gv,qg,Zg;const YD=AS("CREPE_TOOLBAR");class I_e{constructor(e,n,r){Cg(this,Qc),Cg(this,Eg),Cg(this,gv),Cg(this,qg),Cg(this,Zg,je(!1)),this.update=(a,s)=>{ko(this,Qc).update(a,s),ko(this,qg).value=a.state.selection},this.destroy=()=>{ko(this,Qc).destroy(),ko(this,gv).unmount(),ko(this,Eg).remove()},this.hide=()=>{ko(this,Qc).hide()};const i=document.createElement("div");i.className="milkdown-toolbar",mv(this,qg,Ob(n.state.selection));const o=Ho(A_e,{ctx:e,hide:this.hide,config:r,selection:ko(this,qg),show:ko(this,Zg)});o.mount(i),mv(this,Eg,i),mv(this,gv,o),mv(this,Qc,new US({content:ko(this,Eg),debounce:20,offset:10,shouldShow(a){const{doc:s,selection:l}=a.state,{empty:O,from:c,to:u}=l,f=!s.textBetween(c,u).length&&l instanceof Le,d=!(l instanceof Le),h=a.dom.getRootNode().activeElement,p=i.contains(h),m=!a.hasFocus()&&!p,g=!a.editable;return!(m||d||O||f||g)}})),ko(this,Qc).onShow=()=>{ko(this,Zg).value=!0},ko(this,Qc).onHide=()=>{ko(this,Zg).value=!1},this.update(n)}}Qc=new WeakMap,Eg=new WeakMap,gv=new WeakMap,qg=new WeakMap,Zg=new WeakMap;const j_e=(t,e)=>{t.config(Ma(Wt.Toolbar)).config(n=>{n.set(YD.key,{view:r=>new I_e(n,r,e)})}).use(YD)},VD=[{label:"Paragraph",level:null},{label:"Heading 1",level:1},{label:"Heading 2",level:2},{label:"Heading 3",level:3},{label:"Heading 4",level:4},{label:"Heading 5",level:5},{label:"Heading 6",level:6}];function M_e(t,e){var n,r;const i=e??VD,o=t.get(Nt),{$from:a}=o.state.selection,s=a.parent,l=(n=i.find(O=>O.level===null))!=null?n:i[0];if(s.type===gi.type(t)){const O=s.attrs.level;return(r=i.find(c=>c.level===O))!=null?r:l}return l}function N_e(t,e){const n=t.get(Ce);if(e==null){const r=go.type(t);n.call(Fo.key,{nodeType:r})}else{const r=gi.type(t);n.call(Fo.key,{nodeType:r,attrs:{level:e}})}}function uf(t,e){if(t.get(Ce).call(Cu.key,e))return!0;const i=t.get(Nt),{state:o}=i;if(o.storedMarks)return o.storedMarks.some(a=>a.type===e);if(o.selection instanceof Le){const{$cursor:a}=o.selection;if(a)return a.marks().some(s=>s.type===e)}return!1}function D_e(t,e){const n=t??VD;return{icon:"",active:()=>!1,selector:{chevronIcon:e??GX,activeLabel:r=>M_e(r,n).label,options:n.map(r=>({label:r.label,onSelect:i=>N_e(i,r.level)}))}}}function L_e(t,e){var n,r,i,o,a,s,l,O,c,u,f,d,h,p,m;const g=e&&Th(e).get(),Q=g==null?void 0:g.includes(Wt.Latex),b=g==null?void 0:g.includes(Wt.ImageBlock),P=g==null?void 0:g.includes(Wt.Table),v=new t7;v.addGroup("heading","Heading").addItem("heading-selector",{...D_e(t==null?void 0:t.headingOptions,t==null?void 0:t.chevronDownIcon)}),v.addGroup("formatting","Formatting").addItem("bold",{icon:(n=t==null?void 0:t.boldIcon)!=null?n:aD,active:X=>uf(X,Tu.type(X)),onRun:X=>{X.get(Ce).call(f0.key)}}).addItem("italic",{icon:(r=t==null?void 0:t.italicIcon)!=null?r:fD,active:X=>uf(X,NO.type(X)),onRun:X=>{X.get(Ce).call(u0.key)}}).addItem("strikethrough",{icon:(i=t==null?void 0:t.strikethroughIcon)!=null?i:gD,active:X=>uf(X,Nu.type(X)),onRun:X=>{X.get(Ce).call(M0.key)}}).addItem("code",{icon:(o=t==null?void 0:t.codeIcon)!=null?o:BX,active:X=>uf(X,Ca.type(X)),onRun:X=>{const T=X.get(Nt),{state:C}=T;if(C.selection.empty){const W=Ca.type(X);uf(X,W)?T.dispatch(C.tr.removeStoredMark(W)):T.dispatch(C.tr.addStoredMark(W.create()))}else X.get(Ce).call(d0.key)}}),v.addGroup("list","List").addItem("bullet-list",{icon:(a=t==null?void 0:t.bulletListIcon)!=null?a:sD,active:()=>!1,onRun:X=>{const T=X.get(Ce),C=LO.type(X);T.call(Tl.key,{nodeType:C})}}).addItem("ordered-list",{icon:(s=t==null?void 0:t.orderedListIcon)!=null?s:hD,active:()=>!1,onRun:X=>{const T=X.get(Ce),C=GO.type(X);T.call(Tl.key,{nodeType:C})}}).addItem("task-list",{icon:(l=t==null?void 0:t.taskListIcon)!=null?l:QD,active:()=>!1,onRun:X=>{const T=X.get(Ce),C=Bo.type(X);T.call(Tl.key,{nodeType:C,attrs:{checked:!1}})}});const w=v.addGroup("insert","Insert");w.addItem("link",{icon:(O=t==null?void 0:t.linkIcon)!=null?O:dD,active:X=>uf(X,mo.type(X)),onRun:X=>{const T=X.get(Nt),{state:C}=T,W=mo.type(X);if(C.selection.empty&&uf(X,W)){T.dispatch(C.tr.removeStoredMark(W));return}X.get(Ce).call(qX.key)}}),b&&w.addItem("image",{icon:(c=t==null?void 0:t.imageIcon)!=null?c:ov,active:()=>!1,onRun:X=>{const T=X.get(Ce),C=I0.type(X);T.call(_l.key,{nodeType:C})}}),P&&w.addItem("table",{icon:(u=t==null?void 0:t.tableIcon)!=null?u:$D,active:()=>!1,onRun:X=>{const T=X.get(Ce),C=X.get(Nt),{from:W}=C.state.selection;T.call(_l.key,{nodeType:Vb(X,3,3)}),T.call(b4.key,{pos:W})}});const k=v.addGroup("block","Block");return k.addItem("code-block",{icon:(f=t==null?void 0:t.codeBlockIcon)!=null?f:F4e,active:()=>!1,onRun:X=>{const T=X.get(Ce),C=Go.type(X);T.call(Fo.key,{nodeType:C})}}),Q&&k.addItem("math",{icon:(d=t==null?void 0:t.mathIcon)!=null?d:e7,active:()=>!1,onRun:X=>{const T=X.get(Ce),C=Go.type(X);T.call(_l.key,{nodeType:C,attrs:{language:"LaTeX"}})}}),v.addGroup("more","More").addItem("quote",{icon:(h=t==null?void 0:t.quoteIcon)!=null?h:pD,active:()=>!1,onRun:X=>{const T=X.get(Ce),C=_u.type(X);T.call(Tl.key,{nodeType:C})}}).addItem("hr",{icon:(p=t==null?void 0:t.hrIcon)!=null?p:cD,active:()=>!1,onRun:X=>{const T=X.get(Ce),C=zu.type(X);T.call(_l.key,{nodeType:C})}}),(m=t==null?void 0:t.buildTopBar)==null||m.call(t,v),v.build()}af(B,mn);const G_e=kr({props:{ctx:{type:Object,required:!0},version:{type:Object,required:!0},config:{type:Object,required:!1}},setup(t){const{ctx:e,config:n}=t,r=je(null),i=h=>p=>{p.preventDefault(),e&&h(e)};function o(){return e.get(Ty).status===Kr.Created}function a(){af(t.version.value)}function s(h){return a(),o()?h(e):!1}function l(h){var p,m;return a(),o()?h.activeLabel(e):(m=(p=h.options[0])==null?void 0:p.label)!=null?m:""}function O(h,p){p.preventDefault(),p.stopPropagation(),r.value=r.value===h?null:h}const c=h=>{h.target.closest(".top-bar-heading-selector")||(r.value=null)};Ld(()=>{window.addEventListener("pointerdown",c)}),Gd(()=>{window.removeEventListener("pointerdown",c)});const u=Iu(()=>L_e(n,e));function f(h,p){const m=r.value===h,g=l(p);return B("div",{key:h,class:"top-bar-heading-selector"},B("button",{type:"button",class:"top-bar-heading-button",onPointerdown:Q=>O(h,Q)},B("span",{class:"top-bar-heading-label"},g),p.chevronIcon&&B("span",{class:"top-bar-chevron"},B(JO,{icon:p.chevronIcon}))),m&&B("div",{class:"top-bar-heading-dropdown"},p.options.map((Q,b)=>B("button",{key:`${h}-${b}`,type:"button",class:Pr("top-bar-heading-option",g===Q.label&&"active"),onPointerdown:P=>{P.preventDefault(),P.stopPropagation(),r.value=null,Q.onSelect(e)}},Q.label))))}function d(h){return B("button",{key:h.key,type:"button",class:Pr("top-bar-item",s(h.active)&&"active"),onPointerdown:i(h.onRun)},B(JO,{icon:h.icon}))}return()=>{const h=o()?e.get(Nt):null;return(h?!h.editable:!1)?null:B("div",{class:"top-bar-inner"},u.value.map(m=>m.items.map(g=>g.selector?f(g.key,g.selector):g.onRun?d(g):null)).reduce((m,g,Q)=>{var b,P;if(Q===0)m.push(...g);else{const v=(P=(b=u.value[Q])==null?void 0:b.key)!=null?P:Q;m.push(B("div",{key:`divider-${v}`,class:"top-bar-divider"}),...g)}return m},[]))}}});var WD=t=>{throw TypeError(t)},UD=(t,e,n)=>e.has(t)||WD("Cannot "+n),Yg=(t,e,n)=>(UD(t,e,"read from private field"),n?n.call(t):e.get(t)),a7=(t,e,n)=>e.has(t)?WD("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),s7=(t,e,n,r)=>(UD(t,e,"write to private field"),e.set(t,n),n),Vg,$v,Wg;const B_e=new hn("CREPE_TOP_BAR");class F_e{constructor(e,n,r){a7(this,Vg),a7(this,$v),a7(this,Wg),this.update=(s,l)=>{Yg(this,Vg).style.display=s.editable?"":"none",Yg(this,Wg).value++},this.destroy=()=>{Yg(this,$v).unmount(),Yg(this,Vg).remove()},s7(this,Wg,je(0));const i=document.createElement("div");i.className="milkdown-top-bar";const o=Ho(G_e,{ctx:e,config:r,version:Yg(this,Wg)});o.mount(i),s7(this,Vg,i),s7(this,$v,o);const a=n.dom.parentElement;a&&a.insertBefore(i,a.firstChild),this.update(n)}}Vg=new WeakMap,$v=new WeakMap,Wg=new WeakMap;const l7=Lt({view:()=>({update:()=>{},destroy:()=>{}})},"topBarConfig"),H_e=Gn(t=>{const e=t.get(l7.key);return new dn({key:B_e,view:e.view})}),K_e=(t,e)=>{t.config(Ma(Wt.TopBar)).config(n=>{n.set(l7.key,{view:r=>new F_e(n,r,e)})}).use(l7).use(H_e)};function J_e(t,e,n){switch(t){case Wt.CodeMirror:return Q_e(e,n);case Wt.ListItem:return E_e(e,n);case Wt.LinkTooltip:return z_e(e,n);case Wt.ImageBlock:return b_e(e,n);case Wt.Cursor:return y_e(e,n);case Wt.BlockEdit:return $_e(e,n);case Wt.Placeholder:return V_e(e,n);case Wt.Toolbar:return j_e(e,n);case Wt.Table:return W_e(e,n);case Wt.Latex:return X_e(e,n);case Wt.TopBar:return K_e(e,n)}}var AD=t=>{throw TypeError(t)},ID=(t,e,n)=>e.has(t)||AD("Cannot "+n),Po=(t,e,n)=>(ID(t,e,"read from private field"),n?n.call(t):e.get(t)),O7=(t,e,n)=>e.has(t)?AD("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),c7=(t,e,n,r)=>(ID(t,e,"write to private field"),e.set(t,n),n),xo,Qv,Ug;class e2e{constructor({root:e,defaultValue:n=""}={}){O7(this,xo),O7(this,Qv),O7(this,Ug,!0),this.addFeature=(i,o)=>(i(Po(this,xo),o),this),this.create=()=>Po(this,xo).create(),this.destroy=()=>Po(this,xo).destroy(),this.setReadonly=i=>(c7(this,Ug,!i),Po(this,xo).action(o=>{Po(this,xo).status===Kr.Created&&o.get(Nt).setProps({editable:()=>!i})}),this),this.getMarkdown=()=>Po(this,xo).action(M0e()),this.on=i=>Po(this,xo).status!==Kr.Created?(Po(this,xo).config(o=>{const a=o.get(iv);i(a)}),this):(Po(this,xo).action(o=>{const a=o.get(iv);i(a)}),this);var r;c7(this,Qv,(r=typeof e=="string"?document.querySelector(e):e)!=null?r:document.body),c7(this,xo,A0e.make().config(i=>{i.inject(s_e,this),i.inject(a_e,[])}).config(i=>{i.set(Zy,Po(this,Qv)),i.set(zy,n),i.set(o0,{editable:()=>Po(this,Ug)}),i.update(rv.key,o=>({...o,size:4})),i.update(xh.key,o=>({...o,uploader:async(a,s,l)=>{const c=Th(l).get().includes(Wt.ImageBlock),u=c?s.nodes["image-block"]:s.nodes.image;if(!u)return[];const f=c?l.get(A0.key).onUpload:void 0,d=[];for(let p=0;p<a.length;p++){const m=a.item(p);m&&m.type.includes("image")&&d.push(m)}return await Promise.all(d.map(async p=>{const m=f?await f(p):URL.createObjectURL(p);return u.createAndFill({src:m})}))}}))}).use(n$e).use(rD).use(E4e).use(Z4e).use(V4e).use(JN).use(A4e).use(zve))}get editor(){return Po(this,xo)}get readonly(){return!Po(this,Ug)}}xo=new WeakMap,Qv=new WeakMap,Ug=new WeakMap;class jD extends e2e{constructor({features:e={},featureConfigs:n={},...r}={}){super(r);const i=eae(n,o_e);Object.entries({...I4e,...e}).filter(([,a])=>a).map(([a])=>a).forEach(a=>{const s=i[a];J_e(a,this.editor,s)})}}jD.Feature=Wt;class t2e{constructor(e){kn(this,"root");kn(this,"onChange");kn(this,"content");kn(this,"readOnly");kn(this,"crepe",null);kn(this,"suppressChanges",!1);this.root=e.root,this.onChange=e.onChange,this.content=e.content,this.readOnly=e.readOnly}async mount(){await this.render(this.content),this.setReadOnly(this.readOnly)}async replaceContent(e){if(e===this.content)return;this.content=e;const n=this.readOnly;await this.render(e),this.setReadOnly(n)}setReadOnly(e){var n;this.readOnly=e,(n=this.crepe)==null||n.setReadonly(e)}async render(e){this.suppressChanges=!0,this.crepe&&(await this.crepe.destroy(),this.root.innerHTML=""),this.crepe=new jD({root:this.root,defaultValue:e}),this.crepe.on(n=>{n.markdownUpdated((r,i)=>{this.content=i,this.suppressChanges||this.onChange(i)})}),await this.crepe.create(),this.suppressChanges=!1,this.content=e}}class n2e extends HTMLElement{constructor(){super(...arguments);kn(this,"bootstrap",null);kn(this,"client",pre({createSocket:()=>{var i;const n=window.location.protocol==="https:"?"wss:":"ws:",r=((i=this.bootstrap)==null?void 0:i.websocketPath)??"";return new WebSocket(`${n}//${window.location.host}${r}`)}}));kn(this,"editor",null);kn(this,"saveTimer",null);kn(this,"titleText","Markdown");kn(this,"statusText","Connecting...");kn(this,"overlayVisible",!0);kn(this,"overlayText","Connecting to the markdown session...")}connectedCallback(){if(this.bootstrap={artifactId:this.dataset.artifactId??"",websocketPath:this.dataset.websocketPath??""},!this.bootstrap)throw new Error("Editable markdown bootstrap config missing");if(!this.bootstrap.artifactId||!this.bootstrap.websocketPath)throw new Error("Editable markdown element is missing required bootstrap data attributes");this.client.addEventListener("document-ready",r=>{var i;this.titleText=r.title,(i=this.editor)==null||i.replaceContent(r.content),this.updateView()}),this.client.addEventListener("document-update",r=>{var i;typeof r.title=="string"&&(this.titleText=r.title),typeof r.content=="string"&&((i=this.editor)==null||i.replaceContent(r.content)),this.updateView()}),this.client.addEventListener("document-saved",r=>{this.statusText=`Saved ${new Date(r.savedAt).toLocaleTimeString()}`,this.updateView()}),this.client.addEventListener("error",r=>{const i=document.createElement("div");i.className="editable-markdown-flash",i.textContent=r.message,document.body.append(i),window.setTimeout(()=>i.remove(),4e3)}),this.client.addEventListener("connection",r=>{var i,o,a;switch(r.state){case"connecting":this.statusText="Connecting...",this.overlayVisible=!0,this.overlayText="Connecting to the markdown session...",(i=this.editor)==null||i.setReadOnly(!0);break;case"connected":this.statusText="Live",this.overlayVisible=!1,(o=this.editor)==null||o.setReadOnly(!1);break;case"disconnected":this.statusText=r.retryInMs===null?"Disconnected":`Retrying in ${Math.ceil(r.retryInMs/1e3)}s`,this.overlayVisible=!0,this.overlayText=r.retryInMs===null?"The connection is unavailable.":`Retrying in ${Math.ceil(r.retryInMs/1e3)} second${Math.ceil(r.retryInMs/1e3)===1?"":"s"}.`,(a=this.editor)==null||a.setReadOnly(!0);break}this.updateView()}),this.updateView();const n=this.querySelector(".editable-markdown-editor-root");if(!n)throw new Error("Editable markdown root missing");this.editor=new t2e({root:n,content:"",readOnly:!0,onChange:r=>{this.saveTimer!==null&&clearTimeout(this.saveTimer),this.saveTimer=window.setTimeout(()=>{this.saveTimer=null,this.client.sendDocument(r)},300)}}),this.editor.mount(),this.client.connect()}disconnectedCallback(){this.client.disconnect()}updateView(){nre(Bne`
|
|
949
949
|
<main class="editable-markdown-shell">
|
|
950
950
|
<span class="editable-markdown-status">${this.statusText}</span>
|
|
951
951
|
<div class="editable-markdown-editor-root"></div>
|
package/dist/cli.cjs
CHANGED
|
@@ -83853,10 +83853,10 @@ function renderArtifact(artifact, options) {
|
|
|
83853
83853
|
if (!element) return;
|
|
83854
83854
|
const config = ${JSON.stringify({
|
|
83855
83855
|
artifactId: artifact.id,
|
|
83856
|
-
|
|
83856
|
+
websocketPath: options?.editableMarkdownWebsocketPath ?? ""
|
|
83857
83857
|
}).replace(/</g, "\\u003c")};
|
|
83858
83858
|
element.setAttribute("data-artifact-id", config.artifactId);
|
|
83859
|
-
element.setAttribute("data-websocket-
|
|
83859
|
+
element.setAttribute("data-websocket-path", config.websocketPath);
|
|
83860
83860
|
})();` : void 0;
|
|
83861
83861
|
return wrapArtifactHTML({
|
|
83862
83862
|
content,
|
|
@@ -85740,7 +85740,7 @@ var Server2 = class {
|
|
|
85740
85740
|
}
|
|
85741
85741
|
const html = renderArtifact(artifact, {
|
|
85742
85742
|
staticDir: options.staticDir,
|
|
85743
|
-
|
|
85743
|
+
editableMarkdownWebsocketPath: websocketURL.pathname + websocketURL.search
|
|
85744
85744
|
});
|
|
85745
85745
|
res.type("html").send(html);
|
|
85746
85746
|
});
|
package/dist/electron.cjs
CHANGED
|
@@ -80137,10 +80137,10 @@ function renderArtifact(artifact, options) {
|
|
|
80137
80137
|
if (!element) return;
|
|
80138
80138
|
const config = ${JSON.stringify({
|
|
80139
80139
|
artifactId: artifact.id,
|
|
80140
|
-
|
|
80140
|
+
websocketPath: options?.editableMarkdownWebsocketPath ?? ""
|
|
80141
80141
|
}).replace(/</g, "\\u003c")};
|
|
80142
80142
|
element.setAttribute("data-artifact-id", config.artifactId);
|
|
80143
|
-
element.setAttribute("data-websocket-
|
|
80143
|
+
element.setAttribute("data-websocket-path", config.websocketPath);
|
|
80144
80144
|
})();` : void 0;
|
|
80145
80145
|
return wrapArtifactHTML({
|
|
80146
80146
|
content,
|
|
@@ -82024,7 +82024,7 @@ var Server2 = class {
|
|
|
82024
82024
|
}
|
|
82025
82025
|
const html = renderArtifact(artifact, {
|
|
82026
82026
|
staticDir: options.staticDir,
|
|
82027
|
-
|
|
82027
|
+
editableMarkdownWebsocketPath: websocketURL.pathname + websocketURL.search
|
|
82028
82028
|
});
|
|
82029
82029
|
res.type("html").send(html);
|
|
82030
82030
|
});
|