@ahzoo/sus 3.0.0 → 3.0.1

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.
@@ -101,7 +101,7 @@ img.ProseMirror-separator {
101
101
  `,p0="️",m0="‍",Uo="";let Hi=null,Fi=null;function g0(n=[]){const e={};Fe.groups=e;const t=new Fe;Hi==null&&(Hi=jd(a0)),Fi==null&&(Fi=jd(c0)),E(t,"'",Ni),E(t,"{",yr),E(t,"}",br),E(t,"[",pi),E(t,"]",mi),E(t,"(",gi),E(t,")",yi),E(t,"<",bi),E(t,">",wi),E(t,"(",ki),E(t,")",xi),E(t,"「",Si),E(t,"」",Ci),E(t,"『",Ei),E(t,"』",Mi),E(t,"<",vi),E(t,">",Ti),E(t,"&",Oi),E(t,"*",Ai),E(t,"@",Xt),E(t,"`",Ri),E(t,"^",Ii),E(t,":",Qt),E(t,",",_o),E(t,"$",Pi),E(t,".",ct),E(t,"=",Li),E(t,"!",Vo),E(t,"-",Qe),E(t,"%",wr),E(t,"|",Bi),E(t,"+",_i),E(t,"#",Vi),E(t,"?",kr),E(t,'"',$o),E(t,"/",dt),E(t,";",zo),E(t,"~",xr),E(t,"_",$i),E(t,"\\",Di),E(t,"・",Vd);const r=ue(t,Nt,Po,{[vo]:!0});ue(r,Nt,r);const i=ue(r,Ot,Bd,{[pr]:!0}),s=ue(r,Sr,_d,{[mr]:!0}),o=ue(t,Ot,Tt,{[To]:!0});ue(o,Nt,i),ue(o,Ot,o),ue(i,Nt,i),ue(i,Ot,i);const l=ue(t,Sr,Do,{[Oo]:!0});ue(l,Ot),ue(l,Nt,s),ue(l,Sr,l),ue(s,Nt,s),ue(s,Ot),ue(s,Sr,s);const a=E(t,jo,Bo,{[Ao]:!0}),c=E(t,Hd,Lo,{[Ao]:!0}),d=ue(t,Fo,Lo,{[Ao]:!0});E(t,Uo,d),E(c,jo,a),E(c,Uo,d),ue(c,Fo,d),E(d,Hd),E(d,jo),ue(d,Fo,d),E(d,Uo,d);const u=ue(t,Ho,$d,{[Pd]:!0});E(u,"#"),ue(u,Ho,u),E(u,p0,u);const f=E(u,m0);E(f,"#"),ue(f,Ho,u);const h=[[Ot,o],[Nt,i]],p=[[Ot,null],[Sr,l],[Nt,s]];for(let g=0;g<Hi.length;g++)Zt(t,Hi[g],Ro,Tt,h);for(let g=0;g<Fi.length;g++)Zt(t,Fi[g],Io,Do,p);wn(Ro,{tld:!0,ascii:!0},e),wn(Io,{utld:!0,alpha:!0},e),Zt(t,"file",hi,Tt,h),Zt(t,"mailto",hi,Tt,h),Zt(t,"http",Vn,Tt,h),Zt(t,"https",Vn,Tt,h),Zt(t,"ftp",Vn,Tt,h),Zt(t,"ftps",Vn,Tt,h),wn(hi,{scheme:!0,ascii:!0},e),wn(Vn,{slashscheme:!0,ascii:!0},e),n=n.sort((g,y)=>g[0]>y[0]?1:-1);for(let g=0;g<n.length;g++){const y=n[g][0],k=n[g][1]?{[d0]:!0}:{[u0]:!0};y.indexOf("-")>=0?k[No]=!0:Ot.test(y)?Nt.test(y)?k[pr]=!0:k[To]=!0:k[vo]=!0,Ld(t,y,y,k)}return Ld(t,"localhost",gr,{ascii:!0}),t.jd=new Fe(zi),{start:t,tokens:Object.assign({groups:e},zd)}}function Fd(n,e){const t=y0(e.replace(/[A-Z]/g,l=>l.toLowerCase())),r=t.length,i=[];let s=0,o=0;for(;o<r;){let l=n,a=null,c=0,d=null,u=-1,f=-1;for(;o<r&&(a=l.go(t[o]));)l=a,l.accepts()?(u=0,f=0,d=l):u>=0&&(u+=t[o].length,f++),c+=t[o].length,s+=t[o].length,o++;s-=u,o-=f,c-=u,i.push({t:d.t,v:e.slice(s-c,s),s:s-c,e:s})}return i}function y0(n){const e=[],t=n.length;let r=0;for(;r<t;){let i=n.charCodeAt(r),s,o=i<55296||i>56319||r+1===t||(s=n.charCodeAt(r+1))<56320||s>57343?n[r]:n.slice(r,r+2);e.push(o),r+=o.length}return e}function Zt(n,e,t,r,i){let s;const o=e.length;for(let l=0;l<o-1;l++){const a=e[l];n.j[a]?s=n.j[a]:(s=new Fe(r),s.jr=i.slice(),n.j[a]=s),n=s}return s=new Fe(t),s.jr=i.slice(),n.j[e[o-1]]=s,s}function jd(n){const e=[],t=[];let r=0,i="0123456789";for(;r<n.length;){let s=0;for(;i.indexOf(n[r+s])>=0;)s++;if(s>0){e.push(t.join(""));for(let o=parseInt(n.substring(r,r+s),10);o>0;o--)t.pop();r+=s}else t.push(n[r]),r++}return e}const Cr={defaultProtocol:"http",events:null,format:Ud,formatHref:Ud,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Wo(n,e=null){let t=Object.assign({},Cr);n&&(t=Object.assign(t,n instanceof Wo?n.o:n));const r=t.ignoreTags,i=[];for(let s=0;s<r.length;s++)i.push(r[s].toUpperCase());this.o=t,e&&(this.defaultRender=e),this.ignoreTags=i}Wo.prototype={o:Cr,ignoreTags:[],defaultRender(n){return n},check(n){return this.get("validate",n.toString(),n)},get(n,e,t){const r=e!=null;let i=this.o[n];return i&&(typeof i=="object"?(i=t.t in i?i[t.t]:Cr[n],typeof i=="function"&&r&&(i=i(e,t))):typeof i=="function"&&r&&(i=i(e,t.t,t)),i)},getObj(n,e,t){let r=this.o[n];return typeof r=="function"&&e!=null&&(r=r(e,t.t,t)),r},render(n){const e=n.render(this);return(this.get("render",null,n)||this.defaultRender)(e,n.t,n)}};function Ud(n){return n}function Wd(n,e){this.t="token",this.v=n,this.tk=e}Wd.prototype={isLink:!1,toString(){return this.v},toHref(n){return this.toString()},toFormattedString(n){const e=this.toString(),t=n.get("truncate",e,this),r=n.get("format",e,this);return t&&r.length>t?r.substring(0,t)+"…":r},toFormattedHref(n){return n.get("formatHref",this.toHref(n.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(n=Cr.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(n),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(n){return{type:this.t,value:this.toFormattedString(n),isLink:this.isLink,href:this.toFormattedHref(n),start:this.startIndex(),end:this.endIndex()}},validate(n){return n.get("validate",this.toString(),this)},render(n){const e=this,t=this.toHref(n.get("defaultProtocol")),r=n.get("formatHref",t,this),i=n.get("tagName",t,e),s=this.toFormattedString(n),o={},l=n.get("className",t,e),a=n.get("target",t,e),c=n.get("rel",t,e),d=n.getObj("attributes",t,e),u=n.getObj("events",t,e);return o.href=r,l&&(o.class=l),a&&(o.target=a),c&&(o.rel=c),d&&Object.assign(o,d),{tagName:i,attributes:o,content:s,eventListeners:u}}};function ji(n,e){class t extends Wd{constructor(i,s){super(i,s),this.t=n}}for(const r in e)t.prototype[r]=e[r];return t.t=n,t}const Kd=ji("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),qd=ji("text"),b0=ji("nl"),Ui=ji("url",{isLink:!0,toHref(n=Cr.defaultProtocol){return this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==gr&&n[1].t===Qt}}),Ze=n=>new Fe(n);function w0({groups:n}){const e=n.domain.concat([Oi,Ai,Xt,Di,Ri,Ii,Pi,Li,Qe,Po,wr,Bi,_i,Vi,dt,zi,xr,$i]),t=[Ni,Qt,_o,ct,Vo,wr,kr,$o,zo,bi,wi,yr,br,mi,pi,gi,yi,ki,xi,Si,Ci,Ei,Mi,vi,Ti],r=[Oi,Ni,Ai,Di,Ri,Ii,Pi,Li,Qe,yr,br,wr,Bi,_i,Vi,kr,dt,zi,xr,$i],i=Ze(),s=E(i,xr);G(s,r,s),G(s,n.domain,s);const o=Ze(),l=Ze(),a=Ze();G(i,n.domain,o),G(i,n.scheme,l),G(i,n.slashscheme,a),G(o,r,s),G(o,n.domain,o);const c=E(o,Xt);E(s,Xt,c),E(l,Xt,c),E(a,Xt,c);const d=E(s,ct);G(d,r,s),G(d,n.domain,s);const u=Ze();G(c,n.domain,u),G(u,n.domain,u);const f=E(u,ct);G(f,n.domain,u);const h=Ze(Kd);G(f,n.tld,h),G(f,n.utld,h),E(c,gr,h);const p=E(u,Qe);E(p,Qe,p),G(p,n.domain,u),G(h,n.domain,u),E(h,ct,f),E(h,Qe,p);const g=E(h,Qt);G(g,n.numeric,Kd);const y=E(o,Qe),w=E(o,ct);E(y,Qe,y),G(y,n.domain,o),G(w,r,s),G(w,n.domain,o);const k=Ze(Ui);G(w,n.tld,k),G(w,n.utld,k),G(k,n.domain,o),G(k,r,s),E(k,ct,w),E(k,Qe,y),E(k,Xt,c);const C=E(k,Qt),D=Ze(Ui);G(C,n.numeric,D);const M=Ze(Ui),P=Ze();G(M,e,M),G(M,t,P),G(P,e,M),G(P,t,P),E(k,dt,M),E(D,dt,M);const T=E(l,Qt),V=E(a,Qt),K=E(V,dt),j=E(K,dt);G(l,n.domain,o),E(l,ct,w),E(l,Qe,y),G(a,n.domain,o),E(a,ct,w),E(a,Qe,y),G(T,n.domain,M),E(T,dt,M),E(T,kr,M),G(j,n.domain,M),G(j,e,M),E(j,dt,M);const U=[[yr,br],[pi,mi],[gi,yi],[bi,wi],[ki,xi],[Si,Ci],[Ei,Mi],[vi,Ti]];for(let R=0;R<U.length;R++){const[X,Z]=U[R],ke=E(M,X);E(P,X,ke),E(ke,Z,M);const he=Ze(Ui);G(ke,e,he);const pe=Ze();G(ke,t),G(he,e,he),G(he,t,pe),G(pe,e,he),G(pe,t,pe),E(he,Z,M),E(pe,Z,M)}return E(i,gr,k),E(i,Bo,b0),{start:i,tokens:zd}}function k0(n,e,t){let r=t.length,i=0,s=[],o=[];for(;i<r;){let l=n,a=null,c=null,d=0,u=null,f=-1;for(;i<r&&!(a=l.go(t[i].t));)o.push(t[i++]);for(;i<r&&(c=a||l.go(t[i].t));)a=null,l=c,l.accepts()?(f=0,u=l):f>=0&&f++,i++,d++;if(f<0)i-=d,i<r&&(o.push(t[i]),i++);else{o.length>0&&(s.push(Ko(qd,e,o)),o=[]),i-=f,d-=f;const h=u.t,p=t.slice(i-d,i);s.push(Ko(h,e,p))}}return o.length>0&&s.push(Ko(qd,e,o)),s}function Ko(n,e,t){const r=t[0].s,i=t[t.length-1].e,s=e.slice(r,i);return new n(s,t)}const x0=typeof console<"u"&&console&&console.warn||(()=>{}),S0="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",oe={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function C0(){return Fe.groups={},oe.scanner=null,oe.parser=null,oe.tokenQueue=[],oe.pluginQueue=[],oe.customSchemes=[],oe.initialized=!1,oe}function Jd(n,e=!1){if(oe.initialized&&x0(`linkifyjs: already initialized - will not register custom scheme "${n}" ${S0}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format.
102
102
  1. Must only contain digits, lowercase ASCII letters or "-"
103
103
  2. Cannot start or end with "-"
104
- 3. "-" cannot repeat`);oe.customSchemes.push([n,e])}function E0(){oe.scanner=g0(oe.customSchemes);for(let n=0;n<oe.tokenQueue.length;n++)oe.tokenQueue[n][1]({scanner:oe.scanner});oe.parser=w0(oe.scanner.tokens);for(let n=0;n<oe.pluginQueue.length;n++)oe.pluginQueue[n][1]({scanner:oe.scanner,parser:oe.parser});return oe.initialized=!0,oe}function qo(n){return oe.initialized||E0(),k0(oe.parser.start,n,Fd(oe.scanner.start,n))}qo.scan=Fd;function Gd(n,e=null,t=null){if(e&&typeof e=="object"){if(t)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);t=e,e=null}const r=new Wo(t),i=qo(n),s=[];for(let o=0;o<i.length;o++){const l=i[o];l.isLink&&(!e||l.t===e)&&r.check(l)&&s.push(l.toFormattedObject(r))}return s}var Jo="[\0-   ᠎ -\u2029  ]",M0=new RegExp(Jo),v0=new RegExp(`${Jo}$`),T0=new RegExp(Jo,"g");function O0(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}function N0(n){return new se({key:new le("autolink"),appendTransaction:(e,t,r)=>{const i=e.some(c=>c.docChanged)&&!t.doc.eq(r.doc),s=e.some(c=>c.getMeta("preventAutolink"));if(!i||s)return;const{tr:o}=r,l=Yc(t.doc,[...e]);if(ld(l).forEach(({newRange:c})=>{const d=jm(r.doc,c,h=>h.isTextblock);let u,f;if(d.length>1)u=d[0],f=r.doc.textBetween(u.pos,u.pos+u.node.nodeSize,void 0," ");else if(d.length){const h=r.doc.textBetween(c.from,c.to," "," ");if(!v0.test(h))return;u=d[0],f=r.doc.textBetween(u.pos,c.to,void 0," ")}if(u&&f){const h=f.split(M0).filter(Boolean);if(h.length<=0)return!1;const p=h[h.length-1],g=u.pos+f.lastIndexOf(p);if(!p)return!1;const y=qo(p).map(w=>w.toObject(n.defaultProtocol));if(!O0(y))return!1;y.filter(w=>w.isLink).map(w=>({...w,from:g+w.start+1,to:g+w.end+1})).filter(w=>r.schema.marks.code?!r.doc.rangeHasMark(w.from,w.to,r.schema.marks.code):!0).filter(w=>n.validate(w.value)).filter(w=>n.shouldAutoLink(w.value)).forEach(w=>{yo(w.from,w.to,r.doc).some(k=>k.mark.type===n.type)||o.addMark(w.from,w.to,n.type.create({href:w.href}))})}}),!!o.steps.length)return o}})}function A0(n){return new se({key:new le("handleClickLink"),props:{handleClick:(e,t,r)=>{var i,s;if(r.button!==0||!e.editable)return!1;let o=null;if(r.target instanceof HTMLAnchorElement)o=r.target;else{let d=r.target;const u=[];for(;d.nodeName!=="DIV";)u.push(d),d=d.parentNode;o=u.find(f=>f.nodeName==="A")}if(!o)return!1;const l=od(e.state,n.type.name),a=(i=o?.href)!=null?i:l.href,c=(s=o?.target)!=null?s:l.target;return n.enableClickSelection&&n.editor.commands.extendMarkRange(n.type.name),o&&a?(window.open(a,c),!0):!1}}})}function D0(n){return new se({key:new le("handlePasteLink"),props:{handlePaste:(e,t,r)=>{const{state:i}=e,{selection:s}=i,{empty:o}=s;if(o)return!1;let l="";r.content.forEach(c=>{l+=c.textContent});const a=Gd(l,{defaultProtocol:n.defaultProtocol}).find(c=>c.isLink&&c.value===l);return!l||!a?!1:n.editor.commands.setMark(n.type,{href:a.href})}}})}function kn(n,e){const t=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const i=typeof r=="string"?r:r.scheme;i&&t.push(i)}),!n||n.replace(T0,"").match(new RegExp(`^(?:(?:${t.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var Yd=yn.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(n=>{if(typeof n=="string"){Jd(n);return}Jd(n.scheme,n.optionalSlashes)})},onDestroy(){C0()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(n,e)=>!!kn(n,e.protocols),validate:n=>!!n,shouldAutoLink:n=>!!n}},addAttributes(){return{href:{default:null,parseHTML(n){return n.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:n=>{const e=n.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:t=>!!kn(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:n}){return this.options.isAllowedUri(n.href,{defaultValidate:e=>!!kn(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",ce(this.options.HTMLAttributes,n),0]:["a",ce(this.options.HTMLAttributes,{...n,href:""}),0]},addCommands(){return{setLink:n=>({chain:e})=>{const{href:t}=n;return this.options.isAllowedUri(t,{defaultValidate:r=>!!kn(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,n).setMeta("preventAutolink",!0).run():!1},toggleLink:n=>({chain:e})=>{const{href:t}=n||{};return t&&!this.options.isAllowedUri(t,{defaultValidate:r=>!!kn(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,n,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[bn({find:n=>{const e=[];if(n){const{protocols:t,defaultProtocol:r}=this.options,i=Gd(n).filter(s=>s.isLink&&this.options.isAllowedUri(s.value,{defaultValidate:o=>!!kn(o,t),protocols:t,defaultProtocol:r}));i.length&&i.forEach(s=>e.push({text:s.value,data:{href:s.href},index:s.start}))}return e},type:this.type,getAttributes:n=>{var e;return{href:(e=n.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const n=[],{protocols:e,defaultProtocol:t}=this.options;return this.options.autolink&&n.push(N0({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!kn(i,e),protocols:e,defaultProtocol:t}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&n.push(A0({type:this.type,editor:this.editor,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&n.push(D0({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),n}}),R0=Yd,I0=Object.defineProperty,P0=(n,e)=>{for(var t in e)I0(n,t,{get:e[t],enumerable:!0})},L0="listItem",Xd="textStyle",Qd=/^\s*([-+*])\s$/,Zd=$e.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:n}){return["ul",ce(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleBulletList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(L0,this.editor.getAttributes(Xd)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let n=_n({find:Qd,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=_n({find:Qd,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Xd),editor:this.editor})),[n]}}),eu=$e.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",ce(this.options.HTMLAttributes,n),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),B0={};P0(B0,{findListItemPos:()=>Er,getNextListDepth:()=>Go,handleBackspace:()=>Yo,handleDelete:()=>Xo,hasListBefore:()=>tu,hasListItemAfter:()=>_0,hasListItemBefore:()=>nu,listItemHasSubList:()=>ru,nextListIsDeeper:()=>iu,nextListIsHigher:()=>su});var Er=(n,e)=>{const{$from:t}=e.selection,r=be(n,e.schema);let i=null,s=t.depth,o=t.pos,l=null;for(;s>0&&l===null;)i=t.node(s),i.type===r?l=s:(s-=1,o-=1);return l===null?null:{$pos:e.doc.resolve(o),depth:l}},Go=(n,e)=>{const t=Er(n,e);if(!t)return!1;const[,r]=Qm(e,n,t.$pos.pos+4);return r},tu=(n,e,t)=>{const{$anchor:r}=n.selection,i=Math.max(0,r.pos-2),s=n.doc.resolve(i).node();return!(!s||!t.includes(s.type.name))},nu=(n,e)=>{var t;const{$anchor:r}=e.selection,i=e.doc.resolve(r.pos-2);return!(i.index()===0||((t=i.nodeBefore)==null?void 0:t.type.name)!==n)},ru=(n,e,t)=>{if(!t)return!1;const r=be(n,e.schema);let i=!1;return t.descendants(s=>{s.type===r&&(i=!0)}),i},Yo=(n,e,t)=>{if(n.commands.undoInputRule())return!0;if(n.state.selection.from!==n.state.selection.to)return!1;if(!Gt(n.state,e)&&tu(n.state,e,t)){const{$anchor:l}=n.state.selection,a=n.state.doc.resolve(l.before()-1),c=[];a.node().descendants((f,h)=>{f.type.name===e&&c.push({node:f,pos:h})});const d=c.at(-1);if(!d)return!1;const u=n.state.doc.resolve(a.start()+d.pos+1);return n.chain().cut({from:l.start()-1,to:l.end()+1},u.end()).joinForward().run()}if(!Gt(n.state,e)||!ng(n.state))return!1;const r=Er(e,n.state);if(!r)return!1;const s=n.state.doc.resolve(r.$pos.pos-2).node(r.depth),o=ru(e,n.state,s);return nu(e,n.state)&&!o?n.commands.joinItemBackward():n.chain().liftListItem(e).run()},iu=(n,e)=>{const t=Go(n,e),r=Er(n,e);return!r||!t?!1:t>r.depth},su=(n,e)=>{const t=Go(n,e),r=Er(n,e);return!r||!t?!1:t<r.depth},Xo=(n,e)=>{if(!Gt(n.state,e)||!tg(n.state,e))return!1;const{selection:t}=n.state,{$from:r,$to:i}=t;return!t.empty&&r.sameParent(i)?!1:iu(e,n.state)?n.chain().focus(n.state.selection.from+4).lift(e).joinBackward().run():su(e,n.state)?n.chain().joinForward().joinBackward().run():n.commands.joinItemForward()},_0=(n,e)=>{var t;const{$anchor:r}=e.selection,i=e.doc.resolve(r.pos-r.parentOffset-2);return!(i.index()===i.parent.childCount-1||((t=i.nodeAfter)==null?void 0:t.type.name)!==n)},ou=de.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&Xo(n,t)&&(e=!0)}),e},"Mod-Delete":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&Xo(n,t)&&(e=!0)}),e},Backspace:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:r})=>{n.state.schema.nodes[t]!==void 0&&Yo(n,t,r)&&(e=!0)}),e},"Mod-Backspace":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:r})=>{n.state.schema.nodes[t]!==void 0&&Yo(n,t,r)&&(e=!0)}),e}}}}),V0="listItem",lu="textStyle",au=/^(\d+)\.\s$/,cu=$e.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:n=>n.hasAttribute("start")?parseInt(n.getAttribute("start")||"",10):1},type:{default:null,parseHTML:n=>n.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:n}){const{start:e,...t}=n;return e===1?["ol",ce(this.options.HTMLAttributes,t),0]:["ol",ce(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleOrderedList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(V0,this.editor.getAttributes(lu)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let n=_n({find:au,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(n=_n({find:au,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(lu)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[n]}}),$0=/^\s*(\[([( |x])?\])\s$/,z0=$e.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:n=>{const e=n.getAttribute("data-checked");return e===""||e==="true"},renderHTML:n=>({"data-checked":n.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:n,HTMLAttributes:e}){return["li",ce(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:n.attrs.checked?"checked":null}],["span"]],["div",0]]},addKeyboardShortcuts(){const n={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...n,Tab:()=>this.editor.commands.sinkListItem(this.name)}:n},addNodeView(){return({node:n,HTMLAttributes:e,getPos:t,editor:r})=>{const i=document.createElement("li"),s=document.createElement("label"),o=document.createElement("span"),l=document.createElement("input"),a=document.createElement("div"),c=d=>{var u,f;l.ariaLabel=((f=(u=this.options.a11y)==null?void 0:u.checkboxLabel)==null?void 0:f.call(u,d,l.checked))||`Task item checkbox for ${d.textContent||"empty task item"}`};return c(n),s.contentEditable="false",l.type="checkbox",l.addEventListener("mousedown",d=>d.preventDefault()),l.addEventListener("change",d=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){l.checked=!l.checked;return}const{checked:u}=d.target;r.isEditable&&typeof t=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:f})=>{const h=t();if(typeof h!="number")return!1;const p=f.doc.nodeAt(h);return f.setNodeMarkup(h,void 0,{...p?.attrs,checked:u}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(n,u)||(l.checked=!l.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([d,u])=>{i.setAttribute(d,u)}),i.dataset.checked=n.attrs.checked,l.checked=n.attrs.checked,s.append(l,o),i.append(s,a),Object.entries(e).forEach(([d,u])=>{i.setAttribute(d,u)}),{dom:i,contentDOM:a,update:d=>d.type!==this.type?!1:(i.dataset.checked=d.attrs.checked,l.checked=d.attrs.checked,c(d),!0)}}},addInputRules(){return[_n({find:$0,type:this.type,getAttributes:n=>({checked:n[n.length-1]==="x"})})]}}),H0=$e.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:n}){return["ul",ce(this.options.HTMLAttributes,n,{"data-type":this.name}),0]},addCommands(){return{toggleTaskList:()=>({commands:n})=>n.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});de.create({name:"listKit",addExtensions(){const n=[];return this.options.bulletList!==!1&&n.push(Zd.configure(this.options.bulletList)),this.options.listItem!==!1&&n.push(eu.configure(this.options.listItem)),this.options.listKeymap!==!1&&n.push(ou.configure(this.options.listKeymap)),this.options.orderedList!==!1&&n.push(cu.configure(this.options.orderedList)),this.options.taskItem!==!1&&n.push(z0.configure(this.options.taskItem)),this.options.taskList!==!1&&n.push(H0.configure(this.options.taskList)),n}});var F0=$e.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",ce(this.options.HTMLAttributes,n),0]},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),j0=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,U0=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,W0=yn.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["s",ce(this.options.HTMLAttributes,n),0]},addCommands(){return{setStrike:()=>({commands:n})=>n.setMark(this.name),toggleStrike:()=>({commands:n})=>n.toggleMark(this.name),unsetStrike:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Bn({find:j0,type:this.type})]},addPasteRules(){return[bn({find:U0,type:this.type})]}}),K0=$e.create({name:"text",group:"inline"}),q0=yn.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["u",ce(this.options.HTMLAttributes,n),0]},addCommands(){return{setUnderline:()=>({commands:n})=>n.setMark(this.name),toggleUnderline:()=>({commands:n})=>n.toggleMark(this.name),unsetUnderline:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function J0(n={}){return new se({view(e){return new G0(e,n)}})}class G0{constructor(e,t){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=t.width)!==null&&r!==void 0?r:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let s=o=>{this[i](o)};return e.dom.addEventListener(i,s),{name:i,handler:s}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,r,i=this.editorView.dom,s=i.getBoundingClientRect(),o=s.width/i.offsetWidth,l=s.height/i.offsetHeight;if(t){let u=e.nodeBefore,f=e.nodeAfter;if(u||f){let h=this.editorView.nodeDOM(this.cursorPos-(u?u.nodeSize:0));if(h){let p=h.getBoundingClientRect(),g=u?p.bottom:p.top;u&&f&&(g=(g+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let y=this.width/2*l;r={left:p.left,right:p.right,top:g-y,bottom:g+y}}}}if(!r){let u=this.editorView.coordsAtPos(this.cursorPos),f=this.width/2*o;r={left:u.left-f,right:u.left+f,top:u.top,bottom:u.bottom}}let a=this.editorView.dom.offsetParent;this.element||(this.element=a.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let c,d;if(!a||a==document.body&&getComputedStyle(a).position=="static")c=-pageXOffset,d=-pageYOffset;else{let u=a.getBoundingClientRect(),f=u.width/a.offsetWidth,h=u.height/a.offsetHeight;c=u.left-a.scrollLeft*f,d=u.top-a.scrollTop*h}this.element.style.left=(r.left-c)/o+"px",this.element.style.top=(r.top-d)/l+"px",this.element.style.width=(r.right-r.left)/o+"px",this.element.style.height=(r.bottom-r.top)/l+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),i=r&&r.type.spec.disableDropCursor,s=typeof i=="function"?i(this.editorView,t,e):i;if(t&&!s){let o=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=aa(this.editorView.state.doc,o,this.editorView.dragging.slice);l!=null&&(o=l)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class fe extends H{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return fe.valid(r)?new fe(r):H.near(r)}content(){return N.empty}eq(e){return e instanceof fe&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new fe(e.resolve(t.pos))}getBookmark(){return new Qo(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!Y0(e)||!X0(e))return!1;let r=t.type.spec.allowGapCursor;if(r!=null)return r;let i=t.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,t,r=!1){e:for(;;){if(!r&&fe.valid(e))return e;let i=e.pos,s=null;for(let o=e.depth;;o--){let l=e.node(o);if(t>0?e.indexAfter(o)<l.childCount:e.index(o)>0){s=l.child(t>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;i+=t;let a=e.doc.resolve(i);if(fe.valid(a))return a}for(;;){let o=t>0?s.firstChild:s.lastChild;if(!o){if(s.isAtom&&!s.isText&&!B.isSelectable(s)){e=e.doc.resolve(i+s.nodeSize*t),r=!1;continue e}break}s=o,i+=t;let l=e.doc.resolve(i);if(fe.valid(l))return l}return null}}}fe.prototype.visible=!1,fe.findFrom=fe.findGapCursorFrom,H.jsonID("gapcursor",fe);class Qo{constructor(e){this.pos=e}map(e){return new Qo(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return fe.valid(t)?new fe(t):H.near(t)}}function Y0(n){for(let e=n.depth;e>=0;e--){let t=n.index(e),r=n.node(e);if(t==0){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(t-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||i.isAtom||i.type.spec.isolating)return!0;if(i.inlineContent)return!1}}return!0}function X0(n){for(let e=n.depth;e>=0;e--){let t=n.indexAfter(e),r=n.node(e);if(t==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(t);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||i.isAtom||i.type.spec.isolating)return!0;if(i.inlineContent)return!1}}return!0}function Q0(){return new se({props:{decorations:nb,createSelectionBetween(n,e,t){return e.pos==t.pos&&fe.valid(t)?new fe(t):null},handleClick:eb,handleKeyDown:Z0,handleDOMEvents:{beforeinput:tb}}})}const Z0=no({ArrowLeft:Wi("horiz",-1),ArrowRight:Wi("horiz",1),ArrowUp:Wi("vert",-1),ArrowDown:Wi("vert",1)});function Wi(n,e){const t=n=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,s){let o=r.selection,l=e>0?o.$to:o.$from,a=o.empty;if(o instanceof F){if(!s.endOfTextblock(t)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let c=fe.findGapCursorFrom(l,e,a);return c?(i&&i(r.tr.setSelection(new fe(c))),!0):!1}}function eb(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!fe.valid(r))return!1;let i=n.posAtCoords({left:t.clientX,top:t.clientY});return i&&i.inside>-1&&B.isSelectable(n.state.doc.nodeAt(i.inside))?!1:(n.dispatch(n.state.tr.setSelection(new fe(r))),!0)}function tb(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof fe))return!1;let{$from:t}=n.state.selection,r=t.parent.contentMatchAt(t.index()).findWrapping(n.state.schema.nodes.text);if(!r)return!1;let i=S.empty;for(let o=r.length-1;o>=0;o--)i=S.from(r[o].createAndFill(null,i));let s=n.state.tr.replace(t.pos,t.pos,new N(i,0,0));return s.setSelection(F.near(s.doc.resolve(t.pos+1))),n.dispatch(s),!1}function nb(n){if(!(n.selection instanceof fe))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",ae.create(n.doc,[Ie.widget(n.selection.head,e,{key:"gapcursor"})])}var Ki=200,Ee=function(){};Ee.prototype.append=function(e){return e.length?(e=Ee.from(e),!this.length&&e||e.length<Ki&&this.leafAppend(e)||this.length<Ki&&e.leafPrepend(this)||this.appendInner(e)):this},Ee.prototype.prepend=function(e){return e.length?Ee.from(e).append(this):this},Ee.prototype.appendInner=function(e){return new rb(this,e)},Ee.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?Ee.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},Ee.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},Ee.prototype.forEach=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length),t<=r?this.forEachInner(e,t,r,0):this.forEachInvertedInner(e,t,r,0)},Ee.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(s,o){return i.push(e(s,o))},t,r),i},Ee.from=function(e){return e instanceof Ee?e:e&&e.length?new du(e):Ee.empty};var du=(function(n){function e(r){n.call(this),this.values=r}n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,s){return i==0&&s==this.length?this:new e(this.values.slice(i,s))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,s,o,l){for(var a=s;a<o;a++)if(i(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(i,s,o,l){for(var a=s-1;a>=o;a--)if(i(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Ki)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Ki)return new e(i.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e})(Ee);Ee.empty=new du([]);var rb=(function(n){function e(t,r){n.call(this),this.left=t,this.right=r,this.length=t.length+r.length,this.depth=Math.max(t.depth,r.depth)+1}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,i,s,o){var l=this.left.length;if(i<l&&this.left.forEachInner(r,i,Math.min(s,l),o)===!1||s>l&&this.right.forEachInner(r,Math.max(i-l,0),Math.min(this.length,s)-l,o+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,s,o){var l=this.left.length;if(i>l&&this.right.forEachInvertedInner(r,i-l,Math.max(s,l)-l,o+l)===!1||s<l&&this.left.forEachInvertedInner(r,Math.min(i,l),s,o)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var s=this.left.length;return i<=s?this.left.slice(r,i):r>=s?this.right.slice(r-s,i-s):this.left.slice(r,s).append(this.right.slice(0,i-s))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(Ee);const ib=500;class nt{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,s;t&&(i=this.remapping(r,this.items.length),s=i.maps.length);let o=e.tr,l,a,c=[],d=[];return this.items.forEach((u,f)=>{if(!u.step){i||(i=this.remapping(r,f+1),s=i.maps.length),s--,d.push(u);return}if(i){d.push(new ut(u.map));let h=u.step.map(i.slice(s)),p;h&&o.maybeStep(h).doc&&(p=o.mapping.maps[o.mapping.maps.length-1],c.push(new ut(p,void 0,void 0,c.length+d.length))),s--,p&&i.appendMap(p,s)}else o.maybeStep(u.step);if(u.selection)return l=i?u.selection.map(i.slice(s)):u.selection,a=new nt(this.items.slice(0,r).append(d.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:o,selection:l}}addTransform(e,t,r,i){let s=[],o=this.eventCount,l=this.items,a=!i&&l.length?l.get(l.length-1):null;for(let d=0;d<e.steps.length;d++){let u=e.steps[d].invert(e.docs[d]),f=new ut(e.mapping.maps[d],u,t),h;(h=a&&a.merge(f))&&(f=h,d?s.pop():l=l.slice(0,l.length-1)),s.push(f),t&&(o++,t=void 0),i||(a=f)}let c=o-r.depth;return c>ob&&(l=sb(l,c),o-=c),new nt(l.append(s),o)}remapping(e,t){let r=new Qn;return this.items.forEach((i,s)=>{let o=i.mirrorOffset!=null&&s-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,o)},e,t),r}addMaps(e){return this.eventCount==0?this:new nt(this.items.append(e.map(t=>new ut(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-t),s=e.mapping,o=e.steps.length,l=this.eventCount;this.items.forEach(f=>{f.selection&&l--},i);let a=t;this.items.forEach(f=>{let h=s.getMirror(--a);if(h==null)return;o=Math.min(o,h);let p=s.maps[h];if(f.step){let g=e.steps[h].invert(e.docs[h]),y=f.selection&&f.selection.map(s.slice(a+1,h));y&&l++,r.push(new ut(p,g,y))}else r.push(new ut(p))},i);let c=[];for(let f=t;f<o;f++)c.push(new ut(s.maps[f]));let d=this.items.slice(0,i).append(c).append(r),u=new nt(d,l);return u.emptyItemCount()>ib&&(u=u.compress(this.items.length-r.length)),u}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),r=t.maps.length,i=[],s=0;return this.items.forEach((o,l)=>{if(l>=e)i.push(o),o.selection&&s++;else if(o.step){let a=o.step.map(t.slice(r)),c=a&&a.getMap();if(r--,c&&t.appendMap(c,r),a){let d=o.selection&&o.selection.map(t.slice(r));d&&s++;let u=new ut(c.invert(),a,d),f,h=i.length-1;(f=i.length&&i[h].merge(u))?i[h]=f:i.push(u)}}else o.map&&r--},this.items.length,0),new nt(Ee.from(i.reverse()),s)}}nt.empty=new nt(Ee.empty,0);function sb(n,e){let t;return n.forEach((r,i)=>{if(r.selection&&e--==0)return t=i,!1}),n.slice(t)}class ut{constructor(e,t,r,i){this.map=e,this.step=t,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new ut(t.getMap().invert(),t,this.selection)}}}class en{constructor(e,t,r,i,s){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=i,this.prevComposition=s}}const ob=20;function lb(n,e,t,r){let i=t.getMeta(xn),s;if(i)return i.historyState;t.getMeta(db)&&(n=new en(n.done,n.undone,null,0,-1));let o=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(o&&o.getMeta(xn))return o.getMeta(xn).redo?new en(n.done.addTransform(t,void 0,r,qi(e)),n.undone,uu(t.mapping.maps),n.prevTime,n.prevComposition):new en(n.done,n.undone.addTransform(t,void 0,r,qi(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let l=t.getMeta("composition"),a=n.prevTime==0||!o&&n.prevComposition!=l&&(n.prevTime<(t.time||0)-r.newGroupDelay||!ab(t,n.prevRanges)),c=o?Zo(n.prevRanges,t.mapping):uu(t.mapping.maps);return new en(n.done.addTransform(t,a?e.selection.getBookmark():void 0,r,qi(e)),nt.empty,c,t.time,l??n.prevComposition)}else return(s=t.getMeta("rebased"))?new en(n.done.rebased(t,s),n.undone.rebased(t,s),Zo(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new en(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),Zo(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function ab(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,i)=>{for(let s=0;s<e.length;s+=2)r<=e[s+1]&&i>=e[s]&&(t=!0)}),t}function uu(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((r,i,s,o)=>e.push(s,o));return e}function Zo(n,e){if(!n)return null;let t=[];for(let r=0;r<n.length;r+=2){let i=e.map(n[r],1),s=e.map(n[r+1],-1);i<=s&&t.push(i,s)}return t}function cb(n,e,t){let r=qi(e),i=xn.get(e).spec.config,s=(t?n.undone:n.done).popEvent(e,r);if(!s)return null;let o=s.selection.resolve(s.transform.doc),l=(t?n.done:n.undone).addTransform(s.transform,e.selection.getBookmark(),i,r),a=new en(t?l:s.remaining,t?s.remaining:l,null,0,-1);return s.transform.setSelection(o).setMeta(xn,{redo:t,historyState:a})}let el=!1,fu=null;function qi(n){let e=n.plugins;if(fu!=e){el=!1,fu=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){el=!0;break}}return el}const xn=new le("history"),db=new le("closeHistory");function ub(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new se({key:xn,state:{init(){return new en(nt.empty,nt.empty,null,0,-1)},apply(e,t,r){return lb(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,i=r=="historyUndo"?pu:r=="historyRedo"?mu:null;return i?(t.preventDefault(),i(e.state,e.dispatch)):!1}}}})}function hu(n,e){return(t,r)=>{let i=xn.getState(t);if(!i||(n?i.undone:i.done).eventCount==0)return!1;if(r){let s=cb(i,t,n);s&&r(e?s.scrollIntoView():s)}return!0}}const pu=hu(!1,!0),mu=hu(!0,!0);de.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:n=>n.length,wordCounter:n=>n.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=n=>{const e=n?.node||this.editor.state.doc;if((n?.mode||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=n=>{const e=n?.node||this.editor.state.doc,t=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(t)}},addProseMirrorPlugins(){let n=!1;return[new se({key:new le("characterCount"),appendTransaction:(e,t,r)=>{if(n)return;const i=this.options.limit;if(i==null||i===0){n=!0;return}const s=this.storage.characters({node:r.doc});if(s>i){const o=s-i,l=0,a=o;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);const c=r.tr.deleteRange(l,a);return n=!0,c}n=!0},filterTransaction:(e,t)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const i=this.storage.characters({node:t.doc}),s=this.storage.characters({node:e.doc});if(s<=r||i>r&&s>r&&s<=i)return!0;if(i>r&&s>r&&s>i||!e.getMeta("paste"))return!1;const l=e.selection.$head.pos,a=s-r,c=l-a,d=l;return e.deleteRange(c,d),!(this.storage.characters({node:e.doc})>r)}})]}});var fb=de.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[J0(this.options)]}});de.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new se({key:new le("focus"),props:{decorations:({doc:n,selection:e})=>{const{isEditable:t,isFocused:r}=this.editor,{anchor:i}=e,s=[];if(!t||!r)return ae.create(n,[]);let o=0;this.options.mode==="deepest"&&n.descendants((a,c)=>{if(a.isText)return;if(!(i>=c&&i<=c+a.nodeSize-1))return!1;o+=1});let l=0;return n.descendants((a,c)=>{if(a.isText||!(i>=c&&i<=c+a.nodeSize-1))return!1;if(l+=1,this.options.mode==="deepest"&&o-l>0||this.options.mode==="shallowest"&&l>1)return this.options.mode==="deepest";s.push(Ie.node(c,c+a.nodeSize,{class:this.options.className}))}),ae.create(n,s)}}})]}});var hb=de.create({name:"gapCursor",addProseMirrorPlugins(){return[Q0()]},extendNodeSchema(n){var e;const t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=ee($(n,"allowGapCursor",t)))!=null?e:null}}}),pb=de.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new se({key:new le("placeholder"),props:{decorations:({doc:n,selection:e})=>{const t=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=e,i=[];if(!t)return null;const s=this.editor.isEmpty;return n.descendants((o,l)=>{const a=r>=l&&r<=l+o.nodeSize,c=!o.isLeaf&&si(o);if((a||!this.options.showOnlyCurrent)&&c){const d=[this.options.emptyNodeClass];s&&d.push(this.options.emptyEditorClass);const u=Ie.node(l,l+o.nodeSize,{class:d.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:o,pos:l,hasAnchor:a}):this.options.placeholder});i.push(u)}return this.options.includeChildren}),ae.create(n,i)}}})]}});de.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:n,options:e}=this;return[new se({key:new le("selection"),props:{decorations(t){return t.selection.empty||n.isFocused||!n.isEditable||fd(t.selection)||n.view.dragging?null:ae.create(t.doc,[Ie.inline(t.selection.from,t.selection.to,{class:e.className})])}}})]}});function gu({types:n,node:e}){return e&&Array.isArray(n)&&n.includes(e.type)||e?.type===n}var mb=de.create({name:"trailingNode",addOptions(){return{node:"paragraph",notAfter:[]}},addProseMirrorPlugins(){const n=new le(this.name),e=Object.entries(this.editor.schema.nodes).map(([,t])=>t).filter(t=>(this.options.notAfter||[]).concat(this.options.node).includes(t.name));return[new se({key:n,appendTransaction:(t,r,i)=>{const{doc:s,tr:o,schema:l}=i,a=n.getState(i),c=s.content.size,d=l.nodes[this.options.node];if(a)return o.insert(c,d.create())},state:{init:(t,r)=>{const i=r.tr.doc.lastChild;return!gu({node:i,types:e})},apply:(t,r)=>{if(!t.docChanged)return r;const i=t.doc.lastChild;return!gu({node:i,types:e})}}})]}}),gb=de.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>pu(n,e),redo:()=>({state:n,dispatch:e})=>mu(n,e)}},addProseMirrorPlugins(){return[ub(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),yb=de.create({name:"starterKit",addExtensions(){var n,e,t,r;const i=[];return this.options.bold!==!1&&i.push(Ky.configure(this.options.bold)),this.options.blockquote!==!1&&i.push(Hy.configure(this.options.blockquote)),this.options.bulletList!==!1&&i.push(Zd.configure(this.options.bulletList)),this.options.code!==!1&&i.push(Gy.configure(this.options.code)),this.options.codeBlock!==!1&&i.push(Id.configure(this.options.codeBlock)),this.options.document!==!1&&i.push(Zy.configure(this.options.document)),this.options.dropcursor!==!1&&i.push(fb.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&i.push(hb.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&i.push(e0.configure(this.options.hardBreak)),this.options.heading!==!1&&i.push(t0.configure(this.options.heading)),this.options.undoRedo!==!1&&i.push(gb.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&i.push(n0.configure(this.options.horizontalRule)),this.options.italic!==!1&&i.push(l0.configure(this.options.italic)),this.options.listItem!==!1&&i.push(eu.configure(this.options.listItem)),this.options.listKeymap!==!1&&i.push(ou.configure((n=this.options)==null?void 0:n.listKeymap)),this.options.link!==!1&&i.push(Yd.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&i.push(cu.configure(this.options.orderedList)),this.options.paragraph!==!1&&i.push(F0.configure(this.options.paragraph)),this.options.strike!==!1&&i.push(W0.configure(this.options.strike)),this.options.text!==!1&&i.push(K0.configure(this.options.text)),this.options.underline!==!1&&i.push(q0.configure((t=this.options)==null?void 0:t.underline)),this.options.trailingNode!==!1&&i.push(mb.configure((r=this.options)==null?void 0:r.trailingNode)),i}}),bb=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,wb=$e.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{}}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:n}){return["img",ce(this.options.HTMLAttributes,n)]},addCommands(){return{setImage:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n})}},addInputRules(){return[Dd({find:bb,type:this.type,getAttributes:n=>{const[,,e,t,r]=n;return{src:t,alt:e,title:r}}})]}}),kb=wb;const yu=["top","right","bottom","left"],bu=["start","end"],wu=yu.reduce((n,e)=>n.concat(e,e+"-"+bu[0],e+"-"+bu[1]),[]),ft=Math.min,ze=Math.max,Ji=Math.round,ht=n=>({x:n,y:n}),xb={left:"right",right:"left",bottom:"top",top:"bottom"},Sb={start:"end",end:"start"};function tl(n,e,t){return ze(n,ft(e,t))}function At(n,e){return typeof n=="function"?n(e):n}function et(n){return n.split("-")[0]}function rt(n){return n.split("-")[1]}function ku(n){return n==="x"?"y":"x"}function nl(n){return n==="y"?"height":"width"}const Cb=new Set(["top","bottom"]);function pt(n){return Cb.has(et(n))?"y":"x"}function rl(n){return ku(pt(n))}function xu(n,e,t){t===void 0&&(t=!1);const r=rt(n),i=rl(n),s=nl(i);let o=i==="x"?r===(t?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=Yi(o)),[o,Yi(o)]}function Eb(n){const e=Yi(n);return[Gi(n),e,Gi(e)]}function Gi(n){return n.replace(/start|end/g,e=>Sb[e])}const Su=["left","right"],Cu=["right","left"],Mb=["top","bottom"],vb=["bottom","top"];function Tb(n,e,t){switch(n){case"top":case"bottom":return t?e?Cu:Su:e?Su:Cu;case"left":case"right":return e?Mb:vb;default:return[]}}function Ob(n,e,t,r){const i=rt(n);let s=Tb(et(n),t==="start",r);return i&&(s=s.map(o=>o+"-"+i),e&&(s=s.concat(s.map(Gi)))),s}function Yi(n){return n.replace(/left|right|bottom|top/g,e=>xb[e])}function Nb(n){return{top:0,right:0,bottom:0,left:0,...n}}function il(n){return typeof n!="number"?Nb(n):{top:n,right:n,bottom:n,left:n}}function $n(n){const{x:e,y:t,width:r,height:i}=n;return{width:r,height:i,top:t,left:e,right:e+r,bottom:t+i,x:e,y:t}}function Eu(n,e,t){let{reference:r,floating:i}=n;const s=pt(e),o=rl(e),l=nl(o),a=et(e),c=s==="y",d=r.x+r.width/2-i.width/2,u=r.y+r.height/2-i.height/2,f=r[l]/2-i[l]/2;let h;switch(a){case"top":h={x:d,y:r.y-i.height};break;case"bottom":h={x:d,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:u};break;case"left":h={x:r.x-i.width,y:u};break;default:h={x:r.x,y:r.y}}switch(rt(e)){case"start":h[o]-=f*(t&&c?-1:1);break;case"end":h[o]+=f*(t&&c?-1:1);break}return h}const Ab=async(n,e,t)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=t,l=s.filter(Boolean),a=await(o.isRTL==null?void 0:o.isRTL(e));let c=await o.getElementRects({reference:n,floating:e,strategy:i}),{x:d,y:u}=Eu(c,r,a),f=r,h={},p=0;for(let g=0;g<l.length;g++){const{name:y,fn:w}=l[g],{x:k,y:C,data:D,reset:M}=await w({x:d,y:u,initialPlacement:r,placement:f,strategy:i,middlewareData:h,rects:c,platform:o,elements:{reference:n,floating:e}});d=k??d,u=C??u,h={...h,[y]:{...h[y],...D}},M&&p<=50&&(p++,typeof M=="object"&&(M.placement&&(f=M.placement),M.rects&&(c=M.rects===!0?await o.getElementRects({reference:n,floating:e,strategy:i}):M.rects),{x:d,y:u}=Eu(c,f,a)),g=-1)}return{x:d,y:u,placement:f,strategy:i,middlewareData:h}};async function zn(n,e){var t;e===void 0&&(e={});const{x:r,y:i,platform:s,rects:o,elements:l,strategy:a}=n,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:f=!1,padding:h=0}=At(e,n),p=il(h),y=l[f?u==="floating"?"reference":"floating":u],w=$n(await s.getClippingRect({element:(t=await(s.isElement==null?void 0:s.isElement(y)))==null||t?y:y.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:c,rootBoundary:d,strategy:a})),k=u==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,C=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),D=await(s.isElement==null?void 0:s.isElement(C))?await(s.getScale==null?void 0:s.getScale(C))||{x:1,y:1}:{x:1,y:1},M=$n(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:k,offsetParent:C,strategy:a}):k);return{top:(w.top-M.top+p.top)/D.y,bottom:(M.bottom-w.bottom+p.bottom)/D.y,left:(w.left-M.left+p.left)/D.x,right:(M.right-w.right+p.right)/D.x}}const Db=n=>({name:"arrow",options:n,async fn(e){const{x:t,y:r,placement:i,rects:s,platform:o,elements:l,middlewareData:a}=e,{element:c,padding:d=0}=At(n,e)||{};if(c==null)return{};const u=il(d),f={x:t,y:r},h=rl(i),p=nl(h),g=await o.getDimensions(c),y=h==="y",w=y?"top":"left",k=y?"bottom":"right",C=y?"clientHeight":"clientWidth",D=s.reference[p]+s.reference[h]-f[h]-s.floating[p],M=f[h]-s.reference[h],P=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c));let T=P?P[C]:0;(!T||!await(o.isElement==null?void 0:o.isElement(P)))&&(T=l.floating[C]||s.floating[p]);const V=D/2-M/2,K=T/2-g[p]/2-1,j=ft(u[w],K),U=ft(u[k],K),R=j,X=T-g[p]-U,Z=T/2-g[p]/2+V,ke=tl(R,Z,X),he=!a.arrow&&rt(i)!=null&&Z!==ke&&s.reference[p]/2-(Z<R?j:U)-g[p]/2<0,pe=he?Z<R?Z-R:Z-X:0;return{[h]:f[h]+pe,data:{[h]:ke,centerOffset:Z-ke-pe,...he&&{alignmentOffset:pe}},reset:he}}});function Rb(n,e,t){return(n?[...t.filter(i=>rt(i)===n),...t.filter(i=>rt(i)!==n)]:t.filter(i=>et(i)===i)).filter(i=>n?rt(i)===n||(e?Gi(i)!==i:!1):!0)}const Ib=function(n){return n===void 0&&(n={}),{name:"autoPlacement",options:n,async fn(e){var t,r,i;const{rects:s,middlewareData:o,placement:l,platform:a,elements:c}=e,{crossAxis:d=!1,alignment:u,allowedPlacements:f=wu,autoAlignment:h=!0,...p}=At(n,e),g=u!==void 0||f===wu?Rb(u||null,h,f):f,y=await zn(e,p),w=((t=o.autoPlacement)==null?void 0:t.index)||0,k=g[w];if(k==null)return{};const C=xu(k,s,await(a.isRTL==null?void 0:a.isRTL(c.floating)));if(l!==k)return{reset:{placement:g[0]}};const D=[y[et(k)],y[C[0]],y[C[1]]],M=[...((r=o.autoPlacement)==null?void 0:r.overflows)||[],{placement:k,overflows:D}],P=g[w+1];if(P)return{data:{index:w+1,overflows:M},reset:{placement:P}};const T=M.map(j=>{const U=rt(j.placement);return[j.placement,U&&d?j.overflows.slice(0,2).reduce((R,X)=>R+X,0):j.overflows[0],j.overflows]}).sort((j,U)=>j[1]-U[1]),K=((i=T.filter(j=>j[2].slice(0,rt(j[0])?2:3).every(U=>U<=0))[0])==null?void 0:i[0])||T[0][0];return K!==l?{data:{index:w+1,overflows:M},reset:{placement:K}}:{}}}},Pb=function(n){return n===void 0&&(n={}),{name:"flip",options:n,async fn(e){var t,r;const{placement:i,middlewareData:s,rects:o,initialPlacement:l,platform:a,elements:c}=e,{mainAxis:d=!0,crossAxis:u=!0,fallbackPlacements:f,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:g=!0,...y}=At(n,e);if((t=s.arrow)!=null&&t.alignmentOffset)return{};const w=et(i),k=pt(l),C=et(l)===l,D=await(a.isRTL==null?void 0:a.isRTL(c.floating)),M=f||(C||!g?[Yi(l)]:Eb(l)),P=p!=="none";!f&&P&&M.push(...Ob(l,g,p,D));const T=[l,...M],V=await zn(e,y),K=[];let j=((r=s.flip)==null?void 0:r.overflows)||[];if(d&&K.push(V[w]),u){const Z=xu(i,o,D);K.push(V[Z[0]],V[Z[1]])}if(j=[...j,{placement:i,overflows:K}],!K.every(Z=>Z<=0)){var U,R;const Z=(((U=s.flip)==null?void 0:U.index)||0)+1,ke=T[Z];if(ke&&(!(u==="alignment"?k!==pt(ke):!1)||j.every(Me=>pt(Me.placement)===k?Me.overflows[0]>0:!0)))return{data:{index:Z,overflows:j},reset:{placement:ke}};let he=(R=j.filter(pe=>pe.overflows[0]<=0).sort((pe,Me)=>pe.overflows[1]-Me.overflows[1])[0])==null?void 0:R.placement;if(!he)switch(h){case"bestFit":{var X;const pe=(X=j.filter(Me=>{if(P){const yt=pt(Me.placement);return yt===k||yt==="y"}return!0}).map(Me=>[Me.placement,Me.overflows.filter(yt=>yt>0).reduce((yt,pl)=>yt+pl,0)]).sort((Me,yt)=>Me[1]-yt[1])[0])==null?void 0:X[0];pe&&(he=pe);break}case"initialPlacement":he=l;break}if(i!==he)return{reset:{placement:he}}}return{}}}};function Mu(n,e){return{top:n.top-e.height,right:n.right-e.width,bottom:n.bottom-e.height,left:n.left-e.width}}function vu(n){return yu.some(e=>n[e]>=0)}const Lb=function(n){return n===void 0&&(n={}),{name:"hide",options:n,async fn(e){const{rects:t}=e,{strategy:r="referenceHidden",...i}=At(n,e);switch(r){case"referenceHidden":{const s=await zn(e,{...i,elementContext:"reference"}),o=Mu(s,t.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:vu(o)}}}case"escaped":{const s=await zn(e,{...i,altBoundary:!0}),o=Mu(s,t.floating);return{data:{escapedOffsets:o,escaped:vu(o)}}}default:return{}}}}};function Tu(n){const e=ft(...n.map(s=>s.left)),t=ft(...n.map(s=>s.top)),r=ze(...n.map(s=>s.right)),i=ze(...n.map(s=>s.bottom));return{x:e,y:t,width:r-e,height:i-t}}function Bb(n){const e=n.slice().sort((i,s)=>i.y-s.y),t=[];let r=null;for(let i=0;i<e.length;i++){const s=e[i];!r||s.y-r.y>r.height/2?t.push([s]):t[t.length-1].push(s),r=s}return t.map(i=>$n(Tu(i)))}const _b=function(n){return n===void 0&&(n={}),{name:"inline",options:n,async fn(e){const{placement:t,elements:r,rects:i,platform:s,strategy:o}=e,{padding:l=2,x:a,y:c}=At(n,e),d=Array.from(await(s.getClientRects==null?void 0:s.getClientRects(r.reference))||[]),u=Bb(d),f=$n(Tu(d)),h=il(l);function p(){if(u.length===2&&u[0].left>u[1].right&&a!=null&&c!=null)return u.find(y=>a>y.left-h.left&&a<y.right+h.right&&c>y.top-h.top&&c<y.bottom+h.bottom)||f;if(u.length>=2){if(pt(t)==="y"){const j=u[0],U=u[u.length-1],R=et(t)==="top",X=j.top,Z=U.bottom,ke=R?j.left:U.left,he=R?j.right:U.right,pe=he-ke,Me=Z-X;return{top:X,bottom:Z,left:ke,right:he,width:pe,height:Me,x:ke,y:X}}const y=et(t)==="left",w=ze(...u.map(j=>j.right)),k=ft(...u.map(j=>j.left)),C=u.filter(j=>y?j.left===k:j.right===w),D=C[0].top,M=C[C.length-1].bottom,P=k,T=w,V=T-P,K=M-D;return{top:D,bottom:M,left:P,right:T,width:V,height:K,x:P,y:D}}return f}const g=await s.getElementRects({reference:{getBoundingClientRect:p},floating:r.floating,strategy:o});return i.reference.x!==g.reference.x||i.reference.y!==g.reference.y||i.reference.width!==g.reference.width||i.reference.height!==g.reference.height?{reset:{rects:g}}:{}}}},Vb=new Set(["left","top"]);async function $b(n,e){const{placement:t,platform:r,elements:i}=n,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=et(t),l=rt(t),a=pt(t)==="y",c=Vb.has(o)?-1:1,d=s&&a?-1:1,u=At(e,n);let{mainAxis:f,crossAxis:h,alignmentAxis:p}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return l&&typeof p=="number"&&(h=l==="end"?p*-1:p),a?{x:h*d,y:f*c}:{x:f*c,y:h*d}}const zb=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(e){var t,r;const{x:i,y:s,placement:o,middlewareData:l}=e,a=await $b(e,n);return o===((t=l.offset)==null?void 0:t.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:i+a.x,y:s+a.y,data:{...a,placement:o}}}}},Hb=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(e){const{x:t,y:r,placement:i}=e,{mainAxis:s=!0,crossAxis:o=!1,limiter:l={fn:y=>{let{x:w,y:k}=y;return{x:w,y:k}}},...a}=At(n,e),c={x:t,y:r},d=await zn(e,a),u=pt(et(i)),f=ku(u);let h=c[f],p=c[u];if(s){const y=f==="y"?"top":"left",w=f==="y"?"bottom":"right",k=h+d[y],C=h-d[w];h=tl(k,h,C)}if(o){const y=u==="y"?"top":"left",w=u==="y"?"bottom":"right",k=p+d[y],C=p-d[w];p=tl(k,p,C)}const g=l.fn({...e,[f]:h,[u]:p});return{...g,data:{x:g.x-t,y:g.y-r,enabled:{[f]:s,[u]:o}}}}}},Fb=function(n){return n===void 0&&(n={}),{name:"size",options:n,async fn(e){var t,r;const{placement:i,rects:s,platform:o,elements:l}=e,{apply:a=()=>{},...c}=At(n,e),d=await zn(e,c),u=et(i),f=rt(i),h=pt(i)==="y",{width:p,height:g}=s.floating;let y,w;u==="top"||u==="bottom"?(y=u,w=f===(await(o.isRTL==null?void 0:o.isRTL(l.floating))?"start":"end")?"left":"right"):(w=u,y=f==="end"?"top":"bottom");const k=g-d.top-d.bottom,C=p-d.left-d.right,D=ft(g-d[y],k),M=ft(p-d[w],C),P=!e.middlewareData.shift;let T=D,V=M;if((t=e.middlewareData.shift)!=null&&t.enabled.x&&(V=C),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(T=k),P&&!f){const j=ze(d.left,0),U=ze(d.right,0),R=ze(d.top,0),X=ze(d.bottom,0);h?V=p-2*(j!==0||U!==0?j+U:ze(d.left,d.right)):T=g-2*(R!==0||X!==0?R+X:ze(d.top,d.bottom))}await a({...e,availableWidth:V,availableHeight:T});const K=await o.getDimensions(l.floating);return p!==K.width||g!==K.height?{reset:{rects:!0}}:{}}}};function Xi(){return typeof window<"u"}function Hn(n){return Ou(n)?(n.nodeName||"").toLowerCase():"#document"}function Ke(n){var e;return(n==null||(e=n.ownerDocument)==null?void 0:e.defaultView)||window}function Dt(n){var e;return(e=(Ou(n)?n.ownerDocument:n.document)||window.document)==null?void 0:e.documentElement}function Ou(n){return Xi()?n instanceof Node||n instanceof Ke(n).Node:!1}function it(n){return Xi()?n instanceof Element||n instanceof Ke(n).Element:!1}function mt(n){return Xi()?n instanceof HTMLElement||n instanceof Ke(n).HTMLElement:!1}function Nu(n){return!Xi()||typeof ShadowRoot>"u"?!1:n instanceof ShadowRoot||n instanceof Ke(n).ShadowRoot}const jb=new Set(["inline","contents"]);function Mr(n){const{overflow:e,overflowX:t,overflowY:r,display:i}=st(n);return/auto|scroll|overlay|hidden|clip/.test(e+r+t)&&!jb.has(i)}const Ub=new Set(["table","td","th"]);function Wb(n){return Ub.has(Hn(n))}const Kb=[":popover-open",":modal"];function Qi(n){return Kb.some(e=>{try{return n.matches(e)}catch{return!1}})}const qb=["transform","translate","scale","rotate","perspective"],Jb=["transform","translate","scale","rotate","perspective","filter"],Gb=["paint","layout","strict","content"];function sl(n){const e=ol(),t=it(n)?st(n):n;return qb.some(r=>t[r]?t[r]!=="none":!1)||(t.containerType?t.containerType!=="normal":!1)||!e&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!e&&(t.filter?t.filter!=="none":!1)||Jb.some(r=>(t.willChange||"").includes(r))||Gb.some(r=>(t.contain||"").includes(r))}function Yb(n){let e=tn(n);for(;mt(e)&&!Fn(e);){if(sl(e))return e;if(Qi(e))return null;e=tn(e)}return null}function ol(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Xb=new Set(["html","body","#document"]);function Fn(n){return Xb.has(Hn(n))}function st(n){return Ke(n).getComputedStyle(n)}function Zi(n){return it(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.scrollX,scrollTop:n.scrollY}}function tn(n){if(Hn(n)==="html")return n;const e=n.assignedSlot||n.parentNode||Nu(n)&&n.host||Dt(n);return Nu(e)?e.host:e}function Au(n){const e=tn(n);return Fn(e)?n.ownerDocument?n.ownerDocument.body:n.body:mt(e)&&Mr(e)?e:Au(e)}function Du(n,e,t){var r;e===void 0&&(e=[]);const i=Au(n),s=i===((r=n.ownerDocument)==null?void 0:r.body),o=Ke(i);return s?(ll(o),e.concat(o,o.visualViewport||[],Mr(i)?i:[],[])):e.concat(i,Du(i,[]))}function ll(n){return n.parent&&Object.getPrototypeOf(n.parent)?n.frameElement:null}function Ru(n){const e=st(n);let t=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=mt(n),s=i?n.offsetWidth:t,o=i?n.offsetHeight:r,l=Ji(t)!==s||Ji(r)!==o;return l&&(t=s,r=o),{width:t,height:r,$:l}}function Iu(n){return it(n)?n:n.contextElement}function jn(n){const e=Iu(n);if(!mt(e))return ht(1);const t=e.getBoundingClientRect(),{width:r,height:i,$:s}=Ru(e);let o=(s?Ji(t.width):t.width)/r,l=(s?Ji(t.height):t.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}const Qb=ht(0);function Pu(n){const e=Ke(n);return!ol()||!e.visualViewport?Qb:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Zb(n,e,t){return e===void 0&&(e=!1),!t||e&&t!==Ke(n)?!1:e}function vr(n,e,t,r){e===void 0&&(e=!1),t===void 0&&(t=!1);const i=n.getBoundingClientRect(),s=Iu(n);let o=ht(1);e&&(r?it(r)&&(o=jn(r)):o=jn(n));const l=Zb(s,t,r)?Pu(s):ht(0);let a=(i.left+l.x)/o.x,c=(i.top+l.y)/o.y,d=i.width/o.x,u=i.height/o.y;if(s){const f=Ke(s),h=r&&it(r)?Ke(r):r;let p=f,g=ll(p);for(;g&&r&&h!==p;){const y=jn(g),w=g.getBoundingClientRect(),k=st(g),C=w.left+(g.clientLeft+parseFloat(k.paddingLeft))*y.x,D=w.top+(g.clientTop+parseFloat(k.paddingTop))*y.y;a*=y.x,c*=y.y,d*=y.x,u*=y.y,a+=C,c+=D,p=Ke(g),g=ll(p)}}return $n({width:d,height:u,x:a,y:c})}function es(n,e){const t=Zi(n).scrollLeft;return e?e.left+t:vr(Dt(n)).left+t}function Lu(n,e){const t=n.getBoundingClientRect(),r=t.left+e.scrollLeft-es(n,t),i=t.top+e.scrollTop;return{x:r,y:i}}function e1(n){let{elements:e,rect:t,offsetParent:r,strategy:i}=n;const s=i==="fixed",o=Dt(r),l=e?Qi(e.floating):!1;if(r===o||l&&s)return t;let a={scrollLeft:0,scrollTop:0},c=ht(1);const d=ht(0),u=mt(r);if((u||!u&&!s)&&((Hn(r)!=="body"||Mr(o))&&(a=Zi(r)),mt(r))){const h=vr(r);c=jn(r),d.x=h.x+r.clientLeft,d.y=h.y+r.clientTop}const f=o&&!u&&!s?Lu(o,a):ht(0);return{width:t.width*c.x,height:t.height*c.y,x:t.x*c.x-a.scrollLeft*c.x+d.x+f.x,y:t.y*c.y-a.scrollTop*c.y+d.y+f.y}}function t1(n){return Array.from(n.getClientRects())}function n1(n){const e=Dt(n),t=Zi(n),r=n.ownerDocument.body,i=ze(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),s=ze(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-t.scrollLeft+es(n);const l=-t.scrollTop;return st(r).direction==="rtl"&&(o+=ze(e.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:l}}const Bu=25;function r1(n,e){const t=Ke(n),r=Dt(n),i=t.visualViewport;let s=r.clientWidth,o=r.clientHeight,l=0,a=0;if(i){s=i.width,o=i.height;const d=ol();(!d||d&&e==="fixed")&&(l=i.offsetLeft,a=i.offsetTop)}const c=es(r);if(c<=0){const d=r.ownerDocument,u=d.body,f=getComputedStyle(u),h=d.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,p=Math.abs(r.clientWidth-u.clientWidth-h);p<=Bu&&(s-=p)}else c<=Bu&&(s+=c);return{width:s,height:o,x:l,y:a}}const i1=new Set(["absolute","fixed"]);function s1(n,e){const t=vr(n,!0,e==="fixed"),r=t.top+n.clientTop,i=t.left+n.clientLeft,s=mt(n)?jn(n):ht(1),o=n.clientWidth*s.x,l=n.clientHeight*s.y,a=i*s.x,c=r*s.y;return{width:o,height:l,x:a,y:c}}function _u(n,e,t){let r;if(e==="viewport")r=r1(n,t);else if(e==="document")r=n1(Dt(n));else if(it(e))r=s1(e,t);else{const i=Pu(n);r={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return $n(r)}function Vu(n,e){const t=tn(n);return t===e||!it(t)||Fn(t)?!1:st(t).position==="fixed"||Vu(t,e)}function o1(n,e){const t=e.get(n);if(t)return t;let r=Du(n,[]).filter(l=>it(l)&&Hn(l)!=="body"),i=null;const s=st(n).position==="fixed";let o=s?tn(n):n;for(;it(o)&&!Fn(o);){const l=st(o),a=sl(o);!a&&l.position==="fixed"&&(i=null),(s?!a&&!i:!a&&l.position==="static"&&!!i&&i1.has(i.position)||Mr(o)&&!a&&Vu(n,o))?r=r.filter(d=>d!==o):i=l,o=tn(o)}return e.set(n,r),r}function l1(n){let{element:e,boundary:t,rootBoundary:r,strategy:i}=n;const o=[...t==="clippingAncestors"?Qi(e)?[]:o1(e,this._c):[].concat(t),r],l=o[0],a=o.reduce((c,d)=>{const u=_u(e,d,i);return c.top=ze(u.top,c.top),c.right=ft(u.right,c.right),c.bottom=ft(u.bottom,c.bottom),c.left=ze(u.left,c.left),c},_u(e,l,i));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function a1(n){const{width:e,height:t}=Ru(n);return{width:e,height:t}}function c1(n,e,t){const r=mt(e),i=Dt(e),s=t==="fixed",o=vr(n,!0,s,e);let l={scrollLeft:0,scrollTop:0};const a=ht(0);function c(){a.x=es(i)}if(r||!r&&!s)if((Hn(e)!=="body"||Mr(i))&&(l=Zi(e)),r){const h=vr(e,!0,s,e);a.x=h.x+e.clientLeft,a.y=h.y+e.clientTop}else i&&c();s&&!r&&i&&c();const d=i&&!r&&!s?Lu(i,l):ht(0),u=o.left+l.scrollLeft-a.x-d.x,f=o.top+l.scrollTop-a.y-d.y;return{x:u,y:f,width:o.width,height:o.height}}function al(n){return st(n).position==="static"}function $u(n,e){if(!mt(n)||st(n).position==="fixed")return null;if(e)return e(n);let t=n.offsetParent;return Dt(n)===t&&(t=t.ownerDocument.body),t}function zu(n,e){const t=Ke(n);if(Qi(n))return t;if(!mt(n)){let i=tn(n);for(;i&&!Fn(i);){if(it(i)&&!al(i))return i;i=tn(i)}return t}let r=$u(n,e);for(;r&&Wb(r)&&al(r);)r=$u(r,e);return r&&Fn(r)&&al(r)&&!sl(r)?t:r||Yb(n)||t}const d1=async function(n){const e=this.getOffsetParent||zu,t=this.getDimensions,r=await t(n.floating);return{reference:c1(n.reference,await e(n.floating),n.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function u1(n){return st(n).direction==="rtl"}const f1={convertOffsetParentRelativeRectToViewportRelativeRect:e1,getDocumentElement:Dt,getClippingRect:l1,getOffsetParent:zu,getElementRects:d1,getClientRects:t1,getDimensions:a1,getScale:jn,isElement:it,isRTL:u1},Hu=zb,Fu=Ib,ju=Hb,Uu=Pb,Wu=Fb,Ku=Lb,qu=Db,Ju=_b,Gu=(n,e,t)=>{const r=new Map,i={platform:f1,...t},s={...i.platform,_c:r};return Ab(n,e,{...i,platform:s})};var cl,dl;if(typeof WeakMap<"u"){let n=new WeakMap;cl=e=>n.get(e),dl=(e,t)=>(n.set(e,t),t)}else{const n=[];let t=0;cl=r=>{for(let i=0;i<n.length;i+=2)if(n[i]==r)return n[i+1]},dl=(r,i)=>(t==10&&(t=0),n[t++]=r,n[t++]=i)}var Rt=class{constructor(n,e,t,r){this.width=n,this.height=e,this.map=t,this.problems=r}findCell(n){for(let e=0;e<this.map.length;e++){const t=this.map[e];if(t!=n)continue;const r=e%this.width,i=e/this.width|0;let s=r+1,o=i+1;for(let l=1;s<this.width&&this.map[e+l]==t;l++)s++;for(let l=1;o<this.height&&this.map[e+this.width*l]==t;l++)o++;return{left:r,top:i,right:s,bottom:o}}throw new RangeError(`No cell with offset ${n} found`)}colCount(n){for(let e=0;e<this.map.length;e++)if(this.map[e]==n)return e%this.width;throw new RangeError(`No cell with offset ${n} found`)}nextCell(n,e,t){const{left:r,right:i,top:s,bottom:o}=this.findCell(n);return e=="horiz"?(t<0?r==0:i==this.width)?null:this.map[s*this.width+(t<0?r-1:i)]:(t<0?s==0:o==this.height)?null:this.map[r+this.width*(t<0?s-1:o)]}rectBetween(n,e){const{left:t,right:r,top:i,bottom:s}=this.findCell(n),{left:o,right:l,top:a,bottom:c}=this.findCell(e);return{left:Math.min(t,o),top:Math.min(i,a),right:Math.max(r,l),bottom:Math.max(s,c)}}cellsInRect(n){const e=[],t={};for(let r=n.top;r<n.bottom;r++)for(let i=n.left;i<n.right;i++){const s=r*this.width+i,o=this.map[s];t[o]||(t[o]=!0,!(i==n.left&&i&&this.map[s-1]==o||r==n.top&&r&&this.map[s-this.width]==o)&&e.push(o))}return e}positionAt(n,e,t){for(let r=0,i=0;;r++){const s=i+t.child(r).nodeSize;if(r==n){let o=e+n*this.width;const l=(n+1)*this.width;for(;o<l&&this.map[o]<i;)o++;return o==l?s-1:this.map[o]}i=s}}static get(n){return cl(n)||dl(n,h1(n))}};function h1(n){if(n.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+n.type.name);const e=p1(n),t=n.childCount,r=[];let i=0,s=null;const o=[];for(let c=0,d=e*t;c<d;c++)r[c]=0;for(let c=0,d=0;c<t;c++){const u=n.child(c);d++;for(let p=0;;p++){for(;i<r.length&&r[i]!=0;)i++;if(p==u.childCount)break;const g=u.child(p),{colspan:y,rowspan:w,colwidth:k}=g.attrs;for(let C=0;C<w;C++){if(C+c>=t){(s||(s=[])).push({type:"overlong_rowspan",pos:d,n:w-C});break}const D=i+C*e;for(let M=0;M<y;M++){r[D+M]==0?r[D+M]=d:(s||(s=[])).push({type:"collision",row:c,pos:d,n:y-M});const P=k&&k[M];if(P){const T=(D+M)%e*2,V=o[T];V==null||V!=P&&o[T+1]==1?(o[T]=P,o[T+1]=1):V==P&&o[T+1]++}}}i+=y,d+=g.nodeSize}const f=(c+1)*e;let h=0;for(;i<f;)r[i++]==0&&h++;h&&(s||(s=[])).push({type:"missing",row:c,n:h}),d++}(e===0||t===0)&&(s||(s=[])).push({type:"zero_sized"});const l=new Rt(e,t,r,s);let a=!1;for(let c=0;!a&&c<o.length;c+=2)o[c]!=null&&o[c+1]<t&&(a=!0);return a&&m1(l,o,n),l}function p1(n){let e=-1,t=!1;for(let r=0;r<n.childCount;r++){const i=n.child(r);let s=0;if(t)for(let o=0;o<r;o++){const l=n.child(o);for(let a=0;a<l.childCount;a++){const c=l.child(a);o+c.attrs.rowspan>r&&(s+=c.attrs.colspan)}}for(let o=0;o<i.childCount;o++){const l=i.child(o);s+=l.attrs.colspan,l.attrs.rowspan>1&&(t=!0)}e==-1?e=s:e!=s&&(e=Math.max(e,s))}return e}function m1(n,e,t){n.problems||(n.problems=[]);const r={};for(let i=0;i<n.map.length;i++){const s=n.map[i];if(r[s])continue;r[s]=!0;const o=t.nodeAt(s);if(!o)throw new RangeError(`No cell with offset ${s} found`);let l=null;const a=o.attrs;for(let c=0;c<a.colspan;c++){const d=(i+c)%n.width,u=e[d*2];u!=null&&(!a.colwidth||a.colwidth[c]!=u)&&((l||(l=g1(a)))[c]=u)}l&&n.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:l})}}function g1(n){if(n.colwidth)return n.colwidth.slice();const e=[];for(let t=0;t<n.colspan;t++)e.push(0);return e}function ul(n){let e=n.cached.tableNodeTypes;if(!e){e=n.cached.tableNodeTypes={};for(const t in n.nodes){const r=n.nodes[t],i=r.spec.tableRole;i&&(e[i]=r)}}return e}new le("selectingCells");function y1(n){for(let e=n.depth-1;e>0;e--)if(n.node(e).type.spec.tableRole=="row")return n.node(0).resolve(n.before(e+1));return null}function Yu(n){const e=n.selection.$head;for(let t=e.depth;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return!0;return!1}function b1(n){const e=n.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 t=y1(e.$head)||w1(e.$head);if(t)return t;throw new RangeError(`No cell found around position ${e.head}`)}function w1(n){for(let e=n.nodeAfter,t=n.pos;e;e=e.firstChild,t++){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return n.doc.resolve(t)}for(let e=n.nodeBefore,t=n.pos;e;e=e.lastChild,t--){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return n.doc.resolve(t-e.nodeSize)}}function Xu(n){return n.parent.type.spec.tableRole=="row"&&!!n.nodeAfter}function Qu(n,e){return n.depth==e.depth&&n.pos>=e.start(-1)&&n.pos<=e.end(-1)}function Zu(n,e,t){const r=n.node(-1),i=Rt.get(r),s=n.start(-1),o=i.nextCell(n.pos-s,e,t);return o==null?null:n.node(0).resolve(s+o)}function ef(n,e,t=1){const r={...n,colspan:n.colspan-t};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,t),r.colwidth.some(i=>i>0)||(r.colwidth=null)),r}var gt=class Pt extends H{constructor(e,t=e){const r=e.node(-1),i=Rt.get(r),s=e.start(-1),o=i.rectBetween(e.pos-s,t.pos-s),l=e.node(0),a=i.cellsInRect(o).filter(d=>d!=t.pos-s);a.unshift(t.pos-s);const c=a.map(d=>{const u=r.nodeAt(d);if(!u)throw RangeError(`No cell with offset ${d} found`);const f=s+d+1;return new pa(l.resolve(f),l.resolve(f+u.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=t}map(e,t){const r=e.resolve(t.map(this.$anchorCell.pos)),i=e.resolve(t.map(this.$headCell.pos));if(Xu(r)&&Xu(i)&&Qu(r,i)){const s=this.$anchorCell.node(-1)!=r.node(-1);return s&&this.isRowSelection()?Pt.rowSelection(r,i):s&&this.isColSelection()?Pt.colSelection(r,i):new Pt(r,i)}return F.between(r,i)}content(){const e=this.$anchorCell.node(-1),t=Rt.get(e),r=this.$anchorCell.start(-1),i=t.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),s={},o=[];for(let a=i.top;a<i.bottom;a++){const c=[];for(let d=a*t.width+i.left,u=i.left;u<i.right;u++,d++){const f=t.map[d];if(s[f])continue;s[f]=!0;const h=t.findCell(f);let p=e.nodeAt(f);if(!p)throw RangeError(`No cell with offset ${f} found`);const g=i.left-h.left,y=h.right-i.right;if(g>0||y>0){let w=p.attrs;if(g>0&&(w=ef(w,0,g)),y>0&&(w=ef(w,w.colspan-y,y)),h.left<i.left){if(p=p.type.createAndFill(w),!p)throw RangeError(`Could not create cell with attrs ${JSON.stringify(w)}`)}else p=p.type.create(w,p.content)}if(h.top<i.top||h.bottom>i.bottom){const w={...p.attrs,rowspan:Math.min(h.bottom,i.bottom)-Math.max(h.top,i.top)};h.top<i.top?p=p.type.createAndFill(w):p=p.type.create(w,p.content)}c.push(p)}o.push(e.child(a).copy(S.from(c)))}const l=this.isColSelection()&&this.isRowSelection()?e:o;return new N(S.from(l),1,1)}replace(e,t=N.empty){const r=e.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){const{$from:l,$to:a}=i[o],c=e.mapping.slice(r);e.replace(c.map(l.pos),c.map(a.pos),o?N.empty:t)}const s=H.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);s&&e.setSelection(s)}replaceWith(e,t){this.replace(e,new N(S.from(t),0,0))}forEachCell(e){const t=this.$anchorCell.node(-1),r=Rt.get(t),i=this.$anchorCell.start(-1),s=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-i,this.$headCell.pos-i));for(let o=0;o<s.length;o++)e(t.nodeAt(s[o]),i+s[o])}isColSelection(){const e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,i=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,i)==this.$headCell.node(-1).childCount}static colSelection(e,t=e){const r=e.node(-1),i=Rt.get(r),s=e.start(-1),o=i.findCell(e.pos-s),l=i.findCell(t.pos-s),a=e.node(0);return o.top<=l.top?(o.top>0&&(e=a.resolve(s+i.map[o.left])),l.bottom<i.height&&(t=a.resolve(s+i.map[i.width*(i.height-1)+l.right-1]))):(l.top>0&&(t=a.resolve(s+i.map[l.left])),o.bottom<i.height&&(e=a.resolve(s+i.map[i.width*(i.height-1)+o.right-1]))),new Pt(e,t)}isRowSelection(){const e=this.$anchorCell.node(-1),t=Rt.get(e),r=this.$anchorCell.start(-1),i=t.colCount(this.$anchorCell.pos-r),s=t.colCount(this.$headCell.pos-r);if(Math.min(i,s)>0)return!1;const o=i+this.$anchorCell.nodeAfter.attrs.colspan,l=s+this.$headCell.nodeAfter.attrs.colspan;return Math.max(o,l)==t.width}eq(e){return e instanceof Pt&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,t=e){const r=e.node(-1),i=Rt.get(r),s=e.start(-1),o=i.findCell(e.pos-s),l=i.findCell(t.pos-s),a=e.node(0);return o.left<=l.left?(o.left>0&&(e=a.resolve(s+i.map[o.top*i.width])),l.right<i.width&&(t=a.resolve(s+i.map[i.width*(l.top+1)-1]))):(l.left>0&&(t=a.resolve(s+i.map[l.top*i.width])),o.right<i.width&&(e=a.resolve(s+i.map[i.width*(o.top+1)-1]))),new Pt(e,t)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,t){return new Pt(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){return new Pt(e.resolve(t),e.resolve(r))}getBookmark(){return new k1(this.$anchorCell.pos,this.$headCell.pos)}};gt.prototype.visible=!1,H.jsonID("cell",gt);var k1=class Bf{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Bf(e.map(this.anchor),e.map(this.head))}resolve(e){const t=e.resolve(this.anchor),r=e.resolve(this.head);return t.parent.type.spec.tableRole=="row"&&r.parent.type.spec.tableRole=="row"&&t.index()<t.parent.childCount&&r.index()<r.parent.childCount&&Qu(t,r)?new gt(t,r):H.near(r,1)}};new le("fix-tables");function tf(n){const e=n.selection,t=b1(n),r=t.node(-1),i=t.start(-1),s=Rt.get(r);return{...e instanceof gt?s.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):s.findCell(t.pos-i),tableStart:i,map:s,table:r}}function x1(n){return function(e,t){if(!Yu(e))return!1;if(t){const r=ul(e.schema),i=tf(e),s=e.tr,o=i.map.cellsInRect(n=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:n=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),l=o.map(a=>i.table.nodeAt(a));for(let a=0;a<o.length;a++)l[a].type==r.header_cell&&s.setNodeMarkup(i.tableStart+o[a],r.cell,l[a].attrs);if(s.steps.length==0)for(let a=0;a<o.length;a++)s.setNodeMarkup(i.tableStart+o[a],r.header_cell,l[a].attrs);t(s)}return!0}}function nf(n,e,t){const r=e.map.cellsInRect({left:0,top:0,right:n=="row"?e.map.width:1,bottom:n=="column"?e.map.height:1});for(let i=0;i<r.length;i++){const s=e.table.nodeAt(r[i]);if(s&&s.type!==t.header_cell)return!1}return!0}function fl(n,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?x1(n):function(t,r){if(!Yu(t))return!1;if(r){const i=ul(t.schema),s=tf(t),o=t.tr,l=nf("row",s,i),a=nf("column",s,i),d=(n==="column"?l:n==="row"?a:!1)?1:0,u=n=="column"?{left:0,top:d,right:1,bottom:s.map.height}:n=="row"?{left:d,top:0,right:s.map.width,bottom:1}:s,f=n=="column"?a?i.cell:i.header_cell:n=="row"?l?i.cell:i.header_cell:i.cell;s.map.cellsInRect(u).forEach(h=>{const p=h+s.tableStart,g=o.doc.nodeAt(p);g&&o.setNodeMarkup(p,f,g.attrs)}),r(o)}return!0}}fl("row",{useDeprecatedLogic:!0}),fl("column",{useDeprecatedLogic:!0}),fl("cell",{useDeprecatedLogic:!0});function ts(n,e){const t=n.selection;if(!(t instanceof gt))return!1;if(e){const r=n.tr,i=ul(n.schema).cell.createAndFill().content;t.forEachCell((s,o)=>{s.content.eq(i)||r.replace(r.mapping.map(o+1),r.mapping.map(o+s.nodeSize-1),new N(i,0,0))}),r.docChanged&&e(r)}return!0}no({ArrowLeft:rs("horiz",-1),ArrowRight:rs("horiz",1),ArrowUp:rs("vert",-1),ArrowDown:rs("vert",1),"Shift-ArrowLeft":is("horiz",-1),"Shift-ArrowRight":is("horiz",1),"Shift-ArrowUp":is("vert",-1),"Shift-ArrowDown":is("vert",1),Backspace:ts,"Mod-Backspace":ts,Delete:ts,"Mod-Delete":ts});function ns(n,e,t){return t.eq(n.selection)?!1:(e&&e(n.tr.setSelection(t).scrollIntoView()),!0)}function rs(n,e){return(t,r,i)=>{if(!i)return!1;const s=t.selection;if(s instanceof gt)return ns(t,r,H.near(s.$headCell,e));if(n!="horiz"&&!s.empty)return!1;const o=rf(i,n,e);if(o==null)return!1;if(n=="horiz")return ns(t,r,H.near(t.doc.resolve(s.head+e),e));{const l=t.doc.resolve(o),a=Zu(l,n,e);let c;return a?c=H.near(a,1):e<0?c=H.near(t.doc.resolve(l.before(-1)),-1):c=H.near(t.doc.resolve(l.after(-1)),1),ns(t,r,c)}}}function is(n,e){return(t,r,i)=>{if(!i)return!1;const s=t.selection;let o;if(s instanceof gt)o=s;else{const a=rf(i,n,e);if(a==null)return!1;o=new gt(t.doc.resolve(a))}const l=Zu(o.$headCell,n,e);return l?ns(t,r,new gt(o.$anchorCell,l)):!1}}function rf(n,e,t){if(!(n.state.selection instanceof F))return null;const{$head:r}=n.state.selection;for(let i=r.depth-1;i>=0;i--){const s=r.node(i);if((t<0?r.index(i):r.indexAfter(i))!=(t<0?0:s.childCount))return null;if(s.type.spec.tableRole=="cell"||s.type.spec.tableRole=="header_cell"){const l=r.before(i),a=e=="vert"?t>0?"down":"up":t>0?"right":"left";return n.endOfTextblock(a)?l:null}}return null}new le("tableColumnResizing");function S1(n,e){const t=Math.min(n.top,e.top),r=Math.max(n.bottom,e.bottom),i=Math.min(n.left,e.left),o=Math.max(n.right,e.right)-i,l=r-t,a=i,c=t;return new DOMRect(a,c,o,l)}var C1=class{constructor({editor:n,element:e,view:t,updateDelay:r=250,resizeDelay:i=60,shouldShow:s,appendTo:o,getReferencedVirtualElement:l,options:a}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.floatingUIOptions={strategy:"absolute",placement:"top",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1,onShow:void 0,onHide:void 0,onUpdate:void 0,onDestroy:void 0},this.shouldShow=({view:d,state:u,from:f,to:h})=>{const{doc:p,selection:g}=u,{empty:y}=g,w=!p.textBetween(f,h).length&&ko(u.selection),k=this.element.contains(document.activeElement);return!(!(d.hasFocus()||k)||y||w||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:d})=>{var u;if(this.editor.isDestroyed){this.destroy();return}if(this.preventHide){this.preventHide=!1;return}d?.relatedTarget&&((u=this.element.parentNode)!=null&&u.contains(d.relatedTarget))||d?.relatedTarget!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(d,u)=>{const f=!u?.selection.eq(d.state.selection),h=!u?.doc.eq(d.state.doc);!f&&!h||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(d,f,h,u)},this.updateDelay))},this.updateHandler=(d,u,f,h)=>{const{composing:p}=d;if(p||!u&&!f)return;if(!this.getShouldShow(h)){this.hide();return}this.updatePosition(),this.show()},this.transactionHandler=({transaction:d})=>{d.getMeta("bubbleMenu")==="updatePosition"&&this.updatePosition()};var c;this.editor=n,this.element=e,this.view=t,this.updateDelay=r,this.resizeDelay=i,this.appendTo=o,this.scrollTarget=(c=a?.scrollTarget)!=null?c:window,this.getReferencedVirtualElement=l,this.floatingUIOptions={...this.floatingUIOptions,...a},this.element.tabIndex=0,s&&(this.shouldShow=s),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.editor.on("transaction",this.transactionHandler),window.addEventListener("resize",this.resizeHandler),this.scrollTarget.addEventListener("scroll",this.resizeHandler),this.update(t,t.state),this.getShouldShow()&&this.show()}get middlewares(){const n=[];return this.floatingUIOptions.flip&&n.push(Uu(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&n.push(ju(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&n.push(Hu(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&n.push(qu(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&n.push(Wu(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&n.push(Fu(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&n.push(Ku(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&n.push(Ju(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),n}get virtualElement(){var n;const{selection:e}=this.editor.state,t=(n=this.getReferencedVirtualElement)==null?void 0:n.call(this);if(t)return t;const r=hd(this.view,e.from,e.to);let i={getBoundingClientRect:()=>r,getClientRects:()=>[r]};if(e instanceof B){let s=this.view.nodeDOM(e.from);const o=s.dataset.nodeViewWrapper?s:s.querySelector("[data-node-view-wrapper]");o&&(s=o),s&&(i={getBoundingClientRect:()=>s.getBoundingClientRect(),getClientRects:()=>[s.getBoundingClientRect()]})}if(e instanceof gt){const{$anchorCell:s,$headCell:o}=e,l=s?s.pos:o.pos,a=o?o.pos:s.pos,c=this.view.nodeDOM(l),d=this.view.nodeDOM(a);if(!c||!d)return;const u=c===d?c.getBoundingClientRect():S1(c.getBoundingClientRect(),d.getBoundingClientRect());i={getBoundingClientRect:()=>u,getClientRects:()=>[u]}}return i}updatePosition(){const n=this.virtualElement;n&&Gu(n,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:t,strategy:r})=>{this.element.style.width="max-content",this.element.style.position=r,this.element.style.left=`${e}px`,this.element.style.top=`${t}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(n,e){const{state:t}=n,r=t.selection.from!==t.selection.to;if(this.updateDelay>0&&r){this.handleDebouncedUpdate(n,e);return}const i=!e?.selection.eq(n.state.selection),s=!e?.doc.eq(n.state.doc);this.updateHandler(n,i,s,e)}getShouldShow(n){var e;const{state:t}=this.view,{selection:r}=t,{ranges:i}=r,s=Math.min(...i.map(a=>a.$from.pos)),o=Math.max(...i.map(a=>a.$to.pos));return(e=this.shouldShow)==null?void 0:e.call(this,{editor:this.editor,element:this.element,view:this.view,state:t,oldState:n,from:s,to:o})}show(){var n;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const e=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(n=e??this.view.dom.parentElement)==null||n.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),window.removeEventListener("resize",this.resizeHandler),this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.editor.off("transaction",this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},sf=n=>new se({key:typeof n.pluginKey=="string"?new le(n.pluginKey):n.pluginKey,view:e=>new C1({view:e,...n})});de.create({name:"bubbleMenu",addOptions(){return{element:null,pluginKey:"bubbleMenu",updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[sf({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,options:this.options.options,appendTo:this.options.appendTo,getReferencedVirtualElement:this.options.getReferencedVirtualElement,shouldShow:this.options.shouldShow})]:[]}});var E1=m.defineComponent({name:"BubbleMenu",inheritAttrs:!1,props:{pluginKey:{type:[String,Object],default:"bubbleMenu"},editor:{type:Object,required:!0},updateDelay:{type:Number,default:void 0},resizeDelay:{type:Number,default:void 0},options:{type:Object,default:()=>({})},appendTo:{type:Object,default:void 0},shouldShow:{type:Function,default:null},getReferencedVirtualElement:{type:Function,default:void 0}},setup(n,{slots:e,attrs:t}){const r=m.ref(null);return m.onMounted(()=>{const{editor:i,options:s,pluginKey:o,resizeDelay:l,appendTo:a,shouldShow:c,getReferencedVirtualElement:d,updateDelay:u}=n;r.value&&(r.value.style.visibility="hidden",r.value.style.position="absolute",r.value.remove(),i.registerPlugin(sf({editor:i,element:r.value,options:s,pluginKey:o,resizeDelay:l,appendTo:a,shouldShow:c,getReferencedVirtualElement:d,updateDelay:u})))}),m.onBeforeUnmount(()=>{const{pluginKey:i,editor:s}=n;s.unregisterPlugin(i)}),()=>{var i;return m.h(m.Teleport,{to:"body"},m.h("div",{...t,ref:r},(i=e.default)==null?void 0:i.call(e)))}}}),M1=class{constructor({editor:n,element:e,view:t,options:r,appendTo:i,shouldShow:s}){this.preventHide=!1,this.isVisible=!1,this.shouldShow=({view:o,state:l})=>{const{selection:a}=l,{$anchor:c,empty:d}=a,u=c.depth===1,f=c.parent.isTextblock&&!c.parent.type.spec.code&&!c.parent.textContent&&c.parent.childCount===0&&!this.getTextContent(c.parent);return!(!o.hasFocus()||!d||!u||!f||!this.editor.isEditable)},this.floatingUIOptions={strategy:"absolute",placement:"right",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1},this.updateHandler=(o,l,a,c)=>{const{composing:d}=o;if(d||!l&&!a)return;if(!this.getShouldShow(c)){this.hide();return}this.updatePosition(),this.show()},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:o})=>{var l;if(this.preventHide){this.preventHide=!1;return}o?.relatedTarget&&((l=this.element.parentNode)!=null&&l.contains(o.relatedTarget))||o?.relatedTarget!==this.editor.view.dom&&this.hide()},this.editor=n,this.element=e,this.view=t,this.appendTo=i,this.floatingUIOptions={...this.floatingUIOptions,...r},this.element.tabIndex=0,s&&(this.shouldShow=s),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.update(t,t.state),this.getShouldShow()&&this.show()}getTextContent(n){return id(n,{textSerializers:po(this.editor.schema)})}get middlewares(){const n=[];return this.floatingUIOptions.flip&&n.push(Uu(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&n.push(ju(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&n.push(Hu(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&n.push(qu(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&n.push(Wu(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&n.push(Fu(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&n.push(Ku(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&n.push(Ju(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),n}getShouldShow(n){var e;const{state:t}=this.view,{selection:r}=t,{ranges:i}=r,s=Math.min(...i.map(a=>a.$from.pos)),o=Math.max(...i.map(a=>a.$to.pos));return(e=this.shouldShow)==null?void 0:e.call(this,{editor:this.editor,view:this.view,state:t,oldState:n,from:s,to:o})}updatePosition(){const{selection:n}=this.editor.state,e=hd(this.view,n.from,n.to);Gu({getBoundingClientRect:()=>e,getClientRects:()=>[e]},this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:r,y:i,strategy:s})=>{this.element.style.width="max-content",this.element.style.position=s,this.element.style.left=`${r}px`,this.element.style.top=`${i}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(n,e){const t=!e?.selection.eq(n.state.selection),r=!e?.doc.eq(n.state.doc);this.updateHandler(n,t,r,e)}show(){var n;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const e=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(n=e??this.view.dom.parentElement)==null||n.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},of=n=>new se({key:typeof n.pluginKey=="string"?new le(n.pluginKey):n.pluginKey,view:e=>new M1({view:e,...n})});de.create({name:"floatingMenu",addOptions(){return{element:null,options:{},pluginKey:"floatingMenu",appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[of({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,options:this.options.options,appendTo:this.options.appendTo,shouldShow:this.options.shouldShow})]:[]}}),m.defineComponent({name:"FloatingMenu",inheritAttrs:!1,props:{pluginKey:{type:null,default:"floatingMenu"},editor:{type:Object,required:!0},options:{type:Object,default:()=>({})},appendTo:{type:Object,default:void 0},shouldShow:{type:Function,default:null}},setup(n,{slots:e,attrs:t}){const r=m.ref(null);return m.onMounted(()=>{const{pluginKey:i,editor:s,options:o,appendTo:l,shouldShow:a}=n;r.value&&(r.value.style.visibility="hidden",r.value.style.position="absolute",r.value.remove(),s.registerPlugin(of({pluginKey:i,editor:s,element:r.value,options:o,appendTo:l,shouldShow:a})))}),m.onBeforeUnmount(()=>{const{pluginKey:i,editor:s}=n;s.unregisterPlugin(i)}),()=>{var i;return m.h(m.Teleport,{to:"body"},m.h("div",{...t,ref:r},(i=e.default)==null?void 0:i.call(e)))}}});const v1={class:"sus-bubble-menu"},T1=Yt(m.defineComponent({__name:"BubbleMenu",props:{editor:{},showMenu:{type:Boolean}},setup(n){const e=n,t=m.ref(""),r=m.ref(!1);function i({editor:l}){const{from:a,to:c}=l.state.selection;if(a===c){const{$anchor:d}=l.state.selection;return l.isActive("link")}return l.isActive("link")}function s(){if(r.value){r.value=!1;return}t.value=e.editor?.getAttributes("link").href,r.value=!0}function o(){if(!t.value){e.editor?.chain().focus().extendMarkRange("link").unsetLink().run(),r.value=!1;return}e.editor?.chain().focus().extendMarkRange("link").setLink({href:t.value}).run(),r.value=!1}return(l,a)=>(m.openBlock(),m.createElementBlock(m.Fragment,null,[m.withDirectives(m.createElementVNode("div",{class:"sus-bubble-mask",onClick:a[2]||(a[2]=c=>r.value=!1)},[m.createElementVNode("div",{class:"sus-link",onClick:a[1]||(a[1]=m.withModifiers(()=>{},["stop"]))},[m.withDirectives(m.createElementVNode("input",{"onUpdate:modelValue":a[0]||(a[0]=c=>t.value=c),onKeyup:m.withKeys(o,["enter"]),class:"sus-link-input",type:"text",placeholder:"请输入链接"},null,544),[[m.vModelText,t.value]]),m.createElementVNode("button",{onClick:o,title:"确定"},[...a[4]||(a[4]=[m.createStaticVNode('<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" data-v-1bbeca5c><rect width="24" height="24" fill="none" data-v-1bbeca5c></rect><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-width="1.5" data-v-1bbeca5c><path d="M15 2.458A10 10 0 0 0 12 2C6.477 2 2 6.477 2 12s4.477 10 10 10s10-4.477 10-10a10 10 0 0 0-.458-3" data-v-1bbeca5c></path><path stroke-linejoin="round" d="M8.5 9.5L12 13l9-10" data-v-1bbeca5c></path></g></svg>',1)])])])],512),[[m.vShow,r.value]]),n.editor&&n.showMenu?(m.openBlock(),m.createBlock(m.unref(E1),{key:0,editor:n.editor,options:{placement:"bottom",offset:8,shouldShow:i}},{default:m.withCtx(()=>[m.createElementVNode("div",v1,[m.createElementVNode("button",{onClick:s,title:"添加链接"},[...a[5]||(a[5]=[m.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},[m.createElementVNode("path",{d:"M9 17H7A5 5 0 0 1 7 7h2"}),m.createElementVNode("path",{d:"M15 7h2a5 5 0 1 1 0 10h-2"}),m.createElementVNode("line",{x1:"8",x2:"16",y1:"12",y2:"12"})],-1)])]),m.createElementVNode("button",{onClick:a[3]||(a[3]=c=>n.editor.commands.unsetAllMarks()),title:"清除当前选中格式"},[...a[6]||(a[6]=[m.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},[m.createElementVNode("path",{d:"M4 7V4h16v3"}),m.createElementVNode("path",{d:"M5 20h6"}),m.createElementVNode("path",{d:"M13 4 8 20"}),m.createElementVNode("path",{d:"m15 15 5 5"}),m.createElementVNode("path",{d:"m20 15-5 5"})],-1)])])])]),_:1},8,["editor","options"])):m.createCommentVNode("",!0)],64))}}),[["__scopeId","data-v-1bbeca5c"]]),O1=$e.create({name:"emoji",inline:!0,group:"inline",atom:!0,addAttributes(){return{name:{default:null},src:{default:null}}},parseHTML(){return[{tag:"span[data-type='emoji']"}]},renderHTML({HTMLAttributes:n}){return["span",{"data-type":"emoji",class:"emoji",contenteditable:"false"},["img",ce(n,{src:n.src,alt:n.name,draggable:"false",loading:"lazy",align:"absmiddle"})]]}});function N1(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var hl,lf;function A1(){if(lf)return hl;lf=1;function n(b){return b instanceof Map?b.clear=b.delete=b.set=function(){throw new Error("map is read-only")}:b instanceof Set&&(b.add=b.clear=b.delete=function(){throw new Error("set is read-only")}),Object.freeze(b),Object.getOwnPropertyNames(b).forEach(x=>{const O=b[x],q=typeof O;(q==="object"||q==="function")&&!Object.isFrozen(O)&&n(O)}),b}class e{constructor(x){x.data===void 0&&(x.data={}),this.data=x.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function t(b){return b.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function r(b,...x){const O=Object.create(null);for(const q in b)O[q]=b[q];return x.forEach(function(q){for(const me in q)O[me]=q[me]}),O}const i="</span>",s=b=>!!b.scope,o=(b,{prefix:x})=>{if(b.startsWith("language:"))return b.replace("language:","language-");if(b.includes(".")){const O=b.split(".");return[`${x}${O.shift()}`,...O.map((q,me)=>`${q}${"_".repeat(me+1)}`)].join(" ")}return`${x}${b}`};class l{constructor(x,O){this.buffer="",this.classPrefix=O.classPrefix,x.walk(this)}addText(x){this.buffer+=t(x)}openNode(x){if(!s(x))return;const O=o(x.scope,{prefix:this.classPrefix});this.span(O)}closeNode(x){s(x)&&(this.buffer+=i)}value(){return this.buffer}span(x){this.buffer+=`<span class="${x}">`}}const a=(b={})=>{const x={children:[]};return Object.assign(x,b),x};class c{constructor(){this.rootNode=a(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(x){this.top.children.push(x)}openNode(x){const O=a({scope:x});this.add(O),this.stack.push(O)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(x){return this.constructor._walk(x,this.rootNode)}static _walk(x,O){return typeof O=="string"?x.addText(O):O.children&&(x.openNode(O),O.children.forEach(q=>this._walk(x,q)),x.closeNode(O)),x}static _collapse(x){typeof x!="string"&&x.children&&(x.children.every(O=>typeof O=="string")?x.children=[x.children.join("")]:x.children.forEach(O=>{c._collapse(O)}))}}class d extends c{constructor(x){super(),this.options=x}addText(x){x!==""&&this.add(x)}startScope(x){this.openNode(x)}endScope(){this.closeNode()}__addSublanguage(x,O){const q=x.root;O&&(q.scope=`language:${O}`),this.add(q)}toHTML(){return new l(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function u(b){return b?typeof b=="string"?b:b.source:null}function f(b){return g("(?=",b,")")}function h(b){return g("(?:",b,")*")}function p(b){return g("(?:",b,")?")}function g(...b){return b.map(O=>u(O)).join("")}function y(b){const x=b[b.length-1];return typeof x=="object"&&x.constructor===Object?(b.splice(b.length-1,1),x):{}}function w(...b){return"("+(y(b).capture?"":"?:")+b.map(q=>u(q)).join("|")+")"}function k(b){return new RegExp(b.toString()+"|").exec("").length-1}function C(b,x){const O=b&&b.exec(x);return O&&O.index===0}const D=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function M(b,{joinWith:x}){let O=0;return b.map(q=>{O+=1;const me=O;let ge=u(q),L="";for(;ge.length>0;){const I=D.exec(ge);if(!I){L+=ge;break}L+=ge.substring(0,I.index),ge=ge.substring(I.index+I[0].length),I[0][0]==="\\"&&I[1]?L+="\\"+String(Number(I[1])+me):(L+=I[0],I[0]==="("&&O++)}return L}).map(q=>`(${q})`).join(x)}const P=/\b\B/,T="[a-zA-Z]\\w*",V="[a-zA-Z_]\\w*",K="\\b\\d+(\\.\\d+)?",j="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",U="\\b(0b[01]+)",R="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",X=(b={})=>{const x=/^#![ ]*\//;return b.binary&&(b.begin=g(x,/.*\b/,b.binary,/\b.*/)),r({scope:"meta",begin:x,end:/$/,relevance:0,"on:begin":(O,q)=>{O.index!==0&&q.ignoreMatch()}},b)},Z={begin:"\\\\[\\s\\S]",relevance:0},ke={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[Z]},he={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[Z]},pe={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},Me=function(b,x,O={}){const q=r({scope:"comment",begin:b,end:x,contains:[]},O);q.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const me=w("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return q.contains.push({begin:g(/[ ]+/,"(",me,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),q},yt=Me("//","$"),pl=Me("/\\*","\\*/"),Xw=Me("#","$"),Qw={scope:"number",begin:K,relevance:0},Zw={scope:"number",begin:j,relevance:0},ek={scope:"number",begin:U,relevance:0},tk={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[Z,{begin:/\[/,end:/\]/,relevance:0,contains:[Z]}]},nk={scope:"title",begin:T,relevance:0},rk={scope:"title",begin:V,relevance:0},ik={begin:"\\.\\s*"+V,relevance:0};var ls=Object.freeze({__proto__:null,APOS_STRING_MODE:ke,BACKSLASH_ESCAPE:Z,BINARY_NUMBER_MODE:ek,BINARY_NUMBER_RE:U,COMMENT:Me,C_BLOCK_COMMENT_MODE:pl,C_LINE_COMMENT_MODE:yt,C_NUMBER_MODE:Zw,C_NUMBER_RE:j,END_SAME_AS_BEGIN:function(b){return Object.assign(b,{"on:begin":(x,O)=>{O.data._beginMatch=x[1]},"on:end":(x,O)=>{O.data._beginMatch!==x[1]&&O.ignoreMatch()}})},HASH_COMMENT_MODE:Xw,IDENT_RE:T,MATCH_NOTHING_RE:P,METHOD_GUARD:ik,NUMBER_MODE:Qw,NUMBER_RE:K,PHRASAL_WORDS_MODE:pe,QUOTE_STRING_MODE:he,REGEXP_MODE:tk,RE_STARTERS_RE:R,SHEBANG:X,TITLE_MODE:nk,UNDERSCORE_IDENT_RE:V,UNDERSCORE_TITLE_MODE:rk});function sk(b,x){b.input[b.index-1]==="."&&x.ignoreMatch()}function ok(b,x){b.className!==void 0&&(b.scope=b.className,delete b.className)}function lk(b,x){x&&b.beginKeywords&&(b.begin="\\b("+b.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",b.__beforeBegin=sk,b.keywords=b.keywords||b.beginKeywords,delete b.beginKeywords,b.relevance===void 0&&(b.relevance=0))}function ak(b,x){Array.isArray(b.illegal)&&(b.illegal=w(...b.illegal))}function ck(b,x){if(b.match){if(b.begin||b.end)throw new Error("begin & end are not supported with match");b.begin=b.match,delete b.match}}function dk(b,x){b.relevance===void 0&&(b.relevance=1)}const uk=(b,x)=>{if(!b.beforeMatch)return;if(b.starts)throw new Error("beforeMatch cannot be used with starts");const O=Object.assign({},b);Object.keys(b).forEach(q=>{delete b[q]}),b.keywords=O.keywords,b.begin=g(O.beforeMatch,f(O.begin)),b.starts={relevance:0,contains:[Object.assign(O,{endsParent:!0})]},b.relevance=0,delete O.beforeMatch},fk=["of","and","for","in","not","or","if","then","parent","list","value"],hk="keyword";function gf(b,x,O=hk){const q=Object.create(null);return typeof b=="string"?me(O,b.split(" ")):Array.isArray(b)?me(O,b):Object.keys(b).forEach(function(ge){Object.assign(q,gf(b[ge],x,ge))}),q;function me(ge,L){x&&(L=L.map(I=>I.toLowerCase())),L.forEach(function(I){const W=I.split("|");q[W[0]]=[ge,pk(W[0],W[1])]})}}function pk(b,x){return x?Number(x):mk(b)?0:1}function mk(b){return fk.includes(b.toLowerCase())}const yf={},Sn=b=>{console.error(b)},bf=(b,...x)=>{console.log(`WARN: ${b}`,...x)},Un=(b,x)=>{yf[`${b}/${x}`]||(console.log(`Deprecated as of ${b}. ${x}`),yf[`${b}/${x}`]=!0)},as=new Error;function wf(b,x,{key:O}){let q=0;const me=b[O],ge={},L={};for(let I=1;I<=x.length;I++)L[I+q]=me[I],ge[I+q]=!0,q+=k(x[I-1]);b[O]=L,b[O]._emit=ge,b[O]._multi=!0}function gk(b){if(Array.isArray(b.begin)){if(b.skip||b.excludeBegin||b.returnBegin)throw Sn("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),as;if(typeof b.beginScope!="object"||b.beginScope===null)throw Sn("beginScope must be object"),as;wf(b,b.begin,{key:"beginScope"}),b.begin=M(b.begin,{joinWith:""})}}function yk(b){if(Array.isArray(b.end)){if(b.skip||b.excludeEnd||b.returnEnd)throw Sn("skip, excludeEnd, returnEnd not compatible with endScope: {}"),as;if(typeof b.endScope!="object"||b.endScope===null)throw Sn("endScope must be object"),as;wf(b,b.end,{key:"endScope"}),b.end=M(b.end,{joinWith:""})}}function bk(b){b.scope&&typeof b.scope=="object"&&b.scope!==null&&(b.beginScope=b.scope,delete b.scope)}function wk(b){bk(b),typeof b.beginScope=="string"&&(b.beginScope={_wrap:b.beginScope}),typeof b.endScope=="string"&&(b.endScope={_wrap:b.endScope}),gk(b),yk(b)}function kk(b){function x(L,I){return new RegExp(u(L),"m"+(b.case_insensitive?"i":"")+(b.unicodeRegex?"u":"")+(I?"g":""))}class O{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(I,W){W.position=this.position++,this.matchIndexes[this.matchAt]=W,this.regexes.push([W,I]),this.matchAt+=k(I)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const I=this.regexes.map(W=>W[1]);this.matcherRe=x(M(I,{joinWith:"|"}),!0),this.lastIndex=0}exec(I){this.matcherRe.lastIndex=this.lastIndex;const W=this.matcherRe.exec(I);if(!W)return null;const ve=W.findIndex((Tr,gl)=>gl>0&&Tr!==void 0),we=this.matchIndexes[ve];return W.splice(0,ve),Object.assign(W,we)}}class q{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(I){if(this.multiRegexes[I])return this.multiRegexes[I];const W=new O;return this.rules.slice(I).forEach(([ve,we])=>W.addRule(ve,we)),W.compile(),this.multiRegexes[I]=W,W}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(I,W){this.rules.push([I,W]),W.type==="begin"&&this.count++}exec(I){const W=this.getMatcher(this.regexIndex);W.lastIndex=this.lastIndex;let ve=W.exec(I);if(this.resumingScanAtSamePosition()&&!(ve&&ve.index===this.lastIndex)){const we=this.getMatcher(0);we.lastIndex=this.lastIndex+1,ve=we.exec(I)}return ve&&(this.regexIndex+=ve.position+1,this.regexIndex===this.count&&this.considerAll()),ve}}function me(L){const I=new q;return L.contains.forEach(W=>I.addRule(W.begin,{rule:W,type:"begin"})),L.terminatorEnd&&I.addRule(L.terminatorEnd,{type:"end"}),L.illegal&&I.addRule(L.illegal,{type:"illegal"}),I}function ge(L,I){const W=L;if(L.isCompiled)return W;[ok,ck,wk,uk].forEach(we=>we(L,I)),b.compilerExtensions.forEach(we=>we(L,I)),L.__beforeBegin=null,[lk,ak,dk].forEach(we=>we(L,I)),L.isCompiled=!0;let ve=null;return typeof L.keywords=="object"&&L.keywords.$pattern&&(L.keywords=Object.assign({},L.keywords),ve=L.keywords.$pattern,delete L.keywords.$pattern),ve=ve||/\w+/,L.keywords&&(L.keywords=gf(L.keywords,b.case_insensitive)),W.keywordPatternRe=x(ve,!0),I&&(L.begin||(L.begin=/\B|\b/),W.beginRe=x(W.begin),!L.end&&!L.endsWithParent&&(L.end=/\B|\b/),L.end&&(W.endRe=x(W.end)),W.terminatorEnd=u(W.end)||"",L.endsWithParent&&I.terminatorEnd&&(W.terminatorEnd+=(L.end?"|":"")+I.terminatorEnd)),L.illegal&&(W.illegalRe=x(L.illegal)),L.contains||(L.contains=[]),L.contains=[].concat(...L.contains.map(function(we){return xk(we==="self"?L:we)})),L.contains.forEach(function(we){ge(we,W)}),L.starts&&ge(L.starts,I),W.matcher=me(W),W}if(b.compilerExtensions||(b.compilerExtensions=[]),b.contains&&b.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return b.classNameAliases=r(b.classNameAliases||{}),ge(b)}function kf(b){return b?b.endsWithParent||kf(b.starts):!1}function xk(b){return b.variants&&!b.cachedVariants&&(b.cachedVariants=b.variants.map(function(x){return r(b,{variants:null},x)})),b.cachedVariants?b.cachedVariants:kf(b)?r(b,{starts:b.starts?r(b.starts):null}):Object.isFrozen(b)?r(b):b}var Sk="11.11.1";class Ck extends Error{constructor(x,O){super(x),this.name="HTMLInjectionError",this.html=O}}const ml=t,xf=r,Sf=Symbol("nomatch"),Ek=7,Cf=function(b){const x=Object.create(null),O=Object.create(null),q=[];let me=!0;const ge="Could not find the language '{}', did you forget to load/include a language module?",L={disableAutodetect:!0,name:"Plain text",contains:[]};let I={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:d};function W(v){return I.noHighlightRe.test(v)}function ve(v){let z=v.className+" ";z+=v.parentNode?v.parentNode.className:"";const Q=I.languageDetectRe.exec(z);if(Q){const re=nn(Q[1]);return re||(bf(ge.replace("{}",Q[1])),bf("Falling back to no-highlight mode for this block.",v)),re?Q[1]:"no-highlight"}return z.split(/\s+/).find(re=>W(re)||nn(re))}function we(v,z,Q){let re="",xe="";typeof z=="object"?(re=v,Q=z.ignoreIllegals,xe=z.language):(Un("10.7.0","highlight(lang, code, ...args) has been deprecated."),Un("10.7.0",`Please use highlight(code, options) instead.
105
- https://github.com/highlightjs/highlight.js/issues/2277`),xe=v,re=z),Q===void 0&&(Q=!0);const ot={code:re,language:xe};ds("before:highlight",ot);const rn=ot.result?ot.result:Tr(ot.language,ot.code,Q);return rn.code=ot.code,ds("after:highlight",rn),rn}function Tr(v,z,Q,re){const xe=Object.create(null);function ot(A,_){return A.keywords[_]}function rn(){if(!J.keywords){Ae.addText(ie);return}let A=0;J.keywordPatternRe.lastIndex=0;let _=J.keywordPatternRe.exec(ie),Y="";for(;_;){Y+=ie.substring(A,_.index);const te=wt.case_insensitive?_[0].toLowerCase():_[0],Le=ot(J,te);if(Le){const[It,Hk]=Le;if(Ae.addText(Y),Y="",xe[te]=(xe[te]||0)+1,xe[te]<=Ek&&(hs+=Hk),It.startsWith("_"))Y+=_[0];else{const Fk=wt.classNameAliases[It]||It;bt(_[0],Fk)}}else Y+=_[0];A=J.keywordPatternRe.lastIndex,_=J.keywordPatternRe.exec(ie)}Y+=ie.substring(A),Ae.addText(Y)}function us(){if(ie==="")return;let A=null;if(typeof J.subLanguage=="string"){if(!x[J.subLanguage]){Ae.addText(ie);return}A=Tr(J.subLanguage,ie,!0,Df[J.subLanguage]),Df[J.subLanguage]=A._top}else A=yl(ie,J.subLanguage.length?J.subLanguage:null);J.relevance>0&&(hs+=A.relevance),Ae.__addSublanguage(A._emitter,A.language)}function qe(){J.subLanguage!=null?us():rn(),ie=""}function bt(A,_){A!==""&&(Ae.startScope(_),Ae.addText(A),Ae.endScope())}function Tf(A,_){let Y=1;const te=_.length-1;for(;Y<=te;){if(!A._emit[Y]){Y++;continue}const Le=wt.classNameAliases[A[Y]]||A[Y],It=_[Y];Le?bt(It,Le):(ie=It,rn(),ie=""),Y++}}function Of(A,_){return A.scope&&typeof A.scope=="string"&&Ae.openNode(wt.classNameAliases[A.scope]||A.scope),A.beginScope&&(A.beginScope._wrap?(bt(ie,wt.classNameAliases[A.beginScope._wrap]||A.beginScope._wrap),ie=""):A.beginScope._multi&&(Tf(A.beginScope,_),ie="")),J=Object.create(A,{parent:{value:J}}),J}function Nf(A,_,Y){let te=C(A.endRe,Y);if(te){if(A["on:end"]){const Le=new e(A);A["on:end"](_,Le),Le.isMatchIgnored&&(te=!1)}if(te){for(;A.endsParent&&A.parent;)A=A.parent;return A}}if(A.endsWithParent)return Nf(A.parent,_,Y)}function Bk(A){return J.matcher.regexIndex===0?(ie+=A[0],1):(xl=!0,0)}function _k(A){const _=A[0],Y=A.rule,te=new e(Y),Le=[Y.__beforeBegin,Y["on:begin"]];for(const It of Le)if(It&&(It(A,te),te.isMatchIgnored))return Bk(_);return Y.skip?ie+=_:(Y.excludeBegin&&(ie+=_),qe(),!Y.returnBegin&&!Y.excludeBegin&&(ie=_)),Of(Y,A),Y.returnBegin?0:_.length}function Vk(A){const _=A[0],Y=z.substring(A.index),te=Nf(J,A,Y);if(!te)return Sf;const Le=J;J.endScope&&J.endScope._wrap?(qe(),bt(_,J.endScope._wrap)):J.endScope&&J.endScope._multi?(qe(),Tf(J.endScope,A)):Le.skip?ie+=_:(Le.returnEnd||Le.excludeEnd||(ie+=_),qe(),Le.excludeEnd&&(ie=_));do J.scope&&Ae.closeNode(),!J.skip&&!J.subLanguage&&(hs+=J.relevance),J=J.parent;while(J!==te.parent);return te.starts&&Of(te.starts,A),Le.returnEnd?0:_.length}function $k(){const A=[];for(let _=J;_!==wt;_=_.parent)_.scope&&A.unshift(_.scope);A.forEach(_=>Ae.openNode(_))}let fs={};function Af(A,_){const Y=_&&_[0];if(ie+=A,Y==null)return qe(),0;if(fs.type==="begin"&&_.type==="end"&&fs.index===_.index&&Y===""){if(ie+=z.slice(_.index,_.index+1),!me){const te=new Error(`0 width match regex (${v})`);throw te.languageName=v,te.badRule=fs.rule,te}return 1}if(fs=_,_.type==="begin")return _k(_);if(_.type==="illegal"&&!Q){const te=new Error('Illegal lexeme "'+Y+'" for mode "'+(J.scope||"<unnamed>")+'"');throw te.mode=J,te}else if(_.type==="end"){const te=Vk(_);if(te!==Sf)return te}if(_.type==="illegal"&&Y==="")return ie+=`
106
- `,1;if(kl>1e5&&kl>_.index*3)throw new Error("potential infinite loop, way more iterations than matches");return ie+=Y,Y.length}const wt=nn(v);if(!wt)throw Sn(ge.replace("{}",v)),new Error('Unknown language: "'+v+'"');const zk=kk(wt);let wl="",J=re||zk;const Df={},Ae=new I.__emitter(I);$k();let ie="",hs=0,Cn=0,kl=0,xl=!1;try{if(wt.__emitTokens)wt.__emitTokens(z,Ae);else{for(J.matcher.considerAll();;){kl++,xl?xl=!1:J.matcher.considerAll(),J.matcher.lastIndex=Cn;const A=J.matcher.exec(z);if(!A)break;const _=z.substring(Cn,A.index),Y=Af(_,A);Cn=A.index+Y}Af(z.substring(Cn))}return Ae.finalize(),wl=Ae.toHTML(),{language:v,value:wl,relevance:hs,illegal:!1,_emitter:Ae,_top:J}}catch(A){if(A.message&&A.message.includes("Illegal"))return{language:v,value:ml(z),illegal:!0,relevance:0,_illegalBy:{message:A.message,index:Cn,context:z.slice(Cn-100,Cn+100),mode:A.mode,resultSoFar:wl},_emitter:Ae};if(me)return{language:v,value:ml(z),illegal:!1,relevance:0,errorRaised:A,_emitter:Ae,_top:J};throw A}}function gl(v){const z={value:ml(v),illegal:!1,relevance:0,_top:L,_emitter:new I.__emitter(I)};return z._emitter.addText(v),z}function yl(v,z){z=z||I.languages||Object.keys(x);const Q=gl(v),re=z.filter(nn).filter(vf).map(qe=>Tr(qe,v,!1));re.unshift(Q);const xe=re.sort((qe,bt)=>{if(qe.relevance!==bt.relevance)return bt.relevance-qe.relevance;if(qe.language&&bt.language){if(nn(qe.language).supersetOf===bt.language)return 1;if(nn(bt.language).supersetOf===qe.language)return-1}return 0}),[ot,rn]=xe,us=ot;return us.secondBest=rn,us}function Mk(v,z,Q){const re=z&&O[z]||Q;v.classList.add("hljs"),v.classList.add(`language-${re}`)}function bl(v){let z=null;const Q=ve(v);if(W(Q))return;if(ds("before:highlightElement",{el:v,language:Q}),v.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",v);return}if(v.children.length>0&&(I.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(v)),I.throwUnescapedHTML))throw new Ck("One of your code blocks includes unescaped HTML.",v.innerHTML);z=v;const re=z.textContent,xe=Q?we(re,{language:Q,ignoreIllegals:!0}):yl(re);v.innerHTML=xe.value,v.dataset.highlighted="yes",Mk(v,Q,xe.language),v.result={language:xe.language,re:xe.relevance,relevance:xe.relevance},xe.secondBest&&(v.secondBest={language:xe.secondBest.language,relevance:xe.secondBest.relevance}),ds("after:highlightElement",{el:v,result:xe,text:re})}function vk(v){I=xf(I,v)}const Tk=()=>{cs(),Un("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function Ok(){cs(),Un("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let Ef=!1;function cs(){function v(){cs()}if(document.readyState==="loading"){Ef||window.addEventListener("DOMContentLoaded",v,!1),Ef=!0;return}document.querySelectorAll(I.cssSelector).forEach(bl)}function Nk(v,z){let Q=null;try{Q=z(b)}catch(re){if(Sn("Language definition for '{}' could not be registered.".replace("{}",v)),me)Sn(re);else throw re;Q=L}Q.name||(Q.name=v),x[v]=Q,Q.rawDefinition=z.bind(null,b),Q.aliases&&Mf(Q.aliases,{languageName:v})}function Ak(v){delete x[v];for(const z of Object.keys(O))O[z]===v&&delete O[z]}function Dk(){return Object.keys(x)}function nn(v){return v=(v||"").toLowerCase(),x[v]||x[O[v]]}function Mf(v,{languageName:z}){typeof v=="string"&&(v=[v]),v.forEach(Q=>{O[Q.toLowerCase()]=z})}function vf(v){const z=nn(v);return z&&!z.disableAutodetect}function Rk(v){v["before:highlightBlock"]&&!v["before:highlightElement"]&&(v["before:highlightElement"]=z=>{v["before:highlightBlock"](Object.assign({block:z.el},z))}),v["after:highlightBlock"]&&!v["after:highlightElement"]&&(v["after:highlightElement"]=z=>{v["after:highlightBlock"](Object.assign({block:z.el},z))})}function Ik(v){Rk(v),q.push(v)}function Pk(v){const z=q.indexOf(v);z!==-1&&q.splice(z,1)}function ds(v,z){const Q=v;q.forEach(function(re){re[Q]&&re[Q](z)})}function Lk(v){return Un("10.7.0","highlightBlock will be removed entirely in v12.0"),Un("10.7.0","Please use highlightElement now."),bl(v)}Object.assign(b,{highlight:we,highlightAuto:yl,highlightAll:cs,highlightElement:bl,highlightBlock:Lk,configure:vk,initHighlighting:Tk,initHighlightingOnLoad:Ok,registerLanguage:Nk,unregisterLanguage:Ak,listLanguages:Dk,getLanguage:nn,registerAliases:Mf,autoDetection:vf,inherit:xf,addPlugin:Ik,removePlugin:Pk}),b.debugMode=function(){me=!1},b.safeMode=function(){me=!0},b.versionString=Sk,b.regex={concat:g,lookahead:f,either:w,optional:p,anyNumberOfTimes:h};for(const v in ls)typeof ls[v]=="object"&&n(ls[v]);return Object.assign(b,ls),b},Wn=Cf({});return Wn.newInstance=()=>Cf({}),hl=Wn,Wn.HighlightJS=Wn,Wn.default=Wn,hl}var D1=A1();const R1=N1(D1);function af(n,e=[]){return n.flatMap(t=>{const r=[...e,...t.properties?t.properties.className:[]];return t.children?af(t.children,r):{text:t.value,classes:r}})}function cf(n){return n.value||n.children||[]}function I1(n){return!!R1.getLanguage(n)}function df({doc:n,name:e,lowlight:t,defaultLanguage:r}){const i=[];return co(n,s=>s.type.name===e).forEach(s=>{var o;let l=s.pos+1;const a=s.node.attrs.language||r,c=t.listLanguages(),d=a&&(c.includes(a)||I1(a)||(o=t.registered)!=null&&o.call(t,a))?cf(t.highlight(a,s.node.textContent)):cf(t.highlightAuto(s.node.textContent));af(d).forEach(u=>{const f=l+u.text.length;if(u.classes.length){const h=Ie.inline(l,f,{class:u.classes.join(" ")});i.push(h)}l=f})}),ae.create(n,i)}function P1(n){return typeof n=="function"}function L1({name:n,lowlight:e,defaultLanguage:t}){if(!["highlight","highlightAuto","listLanguages"].every(i=>P1(e[i])))throw Error("You should provide an instance of lowlight to use the code-block-lowlight extension");const r=new se({key:new le("lowlight"),state:{init:(i,{doc:s})=>df({doc:s,name:n,lowlight:e,defaultLanguage:t}),apply:(i,s,o,l)=>{const a=o.selection.$head.parent.type.name,c=l.selection.$head.parent.type.name,d=co(o.doc,f=>f.type.name===n),u=co(l.doc,f=>f.type.name===n);return i.docChanged&&([a,c].includes(n)||u.length!==d.length||i.steps.some(f=>f.from!==void 0&&f.to!==void 0&&d.some(h=>h.pos>=f.from&&h.pos+h.node.nodeSize<=f.to)))?df({doc:i.doc,name:n,lowlight:e,defaultLanguage:t}):s.map(i.mapping,i.doc)}},props:{decorations(i){return r.getState(i)}}});return r}var B1=Qy.extend({addOptions(){var n;return{...(n=this.parent)==null?void 0:n.call(this),lowlight:{},languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:4,HTMLAttributes:{}}},addProseMirrorPlugins(){var n;return[...((n=this.parent)==null?void 0:n.call(this))||[],L1({name:this.name,lowlight:this.options.lowlight,defaultLanguage:this.options.defaultLanguage})]}}),_1=B1;const V1=["onClick"],$1={class:"sus-code-block-content"},z1=Yt(m.defineComponent({__name:"CodeBlockView",props:{editor:{},node:{},updateAttributes:{type:Function},selected:{type:Boolean}},setup(n){const e=n,t=m.ref(!1),r=m.ref(null),i=m.computed(()=>e.node.attrs.language||""),s=m.computed(()=>{const c=uf.find(d=>d.value===i.value);return c?c.label:"纯文本"});function o(c){e.updateAttributes({language:c||null}),t.value=!1}function l(){t.value=!t.value}function a(c){r.value&&!r.value.contains(c.target)&&(t.value=!1)}return m.onMounted(()=>{document.addEventListener("click",a)}),m.onUnmounted(()=>{document.removeEventListener("click",a)}),(c,d)=>(m.openBlock(),m.createBlock(m.unref(Dy),{class:m.normalizeClass(["sus-code-block-wrapper",{"is-selected":n.selected}])},{default:m.withCtx(()=>[m.createElementVNode("div",{class:"sus-code-block-toolbar",ref_key:"languageSelectRef",ref:r},[m.createElementVNode("button",{onClick:m.withModifiers(l,["stop"]),class:"sus-code-block-language-btn",title:"选择语言"},[m.createElementVNode("span",null,m.toDisplayString(s.value),1),d[1]||(d[1]=m.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[m.createElementVNode("polyline",{points:"6 9 12 15 18 9"})],-1))]),t.value?(m.openBlock(),m.createElementBlock("div",{key:0,class:"sus-code-block-language-selector",onClick:d[0]||(d[0]=m.withModifiers(()=>{},["stop"]))},[(m.openBlock(!0),m.createElementBlock(m.Fragment,null,m.renderList(m.unref(uf),u=>(m.openBlock(),m.createElementBlock("div",{key:u.value,onClick:f=>o(u.value),class:m.normalizeClass(["sus-code-block-language-item",{active:i.value===u.value}])},m.toDisplayString(u.label),11,V1))),128))])):m.createCommentVNode("",!0)],512),m.createElementVNode("pre",$1,[d[2]||(d[2]=m.createTextVNode(" ",-1)),m.createElementVNode("code",null,[m.createVNode(m.unref(Ay))]),d[3]||(d[3]=m.createTextVNode(`
107
- `,-1))])]),_:1},8,["class"]))}}),[["__scopeId","data-v-a07bc552"]]),H1=_f.createLowlight(),uf=[{value:"",label:"纯文本"},{value:"java",label:"Java"},{value:"python",label:"Python"},{value:"shell",label:"Shell"},{value:"yaml",label:"YAML"},{value:"javascript",label:"JavaScript"},{value:"html",label:"HTML"}],F1=_1.extend({addNodeView(){return Ly(z1)}}).configure({lowlight:H1,defaultLanguage:null}),j1={class:"sus-comment"},U1={key:0,class:"sus-comment-avatar"},W1=["src"],K1={class:"sus-avatar-text"},q1={class:"sus-comment__main"},J1={key:0,class:"sus-comment__info"},G1={key:0,class:"sus-comment__info-input"},Y1=["placeholder","title"],X1={key:1,class:"sus-comment__info-input"},Q1=["placeholder","title"],Z1={key:2,class:"sus-comment__info-input"},ew=["placeholder","title"],tw={class:"sus-comment__editor-wrapper"},nw={class:"sus-comment__footer"},rw={class:"sus-comment__footer-left"},iw={key:0,class:"sus-comment__footer-icon"},sw={key:1,class:"sus-upload sus-comment__footer-icon"},ow={class:"sus-comment__toolbar"},lw={class:"sus-comment__toolbar-mask"},aw={class:"sus-comment__extend"},cw=["src"],dw=["onClick"],ff=Yt(m.defineComponent({__name:"index",props:{reply:{},toolBar:{},infoBar:{},placeholder:{default:"支持常见的markdown语法,如图片、代码块等"},comment:{}},emits:["on-save","on-cancel","add-image","update-avatar"],setup(n,{expose:e,emit:t}){class r{articleId="";userName="";userEmail="";userWebsite="";userAvatar="";content="";contentText="";replyName="";parentId="";notify=0;privacy=!1}const i=n;e({updateImage:M,updatePreviewImage:T});const s=t,o=m.reactive({emojis:i.toolBar?.emoji?.emojis||[],showPanel:!1}),l=i.reply?.userName,a=m.ref("在此处留下你的足迹吧!(支持markdown语法)"),c=m.reactive(new r),d=m.ref(""),u=m.ref(null),f=m.ref([]),h=m.ref(null),p=i.comment?.privacy||!1,g={enable:i.infoBar?.enable===void 0?!0:i.infoBar.enable,name:{show:i.infoBar?.name?.show===void 0?!0:i.infoBar.name.show,placeholder:i.infoBar?.name?.placeholder||"昵称(必填)"},website:{show:i.infoBar?.website?.show===void 0?!0:i.infoBar.website.show,placeholder:i.infoBar?.website?.placeholder||"网址(https://)",tips:i.infoBar?.website?.tips||"点击昵称时可跳转"},email:{show:i.infoBar?.email?.show===void 0?!0:i.infoBar.email.show,placeholder:i.infoBar?.email?.placeholder||"邮箱(不会公开,仅用于通知回复)",tips:i.infoBar?.email?.tips||"输入QQ邮箱自动获取头像"}},y=Ry({extensions:[yb.configure({codeBlock:!1}),F1,kb,pb.configure({placeholder:i.placeholder}),R0.configure({openOnClick:!1,enableClickSelection:!0,HTMLAttributes:{class:"cursor-pointer",onclick:"return false;"}}),O1],editorProps:{handleDOMEvents:{mousedown:(U,R)=>R.target.closest("a")?(R.preventDefault(),R.stopPropagation(),setTimeout(()=>{y.value&&y.value.chain().focus().extendMarkRange("link").run()},0),!0):!1,click:(U,R)=>R.target.closest("a")?(R.preventDefault(),R.stopPropagation(),!0):!1}}});function w(){i.comment&&(c.privacy=i.comment.privacy===void 0?!1:i.comment.privacy,c.notify=i.comment.notify||1,c.userName=i.comment.userName||"",c.userEmail=i.comment.userEmail||"",c.userWebsite=i.comment.userWebsite||"",c.userAvatar=i.comment.userAvatar||"",c.content=i.comment.content||"",c.articleId=i.comment.articleId||"")}async function k(){if(!(!y||!y.value)){if(d.value=y.value.getHTML(),c.userWebsite&&(c.userWebsite.concat("http://")||c.userWebsite.concat("https://")||(c.userWebsite="https://"+c.userWebsite)),localStorage.setItem("user",JSON.stringify(c)),localStorage.setItem("comment-content",d.value),i.reply?.id&&i.reply?.id!="0"){const U=i.reply.parentId;c.parentId=U==="0"?i.reply.id:U,c.replyName=i.reply.userName,a.value="@"+l+":"}c.content=d.value,c.contentText=y.value.getText(),s("on-save",c,h.value)}}function C(){localStorage.setItem("comment-content",""),s("on-cancel")}function D(){s("add-image",u.value,h.value)}function M(U){h.value||(h.value=[]),!h.value||h.value.length==0?h.value=U:h.value=P(h.value,U[0]),f.value=[];for(let R=0;R<h.value.length;R++)f.value.push(URL.createObjectURL(h.value[R]))}function P(U,R){return[...U,R]}function T(U){f.value=U}function V(){s("update-avatar",c)}function K(){c.notify==1?c.notify=0:c.notify=1}function j(U){try{if(!h.value||!h.value.length||h.value.length<=1){h.value=[],f.value=[];return}h.value?.splice(U,1),f.value.splice(U,1)}catch(R){console.log("remove image error: ",R),h.value=[],f.value=[]}}return m.onMounted(()=>{if(!y||!y.value)return;w();const U=localStorage.getItem("user");if(c.content&&c.content.length>3)y.value.commands.setContent(c.content);else{const R=localStorage.getItem("comment-content");R&&y.value.commands.setContent(R)}if(U){const R=JSON.parse(U);c.userName=R.userName,c.userEmail=R.userEmail,c.userWebsite=R.userWebsite,V()}c.notify=1}),(U,R)=>(m.openBlock(),m.createElementBlock("div",j1,[g.enable?(m.openBlock(),m.createElementBlock("div",U1,[m.withDirectives(m.createElementVNode("img",{alt:"头像",src:c.userAvatar,class:"sus-avatar",onerror:"this.onerror=null,this.src='/error.webp'"},null,8,W1),[[m.vShow,!!c.userAvatar]]),m.withDirectives(m.createElementVNode("div",K1,[m.createElementVNode("span",null,m.toDisplayString(c?.userName?.charAt(0)),1)],512),[[m.vShow,!c.userAvatar]])])):m.createCommentVNode("",!0),m.createElementVNode("div",q1,[g.enable?(m.openBlock(),m.createElementBlock("div",J1,[g.name.show?(m.openBlock(),m.createElementBlock("div",G1,[m.withDirectives(m.createElementVNode("input",{class:"sus-input sus-username",placeholder:g.name.placeholder,title:g.name.placeholder,"onUpdate:modelValue":R[0]||(R[0]=X=>c.userName=X),maxlength:"23"},null,8,Y1),[[m.vModelText,c.userName]])])):m.createCommentVNode("",!0),g.website.show?(m.openBlock(),m.createElementBlock("div",X1,[m.createVNode(m.unref(qn.OuOToolTip),{content:g.website.tips},{default:m.withCtx(()=>[m.withDirectives(m.createElementVNode("input",{class:"sus-input sus-web",placeholder:g.website.placeholder,title:g.website.placeholder,"onUpdate:modelValue":R[1]||(R[1]=X=>c.userWebsite=X),maxlength:"35"},null,8,Q1),[[m.vModelText,c.userWebsite]])]),_:1},8,["content"])])):m.createCommentVNode("",!0),g.email.show?(m.openBlock(),m.createElementBlock("div",Z1,[m.createVNode(m.unref(qn.OuOToolTip),{content:g.email.tips},{default:m.withCtx(()=>[m.withDirectives(m.createElementVNode("input",{onBlur:V,class:"sus-input sus-email",placeholder:g.email.placeholder,title:g.email.placeholder,"onUpdate:modelValue":R[2]||(R[2]=X=>c.userEmail=X),maxlength:"35"},null,40,ew),[[m.vModelText,c.userEmail]])]),_:1},8,["content"])])):m.createCommentVNode("",!0)])):m.createCommentVNode("",!0),m.createElementVNode("div",tw,[m.createVNode(T1,{editor:m.unref(y),showMenu:n.toolBar?.bubbleMenu?.show},null,8,["editor","showMenu"]),m.withDirectives(m.createVNode($y,{class:"sus-emoji-panel-position",emoji:o,editor:m.unref(y)},null,8,["emoji","editor"]),[[m.vShow,o.showPanel]]),m.createVNode(m.unref(Ny),{class:"sus-comment-input",editor:m.unref(y)},null,8,["editor"])]),m.createElementVNode("div",nw,[m.createElementVNode("div",rw,[o.emojis.length>=0?(m.openBlock(),m.createElementBlock("div",iw,[(m.openBlock(),m.createElementBlock("svg",{title:"表情",onClick:R[3]||(R[3]=X=>o.showPanel=!o.showPanel),xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},[...R[5]||(R[5]=[m.createStaticVNode('<g fill="none" data-v-f4426d84><path stroke="currentColor" stroke-linecap="round" stroke-width="1.5" d="M9 16c.85.63 1.885 1 3 1s2.15-.37 3-1" data-v-f4426d84></path><path fill="currentColor" d="M16 10.5c0 .828-.448 1.5-1 1.5s-1-.672-1-1.5s.448-1.5 1-1.5s1 .672 1 1.5" data-v-f4426d84></path><ellipse cx="9" cy="10.5" fill="currentColor" rx="1" ry="1.5" data-v-f4426d84></ellipse><path stroke="currentColor" stroke-linecap="round" stroke-width="1.5" d="M7 3.338A9.95 9.95 0 0 1 12 2c5.523 0 10 4.477 10 10s-4.477 10-10 10S2 17.523 2 12c0-1.821.487-3.53 1.338-5" data-v-f4426d84></path></g>',1)])]))])):m.createCommentVNode("",!0),n.toolBar?.image?(m.openBlock(),m.createElementBlock("div",sw,[m.createElementVNode("input",{ref_key:"imgRef",ref:u,onChange:D,type:"file",id:"upload-input",name:"image",accept:"image/*"},null,544),R[6]||(R[6]=m.createStaticVNode('<label for="upload-input" data-v-f4426d84><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" data-v-f4426d84><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-width="1.5" data-v-f4426d84><path d="m2 12.5l1.752-1.533a2.3 2.3 0 0 1 3.14.105l4.29 4.29a2 2 0 0 0 2.564.222l.299-.21a3 3 0 0 1 3.731.225L21 18.5m-6-13h3.5m0 0H22m-3.5 0V9m0-3.5V2" data-v-f4426d84></path><path d="M22 12c0 4.714 0 7.071-1.465 8.535C19.072 22 16.714 22 12 22s-7.071 0-8.536-1.465C2 19.072 2 16.714 2 12c0-1.128 0-2.122.02-3M12 2C7.286 2 4.929 2 3.464 3.464c-.424.425-.726.925-.94 1.536" data-v-f4426d84></path></g></svg></label>',1))])):m.createCommentVNode("",!0),n.toolBar?.notify?(m.openBlock(),m.createElementBlock("div",{key:2,onClick:K,class:"sus-comment__footer-icon"},[m.withDirectives(m.createVNode(m.unref(qn.OuOToolTip),{content:"收到回复后通知"},{default:m.withCtx(()=>[...R[7]||(R[7]=[m.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},[m.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-width":"1.5",d:"M12 6v4m-4.5 9c.655 1.748 2.422 3 4.5 3q.367 0 .72-.05M16.5 19a4.5 4.5 0 0 1-1.302 1.84M9.107 2.674A6.5 6.5 0 0 1 12 2c3.727 0 6.75 3.136 6.75 7.005v.705a4.4 4.4 0 0 0 .692 2.375l1.108 1.724c1.011 1.575.239 3.716-1.52 4.214a25.8 25.8 0 0 1-14.06 0c-1.759-.498-2.531-2.639-1.52-4.213l1.108-1.725A4.4 4.4 0 0 0 5.25 9.71v-.705c0-1.074.233-2.092.65-3.002"})],-1)])]),_:1},512),[[m.vShow,c.notify===1]]),m.withDirectives(m.createVNode(m.unref(qn.OuOToolTip),{content:"收到回复后不通知"},{default:m.withCtx(()=>[...R[8]||(R[8]=[m.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},[m.createElementVNode("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-width":"1.5"},[m.createElementVNode("path",{"stroke-linejoin":"round",d:"M10 9h4l-4 4h4"}),m.createElementVNode("path",{d:"M7.5 19c.655 1.748 2.422 3 4.5 3q.367 0 .72-.05M16.5 19a4.5 4.5 0 0 1-1.302 1.84M9.107 2.674A6.5 6.5 0 0 1 12 2c3.727 0 6.75 3.136 6.75 7.005v.705a4.4 4.4 0 0 0 .692 2.375l1.108 1.724c1.011 1.575.239 3.716-1.52 4.214a25.8 25.8 0 0 1-14.06 0c-1.759-.498-2.531-2.639-1.52-4.213l1.108-1.725A4.4 4.4 0 0 0 5.25 9.71v-.705c0-1.074.233-2.092.65-3.002"})])],-1)])]),_:1},512),[[m.vShow,c.notify!==1]])])):m.createCommentVNode("",!0)]),m.createElementVNode("div",{class:"sus-comment__footer-send"},[m.createElementVNode("button",{class:"sus-button cancel",onClick:C},"取消"),m.createElementVNode("button",{class:"sus-button ok",onClick:k},"发送")])]),m.createElementVNode("div",ow,[m.withDirectives(m.createVNode(m.unref(qn.OuOCheckBox),{modelValue:c.privacy,"onUpdate:modelValue":R[4]||(R[4]=X=>c.privacy=X),checked:m.unref(p)},{default:m.withCtx(()=>[...R[9]||(R[9]=[m.createTextVNode(" 仅博主可见 ",-1)])]),_:1},8,["modelValue","checked"]),[[m.vShow,n.toolBar?.privacy?.show]]),m.withDirectives(m.createElementVNode("div",lw,null,512),[[m.vShow,n.toolBar?.privacy?.disable]])]),m.createElementVNode("div",aw,[(m.openBlock(!0),m.createElementBlock(m.Fragment,null,m.renderList(f.value,(X,Z)=>(m.openBlock(),m.createElementBlock("div",{class:"sus-comment__extend-img",key:X},[m.createElementVNode("img",{class:"img-item",src:X,alt:""},null,8,cw),m.createElementVNode("div",{onClick:ke=>j(Z),class:"mask"},[...R[10]||(R[10]=[m.createStaticVNode('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" data-v-f4426d84><g fill="none" stroke="currentColor" stroke-width="1.5" data-v-f4426d84><path stroke-linecap="round" d="M20.5 6h-17m6 5l.5 5m4.5-5l-.5 5" data-v-f4426d84></path><path d="M6.5 6h.11a2 2 0 0 0 1.83-1.32l.034-.103l.097-.291c.083-.249.125-.373.18-.479a1.5 1.5 0 0 1 1.094-.788C9.962 3 10.093 3 10.355 3h3.29c.262 0 .393 0 .51.019a1.5 1.5 0 0 1 1.094.788c.055.106.097.23.18.479l.097.291A2 2 0 0 0 17.5 6" data-v-f4426d84></path><path stroke-linecap="round" d="M18.374 15.4c-.177 2.654-.266 3.981-1.131 4.79s-2.195.81-4.856.81h-.774c-2.66 0-3.99 0-4.856-.81c-.865-.809-.953-2.136-1.13-4.79l-.46-6.9m13.666 0l-.2 3" data-v-f4426d84></path></g></svg>',1)])],8,dw)]))),128))])])]))}}),[["__scopeId","data-v-f4426d84"]]);function uw(n){const e=new Date(n),t=e.getFullYear(),r=e.getMonth()+1,i=e.getDate(),s=new Date,o=s.getFullYear(),l=s.getMonth()+1,a=s.getDate();if(o===t&&l==r){const c=a-i;if(c===0)return"今天";if(c<7)return c+"天前"}return o===t?`${r}月${i}日`:`${t}年${r}月${i}日`}const fw={class:"sus-item__container"},hw={class:"sus-item-svg",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},pw={class:"sus-item__row"},mw={class:"sus-item__operate"},gw={class:"sus-comment-aside"},yw={class:"sus-comment-avatar"},bw=["src"],ww={class:"sus-avatar-text"},kw={class:"sus-item-floor"},xw={class:"sus-item__main"},Sw={class:"sus-item__user"},Cw=["rel","href"],Ew={key:0,class:"sus-item-tag",title:"博主"},Mw={key:1,class:"sus-item__content-name"},vw={class:"sus-item__user-date"},Tw={key:0,class:"sus-item__content"},Ow=["innerHTML"],Nw={key:1,class:"sus-item__content"},Aw=["innerHTML"],Dw={key:0,class:"sus-item__info"},Rw={class:"sus-item__info-area"},Iw={class:"sus-item__info-useragent"},ss=Yt(m.defineComponent({__name:"item",props:{comment:{},lineHeight:{},showFooter:{type:Boolean},num:{default:1}},emits:["on-reply","on-edit","on-remove"],setup(n,{emit:e}){const t=n,r=m.ref(),i=m.ref(),s=m.ref(!1),o=e;function l(){r.value.style.display="block",s.value=!1}function a(){const p=r?.value?.clientHeight||0,g=t.lineHeight*5;p>=g&&(s.value=!0)}function c(){o("on-reply",t.comment)}function d(){o("on-edit",t.comment)}function u(){o("on-remove",t.comment)}function f(){t.comment.userAvatar||(t.comment.userAvatar="/error.webp")}function h(){const p=new Date(t.comment?.createdDate),g=new Date,y=new Date(g.getFullYear()-1,g.getMonth(),g.getDate());return p>y?"ugc noopener nofollow":"ugc noopener noreferrer nofollow"}return m.onMounted(()=>{f(),a()}),(p,g)=>(m.openBlock(),m.createElementBlock("div",fw,[m.withDirectives((m.openBlock(),m.createElementBlock("svg",hw,[...g[0]||(g[0]=[m.createElementVNode("rect",{width:"24",height:"24",fill:"none"},null,-1),m.createElementVNode("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-width":"1.5"},[m.createElementVNode("path",{d:"M21 7v-.281c0-2.19 0-3.285-.707-3.884c-.707-.6-1.788-.42-3.95-.059l-1.055.176c-1.64.273-2.46.41-3.288.41s-1.648-.137-3.288-.41l-1.054-.176c-2.162-.36-3.243-.54-3.95.059S3 4.529 3 6.719V12c0 5.49 4.239 8.155 6.899 9.286c.721.307 1.082.46 2.101.46c1.02 0 1.38-.153 2.101-.46C16.761 20.155 21 17.49 21 12v-1"}),m.createElementVNode("path",{d:"M6.5 9c.291-.583 1.077-1 2-1s1.709.417 2 1m3 0c.291-.583 1.077-1 2-1s1.709.417 2 1m-9 5s1.05 1 3.5 1s3.5-1 3.5-1"})],-1)])],512)),[[m.vShow,n.comment.band==="privacy"]]),m.createElementVNode("div",pw,[m.createElementVNode("div",mw,[m.withDirectives(m.createElementVNode("span",{onClick:u,class:"sus-item__operate-delete"}," 删除 ",512),[[m.vShow,!n.comment.privacy&&n.comment.showDelete]]),m.withDirectives(m.createElementVNode("span",{onClick:d,class:"sus-item__operate-edit"}," 编辑 ",512),[[m.vShow,!n.comment.privacy&&n.comment.showEdit]]),m.withDirectives(m.createElementVNode("span",{onClick:c,class:"sus-item__operate-reply"}," 回复 ",512),[[m.vShow,!n.comment.privacy]])]),m.createElementVNode("div",gw,[m.createElementVNode("div",yw,[m.withDirectives(m.createElementVNode("img",{alt:"",class:"sus-avatar",src:n.comment.userAvatar,onerror:"this.onerror=null,this.src='/error.webp'"},null,8,bw),[[m.vShow,!!n.comment.userAvatar]]),m.withDirectives(m.createElementVNode("div",ww,[m.createElementVNode("span",null,m.toDisplayString(n.comment.userName.charAt(0)),1)],512),[[m.vShow,!n.comment.userAvatar]])]),m.createElementVNode("p",kw,m.toDisplayString(n.num),1)]),m.createElementVNode("div",xw,[m.createElementVNode("div",Sw,[m.createElementVNode("a",{target:"_blank",rel:h(),href:n.comment.userWebsite,class:m.normalizeClass([n.comment.tagName,"sus-item__user-name"])},m.toDisplayString(n.comment.userName),11,Cw),n.comment.tagName==="owner"?(m.openBlock(),m.createElementBlock("span",Ew," 博主 ")):m.createCommentVNode("",!0),n.comment.replyName?(m.openBlock(),m.createElementBlock("span",Mw,"@"+m.toDisplayString(n.comment.replyName),1)):m.createCommentVNode("",!0),m.createElementVNode("span",vw,m.toDisplayString(m.unref(uw)(n.comment.createdDate)),1)]),n.comment.privacy?(m.openBlock(),m.createElementBlock("div",Tw,[g[1]||(g[1]=m.createElementVNode("div",{class:"sus-item-privacy"},null,-1)),m.createElementVNode("span",{class:"sus-item-privacy-text",innerHTML:n.comment.content},null,8,Ow)])):(m.openBlock(),m.createElementBlock("div",Nw,[m.createElementVNode("span",{ref_key:"contentDom",ref:r,class:"sus-item__content-text",innerHTML:n.comment.content+(n.comment.contentExtends||"")},null,8,Aw),s.value?(m.openBlock(),m.createElementBlock("a",{key:0,ref_key:"showMoreDom",ref:i,class:"sus-show-detail",onClick:l},"显示更多>",512)):m.createCommentVNode("",!0)]))])]),n.showFooter&&n.comment.area&&!n.comment.privacy?(m.openBlock(),m.createElementBlock("div",Dw,[m.createElementVNode("span",Rw,[g[2]||(g[2]=m.createElementVNode("svg",{class:"sus-svg",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},[m.createElementVNode("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-width":"1.5"},[m.createElementVNode("path",{d:"M12.5 7.041A3 3 0 1 0 14.959 9.5"}),m.createElementVNode("path",{d:"M5 15.216c-.647-1.654-1-3.415-1-5.073C4 5.646 7.582 2 12 2s8 3.646 8 8.143c0 4.462-2.553 9.67-6.537 11.531a3.45 3.45 0 0 1-2.926 0C9.265 21.08 8.138 20.144 7.194 19"})])],-1)),m.createTextVNode(" "+m.toDisplayString(n.comment.area),1)]),m.createElementVNode("span",Iw,[g[3]||(g[3]=m.createElementVNode("svg",{class:"sus-svg",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},[m.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-width":"1.5",d:"M5 2.252c-.774.169-1.359.45-1.828.92C2 4.343 2 6.229 2 10v1c0 2.828 0 4.243.879 5.121C3.757 17 5.172 17 8 17h8c2.828 0 4.243 0 5.121-.879C22 15.243 22 13.828 22 11v-1c0-3.771 0-5.657-1.172-6.828S17.771 2 14 2H9m7 20H8m4-5v5m10-9h-6M2 13h10"})],-1)),m.createTextVNode(" "+m.toDisplayString(n.comment.userAgent),1)])])):m.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-ddb1717b"]]),Pw={class:"sus-comment__item"},Lw={key:0,class:"sus-comment__item-child"},Bw={key:1},_w={key:0,class:"sus-comment__item-footer"},hf=Yt(m.defineComponent({__name:"index",props:{comment:{},lineHeight:{default:23},showFooter:{type:Boolean,default:!1}},emits:["on-reply","on-edit","on-remove"],setup(n,{emit:e}){const t=m.ref(!1),r=e;function i(l){r("on-reply",l)}function s(l){r("on-edit",l)}function o(l){r("on-remove",l)}return(l,a)=>(m.openBlock(),m.createElementBlock("div",Pw,[m.createVNode(ss,{comment:n.comment,onOnReply:a[0]||(a[0]=c=>i(n.comment)),onOnEdit:a[1]||(a[1]=c=>s(n.comment)),onOnRemove:a[2]||(a[2]=c=>o(n.comment)),lineHeight:n.lineHeight,showFooter:n.showFooter},null,8,["comment","lineHeight","showFooter"]),n.comment.child?.length>0?(m.openBlock(),m.createElementBlock("div",Lw,[m.createVNode(ss,{onOnReply:a[3]||(a[3]=c=>i(n.comment.child[0])),onOnEdit:a[4]||(a[4]=c=>s(n.comment.child[0])),onOnRemove:a[5]||(a[5]=c=>o(n.comment.child[0])),comment:n.comment.child[0],num:2,showFooter:n.showFooter,lineHeight:n.lineHeight,class:"sus-comment__item-child__item"},null,8,["comment","showFooter","lineHeight"]),n.comment.child?.length>1?(m.openBlock(),m.createBlock(ss,{key:0,onOnReply:a[6]||(a[6]=c=>i(n.comment.child[1])),onOnEdit:a[7]||(a[7]=c=>s(n.comment.child[1])),onOnRemove:a[8]||(a[8]=c=>o(n.comment.child[1])),comment:n.comment.child[1],num:3,showFooter:n.showFooter,lineHeight:n.lineHeight,class:"sus-comment__item-child__item"},null,8,["comment","showFooter","lineHeight"])):m.createCommentVNode("",!0),n.comment.child?.length>2?(m.openBlock(),m.createElementBlock("div",Bw,[t.value?m.createCommentVNode("",!0):(m.openBlock(),m.createElementBlock("div",_w,[m.createElementVNode("p",{class:"sus-load-more",onClick:a[9]||(a[9]=c=>t.value=!0)}," 查看更多回复 > ")])),t.value?(m.openBlock(!0),m.createElementBlock(m.Fragment,{key:1},m.renderList(n.comment.child.slice(2),(c,d)=>(m.openBlock(),m.createBlock(ss,{onOnReply:u=>i(c),onOnEdit:u=>s(c),onOnRemove:u=>o(c),key:d,comment:c,num:4+d,showFooter:n.showFooter,lineHeight:n.lineHeight,class:"sus-comment__item-child__item"},null,8,["onOnReply","onOnEdit","onOnRemove","comment","num","showFooter","lineHeight"]))),128)):m.createCommentVNode("",!0)])):m.createCommentVNode("",!0)])):m.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-170ec605"]]),Vw={class:"sus-top-item"},$w={class:"sus-top-item__info"},zw={class:"sus-top-item__user"},Hw={key:0,class:"sus-top-item__reply"},Fw=["innerHTML"],pf=Yt(m.defineComponent({__name:"simple",props:{comment:{}},setup(n){return(e,t)=>(m.openBlock(),m.createElementBlock("div",Vw,[m.createElementVNode("div",$w,[m.createElementVNode("span",zw,m.toDisplayString(n.comment.userName)+": ",1),n.comment.replyName?(m.openBlock(),m.createElementBlock("span",Hw,m.toDisplayString("@"+n.comment.replyName),1)):m.createCommentVNode("",!0)]),m.createElementVNode("span",{class:"sus-top-item__content",innerHTML:n.comment.content},null,8,Fw)]))}}),[["__scopeId","data-v-f6f1f9aa"]]),jw={class:"sus-top-item__user"},Uw={key:0,class:"sus-top-item__user-avatar"},Ww=["src"],Kw={class:"sus-top-item__user-owner"},qw={class:"sus-top-item__user-reply"},Jw=["innerHTML"],mf=Yt(m.defineComponent({__name:"index",props:{comment:{}},emits:["go-local"],setup(n,{emit:e}){const t=e;function r(){t("go-local")}return(i,s)=>(m.openBlock(),m.createElementBlock("div",{class:"sus-top-item",onClick:r},[m.createElementVNode("div",jw,[n.comment.userAvatar?(m.openBlock(),m.createElementBlock("div",Uw,[m.createElementVNode("img",{alt:"",class:"sus-avatar",loading:"lazy",decoding:"async",src:n.comment.userAvatar,onerror:"this.onerror=null,this.src='/error.webp'"},null,8,Ww)])):m.createCommentVNode("",!0),m.createElementVNode("div",Kw,m.toDisplayString(n.comment.userName),1),m.createElementVNode("div",qw,m.toDisplayString(n.comment.replyName?"@"+n.comment.replyName:""),1)]),m.createElementVNode("div",{class:"sus-top-item__content",innerHTML:n.comment.content},null,8,Jw)]))}}),[["__scopeId","data-v-250e2f2a"]]),Gw=[ff,hf,mf,pf],Yw={install(n){Gw.forEach(e=>{n.component(e.name,e)})}};je.SuSComment=ff,je.SuSList=hf,je.SuSSimpleTop=pf,je.SuSTop=mf,je.default=Yw,Object.defineProperties(je,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
104
+ 3. "-" cannot repeat`);oe.customSchemes.push([n,e])}function E0(){oe.scanner=g0(oe.customSchemes);for(let n=0;n<oe.tokenQueue.length;n++)oe.tokenQueue[n][1]({scanner:oe.scanner});oe.parser=w0(oe.scanner.tokens);for(let n=0;n<oe.pluginQueue.length;n++)oe.pluginQueue[n][1]({scanner:oe.scanner,parser:oe.parser});return oe.initialized=!0,oe}function qo(n){return oe.initialized||E0(),k0(oe.parser.start,n,Fd(oe.scanner.start,n))}qo.scan=Fd;function Gd(n,e=null,t=null){if(e&&typeof e=="object"){if(t)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);t=e,e=null}const r=new Wo(t),i=qo(n),s=[];for(let o=0;o<i.length;o++){const l=i[o];l.isLink&&(!e||l.t===e)&&r.check(l)&&s.push(l.toFormattedObject(r))}return s}var Jo="[\0-   ᠎ -\u2029  ]",M0=new RegExp(Jo),v0=new RegExp(`${Jo}$`),T0=new RegExp(Jo,"g");function O0(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}function N0(n){return new se({key:new le("autolink"),appendTransaction:(e,t,r)=>{const i=e.some(c=>c.docChanged)&&!t.doc.eq(r.doc),s=e.some(c=>c.getMeta("preventAutolink"));if(!i||s)return;const{tr:o}=r,l=Yc(t.doc,[...e]);if(ld(l).forEach(({newRange:c})=>{const d=jm(r.doc,c,h=>h.isTextblock);let u,f;if(d.length>1)u=d[0],f=r.doc.textBetween(u.pos,u.pos+u.node.nodeSize,void 0," ");else if(d.length){const h=r.doc.textBetween(c.from,c.to," "," ");if(!v0.test(h))return;u=d[0],f=r.doc.textBetween(u.pos,c.to,void 0," ")}if(u&&f){const h=f.split(M0).filter(Boolean);if(h.length<=0)return!1;const p=h[h.length-1],g=u.pos+f.lastIndexOf(p);if(!p)return!1;const y=qo(p).map(w=>w.toObject(n.defaultProtocol));if(!O0(y))return!1;y.filter(w=>w.isLink).map(w=>({...w,from:g+w.start+1,to:g+w.end+1})).filter(w=>r.schema.marks.code?!r.doc.rangeHasMark(w.from,w.to,r.schema.marks.code):!0).filter(w=>n.validate(w.value)).filter(w=>n.shouldAutoLink(w.value)).forEach(w=>{yo(w.from,w.to,r.doc).some(k=>k.mark.type===n.type)||o.addMark(w.from,w.to,n.type.create({href:w.href}))})}}),!!o.steps.length)return o}})}function A0(n){return new se({key:new le("handleClickLink"),props:{handleClick:(e,t,r)=>{var i,s;if(r.button!==0||!e.editable)return!1;let o=null;if(r.target instanceof HTMLAnchorElement)o=r.target;else{let d=r.target;const u=[];for(;d.nodeName!=="DIV";)u.push(d),d=d.parentNode;o=u.find(f=>f.nodeName==="A")}if(!o)return!1;const l=od(e.state,n.type.name),a=(i=o?.href)!=null?i:l.href,c=(s=o?.target)!=null?s:l.target;return n.enableClickSelection&&n.editor.commands.extendMarkRange(n.type.name),o&&a?(window.open(a,c),!0):!1}}})}function D0(n){return new se({key:new le("handlePasteLink"),props:{handlePaste:(e,t,r)=>{const{state:i}=e,{selection:s}=i,{empty:o}=s;if(o)return!1;let l="";r.content.forEach(c=>{l+=c.textContent});const a=Gd(l,{defaultProtocol:n.defaultProtocol}).find(c=>c.isLink&&c.value===l);return!l||!a?!1:n.editor.commands.setMark(n.type,{href:a.href})}}})}function kn(n,e){const t=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const i=typeof r=="string"?r:r.scheme;i&&t.push(i)}),!n||n.replace(T0,"").match(new RegExp(`^(?:(?:${t.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var Yd=yn.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(n=>{if(typeof n=="string"){Jd(n);return}Jd(n.scheme,n.optionalSlashes)})},onDestroy(){C0()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(n,e)=>!!kn(n,e.protocols),validate:n=>!!n,shouldAutoLink:n=>!!n}},addAttributes(){return{href:{default:null,parseHTML(n){return n.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:n=>{const e=n.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:t=>!!kn(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:n}){return this.options.isAllowedUri(n.href,{defaultValidate:e=>!!kn(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",ce(this.options.HTMLAttributes,n),0]:["a",ce(this.options.HTMLAttributes,{...n,href:""}),0]},addCommands(){return{setLink:n=>({chain:e})=>{const{href:t}=n;return this.options.isAllowedUri(t,{defaultValidate:r=>!!kn(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,n).setMeta("preventAutolink",!0).run():!1},toggleLink:n=>({chain:e})=>{const{href:t}=n||{};return t&&!this.options.isAllowedUri(t,{defaultValidate:r=>!!kn(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,n,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[bn({find:n=>{const e=[];if(n){const{protocols:t,defaultProtocol:r}=this.options,i=Gd(n).filter(s=>s.isLink&&this.options.isAllowedUri(s.value,{defaultValidate:o=>!!kn(o,t),protocols:t,defaultProtocol:r}));i.length&&i.forEach(s=>e.push({text:s.value,data:{href:s.href},index:s.start}))}return e},type:this.type,getAttributes:n=>{var e;return{href:(e=n.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const n=[],{protocols:e,defaultProtocol:t}=this.options;return this.options.autolink&&n.push(N0({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!kn(i,e),protocols:e,defaultProtocol:t}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&n.push(A0({type:this.type,editor:this.editor,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&n.push(D0({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),n}}),R0=Yd,I0=Object.defineProperty,P0=(n,e)=>{for(var t in e)I0(n,t,{get:e[t],enumerable:!0})},L0="listItem",Xd="textStyle",Qd=/^\s*([-+*])\s$/,Zd=$e.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:n}){return["ul",ce(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleBulletList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(L0,this.editor.getAttributes(Xd)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let n=_n({find:Qd,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=_n({find:Qd,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Xd),editor:this.editor})),[n]}}),eu=$e.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",ce(this.options.HTMLAttributes,n),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),B0={};P0(B0,{findListItemPos:()=>Er,getNextListDepth:()=>Go,handleBackspace:()=>Yo,handleDelete:()=>Xo,hasListBefore:()=>tu,hasListItemAfter:()=>_0,hasListItemBefore:()=>nu,listItemHasSubList:()=>ru,nextListIsDeeper:()=>iu,nextListIsHigher:()=>su});var Er=(n,e)=>{const{$from:t}=e.selection,r=be(n,e.schema);let i=null,s=t.depth,o=t.pos,l=null;for(;s>0&&l===null;)i=t.node(s),i.type===r?l=s:(s-=1,o-=1);return l===null?null:{$pos:e.doc.resolve(o),depth:l}},Go=(n,e)=>{const t=Er(n,e);if(!t)return!1;const[,r]=Qm(e,n,t.$pos.pos+4);return r},tu=(n,e,t)=>{const{$anchor:r}=n.selection,i=Math.max(0,r.pos-2),s=n.doc.resolve(i).node();return!(!s||!t.includes(s.type.name))},nu=(n,e)=>{var t;const{$anchor:r}=e.selection,i=e.doc.resolve(r.pos-2);return!(i.index()===0||((t=i.nodeBefore)==null?void 0:t.type.name)!==n)},ru=(n,e,t)=>{if(!t)return!1;const r=be(n,e.schema);let i=!1;return t.descendants(s=>{s.type===r&&(i=!0)}),i},Yo=(n,e,t)=>{if(n.commands.undoInputRule())return!0;if(n.state.selection.from!==n.state.selection.to)return!1;if(!Gt(n.state,e)&&tu(n.state,e,t)){const{$anchor:l}=n.state.selection,a=n.state.doc.resolve(l.before()-1),c=[];a.node().descendants((f,h)=>{f.type.name===e&&c.push({node:f,pos:h})});const d=c.at(-1);if(!d)return!1;const u=n.state.doc.resolve(a.start()+d.pos+1);return n.chain().cut({from:l.start()-1,to:l.end()+1},u.end()).joinForward().run()}if(!Gt(n.state,e)||!ng(n.state))return!1;const r=Er(e,n.state);if(!r)return!1;const s=n.state.doc.resolve(r.$pos.pos-2).node(r.depth),o=ru(e,n.state,s);return nu(e,n.state)&&!o?n.commands.joinItemBackward():n.chain().liftListItem(e).run()},iu=(n,e)=>{const t=Go(n,e),r=Er(n,e);return!r||!t?!1:t>r.depth},su=(n,e)=>{const t=Go(n,e),r=Er(n,e);return!r||!t?!1:t<r.depth},Xo=(n,e)=>{if(!Gt(n.state,e)||!tg(n.state,e))return!1;const{selection:t}=n.state,{$from:r,$to:i}=t;return!t.empty&&r.sameParent(i)?!1:iu(e,n.state)?n.chain().focus(n.state.selection.from+4).lift(e).joinBackward().run():su(e,n.state)?n.chain().joinForward().joinBackward().run():n.commands.joinItemForward()},_0=(n,e)=>{var t;const{$anchor:r}=e.selection,i=e.doc.resolve(r.pos-r.parentOffset-2);return!(i.index()===i.parent.childCount-1||((t=i.nodeAfter)==null?void 0:t.type.name)!==n)},ou=de.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&Xo(n,t)&&(e=!0)}),e},"Mod-Delete":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&Xo(n,t)&&(e=!0)}),e},Backspace:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:r})=>{n.state.schema.nodes[t]!==void 0&&Yo(n,t,r)&&(e=!0)}),e},"Mod-Backspace":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:r})=>{n.state.schema.nodes[t]!==void 0&&Yo(n,t,r)&&(e=!0)}),e}}}}),V0="listItem",lu="textStyle",au=/^(\d+)\.\s$/,cu=$e.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:n=>n.hasAttribute("start")?parseInt(n.getAttribute("start")||"",10):1},type:{default:null,parseHTML:n=>n.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:n}){const{start:e,...t}=n;return e===1?["ol",ce(this.options.HTMLAttributes,t),0]:["ol",ce(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleOrderedList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(V0,this.editor.getAttributes(lu)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let n=_n({find:au,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(n=_n({find:au,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(lu)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[n]}}),$0=/^\s*(\[([( |x])?\])\s$/,z0=$e.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:n=>{const e=n.getAttribute("data-checked");return e===""||e==="true"},renderHTML:n=>({"data-checked":n.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:n,HTMLAttributes:e}){return["li",ce(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:n.attrs.checked?"checked":null}],["span"]],["div",0]]},addKeyboardShortcuts(){const n={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...n,Tab:()=>this.editor.commands.sinkListItem(this.name)}:n},addNodeView(){return({node:n,HTMLAttributes:e,getPos:t,editor:r})=>{const i=document.createElement("li"),s=document.createElement("label"),o=document.createElement("span"),l=document.createElement("input"),a=document.createElement("div"),c=d=>{var u,f;l.ariaLabel=((f=(u=this.options.a11y)==null?void 0:u.checkboxLabel)==null?void 0:f.call(u,d,l.checked))||`Task item checkbox for ${d.textContent||"empty task item"}`};return c(n),s.contentEditable="false",l.type="checkbox",l.addEventListener("mousedown",d=>d.preventDefault()),l.addEventListener("change",d=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){l.checked=!l.checked;return}const{checked:u}=d.target;r.isEditable&&typeof t=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:f})=>{const h=t();if(typeof h!="number")return!1;const p=f.doc.nodeAt(h);return f.setNodeMarkup(h,void 0,{...p?.attrs,checked:u}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(n,u)||(l.checked=!l.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([d,u])=>{i.setAttribute(d,u)}),i.dataset.checked=n.attrs.checked,l.checked=n.attrs.checked,s.append(l,o),i.append(s,a),Object.entries(e).forEach(([d,u])=>{i.setAttribute(d,u)}),{dom:i,contentDOM:a,update:d=>d.type!==this.type?!1:(i.dataset.checked=d.attrs.checked,l.checked=d.attrs.checked,c(d),!0)}}},addInputRules(){return[_n({find:$0,type:this.type,getAttributes:n=>({checked:n[n.length-1]==="x"})})]}}),H0=$e.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:n}){return["ul",ce(this.options.HTMLAttributes,n,{"data-type":this.name}),0]},addCommands(){return{toggleTaskList:()=>({commands:n})=>n.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});de.create({name:"listKit",addExtensions(){const n=[];return this.options.bulletList!==!1&&n.push(Zd.configure(this.options.bulletList)),this.options.listItem!==!1&&n.push(eu.configure(this.options.listItem)),this.options.listKeymap!==!1&&n.push(ou.configure(this.options.listKeymap)),this.options.orderedList!==!1&&n.push(cu.configure(this.options.orderedList)),this.options.taskItem!==!1&&n.push(z0.configure(this.options.taskItem)),this.options.taskList!==!1&&n.push(H0.configure(this.options.taskList)),n}});var F0=$e.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",ce(this.options.HTMLAttributes,n),0]},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),j0=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,U0=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,W0=yn.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["s",ce(this.options.HTMLAttributes,n),0]},addCommands(){return{setStrike:()=>({commands:n})=>n.setMark(this.name),toggleStrike:()=>({commands:n})=>n.toggleMark(this.name),unsetStrike:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Bn({find:j0,type:this.type})]},addPasteRules(){return[bn({find:U0,type:this.type})]}}),K0=$e.create({name:"text",group:"inline"}),q0=yn.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["u",ce(this.options.HTMLAttributes,n),0]},addCommands(){return{setUnderline:()=>({commands:n})=>n.setMark(this.name),toggleUnderline:()=>({commands:n})=>n.toggleMark(this.name),unsetUnderline:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function J0(n={}){return new se({view(e){return new G0(e,n)}})}class G0{constructor(e,t){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=t.width)!==null&&r!==void 0?r:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let s=o=>{this[i](o)};return e.dom.addEventListener(i,s),{name:i,handler:s}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,r,i=this.editorView.dom,s=i.getBoundingClientRect(),o=s.width/i.offsetWidth,l=s.height/i.offsetHeight;if(t){let u=e.nodeBefore,f=e.nodeAfter;if(u||f){let h=this.editorView.nodeDOM(this.cursorPos-(u?u.nodeSize:0));if(h){let p=h.getBoundingClientRect(),g=u?p.bottom:p.top;u&&f&&(g=(g+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let y=this.width/2*l;r={left:p.left,right:p.right,top:g-y,bottom:g+y}}}}if(!r){let u=this.editorView.coordsAtPos(this.cursorPos),f=this.width/2*o;r={left:u.left-f,right:u.left+f,top:u.top,bottom:u.bottom}}let a=this.editorView.dom.offsetParent;this.element||(this.element=a.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let c,d;if(!a||a==document.body&&getComputedStyle(a).position=="static")c=-pageXOffset,d=-pageYOffset;else{let u=a.getBoundingClientRect(),f=u.width/a.offsetWidth,h=u.height/a.offsetHeight;c=u.left-a.scrollLeft*f,d=u.top-a.scrollTop*h}this.element.style.left=(r.left-c)/o+"px",this.element.style.top=(r.top-d)/l+"px",this.element.style.width=(r.right-r.left)/o+"px",this.element.style.height=(r.bottom-r.top)/l+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),i=r&&r.type.spec.disableDropCursor,s=typeof i=="function"?i(this.editorView,t,e):i;if(t&&!s){let o=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=aa(this.editorView.state.doc,o,this.editorView.dragging.slice);l!=null&&(o=l)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class fe extends H{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return fe.valid(r)?new fe(r):H.near(r)}content(){return N.empty}eq(e){return e instanceof fe&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new fe(e.resolve(t.pos))}getBookmark(){return new Qo(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!Y0(e)||!X0(e))return!1;let r=t.type.spec.allowGapCursor;if(r!=null)return r;let i=t.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,t,r=!1){e:for(;;){if(!r&&fe.valid(e))return e;let i=e.pos,s=null;for(let o=e.depth;;o--){let l=e.node(o);if(t>0?e.indexAfter(o)<l.childCount:e.index(o)>0){s=l.child(t>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;i+=t;let a=e.doc.resolve(i);if(fe.valid(a))return a}for(;;){let o=t>0?s.firstChild:s.lastChild;if(!o){if(s.isAtom&&!s.isText&&!B.isSelectable(s)){e=e.doc.resolve(i+s.nodeSize*t),r=!1;continue e}break}s=o,i+=t;let l=e.doc.resolve(i);if(fe.valid(l))return l}return null}}}fe.prototype.visible=!1,fe.findFrom=fe.findGapCursorFrom,H.jsonID("gapcursor",fe);class Qo{constructor(e){this.pos=e}map(e){return new Qo(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return fe.valid(t)?new fe(t):H.near(t)}}function Y0(n){for(let e=n.depth;e>=0;e--){let t=n.index(e),r=n.node(e);if(t==0){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(t-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||i.isAtom||i.type.spec.isolating)return!0;if(i.inlineContent)return!1}}return!0}function X0(n){for(let e=n.depth;e>=0;e--){let t=n.indexAfter(e),r=n.node(e);if(t==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(t);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||i.isAtom||i.type.spec.isolating)return!0;if(i.inlineContent)return!1}}return!0}function Q0(){return new se({props:{decorations:nb,createSelectionBetween(n,e,t){return e.pos==t.pos&&fe.valid(t)?new fe(t):null},handleClick:eb,handleKeyDown:Z0,handleDOMEvents:{beforeinput:tb}}})}const Z0=no({ArrowLeft:Wi("horiz",-1),ArrowRight:Wi("horiz",1),ArrowUp:Wi("vert",-1),ArrowDown:Wi("vert",1)});function Wi(n,e){const t=n=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,s){let o=r.selection,l=e>0?o.$to:o.$from,a=o.empty;if(o instanceof F){if(!s.endOfTextblock(t)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let c=fe.findGapCursorFrom(l,e,a);return c?(i&&i(r.tr.setSelection(new fe(c))),!0):!1}}function eb(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!fe.valid(r))return!1;let i=n.posAtCoords({left:t.clientX,top:t.clientY});return i&&i.inside>-1&&B.isSelectable(n.state.doc.nodeAt(i.inside))?!1:(n.dispatch(n.state.tr.setSelection(new fe(r))),!0)}function tb(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof fe))return!1;let{$from:t}=n.state.selection,r=t.parent.contentMatchAt(t.index()).findWrapping(n.state.schema.nodes.text);if(!r)return!1;let i=S.empty;for(let o=r.length-1;o>=0;o--)i=S.from(r[o].createAndFill(null,i));let s=n.state.tr.replace(t.pos,t.pos,new N(i,0,0));return s.setSelection(F.near(s.doc.resolve(t.pos+1))),n.dispatch(s),!1}function nb(n){if(!(n.selection instanceof fe))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",ae.create(n.doc,[Ie.widget(n.selection.head,e,{key:"gapcursor"})])}var Ki=200,Ee=function(){};Ee.prototype.append=function(e){return e.length?(e=Ee.from(e),!this.length&&e||e.length<Ki&&this.leafAppend(e)||this.length<Ki&&e.leafPrepend(this)||this.appendInner(e)):this},Ee.prototype.prepend=function(e){return e.length?Ee.from(e).append(this):this},Ee.prototype.appendInner=function(e){return new rb(this,e)},Ee.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?Ee.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},Ee.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},Ee.prototype.forEach=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length),t<=r?this.forEachInner(e,t,r,0):this.forEachInvertedInner(e,t,r,0)},Ee.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(s,o){return i.push(e(s,o))},t,r),i},Ee.from=function(e){return e instanceof Ee?e:e&&e.length?new du(e):Ee.empty};var du=(function(n){function e(r){n.call(this),this.values=r}n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,s){return i==0&&s==this.length?this:new e(this.values.slice(i,s))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,s,o,l){for(var a=s;a<o;a++)if(i(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(i,s,o,l){for(var a=s-1;a>=o;a--)if(i(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Ki)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Ki)return new e(i.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e})(Ee);Ee.empty=new du([]);var rb=(function(n){function e(t,r){n.call(this),this.left=t,this.right=r,this.length=t.length+r.length,this.depth=Math.max(t.depth,r.depth)+1}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,i,s,o){var l=this.left.length;if(i<l&&this.left.forEachInner(r,i,Math.min(s,l),o)===!1||s>l&&this.right.forEachInner(r,Math.max(i-l,0),Math.min(this.length,s)-l,o+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,s,o){var l=this.left.length;if(i>l&&this.right.forEachInvertedInner(r,i-l,Math.max(s,l)-l,o+l)===!1||s<l&&this.left.forEachInvertedInner(r,Math.min(i,l),s,o)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var s=this.left.length;return i<=s?this.left.slice(r,i):r>=s?this.right.slice(r-s,i-s):this.left.slice(r,s).append(this.right.slice(0,i-s))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(Ee);const ib=500;class nt{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,s;t&&(i=this.remapping(r,this.items.length),s=i.maps.length);let o=e.tr,l,a,c=[],d=[];return this.items.forEach((u,f)=>{if(!u.step){i||(i=this.remapping(r,f+1),s=i.maps.length),s--,d.push(u);return}if(i){d.push(new ut(u.map));let h=u.step.map(i.slice(s)),p;h&&o.maybeStep(h).doc&&(p=o.mapping.maps[o.mapping.maps.length-1],c.push(new ut(p,void 0,void 0,c.length+d.length))),s--,p&&i.appendMap(p,s)}else o.maybeStep(u.step);if(u.selection)return l=i?u.selection.map(i.slice(s)):u.selection,a=new nt(this.items.slice(0,r).append(d.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:o,selection:l}}addTransform(e,t,r,i){let s=[],o=this.eventCount,l=this.items,a=!i&&l.length?l.get(l.length-1):null;for(let d=0;d<e.steps.length;d++){let u=e.steps[d].invert(e.docs[d]),f=new ut(e.mapping.maps[d],u,t),h;(h=a&&a.merge(f))&&(f=h,d?s.pop():l=l.slice(0,l.length-1)),s.push(f),t&&(o++,t=void 0),i||(a=f)}let c=o-r.depth;return c>ob&&(l=sb(l,c),o-=c),new nt(l.append(s),o)}remapping(e,t){let r=new Qn;return this.items.forEach((i,s)=>{let o=i.mirrorOffset!=null&&s-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,o)},e,t),r}addMaps(e){return this.eventCount==0?this:new nt(this.items.append(e.map(t=>new ut(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-t),s=e.mapping,o=e.steps.length,l=this.eventCount;this.items.forEach(f=>{f.selection&&l--},i);let a=t;this.items.forEach(f=>{let h=s.getMirror(--a);if(h==null)return;o=Math.min(o,h);let p=s.maps[h];if(f.step){let g=e.steps[h].invert(e.docs[h]),y=f.selection&&f.selection.map(s.slice(a+1,h));y&&l++,r.push(new ut(p,g,y))}else r.push(new ut(p))},i);let c=[];for(let f=t;f<o;f++)c.push(new ut(s.maps[f]));let d=this.items.slice(0,i).append(c).append(r),u=new nt(d,l);return u.emptyItemCount()>ib&&(u=u.compress(this.items.length-r.length)),u}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),r=t.maps.length,i=[],s=0;return this.items.forEach((o,l)=>{if(l>=e)i.push(o),o.selection&&s++;else if(o.step){let a=o.step.map(t.slice(r)),c=a&&a.getMap();if(r--,c&&t.appendMap(c,r),a){let d=o.selection&&o.selection.map(t.slice(r));d&&s++;let u=new ut(c.invert(),a,d),f,h=i.length-1;(f=i.length&&i[h].merge(u))?i[h]=f:i.push(u)}}else o.map&&r--},this.items.length,0),new nt(Ee.from(i.reverse()),s)}}nt.empty=new nt(Ee.empty,0);function sb(n,e){let t;return n.forEach((r,i)=>{if(r.selection&&e--==0)return t=i,!1}),n.slice(t)}class ut{constructor(e,t,r,i){this.map=e,this.step=t,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new ut(t.getMap().invert(),t,this.selection)}}}class en{constructor(e,t,r,i,s){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=i,this.prevComposition=s}}const ob=20;function lb(n,e,t,r){let i=t.getMeta(xn),s;if(i)return i.historyState;t.getMeta(db)&&(n=new en(n.done,n.undone,null,0,-1));let o=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(o&&o.getMeta(xn))return o.getMeta(xn).redo?new en(n.done.addTransform(t,void 0,r,qi(e)),n.undone,uu(t.mapping.maps),n.prevTime,n.prevComposition):new en(n.done,n.undone.addTransform(t,void 0,r,qi(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let l=t.getMeta("composition"),a=n.prevTime==0||!o&&n.prevComposition!=l&&(n.prevTime<(t.time||0)-r.newGroupDelay||!ab(t,n.prevRanges)),c=o?Zo(n.prevRanges,t.mapping):uu(t.mapping.maps);return new en(n.done.addTransform(t,a?e.selection.getBookmark():void 0,r,qi(e)),nt.empty,c,t.time,l??n.prevComposition)}else return(s=t.getMeta("rebased"))?new en(n.done.rebased(t,s),n.undone.rebased(t,s),Zo(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new en(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),Zo(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function ab(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,i)=>{for(let s=0;s<e.length;s+=2)r<=e[s+1]&&i>=e[s]&&(t=!0)}),t}function uu(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((r,i,s,o)=>e.push(s,o));return e}function Zo(n,e){if(!n)return null;let t=[];for(let r=0;r<n.length;r+=2){let i=e.map(n[r],1),s=e.map(n[r+1],-1);i<=s&&t.push(i,s)}return t}function cb(n,e,t){let r=qi(e),i=xn.get(e).spec.config,s=(t?n.undone:n.done).popEvent(e,r);if(!s)return null;let o=s.selection.resolve(s.transform.doc),l=(t?n.done:n.undone).addTransform(s.transform,e.selection.getBookmark(),i,r),a=new en(t?l:s.remaining,t?s.remaining:l,null,0,-1);return s.transform.setSelection(o).setMeta(xn,{redo:t,historyState:a})}let el=!1,fu=null;function qi(n){let e=n.plugins;if(fu!=e){el=!1,fu=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){el=!0;break}}return el}const xn=new le("history"),db=new le("closeHistory");function ub(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new se({key:xn,state:{init(){return new en(nt.empty,nt.empty,null,0,-1)},apply(e,t,r){return lb(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,i=r=="historyUndo"?pu:r=="historyRedo"?mu:null;return i?(t.preventDefault(),i(e.state,e.dispatch)):!1}}}})}function hu(n,e){return(t,r)=>{let i=xn.getState(t);if(!i||(n?i.undone:i.done).eventCount==0)return!1;if(r){let s=cb(i,t,n);s&&r(e?s.scrollIntoView():s)}return!0}}const pu=hu(!1,!0),mu=hu(!0,!0);de.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:n=>n.length,wordCounter:n=>n.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=n=>{const e=n?.node||this.editor.state.doc;if((n?.mode||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=n=>{const e=n?.node||this.editor.state.doc,t=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(t)}},addProseMirrorPlugins(){let n=!1;return[new se({key:new le("characterCount"),appendTransaction:(e,t,r)=>{if(n)return;const i=this.options.limit;if(i==null||i===0){n=!0;return}const s=this.storage.characters({node:r.doc});if(s>i){const o=s-i,l=0,a=o;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);const c=r.tr.deleteRange(l,a);return n=!0,c}n=!0},filterTransaction:(e,t)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const i=this.storage.characters({node:t.doc}),s=this.storage.characters({node:e.doc});if(s<=r||i>r&&s>r&&s<=i)return!0;if(i>r&&s>r&&s>i||!e.getMeta("paste"))return!1;const l=e.selection.$head.pos,a=s-r,c=l-a,d=l;return e.deleteRange(c,d),!(this.storage.characters({node:e.doc})>r)}})]}});var fb=de.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[J0(this.options)]}});de.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new se({key:new le("focus"),props:{decorations:({doc:n,selection:e})=>{const{isEditable:t,isFocused:r}=this.editor,{anchor:i}=e,s=[];if(!t||!r)return ae.create(n,[]);let o=0;this.options.mode==="deepest"&&n.descendants((a,c)=>{if(a.isText)return;if(!(i>=c&&i<=c+a.nodeSize-1))return!1;o+=1});let l=0;return n.descendants((a,c)=>{if(a.isText||!(i>=c&&i<=c+a.nodeSize-1))return!1;if(l+=1,this.options.mode==="deepest"&&o-l>0||this.options.mode==="shallowest"&&l>1)return this.options.mode==="deepest";s.push(Ie.node(c,c+a.nodeSize,{class:this.options.className}))}),ae.create(n,s)}}})]}});var hb=de.create({name:"gapCursor",addProseMirrorPlugins(){return[Q0()]},extendNodeSchema(n){var e;const t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=ee($(n,"allowGapCursor",t)))!=null?e:null}}}),pb=de.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new se({key:new le("placeholder"),props:{decorations:({doc:n,selection:e})=>{const t=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=e,i=[];if(!t)return null;const s=this.editor.isEmpty;return n.descendants((o,l)=>{const a=r>=l&&r<=l+o.nodeSize,c=!o.isLeaf&&si(o);if((a||!this.options.showOnlyCurrent)&&c){const d=[this.options.emptyNodeClass];s&&d.push(this.options.emptyEditorClass);const u=Ie.node(l,l+o.nodeSize,{class:d.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:o,pos:l,hasAnchor:a}):this.options.placeholder});i.push(u)}return this.options.includeChildren}),ae.create(n,i)}}})]}});de.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:n,options:e}=this;return[new se({key:new le("selection"),props:{decorations(t){return t.selection.empty||n.isFocused||!n.isEditable||fd(t.selection)||n.view.dragging?null:ae.create(t.doc,[Ie.inline(t.selection.from,t.selection.to,{class:e.className})])}}})]}});function gu({types:n,node:e}){return e&&Array.isArray(n)&&n.includes(e.type)||e?.type===n}var mb=de.create({name:"trailingNode",addOptions(){return{node:"paragraph",notAfter:[]}},addProseMirrorPlugins(){const n=new le(this.name),e=Object.entries(this.editor.schema.nodes).map(([,t])=>t).filter(t=>(this.options.notAfter||[]).concat(this.options.node).includes(t.name));return[new se({key:n,appendTransaction:(t,r,i)=>{const{doc:s,tr:o,schema:l}=i,a=n.getState(i),c=s.content.size,d=l.nodes[this.options.node];if(a)return o.insert(c,d.create())},state:{init:(t,r)=>{const i=r.tr.doc.lastChild;return!gu({node:i,types:e})},apply:(t,r)=>{if(!t.docChanged)return r;const i=t.doc.lastChild;return!gu({node:i,types:e})}}})]}}),gb=de.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>pu(n,e),redo:()=>({state:n,dispatch:e})=>mu(n,e)}},addProseMirrorPlugins(){return[ub(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),yb=de.create({name:"starterKit",addExtensions(){var n,e,t,r;const i=[];return this.options.bold!==!1&&i.push(Ky.configure(this.options.bold)),this.options.blockquote!==!1&&i.push(Hy.configure(this.options.blockquote)),this.options.bulletList!==!1&&i.push(Zd.configure(this.options.bulletList)),this.options.code!==!1&&i.push(Gy.configure(this.options.code)),this.options.codeBlock!==!1&&i.push(Id.configure(this.options.codeBlock)),this.options.document!==!1&&i.push(Zy.configure(this.options.document)),this.options.dropcursor!==!1&&i.push(fb.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&i.push(hb.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&i.push(e0.configure(this.options.hardBreak)),this.options.heading!==!1&&i.push(t0.configure(this.options.heading)),this.options.undoRedo!==!1&&i.push(gb.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&i.push(n0.configure(this.options.horizontalRule)),this.options.italic!==!1&&i.push(l0.configure(this.options.italic)),this.options.listItem!==!1&&i.push(eu.configure(this.options.listItem)),this.options.listKeymap!==!1&&i.push(ou.configure((n=this.options)==null?void 0:n.listKeymap)),this.options.link!==!1&&i.push(Yd.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&i.push(cu.configure(this.options.orderedList)),this.options.paragraph!==!1&&i.push(F0.configure(this.options.paragraph)),this.options.strike!==!1&&i.push(W0.configure(this.options.strike)),this.options.text!==!1&&i.push(K0.configure(this.options.text)),this.options.underline!==!1&&i.push(q0.configure((t=this.options)==null?void 0:t.underline)),this.options.trailingNode!==!1&&i.push(mb.configure((r=this.options)==null?void 0:r.trailingNode)),i}}),bb=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,wb=$e.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{}}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:n}){return["img",ce(this.options.HTMLAttributes,n)]},addCommands(){return{setImage:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n})}},addInputRules(){return[Dd({find:bb,type:this.type,getAttributes:n=>{const[,,e,t,r]=n;return{src:t,alt:e,title:r}}})]}}),kb=wb;const yu=["top","right","bottom","left"],bu=["start","end"],wu=yu.reduce((n,e)=>n.concat(e,e+"-"+bu[0],e+"-"+bu[1]),[]),ft=Math.min,ze=Math.max,Ji=Math.round,ht=n=>({x:n,y:n}),xb={left:"right",right:"left",bottom:"top",top:"bottom"},Sb={start:"end",end:"start"};function tl(n,e,t){return ze(n,ft(e,t))}function At(n,e){return typeof n=="function"?n(e):n}function et(n){return n.split("-")[0]}function rt(n){return n.split("-")[1]}function ku(n){return n==="x"?"y":"x"}function nl(n){return n==="y"?"height":"width"}const Cb=new Set(["top","bottom"]);function pt(n){return Cb.has(et(n))?"y":"x"}function rl(n){return ku(pt(n))}function xu(n,e,t){t===void 0&&(t=!1);const r=rt(n),i=rl(n),s=nl(i);let o=i==="x"?r===(t?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=Yi(o)),[o,Yi(o)]}function Eb(n){const e=Yi(n);return[Gi(n),e,Gi(e)]}function Gi(n){return n.replace(/start|end/g,e=>Sb[e])}const Su=["left","right"],Cu=["right","left"],Mb=["top","bottom"],vb=["bottom","top"];function Tb(n,e,t){switch(n){case"top":case"bottom":return t?e?Cu:Su:e?Su:Cu;case"left":case"right":return e?Mb:vb;default:return[]}}function Ob(n,e,t,r){const i=rt(n);let s=Tb(et(n),t==="start",r);return i&&(s=s.map(o=>o+"-"+i),e&&(s=s.concat(s.map(Gi)))),s}function Yi(n){return n.replace(/left|right|bottom|top/g,e=>xb[e])}function Nb(n){return{top:0,right:0,bottom:0,left:0,...n}}function il(n){return typeof n!="number"?Nb(n):{top:n,right:n,bottom:n,left:n}}function $n(n){const{x:e,y:t,width:r,height:i}=n;return{width:r,height:i,top:t,left:e,right:e+r,bottom:t+i,x:e,y:t}}function Eu(n,e,t){let{reference:r,floating:i}=n;const s=pt(e),o=rl(e),l=nl(o),a=et(e),c=s==="y",d=r.x+r.width/2-i.width/2,u=r.y+r.height/2-i.height/2,f=r[l]/2-i[l]/2;let h;switch(a){case"top":h={x:d,y:r.y-i.height};break;case"bottom":h={x:d,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:u};break;case"left":h={x:r.x-i.width,y:u};break;default:h={x:r.x,y:r.y}}switch(rt(e)){case"start":h[o]-=f*(t&&c?-1:1);break;case"end":h[o]+=f*(t&&c?-1:1);break}return h}const Ab=async(n,e,t)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=t,l=s.filter(Boolean),a=await(o.isRTL==null?void 0:o.isRTL(e));let c=await o.getElementRects({reference:n,floating:e,strategy:i}),{x:d,y:u}=Eu(c,r,a),f=r,h={},p=0;for(let g=0;g<l.length;g++){const{name:y,fn:w}=l[g],{x:k,y:C,data:D,reset:M}=await w({x:d,y:u,initialPlacement:r,placement:f,strategy:i,middlewareData:h,rects:c,platform:o,elements:{reference:n,floating:e}});d=k??d,u=C??u,h={...h,[y]:{...h[y],...D}},M&&p<=50&&(p++,typeof M=="object"&&(M.placement&&(f=M.placement),M.rects&&(c=M.rects===!0?await o.getElementRects({reference:n,floating:e,strategy:i}):M.rects),{x:d,y:u}=Eu(c,f,a)),g=-1)}return{x:d,y:u,placement:f,strategy:i,middlewareData:h}};async function zn(n,e){var t;e===void 0&&(e={});const{x:r,y:i,platform:s,rects:o,elements:l,strategy:a}=n,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:f=!1,padding:h=0}=At(e,n),p=il(h),y=l[f?u==="floating"?"reference":"floating":u],w=$n(await s.getClippingRect({element:(t=await(s.isElement==null?void 0:s.isElement(y)))==null||t?y:y.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:c,rootBoundary:d,strategy:a})),k=u==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,C=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),D=await(s.isElement==null?void 0:s.isElement(C))?await(s.getScale==null?void 0:s.getScale(C))||{x:1,y:1}:{x:1,y:1},M=$n(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:k,offsetParent:C,strategy:a}):k);return{top:(w.top-M.top+p.top)/D.y,bottom:(M.bottom-w.bottom+p.bottom)/D.y,left:(w.left-M.left+p.left)/D.x,right:(M.right-w.right+p.right)/D.x}}const Db=n=>({name:"arrow",options:n,async fn(e){const{x:t,y:r,placement:i,rects:s,platform:o,elements:l,middlewareData:a}=e,{element:c,padding:d=0}=At(n,e)||{};if(c==null)return{};const u=il(d),f={x:t,y:r},h=rl(i),p=nl(h),g=await o.getDimensions(c),y=h==="y",w=y?"top":"left",k=y?"bottom":"right",C=y?"clientHeight":"clientWidth",D=s.reference[p]+s.reference[h]-f[h]-s.floating[p],M=f[h]-s.reference[h],P=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c));let T=P?P[C]:0;(!T||!await(o.isElement==null?void 0:o.isElement(P)))&&(T=l.floating[C]||s.floating[p]);const V=D/2-M/2,K=T/2-g[p]/2-1,j=ft(u[w],K),U=ft(u[k],K),R=j,X=T-g[p]-U,Z=T/2-g[p]/2+V,ke=tl(R,Z,X),he=!a.arrow&&rt(i)!=null&&Z!==ke&&s.reference[p]/2-(Z<R?j:U)-g[p]/2<0,pe=he?Z<R?Z-R:Z-X:0;return{[h]:f[h]+pe,data:{[h]:ke,centerOffset:Z-ke-pe,...he&&{alignmentOffset:pe}},reset:he}}});function Rb(n,e,t){return(n?[...t.filter(i=>rt(i)===n),...t.filter(i=>rt(i)!==n)]:t.filter(i=>et(i)===i)).filter(i=>n?rt(i)===n||(e?Gi(i)!==i:!1):!0)}const Ib=function(n){return n===void 0&&(n={}),{name:"autoPlacement",options:n,async fn(e){var t,r,i;const{rects:s,middlewareData:o,placement:l,platform:a,elements:c}=e,{crossAxis:d=!1,alignment:u,allowedPlacements:f=wu,autoAlignment:h=!0,...p}=At(n,e),g=u!==void 0||f===wu?Rb(u||null,h,f):f,y=await zn(e,p),w=((t=o.autoPlacement)==null?void 0:t.index)||0,k=g[w];if(k==null)return{};const C=xu(k,s,await(a.isRTL==null?void 0:a.isRTL(c.floating)));if(l!==k)return{reset:{placement:g[0]}};const D=[y[et(k)],y[C[0]],y[C[1]]],M=[...((r=o.autoPlacement)==null?void 0:r.overflows)||[],{placement:k,overflows:D}],P=g[w+1];if(P)return{data:{index:w+1,overflows:M},reset:{placement:P}};const T=M.map(j=>{const U=rt(j.placement);return[j.placement,U&&d?j.overflows.slice(0,2).reduce((R,X)=>R+X,0):j.overflows[0],j.overflows]}).sort((j,U)=>j[1]-U[1]),K=((i=T.filter(j=>j[2].slice(0,rt(j[0])?2:3).every(U=>U<=0))[0])==null?void 0:i[0])||T[0][0];return K!==l?{data:{index:w+1,overflows:M},reset:{placement:K}}:{}}}},Pb=function(n){return n===void 0&&(n={}),{name:"flip",options:n,async fn(e){var t,r;const{placement:i,middlewareData:s,rects:o,initialPlacement:l,platform:a,elements:c}=e,{mainAxis:d=!0,crossAxis:u=!0,fallbackPlacements:f,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:g=!0,...y}=At(n,e);if((t=s.arrow)!=null&&t.alignmentOffset)return{};const w=et(i),k=pt(l),C=et(l)===l,D=await(a.isRTL==null?void 0:a.isRTL(c.floating)),M=f||(C||!g?[Yi(l)]:Eb(l)),P=p!=="none";!f&&P&&M.push(...Ob(l,g,p,D));const T=[l,...M],V=await zn(e,y),K=[];let j=((r=s.flip)==null?void 0:r.overflows)||[];if(d&&K.push(V[w]),u){const Z=xu(i,o,D);K.push(V[Z[0]],V[Z[1]])}if(j=[...j,{placement:i,overflows:K}],!K.every(Z=>Z<=0)){var U,R;const Z=(((U=s.flip)==null?void 0:U.index)||0)+1,ke=T[Z];if(ke&&(!(u==="alignment"?k!==pt(ke):!1)||j.every(Me=>pt(Me.placement)===k?Me.overflows[0]>0:!0)))return{data:{index:Z,overflows:j},reset:{placement:ke}};let he=(R=j.filter(pe=>pe.overflows[0]<=0).sort((pe,Me)=>pe.overflows[1]-Me.overflows[1])[0])==null?void 0:R.placement;if(!he)switch(h){case"bestFit":{var X;const pe=(X=j.filter(Me=>{if(P){const yt=pt(Me.placement);return yt===k||yt==="y"}return!0}).map(Me=>[Me.placement,Me.overflows.filter(yt=>yt>0).reduce((yt,pl)=>yt+pl,0)]).sort((Me,yt)=>Me[1]-yt[1])[0])==null?void 0:X[0];pe&&(he=pe);break}case"initialPlacement":he=l;break}if(i!==he)return{reset:{placement:he}}}return{}}}};function Mu(n,e){return{top:n.top-e.height,right:n.right-e.width,bottom:n.bottom-e.height,left:n.left-e.width}}function vu(n){return yu.some(e=>n[e]>=0)}const Lb=function(n){return n===void 0&&(n={}),{name:"hide",options:n,async fn(e){const{rects:t}=e,{strategy:r="referenceHidden",...i}=At(n,e);switch(r){case"referenceHidden":{const s=await zn(e,{...i,elementContext:"reference"}),o=Mu(s,t.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:vu(o)}}}case"escaped":{const s=await zn(e,{...i,altBoundary:!0}),o=Mu(s,t.floating);return{data:{escapedOffsets:o,escaped:vu(o)}}}default:return{}}}}};function Tu(n){const e=ft(...n.map(s=>s.left)),t=ft(...n.map(s=>s.top)),r=ze(...n.map(s=>s.right)),i=ze(...n.map(s=>s.bottom));return{x:e,y:t,width:r-e,height:i-t}}function Bb(n){const e=n.slice().sort((i,s)=>i.y-s.y),t=[];let r=null;for(let i=0;i<e.length;i++){const s=e[i];!r||s.y-r.y>r.height/2?t.push([s]):t[t.length-1].push(s),r=s}return t.map(i=>$n(Tu(i)))}const _b=function(n){return n===void 0&&(n={}),{name:"inline",options:n,async fn(e){const{placement:t,elements:r,rects:i,platform:s,strategy:o}=e,{padding:l=2,x:a,y:c}=At(n,e),d=Array.from(await(s.getClientRects==null?void 0:s.getClientRects(r.reference))||[]),u=Bb(d),f=$n(Tu(d)),h=il(l);function p(){if(u.length===2&&u[0].left>u[1].right&&a!=null&&c!=null)return u.find(y=>a>y.left-h.left&&a<y.right+h.right&&c>y.top-h.top&&c<y.bottom+h.bottom)||f;if(u.length>=2){if(pt(t)==="y"){const j=u[0],U=u[u.length-1],R=et(t)==="top",X=j.top,Z=U.bottom,ke=R?j.left:U.left,he=R?j.right:U.right,pe=he-ke,Me=Z-X;return{top:X,bottom:Z,left:ke,right:he,width:pe,height:Me,x:ke,y:X}}const y=et(t)==="left",w=ze(...u.map(j=>j.right)),k=ft(...u.map(j=>j.left)),C=u.filter(j=>y?j.left===k:j.right===w),D=C[0].top,M=C[C.length-1].bottom,P=k,T=w,V=T-P,K=M-D;return{top:D,bottom:M,left:P,right:T,width:V,height:K,x:P,y:D}}return f}const g=await s.getElementRects({reference:{getBoundingClientRect:p},floating:r.floating,strategy:o});return i.reference.x!==g.reference.x||i.reference.y!==g.reference.y||i.reference.width!==g.reference.width||i.reference.height!==g.reference.height?{reset:{rects:g}}:{}}}},Vb=new Set(["left","top"]);async function $b(n,e){const{placement:t,platform:r,elements:i}=n,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=et(t),l=rt(t),a=pt(t)==="y",c=Vb.has(o)?-1:1,d=s&&a?-1:1,u=At(e,n);let{mainAxis:f,crossAxis:h,alignmentAxis:p}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return l&&typeof p=="number"&&(h=l==="end"?p*-1:p),a?{x:h*d,y:f*c}:{x:f*c,y:h*d}}const zb=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(e){var t,r;const{x:i,y:s,placement:o,middlewareData:l}=e,a=await $b(e,n);return o===((t=l.offset)==null?void 0:t.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:i+a.x,y:s+a.y,data:{...a,placement:o}}}}},Hb=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(e){const{x:t,y:r,placement:i}=e,{mainAxis:s=!0,crossAxis:o=!1,limiter:l={fn:y=>{let{x:w,y:k}=y;return{x:w,y:k}}},...a}=At(n,e),c={x:t,y:r},d=await zn(e,a),u=pt(et(i)),f=ku(u);let h=c[f],p=c[u];if(s){const y=f==="y"?"top":"left",w=f==="y"?"bottom":"right",k=h+d[y],C=h-d[w];h=tl(k,h,C)}if(o){const y=u==="y"?"top":"left",w=u==="y"?"bottom":"right",k=p+d[y],C=p-d[w];p=tl(k,p,C)}const g=l.fn({...e,[f]:h,[u]:p});return{...g,data:{x:g.x-t,y:g.y-r,enabled:{[f]:s,[u]:o}}}}}},Fb=function(n){return n===void 0&&(n={}),{name:"size",options:n,async fn(e){var t,r;const{placement:i,rects:s,platform:o,elements:l}=e,{apply:a=()=>{},...c}=At(n,e),d=await zn(e,c),u=et(i),f=rt(i),h=pt(i)==="y",{width:p,height:g}=s.floating;let y,w;u==="top"||u==="bottom"?(y=u,w=f===(await(o.isRTL==null?void 0:o.isRTL(l.floating))?"start":"end")?"left":"right"):(w=u,y=f==="end"?"top":"bottom");const k=g-d.top-d.bottom,C=p-d.left-d.right,D=ft(g-d[y],k),M=ft(p-d[w],C),P=!e.middlewareData.shift;let T=D,V=M;if((t=e.middlewareData.shift)!=null&&t.enabled.x&&(V=C),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(T=k),P&&!f){const j=ze(d.left,0),U=ze(d.right,0),R=ze(d.top,0),X=ze(d.bottom,0);h?V=p-2*(j!==0||U!==0?j+U:ze(d.left,d.right)):T=g-2*(R!==0||X!==0?R+X:ze(d.top,d.bottom))}await a({...e,availableWidth:V,availableHeight:T});const K=await o.getDimensions(l.floating);return p!==K.width||g!==K.height?{reset:{rects:!0}}:{}}}};function Xi(){return typeof window<"u"}function Hn(n){return Ou(n)?(n.nodeName||"").toLowerCase():"#document"}function Ke(n){var e;return(n==null||(e=n.ownerDocument)==null?void 0:e.defaultView)||window}function Dt(n){var e;return(e=(Ou(n)?n.ownerDocument:n.document)||window.document)==null?void 0:e.documentElement}function Ou(n){return Xi()?n instanceof Node||n instanceof Ke(n).Node:!1}function it(n){return Xi()?n instanceof Element||n instanceof Ke(n).Element:!1}function mt(n){return Xi()?n instanceof HTMLElement||n instanceof Ke(n).HTMLElement:!1}function Nu(n){return!Xi()||typeof ShadowRoot>"u"?!1:n instanceof ShadowRoot||n instanceof Ke(n).ShadowRoot}const jb=new Set(["inline","contents"]);function Mr(n){const{overflow:e,overflowX:t,overflowY:r,display:i}=st(n);return/auto|scroll|overlay|hidden|clip/.test(e+r+t)&&!jb.has(i)}const Ub=new Set(["table","td","th"]);function Wb(n){return Ub.has(Hn(n))}const Kb=[":popover-open",":modal"];function Qi(n){return Kb.some(e=>{try{return n.matches(e)}catch{return!1}})}const qb=["transform","translate","scale","rotate","perspective"],Jb=["transform","translate","scale","rotate","perspective","filter"],Gb=["paint","layout","strict","content"];function sl(n){const e=ol(),t=it(n)?st(n):n;return qb.some(r=>t[r]?t[r]!=="none":!1)||(t.containerType?t.containerType!=="normal":!1)||!e&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!e&&(t.filter?t.filter!=="none":!1)||Jb.some(r=>(t.willChange||"").includes(r))||Gb.some(r=>(t.contain||"").includes(r))}function Yb(n){let e=tn(n);for(;mt(e)&&!Fn(e);){if(sl(e))return e;if(Qi(e))return null;e=tn(e)}return null}function ol(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Xb=new Set(["html","body","#document"]);function Fn(n){return Xb.has(Hn(n))}function st(n){return Ke(n).getComputedStyle(n)}function Zi(n){return it(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.scrollX,scrollTop:n.scrollY}}function tn(n){if(Hn(n)==="html")return n;const e=n.assignedSlot||n.parentNode||Nu(n)&&n.host||Dt(n);return Nu(e)?e.host:e}function Au(n){const e=tn(n);return Fn(e)?n.ownerDocument?n.ownerDocument.body:n.body:mt(e)&&Mr(e)?e:Au(e)}function Du(n,e,t){var r;e===void 0&&(e=[]);const i=Au(n),s=i===((r=n.ownerDocument)==null?void 0:r.body),o=Ke(i);return s?(ll(o),e.concat(o,o.visualViewport||[],Mr(i)?i:[],[])):e.concat(i,Du(i,[]))}function ll(n){return n.parent&&Object.getPrototypeOf(n.parent)?n.frameElement:null}function Ru(n){const e=st(n);let t=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=mt(n),s=i?n.offsetWidth:t,o=i?n.offsetHeight:r,l=Ji(t)!==s||Ji(r)!==o;return l&&(t=s,r=o),{width:t,height:r,$:l}}function Iu(n){return it(n)?n:n.contextElement}function jn(n){const e=Iu(n);if(!mt(e))return ht(1);const t=e.getBoundingClientRect(),{width:r,height:i,$:s}=Ru(e);let o=(s?Ji(t.width):t.width)/r,l=(s?Ji(t.height):t.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}const Qb=ht(0);function Pu(n){const e=Ke(n);return!ol()||!e.visualViewport?Qb:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Zb(n,e,t){return e===void 0&&(e=!1),!t||e&&t!==Ke(n)?!1:e}function vr(n,e,t,r){e===void 0&&(e=!1),t===void 0&&(t=!1);const i=n.getBoundingClientRect(),s=Iu(n);let o=ht(1);e&&(r?it(r)&&(o=jn(r)):o=jn(n));const l=Zb(s,t,r)?Pu(s):ht(0);let a=(i.left+l.x)/o.x,c=(i.top+l.y)/o.y,d=i.width/o.x,u=i.height/o.y;if(s){const f=Ke(s),h=r&&it(r)?Ke(r):r;let p=f,g=ll(p);for(;g&&r&&h!==p;){const y=jn(g),w=g.getBoundingClientRect(),k=st(g),C=w.left+(g.clientLeft+parseFloat(k.paddingLeft))*y.x,D=w.top+(g.clientTop+parseFloat(k.paddingTop))*y.y;a*=y.x,c*=y.y,d*=y.x,u*=y.y,a+=C,c+=D,p=Ke(g),g=ll(p)}}return $n({width:d,height:u,x:a,y:c})}function es(n,e){const t=Zi(n).scrollLeft;return e?e.left+t:vr(Dt(n)).left+t}function Lu(n,e){const t=n.getBoundingClientRect(),r=t.left+e.scrollLeft-es(n,t),i=t.top+e.scrollTop;return{x:r,y:i}}function e1(n){let{elements:e,rect:t,offsetParent:r,strategy:i}=n;const s=i==="fixed",o=Dt(r),l=e?Qi(e.floating):!1;if(r===o||l&&s)return t;let a={scrollLeft:0,scrollTop:0},c=ht(1);const d=ht(0),u=mt(r);if((u||!u&&!s)&&((Hn(r)!=="body"||Mr(o))&&(a=Zi(r)),mt(r))){const h=vr(r);c=jn(r),d.x=h.x+r.clientLeft,d.y=h.y+r.clientTop}const f=o&&!u&&!s?Lu(o,a):ht(0);return{width:t.width*c.x,height:t.height*c.y,x:t.x*c.x-a.scrollLeft*c.x+d.x+f.x,y:t.y*c.y-a.scrollTop*c.y+d.y+f.y}}function t1(n){return Array.from(n.getClientRects())}function n1(n){const e=Dt(n),t=Zi(n),r=n.ownerDocument.body,i=ze(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),s=ze(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-t.scrollLeft+es(n);const l=-t.scrollTop;return st(r).direction==="rtl"&&(o+=ze(e.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:l}}const Bu=25;function r1(n,e){const t=Ke(n),r=Dt(n),i=t.visualViewport;let s=r.clientWidth,o=r.clientHeight,l=0,a=0;if(i){s=i.width,o=i.height;const d=ol();(!d||d&&e==="fixed")&&(l=i.offsetLeft,a=i.offsetTop)}const c=es(r);if(c<=0){const d=r.ownerDocument,u=d.body,f=getComputedStyle(u),h=d.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,p=Math.abs(r.clientWidth-u.clientWidth-h);p<=Bu&&(s-=p)}else c<=Bu&&(s+=c);return{width:s,height:o,x:l,y:a}}const i1=new Set(["absolute","fixed"]);function s1(n,e){const t=vr(n,!0,e==="fixed"),r=t.top+n.clientTop,i=t.left+n.clientLeft,s=mt(n)?jn(n):ht(1),o=n.clientWidth*s.x,l=n.clientHeight*s.y,a=i*s.x,c=r*s.y;return{width:o,height:l,x:a,y:c}}function _u(n,e,t){let r;if(e==="viewport")r=r1(n,t);else if(e==="document")r=n1(Dt(n));else if(it(e))r=s1(e,t);else{const i=Pu(n);r={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return $n(r)}function Vu(n,e){const t=tn(n);return t===e||!it(t)||Fn(t)?!1:st(t).position==="fixed"||Vu(t,e)}function o1(n,e){const t=e.get(n);if(t)return t;let r=Du(n,[]).filter(l=>it(l)&&Hn(l)!=="body"),i=null;const s=st(n).position==="fixed";let o=s?tn(n):n;for(;it(o)&&!Fn(o);){const l=st(o),a=sl(o);!a&&l.position==="fixed"&&(i=null),(s?!a&&!i:!a&&l.position==="static"&&!!i&&i1.has(i.position)||Mr(o)&&!a&&Vu(n,o))?r=r.filter(d=>d!==o):i=l,o=tn(o)}return e.set(n,r),r}function l1(n){let{element:e,boundary:t,rootBoundary:r,strategy:i}=n;const o=[...t==="clippingAncestors"?Qi(e)?[]:o1(e,this._c):[].concat(t),r],l=o[0],a=o.reduce((c,d)=>{const u=_u(e,d,i);return c.top=ze(u.top,c.top),c.right=ft(u.right,c.right),c.bottom=ft(u.bottom,c.bottom),c.left=ze(u.left,c.left),c},_u(e,l,i));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function a1(n){const{width:e,height:t}=Ru(n);return{width:e,height:t}}function c1(n,e,t){const r=mt(e),i=Dt(e),s=t==="fixed",o=vr(n,!0,s,e);let l={scrollLeft:0,scrollTop:0};const a=ht(0);function c(){a.x=es(i)}if(r||!r&&!s)if((Hn(e)!=="body"||Mr(i))&&(l=Zi(e)),r){const h=vr(e,!0,s,e);a.x=h.x+e.clientLeft,a.y=h.y+e.clientTop}else i&&c();s&&!r&&i&&c();const d=i&&!r&&!s?Lu(i,l):ht(0),u=o.left+l.scrollLeft-a.x-d.x,f=o.top+l.scrollTop-a.y-d.y;return{x:u,y:f,width:o.width,height:o.height}}function al(n){return st(n).position==="static"}function $u(n,e){if(!mt(n)||st(n).position==="fixed")return null;if(e)return e(n);let t=n.offsetParent;return Dt(n)===t&&(t=t.ownerDocument.body),t}function zu(n,e){const t=Ke(n);if(Qi(n))return t;if(!mt(n)){let i=tn(n);for(;i&&!Fn(i);){if(it(i)&&!al(i))return i;i=tn(i)}return t}let r=$u(n,e);for(;r&&Wb(r)&&al(r);)r=$u(r,e);return r&&Fn(r)&&al(r)&&!sl(r)?t:r||Yb(n)||t}const d1=async function(n){const e=this.getOffsetParent||zu,t=this.getDimensions,r=await t(n.floating);return{reference:c1(n.reference,await e(n.floating),n.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function u1(n){return st(n).direction==="rtl"}const f1={convertOffsetParentRelativeRectToViewportRelativeRect:e1,getDocumentElement:Dt,getClippingRect:l1,getOffsetParent:zu,getElementRects:d1,getClientRects:t1,getDimensions:a1,getScale:jn,isElement:it,isRTL:u1},Hu=zb,Fu=Ib,ju=Hb,Uu=Pb,Wu=Fb,Ku=Lb,qu=Db,Ju=_b,Gu=(n,e,t)=>{const r=new Map,i={platform:f1,...t},s={...i.platform,_c:r};return Ab(n,e,{...i,platform:s})};var cl,dl;if(typeof WeakMap<"u"){let n=new WeakMap;cl=e=>n.get(e),dl=(e,t)=>(n.set(e,t),t)}else{const n=[];let t=0;cl=r=>{for(let i=0;i<n.length;i+=2)if(n[i]==r)return n[i+1]},dl=(r,i)=>(t==10&&(t=0),n[t++]=r,n[t++]=i)}var Rt=class{constructor(n,e,t,r){this.width=n,this.height=e,this.map=t,this.problems=r}findCell(n){for(let e=0;e<this.map.length;e++){const t=this.map[e];if(t!=n)continue;const r=e%this.width,i=e/this.width|0;let s=r+1,o=i+1;for(let l=1;s<this.width&&this.map[e+l]==t;l++)s++;for(let l=1;o<this.height&&this.map[e+this.width*l]==t;l++)o++;return{left:r,top:i,right:s,bottom:o}}throw new RangeError(`No cell with offset ${n} found`)}colCount(n){for(let e=0;e<this.map.length;e++)if(this.map[e]==n)return e%this.width;throw new RangeError(`No cell with offset ${n} found`)}nextCell(n,e,t){const{left:r,right:i,top:s,bottom:o}=this.findCell(n);return e=="horiz"?(t<0?r==0:i==this.width)?null:this.map[s*this.width+(t<0?r-1:i)]:(t<0?s==0:o==this.height)?null:this.map[r+this.width*(t<0?s-1:o)]}rectBetween(n,e){const{left:t,right:r,top:i,bottom:s}=this.findCell(n),{left:o,right:l,top:a,bottom:c}=this.findCell(e);return{left:Math.min(t,o),top:Math.min(i,a),right:Math.max(r,l),bottom:Math.max(s,c)}}cellsInRect(n){const e=[],t={};for(let r=n.top;r<n.bottom;r++)for(let i=n.left;i<n.right;i++){const s=r*this.width+i,o=this.map[s];t[o]||(t[o]=!0,!(i==n.left&&i&&this.map[s-1]==o||r==n.top&&r&&this.map[s-this.width]==o)&&e.push(o))}return e}positionAt(n,e,t){for(let r=0,i=0;;r++){const s=i+t.child(r).nodeSize;if(r==n){let o=e+n*this.width;const l=(n+1)*this.width;for(;o<l&&this.map[o]<i;)o++;return o==l?s-1:this.map[o]}i=s}}static get(n){return cl(n)||dl(n,h1(n))}};function h1(n){if(n.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+n.type.name);const e=p1(n),t=n.childCount,r=[];let i=0,s=null;const o=[];for(let c=0,d=e*t;c<d;c++)r[c]=0;for(let c=0,d=0;c<t;c++){const u=n.child(c);d++;for(let p=0;;p++){for(;i<r.length&&r[i]!=0;)i++;if(p==u.childCount)break;const g=u.child(p),{colspan:y,rowspan:w,colwidth:k}=g.attrs;for(let C=0;C<w;C++){if(C+c>=t){(s||(s=[])).push({type:"overlong_rowspan",pos:d,n:w-C});break}const D=i+C*e;for(let M=0;M<y;M++){r[D+M]==0?r[D+M]=d:(s||(s=[])).push({type:"collision",row:c,pos:d,n:y-M});const P=k&&k[M];if(P){const T=(D+M)%e*2,V=o[T];V==null||V!=P&&o[T+1]==1?(o[T]=P,o[T+1]=1):V==P&&o[T+1]++}}}i+=y,d+=g.nodeSize}const f=(c+1)*e;let h=0;for(;i<f;)r[i++]==0&&h++;h&&(s||(s=[])).push({type:"missing",row:c,n:h}),d++}(e===0||t===0)&&(s||(s=[])).push({type:"zero_sized"});const l=new Rt(e,t,r,s);let a=!1;for(let c=0;!a&&c<o.length;c+=2)o[c]!=null&&o[c+1]<t&&(a=!0);return a&&m1(l,o,n),l}function p1(n){let e=-1,t=!1;for(let r=0;r<n.childCount;r++){const i=n.child(r);let s=0;if(t)for(let o=0;o<r;o++){const l=n.child(o);for(let a=0;a<l.childCount;a++){const c=l.child(a);o+c.attrs.rowspan>r&&(s+=c.attrs.colspan)}}for(let o=0;o<i.childCount;o++){const l=i.child(o);s+=l.attrs.colspan,l.attrs.rowspan>1&&(t=!0)}e==-1?e=s:e!=s&&(e=Math.max(e,s))}return e}function m1(n,e,t){n.problems||(n.problems=[]);const r={};for(let i=0;i<n.map.length;i++){const s=n.map[i];if(r[s])continue;r[s]=!0;const o=t.nodeAt(s);if(!o)throw new RangeError(`No cell with offset ${s} found`);let l=null;const a=o.attrs;for(let c=0;c<a.colspan;c++){const d=(i+c)%n.width,u=e[d*2];u!=null&&(!a.colwidth||a.colwidth[c]!=u)&&((l||(l=g1(a)))[c]=u)}l&&n.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:l})}}function g1(n){if(n.colwidth)return n.colwidth.slice();const e=[];for(let t=0;t<n.colspan;t++)e.push(0);return e}function ul(n){let e=n.cached.tableNodeTypes;if(!e){e=n.cached.tableNodeTypes={};for(const t in n.nodes){const r=n.nodes[t],i=r.spec.tableRole;i&&(e[i]=r)}}return e}new le("selectingCells");function y1(n){for(let e=n.depth-1;e>0;e--)if(n.node(e).type.spec.tableRole=="row")return n.node(0).resolve(n.before(e+1));return null}function Yu(n){const e=n.selection.$head;for(let t=e.depth;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return!0;return!1}function b1(n){const e=n.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 t=y1(e.$head)||w1(e.$head);if(t)return t;throw new RangeError(`No cell found around position ${e.head}`)}function w1(n){for(let e=n.nodeAfter,t=n.pos;e;e=e.firstChild,t++){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return n.doc.resolve(t)}for(let e=n.nodeBefore,t=n.pos;e;e=e.lastChild,t--){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return n.doc.resolve(t-e.nodeSize)}}function Xu(n){return n.parent.type.spec.tableRole=="row"&&!!n.nodeAfter}function Qu(n,e){return n.depth==e.depth&&n.pos>=e.start(-1)&&n.pos<=e.end(-1)}function Zu(n,e,t){const r=n.node(-1),i=Rt.get(r),s=n.start(-1),o=i.nextCell(n.pos-s,e,t);return o==null?null:n.node(0).resolve(s+o)}function ef(n,e,t=1){const r={...n,colspan:n.colspan-t};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,t),r.colwidth.some(i=>i>0)||(r.colwidth=null)),r}var gt=class Pt extends H{constructor(e,t=e){const r=e.node(-1),i=Rt.get(r),s=e.start(-1),o=i.rectBetween(e.pos-s,t.pos-s),l=e.node(0),a=i.cellsInRect(o).filter(d=>d!=t.pos-s);a.unshift(t.pos-s);const c=a.map(d=>{const u=r.nodeAt(d);if(!u)throw RangeError(`No cell with offset ${d} found`);const f=s+d+1;return new pa(l.resolve(f),l.resolve(f+u.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=t}map(e,t){const r=e.resolve(t.map(this.$anchorCell.pos)),i=e.resolve(t.map(this.$headCell.pos));if(Xu(r)&&Xu(i)&&Qu(r,i)){const s=this.$anchorCell.node(-1)!=r.node(-1);return s&&this.isRowSelection()?Pt.rowSelection(r,i):s&&this.isColSelection()?Pt.colSelection(r,i):new Pt(r,i)}return F.between(r,i)}content(){const e=this.$anchorCell.node(-1),t=Rt.get(e),r=this.$anchorCell.start(-1),i=t.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),s={},o=[];for(let a=i.top;a<i.bottom;a++){const c=[];for(let d=a*t.width+i.left,u=i.left;u<i.right;u++,d++){const f=t.map[d];if(s[f])continue;s[f]=!0;const h=t.findCell(f);let p=e.nodeAt(f);if(!p)throw RangeError(`No cell with offset ${f} found`);const g=i.left-h.left,y=h.right-i.right;if(g>0||y>0){let w=p.attrs;if(g>0&&(w=ef(w,0,g)),y>0&&(w=ef(w,w.colspan-y,y)),h.left<i.left){if(p=p.type.createAndFill(w),!p)throw RangeError(`Could not create cell with attrs ${JSON.stringify(w)}`)}else p=p.type.create(w,p.content)}if(h.top<i.top||h.bottom>i.bottom){const w={...p.attrs,rowspan:Math.min(h.bottom,i.bottom)-Math.max(h.top,i.top)};h.top<i.top?p=p.type.createAndFill(w):p=p.type.create(w,p.content)}c.push(p)}o.push(e.child(a).copy(S.from(c)))}const l=this.isColSelection()&&this.isRowSelection()?e:o;return new N(S.from(l),1,1)}replace(e,t=N.empty){const r=e.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){const{$from:l,$to:a}=i[o],c=e.mapping.slice(r);e.replace(c.map(l.pos),c.map(a.pos),o?N.empty:t)}const s=H.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);s&&e.setSelection(s)}replaceWith(e,t){this.replace(e,new N(S.from(t),0,0))}forEachCell(e){const t=this.$anchorCell.node(-1),r=Rt.get(t),i=this.$anchorCell.start(-1),s=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-i,this.$headCell.pos-i));for(let o=0;o<s.length;o++)e(t.nodeAt(s[o]),i+s[o])}isColSelection(){const e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,i=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,i)==this.$headCell.node(-1).childCount}static colSelection(e,t=e){const r=e.node(-1),i=Rt.get(r),s=e.start(-1),o=i.findCell(e.pos-s),l=i.findCell(t.pos-s),a=e.node(0);return o.top<=l.top?(o.top>0&&(e=a.resolve(s+i.map[o.left])),l.bottom<i.height&&(t=a.resolve(s+i.map[i.width*(i.height-1)+l.right-1]))):(l.top>0&&(t=a.resolve(s+i.map[l.left])),o.bottom<i.height&&(e=a.resolve(s+i.map[i.width*(i.height-1)+o.right-1]))),new Pt(e,t)}isRowSelection(){const e=this.$anchorCell.node(-1),t=Rt.get(e),r=this.$anchorCell.start(-1),i=t.colCount(this.$anchorCell.pos-r),s=t.colCount(this.$headCell.pos-r);if(Math.min(i,s)>0)return!1;const o=i+this.$anchorCell.nodeAfter.attrs.colspan,l=s+this.$headCell.nodeAfter.attrs.colspan;return Math.max(o,l)==t.width}eq(e){return e instanceof Pt&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,t=e){const r=e.node(-1),i=Rt.get(r),s=e.start(-1),o=i.findCell(e.pos-s),l=i.findCell(t.pos-s),a=e.node(0);return o.left<=l.left?(o.left>0&&(e=a.resolve(s+i.map[o.top*i.width])),l.right<i.width&&(t=a.resolve(s+i.map[i.width*(l.top+1)-1]))):(l.left>0&&(t=a.resolve(s+i.map[l.top*i.width])),o.right<i.width&&(e=a.resolve(s+i.map[i.width*(o.top+1)-1]))),new Pt(e,t)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,t){return new Pt(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){return new Pt(e.resolve(t),e.resolve(r))}getBookmark(){return new k1(this.$anchorCell.pos,this.$headCell.pos)}};gt.prototype.visible=!1,H.jsonID("cell",gt);var k1=class Bf{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Bf(e.map(this.anchor),e.map(this.head))}resolve(e){const t=e.resolve(this.anchor),r=e.resolve(this.head);return t.parent.type.spec.tableRole=="row"&&r.parent.type.spec.tableRole=="row"&&t.index()<t.parent.childCount&&r.index()<r.parent.childCount&&Qu(t,r)?new gt(t,r):H.near(r,1)}};new le("fix-tables");function tf(n){const e=n.selection,t=b1(n),r=t.node(-1),i=t.start(-1),s=Rt.get(r);return{...e instanceof gt?s.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):s.findCell(t.pos-i),tableStart:i,map:s,table:r}}function x1(n){return function(e,t){if(!Yu(e))return!1;if(t){const r=ul(e.schema),i=tf(e),s=e.tr,o=i.map.cellsInRect(n=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:n=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),l=o.map(a=>i.table.nodeAt(a));for(let a=0;a<o.length;a++)l[a].type==r.header_cell&&s.setNodeMarkup(i.tableStart+o[a],r.cell,l[a].attrs);if(s.steps.length==0)for(let a=0;a<o.length;a++)s.setNodeMarkup(i.tableStart+o[a],r.header_cell,l[a].attrs);t(s)}return!0}}function nf(n,e,t){const r=e.map.cellsInRect({left:0,top:0,right:n=="row"?e.map.width:1,bottom:n=="column"?e.map.height:1});for(let i=0;i<r.length;i++){const s=e.table.nodeAt(r[i]);if(s&&s.type!==t.header_cell)return!1}return!0}function fl(n,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?x1(n):function(t,r){if(!Yu(t))return!1;if(r){const i=ul(t.schema),s=tf(t),o=t.tr,l=nf("row",s,i),a=nf("column",s,i),d=(n==="column"?l:n==="row"?a:!1)?1:0,u=n=="column"?{left:0,top:d,right:1,bottom:s.map.height}:n=="row"?{left:d,top:0,right:s.map.width,bottom:1}:s,f=n=="column"?a?i.cell:i.header_cell:n=="row"?l?i.cell:i.header_cell:i.cell;s.map.cellsInRect(u).forEach(h=>{const p=h+s.tableStart,g=o.doc.nodeAt(p);g&&o.setNodeMarkup(p,f,g.attrs)}),r(o)}return!0}}fl("row",{useDeprecatedLogic:!0}),fl("column",{useDeprecatedLogic:!0}),fl("cell",{useDeprecatedLogic:!0});function ts(n,e){const t=n.selection;if(!(t instanceof gt))return!1;if(e){const r=n.tr,i=ul(n.schema).cell.createAndFill().content;t.forEachCell((s,o)=>{s.content.eq(i)||r.replace(r.mapping.map(o+1),r.mapping.map(o+s.nodeSize-1),new N(i,0,0))}),r.docChanged&&e(r)}return!0}no({ArrowLeft:rs("horiz",-1),ArrowRight:rs("horiz",1),ArrowUp:rs("vert",-1),ArrowDown:rs("vert",1),"Shift-ArrowLeft":is("horiz",-1),"Shift-ArrowRight":is("horiz",1),"Shift-ArrowUp":is("vert",-1),"Shift-ArrowDown":is("vert",1),Backspace:ts,"Mod-Backspace":ts,Delete:ts,"Mod-Delete":ts});function ns(n,e,t){return t.eq(n.selection)?!1:(e&&e(n.tr.setSelection(t).scrollIntoView()),!0)}function rs(n,e){return(t,r,i)=>{if(!i)return!1;const s=t.selection;if(s instanceof gt)return ns(t,r,H.near(s.$headCell,e));if(n!="horiz"&&!s.empty)return!1;const o=rf(i,n,e);if(o==null)return!1;if(n=="horiz")return ns(t,r,H.near(t.doc.resolve(s.head+e),e));{const l=t.doc.resolve(o),a=Zu(l,n,e);let c;return a?c=H.near(a,1):e<0?c=H.near(t.doc.resolve(l.before(-1)),-1):c=H.near(t.doc.resolve(l.after(-1)),1),ns(t,r,c)}}}function is(n,e){return(t,r,i)=>{if(!i)return!1;const s=t.selection;let o;if(s instanceof gt)o=s;else{const a=rf(i,n,e);if(a==null)return!1;o=new gt(t.doc.resolve(a))}const l=Zu(o.$headCell,n,e);return l?ns(t,r,new gt(o.$anchorCell,l)):!1}}function rf(n,e,t){if(!(n.state.selection instanceof F))return null;const{$head:r}=n.state.selection;for(let i=r.depth-1;i>=0;i--){const s=r.node(i);if((t<0?r.index(i):r.indexAfter(i))!=(t<0?0:s.childCount))return null;if(s.type.spec.tableRole=="cell"||s.type.spec.tableRole=="header_cell"){const l=r.before(i),a=e=="vert"?t>0?"down":"up":t>0?"right":"left";return n.endOfTextblock(a)?l:null}}return null}new le("tableColumnResizing");function S1(n,e){const t=Math.min(n.top,e.top),r=Math.max(n.bottom,e.bottom),i=Math.min(n.left,e.left),o=Math.max(n.right,e.right)-i,l=r-t,a=i,c=t;return new DOMRect(a,c,o,l)}var C1=class{constructor({editor:n,element:e,view:t,updateDelay:r=250,resizeDelay:i=60,shouldShow:s,appendTo:o,getReferencedVirtualElement:l,options:a}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.floatingUIOptions={strategy:"absolute",placement:"top",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1,onShow:void 0,onHide:void 0,onUpdate:void 0,onDestroy:void 0},this.shouldShow=({view:d,state:u,from:f,to:h})=>{const{doc:p,selection:g}=u,{empty:y}=g,w=!p.textBetween(f,h).length&&ko(u.selection),k=this.element.contains(document.activeElement);return!(!(d.hasFocus()||k)||y||w||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:d})=>{var u;if(this.editor.isDestroyed){this.destroy();return}if(this.preventHide){this.preventHide=!1;return}d?.relatedTarget&&((u=this.element.parentNode)!=null&&u.contains(d.relatedTarget))||d?.relatedTarget!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(d,u)=>{const f=!u?.selection.eq(d.state.selection),h=!u?.doc.eq(d.state.doc);!f&&!h||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(d,f,h,u)},this.updateDelay))},this.updateHandler=(d,u,f,h)=>{const{composing:p}=d;if(p||!u&&!f)return;if(!this.getShouldShow(h)){this.hide();return}this.updatePosition(),this.show()},this.transactionHandler=({transaction:d})=>{d.getMeta("bubbleMenu")==="updatePosition"&&this.updatePosition()};var c;this.editor=n,this.element=e,this.view=t,this.updateDelay=r,this.resizeDelay=i,this.appendTo=o,this.scrollTarget=(c=a?.scrollTarget)!=null?c:window,this.getReferencedVirtualElement=l,this.floatingUIOptions={...this.floatingUIOptions,...a},this.element.tabIndex=0,s&&(this.shouldShow=s),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.editor.on("transaction",this.transactionHandler),window.addEventListener("resize",this.resizeHandler),this.scrollTarget.addEventListener("scroll",this.resizeHandler),this.update(t,t.state),this.getShouldShow()&&this.show()}get middlewares(){const n=[];return this.floatingUIOptions.flip&&n.push(Uu(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&n.push(ju(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&n.push(Hu(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&n.push(qu(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&n.push(Wu(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&n.push(Fu(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&n.push(Ku(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&n.push(Ju(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),n}get virtualElement(){var n;const{selection:e}=this.editor.state,t=(n=this.getReferencedVirtualElement)==null?void 0:n.call(this);if(t)return t;const r=hd(this.view,e.from,e.to);let i={getBoundingClientRect:()=>r,getClientRects:()=>[r]};if(e instanceof B){let s=this.view.nodeDOM(e.from);const o=s.dataset.nodeViewWrapper?s:s.querySelector("[data-node-view-wrapper]");o&&(s=o),s&&(i={getBoundingClientRect:()=>s.getBoundingClientRect(),getClientRects:()=>[s.getBoundingClientRect()]})}if(e instanceof gt){const{$anchorCell:s,$headCell:o}=e,l=s?s.pos:o.pos,a=o?o.pos:s.pos,c=this.view.nodeDOM(l),d=this.view.nodeDOM(a);if(!c||!d)return;const u=c===d?c.getBoundingClientRect():S1(c.getBoundingClientRect(),d.getBoundingClientRect());i={getBoundingClientRect:()=>u,getClientRects:()=>[u]}}return i}updatePosition(){const n=this.virtualElement;n&&Gu(n,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:t,strategy:r})=>{this.element.style.width="max-content",this.element.style.position=r,this.element.style.left=`${e}px`,this.element.style.top=`${t}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(n,e){const{state:t}=n,r=t.selection.from!==t.selection.to;if(this.updateDelay>0&&r){this.handleDebouncedUpdate(n,e);return}const i=!e?.selection.eq(n.state.selection),s=!e?.doc.eq(n.state.doc);this.updateHandler(n,i,s,e)}getShouldShow(n){var e;const{state:t}=this.view,{selection:r}=t,{ranges:i}=r,s=Math.min(...i.map(a=>a.$from.pos)),o=Math.max(...i.map(a=>a.$to.pos));return(e=this.shouldShow)==null?void 0:e.call(this,{editor:this.editor,element:this.element,view:this.view,state:t,oldState:n,from:s,to:o})}show(){var n;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const e=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(n=e??this.view.dom.parentElement)==null||n.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),window.removeEventListener("resize",this.resizeHandler),this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.editor.off("transaction",this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},sf=n=>new se({key:typeof n.pluginKey=="string"?new le(n.pluginKey):n.pluginKey,view:e=>new C1({view:e,...n})});de.create({name:"bubbleMenu",addOptions(){return{element:null,pluginKey:"bubbleMenu",updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[sf({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,options:this.options.options,appendTo:this.options.appendTo,getReferencedVirtualElement:this.options.getReferencedVirtualElement,shouldShow:this.options.shouldShow})]:[]}});var E1=m.defineComponent({name:"BubbleMenu",inheritAttrs:!1,props:{pluginKey:{type:[String,Object],default:"bubbleMenu"},editor:{type:Object,required:!0},updateDelay:{type:Number,default:void 0},resizeDelay:{type:Number,default:void 0},options:{type:Object,default:()=>({})},appendTo:{type:Object,default:void 0},shouldShow:{type:Function,default:null},getReferencedVirtualElement:{type:Function,default:void 0}},setup(n,{slots:e,attrs:t}){const r=m.ref(null);return m.onMounted(()=>{const{editor:i,options:s,pluginKey:o,resizeDelay:l,appendTo:a,shouldShow:c,getReferencedVirtualElement:d,updateDelay:u}=n;r.value&&(r.value.style.visibility="hidden",r.value.style.position="absolute",r.value.remove(),i.registerPlugin(sf({editor:i,element:r.value,options:s,pluginKey:o,resizeDelay:l,appendTo:a,shouldShow:c,getReferencedVirtualElement:d,updateDelay:u})))}),m.onBeforeUnmount(()=>{const{pluginKey:i,editor:s}=n;s.unregisterPlugin(i)}),()=>{var i;return m.h(m.Teleport,{to:"body"},m.h("div",{...t,ref:r},(i=e.default)==null?void 0:i.call(e)))}}}),M1=class{constructor({editor:n,element:e,view:t,options:r,appendTo:i,shouldShow:s}){this.preventHide=!1,this.isVisible=!1,this.shouldShow=({view:o,state:l})=>{const{selection:a}=l,{$anchor:c,empty:d}=a,u=c.depth===1,f=c.parent.isTextblock&&!c.parent.type.spec.code&&!c.parent.textContent&&c.parent.childCount===0&&!this.getTextContent(c.parent);return!(!o.hasFocus()||!d||!u||!f||!this.editor.isEditable)},this.floatingUIOptions={strategy:"absolute",placement:"right",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1},this.updateHandler=(o,l,a,c)=>{const{composing:d}=o;if(d||!l&&!a)return;if(!this.getShouldShow(c)){this.hide();return}this.updatePosition(),this.show()},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:o})=>{var l;if(this.preventHide){this.preventHide=!1;return}o?.relatedTarget&&((l=this.element.parentNode)!=null&&l.contains(o.relatedTarget))||o?.relatedTarget!==this.editor.view.dom&&this.hide()},this.editor=n,this.element=e,this.view=t,this.appendTo=i,this.floatingUIOptions={...this.floatingUIOptions,...r},this.element.tabIndex=0,s&&(this.shouldShow=s),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.update(t,t.state),this.getShouldShow()&&this.show()}getTextContent(n){return id(n,{textSerializers:po(this.editor.schema)})}get middlewares(){const n=[];return this.floatingUIOptions.flip&&n.push(Uu(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&n.push(ju(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&n.push(Hu(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&n.push(qu(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&n.push(Wu(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&n.push(Fu(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&n.push(Ku(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&n.push(Ju(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),n}getShouldShow(n){var e;const{state:t}=this.view,{selection:r}=t,{ranges:i}=r,s=Math.min(...i.map(a=>a.$from.pos)),o=Math.max(...i.map(a=>a.$to.pos));return(e=this.shouldShow)==null?void 0:e.call(this,{editor:this.editor,view:this.view,state:t,oldState:n,from:s,to:o})}updatePosition(){const{selection:n}=this.editor.state,e=hd(this.view,n.from,n.to);Gu({getBoundingClientRect:()=>e,getClientRects:()=>[e]},this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:r,y:i,strategy:s})=>{this.element.style.width="max-content",this.element.style.position=s,this.element.style.left=`${r}px`,this.element.style.top=`${i}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(n,e){const t=!e?.selection.eq(n.state.selection),r=!e?.doc.eq(n.state.doc);this.updateHandler(n,t,r,e)}show(){var n;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const e=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(n=e??this.view.dom.parentElement)==null||n.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},of=n=>new se({key:typeof n.pluginKey=="string"?new le(n.pluginKey):n.pluginKey,view:e=>new M1({view:e,...n})});de.create({name:"floatingMenu",addOptions(){return{element:null,options:{},pluginKey:"floatingMenu",appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[of({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,options:this.options.options,appendTo:this.options.appendTo,shouldShow:this.options.shouldShow})]:[]}}),m.defineComponent({name:"FloatingMenu",inheritAttrs:!1,props:{pluginKey:{type:null,default:"floatingMenu"},editor:{type:Object,required:!0},options:{type:Object,default:()=>({})},appendTo:{type:Object,default:void 0},shouldShow:{type:Function,default:null}},setup(n,{slots:e,attrs:t}){const r=m.ref(null);return m.onMounted(()=>{const{pluginKey:i,editor:s,options:o,appendTo:l,shouldShow:a}=n;r.value&&(r.value.style.visibility="hidden",r.value.style.position="absolute",r.value.remove(),s.registerPlugin(of({pluginKey:i,editor:s,element:r.value,options:o,appendTo:l,shouldShow:a})))}),m.onBeforeUnmount(()=>{const{pluginKey:i,editor:s}=n;s.unregisterPlugin(i)}),()=>{var i;return m.h(m.Teleport,{to:"body"},m.h("div",{...t,ref:r},(i=e.default)==null?void 0:i.call(e)))}}});const v1={class:"sus-bubble-menu"},T1=Yt(m.defineComponent({__name:"BubbleMenu",props:{editor:{},showMenu:{type:Boolean}},setup(n){const e=n,t=m.ref(""),r=m.ref(!1);function i({editor:l}){const{from:a,to:c}=l.state.selection;if(a===c){const{$anchor:d}=l.state.selection;return l.isActive("link")}return l.isActive("link")}function s(){if(r.value){r.value=!1;return}t.value=e.editor?.getAttributes("link").href,r.value=!0}function o(){if(!t.value){e.editor?.chain().focus().extendMarkRange("link").unsetLink().run(),r.value=!1;return}e.editor?.chain().focus().extendMarkRange("link").setLink({href:t.value}).run(),r.value=!1}return(l,a)=>(m.openBlock(),m.createElementBlock(m.Fragment,null,[m.withDirectives(m.createElementVNode("div",{class:"sus-bubble-mask",onClick:a[2]||(a[2]=c=>r.value=!1)},[m.createElementVNode("div",{class:"sus-link",onClick:a[1]||(a[1]=m.withModifiers(()=>{},["stop"]))},[m.withDirectives(m.createElementVNode("input",{"onUpdate:modelValue":a[0]||(a[0]=c=>t.value=c),onKeyup:m.withKeys(o,["enter"]),class:"sus-link-input",type:"text",placeholder:"请输入链接"},null,544),[[m.vModelText,t.value]]),m.createElementVNode("button",{onClick:o,title:"确定"},[...a[4]||(a[4]=[m.createStaticVNode('<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" data-v-1bbeca5c><rect width="24" height="24" fill="none" data-v-1bbeca5c></rect><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-width="1.5" data-v-1bbeca5c><path d="M15 2.458A10 10 0 0 0 12 2C6.477 2 2 6.477 2 12s4.477 10 10 10s10-4.477 10-10a10 10 0 0 0-.458-3" data-v-1bbeca5c></path><path stroke-linejoin="round" d="M8.5 9.5L12 13l9-10" data-v-1bbeca5c></path></g></svg>',1)])])])],512),[[m.vShow,r.value]]),n.editor&&n.showMenu?(m.openBlock(),m.createBlock(m.unref(E1),{key:0,editor:n.editor,options:{placement:"bottom",offset:8,shouldShow:i}},{default:m.withCtx(()=>[m.createElementVNode("div",v1,[m.createElementVNode("button",{onClick:s,title:"添加链接"},[...a[5]||(a[5]=[m.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},[m.createElementVNode("path",{d:"M9 17H7A5 5 0 0 1 7 7h2"}),m.createElementVNode("path",{d:"M15 7h2a5 5 0 1 1 0 10h-2"}),m.createElementVNode("line",{x1:"8",x2:"16",y1:"12",y2:"12"})],-1)])]),m.createElementVNode("button",{onClick:a[3]||(a[3]=c=>n.editor.commands.unsetAllMarks()),title:"清除当前选中格式"},[...a[6]||(a[6]=[m.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},[m.createElementVNode("path",{d:"M4 7V4h16v3"}),m.createElementVNode("path",{d:"M5 20h6"}),m.createElementVNode("path",{d:"M13 4 8 20"}),m.createElementVNode("path",{d:"m15 15 5 5"}),m.createElementVNode("path",{d:"m20 15-5 5"})],-1)])])])]),_:1},8,["editor","options"])):m.createCommentVNode("",!0)],64))}}),[["__scopeId","data-v-1bbeca5c"]]),O1=$e.create({name:"emoji",inline:!0,group:"inline",atom:!0,addAttributes(){return{name:{default:null},src:{default:null}}},parseHTML(){return[{tag:"span[data-type='emoji']"}]},renderHTML({HTMLAttributes:n}){return["span",{"data-type":"emoji",class:"emoji",contenteditable:"false"},["img",ce(n,{src:n.src,alt:n.name,draggable:"false",loading:"lazy",align:"absmiddle"})]]}});function N1(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var hl,lf;function A1(){if(lf)return hl;lf=1;function n(b){return b instanceof Map?b.clear=b.delete=b.set=function(){throw new Error("map is read-only")}:b instanceof Set&&(b.add=b.clear=b.delete=function(){throw new Error("set is read-only")}),Object.freeze(b),Object.getOwnPropertyNames(b).forEach(x=>{const O=b[x],q=typeof O;(q==="object"||q==="function")&&!Object.isFrozen(O)&&n(O)}),b}class e{constructor(x){x.data===void 0&&(x.data={}),this.data=x.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function t(b){return b.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function r(b,...x){const O=Object.create(null);for(const q in b)O[q]=b[q];return x.forEach(function(q){for(const me in q)O[me]=q[me]}),O}const i="</span>",s=b=>!!b.scope,o=(b,{prefix:x})=>{if(b.startsWith("language:"))return b.replace("language:","language-");if(b.includes(".")){const O=b.split(".");return[`${x}${O.shift()}`,...O.map((q,me)=>`${q}${"_".repeat(me+1)}`)].join(" ")}return`${x}${b}`};class l{constructor(x,O){this.buffer="",this.classPrefix=O.classPrefix,x.walk(this)}addText(x){this.buffer+=t(x)}openNode(x){if(!s(x))return;const O=o(x.scope,{prefix:this.classPrefix});this.span(O)}closeNode(x){s(x)&&(this.buffer+=i)}value(){return this.buffer}span(x){this.buffer+=`<span class="${x}">`}}const a=(b={})=>{const x={children:[]};return Object.assign(x,b),x};class c{constructor(){this.rootNode=a(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(x){this.top.children.push(x)}openNode(x){const O=a({scope:x});this.add(O),this.stack.push(O)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(x){return this.constructor._walk(x,this.rootNode)}static _walk(x,O){return typeof O=="string"?x.addText(O):O.children&&(x.openNode(O),O.children.forEach(q=>this._walk(x,q)),x.closeNode(O)),x}static _collapse(x){typeof x!="string"&&x.children&&(x.children.every(O=>typeof O=="string")?x.children=[x.children.join("")]:x.children.forEach(O=>{c._collapse(O)}))}}class d extends c{constructor(x){super(),this.options=x}addText(x){x!==""&&this.add(x)}startScope(x){this.openNode(x)}endScope(){this.closeNode()}__addSublanguage(x,O){const q=x.root;O&&(q.scope=`language:${O}`),this.add(q)}toHTML(){return new l(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function u(b){return b?typeof b=="string"?b:b.source:null}function f(b){return g("(?=",b,")")}function h(b){return g("(?:",b,")*")}function p(b){return g("(?:",b,")?")}function g(...b){return b.map(O=>u(O)).join("")}function y(b){const x=b[b.length-1];return typeof x=="object"&&x.constructor===Object?(b.splice(b.length-1,1),x):{}}function w(...b){return"("+(y(b).capture?"":"?:")+b.map(q=>u(q)).join("|")+")"}function k(b){return new RegExp(b.toString()+"|").exec("").length-1}function C(b,x){const O=b&&b.exec(x);return O&&O.index===0}const D=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function M(b,{joinWith:x}){let O=0;return b.map(q=>{O+=1;const me=O;let ge=u(q),L="";for(;ge.length>0;){const I=D.exec(ge);if(!I){L+=ge;break}L+=ge.substring(0,I.index),ge=ge.substring(I.index+I[0].length),I[0][0]==="\\"&&I[1]?L+="\\"+String(Number(I[1])+me):(L+=I[0],I[0]==="("&&O++)}return L}).map(q=>`(${q})`).join(x)}const P=/\b\B/,T="[a-zA-Z]\\w*",V="[a-zA-Z_]\\w*",K="\\b\\d+(\\.\\d+)?",j="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",U="\\b(0b[01]+)",R="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",X=(b={})=>{const x=/^#![ ]*\//;return b.binary&&(b.begin=g(x,/.*\b/,b.binary,/\b.*/)),r({scope:"meta",begin:x,end:/$/,relevance:0,"on:begin":(O,q)=>{O.index!==0&&q.ignoreMatch()}},b)},Z={begin:"\\\\[\\s\\S]",relevance:0},ke={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[Z]},he={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[Z]},pe={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},Me=function(b,x,O={}){const q=r({scope:"comment",begin:b,end:x,contains:[]},O);q.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const me=w("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return q.contains.push({begin:g(/[ ]+/,"(",me,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),q},yt=Me("//","$"),pl=Me("/\\*","\\*/"),Qw=Me("#","$"),Zw={scope:"number",begin:K,relevance:0},ek={scope:"number",begin:j,relevance:0},tk={scope:"number",begin:U,relevance:0},nk={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[Z,{begin:/\[/,end:/\]/,relevance:0,contains:[Z]}]},rk={scope:"title",begin:T,relevance:0},ik={scope:"title",begin:V,relevance:0},sk={begin:"\\.\\s*"+V,relevance:0};var ls=Object.freeze({__proto__:null,APOS_STRING_MODE:ke,BACKSLASH_ESCAPE:Z,BINARY_NUMBER_MODE:tk,BINARY_NUMBER_RE:U,COMMENT:Me,C_BLOCK_COMMENT_MODE:pl,C_LINE_COMMENT_MODE:yt,C_NUMBER_MODE:ek,C_NUMBER_RE:j,END_SAME_AS_BEGIN:function(b){return Object.assign(b,{"on:begin":(x,O)=>{O.data._beginMatch=x[1]},"on:end":(x,O)=>{O.data._beginMatch!==x[1]&&O.ignoreMatch()}})},HASH_COMMENT_MODE:Qw,IDENT_RE:T,MATCH_NOTHING_RE:P,METHOD_GUARD:sk,NUMBER_MODE:Zw,NUMBER_RE:K,PHRASAL_WORDS_MODE:pe,QUOTE_STRING_MODE:he,REGEXP_MODE:nk,RE_STARTERS_RE:R,SHEBANG:X,TITLE_MODE:rk,UNDERSCORE_IDENT_RE:V,UNDERSCORE_TITLE_MODE:ik});function ok(b,x){b.input[b.index-1]==="."&&x.ignoreMatch()}function lk(b,x){b.className!==void 0&&(b.scope=b.className,delete b.className)}function ak(b,x){x&&b.beginKeywords&&(b.begin="\\b("+b.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",b.__beforeBegin=ok,b.keywords=b.keywords||b.beginKeywords,delete b.beginKeywords,b.relevance===void 0&&(b.relevance=0))}function ck(b,x){Array.isArray(b.illegal)&&(b.illegal=w(...b.illegal))}function dk(b,x){if(b.match){if(b.begin||b.end)throw new Error("begin & end are not supported with match");b.begin=b.match,delete b.match}}function uk(b,x){b.relevance===void 0&&(b.relevance=1)}const fk=(b,x)=>{if(!b.beforeMatch)return;if(b.starts)throw new Error("beforeMatch cannot be used with starts");const O=Object.assign({},b);Object.keys(b).forEach(q=>{delete b[q]}),b.keywords=O.keywords,b.begin=g(O.beforeMatch,f(O.begin)),b.starts={relevance:0,contains:[Object.assign(O,{endsParent:!0})]},b.relevance=0,delete O.beforeMatch},hk=["of","and","for","in","not","or","if","then","parent","list","value"],pk="keyword";function gf(b,x,O=pk){const q=Object.create(null);return typeof b=="string"?me(O,b.split(" ")):Array.isArray(b)?me(O,b):Object.keys(b).forEach(function(ge){Object.assign(q,gf(b[ge],x,ge))}),q;function me(ge,L){x&&(L=L.map(I=>I.toLowerCase())),L.forEach(function(I){const W=I.split("|");q[W[0]]=[ge,mk(W[0],W[1])]})}}function mk(b,x){return x?Number(x):gk(b)?0:1}function gk(b){return hk.includes(b.toLowerCase())}const yf={},Sn=b=>{console.error(b)},bf=(b,...x)=>{console.log(`WARN: ${b}`,...x)},Un=(b,x)=>{yf[`${b}/${x}`]||(console.log(`Deprecated as of ${b}. ${x}`),yf[`${b}/${x}`]=!0)},as=new Error;function wf(b,x,{key:O}){let q=0;const me=b[O],ge={},L={};for(let I=1;I<=x.length;I++)L[I+q]=me[I],ge[I+q]=!0,q+=k(x[I-1]);b[O]=L,b[O]._emit=ge,b[O]._multi=!0}function yk(b){if(Array.isArray(b.begin)){if(b.skip||b.excludeBegin||b.returnBegin)throw Sn("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),as;if(typeof b.beginScope!="object"||b.beginScope===null)throw Sn("beginScope must be object"),as;wf(b,b.begin,{key:"beginScope"}),b.begin=M(b.begin,{joinWith:""})}}function bk(b){if(Array.isArray(b.end)){if(b.skip||b.excludeEnd||b.returnEnd)throw Sn("skip, excludeEnd, returnEnd not compatible with endScope: {}"),as;if(typeof b.endScope!="object"||b.endScope===null)throw Sn("endScope must be object"),as;wf(b,b.end,{key:"endScope"}),b.end=M(b.end,{joinWith:""})}}function wk(b){b.scope&&typeof b.scope=="object"&&b.scope!==null&&(b.beginScope=b.scope,delete b.scope)}function kk(b){wk(b),typeof b.beginScope=="string"&&(b.beginScope={_wrap:b.beginScope}),typeof b.endScope=="string"&&(b.endScope={_wrap:b.endScope}),yk(b),bk(b)}function xk(b){function x(L,I){return new RegExp(u(L),"m"+(b.case_insensitive?"i":"")+(b.unicodeRegex?"u":"")+(I?"g":""))}class O{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(I,W){W.position=this.position++,this.matchIndexes[this.matchAt]=W,this.regexes.push([W,I]),this.matchAt+=k(I)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const I=this.regexes.map(W=>W[1]);this.matcherRe=x(M(I,{joinWith:"|"}),!0),this.lastIndex=0}exec(I){this.matcherRe.lastIndex=this.lastIndex;const W=this.matcherRe.exec(I);if(!W)return null;const ve=W.findIndex((Tr,gl)=>gl>0&&Tr!==void 0),we=this.matchIndexes[ve];return W.splice(0,ve),Object.assign(W,we)}}class q{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(I){if(this.multiRegexes[I])return this.multiRegexes[I];const W=new O;return this.rules.slice(I).forEach(([ve,we])=>W.addRule(ve,we)),W.compile(),this.multiRegexes[I]=W,W}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(I,W){this.rules.push([I,W]),W.type==="begin"&&this.count++}exec(I){const W=this.getMatcher(this.regexIndex);W.lastIndex=this.lastIndex;let ve=W.exec(I);if(this.resumingScanAtSamePosition()&&!(ve&&ve.index===this.lastIndex)){const we=this.getMatcher(0);we.lastIndex=this.lastIndex+1,ve=we.exec(I)}return ve&&(this.regexIndex+=ve.position+1,this.regexIndex===this.count&&this.considerAll()),ve}}function me(L){const I=new q;return L.contains.forEach(W=>I.addRule(W.begin,{rule:W,type:"begin"})),L.terminatorEnd&&I.addRule(L.terminatorEnd,{type:"end"}),L.illegal&&I.addRule(L.illegal,{type:"illegal"}),I}function ge(L,I){const W=L;if(L.isCompiled)return W;[lk,dk,kk,fk].forEach(we=>we(L,I)),b.compilerExtensions.forEach(we=>we(L,I)),L.__beforeBegin=null,[ak,ck,uk].forEach(we=>we(L,I)),L.isCompiled=!0;let ve=null;return typeof L.keywords=="object"&&L.keywords.$pattern&&(L.keywords=Object.assign({},L.keywords),ve=L.keywords.$pattern,delete L.keywords.$pattern),ve=ve||/\w+/,L.keywords&&(L.keywords=gf(L.keywords,b.case_insensitive)),W.keywordPatternRe=x(ve,!0),I&&(L.begin||(L.begin=/\B|\b/),W.beginRe=x(W.begin),!L.end&&!L.endsWithParent&&(L.end=/\B|\b/),L.end&&(W.endRe=x(W.end)),W.terminatorEnd=u(W.end)||"",L.endsWithParent&&I.terminatorEnd&&(W.terminatorEnd+=(L.end?"|":"")+I.terminatorEnd)),L.illegal&&(W.illegalRe=x(L.illegal)),L.contains||(L.contains=[]),L.contains=[].concat(...L.contains.map(function(we){return Sk(we==="self"?L:we)})),L.contains.forEach(function(we){ge(we,W)}),L.starts&&ge(L.starts,I),W.matcher=me(W),W}if(b.compilerExtensions||(b.compilerExtensions=[]),b.contains&&b.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return b.classNameAliases=r(b.classNameAliases||{}),ge(b)}function kf(b){return b?b.endsWithParent||kf(b.starts):!1}function Sk(b){return b.variants&&!b.cachedVariants&&(b.cachedVariants=b.variants.map(function(x){return r(b,{variants:null},x)})),b.cachedVariants?b.cachedVariants:kf(b)?r(b,{starts:b.starts?r(b.starts):null}):Object.isFrozen(b)?r(b):b}var Ck="11.11.1";class Ek extends Error{constructor(x,O){super(x),this.name="HTMLInjectionError",this.html=O}}const ml=t,xf=r,Sf=Symbol("nomatch"),Mk=7,Cf=function(b){const x=Object.create(null),O=Object.create(null),q=[];let me=!0;const ge="Could not find the language '{}', did you forget to load/include a language module?",L={disableAutodetect:!0,name:"Plain text",contains:[]};let I={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:d};function W(v){return I.noHighlightRe.test(v)}function ve(v){let z=v.className+" ";z+=v.parentNode?v.parentNode.className:"";const Q=I.languageDetectRe.exec(z);if(Q){const re=nn(Q[1]);return re||(bf(ge.replace("{}",Q[1])),bf("Falling back to no-highlight mode for this block.",v)),re?Q[1]:"no-highlight"}return z.split(/\s+/).find(re=>W(re)||nn(re))}function we(v,z,Q){let re="",xe="";typeof z=="object"?(re=v,Q=z.ignoreIllegals,xe=z.language):(Un("10.7.0","highlight(lang, code, ...args) has been deprecated."),Un("10.7.0",`Please use highlight(code, options) instead.
105
+ https://github.com/highlightjs/highlight.js/issues/2277`),xe=v,re=z),Q===void 0&&(Q=!0);const ot={code:re,language:xe};ds("before:highlight",ot);const rn=ot.result?ot.result:Tr(ot.language,ot.code,Q);return rn.code=ot.code,ds("after:highlight",rn),rn}function Tr(v,z,Q,re){const xe=Object.create(null);function ot(A,_){return A.keywords[_]}function rn(){if(!J.keywords){Ae.addText(ie);return}let A=0;J.keywordPatternRe.lastIndex=0;let _=J.keywordPatternRe.exec(ie),Y="";for(;_;){Y+=ie.substring(A,_.index);const te=wt.case_insensitive?_[0].toLowerCase():_[0],Le=ot(J,te);if(Le){const[It,Fk]=Le;if(Ae.addText(Y),Y="",xe[te]=(xe[te]||0)+1,xe[te]<=Mk&&(hs+=Fk),It.startsWith("_"))Y+=_[0];else{const jk=wt.classNameAliases[It]||It;bt(_[0],jk)}}else Y+=_[0];A=J.keywordPatternRe.lastIndex,_=J.keywordPatternRe.exec(ie)}Y+=ie.substring(A),Ae.addText(Y)}function us(){if(ie==="")return;let A=null;if(typeof J.subLanguage=="string"){if(!x[J.subLanguage]){Ae.addText(ie);return}A=Tr(J.subLanguage,ie,!0,Df[J.subLanguage]),Df[J.subLanguage]=A._top}else A=yl(ie,J.subLanguage.length?J.subLanguage:null);J.relevance>0&&(hs+=A.relevance),Ae.__addSublanguage(A._emitter,A.language)}function qe(){J.subLanguage!=null?us():rn(),ie=""}function bt(A,_){A!==""&&(Ae.startScope(_),Ae.addText(A),Ae.endScope())}function Tf(A,_){let Y=1;const te=_.length-1;for(;Y<=te;){if(!A._emit[Y]){Y++;continue}const Le=wt.classNameAliases[A[Y]]||A[Y],It=_[Y];Le?bt(It,Le):(ie=It,rn(),ie=""),Y++}}function Of(A,_){return A.scope&&typeof A.scope=="string"&&Ae.openNode(wt.classNameAliases[A.scope]||A.scope),A.beginScope&&(A.beginScope._wrap?(bt(ie,wt.classNameAliases[A.beginScope._wrap]||A.beginScope._wrap),ie=""):A.beginScope._multi&&(Tf(A.beginScope,_),ie="")),J=Object.create(A,{parent:{value:J}}),J}function Nf(A,_,Y){let te=C(A.endRe,Y);if(te){if(A["on:end"]){const Le=new e(A);A["on:end"](_,Le),Le.isMatchIgnored&&(te=!1)}if(te){for(;A.endsParent&&A.parent;)A=A.parent;return A}}if(A.endsWithParent)return Nf(A.parent,_,Y)}function _k(A){return J.matcher.regexIndex===0?(ie+=A[0],1):(xl=!0,0)}function Vk(A){const _=A[0],Y=A.rule,te=new e(Y),Le=[Y.__beforeBegin,Y["on:begin"]];for(const It of Le)if(It&&(It(A,te),te.isMatchIgnored))return _k(_);return Y.skip?ie+=_:(Y.excludeBegin&&(ie+=_),qe(),!Y.returnBegin&&!Y.excludeBegin&&(ie=_)),Of(Y,A),Y.returnBegin?0:_.length}function $k(A){const _=A[0],Y=z.substring(A.index),te=Nf(J,A,Y);if(!te)return Sf;const Le=J;J.endScope&&J.endScope._wrap?(qe(),bt(_,J.endScope._wrap)):J.endScope&&J.endScope._multi?(qe(),Tf(J.endScope,A)):Le.skip?ie+=_:(Le.returnEnd||Le.excludeEnd||(ie+=_),qe(),Le.excludeEnd&&(ie=_));do J.scope&&Ae.closeNode(),!J.skip&&!J.subLanguage&&(hs+=J.relevance),J=J.parent;while(J!==te.parent);return te.starts&&Of(te.starts,A),Le.returnEnd?0:_.length}function zk(){const A=[];for(let _=J;_!==wt;_=_.parent)_.scope&&A.unshift(_.scope);A.forEach(_=>Ae.openNode(_))}let fs={};function Af(A,_){const Y=_&&_[0];if(ie+=A,Y==null)return qe(),0;if(fs.type==="begin"&&_.type==="end"&&fs.index===_.index&&Y===""){if(ie+=z.slice(_.index,_.index+1),!me){const te=new Error(`0 width match regex (${v})`);throw te.languageName=v,te.badRule=fs.rule,te}return 1}if(fs=_,_.type==="begin")return Vk(_);if(_.type==="illegal"&&!Q){const te=new Error('Illegal lexeme "'+Y+'" for mode "'+(J.scope||"<unnamed>")+'"');throw te.mode=J,te}else if(_.type==="end"){const te=$k(_);if(te!==Sf)return te}if(_.type==="illegal"&&Y==="")return ie+=`
106
+ `,1;if(kl>1e5&&kl>_.index*3)throw new Error("potential infinite loop, way more iterations than matches");return ie+=Y,Y.length}const wt=nn(v);if(!wt)throw Sn(ge.replace("{}",v)),new Error('Unknown language: "'+v+'"');const Hk=xk(wt);let wl="",J=re||Hk;const Df={},Ae=new I.__emitter(I);zk();let ie="",hs=0,Cn=0,kl=0,xl=!1;try{if(wt.__emitTokens)wt.__emitTokens(z,Ae);else{for(J.matcher.considerAll();;){kl++,xl?xl=!1:J.matcher.considerAll(),J.matcher.lastIndex=Cn;const A=J.matcher.exec(z);if(!A)break;const _=z.substring(Cn,A.index),Y=Af(_,A);Cn=A.index+Y}Af(z.substring(Cn))}return Ae.finalize(),wl=Ae.toHTML(),{language:v,value:wl,relevance:hs,illegal:!1,_emitter:Ae,_top:J}}catch(A){if(A.message&&A.message.includes("Illegal"))return{language:v,value:ml(z),illegal:!0,relevance:0,_illegalBy:{message:A.message,index:Cn,context:z.slice(Cn-100,Cn+100),mode:A.mode,resultSoFar:wl},_emitter:Ae};if(me)return{language:v,value:ml(z),illegal:!1,relevance:0,errorRaised:A,_emitter:Ae,_top:J};throw A}}function gl(v){const z={value:ml(v),illegal:!1,relevance:0,_top:L,_emitter:new I.__emitter(I)};return z._emitter.addText(v),z}function yl(v,z){z=z||I.languages||Object.keys(x);const Q=gl(v),re=z.filter(nn).filter(vf).map(qe=>Tr(qe,v,!1));re.unshift(Q);const xe=re.sort((qe,bt)=>{if(qe.relevance!==bt.relevance)return bt.relevance-qe.relevance;if(qe.language&&bt.language){if(nn(qe.language).supersetOf===bt.language)return 1;if(nn(bt.language).supersetOf===qe.language)return-1}return 0}),[ot,rn]=xe,us=ot;return us.secondBest=rn,us}function vk(v,z,Q){const re=z&&O[z]||Q;v.classList.add("hljs"),v.classList.add(`language-${re}`)}function bl(v){let z=null;const Q=ve(v);if(W(Q))return;if(ds("before:highlightElement",{el:v,language:Q}),v.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",v);return}if(v.children.length>0&&(I.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(v)),I.throwUnescapedHTML))throw new Ek("One of your code blocks includes unescaped HTML.",v.innerHTML);z=v;const re=z.textContent,xe=Q?we(re,{language:Q,ignoreIllegals:!0}):yl(re);v.innerHTML=xe.value,v.dataset.highlighted="yes",vk(v,Q,xe.language),v.result={language:xe.language,re:xe.relevance,relevance:xe.relevance},xe.secondBest&&(v.secondBest={language:xe.secondBest.language,relevance:xe.secondBest.relevance}),ds("after:highlightElement",{el:v,result:xe,text:re})}function Tk(v){I=xf(I,v)}const Ok=()=>{cs(),Un("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function Nk(){cs(),Un("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let Ef=!1;function cs(){function v(){cs()}if(document.readyState==="loading"){Ef||window.addEventListener("DOMContentLoaded",v,!1),Ef=!0;return}document.querySelectorAll(I.cssSelector).forEach(bl)}function Ak(v,z){let Q=null;try{Q=z(b)}catch(re){if(Sn("Language definition for '{}' could not be registered.".replace("{}",v)),me)Sn(re);else throw re;Q=L}Q.name||(Q.name=v),x[v]=Q,Q.rawDefinition=z.bind(null,b),Q.aliases&&Mf(Q.aliases,{languageName:v})}function Dk(v){delete x[v];for(const z of Object.keys(O))O[z]===v&&delete O[z]}function Rk(){return Object.keys(x)}function nn(v){return v=(v||"").toLowerCase(),x[v]||x[O[v]]}function Mf(v,{languageName:z}){typeof v=="string"&&(v=[v]),v.forEach(Q=>{O[Q.toLowerCase()]=z})}function vf(v){const z=nn(v);return z&&!z.disableAutodetect}function Ik(v){v["before:highlightBlock"]&&!v["before:highlightElement"]&&(v["before:highlightElement"]=z=>{v["before:highlightBlock"](Object.assign({block:z.el},z))}),v["after:highlightBlock"]&&!v["after:highlightElement"]&&(v["after:highlightElement"]=z=>{v["after:highlightBlock"](Object.assign({block:z.el},z))})}function Pk(v){Ik(v),q.push(v)}function Lk(v){const z=q.indexOf(v);z!==-1&&q.splice(z,1)}function ds(v,z){const Q=v;q.forEach(function(re){re[Q]&&re[Q](z)})}function Bk(v){return Un("10.7.0","highlightBlock will be removed entirely in v12.0"),Un("10.7.0","Please use highlightElement now."),bl(v)}Object.assign(b,{highlight:we,highlightAuto:yl,highlightAll:cs,highlightElement:bl,highlightBlock:Bk,configure:Tk,initHighlighting:Ok,initHighlightingOnLoad:Nk,registerLanguage:Ak,unregisterLanguage:Dk,listLanguages:Rk,getLanguage:nn,registerAliases:Mf,autoDetection:vf,inherit:xf,addPlugin:Pk,removePlugin:Lk}),b.debugMode=function(){me=!1},b.safeMode=function(){me=!0},b.versionString=Ck,b.regex={concat:g,lookahead:f,either:w,optional:p,anyNumberOfTimes:h};for(const v in ls)typeof ls[v]=="object"&&n(ls[v]);return Object.assign(b,ls),b},Wn=Cf({});return Wn.newInstance=()=>Cf({}),hl=Wn,Wn.HighlightJS=Wn,Wn.default=Wn,hl}var D1=A1();const R1=N1(D1);function af(n,e=[]){return n.flatMap(t=>{const r=[...e,...t.properties?t.properties.className:[]];return t.children?af(t.children,r):{text:t.value,classes:r}})}function cf(n){return n.value||n.children||[]}function I1(n){return!!R1.getLanguage(n)}function df({doc:n,name:e,lowlight:t,defaultLanguage:r}){const i=[];return co(n,s=>s.type.name===e).forEach(s=>{var o;let l=s.pos+1;const a=s.node.attrs.language||r,c=t.listLanguages(),d=a&&(c.includes(a)||I1(a)||(o=t.registered)!=null&&o.call(t,a))?cf(t.highlight(a,s.node.textContent)):cf(t.highlightAuto(s.node.textContent));af(d).forEach(u=>{const f=l+u.text.length;if(u.classes.length){const h=Ie.inline(l,f,{class:u.classes.join(" ")});i.push(h)}l=f})}),ae.create(n,i)}function P1(n){return typeof n=="function"}function L1({name:n,lowlight:e,defaultLanguage:t}){if(!["highlight","highlightAuto","listLanguages"].every(i=>P1(e[i])))throw Error("You should provide an instance of lowlight to use the code-block-lowlight extension");const r=new se({key:new le("lowlight"),state:{init:(i,{doc:s})=>df({doc:s,name:n,lowlight:e,defaultLanguage:t}),apply:(i,s,o,l)=>{const a=o.selection.$head.parent.type.name,c=l.selection.$head.parent.type.name,d=co(o.doc,f=>f.type.name===n),u=co(l.doc,f=>f.type.name===n);return i.docChanged&&([a,c].includes(n)||u.length!==d.length||i.steps.some(f=>f.from!==void 0&&f.to!==void 0&&d.some(h=>h.pos>=f.from&&h.pos+h.node.nodeSize<=f.to)))?df({doc:i.doc,name:n,lowlight:e,defaultLanguage:t}):s.map(i.mapping,i.doc)}},props:{decorations(i){return r.getState(i)}}});return r}var B1=Qy.extend({addOptions(){var n;return{...(n=this.parent)==null?void 0:n.call(this),lowlight:{},languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:4,HTMLAttributes:{}}},addProseMirrorPlugins(){var n;return[...((n=this.parent)==null?void 0:n.call(this))||[],L1({name:this.name,lowlight:this.options.lowlight,defaultLanguage:this.options.defaultLanguage})]}}),_1=B1;const V1=["onClick"],$1={class:"sus-code-block-content"},z1=Yt(m.defineComponent({__name:"CodeBlockView",props:{editor:{},node:{},updateAttributes:{type:Function},selected:{type:Boolean}},setup(n){const e=n,t=m.ref(!1),r=m.ref(null),i=m.computed(()=>e.node.attrs.language||""),s=m.computed(()=>{const c=uf.find(d=>d.value===i.value);return c?c.label:"纯文本"});function o(c){e.updateAttributes({language:c||null}),t.value=!1}function l(){t.value=!t.value}function a(c){r.value&&!r.value.contains(c.target)&&(t.value=!1)}return m.onMounted(()=>{document.addEventListener("click",a)}),m.onUnmounted(()=>{document.removeEventListener("click",a)}),(c,d)=>(m.openBlock(),m.createBlock(m.unref(Dy),{class:m.normalizeClass(["sus-code-block-wrapper",{"is-selected":n.selected}])},{default:m.withCtx(()=>[m.createElementVNode("div",{class:"sus-code-block-toolbar",ref_key:"languageSelectRef",ref:r},[m.createElementVNode("button",{onClick:m.withModifiers(l,["stop"]),class:"sus-code-block-language-btn",title:"选择语言"},[m.createElementVNode("span",null,m.toDisplayString(s.value),1),d[1]||(d[1]=m.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[m.createElementVNode("polyline",{points:"6 9 12 15 18 9"})],-1))]),t.value?(m.openBlock(),m.createElementBlock("div",{key:0,class:"sus-code-block-language-selector",onClick:d[0]||(d[0]=m.withModifiers(()=>{},["stop"]))},[(m.openBlock(!0),m.createElementBlock(m.Fragment,null,m.renderList(m.unref(uf),u=>(m.openBlock(),m.createElementBlock("div",{key:u.value,onClick:f=>o(u.value),class:m.normalizeClass(["sus-code-block-language-item",{active:i.value===u.value}])},m.toDisplayString(u.label),11,V1))),128))])):m.createCommentVNode("",!0)],512),m.createElementVNode("pre",$1,[d[2]||(d[2]=m.createTextVNode(" ",-1)),m.createElementVNode("code",null,[m.createVNode(m.unref(Ay))]),d[3]||(d[3]=m.createTextVNode(`
107
+ `,-1))])]),_:1},8,["class"]))}}),[["__scopeId","data-v-a07bc552"]]),H1=_f.createLowlight(),uf=[{value:"",label:"纯文本"},{value:"java",label:"Java"},{value:"python",label:"Python"},{value:"shell",label:"Shell"},{value:"yaml",label:"YAML"},{value:"javascript",label:"JavaScript"},{value:"html",label:"HTML"}],F1=_1.extend({addNodeView(){return Ly(z1)}}).configure({lowlight:H1,defaultLanguage:null}),j1={class:"sus-comment"},U1={key:0,class:"sus-comment-avatar"},W1=["src"],K1={class:"sus-avatar-text"},q1={class:"sus-comment__main"},J1={key:0,class:"sus-comment__info"},G1={key:0,class:"sus-comment__info-input"},Y1=["placeholder","title"],X1={key:1,class:"sus-comment__info-input"},Q1=["placeholder","title"],Z1={key:2,class:"sus-comment__info-input"},ew=["placeholder","title"],tw={class:"sus-comment__editor-wrapper"},nw={class:"sus-comment__footer"},rw={class:"sus-comment__footer-left"},iw={key:0,class:"sus-comment__footer-icon"},sw={key:1,class:"sus-upload sus-comment__footer-icon"},ow={class:"sus-comment__toolbar"},lw={class:"sus-comment__toolbar-mask"},aw={class:"sus-comment__extend"},cw=["src"],dw=["onClick"],ff=Yt(m.defineComponent({__name:"index",props:{reply:{},toolBar:{},infoBar:{},placeholder:{default:"支持常见的markdown语法,如图片、代码块等"},comment:{}},emits:["on-save","on-cancel","add-image","update-avatar"],setup(n,{expose:e,emit:t}){class r{articleId="";userName="";userEmail="";userWebsite="";userAvatar="";content="";contentText="";replyName="";parentId="";notify=0;privacy=!1}const i=n;e({updateImage:M,updatePreviewImage:T});const s=t,o=m.reactive({emojis:i.toolBar?.emoji?.emojis||[],showPanel:!1}),l=i.reply?.userName,a=m.ref("在此处留下你的足迹吧!(支持markdown语法)"),c=m.reactive(new r),d=m.ref(""),u=m.ref(null),f=m.ref([]),h=m.ref(null),p=i.comment?.privacy||!1,g={enable:i.infoBar?.enable===void 0?!0:i.infoBar.enable,name:{show:i.infoBar?.name?.show===void 0?!0:i.infoBar.name.show,placeholder:i.infoBar?.name?.placeholder||"昵称(必填)"},website:{show:i.infoBar?.website?.show===void 0?!0:i.infoBar.website.show,placeholder:i.infoBar?.website?.placeholder||"网址(https://)",tips:i.infoBar?.website?.tips||"点击昵称时可跳转"},email:{show:i.infoBar?.email?.show===void 0?!0:i.infoBar.email.show,placeholder:i.infoBar?.email?.placeholder||"邮箱(不会公开,仅用于通知回复)",tips:i.infoBar?.email?.tips||"输入QQ邮箱自动获取头像"}},y=Ry({extensions:[yb.configure({codeBlock:!1}),F1,kb,pb.configure({placeholder:i.placeholder}),R0.configure({openOnClick:!1,enableClickSelection:!0,HTMLAttributes:{class:"cursor-pointer",onclick:"return false;"}}),O1],editorProps:{handleDOMEvents:{mousedown:(U,R)=>R.target.closest("a")?(R.preventDefault(),R.stopPropagation(),setTimeout(()=>{y.value&&y.value.chain().focus().extendMarkRange("link").run()},0),!0):!1,click:(U,R)=>R.target.closest("a")?(R.preventDefault(),R.stopPropagation(),!0):!1}}});function w(){i.comment&&(c.privacy=i.comment.privacy===void 0?!1:i.comment.privacy,c.notify=i.comment.notify||1,c.userName=i.comment.userName||"",c.userEmail=i.comment.userEmail||"",c.userWebsite=i.comment.userWebsite||"",c.userAvatar=i.comment.userAvatar||"",c.content=i.comment.content||"",c.articleId=i.comment.articleId||"")}async function k(){if(!(!y||!y.value)){if(d.value=y.value.getHTML(),c.userWebsite&&(c.userWebsite.concat("http://")||c.userWebsite.concat("https://")||(c.userWebsite="https://"+c.userWebsite)),localStorage.setItem("user",JSON.stringify(c)),localStorage.setItem("comment-content",d.value),i.reply?.id&&i.reply?.id!="0"){const U=i.reply.parentId;c.parentId=U==="0"?i.reply.id:U,c.replyName=i.reply.userName,a.value="@"+l+":"}c.content=d.value,c.contentText=y.value.getText(),s("on-save",c,h.value)}}function C(){localStorage.setItem("comment-content",""),s("on-cancel")}function D(){s("add-image",u.value,h.value)}function M(U){h.value||(h.value=[]),!h.value||h.value.length==0?h.value=U:h.value=P(h.value,U[0]),f.value=[];for(let R=0;R<h.value.length;R++)f.value.push(URL.createObjectURL(h.value[R]))}function P(U,R){return[...U,R]}function T(U){f.value=U}function V(){s("update-avatar",c)}function K(){c.notify==1?c.notify=0:c.notify=1}function j(U){try{if(!h.value||!h.value.length||h.value.length<=1){h.value=[],f.value=[];return}h.value?.splice(U,1),f.value.splice(U,1)}catch(R){console.log("remove image error: ",R),h.value=[],f.value=[]}}return m.onMounted(()=>{if(!y||!y.value)return;w();const U=localStorage.getItem("user");if(c.content&&c.content.length>3)y.value.commands.setContent(c.content);else{const R=localStorage.getItem("comment-content");R&&y.value.commands.setContent(R)}if(U){const R=JSON.parse(U);c.userName=R.userName,c.userEmail=R.userEmail,c.userWebsite=R.userWebsite,V()}c.notify=1}),(U,R)=>(m.openBlock(),m.createElementBlock("div",j1,[g.enable?(m.openBlock(),m.createElementBlock("div",U1,[m.withDirectives(m.createElementVNode("img",{alt:"头像",src:c.userAvatar,class:"sus-avatar",onerror:"this.onerror=null,this.src='/error.webp'"},null,8,W1),[[m.vShow,!!c.userAvatar]]),m.withDirectives(m.createElementVNode("div",K1,[m.createElementVNode("span",null,m.toDisplayString(c?.userName?.charAt(0)),1)],512),[[m.vShow,!c.userAvatar]])])):m.createCommentVNode("",!0),m.createElementVNode("div",q1,[g.enable?(m.openBlock(),m.createElementBlock("div",J1,[g.name.show?(m.openBlock(),m.createElementBlock("div",G1,[m.withDirectives(m.createElementVNode("input",{class:"sus-input sus-username",placeholder:g.name.placeholder,title:g.name.placeholder,"onUpdate:modelValue":R[0]||(R[0]=X=>c.userName=X),maxlength:"23"},null,8,Y1),[[m.vModelText,c.userName]])])):m.createCommentVNode("",!0),g.website.show?(m.openBlock(),m.createElementBlock("div",X1,[m.createVNode(m.unref(qn.OuOToolTip),{content:g.website.tips},{default:m.withCtx(()=>[m.withDirectives(m.createElementVNode("input",{class:"sus-input sus-web",placeholder:g.website.placeholder,title:g.website.placeholder,"onUpdate:modelValue":R[1]||(R[1]=X=>c.userWebsite=X),maxlength:"35"},null,8,Q1),[[m.vModelText,c.userWebsite]])]),_:1},8,["content"])])):m.createCommentVNode("",!0),g.email.show?(m.openBlock(),m.createElementBlock("div",Z1,[m.createVNode(m.unref(qn.OuOToolTip),{content:g.email.tips},{default:m.withCtx(()=>[m.withDirectives(m.createElementVNode("input",{onBlur:V,class:"sus-input sus-email",placeholder:g.email.placeholder,title:g.email.placeholder,"onUpdate:modelValue":R[2]||(R[2]=X=>c.userEmail=X),maxlength:"35"},null,40,ew),[[m.vModelText,c.userEmail]])]),_:1},8,["content"])])):m.createCommentVNode("",!0)])):m.createCommentVNode("",!0),m.createElementVNode("div",tw,[m.createVNode(T1,{editor:m.unref(y),showMenu:n.toolBar?.bubbleMenu?.show},null,8,["editor","showMenu"]),m.withDirectives(m.createVNode($y,{class:"sus-emoji-panel-position",emoji:o,editor:m.unref(y)},null,8,["emoji","editor"]),[[m.vShow,o.showPanel]]),m.createVNode(m.unref(Ny),{class:"sus-comment-input",editor:m.unref(y)},null,8,["editor"])]),m.createElementVNode("div",nw,[m.createElementVNode("div",rw,[o.emojis.length>=0?(m.openBlock(),m.createElementBlock("div",iw,[(m.openBlock(),m.createElementBlock("svg",{title:"表情",onClick:R[3]||(R[3]=X=>o.showPanel=!o.showPanel),xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},[...R[5]||(R[5]=[m.createStaticVNode('<g fill="none" data-v-f4426d84><path stroke="currentColor" stroke-linecap="round" stroke-width="1.5" d="M9 16c.85.63 1.885 1 3 1s2.15-.37 3-1" data-v-f4426d84></path><path fill="currentColor" d="M16 10.5c0 .828-.448 1.5-1 1.5s-1-.672-1-1.5s.448-1.5 1-1.5s1 .672 1 1.5" data-v-f4426d84></path><ellipse cx="9" cy="10.5" fill="currentColor" rx="1" ry="1.5" data-v-f4426d84></ellipse><path stroke="currentColor" stroke-linecap="round" stroke-width="1.5" d="M7 3.338A9.95 9.95 0 0 1 12 2c5.523 0 10 4.477 10 10s-4.477 10-10 10S2 17.523 2 12c0-1.821.487-3.53 1.338-5" data-v-f4426d84></path></g>',1)])]))])):m.createCommentVNode("",!0),n.toolBar?.image?(m.openBlock(),m.createElementBlock("div",sw,[m.createElementVNode("input",{ref_key:"imgRef",ref:u,onChange:D,type:"file",id:"upload-input",name:"image",accept:"image/*"},null,544),R[6]||(R[6]=m.createStaticVNode('<label for="upload-input" data-v-f4426d84><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" data-v-f4426d84><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-width="1.5" data-v-f4426d84><path d="m2 12.5l1.752-1.533a2.3 2.3 0 0 1 3.14.105l4.29 4.29a2 2 0 0 0 2.564.222l.299-.21a3 3 0 0 1 3.731.225L21 18.5m-6-13h3.5m0 0H22m-3.5 0V9m0-3.5V2" data-v-f4426d84></path><path d="M22 12c0 4.714 0 7.071-1.465 8.535C19.072 22 16.714 22 12 22s-7.071 0-8.536-1.465C2 19.072 2 16.714 2 12c0-1.128 0-2.122.02-3M12 2C7.286 2 4.929 2 3.464 3.464c-.424.425-.726.925-.94 1.536" data-v-f4426d84></path></g></svg></label>',1))])):m.createCommentVNode("",!0),n.toolBar?.notify?(m.openBlock(),m.createElementBlock("div",{key:2,onClick:K,class:"sus-comment__footer-icon"},[m.withDirectives(m.createVNode(m.unref(qn.OuOToolTip),{content:"收到回复后通知"},{default:m.withCtx(()=>[...R[7]||(R[7]=[m.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},[m.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-width":"1.5",d:"M12 6v4m-4.5 9c.655 1.748 2.422 3 4.5 3q.367 0 .72-.05M16.5 19a4.5 4.5 0 0 1-1.302 1.84M9.107 2.674A6.5 6.5 0 0 1 12 2c3.727 0 6.75 3.136 6.75 7.005v.705a4.4 4.4 0 0 0 .692 2.375l1.108 1.724c1.011 1.575.239 3.716-1.52 4.214a25.8 25.8 0 0 1-14.06 0c-1.759-.498-2.531-2.639-1.52-4.213l1.108-1.725A4.4 4.4 0 0 0 5.25 9.71v-.705c0-1.074.233-2.092.65-3.002"})],-1)])]),_:1},512),[[m.vShow,c.notify===1]]),m.withDirectives(m.createVNode(m.unref(qn.OuOToolTip),{content:"收到回复后不通知"},{default:m.withCtx(()=>[...R[8]||(R[8]=[m.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},[m.createElementVNode("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-width":"1.5"},[m.createElementVNode("path",{"stroke-linejoin":"round",d:"M10 9h4l-4 4h4"}),m.createElementVNode("path",{d:"M7.5 19c.655 1.748 2.422 3 4.5 3q.367 0 .72-.05M16.5 19a4.5 4.5 0 0 1-1.302 1.84M9.107 2.674A6.5 6.5 0 0 1 12 2c3.727 0 6.75 3.136 6.75 7.005v.705a4.4 4.4 0 0 0 .692 2.375l1.108 1.724c1.011 1.575.239 3.716-1.52 4.214a25.8 25.8 0 0 1-14.06 0c-1.759-.498-2.531-2.639-1.52-4.213l1.108-1.725A4.4 4.4 0 0 0 5.25 9.71v-.705c0-1.074.233-2.092.65-3.002"})])],-1)])]),_:1},512),[[m.vShow,c.notify!==1]])])):m.createCommentVNode("",!0)]),m.createElementVNode("div",{class:"sus-comment__footer-send"},[m.createElementVNode("button",{class:"sus-button cancel",onClick:C},"取消"),m.createElementVNode("button",{class:"sus-button ok",onClick:k},"发送")])]),m.createElementVNode("div",ow,[m.withDirectives(m.createVNode(m.unref(qn.OuOCheckBox),{modelValue:c.privacy,"onUpdate:modelValue":R[4]||(R[4]=X=>c.privacy=X),checked:m.unref(p)},{default:m.withCtx(()=>[...R[9]||(R[9]=[m.createTextVNode(" 仅博主可见 ",-1)])]),_:1},8,["modelValue","checked"]),[[m.vShow,n.toolBar?.privacy?.show]]),m.withDirectives(m.createElementVNode("div",lw,null,512),[[m.vShow,n.toolBar?.privacy?.disable]])]),m.createElementVNode("div",aw,[(m.openBlock(!0),m.createElementBlock(m.Fragment,null,m.renderList(f.value,(X,Z)=>(m.openBlock(),m.createElementBlock("div",{class:"sus-comment__extend-img",key:X},[m.createElementVNode("img",{class:"img-item",src:X,alt:""},null,8,cw),m.createElementVNode("div",{onClick:ke=>j(Z),class:"mask"},[...R[10]||(R[10]=[m.createStaticVNode('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" data-v-f4426d84><g fill="none" stroke="currentColor" stroke-width="1.5" data-v-f4426d84><path stroke-linecap="round" d="M20.5 6h-17m6 5l.5 5m4.5-5l-.5 5" data-v-f4426d84></path><path d="M6.5 6h.11a2 2 0 0 0 1.83-1.32l.034-.103l.097-.291c.083-.249.125-.373.18-.479a1.5 1.5 0 0 1 1.094-.788C9.962 3 10.093 3 10.355 3h3.29c.262 0 .393 0 .51.019a1.5 1.5 0 0 1 1.094.788c.055.106.097.23.18.479l.097.291A2 2 0 0 0 17.5 6" data-v-f4426d84></path><path stroke-linecap="round" d="M18.374 15.4c-.177 2.654-.266 3.981-1.131 4.79s-2.195.81-4.856.81h-.774c-2.66 0-3.99 0-4.856-.81c-.865-.809-.953-2.136-1.13-4.79l-.46-6.9m13.666 0l-.2 3" data-v-f4426d84></path></g></svg>',1)])],8,dw)]))),128))])])]))}}),[["__scopeId","data-v-f4426d84"]]);function uw(n){const e=new Date(n),t=e.getFullYear(),r=e.getMonth()+1,i=e.getDate(),s=new Date,o=s.getFullYear(),l=s.getMonth()+1,a=s.getDate();if(o===t&&l==r){const c=a-i;if(c===0)return"今天";if(c<7)return c+"天前"}return o===t?`${r}月${i}日`:`${t}年${r}月${i}日`}const fw={class:"sus-item__container"},hw={class:"sus-item-svg",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},pw={class:"sus-item__row"},mw={class:"sus-item__operate"},gw={class:"sus-comment-aside"},yw={key:0,class:"sus-comment-avatar"},bw={key:0,class:"sus-avatar-text-container"},ww={class:"sus-avatar-text"},kw=["src"],xw={class:"sus-item-floor"},Sw={class:"sus-item__main"},Cw={class:"sus-item__user"},Ew=["rel","href"],Mw={key:0,class:"sus-item-tag",title:"博主"},vw={key:1,class:"sus-item__content-name"},Tw={class:"sus-item__user-date"},Ow={key:0,class:"sus-item__content"},Nw=["innerHTML"],Aw={key:1,class:"sus-item__content"},Dw=["innerHTML"],Rw={key:0,class:"sus-item__info"},Iw={class:"sus-item__info-area"},Pw={class:"sus-item__info-useragent"},ss=Yt(m.defineComponent({__name:"item",props:{comment:{},lineHeight:{},showFooter:{type:Boolean},num:{default:1}},emits:["on-reply","on-edit","on-remove"],setup(n,{emit:e}){const t=n,r=m.ref(),i=m.ref(),s=m.ref(!1),o=e;function l(){r.value.style.display="block",s.value=!1}function a(){const p=r?.value?.clientHeight||0,g=t.lineHeight*5;p>=g&&(s.value=!0)}function c(){o("on-reply",t.comment)}function d(){o("on-edit",t.comment)}function u(){o("on-remove",t.comment)}function f(){t.comment.userAvatar||(t.comment.userAvatar="/error.webp")}function h(){const p=new Date(t.comment?.createdDate),g=new Date,y=new Date(g.getFullYear()-1,g.getMonth(),g.getDate());return p>y?"ugc noopener nofollow":"ugc noopener noreferrer nofollow"}return m.onMounted(()=>{f(),a()}),(p,g)=>(m.openBlock(),m.createElementBlock("div",fw,[m.withDirectives((m.openBlock(),m.createElementBlock("svg",hw,[...g[0]||(g[0]=[m.createElementVNode("rect",{width:"24",height:"24",fill:"none"},null,-1),m.createElementVNode("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-width":"1.5"},[m.createElementVNode("path",{d:"M21 7v-.281c0-2.19 0-3.285-.707-3.884c-.707-.6-1.788-.42-3.95-.059l-1.055.176c-1.64.273-2.46.41-3.288.41s-1.648-.137-3.288-.41l-1.054-.176c-2.162-.36-3.243-.54-3.95.059S3 4.529 3 6.719V12c0 5.49 4.239 8.155 6.899 9.286c.721.307 1.082.46 2.101.46c1.02 0 1.38-.153 2.101-.46C16.761 20.155 21 17.49 21 12v-1"}),m.createElementVNode("path",{d:"M6.5 9c.291-.583 1.077-1 2-1s1.709.417 2 1m3 0c.291-.583 1.077-1 2-1s1.709.417 2 1m-9 5s1.05 1 3.5 1s3.5-1 3.5-1"})],-1)])],512)),[[m.vShow,n.comment.band==="privacy"]]),m.createElementVNode("div",pw,[m.createElementVNode("div",mw,[m.withDirectives(m.createElementVNode("span",{onClick:u,class:"sus-item__operate-delete"}," 删除 ",512),[[m.vShow,!n.comment.privacy&&n.comment.showDelete]]),m.withDirectives(m.createElementVNode("span",{onClick:d,class:"sus-item__operate-edit"}," 编辑 ",512),[[m.vShow,!n.comment.privacy&&n.comment.showEdit]]),m.withDirectives(m.createElementVNode("span",{onClick:c,class:"sus-item__operate-reply"}," 回复 ",512),[[m.vShow,!n.comment.privacy]])]),m.createElementVNode("div",gw,[n.comment.avatarDisplay!=="none"?(m.openBlock(),m.createElementBlock("div",yw,[n.comment.avatarDisplay==="text"||!n.comment.userAvatar?(m.openBlock(),m.createElementBlock("div",bw,[m.createElementVNode("div",ww,[m.createElementVNode("span",null,m.toDisplayString(n.comment.userName.charAt(0)),1)])])):(m.openBlock(),m.createElementBlock("img",{key:1,alt:"",class:"sus-avatar",src:n.comment.userAvatar,onerror:"this.onerror=null,this.src='/error.webp'"},null,8,kw))])):m.createCommentVNode("",!0),m.createElementVNode("p",xw,m.toDisplayString(n.num),1)]),m.createElementVNode("div",Sw,[m.createElementVNode("div",Cw,[m.createElementVNode("a",{target:"_blank",rel:h(),href:n.comment.userWebsite,class:m.normalizeClass([n.comment.tagName,"sus-item__user-name"])},m.toDisplayString(n.comment.userName),11,Ew),n.comment.tagName==="owner"?(m.openBlock(),m.createElementBlock("span",Mw," 博主 ")):m.createCommentVNode("",!0),n.comment.replyName?(m.openBlock(),m.createElementBlock("span",vw,"@"+m.toDisplayString(n.comment.replyName),1)):m.createCommentVNode("",!0),m.createElementVNode("span",Tw,m.toDisplayString(m.unref(uw)(n.comment.createdDate)),1)]),n.comment.privacy?(m.openBlock(),m.createElementBlock("div",Ow,[g[1]||(g[1]=m.createElementVNode("div",{class:"sus-item-privacy"},null,-1)),m.createElementVNode("span",{class:"sus-item-privacy-text",innerHTML:n.comment.content},null,8,Nw)])):(m.openBlock(),m.createElementBlock("div",Aw,[m.createElementVNode("span",{ref_key:"contentDom",ref:r,class:"sus-item__content-text",innerHTML:n.comment.content+(n.comment.contentExtends||"")},null,8,Dw),s.value?(m.openBlock(),m.createElementBlock("a",{key:0,ref_key:"showMoreDom",ref:i,class:"sus-show-detail",onClick:l},"显示更多>",512)):m.createCommentVNode("",!0)]))])]),n.showFooter&&n.comment.area&&!n.comment.privacy?(m.openBlock(),m.createElementBlock("div",Rw,[m.createElementVNode("span",Iw,[g[2]||(g[2]=m.createElementVNode("svg",{class:"sus-svg",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},[m.createElementVNode("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-width":"1.5"},[m.createElementVNode("path",{d:"M12.5 7.041A3 3 0 1 0 14.959 9.5"}),m.createElementVNode("path",{d:"M5 15.216c-.647-1.654-1-3.415-1-5.073C4 5.646 7.582 2 12 2s8 3.646 8 8.143c0 4.462-2.553 9.67-6.537 11.531a3.45 3.45 0 0 1-2.926 0C9.265 21.08 8.138 20.144 7.194 19"})])],-1)),m.createTextVNode(" "+m.toDisplayString(n.comment.area),1)]),m.createElementVNode("span",Pw,[g[3]||(g[3]=m.createElementVNode("svg",{class:"sus-svg",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},[m.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-width":"1.5",d:"M5 2.252c-.774.169-1.359.45-1.828.92C2 4.343 2 6.229 2 10v1c0 2.828 0 4.243.879 5.121C3.757 17 5.172 17 8 17h8c2.828 0 4.243 0 5.121-.879C22 15.243 22 13.828 22 11v-1c0-3.771 0-5.657-1.172-6.828S17.771 2 14 2H9m7 20H8m4-5v5m10-9h-6M2 13h10"})],-1)),m.createTextVNode(" "+m.toDisplayString(n.comment.userAgent),1)])])):m.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-40d615a8"]]),Lw={class:"sus-comment__item"},Bw={key:0,class:"sus-comment__item-child"},_w={key:1},Vw={key:0,class:"sus-comment__item-footer"},hf=Yt(m.defineComponent({__name:"index",props:{comment:{},lineHeight:{default:23},showFooter:{type:Boolean,default:!1}},emits:["on-reply","on-edit","on-remove"],setup(n,{emit:e}){const t=m.ref(!1),r=e;function i(l){r("on-reply",l)}function s(l){r("on-edit",l)}function o(l){r("on-remove",l)}return(l,a)=>(m.openBlock(),m.createElementBlock("div",Lw,[m.createVNode(ss,{comment:n.comment,onOnReply:a[0]||(a[0]=c=>i(n.comment)),onOnEdit:a[1]||(a[1]=c=>s(n.comment)),onOnRemove:a[2]||(a[2]=c=>o(n.comment)),lineHeight:n.lineHeight,showFooter:n.showFooter},null,8,["comment","lineHeight","showFooter"]),n.comment.child?.length>0?(m.openBlock(),m.createElementBlock("div",Bw,[m.createVNode(ss,{onOnReply:a[3]||(a[3]=c=>i(n.comment.child[0])),onOnEdit:a[4]||(a[4]=c=>s(n.comment.child[0])),onOnRemove:a[5]||(a[5]=c=>o(n.comment.child[0])),comment:n.comment.child[0],num:2,showFooter:n.showFooter,lineHeight:n.lineHeight,class:"sus-comment__item-child__item"},null,8,["comment","showFooter","lineHeight"]),n.comment.child?.length>1?(m.openBlock(),m.createBlock(ss,{key:0,onOnReply:a[6]||(a[6]=c=>i(n.comment.child[1])),onOnEdit:a[7]||(a[7]=c=>s(n.comment.child[1])),onOnRemove:a[8]||(a[8]=c=>o(n.comment.child[1])),comment:n.comment.child[1],num:3,showFooter:n.showFooter,lineHeight:n.lineHeight,class:"sus-comment__item-child__item"},null,8,["comment","showFooter","lineHeight"])):m.createCommentVNode("",!0),n.comment.child?.length>2?(m.openBlock(),m.createElementBlock("div",_w,[t.value?m.createCommentVNode("",!0):(m.openBlock(),m.createElementBlock("div",Vw,[m.createElementVNode("p",{class:"sus-load-more",onClick:a[9]||(a[9]=c=>t.value=!0)}," 查看更多回复 > ")])),t.value?(m.openBlock(!0),m.createElementBlock(m.Fragment,{key:1},m.renderList(n.comment.child.slice(2),(c,d)=>(m.openBlock(),m.createBlock(ss,{onOnReply:u=>i(c),onOnEdit:u=>s(c),onOnRemove:u=>o(c),key:d,comment:c,num:4+d,showFooter:n.showFooter,lineHeight:n.lineHeight,class:"sus-comment__item-child__item"},null,8,["onOnReply","onOnEdit","onOnRemove","comment","num","showFooter","lineHeight"]))),128)):m.createCommentVNode("",!0)])):m.createCommentVNode("",!0)])):m.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-170ec605"]]),$w={class:"sus-top-item"},zw={class:"sus-top-item__info"},Hw={class:"sus-top-item__user"},Fw={key:0,class:"sus-top-item__reply"},jw=["innerHTML"],pf=Yt(m.defineComponent({__name:"simple",props:{comment:{}},setup(n){return(e,t)=>(m.openBlock(),m.createElementBlock("div",$w,[m.createElementVNode("div",zw,[m.createElementVNode("span",Hw,m.toDisplayString(n.comment.userName)+": ",1),n.comment.replyName?(m.openBlock(),m.createElementBlock("span",Fw,m.toDisplayString("@"+n.comment.replyName),1)):m.createCommentVNode("",!0)]),m.createElementVNode("span",{class:"sus-top-item__content",innerHTML:n.comment.content},null,8,jw)]))}}),[["__scopeId","data-v-f6f1f9aa"]]),Uw={class:"sus-top-item__user"},Ww={key:0,class:"sus-top-item__user-avatar"},Kw=["src"],qw={class:"sus-top-item__user-owner"},Jw={class:"sus-top-item__user-reply"},Gw=["innerHTML"],mf=Yt(m.defineComponent({__name:"index",props:{comment:{}},emits:["go-local"],setup(n,{emit:e}){const t=e;function r(){t("go-local")}return(i,s)=>(m.openBlock(),m.createElementBlock("div",{class:"sus-top-item",onClick:r},[m.createElementVNode("div",Uw,[n.comment.userAvatar?(m.openBlock(),m.createElementBlock("div",Ww,[m.createElementVNode("img",{alt:"",class:"sus-avatar",loading:"lazy",decoding:"async",src:n.comment.userAvatar,onerror:"this.onerror=null,this.src='/error.webp'"},null,8,Kw)])):m.createCommentVNode("",!0),m.createElementVNode("div",qw,m.toDisplayString(n.comment.userName),1),m.createElementVNode("div",Jw,m.toDisplayString(n.comment.replyName?"@"+n.comment.replyName:""),1)]),m.createElementVNode("div",{class:"sus-top-item__content",innerHTML:n.comment.content},null,8,Gw)]))}}),[["__scopeId","data-v-250e2f2a"]]),Yw=[ff,hf,mf,pf],Xw={install(n){Yw.forEach(e=>{n.component(e.name,e)})}};je.SuSComment=ff,je.SuSList=hf,je.SuSSimpleTop=pf,je.SuSTop=mf,je.default=Xw,Object.defineProperties(je,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));