=g){p=M;break}m+=f[M].length+1}const x=((a=f[p].match(/^ */))==null?void 0:a[0])||"",C=Math.min(x.length,t);if(C===0)return!0;let v=u;for(let M=0;M{const{from:a,to:c}=s,h=r.doc.textBetween(a,c,`
+`,`
+`).split(`
+`).map(f=>{var p;const m=((p=f.match(/^ */))==null?void 0:p[0])||"",g=Math.min(m.length,t);return f.slice(g)}).join(`
+`);return l.replaceWith(a,c,r.schema.text(h)),!0})},Enter:({editor:n})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=n,{selection:t}=e,{$from:r,empty:s}=t;if(!s||r.parent.type!==this.type)return!1;const i=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(`
+
+`);return!i||!o?!1:n.chain().command(({tr:l})=>(l.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:n})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=n,{selection:t,doc:r}=e,{$from:s,empty:i}=t;if(!i||s.parent.type!==this.type||!(s.parentOffset===s.parent.nodeSize-2))return!1;const l=s.after();return l===void 0?!1:r.nodeAt(l)?n.commands.command(({tr:c})=>(c.setSelection(z.near(r.resolve(l))),!0)):n.commands.exitCode()}}},addInputRules(){return[Co({find:Px,type:this.type,getAttributes:n=>({language:n[1]})}),Co({find:zx,type:this.type,getAttributes:n=>({language:n[1]})})]},addProseMirrorPlugins(){return[new G({key:new re("codeBlockVSCodeHandler"),props:{handlePaste:(n,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const t=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),s=r?JSON.parse(r):void 0,i=s==null?void 0:s.mode;if(!t||!i)return!1;const{tr:o,schema:l}=n.state,a=l.text(t.replace(/\r\n?/g,`
+`));return o.replaceSelectionWith(this.type.create({language:i},a)),o.selection.$from.parent.type!==this.type&&o.setSelection(P.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),n.dispatch(o),!0}}})]}}),$x=Ce.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
+
+`):""}),Fx=Ce.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:n}){return["br",J(this.options.HTMLAttributes,n)]},renderText(){return`
+`},renderMarkdown:()=>`
+`,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:n,chain:e,state:t,editor:r})=>n.first([()=>n.exitCode(),()=>n.command(()=>{const{selection:s,storedMarks:i}=t;if(s.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:l}=r.extensionManager,a=i||s.$to.parentOffset&&s.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:u})=>{if(u&&a&&o){const d=a.filter(h=>l.includes(h.type.name));c.ensureMarks(d)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),Hx=Ce.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(n=>({tag:`h${n}`,attrs:{level:n}}))},renderHTML({node:n,HTMLAttributes:e}){return[`h${this.options.levels.includes(n.attrs.level)?n.attrs.level:this.options.levels[0]}`,J(this.options.HTMLAttributes,e),0]},parseMarkdown:(n,e)=>e.createNode("heading",{level:n.depth||1},e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>{var t;const r=(t=n.attrs)!=null&&t.level?parseInt(n.attrs.level,10):1,s="#".repeat(r);return n.content?`${s} ${e.renderChildren(n.content)}`:""},addCommands(){return{setHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.setNode(this.name,n):!1,toggleHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.toggleNode(this.name,"paragraph",n):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((n,e)=>({...n,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(n=>Co({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}}),_x=Ce.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:n}){return["hr",J(this.options.HTMLAttributes,n)]},markdownTokenName:"hr",parseMarkdown:(n,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:n,state:e})=>{if(!Ub(e,e.schema.nodes[this.name]))return!1;const{selection:t}=e,{$to:r}=t,s=n();return ch(t)?s.insertContentAt(r.pos,{type:this.name}):s.insertContent({type:this.name}),s.command(({state:i,tr:o,dispatch:l})=>{if(l){const{$to:a}=o.selection,c=a.end();if(a.nodeAfter)a.nodeAfter.isTextblock?o.setSelection(P.create(o.doc,a.pos+1)):a.nodeAfter.isBlock?o.setSelection(I.create(o.doc,a.pos)):o.setSelection(P.create(o.doc,a.pos));else{const u=i.schema.nodes[this.options.nextNodeType]||a.parent.type.contentMatch.defaultType,d=u==null?void 0:u.create();d&&(o.insert(c,d),o.setSelection(P.create(o.doc,c+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[Mh({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),jx=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,Vx=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,Wx=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,qx=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Ux=Jt.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:n=>n.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:n=>n.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:n}){return["em",J(this.options.HTMLAttributes,n),0]},addCommands(){return{setItalic:()=>({commands:n})=>n.setMark(this.name),toggleItalic:()=>({commands:n})=>n.toggleMark(this.name),unsetItalic:()=>({commands:n})=>n.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(n,e)=>e.applyMark("italic",e.parseInline(n.tokens||[])),markdownOptions:{htmlReopen:{open:"",close:""}},renderMarkdown:(n,e)=>`*${e.renderChildren(n)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[bn({find:jx,type:this.type}),bn({find:Wx,type:this.type})]},addPasteRules(){return[Wt({find:Vx,type:this.type}),Wt({find:qx,type:this.type})]}});const Kx="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",Jx="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",Oo="numeric",Ro="ascii",Io="alpha",rr="asciinumeric",Jn="alphanumeric",Do="domain",rf="emoji",Gx="scheme",Yx="slashscheme",Hi="whitespace";function Xx(n,e){return n in e||(e[n]=[]),e[n]}function It(n,e,t){e[Oo]&&(e[rr]=!0,e[Jn]=!0),e[Ro]&&(e[rr]=!0,e[Io]=!0),e[rr]&&(e[Jn]=!0),e[Io]&&(e[Jn]=!0),e[Jn]&&(e[Do]=!0),e[rf]&&(e[Do]=!0);for(const r in e){const s=Xx(r,t);s.indexOf(n)<0&&s.push(n)}}function Qx(n,e){const t={};for(const r in e)e[r].indexOf(n)>=0&&(t[r]=!0);return t}function Te(n=null){this.j={},this.jr=[],this.jd=null,this.t=n}Te.groups={};Te.prototype={accepts(){return!!this.t},go(n){const e=this,t=e.j[n];if(t)return t;for(let r=0;rn.ta(e,t,r,s),X=(n,e,t,r,s)=>n.tr(e,t,r,s),Nc=(n,e,t,r,s)=>n.ts(e,t,r,s),S=(n,e,t,r,s)=>n.tt(e,t,r,s),Xe="WORD",Lo="UWORD",sf="ASCIINUMERICAL",of="ALPHANUMERICAL",xr="LOCALHOST",Po="TLD",zo="UTLD",is="SCHEME",cn="SLASH_SCHEME",El="NUM",Bo="WS",Cl="NL",sr="OPENBRACE",ir="CLOSEBRACE",ws="OPENBRACKET",vs="CLOSEBRACKET",Es="OPENPAREN",Cs="CLOSEPAREN",Ts="OPENANGLEBRACKET",Ms="CLOSEANGLEBRACKET",As="FULLWIDTHLEFTPAREN",Ns="FULLWIDTHRIGHTPAREN",Os="LEFTCORNERBRACKET",Rs="RIGHTCORNERBRACKET",Is="LEFTWHITECORNERBRACKET",Ds="RIGHTWHITECORNERBRACKET",Ls="FULLWIDTHLESSTHAN",Ps="FULLWIDTHGREATERTHAN",zs="AMPERSAND",Bs="APOSTROPHE",$s="ASTERISK",ft="AT",Fs="BACKSLASH",Hs="BACKTICK",_s="CARET",Dt="COLON",Tl="COMMA",js="DOLLAR",je="DOT",Vs="EQUALS",Ml="EXCLAMATION",Oe="HYPHEN",or="PERCENT",Ws="PIPE",qs="PLUS",Us="POUND",lr="QUERY",Al="QUOTE",lf="FULLWIDTHMIDDLEDOT",Nl="SEMI",Ve="SLASH",ar="TILDE",Ks="UNDERSCORE",af="EMOJI",Js="SYM";var cf=Object.freeze({__proto__:null,ALPHANUMERICAL:of,AMPERSAND:zs,APOSTROPHE:Bs,ASCIINUMERICAL:sf,ASTERISK:$s,AT:ft,BACKSLASH:Fs,BACKTICK:Hs,CARET:_s,CLOSEANGLEBRACKET:Ms,CLOSEBRACE:ir,CLOSEBRACKET:vs,CLOSEPAREN:Cs,COLON:Dt,COMMA:Tl,DOLLAR:js,DOT:je,EMOJI:af,EQUALS:Vs,EXCLAMATION:Ml,FULLWIDTHGREATERTHAN:Ps,FULLWIDTHLEFTPAREN:As,FULLWIDTHLESSTHAN:Ls,FULLWIDTHMIDDLEDOT:lf,FULLWIDTHRIGHTPAREN:Ns,HYPHEN:Oe,LEFTCORNERBRACKET:Os,LEFTWHITECORNERBRACKET:Is,LOCALHOST:xr,NL:Cl,NUM:El,OPENANGLEBRACKET:Ts,OPENBRACE:sr,OPENBRACKET:ws,OPENPAREN:Es,PERCENT:or,PIPE:Ws,PLUS:qs,POUND:Us,QUERY:lr,QUOTE:Al,RIGHTCORNERBRACKET:Rs,RIGHTWHITECORNERBRACKET:Ds,SCHEME:is,SEMI:Nl,SLASH:Ve,SLASH_SCHEME:cn,SYM:Js,TILDE:ar,TLD:Po,UNDERSCORE:Ks,UTLD:zo,UWORD:Lo,WORD:Xe,WS:Bo});const Je=/[a-z]/,Nn=new RegExp("\\p{L}","u"),_i=new RegExp("\\p{Emoji}","u"),Ge=/\d/,ji=/\s/,Oc="\r",Vi=`
+`,Zx="️",eS="",Wi="";let _r=null,jr=null;function tS(n=[]){const e={};Te.groups=e;const t=new Te;_r==null&&(_r=Rc(Kx)),jr==null&&(jr=Rc(Jx)),S(t,"'",Bs),S(t,"{",sr),S(t,"}",ir),S(t,"[",ws),S(t,"]",vs),S(t,"(",Es),S(t,")",Cs),S(t,"<",Ts),S(t,">",Ms),S(t,"(",As),S(t,")",Ns),S(t,"「",Os),S(t,"」",Rs),S(t,"『",Is),S(t,"』",Ds),S(t,"<",Ls),S(t,">",Ps),S(t,"&",zs),S(t,"*",$s),S(t,"@",ft),S(t,"`",Hs),S(t,"^",_s),S(t,":",Dt),S(t,",",Tl),S(t,"$",js),S(t,".",je),S(t,"=",Vs),S(t,"!",Ml),S(t,"-",Oe),S(t,"%",or),S(t,"|",Ws),S(t,"+",qs),S(t,"#",Us),S(t,"?",lr),S(t,'"',Al),S(t,"/",Ve),S(t,";",Nl),S(t,"~",ar),S(t,"_",Ks),S(t,"\\",Fs),S(t,"・",lf);const r=X(t,Ge,El,{[Oo]:!0});X(r,Ge,r);const s=X(r,Je,sf,{[rr]:!0}),i=X(r,Nn,of,{[Jn]:!0}),o=X(t,Je,Xe,{[Ro]:!0});X(o,Ge,s),X(o,Je,o),X(s,Ge,s),X(s,Je,s);const l=X(t,Nn,Lo,{[Io]:!0});X(l,Je),X(l,Ge,i),X(l,Nn,l),X(i,Ge,i),X(i,Je),X(i,Nn,i);const a=S(t,Vi,Cl,{[Hi]:!0}),c=S(t,Oc,Bo,{[Hi]:!0}),u=X(t,ji,Bo,{[Hi]:!0});S(t,Wi,u),S(c,Vi,a),S(c,Wi,u),X(c,ji,u),S(u,Oc),S(u,Vi),X(u,ji,u),S(u,Wi,u);const d=X(t,_i,af,{[rf]:!0});S(d,"#"),X(d,_i,d),S(d,Zx,d);const h=S(d,eS);S(h,"#"),X(h,_i,d);const f=[[Je,o],[Ge,s]],p=[[Je,null],[Nn,l],[Ge,i]];for(let m=0;m<_r.length;m++)lt(t,_r[m],Po,Xe,f);for(let m=0;mm[0]>g[0]?1:-1);for(let m=0;m=0?x[Do]=!0:Je.test(g)?Ge.test(g)?x[rr]=!0:x[Ro]=!0:x[Oo]=!0,Nc(t,g,g,x)}return Nc(t,"localhost",xr,{ascii:!0}),t.jd=new Te(Js),{start:t,tokens:Object.assign({groups:e},cf)}}function uf(n,e){const t=nS(e.replace(/[A-Z]/g,l=>l.toLowerCase())),r=t.length,s=[];let i=0,o=0;for(;o=0&&(d+=t[o].length,h++),c+=t[o].length,i+=t[o].length,o++;i-=d,o-=h,c-=d,s.push({t:u.t,v:e.slice(i-c,i),s:i-c,e:i})}return s}function nS(n){const e=[],t=n.length;let r=0;for(;r56319||r+1===t||(i=n.charCodeAt(r+1))<56320||i>57343?n[r]:n.slice(r,r+2);e.push(o),r+=o.length}return e}function lt(n,e,t,r,s){let i;const o=e.length;for(let l=0;l=0;)i++;if(i>0){e.push(t.join(""));for(let o=parseInt(n.substring(r,r+i),10);o>0;o--)t.pop();r+=i}else t.push(n[r]),r++}return e}const Sr={defaultProtocol:"http",events:null,format:Ic,formatHref:Ic,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Ol(n,e=null){let t=Object.assign({},Sr);n&&(t=Object.assign(t,n instanceof Ol?n.o:n));const r=t.ignoreTags,s=[];for(let i=0;it?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=Sr.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),s=n.get("tagName",t,e),i=this.toFormattedString(n),o={},l=n.get("className",t,e),a=n.get("target",t,e),c=n.get("rel",t,e),u=n.getObj("attributes",t,e),d=n.getObj("events",t,e);return o.href=r,l&&(o.class=l),a&&(o.target=a),c&&(o.rel=c),u&&Object.assign(o,u),{tagName:s,attributes:o,content:i,eventListeners:d}}};function hi(n,e){class t extends df{constructor(s,i){super(s,i),this.t=n}}for(const r in e)t.prototype[r]=e[r];return t.t=n,t}const rS=hi("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Dc=hi("text"),sS=hi("nl"),Vr=hi("url",{isLink:!0,toHref(n=Sr.defaultProtocol){return this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==xr&&n[1].t===Dt}}),Ne=n=>new Te(n);function iS({groups:n}){const e=n.domain.concat([zs,$s,ft,Fs,Hs,_s,js,Vs,Oe,El,or,Ws,qs,Us,Ve,Js,ar,Ks]),t=[Bs,Dt,Tl,je,Ml,or,lr,Al,Nl,Ts,Ms,sr,ir,vs,ws,Es,Cs,As,Ns,Os,Rs,Is,Ds,Ls,Ps],r=[zs,Bs,$s,Fs,Hs,_s,js,Vs,Oe,sr,ir,or,Ws,qs,Us,lr,Ve,Js,ar,Ks],s=Ne(),i=S(s,ar);B(i,r,i),B(i,n.domain,i);const o=Ne(),l=Ne(),a=Ne();B(s,n.domain,o),B(s,n.scheme,l),B(s,n.slashscheme,a),B(o,r,i),B(o,n.domain,o);const c=S(o,ft);S(i,ft,c),S(l,ft,c),S(a,ft,c);const u=S(i,je);B(u,r,i),B(u,n.domain,i);const d=Ne();B(c,n.domain,d),B(d,n.domain,d);const h=S(d,je);B(h,n.domain,d);const f=Ne(rS);B(h,n.tld,f),B(h,n.utld,f),S(c,xr,f);const p=S(d,Oe);S(p,Oe,p),B(p,n.domain,d),B(f,n.domain,d),S(f,je,h),S(f,Oe,p);const m=S(o,Oe),g=S(o,je);S(m,Oe,m),B(m,n.domain,o),B(g,r,i),B(g,n.domain,o);const y=Ne(Vr);B(g,n.tld,y),B(g,n.utld,y),B(y,n.domain,o),B(y,r,i),S(y,je,g),S(y,Oe,m),S(y,ft,c);const x=S(y,Dt),C=Ne(Vr);B(x,n.numeric,C);const v=Ne(Vr),k=Ne();B(v,e,v),B(v,t,k),B(k,e,v),B(k,t,k),S(y,Ve,v),S(C,Ve,v);const M=S(l,Dt),T=S(a,Dt),L=S(T,Ve),O=S(L,Ve);B(l,n.domain,o),S(l,je,g),S(l,Oe,m),B(a,n.domain,o),S(a,je,g),S(a,Oe,m),B(M,n.domain,v),S(M,Ve,v),S(M,lr,v),B(O,n.domain,v),B(O,e,v),S(O,Ve,v);const $=[[sr,ir],[ws,vs],[Es,Cs],[Ts,Ms],[As,Ns],[Os,Rs],[Is,Ds],[Ls,Ps]];for(let de=0;de<$.length;de++){const[se,ne]=$[de],H=S(v,se);S(k,se,H);const U=Ne(Vr);B(H,e,U);const ot=Ne();B(H,t,ot),S(H,ne,v),B(U,e,U),B(U,t,ot),B(ot,e,U),B(ot,t,ot),S(U,ne,v),S(ot,ne,v)}return S(s,xr,y),S(s,Cl,sS),{start:s,tokens:cf}}function oS(n,e,t){let r=t.length,s=0,i=[],o=[];for(;s=0&&h++,s++,u++;if(h<0)s-=u,s0&&(i.push(qi(Dc,e,o)),o=[]),s-=h,u-=h;const f=d.t,p=t.slice(s-u,s);i.push(qi(f,e,p))}}return o.length>0&&i.push(qi(Dc,e,o)),i}function qi(n,e,t){const r=t[0].s,s=t[t.length-1].e,i=e.slice(r,s);return new n(i,t)}const lS=typeof console<"u"&&console&&console.warn||(()=>{}),aS="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",q={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function cS(){return Te.groups={},q.scanner=null,q.parser=null,q.tokenQueue=[],q.pluginQueue=[],q.customSchemes=[],q.initialized=!1,q}function Lc(n,e=!1){if(q.initialized&&lS(`linkifyjs: already initialized - will not register custom scheme "${n}" ${aS}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format.
+1. Must only contain digits, lowercase ASCII letters or "-"
+2. Cannot start or end with "-"
+3. "-" cannot repeat`);q.customSchemes.push([n,e])}function uS(){q.scanner=tS(q.customSchemes);for(let n=0;n{const s=e.some(c=>c.docChanged)&&!t.doc.eq(r.doc),i=e.some(c=>c.getMeta("preventAutolink"));if(!s||i)return;const{tr:o}=r,l=th(t.doc,[...e]);if(ah(l).forEach(({newRange:c})=>{const u=Vk(r.doc,c,f=>f.isTextblock);let d,h;if(u.length>1)d=u[0],h=r.doc.textBetween(d.pos,d.pos+d.node.nodeSize,void 0," ");else if(u.length){const f=r.doc.textBetween(c.from,c.to," "," ");if(!hS.test(f))return;d=u[0],h=r.doc.textBetween(d.pos,c.to,void 0," ")}if(d&&h){const f=h.split(dS).filter(Boolean);if(f.length<=0)return!1;const p=f[f.length-1],m=d.pos+h.lastIndexOf(p);if(!p)return!1;const g=Rl(p).map(y=>y.toObject(n.defaultProtocol));if(!pS(g))return!1;g.filter(y=>y.isLink).map(y=>({...y,from:m+y.start+1,to:m+y.end+1})).filter(y=>r.schema.marks.code?!r.doc.rangeHasMark(y.from,y.to,r.schema.marks.code):!0).filter(y=>n.validate(y.value)).filter(y=>n.shouldAutoLink(y.value)).forEach(y=>{gl(y.from,y.to,r.doc).some(x=>x.mark.type===n.type)||o.addMark(y.from,y.to,n.type.create({href:y.href}))})}}),!!o.steps.length)return o}})}function gS(n){return new G({key:new re("handleClickLink"),props:{handleClick:(e,t,r)=>{var s,i;if(r.button!==0||!e.editable)return!1;let o=null;if(r.target instanceof HTMLAnchorElement)o=r.target;else{const a=r.target;if(!a)return!1;const c=n.editor.view.dom;o=a.closest("a"),o&&!c.contains(o)&&(o=null)}if(!o)return!1;let l=!1;if(n.enableClickSelection&&(l=n.editor.commands.extendMarkRange(n.type.name)),n.openOnClick){const a=lh(e.state,n.type.name),c=(s=o.href)!=null?s:a.href,u=(i=o.target)!=null?i:a.target;c&&(window.open(c,u),l=!0)}return l}}})}function yS(n){return new G({key:new re("handlePasteLink"),props:{handlePaste:(e,t,r)=>{const{shouldAutoLink:s}=n,{state:i}=e,{selection:o}=i,{empty:l}=o;if(l)return!1;let a="";r.content.forEach(u=>{a+=u.textContent});const c=hf(a,{defaultProtocol:n.defaultProtocol}).find(u=>u.isLink&&u.value===a);return!a||!c||s!==void 0&&!s(c.value)?!1:n.editor.commands.setMark(n.type,{href:c.href})}}})}function Tt(n,e){const t=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const s=typeof r=="string"?r:r.scheme;s&&t.push(s)}),!n||n.replace(fS,"").match(new RegExp(`^(?:(?:${t.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var ff=Jt.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"){Lc(n);return}Lc(n.scheme,n.optionalSlashes)})},onDestroy(){cS()},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)=>!!Tt(n,e.protocols),validate:n=>!!n,shouldAutoLink:n=>{const e=/^[a-z][a-z0-9+.-]*:\/\//i.test(n),t=/^[a-z][a-z0-9+.-]*:/i.test(n);if(e||t&&!n.includes("@"))return!0;const s=(n.includes("@")?n.split("@").pop():n).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(s)||!/\./.test(s))}}},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},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:n=>{const e=n.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:t=>!!Tt(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=>!!Tt(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",J(this.options.HTMLAttributes,n),0]:["a",J(this.options.HTMLAttributes,{...n,href:""}),0]},markdownTokenName:"link",parseMarkdown:(n,e)=>e.applyMark("link",e.parseInline(n.tokens||[]),{href:n.href,title:n.title||null}),renderMarkdown:(n,e)=>{var t,r,s,i;const o=(r=(t=n.attrs)==null?void 0:t.href)!=null?r:"",l=(i=(s=n.attrs)==null?void 0:s.title)!=null?i:"",a=e.renderChildren(n);return l?`[${a}](${o} "${l}")`:`[${a}](${o})`},addCommands(){return{setLink:n=>({chain:e})=>{const{href:t}=n;return this.options.isAllowedUri(t,{defaultValidate:r=>!!Tt(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=>!!Tt(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[Wt({find:n=>{const e=[];if(n){const{protocols:t,defaultProtocol:r}=this.options,s=hf(n).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:o=>!!Tt(o,t),protocols:t,defaultProtocol:r}));s.length&&s.forEach(i=>{this.options.shouldAutoLink(i.value)&&e.push({text:i.value,data:{href:i.href},index:i.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(mS({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:s=>!!Tt(s,e),protocols:e,defaultProtocol:t}),shouldAutoLink:this.options.shouldAutoLink})),n.push(gS({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&n.push(yS({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),n}}),kS=ff,bS=Object.defineProperty,xS=(n,e)=>{for(var t in e)bS(n,t,{get:e[t],enumerable:!0})},SS="listItem",Pc="textStyle",zc=/^\s*([-+*])\s$/,pf=Ce.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",J(this.options.HTMLAttributes,n),0]},markdownTokenName:"list",parseMarkdown:(n,e)=>n.type!=="list"||n.ordered?[]:{type:"bulletList",content:n.items?e.parseChildren(n.items):[]},renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
+`):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(SS,this.editor.getAttributes(Pc)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let n=xn({find:zc,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=xn({find:zc,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Pc),editor:this.editor})),[n]}}),wS=(n,e,t)=>{const{selection:r}=n;if(!r.empty)return null;const{$from:s}=r;if(!s.parent.isTextblock||s.parentOffset!==s.parent.content.size)return null;let i=-1;for(let f=s.depth;f>0;f-=1)if(s.node(f).type.name===e){i=f;break}if(i<0)return null;const o=s.node(i),l=s.index(i);if(l+1>=o.childCount)return null;const a=o.child(l+1);if(!t.includes(a.type.name))return null;const c=n.schema.nodes[e];let u=!1;if(a.forEach(f=>{f.type===c&&f.childCount>1&&(u=!0)}),!u)return null;const d=n.doc.resolve(s.after()).nodeAfter;if(!d||!t.includes(d.type.name))return null;const h=[];return d.forEach(f=>{h.push(f)}),h.length===0?null:{listItemDepth:i,nestedList:d,nestedListPos:s.after(),insertPos:s.after(i),items:h}},vS=(n,e,t,r)=>{const s=wS(n,t,r);if(!s)return!1;const{selection:i}=n,{nestedList:o,nestedListPos:l,insertPos:a,items:c}=s,u=n.tr;u.delete(l,l+o.nodeSize);const d=u.mapping.map(a);return u.insert(d,w.from(c)),u.setSelection(i.map(u.doc,u.mapping)),e&&e(u),!0},ES=(n,e,t)=>vS(n.state,n.view.dispatch,e,t),mf=(n,e)=>Y.create({name:`${n}BranchingDeleteKeymap`,priority:101,addKeyboardShortcuts(){const t=()=>ES(this.editor,n,e);return{Delete:t,"Mod-Delete":t}}});function CS(n){var e,t;const r=(e=n.tokens)==null?void 0:e[0];return!!(n.text&&((t=n.tokens)==null?void 0:t.length)===1&&(r==null?void 0:r.type)==="list"&&r.ordered&&r.raw===n.text)}function TS(n,e){return e.tokenizeInline?e.parseInline(e.tokenizeInline(n)):e.parseInline([{type:"text",raw:n,text:n}])}var gf=Ce.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",J(this.options.HTMLAttributes,n),0]},markdownTokenName:"list_item",parseMarkdown:(n,e)=>{var t;if(n.type!=="list_item")return[];const r=(t=e.parseBlockChildren)!=null?t:e.parseChildren;let s=[];if(n.tokens&&n.tokens.length>0){if(CS(n))return{type:"listItem",content:[{type:"paragraph",content:TS(n.text||"",e)}]};if(n.tokens.some(o=>o.type==="paragraph"))s=r(n.tokens);else{const o=n.tokens[0];if(o&&o.type==="text"&&o.tokens&&o.tokens.length>0){if(s=[{type:"paragraph",content:e.parseInline(o.tokens)}],n.tokens.length>1){const a=n.tokens.slice(1),c=r(a);s.push(...c)}}else s=r(n.tokens)}}return s.length===0&&(s=[{type:"paragraph",content:[]}]),{type:"listItem",content:s}},renderMarkdown:(n,e,t)=>xl(n,e,r=>{var s,i;return r.parentType==="bulletList"?"- ":r.parentType==="orderedList"?`${(((i=(s=r.meta)==null?void 0:s.parentAttrs)==null?void 0:i.start)||1)+r.index}. `:"- "},t),addExtensions(){return[mf(this.name,[this.options.bulletListTypeName,this.options.orderedListTypeName])]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),MS={};xS(MS,{findListItemPos:()=>fi,getNextListDepth:()=>Dl,handleBackspace:()=>$o,handleDelete:()=>Fo,hasListBefore:()=>yf,hasListItemAfter:()=>AS,hasListItemBefore:()=>NS,listItemHasSubList:()=>OS,nextListIsDeeper:()=>kf,nextListIsHigher:()=>bf});var fi=(n,e)=>{const{$from:t}=e.selection,r=te(n,e.schema);let s=null,i=t.depth,o=t.pos,l=null;for(;i>0&&l===null;)s=t.node(i),s.type===r?l=i:(i-=1,o-=1);return l===null?null:{$pos:e.doc.resolve(o),depth:l}},Dl=(n,e)=>{const t=fi(n,e);if(!t)return!1;const[,r]=eb(e,n,t.$pos.pos+4);return r},yf=(n,e,t)=>{const{$anchor:r}=n.selection,s=Math.max(0,r.pos-2),i=n.doc.resolve(s).node();return!(!i||!t.includes(i.type.name))},$o=(n,e,t)=>{if(n.commands.undoInputRule())return!0;if(n.state.selection.from!==n.state.selection.to)return!1;if(!St(n.state,e)&&yf(n.state,e,t)){const{$anchor:r}=n.state.selection,s=n.state.doc.resolve(r.before()-1),i=[];s.node().descendants((a,c)=>{a.type.name===e&&i.push({node:a,pos:c})});const o=i.at(-1);if(!o)return!1;const l=n.state.doc.resolve(s.start()+o.pos+1);return n.chain().cut({from:r.start()-1,to:r.end()+1},l.end()).joinForward().run()}return!St(n.state,e)||!sb(n.state)?!1:n.chain().liftListItem(e).run()},kf=(n,e)=>{const t=Dl(n,e),r=fi(n,e);return!r||!t?!1:t>r.depth},bf=(n,e)=>{const t=Dl(n,e),r=fi(n,e);return!r||!t?!1:t{if(!St(n.state,e)||!rb(n.state,e))return!1;const{selection:t}=n.state,{$from:r,$to:s}=t;return!t.empty&&r.sameParent(s)?!1:kf(e,n.state)?n.chain().focus(n.state.selection.from+4).lift(e).joinBackward().run():bf(e,n.state)?n.chain().joinForward().joinBackward().run():n.commands.joinItemForward()},AS=(n,e)=>{var t;const{$anchor:r}=e.selection,s=e.doc.resolve(r.pos-r.parentOffset-2);return!(s.index()===s.parent.childCount-1||((t=s.nodeAfter)==null?void 0:t.type.name)!==n)},NS=(n,e)=>{var t;const{$anchor:r}=e.selection,s=e.doc.resolve(r.pos-2);return!(s.index()===0||((t=s.nodeBefore)==null?void 0:t.type.name)!==n)},OS=(n,e,t)=>{if(!t)return!1;const r=te(n,e.schema);let s=!1;return t.descendants(i=>{i.type===r&&(s=!0)}),s},xf=Y.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&&Fo(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&&Fo(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&&$o(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&&$o(n,t,r)&&(e=!0)}),e}}}}),Bc=/^(\s*)(\d+)\.\s+(.*)$/,RS=/^\s/;function IS(n){const e=n.trimStart();return/^[-+*]\s+/.test(e)||/^\d+\.\s+/.test(e)||/^>\s?/.test(e)||/^```/.test(e)||/^~~~/.test(e)}function DS(n){const e=[],t=[];let r=!1;return n.forEach(s=>{if(r){t.push(s);return}if(s.trim()===""){r=!0,t.push(s);return}if(e.length>0&&IS(s)){r=!0,t.push(s);return}e.push(s)}),{paragraphLines:e,blockLines:t}}function LS(n){const e=[];let t=0,r=0;for(;te;)h.push(n[d]),d+=1;if(h.length>0){const f=Math.min(...h.map(m=>m.indent)),p=Sf(h,f,t);c.push({type:"list",ordered:!0,start:h[0].number,items:p,raw:h.map(m=>m.raw).join(`
+`)})}r.push({type:"list_item",raw:i.raw,tokens:c}),s=d}else s+=1}return r}function PS(n,e){return n.map(t=>{if(t.type!=="list_item")return e.parseChildren([t])[0];const r=[];return t.tokens&&t.tokens.length>0&&t.tokens.forEach(s=>{if(s.type==="paragraph"||s.type==="list"||s.type==="blockquote"||s.type==="code")r.push(...e.parseChildren([s]));else if(s.type==="text"&&s.tokens){const i=e.parseChildren([s]);r.push({type:"paragraph",content:i})}else{const i=e.parseChildren([s]);i.length>0&&r.push(...i)}}),{type:"listItem",content:r}})}var zS="listItem",$c="textStyle",Fc=/^(\d+)\.\s$/,wf=Ce.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",J(this.options.HTMLAttributes,t),0]:["ol",J(this.options.HTMLAttributes,n),0]},markdownTokenName:"list",parseMarkdown:(n,e)=>{if(n.type!=="list"||!n.ordered)return[];const t=n.start||1,r=n.items?PS(n.items,e):[];return t!==1?{type:"orderedList",attrs:{start:t},content:r}:{type:"orderedList",content:r}},renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
+`):"",markdownTokenizer:{name:"orderedList",level:"block",start:n=>{const e=n.match(/^(\s*)(\d+)\.\s+/),t=e==null?void 0:e.index;return t!==void 0?t:-1},tokenize:(n,e,t)=>{var r;const s=n.split(`
+`),[i,o]=LS(s);if(i.length===0)return;const l=Sf(i,0,t);return l.length===0?void 0:{type:"list",ordered:!0,start:((r=i[0])==null?void 0:r.number)||1,items:l,raw:s.slice(0,o).join(`
+`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(zS,this.editor.getAttributes($c)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let n=xn({find:Fc,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=xn({find:Fc,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes($c)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[n]}}),BS=/^\s*(\[([( |x])?\])\s$/,$S=Ce.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",J(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:n.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(n,e)=>{const t=[];if(n.tokens&&n.tokens.length>0?t.push(e.createNode("paragraph",{},e.parseInline(n.tokens))):n.text?t.push(e.createNode("paragraph",{},[e.createNode("text",{text:n.text})])):t.push(e.createNode("paragraph",{},[])),n.nestedTokens&&n.nestedTokens.length>0){const r=e.parseChildren(n.nestedTokens);t.push(...r)}return e.createNode("taskItem",{checked:n.checked||!1},t)},renderMarkdown:(n,e)=>{var t;const s=`- [${(t=n.attrs)!=null&&t.checked?"x":" "}] `;return xl(n,e,s)},addExtensions(){return this.options.nested?[mf(this.name,[this.options.taskListTypeName])]:[]},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 s=document.createElement("li"),i=document.createElement("label"),o=document.createElement("span"),l=document.createElement("input"),a=document.createElement("div"),c=d=>{var h,f;l.ariaLabel=((f=(h=this.options.a11y)==null?void 0:h.checkboxLabel)==null?void 0:f.call(h,d,l.checked))||`Task item checkbox for ${d.textContent||"empty task item"}`};c(n),i.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:h}=d.target;r.isEditable&&typeof t=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:f})=>{const p=t();if(typeof p!="number")return!1;const m=f.doc.nodeAt(p);return f.setNodeMarkup(p,void 0,{...m==null?void 0:m.attrs,checked:h}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(n,h)||(l.checked=!l.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([d,h])=>{s.setAttribute(d,h)}),s.dataset.checked=n.attrs.checked,l.checked=n.attrs.checked,i.append(l,o),s.append(i,a),Object.entries(e).forEach(([d,h])=>{s.setAttribute(d,h)});let u=new Set(Object.keys(e));return{dom:s,contentDOM:a,update:d=>{if(d.type!==this.type)return!1;s.dataset.checked=d.attrs.checked,l.checked=d.attrs.checked,c(d);const h=r.extensionManager.attributes,f=kn(d,h),p=new Set(Object.keys(f)),m=this.options.HTMLAttributes;return u.forEach(g=>{p.has(g)||(g in m?s.setAttribute(g,m[g]):s.removeAttribute(g))}),Object.entries(f).forEach(([g,y])=>{y==null?g in m?s.setAttribute(g,m[g]):s.removeAttribute(g):s.setAttribute(g,y)}),u=p,!0}}}},addInputRules(){return[xn({find:BS,type:this.type,getAttributes:n=>({checked:n[n.length-1]==="x"})})]}}),FS=Ce.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",J(this.options.HTMLAttributes,n,{"data-type":this.name}),0]},parseMarkdown:(n,e)=>e.createNode("taskList",{},e.parseChildren(n.items||[])),renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
+`):"",markdownTokenizer:{name:"taskList",level:"block",start(n){var e;const t=(e=n.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return t!==void 0?t:-1},tokenize(n,e,t){const r=i=>{const o=To(i,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:l=>({indentLevel:l[1].length,mainContent:l[4],checked:l[3].toLowerCase()==="x"}),createToken:(l,a)=>({type:"taskItem",raw:"",mainContent:l.mainContent,indentLevel:l.indentLevel,checked:l.checked,text:l.mainContent,tokens:t.inlineTokens(l.mainContent),nestedTokens:a}),customNestedParser:r},t);return o?[{type:"taskList",raw:o.raw,items:o.items}]:t.blockTokens(i)},s=To(n,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:i=>({indentLevel:i[1].length,mainContent:i[4],checked:i[3].toLowerCase()==="x"}),createToken:(i,o)=>({type:"taskItem",raw:"",mainContent:i.mainContent,indentLevel:i.indentLevel,checked:i.checked,text:i.mainContent,tokens:t.inlineTokens(i.mainContent),nestedTokens:o}),customNestedParser:r},t);if(s)return{type:"taskList",raw:s.raw,items:s.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:n})=>n.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});Y.create({name:"listKit",addExtensions(){const n=[];return this.options.bulletList!==!1&&n.push(pf.configure(this.options.bulletList)),this.options.listItem!==!1&&n.push(gf.configure(this.options.listItem)),this.options.listKeymap!==!1&&n.push(xf.configure(this.options.listKeymap)),this.options.orderedList!==!1&&n.push(wf.configure(this.options.orderedList)),this.options.taskItem!==!1&&n.push($S.configure(this.options.taskItem)),this.options.taskList!==!1&&n.push(FS.configure(this.options.taskList)),n}});var Wr=" ",Ui=" ",HS=Ce.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",J(this.options.HTMLAttributes,n),0]},parseMarkdown:(n,e)=>{const t=n.tokens||[];if(t.length===1&&t[0].type==="image")return e.parseChildren([t[0]]);const r=e.parseInline(t);return t.length===1&&t[0].type==="text"&&(t[0].raw===Wr||t[0].text===Wr||t[0].raw===Ui||t[0].text===Ui)&&r.length===1&&r[0].type==="text"&&(r[0].text===Wr||r[0].text===Ui)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,r)},renderMarkdown:(n,e,t)=>{var r,s;if(!n)return"";const i=Array.isArray(n.content)?n.content:[];if(i.length===0){const o=Array.isArray((r=t==null?void 0:t.previousNode)==null?void 0:r.content)?t.previousNode.content:[];return((s=t==null?void 0:t.previousNode)==null?void 0:s.type)==="paragraph"&&o.length===0?Wr:""}return e.renderChildren(i)},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),_S=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,jS=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,VS=Jt.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",J(this.options.HTMLAttributes,n),0]},markdownTokenName:"del",parseMarkdown:(n,e)=>e.applyMark("strike",e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>`~~${e.renderChildren(n)}~~`,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:_S,type:this.type})]},addPasteRules(){return[Wt({find:jS,type:this.type})]}}),WS=Ce.create({name:"text",group:"inline",parseMarkdown:n=>({type:"text",text:n.text||""}),renderMarkdown:n=>n.text||""}),vf=Jt.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",J(this.options.HTMLAttributes,n),0]},parseMarkdown(n,e){return e.applyMark(this.name||"underline",e.parseInline(n.tokens||[]))},renderMarkdown(n,e){return`++${e.renderChildren(n)}++`},markdownTokenizer:{name:"underline",level:"inline",start(n){return n.indexOf("++")},tokenize(n,e,t){const s=/^(\+\+)([\s\S]+?)(\+\+)/.exec(n);if(!s)return;const i=s[2].trim();return{type:"underline",raw:s[0],text:i,tokens:t.inlineTokens(i)}}},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()}}}),qS=vf;function US(n={}){return new G({view(e){return new KS(e,n)}})}class KS{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(s=>{let i=o=>{this[s](o)};return e.dom.addEventListener(s,i),{name:s,handler:i}})}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,s=this.editorView.dom,i=s.getBoundingClientRect(),o=i.width/s.offsetWidth,l=i.height/s.offsetHeight;if(t){let d=e.nodeBefore,h=e.nodeAfter;if(d||h){let f=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(f){let p=f.getBoundingClientRect(),m=d?p.bottom:p.top;d&&h&&(m=(m+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let g=this.width/2*l;r={left:p.left,right:p.right,top:m-g,bottom:m+g}}}}if(!r){let d=this.editorView.coordsAtPos(this.cursorPos),h=this.width/2*o;r={left:d.left-h,right:d.left+h,top:d.top,bottom:d.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,u;if(!a||a==document.body&&getComputedStyle(a).position=="static")c=-pageXOffset,u=-pageYOffset;else{let d=a.getBoundingClientRect(),h=d.width/a.offsetWidth,f=d.height/a.offsetHeight;c=d.left-a.scrollLeft*h,u=d.top-a.scrollTop*f}this.element.style.left=(r.left-c)/o+"px",this.element.style.top=(r.top-u)/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),s=r&&r.type.spec.disableDropCursor,i=typeof s=="function"?s(this.editorView,t,e):s;if(t&&!i){let o=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=Fu(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 Q extends z{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return Q.valid(r)?new Q(r):z.near(r)}content(){return A.empty}eq(e){return e instanceof Q&&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 Q(e.resolve(t.pos))}getBookmark(){return new Ll(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!JS(e)||!GS(e))return!1;let r=t.type.spec.allowGapCursor;if(r!=null)return r;let s=t.contentMatchAt(e.index()).defaultType;return s&&s.isTextblock}static findGapCursorFrom(e,t,r=!1){e:for(;;){if(!r&&Q.valid(e))return e;let s=e.pos,i=null;for(let o=e.depth;;o--){let l=e.node(o);if(t>0?e.indexAfter(o)0){i=l.child(t>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;s+=t;let a=e.doc.resolve(s);if(Q.valid(a))return a}for(;;){let o=t>0?i.firstChild:i.lastChild;if(!o){if(i.isAtom&&!i.isText&&!I.isSelectable(i)){e=e.doc.resolve(s+i.nodeSize*t),r=!1;continue e}break}i=o,s+=t;let l=e.doc.resolve(s);if(Q.valid(l))return l}return null}}}Q.prototype.visible=!1;Q.findFrom=Q.findGapCursorFrom;z.jsonID("gapcursor",Q);class Ll{constructor(e){this.pos=e}map(e){return new Ll(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return Q.valid(t)?new Q(t):z.near(t)}}function Ef(n){return n.isAtom||n.spec.isolating||n.spec.createGapCursor}function JS(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 s=r.child(t-1);;s=s.lastChild){if(s.childCount==0&&!s.inlineContent||Ef(s.type))return!0;if(s.inlineContent)return!1}}return!0}function GS(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 s=r.child(t);;s=s.firstChild){if(s.childCount==0&&!s.inlineContent||Ef(s.type))return!0;if(s.inlineContent)return!1}}return!0}function YS(){return new G({props:{decorations:ew,createSelectionBetween(n,e,t){return e.pos==t.pos&&Q.valid(t)?new Q(t):null},handleClick:QS,handleKeyDown:XS,handleDOMEvents:{beforeinput:ZS}}})}const XS=Jd({ArrowLeft:qr("horiz",-1),ArrowRight:qr("horiz",1),ArrowUp:qr("vert",-1),ArrowDown:qr("vert",1)});function qr(n,e){const t=n=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,s,i){let o=r.selection,l=e>0?o.$to:o.$from,a=o.empty;if(o instanceof P){if(!i.endOfTextblock(t)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let c=Q.findGapCursorFrom(l,e,a);return c?(s&&s(r.tr.setSelection(new Q(c))),!0):!1}}function QS(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!Q.valid(r))return!1;let s=n.posAtCoords({left:t.clientX,top:t.clientY});return s&&s.inside>-1&&I.isSelectable(n.state.doc.nodeAt(s.inside))?!1:(n.dispatch(n.state.tr.setSelection(new Q(r))),!0)}function ZS(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof Q))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 s=w.empty;for(let o=r.length-1;o>=0;o--)s=w.from(r[o].createAndFill(null,s));let i=n.state.tr.replace(t.pos,t.pos,new A(s,0,0));return i.setSelection(P.near(i.doc.resolve(t.pos+1))),n.dispatch(i),!1}function ew(n){if(!(n.selection instanceof Q))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",K.create(n.doc,[Se.widget(n.selection.head,e,{key:"gapcursor"})])}var Gs=200,le=function(){};le.prototype.append=function(e){return e.length?(e=le.from(e),!this.length&&e||e.length=t?le.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};le.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};le.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)};le.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var s=[];return this.forEach(function(i,o){return s.push(e(i,o))},t,r),s};le.from=function(e){return e instanceof le?e:e&&e.length?new Cf(e):le.empty};var Cf=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(s,i){return s==0&&i==this.length?this:new e(this.values.slice(s,i))},e.prototype.getInner=function(s){return this.values[s]},e.prototype.forEachInner=function(s,i,o,l){for(var a=i;a=o;a--)if(s(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(s){if(this.length+s.length<=Gs)return new e(this.values.concat(s.flatten()))},e.prototype.leafPrepend=function(s){if(this.length+s.length<=Gs)return new e(s.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e}(le);le.empty=new Cf([]);var tw=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 rl&&this.right.forEachInner(r,Math.max(s-l,0),Math.min(this.length,i)-l,o+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,s,i,o){var l=this.left.length;if(s>l&&this.right.forEachInvertedInner(r,s-l,Math.max(i,l)-l,o+l)===!1||i=i?this.right.slice(r-i,s-i):this.left.slice(r,i).append(this.right.slice(0,s-i))},e.prototype.leafAppend=function(r){var s=this.right.leafAppend(r);if(s)return new e(this.left,s)},e.prototype.leafPrepend=function(r){var s=this.left.leafPrepend(r);if(s)return new e(s,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}(le);const nw=500;class $e{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 s,i;t&&(s=this.remapping(r,this.items.length),i=s.maps.length);let o=e.tr,l,a,c=[],u=[];return this.items.forEach((d,h)=>{if(!d.step){s||(s=this.remapping(r,h+1),i=s.maps.length),i--,u.push(d);return}if(s){u.push(new We(d.map));let f=d.step.map(s.slice(i)),p;f&&o.maybeStep(f).doc&&(p=o.mapping.maps[o.mapping.maps.length-1],c.push(new We(p,void 0,void 0,c.length+u.length))),i--,p&&s.appendMap(p,i)}else o.maybeStep(d.step);if(d.selection)return l=s?d.selection.map(s.slice(i)):d.selection,a=new $e(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:o,selection:l}}addTransform(e,t,r,s){let i=[],o=this.eventCount,l=this.items,a=!s&&l.length?l.get(l.length-1):null;for(let u=0;usw&&(l=rw(l,c),o-=c),new $e(l.append(i),o)}remapping(e,t){let r=new hr;return this.items.forEach((s,i)=>{let o=s.mirrorOffset!=null&&i-s.mirrorOffset>=e?r.maps.length-s.mirrorOffset:void 0;r.appendMap(s.map,o)},e,t),r}addMaps(e){return this.eventCount==0?this:new $e(this.items.append(e.map(t=>new We(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let r=[],s=Math.max(0,this.items.length-t),i=e.mapping,o=e.steps.length,l=this.eventCount;this.items.forEach(h=>{h.selection&&l--},s);let a=t;this.items.forEach(h=>{let f=i.getMirror(--a);if(f==null)return;o=Math.min(o,f);let p=i.maps[f];if(h.step){let m=e.steps[f].invert(e.docs[f]),g=h.selection&&h.selection.map(i.slice(a+1,f));g&&l++,r.push(new We(p,m,g))}else r.push(new We(p))},s);let c=[];for(let h=t;hnw&&(d=d.compress(this.items.length-r.length)),d}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,s=[],i=0;return this.items.forEach((o,l)=>{if(l>=e)s.push(o),o.selection&&i++;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 u=o.selection&&o.selection.map(t.slice(r));u&&i++;let d=new We(c.invert(),a,u),h,f=s.length-1;(h=s.length&&s[f].merge(d))?s[f]=h:s.push(d)}}else o.map&&r--},this.items.length,0),new $e(le.from(s.reverse()),i)}}$e.empty=new $e(le.empty,0);function rw(n,e){let t;return n.forEach((r,s)=>{if(r.selection&&e--==0)return t=s,!1}),n.slice(t)}class We{constructor(e,t,r,s){this.map=e,this.step=t,this.selection=r,this.mirrorOffset=s}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new We(t.getMap().invert(),t,this.selection)}}}class pt{constructor(e,t,r,s,i){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=s,this.prevComposition=i}}const sw=20;function iw(n,e,t,r){let s=t.getMeta($t),i;if(s)return s.historyState;t.getMeta(aw)&&(n=new pt(n.done,n.undone,null,0,-1));let o=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(o&&o.getMeta($t))return o.getMeta($t).redo?new pt(n.done.addTransform(t,void 0,r,ls(e)),n.undone,Hc(t.mapping.maps),n.prevTime,n.prevComposition):new pt(n.done,n.undone.addTransform(t,void 0,r,ls(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||!ow(t,n.prevRanges)),c=o?Ki(n.prevRanges,t.mapping):Hc(t.mapping.maps);return new pt(n.done.addTransform(t,a?e.selection.getBookmark():void 0,r,ls(e)),$e.empty,c,t.time,l??n.prevComposition)}else return(i=t.getMeta("rebased"))?new pt(n.done.rebased(t,i),n.undone.rebased(t,i),Ki(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new pt(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),Ki(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function ow(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,s)=>{for(let i=0;i=e[i]&&(t=!0)}),t}function Hc(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((r,s,i,o)=>e.push(i,o));return e}function Ki(n,e){if(!n)return null;let t=[];for(let r=0;r{let s=$t.getState(t);if(!s||(n?s.undone:s.done).eventCount==0)return!1;if(r){let i=lw(s,t,n);i&&r(e?i.scrollIntoView():i)}return!0}}const Mf=Tf(!1,!0),Af=Tf(!0,!0);Y.create({name:"characterCount",addOptions(){return{limit:null,autoTrim:!0,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==null?void 0:n.node)||this.editor.state.doc;if(((n==null?void 0: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==null?void 0:n.node)||this.editor.state.doc,t=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(t)}},addProseMirrorPlugins(){let n=!1;return[new G({key:new re("characterCount"),appendTransaction:(e,t,r)=>{if(n)return;const s=this.options.limit,i=this.options.autoTrim;if(s==null||s===0||i===!1){n=!0;return}const o=this.storage.characters({node:r.doc});if(o>s){const l=o-s,a=0,c=l;console.warn(`[CharacterCount] Initial content exceeded limit of ${s} characters. Content was automatically trimmed.`);const u=r.tr.deleteRange(a,c);return n=!0,u}n=!0},filterTransaction:(e,t)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const s=this.storage.characters({node:t.doc}),i=this.storage.characters({node:e.doc});if(i<=r||s>r&&i>r&&i<=s)return!0;if(s>r&&i>r&&i>s||!e.getMeta("paste"))return!1;const l=e.selection.$head.pos,a=i-r,c=l-a,u=l;return e.deleteRange(c,u),!(this.storage.characters({node:e.doc})>r)}})]}});var uw=Y.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[US(this.options)]}});Y.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new G({key:new re("focus"),props:{decorations:({doc:n,selection:e})=>{const{isEditable:t,isFocused:r}=this.editor,{anchor:s}=e,i=[];if(!t||!r)return K.create(n,[]);let o=0;this.options.mode==="deepest"&&n.descendants((a,c)=>{if(a.isText)return;if(!(s>=c&&s<=c+a.nodeSize-1))return!1;o+=1});let l=0;return n.descendants((a,c)=>{if(a.isText||!(s>=c&&s<=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";i.push(Se.node(c,c+a.nodeSize,{class:this.options.className}))}),K.create(n,i)}}})]}});var dw=Y.create({name:"gapCursor",addProseMirrorPlugins(){return[YS()]},extendNodeSchema(n){var e;const t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=j(R(n,"allowGapCursor",t)))!=null?e:null}}}),Nf="placeholder",wr=new re("tiptap__placeholder"),jc=200;function Vc(n){const{editor:e,placeholder:t,dataAttribute:r,pos:s,node:i,isEmptyDoc:o,hasAnchor:l,classes:{emptyNode:a,emptyEditor:c}}=n,u=[a];return o&&u.push(c),Se.node(s,s+i.nodeSize,{class:u.join(" "),[r]:typeof t=="function"?t({editor:e,node:i,pos:s,hasAnchor:l}):t})}function Wc(n,e){return typeof n=="function"?n(e):n}function hw({editor:n,options:e,dataAttribute:t,doc:r,selection:s}){var i,o;if(!(n.isEditable||!e.showOnlyWhenEditable))return null;const{anchor:a}=s,c=[],u=n.isEmpty;if(e.showOnlyCurrent&&!e.includeChildren){const h=r.resolve(a),f=h.depth>0?h.node(1):h.nodeAfter,p=h.depth>0?h.before(1):a;if(f&&f.type.isTextblock&&kr(f)){const m=a>=p&&a<=p+f.nodeSize;c.push(Vc({editor:n,isEmptyDoc:u,dataAttribute:t,hasAnchor:m,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:Wc(e.emptyNodeClass,{editor:n,node:f,pos:p,hasAnchor:m})},node:f,pos:p}))}}else{const h=wr.getState(n.state),f=(i=h==null?void 0:h.topPos)!=null?i:0,p=(o=h==null?void 0:h.bottomPos)!=null?o:r.content.size;r.nodesBetween(f,p,(m,g)=>{const y=a>=g&&a<=g+m.nodeSize,x=!m.isLeaf&&kr(m);return m.type.isTextblock&&(y||!e.showOnlyCurrent)&&x&&c.push(Vc({editor:n,isEmptyDoc:u,dataAttribute:t,hasAnchor:y,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:Wc(e.emptyNodeClass,{editor:n,node:m,pos:g,hasAnchor:y})},node:m,pos:g})),e.includeChildren})}return K.create(r,c)}function fw(n){return n.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}function pw(n){const e=getComputedStyle(n),t=`${e.overflow} ${e.overflowY} ${e.overflowX}`;return/auto|scroll|overlay/.test(t)}function mw(n){let e=n;for(;e;){if(pw(e))return e;const t=e.parentElement;if(!t){const r=e.getRootNode();if(r instanceof ShadowRoot){e=r.host;continue}return window}e=t}return window}function gw(n){return n===window?{top:0,bottom:window.innerHeight}:n.getBoundingClientRect()}function yw({doc:n,view:e,scrollContainer:t}){const r=e.dom.getBoundingClientRect(),s=t?gw(t):{top:0,bottom:window.innerHeight},i=Math.max(r.top,s.top)-jc,o=Math.min(r.bottom,s.bottom)+jc;if(i>=o)return{top:0,bottom:n.content.size};const a=getComputedStyle(e.dom).direction==="rtl"?Math.max(r.right-2,r.left+2):r.left+2,c=e.posAtCoords({left:a,top:i+2}),u=e.posAtCoords({left:a,top:o-2});return{top:c?c.pos:0,bottom:u?u.pos:n.content.size}}var kw={init(){return{topPos:null,bottomPos:null}},apply(n,e){const t=n.getMeta(wr);return t!=null&&t.positions?{topPos:t.positions.top,bottomPos:t.positions.bottom}:n.docChanged?{topPos:e.topPos!==null?n.mapping.map(e.topPos):null,bottomPos:e.bottomPos!==null?n.mapping.map(e.bottomPos):null}:e}};function bw(n){const e=mw(n.dom),t=()=>{const l=yw({view:n,doc:n.state.doc,scrollContainer:e}),a=wr.getState(n.state);if((a==null?void 0:a.topPos)===l.top&&(a==null?void 0:a.bottomPos)===l.bottom)return;const c=n.state.tr.setMeta(wr,{positions:l});n.dispatch(c)};let r=null,s=0;const i=150,o=()=>{r===null&&(r=requestAnimationFrame(()=>{r=null;const l=performance.now();l-s>=i?(s=l,t()):o()}))};return e.addEventListener("scroll",o,{passive:!0}),t(),{update(l,a){n.state.doc.content.size!==a.doc.content.size&&o()},destroy:()=>{r!==null&&cancelAnimationFrame(r),e.removeEventListener("scroll",o)}}}function xw({editor:n,options:e}){const t=e.dataAttribute?`data-${fw(e.dataAttribute)}`:`data-${Nf}`;return new G({key:wr,state:kw,view:bw,props:{decorations:({doc:r,selection:s})=>hw({editor:n,options:e,dataAttribute:t,doc:r,selection:s})}})}var Sw=Y.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:Nf,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[xw({editor:this.editor,options:this.options})]}}),ww=`.ProseMirror:not(.ProseMirror-focused) *::selection {
+ background: transparent;
+}
+
+.ProseMirror:not(.ProseMirror-focused) *::-moz-selection {
+ background: transparent;
+}`;Y.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:n,options:e}=this;return n.options.injectCSS&&typeof document<"u"&&Th(ww,n.options.injectNonce,"selection"),[new G({key:new re("selection"),props:{decorations(t){return t.selection.empty||n.isFocused||!n.isEditable||ch(t.selection)||n.view.dragging?null:K.create(t.doc,[Se.inline(t.selection.from,t.selection.to,{class:e.className})])}}})]}});var vw="skipTrailingNode";function qc({types:n,node:e}){return e&&Array.isArray(n)&&n.includes(e.type)||(e==null?void 0:e.type)===n}var Ew=Y.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var n;const e=new re(this.name),t=this.options.node||((n=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:n.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,s])=>s).filter(s=>(this.options.notAfter||[]).concat(t).includes(s.name));return[new G({key:e,appendTransaction:(s,i,o)=>{const{doc:l,tr:a,schema:c}=o,u=e.getState(o),d=l.content.size,h=c.nodes[t];if(!s.some(f=>f.getMeta(vw))&&u)return a.insert(d,h.create())},state:{init:(s,i)=>{const o=i.tr.doc.lastChild;return!qc({node:o,types:r})},apply:(s,i)=>{if(!s.docChanged||s.getMeta("__uniqueIDTransaction"))return i;const o=s.doc.lastChild;return!qc({node:o,types:r})}}})]}}),Cw=Y.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>Mf(n,e),redo:()=>({state:n,dispatch:e})=>Af(n,e)}},addProseMirrorPlugins(){return[cw(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()}}}),Tw=Y.create({name:"starterKit",addExtensions(){var n,e,t,r;const s=[];return this.options.bold!==!1&&s.push(Rx.configure(this.options.bold)),this.options.blockquote!==!1&&s.push(Tx.configure(this.options.blockquote)),this.options.bulletList!==!1&&s.push(pf.configure(this.options.bulletList)),this.options.code!==!1&&s.push(Lx.configure(this.options.code)),this.options.codeBlock!==!1&&s.push(Bx.configure(this.options.codeBlock)),this.options.document!==!1&&s.push($x.configure(this.options.document)),this.options.dropcursor!==!1&&s.push(uw.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&s.push(dw.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&s.push(Fx.configure(this.options.hardBreak)),this.options.heading!==!1&&s.push(Hx.configure(this.options.heading)),this.options.undoRedo!==!1&&s.push(Cw.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&s.push(_x.configure(this.options.horizontalRule)),this.options.italic!==!1&&s.push(Ux.configure(this.options.italic)),this.options.listItem!==!1&&s.push(gf.configure(this.options.listItem)),this.options.listKeymap!==!1&&s.push(xf.configure((n=this.options)==null?void 0:n.listKeymap)),this.options.link!==!1&&s.push(ff.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&s.push(wf.configure(this.options.orderedList)),this.options.paragraph!==!1&&s.push(HS.configure(this.options.paragraph)),this.options.strike!==!1&&s.push(VS.configure(this.options.strike)),this.options.text!==!1&&s.push(WS.configure(this.options.text)),this.options.underline!==!1&&s.push(vf.configure((t=this.options)==null?void 0:t.underline)),this.options.trailingNode!==!1&&s.push(Ew.configure((r=this.options)==null?void 0:r.trailingNode)),s}}),Mw=Tw,Aw=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,Nw=Ce.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},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",J(this.options.HTMLAttributes,n)]},parseMarkdown:(n,e)=>e.createNode("image",{src:n.href,title:n.title,alt:n.text}),renderMarkdown:n=>{var e,t,r,s,i,o;const l=(t=(e=n.attrs)==null?void 0:e.src)!=null?t:"",a=(s=(r=n.attrs)==null?void 0:r.alt)!=null?s:"",c=(o=(i=n.attrs)==null?void 0:i.title)!=null?o:"";return c?``:``},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>"u")return null;const{directions:n,minWidth:e,minHeight:t,alwaysPreserveAspectRatio:r}=this.options.resize;return({node:s,getPos:i,HTMLAttributes:o,editor:l})=>{const a=document.createElement("img");a.draggable=!1;const c=J(this.options.HTMLAttributes,o);Object.entries(c).forEach(([h,f])=>{if(f!=null)switch(h){case"width":case"height":break;default:a.setAttribute(h,f);break}}),c.src!==null&&(a.src=c.src);const u=new qb({element:a,editor:l,node:s,getPos:i,onResize:(h,f)=>{a.style.width=`${h}px`,a.style.height=`${f}px`},onCommit:(h,f)=>{const p=i();p!==void 0&&this.editor.chain().setNodeSelection(p).updateAttributes(this.name,{width:h,height:f}).run()},onUpdate:(h,f,p)=>h.type===s.type,options:{directions:n,min:{width:e,height:t},preserveAspectRatio:r===!0}}),d=u.dom;return d.style.visibility="hidden",d.style.pointerEvents="none",a.onload=()=>{d.style.visibility="",d.style.pointerEvents=""},u}},addCommands(){return{setImage:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n})}},addInputRules(){return[Mh({find:Aw,type:this.type,getAttributes:n=>{const[,,e,t,r]=n;return{src:t,alt:e,title:r}}})]}}),Ow=Nw,Rw=Sw;function Iw(n){for(var e=1;e0&&n[e-1]===`
+`;)e--;return n.substring(0,e)}function If(n){return Rf(Of(n))}var Dw=["ADDRESS","ARTICLE","ASIDE","AUDIO","BLOCKQUOTE","BODY","CANVAS","CENTER","DD","DIR","DIV","DL","DT","FIELDSET","FIGCAPTION","FIGURE","FOOTER","FORM","FRAMESET","H1","H2","H3","H4","H5","H6","HEADER","HGROUP","HR","HTML","ISINDEX","LI","MAIN","MENU","NAV","NOFRAMES","NOSCRIPT","OL","OUTPUT","P","PRE","SECTION","TABLE","TBODY","TD","TFOOT","TH","THEAD","TR","UL"];function Pl(n){return zl(n,Dw)}var Df=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function Lf(n){return zl(n,Df)}function Lw(n){return zf(n,Df)}var Pf=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function Pw(n){return zl(n,Pf)}function zw(n){return zf(n,Pf)}function zl(n,e){return e.indexOf(n.nodeName)>=0}function zf(n,e){return n.getElementsByTagName&&e.some(function(t){return n.getElementsByTagName(t).length})}var Bw=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\]"],[/^>/g,"\\>"],[/_/g,"\\_"],[/^(\d+)\. /g,"$1\\. "]];function Bf(n){return Bw.reduce(function(e,t){return e.replace(t[0],t[1])},n)}var ye={};ye.paragraph={filter:"p",replacement:function(n){return`
+
+`+n+`
+
+`}};ye.lineBreak={filter:"br",replacement:function(n,e,t){return t.br+`
+`}};ye.heading={filter:["h1","h2","h3","h4","h5","h6"],replacement:function(n,e,t){var r=Number(e.nodeName.charAt(1));if(t.headingStyle==="setext"&&r<3){var s=Ho(r===1?"=":"-",n.length);return`
+
+`+n+`
+`+s+`
+
+`}else return`
+
+`+Ho("#",r)+" "+n+`
+
+`}};ye.blockquote={filter:"blockquote",replacement:function(n){return n=If(n).replace(/^/gm,"> "),`
+
+`+n+`
+
+`}};ye.list={filter:["ul","ol"],replacement:function(n,e){var t=e.parentNode;return t.nodeName==="LI"&&t.lastElementChild===e?`
+`+n:`
+
+`+n+`
+
+`}};ye.listItem={filter:"li",replacement:function(n,e,t){var r=t.bulletListMarker+" ",s=e.parentNode;if(s.nodeName==="OL"){var i=s.getAttribute("start"),o=Array.prototype.indexOf.call(s.children,e);r=(i?Number(i)+o:o+1)+". "}var l=/\n$/.test(n);return n=If(n)+(l?`
+`:""),n=n.replace(/\n/gm,`
+`+" ".repeat(r.length)),r+n+(e.nextSibling?`
+`:"")}};ye.indentedCodeBlock={filter:function(n,e){return e.codeBlockStyle==="indented"&&n.nodeName==="PRE"&&n.firstChild&&n.firstChild.nodeName==="CODE"},replacement:function(n,e,t){return`
+
+ `+e.firstChild.textContent.replace(/\n/g,`
+ `)+`
+
+`}};ye.fencedCodeBlock={filter:function(n,e){return e.codeBlockStyle==="fenced"&&n.nodeName==="PRE"&&n.firstChild&&n.firstChild.nodeName==="CODE"},replacement:function(n,e,t){for(var r=e.firstChild.getAttribute("class")||"",s=(r.match(/language-(\S+)/)||[null,""])[1],i=e.firstChild.textContent,o=t.fence.charAt(0),l=3,a=new RegExp("^"+o+"{3,}","gm"),c;c=a.exec(i);)c[0].length>=l&&(l=c[0].length+1);var u=Ho(o,l);return`
+
+`+u+s+`
+`+i.replace(/\n$/,"")+`
+`+u+`
+
+`}};ye.horizontalRule={filter:"hr",replacement:function(n,e,t){return`
+
+`+t.hr+`
+
+`}};ye.inlineLink={filter:function(n,e){return e.linkStyle==="inlined"&&n.nodeName==="A"&&n.getAttribute("href")},replacement:function(n,e){var t=Bl(e.getAttribute("href")),r=$l(Ys(e.getAttribute("title"))),s=r?' "'+r+'"':"";return"["+n+"]("+t+s+")"}};ye.referenceLink={filter:function(n,e){return e.linkStyle==="referenced"&&n.nodeName==="A"&&n.getAttribute("href")},replacement:function(n,e,t){var r=Bl(e.getAttribute("href")),s=Ys(e.getAttribute("title"));s&&(s=' "'+$l(s)+'"');var i,o;switch(t.linkReferenceStyle){case"collapsed":i="["+n+"][]",o="["+n+"]: "+r+s;break;case"shortcut":i="["+n+"]",o="["+n+"]: "+r+s;break;default:var l=this.references.length+1;i="["+n+"]["+l+"]",o="["+l+"]: "+r+s}return this.references.push(o),i},references:[],append:function(n){var e="";return this.references.length&&(e=`
+
+`+this.references.join(`
+`)+`
+
+`,this.references=[]),e}};ye.emphasis={filter:["em","i"],replacement:function(n,e,t){return n.trim()?t.emDelimiter+n+t.emDelimiter:""}};ye.strong={filter:["strong","b"],replacement:function(n,e,t){return n.trim()?t.strongDelimiter+n+t.strongDelimiter:""}};ye.code={filter:function(n){var e=n.previousSibling||n.nextSibling,t=n.parentNode.nodeName==="PRE"&&!e;return n.nodeName==="CODE"&&!t},replacement:function(n){if(!n)return"";n=n.replace(/\r?\n|\r/g," ");for(var e=/^`|^ .*?[^ ].* $|`$/.test(n)?" ":"",t="`",r=n.match(/`+/gm)||[];r.indexOf(t)!==-1;)t=t+"`";return t+e+n+e+t}};ye.image={filter:"img",replacement:function(n,e){var t=Bf(Ys(e.getAttribute("alt"))),r=Bl(e.getAttribute("src")||""),s=Ys(e.getAttribute("title")),i=s?' "'+$l(s)+'"':"";return r?"":""}};function Ys(n){return n?n.replace(/(\n+\s*)+/g,`
+`):""}function Bl(n){var e=n.replace(/([<>()])/g,"\\$1");return e.indexOf(" ")>=0?"<"+e+">":e}function $l(n){return n.replace(/"/g,'\\"')}function $f(n){this.options=n,this._keep=[],this._remove=[],this.blankRule={replacement:n.blankReplacement},this.keepReplacement=n.keepReplacement,this.defaultRule={replacement:n.defaultReplacement},this.array=[];for(var e in n.rules)this.array.push(n.rules[e])}$f.prototype={add:function(n,e){this.array.unshift(e)},keep:function(n){this._keep.unshift({filter:n,replacement:this.keepReplacement})},remove:function(n){this._remove.unshift({filter:n,replacement:function(){return""}})},forNode:function(n){if(n.isBlank)return this.blankRule;var e;return(e=Gi(this.array,n,this.options))||(e=Gi(this._keep,n,this.options))||(e=Gi(this._remove,n,this.options))?e:this.defaultRule},forEach:function(n){for(var e=0;e-1)return!0}else if(typeof r=="function"){if(r.call(n,e,t))return!0}else throw new TypeError("`filter` needs to be a string, array, or function")}function Fw(n){var e=n.element,t=n.isBlock,r=n.isVoid,s=n.isPre||function(d){return d.nodeName==="PRE"};if(!(!e.firstChild||s(e))){for(var i=null,o=!1,l=null,a=Uc(l,e,s);a!==e;){if(a.nodeType===3||a.nodeType===4){var c=a.data.replace(/[ \r\n\t]+/g," ");if((!i||/ $/.test(i.data))&&!o&&c[0]===" "&&(c=c.substr(1)),!c){a=Yi(a);continue}a.data=c,i=a}else if(a.nodeType===1)t(a)||a.nodeName==="BR"?(i&&(i.data=i.data.replace(/ $/,"")),i=null,o=!1):r(a)||s(a)?(i=null,o=!0):i&&(o=!1);else{a=Yi(a);continue}var u=Uc(l,a,s);l=a,a=u}i&&(i.data=i.data.replace(/ $/,""),i.data||Yi(i))}}function Yi(n){var e=n.nextSibling||n.parentNode;return n.parentNode.removeChild(n),e}function Uc(n,e,t){return n&&n.parentNode===e||t(e)?e.nextSibling||e.parentNode:e.firstChild||e.nextSibling||e.parentNode}var Fl=typeof window<"u"?window:{};function Hw(){var n=Fl.DOMParser,e=!1;try{new n().parseFromString("","text/html")&&(e=!0)}catch{}return e}function _w(){var n=function(){};return jw()?n.prototype.parseFromString=function(e){var t=new window.ActiveXObject("htmlfile");return t.designMode="on",t.open(),t.write(e),t.close(),t}:n.prototype.parseFromString=function(e){var t=document.implementation.createHTMLDocument("");return t.open(),t.write(e),t.close(),t},n}function jw(){var n=!1;try{document.implementation.createHTMLDocument("").open()}catch{Fl.ActiveXObject&&(n=!0)}return n}var Vw=Hw()?Fl.DOMParser:_w();function Ww(n,e){var t;if(typeof n=="string"){var r=qw().parseFromString(''+n+"","text/html");t=r.getElementById("turndown-root")}else t=n.cloneNode(!0);return Fw({element:t,isBlock:Pl,isVoid:Lf,isPre:e.preformattedCode?Uw:null}),t}var Xi;function qw(){return Xi=Xi||new Vw,Xi}function Uw(n){return n.nodeName==="PRE"||n.nodeName==="CODE"}function Kw(n,e){return n.isBlock=Pl(n),n.isCode=n.nodeName==="CODE"||n.parentNode.isCode,n.isBlank=Jw(n),n.flankingWhitespace=Gw(n,e),n}function Jw(n){return!Lf(n)&&!Pw(n)&&/^\s*$/i.test(n.textContent)&&!Lw(n)&&!zw(n)}function Gw(n,e){if(n.isBlock||e.preformattedCode&&n.isCode)return{leading:"",trailing:""};var t=Yw(n.textContent);return t.leadingAscii&&Kc("left",n,e)&&(t.leading=t.leadingNonAscii),t.trailingAscii&&Kc("right",n,e)&&(t.trailing=t.trailingNonAscii),{leading:t.leading,trailing:t.trailing}}function Yw(n){var e=n.match(/^(([ \t\r\n]*)(\s*))(?:(?=\S)[\s\S]*\S)?((\s*?)([ \t\r\n]*))$/);return{leading:e[1],leadingAscii:e[2],leadingNonAscii:e[3],trailing:e[4],trailingNonAscii:e[5],trailingAscii:e[6]}}function Kc(n,e,t){var r,s,i;return n==="left"?(r=e.previousSibling,s=/ $/):(r=e.nextSibling,s=/^ /),r&&(r.nodeType===3?i=s.test(r.nodeValue):t.preformattedCode&&r.nodeName==="CODE"?i=!1:r.nodeType===1&&!Pl(r)&&(i=s.test(r.textContent))),i}var Xw=Array.prototype.reduce;function vr(n){if(!(this instanceof vr))return new vr(n);var e={rules:ye,headingStyle:"setext",hr:"* * *",bulletListMarker:"*",codeBlockStyle:"indented",fence:"```",emDelimiter:"_",strongDelimiter:"**",linkStyle:"inlined",linkReferenceStyle:"full",br:" ",preformattedCode:!1,blankReplacement:function(t,r){return r.isBlock?`
+
+`:""},keepReplacement:function(t,r){return r.isBlock?`
+
+`+r.outerHTML+`
+
+`:r.outerHTML},defaultReplacement:function(t,r){return r.isBlock?`
+
+`+t+`
+
+`:t}};this.options=Iw({},e,n),this.rules=new $f(this.options)}vr.prototype={turndown:function(n){if(!e1(n))throw new TypeError(n+" is not a string, or an element/document/fragment node.");if(n==="")return"";var e=Ff.call(this,new Ww(n,this.options));return Qw.call(this,e)},use:function(n){if(Array.isArray(n))for(var e=0;enull};function Zt(n){let e=[];return t=>{let r=Math.max(0,Math.min(3,t-1)),s=e[r];return s||(s=n(r),e[r]=s),s}}function F(n,e=""){let t=typeof n=="string"?n:n.source,r={replace:(s,i)=>{let o=typeof i=="string"?i:i.source;return o=o.replace(fe.caret,"$1"),t=t.replace(s,o),r},getRegex:()=>new RegExp(t,e)};return r}var t1=((n="")=>{try{return!!new RegExp("(?<=1)(?/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:n=>new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:Zt(n=>new RegExp(`^ {0,${n}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:Zt(n=>new RegExp(`^ {0,${n}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:Zt(n=>new RegExp(`^ {0,${n}}(?:\`\`\`|~~~)`)),headingBeginRegex:Zt(n=>new RegExp(`^ {0,${n}}#`)),htmlBeginRegex:Zt(n=>new RegExp(`^ {0,${n}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:Zt(n=>new RegExp(`^ {0,${n}}>`))},n1=/^(?:[ \t]*(?:\n|$))+/,r1=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,s1=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Nr=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,i1=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,_l=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,jf=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Vf=F(jf).replace(/bull/g,_l).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),o1=F(jf).replace(/bull/g,_l).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),jl=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,l1=/^[^\n]+/,Vl=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,a1=F(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Vl).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),c1=F(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,_l).getRegex(),pi="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Wl=/|$))/,u1=F("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Wl).replace("tag",pi).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Wf=F(jl).replace("hr",Nr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html","?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",pi).getRegex(),d1=F(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Wf).getRegex(),ql={blockquote:d1,code:r1,def:a1,fences:s1,heading:i1,hr:Nr,html:u1,lheading:Vf,list:c1,newline:n1,paragraph:Wf,table:At,text:l1},Jc=F("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Nr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",pi).getRegex(),h1={...ql,lheading:o1,table:Jc,paragraph:F(jl).replace("hr",Nr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Jc).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html","?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",pi).getRegex()},f1={...ql,html:F(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?\\1> *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Wl).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:At,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:F(jl).replace("hr",Nr).replace("heading",` *#{1,6} *[^
+]`).replace("lheading",Vf).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},p1=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,m1=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,qf=/^( {2,}|\\)\n(?!\s*$)/,g1=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\`+)[^`]+\k(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",t1?"(?`+)[^`]+\k(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Kf=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,S1=F(Kf,"u").replace(/punct/g,Cn).getRegex(),w1=F(Kf,"u").replace(/punct/g,Uf).getRegex(),Jf="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",v1=F(Jf,"gu").replace(/notPunctSpace/g,Ul).replace(/punctSpace/g,mi).replace(/punct/g,Cn).getRegex(),E1=F(Jf,"gu").replace(/notPunctSpace/g,b1).replace(/punctSpace/g,k1).replace(/punct/g,Uf).getRegex(),C1=F("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Ul).replace(/punctSpace/g,mi).replace(/punct/g,Cn).getRegex(),T1=F(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,Cn).getRegex(),M1="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",A1=F(M1,"gu").replace(/notPunctSpace/g,Ul).replace(/punctSpace/g,mi).replace(/punct/g,Cn).getRegex(),N1=F(/\\(punct)/,"gu").replace(/punct/g,Cn).getRegex(),O1=F(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),R1=F(Wl).replace("(?:-->|$)","-->").getRegex(),I1=F("^comment|^[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^").replace("comment",R1).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Xs=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,D1=F(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",Xs).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Gf=F(/^!?\[(label)\]\[(ref)\]/).replace("label",Xs).replace("ref",Vl).getRegex(),Yf=F(/^!?\[(ref)\](?:\[\])?/).replace("ref",Vl).getRegex(),L1=F("reflink|nolink(?!\\()","g").replace("reflink",Gf).replace("nolink",Yf).getRegex(),Gc=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Kl={_backpedal:At,anyPunctuation:N1,autolink:O1,blockSkip:x1,br:qf,code:m1,del:At,delLDelim:At,delRDelim:At,emStrongLDelim:S1,emStrongRDelimAst:v1,emStrongRDelimUnd:C1,escape:p1,link:D1,nolink:Yf,punctuation:y1,reflink:Gf,reflinkSearch:L1,tag:I1,text:g1,url:At},P1={...Kl,link:F(/^!?\[(label)\]\((.*?)\)/).replace("label",Xs).getRegex(),reflink:F(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Xs).getRegex()},_o={...Kl,emStrongRDelimAst:E1,emStrongLDelim:w1,delLDelim:T1,delRDelim:A1,url:F(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Gc).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:F(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\":">",'"':""","'":"'"},Yc=n=>B1[n];function _e(n,e){if(e){if(fe.escapeTest.test(n))return n.replace(fe.escapeReplace,Yc)}else if(fe.escapeTestNoEncode.test(n))return n.replace(fe.escapeReplaceNoEncode,Yc);return n}function Xc(n){try{n=encodeURI(n).replace(fe.percentDecode,"%")}catch{return null}return n}function Qc(n,e){var i;let t=n.replace(fe.findPipe,(o,l,a)=>{let c=!1,u=l;for(;--u>=0&&a[u]==="\\";)c=!c;return c?"|":" |"}),r=t.split(fe.splitPipe),s=0;if(r[0].trim()||r.shift(),r.length>0&&!((i=r.at(-1))!=null&&i.trim())&&r.pop(),e)if(r.length>e)r.splice(e);else for(;r.length=0&&fe.blankLine.test(e[t]);)t--;return e.length-t<=2?n:e.slice(0,t+1).join(`
+`)}function $1(n,e){if(n.indexOf(e[1])===-1)return-1;let t=0;for(let r=0;r0?-2:-1}function F1(n,e=0){let t=e,r="";for(let s of n)if(s===" "){let i=4-t%4;r+=" ".repeat(i),t+=i}else r+=s,t++;return r}function eu(n,e,t,r,s){let i=e.href,o=e.title||null,l=n[1].replace(s.other.outputLinkReplace,"$1");r.state.inLink=!0;let a={type:n[0].charAt(0)==="!"?"image":"link",raw:t,href:i,title:o,text:l,tokens:r.inlineTokens(l)};return r.state.inLink=!1,a}function H1(n,e,t){let r=n.match(t.other.indentCodeCompensation);if(r===null)return e;let s=r[1];return e.split(`
+`).map(i=>{let o=i.match(t.other.beginningSpace);if(o===null)return i;let[l]=o;return l.length>=s.length?i.slice(s.length):i}).join(`
+`)}var Qs=class{constructor(n){V(this,"options");V(this,"rules");V(this,"lexer");this.options=n||Yt}space(n){let e=this.rules.block.newline.exec(n);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(n){let e=this.rules.block.code.exec(n);if(e){let t=this.options.pedantic?e[0]:Zc(e[0]),r=t.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t,codeBlockStyle:"indented",text:r}}}fences(n){let e=this.rules.block.fences.exec(n);if(e){let t=e[0],r=H1(t,e[3]||"",this.rules);return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:r}}}heading(n){let e=this.rules.block.heading.exec(n);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){let r=at(t,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(t=r.trim())}return{type:"heading",raw:at(e[0],`
+`),depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(n){let e=this.rules.block.hr.exec(n);if(e)return{type:"hr",raw:at(e[0],`
+`)}}blockquote(n){let e=this.rules.block.blockquote.exec(n);if(e){let t=at(e[0],`
+`).split(`
+`),r="",s="",i=[];for(;t.length>0;){let o=!1,l=[],a;for(a=0;a1,s={type:"list",raw:"",ordered:r,start:r?+t.slice(0,-1):"",loose:!1,items:[]};t=r?`\\d{1,9}\\${t.slice(-1)}`:`\\${t}`,this.options.pedantic&&(t=r?t:"[*+-]");let i=this.rules.other.listItemRegex(t),o=!1;for(;n;){let a=!1,c="",u="";if(!(e=i.exec(n))||this.rules.block.hr.test(n))break;c=e[0],n=n.substring(c.length);let d=F1(e[2].split(`
+`,1)[0],e[1].length),h=n.split(`
+`,1)[0],f=!d.trim(),p=0;if(this.options.pedantic?(p=2,u=d.trimStart()):f?p=e[1].length+1:(p=d.search(this.rules.other.nonSpaceChar),p=p>4?1:p,u=d.slice(p),p+=e[1].length),f&&this.rules.other.blankLine.test(h)&&(c+=h+`
+`,n=n.substring(h.length+1),a=!0),!a){let m=this.rules.other.nextBulletRegex(p),g=this.rules.other.hrRegex(p),y=this.rules.other.fencesBeginRegex(p),x=this.rules.other.headingBeginRegex(p),C=this.rules.other.htmlBeginRegex(p),v=this.rules.other.blockquoteBeginRegex(p);for(;n;){let k=n.split(`
+`,1)[0],M;if(h=k,this.options.pedantic?(h=h.replace(this.rules.other.listReplaceNesting," "),M=h):M=h.replace(this.rules.other.tabCharGlobal," "),y.test(h)||x.test(h)||C.test(h)||v.test(h)||m.test(h)||g.test(h))break;if(M.search(this.rules.other.nonSpaceChar)>=p||!h.trim())u+=`
+`+M.slice(p);else{if(f||d.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||y.test(d)||x.test(d)||g.test(d))break;u+=`
+`+h}f=!h.trim(),c+=k+`
+`,n=n.substring(k.length+1),d=M.slice(p)}}s.loose||(o?s.loose=!0:this.rules.other.doubleBlankLine.test(c)&&(o=!0)),s.items.push({type:"list_item",raw:c,task:!!this.options.gfm&&this.rules.other.listIsTask.test(u),loose:!1,text:u,tokens:[]}),s.raw+=c}let l=s.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd();else return;s.raw=s.raw.trimEnd();for(let a of s.items){this.lexer.state.top=!1,a.tokens=this.lexer.blockTokens(a.text,[]);let c=a.tokens[0];if(a.task&&((c==null?void 0:c.type)==="text"||(c==null?void 0:c.type)==="paragraph")){a.text=a.text.replace(this.rules.other.listReplaceTask,""),c.raw=c.raw.replace(this.rules.other.listReplaceTask,""),c.text=c.text.replace(this.rules.other.listReplaceTask,"");for(let d=this.lexer.inlineQueue.length-1;d>=0;d--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[d].src)){this.lexer.inlineQueue[d].src=this.lexer.inlineQueue[d].src.replace(this.rules.other.listReplaceTask,"");break}let u=this.rules.other.listTaskCheckbox.exec(a.raw);if(u){let d={type:"checkbox",raw:u[0]+" ",checked:u[0]!=="[ ]"};a.checked=d.checked,s.loose?a.tokens[0]&&["paragraph","text"].includes(a.tokens[0].type)&&"tokens"in a.tokens[0]&&a.tokens[0].tokens?(a.tokens[0].raw=d.raw+a.tokens[0].raw,a.tokens[0].text=d.raw+a.tokens[0].text,a.tokens[0].tokens.unshift(d)):a.tokens.unshift({type:"paragraph",raw:d.raw,text:d.raw,tokens:[d]}):a.tokens.unshift(d)}}else a.task&&(a.task=!1);if(!s.loose){let u=a.tokens.filter(h=>h.type==="space"),d=u.length>0&&u.some(h=>this.rules.other.anyLine.test(h.raw));s.loose=d}}if(s.loose)for(let a of s.items){a.loose=!0;for(let c of a.tokens)c.type==="text"&&(c.type="paragraph")}return s}}html(n){let e=this.rules.block.html.exec(n);if(e){let t=Zc(e[0]);return{type:"html",block:!0,raw:t,pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:t}}}def(n){let e=this.rules.block.def.exec(n);if(e){let t=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",s=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:at(e[0],`
+`),href:r,title:s}}}table(n){var o;let e=this.rules.block.table.exec(n);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let t=Qc(e[1]),r=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),s=(o=e[3])!=null&&o.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
+`):[],i={type:"table",raw:at(e[0],`
+`),header:[],align:[],rows:[]};if(t.length===r.length){for(let l of r)this.rules.other.tableAlignRight.test(l)?i.align.push("right"):this.rules.other.tableAlignCenter.test(l)?i.align.push("center"):this.rules.other.tableAlignLeft.test(l)?i.align.push("left"):i.align.push(null);for(let l=0;l({text:a,tokens:this.lexer.inline(a),header:!1,align:i.align[c]})));return i}}lheading(n){let e=this.rules.block.lheading.exec(n);if(e){let t=e[1].trim();return{type:"heading",raw:at(e[0],`
+`),depth:e[2].charAt(0)==="="?1:2,text:t,tokens:this.lexer.inline(t)}}}paragraph(n){let e=this.rules.block.paragraph.exec(n);if(e){let t=e[1].charAt(e[1].length-1)===`
+`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(n){let e=this.rules.block.text.exec(n);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(n){let e=this.rules.inline.escape.exec(n);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(n){let e=this.rules.inline.tag.exec(n);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(n){let e=this.rules.inline.link.exec(n);if(e){let t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;let i=at(t.slice(0,-1),"\\");if((t.length-i.length)%2===0)return}else{let i=$1(e[2],"()");if(i===-2)return;if(i>-1){let o=(e[0].indexOf("!")===0?5:4)+e[1].length+i;e[2]=e[2].substring(0,i),e[0]=e[0].substring(0,o).trim(),e[3]=""}}let r=e[2],s="";if(this.options.pedantic){let i=this.rules.other.pedanticHrefTitle.exec(r);i&&(r=i[1],s=i[3])}else s=e[3]?e[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(t)?r=r.slice(1):r=r.slice(1,-1)),eu(e,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:s&&s.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(n,e){let t;if((t=this.rules.inline.reflink.exec(n))||(t=this.rules.inline.nolink.exec(n))){let r=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),s=e[r.toLowerCase()];if(!s){let i=t[0].charAt(0);return{type:"text",raw:i,text:i}}return eu(t,s,t[0],this.lexer,this.rules)}}emStrong(n,e,t=""){let r=this.rules.inline.emStrongLDelim.exec(n);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!t||this.rules.inline.punctuation.exec(t))){let s=[...r[0]].length-1,i,o,l=s,a=0,c=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,e=e.slice(-1*n.length+s);(r=c.exec(e))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(o=[...i].length,r[3]||r[4]){l+=o;continue}else if((r[5]||r[6])&&s%3&&!((s+o)%3)){a+=o;continue}if(l-=o,l>0)continue;o=Math.min(o,o+l+a);let u=[...r[0]][0].length,d=n.slice(0,s+r.index+u+o);if(Math.min(s,o)%2){let f=d.slice(1,-1);return{type:"em",raw:d,text:f,tokens:this.lexer.inlineTokens(f)}}let h=d.slice(2,-2);return{type:"strong",raw:d,text:h,tokens:this.lexer.inlineTokens(h)}}}}codespan(n){let e=this.rules.inline.code.exec(n);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(t),s=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return r&&s&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(n){let e=this.rules.inline.br.exec(n);if(e)return{type:"br",raw:e[0]}}del(n,e,t=""){let r=this.rules.inline.delLDelim.exec(n);if(r&&(!r[1]||!t||this.rules.inline.punctuation.exec(t))){let s=[...r[0]].length-1,i,o,l=s,a=this.rules.inline.delRDelim;for(a.lastIndex=0,e=e.slice(-1*n.length+s);(r=a.exec(e))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(o=[...i].length,o!==s))continue;if(r[3]||r[4]){l+=o;continue}if(l-=o,l>0)continue;o=Math.min(o,o+l);let c=[...r[0]][0].length,u=n.slice(0,s+r.index+c+o),d=u.slice(s,-s);return{type:"del",raw:u,text:d,tokens:this.lexer.inlineTokens(d)}}}}autolink(n){let e=this.rules.inline.autolink.exec(n);if(e){let t,r;return e[2]==="@"?(t=e[1],r="mailto:"+t):(t=e[1],r=t),{type:"link",raw:e[0],text:t,href:r,tokens:[{type:"text",raw:t,text:t}]}}}url(n){var t;let e;if(e=this.rules.inline.url.exec(n)){let r,s;if(e[2]==="@")r=e[0],s="mailto:"+r;else{let i;do i=e[0],e[0]=((t=this.rules.inline._backpedal.exec(e[0]))==null?void 0:t[0])??"";while(i!==e[0]);r=e[0],e[1]==="www."?s="http://"+e[0]:s=e[0]}return{type:"link",raw:e[0],text:r,href:s,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(n){let e=this.rules.inline.text.exec(n);if(e){let t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}},ze=class jo{constructor(e){V(this,"tokens");V(this,"options");V(this,"state");V(this,"inlineQueue");V(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Yt,this.options.tokenizer=this.options.tokenizer||new Qs,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:fe,block:Ur.normal,inline:On.normal};this.options.pedantic?(t.block=Ur.pedantic,t.inline=On.pedantic):this.options.gfm&&(t.block=Ur.gfm,this.options.breaks?t.inline=On.breaks:t.inline=On.gfm),this.tokenizer.rules=t}static get rules(){return{block:Ur,inline:On}}static lex(e,t){return new jo(t).lex(e)}static lexInline(e,t){return new jo(t).inlineTokens(e)}lex(e){e=e.replace(fe.carriageReturn,`
+`),this.blockTokens(e,this.tokens);for(let t=0;t(a=u.call({lexer:this},e,t))?(e=e.substring(a.raw.length),t.push(a),!0):!1))continue;if(a=this.tokenizer.space(e)){e=e.substring(a.raw.length);let u=t.at(-1);a.raw.length===1&&u!==void 0?u.raw+=`
+`:t.push(a);continue}if(a=this.tokenizer.code(e)){e=e.substring(a.raw.length);let u=t.at(-1);(u==null?void 0:u.type)==="paragraph"||(u==null?void 0:u.type)==="text"?(u.raw+=(u.raw.endsWith(`
+`)?"":`
+`)+a.raw,u.text+=`
+`+a.text,this.inlineQueue.at(-1).src=u.text):t.push(a);continue}if(a=this.tokenizer.fences(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.heading(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.hr(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.blockquote(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.list(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.html(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.def(e)){e=e.substring(a.raw.length);let u=t.at(-1);(u==null?void 0:u.type)==="paragraph"||(u==null?void 0:u.type)==="text"?(u.raw+=(u.raw.endsWith(`
+`)?"":`
+`)+a.raw,u.text+=`
+`+a.raw,this.inlineQueue.at(-1).src=u.text):this.tokens.links[a.tag]||(this.tokens.links[a.tag]={href:a.href,title:a.title},t.push(a));continue}if(a=this.tokenizer.table(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.lheading(e)){e=e.substring(a.raw.length),t.push(a);continue}let c=e;if((l=this.options.extensions)!=null&&l.startBlock){let u=1/0,d=e.slice(1),h;this.options.extensions.startBlock.forEach(f=>{h=f.call({lexer:this},d),typeof h=="number"&&h>=0&&(u=Math.min(u,h))}),u<1/0&&u>=0&&(c=e.substring(0,u+1))}if(this.state.top&&(a=this.tokenizer.paragraph(c))){let u=t.at(-1);r&&(u==null?void 0:u.type)==="paragraph"?(u.raw+=(u.raw.endsWith(`
+`)?"":`
+`)+a.raw,u.text+=`
+`+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=u.text):t.push(a),r=c.length!==e.length,e=e.substring(a.raw.length);continue}if(a=this.tokenizer.text(e)){e=e.substring(a.raw.length);let u=t.at(-1);(u==null?void 0:u.type)==="text"?(u.raw+=(u.raw.endsWith(`
+`)?"":`
+`)+a.raw,u.text+=`
+`+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=u.text):t.push(a);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){var c,u,d,h,f;this.tokenizer.lexer=this;let r=e,s=null;if(this.tokens.links){let p=Object.keys(this.tokens.links);if(p.length>0)for(;(s=this.tokenizer.rules.inline.reflinkSearch.exec(r))!==null;)p.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(s=this.tokenizer.rules.inline.anyPunctuation.exec(r))!==null;)r=r.slice(0,s.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let i;for(;(s=this.tokenizer.rules.inline.blockSkip.exec(r))!==null;)i=s[2]?s[2].length:0,r=r.slice(0,s.index+i)+"["+"a".repeat(s[0].length-i-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);r=((u=(c=this.options.hooks)==null?void 0:c.emStrongMask)==null?void 0:u.call({lexer:this},r))??r;let o=!1,l="",a=1/0;for(;e;){if(e.length(p=g.call({lexer:this},e,t))?(e=e.substring(p.raw.length),t.push(p),!0):!1))continue;if(p=this.tokenizer.escape(e)){e=e.substring(p.raw.length),t.push(p);continue}if(p=this.tokenizer.tag(e)){e=e.substring(p.raw.length),t.push(p);continue}if(p=this.tokenizer.link(e)){e=e.substring(p.raw.length),t.push(p);continue}if(p=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(p.raw.length);let g=t.at(-1);p.type==="text"&&(g==null?void 0:g.type)==="text"?(g.raw+=p.raw,g.text+=p.text):t.push(p);continue}if(p=this.tokenizer.emStrong(e,r,l)){e=e.substring(p.raw.length),t.push(p);continue}if(p=this.tokenizer.codespan(e)){e=e.substring(p.raw.length),t.push(p);continue}if(p=this.tokenizer.br(e)){e=e.substring(p.raw.length),t.push(p);continue}if(p=this.tokenizer.del(e,r,l)){e=e.substring(p.raw.length),t.push(p);continue}if(p=this.tokenizer.autolink(e)){e=e.substring(p.raw.length),t.push(p);continue}if(!this.state.inLink&&(p=this.tokenizer.url(e))){e=e.substring(p.raw.length),t.push(p);continue}let m=e;if((f=this.options.extensions)!=null&&f.startInline){let g=1/0,y=e.slice(1),x;this.options.extensions.startInline.forEach(C=>{x=C.call({lexer:this},y),typeof x=="number"&&x>=0&&(g=Math.min(g,x))}),g<1/0&&g>=0&&(m=e.substring(0,g+1))}if(p=this.tokenizer.inlineText(m)){e=e.substring(p.raw.length),p.raw.slice(-1)!=="_"&&(l=p.raw.slice(-1)),o=!0;let g=t.at(-1);(g==null?void 0:g.type)==="text"?(g.raw+=p.raw,g.text+=p.text):t.push(p);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}infiniteLoopError(e){let t="Infinite loop on byte: "+e;if(this.options.silent)console.error(t);else throw new Error(t)}},Zs=class{constructor(n){V(this,"options");V(this,"parser");this.options=n||Yt}space(n){return""}code({text:n,lang:e,escaped:t}){var i;let r=(i=(e||"").match(fe.notSpaceStart))==null?void 0:i[0],s=n.replace(fe.endingNewline,"")+`
+`;return r?''+(t?s:_e(s,!0))+`
+`:""+(t?s:_e(s,!0))+`
+`}blockquote({tokens:n}){return`
+${this.parser.parse(n)}
+`}html({text:n}){return n}def(n){return""}heading({tokens:n,depth:e}){return`${this.parser.parseInline(n)}
+`}hr(n){return`
+`}list(n){let e=n.ordered,t=n.start,r="";for(let o=0;o
+`+r+""+s+`>
+`}listitem(n){return`${this.parser.parse(n.tokens)}
+`}checkbox({checked:n}){return" '}paragraph({tokens:n}){return`${this.parser.parseInline(n)}
+`}table(n){let e="",t="";for(let s=0;s${r}`),`
+`}tablerow({text:n}){return`
+${n}
+`}tablecell(n){let e=this.parser.parseInline(n.tokens),t=n.header?"th":"td";return(n.align?`<${t} align="${n.align}">`:`<${t}>`)+e+`${t}>
+`}strong({tokens:n}){return`${this.parser.parseInline(n)}`}em({tokens:n}){return`${this.parser.parseInline(n)}`}codespan({text:n}){return`${_e(n,!0)}`}br(n){return"
"}del({tokens:n}){return`${this.parser.parseInline(n)}`}link({href:n,title:e,tokens:t}){let r=this.parser.parseInline(t),s=Xc(n);if(s===null)return r;n=s;let i='"+r+"",i}image({href:n,title:e,text:t,tokens:r}){r&&(t=this.parser.parseInline(r,this.parser.textRenderer));let s=Xc(n);if(s===null)return _e(t);n=s;let i=`
",i}text(n){return"tokens"in n&&n.tokens?this.parser.parseInline(n.tokens):"escaped"in n&&n.escaped?n.text:_e(n.text)}},Jl=class{strong({text:n}){return n}em({text:n}){return n}codespan({text:n}){return n}del({text:n}){return n}html({text:n}){return n}text({text:n}){return n}link({text:n}){return""+n}image({text:n}){return""+n}br(){return""}checkbox({raw:n}){return n}},Be=class Vo{constructor(e){V(this,"options");V(this,"renderer");V(this,"textRenderer");this.options=e||Yt,this.options.renderer=this.options.renderer||new Zs,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Jl}static parse(e,t){return new Vo(t).parse(e)}static parseInline(e,t){return new Vo(t).parseInline(e)}parse(e){var r,s;this.renderer.parser=this;let t="";for(let i=0;i{let a=o[l].flat(1/0);t=t.concat(this.walkTokens(a,e))}):o.tokens&&(t=t.concat(this.walkTokens(o.tokens,e)))}}return t}use(...n){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return n.forEach(t=>{let r={...t};if(r.async=this.defaults.async||r.async||!1,t.extensions&&(t.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if("renderer"in s){let i=e.renderers[s.name];i?e.renderers[s.name]=function(...o){let l=s.renderer.apply(this,o);return l===!1&&(l=i.apply(this,o)),l}:e.renderers[s.name]=s.renderer}if("tokenizer"in s){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let i=e[s.level];i?i.unshift(s.tokenizer):e[s.level]=[s.tokenizer],s.start&&(s.level==="block"?e.startBlock?e.startBlock.push(s.start):e.startBlock=[s.start]:s.level==="inline"&&(e.startInline?e.startInline.push(s.start):e.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(e.childTokens[s.name]=s.childTokens)}),r.extensions=e),t.renderer){let s=this.defaults.renderer||new Zs(this.defaults);for(let i in t.renderer){if(!(i in s))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;let o=i,l=t.renderer[o],a=s[o];s[o]=(...c)=>{let u=l.apply(s,c);return u===!1&&(u=a.apply(s,c)),u||""}}r.renderer=s}if(t.tokenizer){let s=this.defaults.tokenizer||new Qs(this.defaults);for(let i in t.tokenizer){if(!(i in s))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;let o=i,l=t.tokenizer[o],a=s[o];s[o]=(...c)=>{let u=l.apply(s,c);return u===!1&&(u=a.apply(s,c)),u}}r.tokenizer=s}if(t.hooks){let s=this.defaults.hooks||new Gn;for(let i in t.hooks){if(!(i in s))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;let o=i,l=t.hooks[o],a=s[o];Gn.passThroughHooks.has(i)?s[o]=c=>{if(this.defaults.async&&Gn.passThroughHooksRespectAsync.has(i))return(async()=>{let d=await l.call(s,c);return a.call(s,d)})();let u=l.call(s,c);return a.call(s,u)}:s[o]=(...c)=>{if(this.defaults.async)return(async()=>{let d=await l.apply(s,c);return d===!1&&(d=await a.apply(s,c)),d})();let u=l.apply(s,c);return u===!1&&(u=a.apply(s,c)),u}}r.hooks=s}if(t.walkTokens){let s=this.defaults.walkTokens,i=t.walkTokens;r.walkTokens=function(o){let l=[];return l.push(i.call(this,o)),s&&(l=l.concat(s.call(this,o))),l}}this.defaults={...this.defaults,...r}}),this}setOptions(n){return this.defaults={...this.defaults,...n},this}lexer(n,e){return ze.lex(n,e??this.defaults)}parser(n,e){return Be.parse(n,e??this.defaults)}parseMarkdown(n){return(e,t)=>{let r={...t},s={...this.defaults,...r},i=this.onError(!!s.silent,!!s.async);if(this.defaults.async===!0&&r.async===!1)return i(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return i(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return i(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(s.hooks&&(s.hooks.options=s,s.hooks.block=n),s.async)return(async()=>{let o=s.hooks?await s.hooks.preprocess(e):e,l=await(s.hooks?await s.hooks.provideLexer(n):n?ze.lex:ze.lexInline)(o,s),a=s.hooks?await s.hooks.processAllTokens(l):l;s.walkTokens&&await Promise.all(this.walkTokens(a,s.walkTokens));let c=await(s.hooks?await s.hooks.provideParser(n):n?Be.parse:Be.parseInline)(a,s);return s.hooks?await s.hooks.postprocess(c):c})().catch(i);try{s.hooks&&(e=s.hooks.preprocess(e));let o=(s.hooks?s.hooks.provideLexer(n):n?ze.lex:ze.lexInline)(e,s);s.hooks&&(o=s.hooks.processAllTokens(o)),s.walkTokens&&this.walkTokens(o,s.walkTokens);let l=(s.hooks?s.hooks.provideParser(n):n?Be.parse:Be.parseInline)(o,s);return s.hooks&&(l=s.hooks.postprocess(l)),l}catch(o){return i(o)}}}onError(n,e){return t=>{if(t.message+=`
+Please report this to https://github.com/markedjs/marked.`,n){let r="An error occurred:
"+_e(t.message+"",!0)+"
";return e?Promise.resolve(r):r}if(e)return Promise.reject(t);throw t}}},Ut=new _1;function _(n,e){return Ut.parse(n,e)}_.options=_.setOptions=function(n){return Ut.setOptions(n),_.defaults=Ut.defaults,_f(_.defaults),_};_.getDefaults=Hl;_.defaults=Yt;_.use=function(...n){return Ut.use(...n),_.defaults=Ut.defaults,_f(_.defaults),_};_.walkTokens=function(n,e){return Ut.walkTokens(n,e)};_.parseInline=Ut.parseInline;_.Parser=Be;_.parser=Be.parse;_.Renderer=Zs;_.TextRenderer=Jl;_.Lexer=ze;_.lexer=ze.lex;_.Tokenizer=Qs;_.Hooks=Gn;_.parse=_;_.options;_.setOptions;_.use;_.walkTokens;_.parseInline;Be.parse;ze.lex;const j1=/([\s\S]*?)<\/members-only>/gi,Xf={headingStyle:"atx",codeBlockStyle:"fenced",emDelimiter:"*",bulletListMarker:"-"};function Qf(n){return n.replace(/^\n+/,"").replace(/\n+$/,"")}function tu(n){return n.replace(/\u00A0/g," ")}function Zf(n){if(!/
/i.test(n))return n;const e=new DOMParser().parseFromString(`${n}
`,"text/html"),t=e.querySelector("[data-wrap]");return t?([...t.querySelectorAll("p")].forEach(r=>{const s=r.innerHTML;if(!/
/i.test(s))return;const i=s.split(/
/i),o=e.createDocumentFragment();i.forEach((l,a)=>{if(l===""&&a===i.length-1)return;const c=e.createElement("p");c.innerHTML=l,o.appendChild(c)}),r.replaceWith(o)}),t.innerHTML):n}function ep(n){n.addRule("image",{filter:"img",replacement:(e,t)=>{const r=t,s=r.getAttribute("alt")??"",i=r.getAttribute("src")??"";return i?``:""}}),n.addRule("underline",{filter:["u"],replacement:e=>`${e}`}),n.addRule("strikethrough",{filter:["del","s","strike"],replacement:e=>`~~${e}~~`}),n.addRule("horizontalRule",{filter:"hr",replacement:()=>`
+
+---
+
+`}),n.addRule("anchor",{filter:e=>e.nodeName!=="A"?!1:!!e.getAttribute("href"),replacement:(e,t)=>{const r=t,s=r.getAttribute("href")??"",i=r.getAttribute("title");return i?`[${e}](${s} "${i}")`:`[${e}](${s})`}})}const tp=new vr(Xf);ep(tp);const Gl=new vr(Xf);ep(Gl);Gl.addRule("membersOnly",{filter:"members-only",replacement:(n,e)=>{const t=e,r=[];return t.childNodes.forEach(i=>{if(i.nodeType===Node.TEXT_NODE){const o=(i.textContent??"").trim();o&&r.push(tu(o));return}i instanceof HTMLElement&&r.push(tu(tp.turndown(i.outerHTML).trim()))}),`
+
+
+
+${Qf(r.join(`
+
+`))}
+
+
+
+`}});_.setOptions({gfm:!0,breaks:!0});_.use({tokenizer:{code(){}}});function np(n){return au.sanitize(n,lu)}function V1(n){return n.split(/(```[\s\S]*?```)/g).map((e,t)=>t%2===1?e:e.replace(/^( +)(?=\S)/gm,(r,s)=>" ".repeat(s.length))).join("")}function Qi(n){return n.trim()?_.parse(V1(n),{async:!1}):""}function W1(n){const e=new DOMParser().parseFromString(np(n),"text/html");return e.querySelectorAll(".post-members-only__badge, .post-members-only__exit-btn, .post-members-only__unwrap-btn").forEach(t=>{t.remove()}),e.querySelectorAll("members-only").forEach(t=>{const r=t.querySelector(".post-members-only__body"),s=r?r.innerHTML:t.innerHTML;t.innerHTML=Zf(s)}),e.body.innerHTML}function q1(n){return n.replace(/<\/members-only>(?=[^\s\n])/g,`
+
+`).replace(/\s*<\/members-only>/g,`
+
+`)}function U1(n){return n.replace(/^(\s*[-+*])\s+(?=\S)/gm,"$1 ").replace(/^(\s*\d+\.)\s+(?=\S)/gm,"$1 ")}function K1(n){if(!n.trim())return"";const e=W1(n),t=Gl.turndown(e).replace(/\n{3,}/g,`
+
+`).trim();return U1(t)}function Kr(n){if(!n.trim())return"";const e=q1(n),t=new RegExp(j1.source,"gi");let r="",s=0,i=t.exec(e);for(;i;){const l=e.slice(s,i.index);l.trim()&&(r+=Qi(l));const a=Qf(i[1]),c=a.trim()?Zf(Qi(a)):"";r+=`${c}`,s=t.lastIndex,i=t.exec(e)}const o=e.slice(s);return o.trim()&&(r+=Qi(o)),np(r)}const un=" ";function J1(n,e,t){const r=n.lastIndexOf(`
+`,e-1)+1,s=n.indexOf(`
+`,t),i=s===-1?n.length:s;return{lineStart:r,lineEnd:i}}function G1(n,e,t){const s=n.slice(e,t).split(`
+`).map(i=>un+i).join(`
+`);return n.slice(0,e)+s+n.slice(t)}function Y1(n,e,t,r,s){const o=n.slice(e,t).split(`
+`);let l=e,a=r,c=s;const u=o.map(d=>{const h=d.match(/^ {1,4}/),f=h?h[0].length:0;return f>0&&(r>l&&(a-=Math.min(f,r-l)),s>l&&(c-=Math.min(f,s-l))),l+=d.length+1,d.replace(/^ {1,4}/,"")}).join(`
+`);return{next:n.slice(0,e)+u+n.slice(t),newStart:Math.max(e,a),newEnd:Math.max(e,c)}}function Fe(n,e,t,r=t,s){s(e),requestAnimationFrame(()=>{n.selectionStart=t,n.selectionEnd=r,n.focus()})}function nu(n,e,t,r){const{selectionStart:s,selectionEnd:i}=n,o=e.slice(0,s)+t+e.slice(i),l=s+t.length;Fe(n,o,l,l,r)}function X1(n,e){if(n.key!=="Tab")return;n.preventDefault();const t=n.currentTarget,{selectionStart:r,selectionEnd:s,value:i}=t,{lineStart:o,lineEnd:l}=J1(i,r,s),a=r!==s,c=i.slice(o,l),u=a&&c.split(`
+`).length>1;if(n.shiftKey){if(u){const{next:m,newStart:g,newEnd:y}=Y1(i,o,l,r,s);Fe(t,m,g,y,e);return}const f=i.slice(o,r).match(/ {1,4}$/);if(f){const m=f[0].length,g=i.slice(0,r-m)+i.slice(r);Fe(t,g,r-m,s-m,e);return}const p=i.slice(o,r).match(/^ {1,4}/);if(p){const m=p[0].length,g=i.slice(0,o)+i.slice(o+m);Fe(t,g,r-m,s-m,e)}return}if(u){const h=G1(i,o,l),f=i.slice(o,l).split(`
+`).length;Fe(t,h,r+un.length,s+un.length*f,e);return}const d=i.slice(0,r)+un+i.slice(s);Fe(t,d,r+un.length,r+un.length,e)}function Rn(n,e,t,r,s,i){const{selectionStart:o,selectionEnd:l}=n,c=e.slice(o,l)||s,u=t+c+r,d=e.slice(0,o)+u+e.slice(l),h=o+t.length,f=h+c.length;Fe(n,d,h,f,i)}function Zi(n,e,t,r){const{selectionStart:s,selectionEnd:i}=n,o=e.lastIndexOf(`
+`,s-1)+1,l=e.indexOf(`
+`,i),a=l===-1?e.length:l,u=e.slice(o,a).split(`
+`).map(h=>`${t}${h}`),d=e.slice(0,o)+u.join(`
+`)+e.slice(a);Fe(n,d,s+t.length,i+t.length*u.length,r)}function Q1(n,e,t){const{selectionStart:r}=n,s=e.lastIndexOf(`
+`,r-1)+1,i=e.indexOf(`
+`,r),o=i===-1?e.length:i,l=e.slice(s,o),a=l.match(/^(#{2,6})\s+(.*)$/);let c;if(!a)c=`## ${l}`;else{const h=a[1].length,f=a[2];c=h>=6?f:`${"#".repeat(h+1)} ${f}`}const u=e.slice(0,s)+c+e.slice(o),d=c.length-l.length;Fe(n,u,r+Math.max(0,d),r+Math.max(0,d),t)}function Z1(n,e,t){const{selectionStart:r,selectionEnd:s}=n,o=e.slice(0,r)+`
+
+
+
+
+
+
+`+e.slice(s),l=r+18;Fe(n,o,l,l,t)}function ev(n,e,t,r){const{selectionStart:s,selectionEnd:i}=n,l=`[${e.slice(s,i)||"链接文字"}](${t})`,a=e.slice(0,s)+l+e.slice(i);Fe(n,a,s+l.length,s+l.length,r)}function ru(n){var s,i;const e=n.trim();if(!e)return 0;const t=((s=e.match(/[\u4e00-\u9fff]/g))==null?void 0:s.length)??0,r=((i=e.match(/[a-zA-Z0-9]+/g))==null?void 0:i.length)??0;return t+r}function eo(n){for(let e=n.depth;e>0;e-=1)if(n.node(e).type.name==="membersOnly")return e;return-1}function tv({selected:n,editor:e}){const t=()=>{e.chain().focus().exitMembersOnly().run()},r=()=>{e.chain().focus().unwrapMembersOnly().run()};return b.jsxs(ax,{as:"members-only",className:`post-members-only post-members-only--visible editor-members-only${n?" editor-members-only--selected":""}`,children:[b.jsxs("div",{className:"post-members-only__badge",contentEditable:!1,children:[b.jsx("span",{className:"post-members-only__badge-icon","aria-hidden":"true",children:b.jsx(to,{size:12})}),b.jsx("span",{children:"登录可见"}),b.jsxs("button",{type:"button",className:"post-members-only__exit-btn",title:"Ctrl+Enter 退出到公开区域",onMouseDown:s=>s.preventDefault(),onClick:t,children:[b.jsx(bp,{size:11}),"退出"]}),b.jsx("span",{className:"post-members-only__shortcut-hint",children:"Ctrl+Enter 退出"}),b.jsx("button",{type:"button",className:"post-members-only__unwrap-btn",title:"取消登录可见包裹,保留正文",onMouseDown:s=>s.preventDefault(),onClick:r,children:"取消包裹"})]}),b.jsx(lx,{className:"post-members-only__body"})]})}const nv=Ce.create({name:"membersOnly",group:"block",content:"block+",defining:!0,isolating:!0,parseHTML(){return[{tag:"members-only"}]},renderHTML({HTMLAttributes:n}){return["members-only",J(n),0]},addNodeView(){return px(tv)},addKeyboardShortcuts(){return{Enter:({editor:n})=>{const{$from:e,empty:t}=n.state.selection;if(!t||eo(e)<0)return!1;const s=e.parent,i=e.parentOffset===s.content.size,o=s.textContent.trim().length===0;return!i||!o?!1:n.commands.exitMembersOnly()},"Mod-Enter":({editor:n})=>n.isActive("membersOnly")?n.commands.exitMembersOnly():!1}},addCommands(){return{insertMembersOnly:()=>({chain:n})=>n().insertContent({type:this.name,content:[{type:"paragraph"}]}).run(),wrapMembersOnly:()=>({tr:n,state:e,dispatch:t})=>{const{from:r,to:s,empty:i}=e.selection;if(i)return!1;const o=e.doc.slice(r,s);if(!o.content.size)return!1;const l=e.schema.nodes.membersOnly.create(null,o.content);return t&&n.replaceRangeWith(r,s,l),!0},exitMembersOnly:()=>({state:n,chain:e})=>{const{$from:t}=n.selection,r=eo(t);if(r<0)return!1;const s=t.before(r),i=t.node(r),o=s+i.nodeSize;return e().insertContentAt(o,{type:"paragraph"}).setTextSelection(o+1).run()},unwrapMembersOnly:()=>({tr:n,state:e,dispatch:t})=>{const{$from:r}=e.selection,s=eo(r);if(s<0)return!1;const i=r.before(s),o=r.node(s);return n.replaceWith(i,i+o.nodeSize,o.content),t&&t(n),!0}}}}),wt=" ";function rp(n){const{from:e,to:t}=n.state.selection,r=[];return n.state.doc.nodesBetween(e,t,(s,i)=>{if(s.isTextblock)return r.push({pos:i}),!1}),r}function rv(n){const{from:e,to:t,empty:r}=n.state.selection;if(r)return!1;const s=n.state.doc.textBetween(e,t,`
+`,`
+`),i=[e];for(let a=0;a{o=o.insertText(wt,a+l),l+=wt.length}),n.view.dispatch(o),!0}function sv(n){const{from:e,to:t,empty:r}=n.state.selection;if(r)return!1;const s=n.state.doc,i=s.textBetween(e,t,`
+`,`
+`),o=[e];for(let u=0;u{const d=u+a,f=(s.textBetween(d,t+a).split(`
+`)[0]??"").match(/^ {1,4}/);f&&(l=l.delete(d,d+f[0].length),a-=f[0].length,c=!0)}),c?(n.view.dispatch(l),!0):!1}function iv(n){const{empty:e}=n.state.selection;if(e)return!1;if(n.isActive("codeBlock"))return rv(n);if(n.isActive("listItem"))return n.chain().focus().sinkListItem("listItem").run();const t=rp(n);if(t.length===0)return!1;let r=n.state.tr,s=0;return t.forEach(({pos:i})=>{const o=i+1+s;r=r.insertText(wt,o),s+=wt.length}),n.view.dispatch(r),!0}function ov(n){const{empty:e}=n.state.selection;if(e)return!1;if(n.isActive("codeBlock"))return sv(n);if(n.isActive("listItem"))return n.chain().focus().liftListItem("listItem").run();const t=rp(n);if(t.length===0)return!1;let r=n.state.tr,s=0;return t.forEach(({pos:i})=>{const o=n.state.doc.nodeAt(i);if(!(o!=null&&o.isTextblock))return;const a=o.textContent.match(/^ {1,4}/);if(!a)return;const c=a[0].length,u=i+1+s;r=r.delete(u,u+c),s-=c}),r.steps.length===0?!1:(n.view.dispatch(r),!0)}function su(n){const{state:e}=n,{$from:t,empty:r}=e.selection;if(!r||!t.parent.isTextblock)return!1;const s=t.start(),i=e.doc.textBetween(s,t.pos);if(i.endsWith(wt))return n.chain().focus().deleteRange({from:t.pos-wt.length,to:t.pos}).run();const o=i.match(/^ {1,4}/);return o?n.chain().focus().deleteRange({from:s,to:s+o[0].length}).run():!1}const lv=Y.create({name:"tabIndent",addKeyboardShortcuts(){return{Tab:({editor:n})=>n.state.selection.empty?n.isActive("codeBlock")?n.chain().focus().insertContent(wt).run():n.isActive("listItem")?n.chain().focus().sinkListItem("listItem").run():n.chain().focus().insertContent(wt).run():iv(n),"Shift-Tab":({editor:n})=>n.state.selection.empty?n.isActive("codeBlock")?su(n):n.isActive("listItem")?n.chain().focus().liftListItem("listItem").run():su(n):ov(n)}}});function av({open:n,onOpenChange:e,initialUrl:t="",onConfirm:r,onRemove:s}){const[i,o]=N.useState(t);N.useEffect(()=>{n&&o(t||"https://")},[n,t]);const l=()=>{r(i.trim()),e(!1)};return b.jsx(Mp,{open:n,onOpenChange:e,children:b.jsxs(Ap,{className:"article-link-dialog",children:[b.jsxs(Np,{children:[b.jsx(Op,{children:"插入链接"}),b.jsx(Rp,{children:"输入完整 URL,留空并确认可移除已有链接。"})]}),b.jsx(Dp,{type:"url",value:i,placeholder:"https://",onChange:a=>o(a.target.value),onKeyDown:a=>{a.key==="Enter"&&(a.preventDefault(),l())},autoFocus:!0}),b.jsxs(Ip,{className:"article-link-dialog__footer",children:[s&&t?b.jsx(gi,{type:"button",variant:"outline",onClick:()=>{s(),e(!1)},children:"移除链接"}):null,b.jsx(gi,{type:"button",variant:"outline",onClick:()=>e(!1),children:"取消"}),b.jsx(gi,{type:"button",onClick:l,children:"确定"})]})]})})}function Wo({content:n,hint:e,side:t="bottom",align:r="center",children:s,className:i}){if(!N.isValidElement(s))return s;const o=e?`${n},${e}`:n,l=N.cloneElement(s,{"aria-label":o});return b.jsxs("span",{className:Yl("ui-tooltip",i),children:[l,b.jsxs("span",{role:"tooltip",className:Yl("ui-tooltip-bubble",`ui-tooltip-bubble--${t}`,`ui-tooltip-bubble--${r}`,e?"ui-tooltip-bubble--rich":"ui-tooltip-bubble--compact"),children:[b.jsx("span",{className:"ui-tooltip-bubble__title",children:n}),e?b.jsx("span",{className:"ui-tooltip-bubble__hint",children:e}):null]})]})}const cv="在此输入仅登录用户可见的内容…";function Ye(n){return au.sanitize(n,lu)}function iu(n){return n.state.doc.textContent.trim().length===0}function uv(n){for(let e=2;e<=6;e+=1)if(n.isActive("heading",{level:e})){e===6?n.chain().focus().setParagraph().run():n.chain().focus().toggleHeading({level:e+1}).run();return}n.chain().focus().toggleHeading({level:2}).run()}async function ou(){return new Promise(n=>{const e=document.createElement("input");e.type="file",e.accept="image/jpeg,image/png,image/gif,image/webp",e.onchange=async()=>{var r;const t=(r=e.files)==null?void 0:r[0];if(!t){n(null);return}try{const{url:s}=await en.uploadPostImage(t);n(s)}catch(s){He.error(s instanceof Error?s.message:"图片上传失败"),n(null)}},e.click()})}function dv(n){return n.map((e,t)=>b.jsxs("span",{className:e.className==="article-tool-btn--members"?"article-editor-tools-members":void 0,children:[e.className==="article-tool-btn--members"?b.jsx("span",{className:"article-editor-tools-sep","aria-hidden":"true"}):null,b.jsx(Wo,{content:e.title,hint:e.hint,align:e.align,side:"bottom",children:b.jsx("button",{type:"button",className:`article-tool-btn${e.active?" active":""}${e.className?` ${e.className}`:""}`,onMouseDown:r=>r.preventDefault(),onClick:e.action,children:e.icon})})]},t))}const hv=N.forwardRef(function({value:e,onChange:t,placeholder:r="在此撰写正文…"},s){const i=N.useRef(!1),o=N.useRef(e),[,l]=N.useState(0),[a,c]=N.useState("rich"),[u,d]=N.useState(!1),[h,f]=N.useState(""),[p,m]=N.useState(!1),[g,y]=N.useState(""),[x,C]=N.useState("rich"),v=N.useRef(null),k=ox({extensions:[Mw.configure({heading:{levels:[2,3,4,5,6]}}),qS,kS.configure({openOnClick:!1,autolink:!0,defaultProtocol:"https"}),Ow.configure({inline:!1,allowBase64:!1}),Rw.configure({placeholder:({node:E})=>{var D;return E.type.name==="paragraph"&&((D=E.parent)==null?void 0:D.type.name)==="membersOnly"?cv:r},includeChildren:!0}),nv,lv],content:Ye(e)||"",onUpdate:({editor:E})=>{const D=Ye(E.getHTML());i.current=!0,o.current=D,t(D),iu(E)&&!E.state.selection.empty&&E.commands.setTextSelection(1)},onSelectionUpdate:()=>{l(E=>E+1)},onTransaction:()=>{l(E=>E+1)},editorProps:{attributes:{class:"article-prosemirror post-detail-content",spellcheck:"false"},handleKeyDown:(E,D)=>(D.ctrlKey||D.metaKey)&&D.key.toLowerCase()==="a"&&!E.state.doc.textContent.trim()?(D.preventDefault(),E.dispatch(E.state.tr.setSelection(P.create(E.state.doc,1))),!0):!1}});N.useEffect(()=>{if(!k||a!=="rich")return;if(i.current){i.current=!1;return}const E=Ye(e);E!==o.current&&(o.current=E,k.commands.setContent(E||"",{emitUpdate:!1}))},[e,k,a]),N.useEffect(()=>{if(!u)return;const E=document.body.style.overflow;document.body.style.overflow="hidden";const D=Z=>{Z.key==="Escape"&&d(!1)};return window.addEventListener("keydown",D),()=>{document.body.style.overflow=E,window.removeEventListener("keydown",D)}},[u]),N.useImperativeHandle(s,()=>({getHTML:()=>a==="markdown"?Ye(Kr(h)):k?Ye(k.getHTML()):e,isEmpty:()=>a==="markdown"?h.trim().length===0:k?iu(k):!e.trim(),focus:()=>{var E;if(a==="markdown"){(E=v.current)==null||E.focus();return}k==null||k.commands.focus()}}),[k,e,a,h]);const M=N.useCallback(E=>{f(E);const D=Ye(Kr(E));i.current=!0,o.current=D,t(D)},[t]),T=N.useCallback(E=>{if(E==="rich"){if(!k)return;const D=k.getAttributes("link").href;y(D??"")}else y("");C(E),m(!0)},[k]),L=N.useCallback(E=>{if(x==="markdown"){const D=v.current;if(!D||!E)return;ev(D,h,E,M);return}if(k){if(!E){k.chain().focus().extendMarkRange("link").unsetLink().run();return}k.chain().focus().extendMarkRange("link").setLink({href:E}).run()}},[k,x,h,M]),O=N.useCallback(()=>{k&&k.chain().focus().extendMarkRange("link").unsetLink().run()},[k]),$=N.useCallback(async()=>{if(!k)return;const E=await ou();E&&k.chain().focus().setImage({src:E}).run()},[k]),de=N.useCallback(()=>{if(!k)return;if(k.isActive("membersOnly")){k.chain().focus().exitMembersOnly().run();return}const{from:E,to:D,empty:Z}=k.state.selection;if(!Z&&E!==D){k.chain().focus().wrapMembersOnly().run();return}k.chain().focus().insertMembersOnly().run()},[k]),se=N.useCallback(()=>{if(!k)return;const E=Ye(k.getHTML());o.current=E,f(K1(E)),c("markdown")},[k]),ne=N.useCallback(()=>{const E=Ye(Kr(h));o.current=E,i.current=!0,t(E),k&&k.commands.setContent(E||"",{emitUpdate:!1}),c("rich")},[k,h,t]),H=N.useCallback(E=>()=>{const D=v.current;D&&E(D,h,M)},[h,M]),U=N.useCallback(async()=>{const E=v.current;if(!E)return;const D=await ou();D&&nu(E,h,`
+
+
+
+`,M)},[h,M]),ot=N.useMemo(()=>yp(Ye(Kr(h)),!0),[h]),sp=N.useCallback(()=>k?[{icon:b.jsx("strong",{children:"H"}),title:"标题",hint:"H2 → H6 循环",active:k.isActive("heading"),action:()=>uv(k)},{icon:b.jsx(Ql,{size:15}),title:"加粗",active:k.isActive("bold"),action:()=>k.chain().focus().toggleBold().run()},{icon:b.jsx(Zl,{size:15}),title:"斜体",active:k.isActive("italic"),action:()=>k.chain().focus().toggleItalic().run()},{icon:b.jsx(ea,{size:15}),title:"下划线",active:k.isActive("underline"),action:()=>k.chain().focus().toggleUnderline().run()},{icon:b.jsx(ta,{size:15}),title:"删除线",active:k.isActive("strike"),action:()=>k.chain().focus().toggleStrike().run()},{icon:b.jsx(na,{size:15}),title:"分割线",action:()=>k.chain().focus().setHorizontalRule().run()},{icon:b.jsx(ra,{size:15}),title:"引用",active:k.isActive("blockquote"),action:()=>k.chain().focus().toggleBlockquote().run()},{icon:b.jsx(sa,{size:15}),title:"无序列表",active:k.isActive("bulletList"),action:()=>k.chain().focus().toggleBulletList().run()},{icon:b.jsx(ia,{size:15}),title:"有序列表",active:k.isActive("orderedList"),action:()=>k.chain().focus().toggleOrderedList().run()},{icon:b.jsx(oa,{size:15}),title:"代码块",active:k.isActive("codeBlock"),action:()=>k.chain().focus().toggleCodeBlock().run()},{icon:b.jsx(la,{size:15}),title:"链接",active:k.isActive("link"),action:()=>T("rich")},{icon:b.jsx(aa,{size:15}),title:"上传图片",action:$},{icon:b.jsx(to,{size:15}),title:"登录可见",hint:"独立输入区;Ctrl+Enter 退出",active:k.isActive("membersOnly"),className:"article-tool-btn--members",action:de}]:[],[k,T,$,de]),ip=N.useCallback(()=>[{icon:b.jsx("strong",{children:"H"}),title:"标题",hint:"H2 → H6 循环",action:H(Q1)},{icon:b.jsx(Ql,{size:15}),title:"加粗",action:H((E,D,Z)=>Rn(E,D,"**","**","加粗文字",Z))},{icon:b.jsx(Zl,{size:15}),title:"斜体",action:H((E,D,Z)=>Rn(E,D,"*","*","斜体文字",Z))},{icon:b.jsx(ea,{size:15}),title:"下划线",action:H((E,D,Z)=>Rn(E,D,"","","下划线文字",Z))},{icon:b.jsx(ta,{size:15}),title:"删除线",action:H((E,D,Z)=>Rn(E,D,"~~","~~","删除线文字",Z))},{icon:b.jsx(na,{size:15}),title:"分割线",action:H((E,D,Z)=>nu(E,D,`
+
+---
+
+`,Z))},{icon:b.jsx(ra,{size:15}),title:"引用",action:H((E,D,Z)=>Zi(E,D,"> ",Z))},{icon:b.jsx(sa,{size:15}),title:"无序列表",action:H((E,D,Z)=>Zi(E,D,"- ",Z))},{icon:b.jsx(ia,{size:15}),title:"有序列表",action:H((E,D,Z)=>Zi(E,D,"1. ",Z))},{icon:b.jsx(oa,{size:15}),title:"代码块",action:H((E,D,Z)=>Rn(E,D,"```\n","\n```","代码",Z))},{icon:b.jsx(la,{size:15}),title:"链接",action:()=>T("markdown")},{icon:b.jsx(aa,{size:15}),title:"上传图片",action:U},{icon:b.jsx(to,{size:15}),title:"登录可见",hint:"插入 区块",className:"article-tool-btn--members",action:H(Z1)}],[H,T,U]),op=a==="rich"?sp():ip(),lp=a==="markdown"?ru(h):k?ru(k.getText()):0;return b.jsxs("div",{className:`article-editor article-editor--${a}${u?" article-editor--fullscreen":""}`,children:[b.jsx("div",{className:"article-editor-bar",children:b.jsx("div",{className:"article-editor-tools",children:dv(op)})}),b.jsx("div",{className:"article-editor-body",children:a==="rich"?b.jsx("div",{className:"article-editor-pane article-editor-pane--rich",children:b.jsx("div",{className:"article-editor-scroll",children:b.jsx(Ih,{editor:k,className:"article-editor-content"})})}):b.jsxs("div",{className:"article-editor-markdown",children:[b.jsx("div",{className:"article-editor-pane article-editor-pane--source",children:b.jsx("div",{className:"article-editor-scroll",children:b.jsx("textarea",{ref:v,className:"article-editor-markdown-input",value:h,onChange:E=>M(E.target.value),onKeyDown:E=>X1(E,M),placeholder:"在此编写 Markdown 源码…",spellCheck:!1})})}),b.jsxs("div",{className:"article-editor-markdown-preview",children:[b.jsx("div",{className:"article-editor-markdown-preview-label",children:"预览"}),b.jsx("div",{className:"article-editor-markdown-preview-body post-detail-content",dangerouslySetInnerHTML:{__html:ot}})]})]})}),b.jsxs("div",{className:"article-editor-status",children:[b.jsxs("div",{className:"article-editor-status-meta",children:[b.jsxs("span",{children:[lp," 字"]}),b.jsx("span",{className:"article-editor-status-sep",children:"·"}),b.jsxs("span",{children:[a==="rich"?"富文本":"Markdown 源码"," · Tab 缩进 / Shift+Tab 回退",a==="rich"?" · 登录可见内 Ctrl+Enter 退出":""]})]}),b.jsxs("div",{className:"article-editor-status-actions",children:[b.jsx(Wo,{content:a==="rich"?"Markdown 源码":"富文本编辑",hint:a==="rich"?"切换为 Markdown 源码编写":"返回所见即所得编辑",align:"end",side:"top",children:b.jsxs("button",{type:"button",className:`article-editor-view-btn${a==="markdown"?" active":""}`,onMouseDown:E=>E.preventDefault(),onClick:a==="rich"?se:ne,children:[a==="rich"?b.jsx(xp,{size:15}):b.jsx(Sp,{size:15}),b.jsx("span",{children:a==="rich"?"源码":"富文本"})]})}),b.jsx(Wo,{content:u?"退出全屏":"全屏编辑",hint:u?"Esc 也可退出":"沉浸式编写长文",align:"end",side:"top",children:b.jsxs("button",{type:"button",className:"article-editor-view-btn",onMouseDown:E=>E.preventDefault(),onClick:()=>d(E=>!E),children:[u?b.jsx(wp,{size:15}):b.jsx(vp,{size:15}),b.jsx("span",{children:u?"退出全屏":"全屏"})]})})]})]}),b.jsx(av,{open:p,onOpenChange:m,initialUrl:g,onConfirm:L,onRemove:x==="rich"&&g?O:void 0})]})});function Av(){const n=hp(),{id:e}=fp(),t=e?Number(e):null,r=t!==null&&!Number.isNaN(t),[s]=pp(),i=s.get("board")||"",{user:o,loading:l}=mp(),{limits:a}=gp(),[c,u]=N.useState([]),[d,h]=N.useState(i),[f,p]=N.useState(""),[m,g]=N.useState(""),[y,x]=N.useState(""),[C,v]=N.useState(!1),[k,M]=N.useState(r);if(N.useEffect(()=>{if(!l){if(!o){n("/login");return}if(r){M(!0),Promise.all([en.boards(),en.post(t,{skipView:!0})]).then(([O,$])=>{const de=O.boards??[];u(de);const se=$.post;if(!(o.role==="admin"||se.user_id===o.id)){He.error("无权编辑此帖子"),n(`/post/${t}`);return}if(!$.can_edit){He.error($.edit_block_reason||"当前无法编辑此帖子"),n(`/post/${t}`);return}h(String(se.board_id)),p(se.title),g(se.tags??""),x(se.content??"")}).catch(O=>{He.error(O instanceof Error?O.message:"加载帖子失败"),n("/")}).finally(()=>M(!1));return}en.boards().then(O=>{const $=O.boards??[];u($),!i&&$.length>0&&h(String($[0].id))}).catch(()=>{})}},[o,l,n,i,r,t]),l)return b.jsx("div",{className:"compose-page compose-page--empty",children:b.jsx(Xl,{size:"lg"})});if(!o)return null;if(k)return b.jsx("div",{className:"compose-page compose-page--empty",children:b.jsx(Xl,{size:"lg"})});if(!r&&c.length===0)return b.jsx("div",{className:"compose-page compose-page--empty",children:b.jsxs("div",{className:"compose-empty-card",children:[b.jsx("div",{className:"compose-empty-icon",children:"✎"}),b.jsx("h2",{children:"暂无可发帖板块"}),b.jsx("p",{children:"需要管理员先创建板块后才能发布内容"}),o.role==="admin"?b.jsx("button",{type:"button",className:"compose-primary-btn",onClick:()=>n("/admin/boards"),children:"去创建板块"}):b.jsx("button",{type:"button",className:"compose-ghost-btn",onClick:()=>n("/"),children:"返回首页"})]})});const T=async()=>{const O=f.trim();if(!r&&!d){He.warning("请选择板块");return}if(!O){He.warning("请输入标题");return}if(kp(y)){He.warning("请输入正文内容");return}v(!0);try{const $={title:O,content:y.trim(),tags:m.trim()};if(r)await en.updatePost(t,$),He.success("帖子已更新"),n(`/post/${t}`);else{const de=await en.createPost({board_id:d,...$});He.success("发帖成功"),n(`/post/${de.post_id}`)}}catch($){He.error($ instanceof Error?$.message:r?"保存失败":"发帖失败")}finally{v(!1)}},L=c.find(O=>String(O.id)===d);return b.jsx("div",{className:"compose-page",children:b.jsxs("div",{className:"compose-canvas",children:[b.jsxs("header",{className:"compose-header",children:[b.jsxs("button",{type:"button",className:"compose-back",onClick:()=>n(r?`/post/${t}`:-1),children:[b.jsx(Ep,{size:16}),b.jsx("span",{children:"返回"})]}),b.jsx("div",{className:"compose-header-actions",children:b.jsxs("button",{type:"button",className:"compose-publish-btn",disabled:C,onClick:T,children:[b.jsx(Cp,{size:16}),C?r?"保存中…":"发布中…":r?"保存修改":"发布帖子"]})})]}),b.jsxs("div",{className:"compose-meta",children:[r?L&&b.jsx("div",{className:"compose-board-pills",children:b.jsx("span",{className:"compose-board-pill active",children:L.name})}):b.jsx("div",{className:"compose-board-pills",children:c.map(O=>b.jsx("button",{type:"button",className:`compose-board-pill${String(O.id)===d?" active":""}`,onClick:()=>h(String(O.id)),children:O.name},O.id))}),b.jsxs("div",{className:"compose-tags-field",children:[b.jsx(Tp,{className:"compose-tags-icon",size:16}),b.jsx("input",{type:"text",placeholder:"添加标签,逗号分隔",value:m,onChange:O=>g(O.target.value),maxLength:a.post_tags_max>0?a.post_tags_max:void 0})]})]}),b.jsxs("div",{className:"compose-writing",children:[b.jsx("input",{className:"compose-title",type:"text",placeholder:"输入文章标题…",value:f,onChange:O=>p(O.target.value),maxLength:a.post_title_max>0?a.post_title_max:void 0}),L&&b.jsxs("div",{className:"compose-subtitle",children:[r?"编辑于":"发布至"," ",b.jsx("strong",{children:L.name})]}),b.jsx(hv,{value:y,onChange:x,placeholder:"开始写作。所见即所得,选中文字后使用工具栏设置格式。"})]})]})})}export{Av as default};
diff --git a/embed_static/static/spa/assets/ComposePage-DPJpUz3A.js b/embed_static/static/spa/assets/ComposePage-DPJpUz3A.js
deleted file mode 100644
index 5d5ce44..0000000
--- a/embed_static/static/spa/assets/ComposePage-DPJpUz3A.js
+++ /dev/null
@@ -1,165 +0,0 @@
-import{r as D,k as vt,j as w,a as Ud,m as qd,e as Jd,w as Kd,i as Gd}from"./react-vendor-CFzzFOsg.js";import{a as zt,n as Oe,u as Yd,d as Xd,S as Ho}from"./index-5C0q-ZMs.js";import{P as Qd,i as Zd}from"./postContent-ClrHK1rL.js";import{p as eh}from"./purify-vendor-Cx4rtWv4.js";import{O as Ma,Q as th,V as nh,W as rh,Y as ih,Z as sh,_ as oh,$ as lh,a0 as ah,a1 as ch,a2 as uh,A as dh,x as hh,a3 as fh}from"./ui-vendor-BtpOfToU.js";var Ca={exports:{}},Ea={};/**
- * @license React
- * use-sync-external-store-shim.production.js
- *
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */var qt=D;function ph(n,e){return n===e&&(n!==0||1/n===1/e)||n!==n&&e!==e}var mh=typeof Object.is=="function"?Object.is:ph,gh=qt.useState,yh=qt.useEffect,bh=qt.useLayoutEffect,kh=qt.useDebugValue;function Sh(n,e){var t=e(),r=gh({inst:{value:t,getSnapshot:e}}),i=r[0].inst,s=r[1];return bh(function(){i.value=t,i.getSnapshot=e,Li(i)&&s({inst:i})},[n,t,e]),yh(function(){return Li(i)&&s({inst:i}),n(function(){Li(i)&&s({inst:i})})},[n]),kh(t),t}function Li(n){var e=n.getSnapshot;n=n.value;try{var t=e();return!mh(n,t)}catch{return!0}}function xh(n,e){return e()}var wh=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?xh:Sh;Ea.useSyncExternalStore=qt.useSyncExternalStore!==void 0?qt.useSyncExternalStore:wh;Ca.exports=Ea;var Gs=Ca.exports;function te(n){this.content=n}te.prototype={constructor:te,find:function(n){for(var e=0;e>1}};te.from=function(n){if(n instanceof te)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new te(e)};function Ta(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let i=n.child(r),s=e.child(r);if(i==s){t+=i.nodeSize;continue}if(!i.sameMarkup(s))return t;if(i.isText&&i.text!=s.text){let o=i.text,l=s.text,a=0;for(;o[a]==l[a];a++)t++;return a&&a0&&f>0&&c[d-1]==u[f-1];)d--,f--,t--,r--;return d&&f&&d=56320&&n<57344}function Oa(n){return n>=55296&&n<56320}let S=class ce{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;re&&r(a,i+l,s||null,o)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,t-u),r,i+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,i){let s="",o=!0;return this.nodesBetween(e,t,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?i?typeof i=="function"?i(l):i:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(o?o=!1:s+=r),s+=c},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(t.isText&&t.sameMarkup(r)&&(i[i.length-1]=t.withText(t.text+r.text),s=1);se)for(let s=0,o=0;oe&&((ot)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,t-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,t-o-1))),r.push(l),i+=l.nodeSize),o=a}return new ce(r,i)}cutByIndex(e,t){return e==t?ce.empty:e==0&&t==this.content.length?this:new ce(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let i=this.content.slice(),s=this.size+t.nodeSize-r.nodeSize;return i[e]=t,new ce(i,s)}addToStart(e){return new ce([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new ce(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;tthis.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,r=0;;t++){let i=this.child(t),s=r+i.nodeSize;if(s>=e)return s==e?ir(t+1,s):ir(t,r);r=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return ce.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return ce.fromArray(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return ce.empty;let t,r=0;for(let i=0;ithis.type.rank&&(t||(t=e.slice(0,i)),t.push(this),r=!0),t&&t.push(s)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;tr.type.rank-i.type.rank),t}};$.none=[];let Fn=class extends Error{},C=class Bt{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=Ia(this.content,e+this.openStart,t,this.openStart+1,this.openEnd+1);return r&&new Bt(r,this.openStart,this.openEnd)}removeBetween(e,t){return new Bt(Ra(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return Bt.empty;let r=t.openStart||0,i=t.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Bt(S.fromJSON(e,t.content),r,i)}static maxOpen(e,t=!0){let r=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.lastChild)i++;return new Bt(e,r,i)}};C.empty=new C(S.empty,0,0);function Ra(n,e,t){let{index:r,offset:i}=n.findIndex(e),s=n.maybeChild(r),{index:o,offset:l}=n.findIndex(t);if(i==e||s.isText){if(l!=t&&!n.child(o).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=o)throw new RangeError("Removing non-flat range");return n.replaceChild(r,s.copy(Ra(s.content,e-i-1,t-i-1)))}function Ia(n,e,t,r,i,s){let{index:o,offset:l}=n.findIndex(e),a=n.maybeChild(o);if(l==e||a.isText)return s&&r<=0&&i<=0&&!s.canReplace(o,o,t)?null:n.cut(0,e).append(t).append(n.cut(e));let c=Ia(a.content,e-l-1,t,o==0?r-1:0,o==n.childCount-1?i-1:0,a);return c&&n.replaceChild(o,a.copy(c))}function vh(n,e,t){if(t.openStart>n.depth)throw new Fn("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Fn("Inconsistent open depths");return Da(n,e,t,0)}function Da(n,e,t,r){let i=n.index(r),s=n.node(r);if(i==e.index(r)&&r=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function Tn(n,e,t,r){let i=(e||n).node(t),s=0,o=e?e.index(t):i.childCount;n&&(s=n.index(t),n.depth>t?s++:n.textOffset&&(bt(n.nodeAfter,r),s++));for(let l=s;li&&ms(n,e,i+1),o=r.depth>i&&ms(t,r,i+1),l=[];return Tn(null,n,i,l),s&&o&&e.index(i)==t.index(i)?(Pa(s,o),bt(kt(s,La(n,e,t,r,i+1)),l)):(s&&bt(kt(s,Pr(n,e,i+1)),l),Tn(e,t,i,l),o&&bt(kt(o,Pr(t,r,i+1)),l)),Tn(r,null,i,l),new S(l)}function Pr(n,e,t){let r=[];if(Tn(null,n,t,r),n.depth>t){let i=ms(n,e,t+1);bt(kt(i,Pr(n,e,t+1)),r)}return Tn(e,null,t,r),new S(r)}function Mh(n,e){let t=e.depth-n.openStart,i=e.node(t).copy(n.content);for(let s=t-1;s>=0;s--)i=e.node(s).copy(S.from(i));return{start:i.resolveNoCache(n.openStart+t),end:i.resolveNoCache(i.content.size-n.openEnd-t)}}class Hn{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(t);return r?e.child(t).cut(r):i}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],i=t==0?0:this.path[t*3-1]+1;for(let s=0;s0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new Lr(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],i=0,s=t;for(let o=e;;){let{index:l,offset:a}=o.content.findIndex(s),c=s-a;if(r.push(o,l,i+a),!c||(o=o.child(l),o.isText))break;s=c-1,i+=a+1}return new Hn(t,r,s)}static resolveCached(e,t){let r=Vo.get(e);if(r)for(let s=0;se&&this.nodesBetween(e,t,s=>(r.isInSet(s.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),za(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=S.empty,i=0,s=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,i,s),l=o&&o.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=i;at.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let i=S.fromJSON(e,t.content),s=e.nodeType(t.type).create(t.attrs,i,r);return s.type.checkAttrs(s.attrs),s}}Ne.prototype.text=void 0;class zr extends Ne{constructor(e,t,r,i){if(super(e,t,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):za(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new zr(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new zr(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function za(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class Mt{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new Ah(e,t);if(r.next==null)return Mt.empty;let i=Ba(r);r.next&&r.err("Unexpected trailing text");let s=Lh(Ph(i));return zh(s,r),s}matchType(e){for(let t=0;tc.createAndFill()));for(let c=0;c=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let i=0;i