@inkeep/open-knowledge 0.7.0-beta.6 → 0.7.0-beta.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/skills/discovery/SKILL.md +1 -1
- package/dist/assets/skills/project/SKILL.md +1 -1
- package/dist/cli.mjs +4 -4
- package/dist/constants-Cxl2O-jK.mjs +2 -0
- package/dist/{dist-DXa8OEXF.mjs → dist-BuMJFmKr.mjs} +9 -9
- package/dist/{dist-Cr5y5l5H.mjs → dist-ENVMxI9h.mjs} +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{init-DRH-wNqE.mjs → init-Byxy8mBS.mjs} +4 -4
- package/dist/init-D2PQe4cd.mjs +1 -0
- package/dist/{loader-DWl_RypJ.mjs → loader-BNrIwWvs.mjs} +2 -2
- package/dist/loader-C6oqp0Cc.mjs +1 -0
- package/dist/{preview-BCk-Dus6.mjs → preview-CWnfRj79.mjs} +2 -2
- package/dist/preview-Cj9L-zSu.mjs +1 -0
- package/dist/public/assets/{ActivityModeContent-czEDk63C.js → ActivityModeContent-CuX5LBOv.js} +1 -1
- package/dist/public/assets/DocumentContext-G9GEIY2t.js +58 -0
- package/dist/public/assets/{GraphPanel-DDRNPZvZ.js → GraphPanel-CGlQ7dQi.js} +3 -3
- package/dist/public/assets/{SettingsDialogBody-ammlZhKv.js → SettingsDialogBody-Ft8K8Xe0.js} +2 -2
- package/dist/public/assets/{SourceEditor-BKUWyZoX.js → SourceEditor-DRGyXuRn.js} +1 -1
- package/dist/public/assets/config-validation-events-CDLRZbTy.js +12 -0
- package/dist/public/assets/index-ioLRUVSb.js +1914 -0
- package/dist/public/assets/{prop-types-CshEEa52.js → prop-types-CLmhKvTv.js} +96 -96
- package/dist/public/assets/{target-navigation-intent-BDpwJe-x.js → target-navigation-intent-CEARBK1J.js} +1 -1
- package/dist/public/assets/{toggle-group-DPMvPSnm.js → toggle-group-BoN11_Zi.js} +1 -1
- package/dist/public/assets/{typing-burst-detector-B70or2--.js → typing-burst-detector-qQo7S9h4.js} +1 -1
- package/dist/public/index.html +7 -7
- package/dist/{repair-launch-json-D1KAu6Eo.mjs → repair-launch-json-BOzdG83p.mjs} +2 -2
- package/dist/{repair-mcp-configs-Q4EAIAlx.mjs → repair-mcp-configs-aeUoWV34.mjs} +2 -2
- package/dist/{src-Dch-clzE.mjs → src-DB3SX9CQ.mjs} +2 -2
- package/dist/{start-DRxCCj9x.mjs → start-BmLoNTLp.mjs} +2 -2
- package/dist/start-DYP_V5mO.mjs +1 -0
- package/package.json +1 -1
- package/dist/constants-DVSnxX6c.mjs +0 -2
- package/dist/init-CG53icTv.mjs +0 -1
- package/dist/loader-B5xfHr2h.mjs +0 -1
- package/dist/preview-C0l4XdsW.mjs +0 -1
- package/dist/public/assets/DocumentContext-BIMINsvD.js +0 -58
- package/dist/public/assets/config-validation-events-D4KTJyn9.js +0 -12
- package/dist/public/assets/index-Bjw42FLJ.js +0 -1914
- package/dist/start-Dx7w19tk.mjs +0 -1
|
@@ -205,24 +205,24 @@ ${S}`}}),k}function updateMarkViewAttributes(e,t,S={}){let{state:w}=t,{doc:E,tr:
|
|
|
205
205
|
`);return!D||!O?!1:e.chain().command(({tr:e})=>(e.delete(w.pos-2,w.pos),!0)).exitCode().run()},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;let{state:t}=e,{selection:S,doc:w}=t,{$from:E,empty:D}=S;if(!D||E.parent.type!==this.type||E.parentOffset!==E.parent.nodeSize-2)return!1;let O=E.after();return O===void 0?!1:w.nodeAt(O)?e.commands.command(({tr:e})=>(e.setSelection(Selection$1.near(w.resolve(O))),!0)):e.commands.exitCode()}}},addInputRules(){return[textblockTypeInputRule({find:backtickInputRegex,type:this.type,getAttributes:e=>({language:e[1]})}),textblockTypeInputRule({find:tildeInputRegex,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new Plugin({key:new PluginKey(`codeBlockVSCodeHandler`),props:{handlePaste:(e,t)=>{if(!t.clipboardData||this.editor.isActive(this.type.name))return!1;let S=t.clipboardData.getData(`text/plain`),w=t.clipboardData.getData(`vscode-editor-data`),E=(w?JSON.parse(w):void 0)?.mode;if(!S||!E)return!1;let{tr:D,schema:O}=e.state,k=O.text(S.replace(/\r\n?/g,`
|
|
206
206
|
`));return D.replaceSelectionWith(this.type.create({language:E},k)),D.selection.$from.parent.type!==this.type&&D.setSelection(TextSelection.near(D.doc.resolve(Math.max(0,D.selection.from-2)))),D.setMeta(`paste`,!0),e.dispatch(D),!0}}})]}}),index_default$11=CodeBlock,h$1=(e,t)=>{if(e===`slot`)return 0;if(e instanceof Function)return e(t);let{children:S,...w}=t??{};if(e===`svg`)throw Error(`SVG elements are not supported in the JSX syntax, use the array syntax instead`);return[e,w,S]},starInputRegex$1=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,starPasteRegex$1=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,underscoreInputRegex$1=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,underscorePasteRegex$1=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,Bold=Mark.create({name:`bold`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`strong`},{tag:`b`,getAttrs:e=>e.style.fontWeight!==`normal`&&null},{style:`font-weight=400`,clearMark:e=>e.type.name===this.name},{style:`font-weight`,getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}]},renderHTML({HTMLAttributes:e}){return h$1(`strong`,{...mergeAttributes(this.options.HTMLAttributes,e),children:h$1(`slot`,{})})},markdownTokenName:`strong`,parseMarkdown:(e,t)=>t.applyMark(`bold`,t.parseInline(e.tokens||[])),markdownOptions:{htmlReopen:{open:`<strong>`,close:`</strong>`}},renderMarkdown:(e,t)=>`**${t.renderChildren(e)}**`,addCommands(){return{setBold:()=>({commands:e})=>e.setMark(this.name),toggleBold:()=>({commands:e})=>e.toggleMark(this.name),unsetBold:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[markInputRule({find:starInputRegex$1,type:this.type}),markInputRule({find:underscoreInputRegex$1,type:this.type})]},addPasteRules(){return[markPasteRule({find:starPasteRegex$1,type:this.type}),markPasteRule({find:underscorePasteRegex$1,type:this.type})]}}),index_default$10=Bold,starInputRegex=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,starPasteRegex=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,underscoreInputRegex=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,underscorePasteRegex=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Italic=Mark.create({name:`italic`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`em`},{tag:`i`,getAttrs:e=>e.style.fontStyle!==`normal`&&null},{style:`font-style=normal`,clearMark:e=>e.type.name===this.name},{style:`font-style=italic`}]},renderHTML({HTMLAttributes:e}){return[`em`,mergeAttributes(this.options.HTMLAttributes,e),0]},addCommands(){return{setItalic:()=>({commands:e})=>e.setMark(this.name),toggleItalic:()=>({commands:e})=>e.toggleMark(this.name),unsetItalic:()=>({commands:e})=>e.unsetMark(this.name)}},markdownTokenName:`em`,parseMarkdown:(e,t)=>t.applyMark(`italic`,t.parseInline(e.tokens||[])),markdownOptions:{htmlReopen:{open:`<em>`,close:`</em>`}},renderMarkdown:(e,t)=>`*${t.renderChildren(e)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[markInputRule({find:starInputRegex,type:this.type}),markInputRule({find:underscoreInputRegex,type:this.type})]},addPasteRules(){return[markPasteRule({find:starPasteRegex,type:this.type}),markPasteRule({find:underscorePasteRegex,type:this.type})]}}),index_default$9=Italic,HardBreak=Node3.create({name:`hardBreak`,markdownTokenName:`br`,addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:`inline`,selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:`br`}]},renderHTML({HTMLAttributes:e}){return[`br`,mergeAttributes(this.options.HTMLAttributes,e)]},renderText(){return`
|
|
207
207
|
`},renderMarkdown:()=>`
|
|
208
|
-
`,parseMarkdown:()=>({type:`hardBreak`}),addCommands(){return{setHardBreak:()=>({commands:e,chain:t,state:S,editor:w})=>e.first([()=>e.exitCode(),()=>e.command(()=>{let{selection:e,storedMarks:E}=S;if(e.$from.parent.type.spec.isolating)return!1;let{keepMarks:D}=this.options,{splittableMarks:O}=w.extensionManager,k=E||e.$to.parentOffset&&e.$from.marks();return t().insertContent({type:this.name}).command(({tr:e,dispatch:t})=>{if(t&&k&&D){let t=k.filter(e=>O.includes(e.type.name));e.ensureMarks(t)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),index_default$8=HardBreak,Heading=Node3.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(e=>({tag:`h${e}`,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:t}){return[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,mergeAttributes(this.options.HTMLAttributes,t),0]},parseMarkdown:(e,t)=>t.createNode(`heading`,{level:e.depth||1},t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>{var S;let w=e.attrs?.level?parseInt(e.attrs.level,10):1,E=`#`.repeat(w);return e.content?`${E} ${t.renderChildren(e.content)}`:``},addCommands(){return{setHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.setNode(this.name,e):!1,toggleHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.toggleNode(this.name,`paragraph`,e):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>({...e,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(e=>textblockTypeInputRule({find:RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}}),index_default$7=Heading,require_linkify=__commonJSMin$1((e=>{let t=`aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2`,S=`ελ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`,w=`numeric`,E=`ascii`,D=`alpha`,O=`asciinumeric`,k=`alphanumeric`,j=`domain`,F=`emoji`,L=`scheme`,B=`slashscheme`,H=`whitespace`;function q(e,t){return e in t||(t[e]=[]),t[e]}function J(e,t,S){t[w]&&(t[O]=!0,t[k]=!0),t[E]&&(t[O]=!0,t[D]=!0),t[O]&&(t[k]=!0),t[D]&&(t[k]=!0),t[k]&&(t[j]=!0),t[F]&&(t[j]=!0);for(let w in t){let t=q(w,S);t.indexOf(e)<0&&t.push(e)}}function Y(e,t){let S={};for(let w in t)t[w].indexOf(e)>=0&&(S[w]=!0);return S}function ee(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}ee.groups={},ee.prototype={accepts(){return!!this.t},go(e){let t=this,S=t.j[e];if(S)return S;for(let S=0;S<t.jr.length;S++){let w=t.jr[S][0],E=t.jr[S][1];if(E&&w.test(e))return E}return t.jd},has(e,t=!1){return t?e in this.j:!!this.go(e)},ta(e,t,S,w){for(let E=0;E<e.length;E++)this.tt(e[E],t,S,w)},tr(e,t,S,w){w||=ee.groups;let E;return t&&t.j?E=t:(E=new ee(t),S&&w&&J(t,S,w)),this.jr.push([e,E]),E},ts(e,t,S,w){let E=this,D=e.length;if(!D)return E;for(let t=0;t<D-1;t++)E=E.tt(e[t]);return E.tt(e[D-1],t,S,w)},tt(e,t,S,w){w||=ee.groups;let E=this;if(t&&t.j)return E.j[e]=t,t;let D=t,O,k=E.go(e);return k?(O=new ee,Object.assign(O.j,k.j),O.jr.push.apply(O.jr,k.jr),O.jd=k.jd,O.t=k.t):O=new ee,D&&(w&&(O.t&&typeof O.t==`string`?J(D,Object.assign(Y(O.t,w),S),w):S&&J(D,S,w)),O.t=D),E.j[e]=O,O}};let te=(e,t,S,w,E)=>e.ta(t,S,w,E),ne=(e,t,S,w,E)=>e.tr(t,S,w,E),ae=(e,t,S,w,E)=>e.ts(t,S,w,E),oe=(e,t,S,w,E)=>e.tt(t,S,w,E),se=`WORD`,ce=`UWORD`,ue=`ASCIINUMERICAL`,de=`ALPHANUMERICAL`,fe=`LOCALHOST`,me=`TLD`,ge=`UTLD`,_e=`SCHEME`,ve=`SLASH_SCHEME`,ye=`NUM`,Ce=`WS`,we=`NL`,Te=`OPENBRACE`,De=`CLOSEBRACE`,je=`OPENBRACKET`,Me=`CLOSEBRACKET`,Pe=`OPENPAREN`,Ie=`CLOSEPAREN`,Re=`OPENANGLEBRACKET`,ze=`CLOSEANGLEBRACKET`,Be=`FULLWIDTHLEFTPAREN`,Ve=`FULLWIDTHRIGHTPAREN`,Ue=`LEFTCORNERBRACKET`,We=`RIGHTCORNERBRACKET`,Ge=`LEFTWHITECORNERBRACKET`,Ke=`RIGHTWHITECORNERBRACKET`,Xe=`FULLWIDTHLESSTHAN`,$e=`FULLWIDTHGREATERTHAN`,nt=`AMPERSAND`,rt=`APOSTROPHE`,it=`ASTERISK`,at=`AT`,st=`BACKSLASH`,vt=`BACKTICK`,Tt=`CARET`,Et=`COLON`,Dt=`COMMA`,jt=`DOLLAR`,Mt=`DOT`,Ft=`EQUALS`,It=`EXCLAMATION`,Lt=`HYPHEN`,Rt=`PERCENT`,zt=`PIPE`,Bt=`PLUS`,Vt=`POUND`,Ht=`QUERY`,Ut=`QUOTE`,Wt=`FULLWIDTHMIDDLEDOT`,Kt=`SEMI`,$t=`SLASH`,en=`TILDE`,jr=`UNDERSCORE`,Mr=`EMOJI`,Fr=`SYM`;var Ir=Object.freeze({__proto__:null,ALPHANUMERICAL:de,AMPERSAND:nt,APOSTROPHE:rt,ASCIINUMERICAL:ue,ASTERISK:it,AT:`AT`,BACKSLASH:st,BACKTICK:vt,CARET:Tt,CLOSEANGLEBRACKET:ze,CLOSEBRACE:De,CLOSEBRACKET:Me,CLOSEPAREN:Ie,COLON:Et,COMMA:Dt,DOLLAR:jt,DOT:`DOT`,EMOJI:Mr,EQUALS:Ft,EXCLAMATION:It,FULLWIDTHGREATERTHAN:$e,FULLWIDTHLEFTPAREN:Be,FULLWIDTHLESSTHAN:Xe,FULLWIDTHMIDDLEDOT:Wt,FULLWIDTHRIGHTPAREN:Ve,HYPHEN:Lt,LEFTCORNERBRACKET:Ue,LEFTWHITECORNERBRACKET:Ge,LOCALHOST:fe,NL:`NL`,NUM:`NUM`,OPENANGLEBRACKET:Re,OPENBRACE:Te,OPENBRACKET:je,OPENPAREN:Pe,PERCENT:Rt,PIPE:zt,PLUS:Bt,POUND:Vt,QUERY:Ht,QUOTE:Ut,RIGHTCORNERBRACKET:We,RIGHTWHITECORNERBRACKET:Ke,SCHEME:_e,SEMI:Kt,SLASH:$t,SLASH_SCHEME:ve,SYM:`SYM`,TILDE:en,TLD:`TLD`,UNDERSCORE:jr,UTLD:ge,UWORD:ce,WORD:se,WS:`WS`});let Lr=/[a-z]/,zr=/\p{L}/u,Br=/\p{Emoji}/u,Vr=/\d/,Hr=/\s/,Ur=`\r`,Wr=`
|
|
208
|
+
`,parseMarkdown:()=>({type:`hardBreak`}),addCommands(){return{setHardBreak:()=>({commands:e,chain:t,state:S,editor:w})=>e.first([()=>e.exitCode(),()=>e.command(()=>{let{selection:e,storedMarks:E}=S;if(e.$from.parent.type.spec.isolating)return!1;let{keepMarks:D}=this.options,{splittableMarks:O}=w.extensionManager,k=E||e.$to.parentOffset&&e.$from.marks();return t().insertContent({type:this.name}).command(({tr:e,dispatch:t})=>{if(t&&k&&D){let t=k.filter(e=>O.includes(e.type.name));e.ensureMarks(t)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),index_default$8=HardBreak,Heading=Node3.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(e=>({tag:`h${e}`,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:t}){return[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,mergeAttributes(this.options.HTMLAttributes,t),0]},parseMarkdown:(e,t)=>t.createNode(`heading`,{level:e.depth||1},t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>{var S;let w=e.attrs?.level?parseInt(e.attrs.level,10):1,E=`#`.repeat(w);return e.content?`${E} ${t.renderChildren(e.content)}`:``},addCommands(){return{setHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.setNode(this.name,e):!1,toggleHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.toggleNode(this.name,`paragraph`,e):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>({...e,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(e=>textblockTypeInputRule({find:RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}}),index_default$7=Heading,inputRegex$5=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,Image=Node3.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:e}){return[`img`,mergeAttributes(this.options.HTMLAttributes,e)]},parseMarkdown:(e,t)=>t.createNode(`image`,{src:e.href,title:e.title,alt:e.text}),renderMarkdown:e=>{var t,S,w,E,D,O;let k=e.attrs?.src??``,j=e.attrs?.alt??``,F=e.attrs?.title??``;return F?``:``},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>`u`)return null;let{directions:e,minWidth:t,minHeight:S,alwaysPreserveAspectRatio:w}=this.options.resize;return({node:E,getPos:D,HTMLAttributes:O,editor:k})=>{let j=document.createElement(`img`);Object.entries(O).forEach(([e,t])=>{if(t!=null)switch(e){case`width`:case`height`:break;default:j.setAttribute(e,t);break}}),j.src=O.src;let F=new ResizableNodeView({element:j,editor:k,node:E,getPos:D,onResize:(e,t)=>{j.style.width=`${e}px`,j.style.height=`${t}px`},onCommit:(e,t)=>{let S=D();S!==void 0&&this.editor.chain().setNodeSelection(S).updateAttributes(this.name,{width:e,height:t}).run()},onUpdate:(e,t,S)=>e.type===E.type,options:{directions:e,min:{width:t,height:S},preserveAspectRatio:w===!0}}),L=F.dom;return L.style.visibility=`hidden`,L.style.pointerEvents=`none`,j.onload=()=>{L.style.visibility=``,L.style.pointerEvents=``},F}},addCommands(){return{setImage:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}},addInputRules(){return[nodeInputRule({find:inputRegex$5,type:this.type,getAttributes:e=>{let[,,t,S,w]=e;return{src:S,alt:t,title:w}}})]}}),index_default$6=Image,require_linkify=__commonJSMin$1((e=>{let t=`aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2`,S=`ελ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`,w=`numeric`,E=`ascii`,D=`alpha`,O=`asciinumeric`,k=`alphanumeric`,j=`domain`,F=`emoji`,L=`scheme`,B=`slashscheme`,H=`whitespace`;function q(e,t){return e in t||(t[e]=[]),t[e]}function J(e,t,S){t[w]&&(t[O]=!0,t[k]=!0),t[E]&&(t[O]=!0,t[D]=!0),t[O]&&(t[k]=!0),t[D]&&(t[k]=!0),t[k]&&(t[j]=!0),t[F]&&(t[j]=!0);for(let w in t){let t=q(w,S);t.indexOf(e)<0&&t.push(e)}}function Y(e,t){let S={};for(let w in t)t[w].indexOf(e)>=0&&(S[w]=!0);return S}function ee(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}ee.groups={},ee.prototype={accepts(){return!!this.t},go(e){let t=this,S=t.j[e];if(S)return S;for(let S=0;S<t.jr.length;S++){let w=t.jr[S][0],E=t.jr[S][1];if(E&&w.test(e))return E}return t.jd},has(e,t=!1){return t?e in this.j:!!this.go(e)},ta(e,t,S,w){for(let E=0;E<e.length;E++)this.tt(e[E],t,S,w)},tr(e,t,S,w){w||=ee.groups;let E;return t&&t.j?E=t:(E=new ee(t),S&&w&&J(t,S,w)),this.jr.push([e,E]),E},ts(e,t,S,w){let E=this,D=e.length;if(!D)return E;for(let t=0;t<D-1;t++)E=E.tt(e[t]);return E.tt(e[D-1],t,S,w)},tt(e,t,S,w){w||=ee.groups;let E=this;if(t&&t.j)return E.j[e]=t,t;let D=t,O,k=E.go(e);return k?(O=new ee,Object.assign(O.j,k.j),O.jr.push.apply(O.jr,k.jr),O.jd=k.jd,O.t=k.t):O=new ee,D&&(w&&(O.t&&typeof O.t==`string`?J(D,Object.assign(Y(O.t,w),S),w):S&&J(D,S,w)),O.t=D),E.j[e]=O,O}};let te=(e,t,S,w,E)=>e.ta(t,S,w,E),ne=(e,t,S,w,E)=>e.tr(t,S,w,E),ae=(e,t,S,w,E)=>e.ts(t,S,w,E),oe=(e,t,S,w,E)=>e.tt(t,S,w,E),se=`WORD`,ce=`UWORD`,ue=`ASCIINUMERICAL`,de=`ALPHANUMERICAL`,fe=`LOCALHOST`,me=`TLD`,ge=`UTLD`,_e=`SCHEME`,ve=`SLASH_SCHEME`,ye=`NUM`,Ce=`WS`,we=`NL`,Te=`OPENBRACE`,De=`CLOSEBRACE`,je=`OPENBRACKET`,Me=`CLOSEBRACKET`,Pe=`OPENPAREN`,Ie=`CLOSEPAREN`,Re=`OPENANGLEBRACKET`,ze=`CLOSEANGLEBRACKET`,Be=`FULLWIDTHLEFTPAREN`,Ve=`FULLWIDTHRIGHTPAREN`,Ue=`LEFTCORNERBRACKET`,We=`RIGHTCORNERBRACKET`,Ge=`LEFTWHITECORNERBRACKET`,Ke=`RIGHTWHITECORNERBRACKET`,Xe=`FULLWIDTHLESSTHAN`,$e=`FULLWIDTHGREATERTHAN`,nt=`AMPERSAND`,rt=`APOSTROPHE`,it=`ASTERISK`,at=`AT`,st=`BACKSLASH`,vt=`BACKTICK`,Tt=`CARET`,Et=`COLON`,Dt=`COMMA`,jt=`DOLLAR`,Mt=`DOT`,Ft=`EQUALS`,It=`EXCLAMATION`,Lt=`HYPHEN`,Rt=`PERCENT`,zt=`PIPE`,Bt=`PLUS`,Vt=`POUND`,Ht=`QUERY`,Ut=`QUOTE`,Wt=`FULLWIDTHMIDDLEDOT`,Kt=`SEMI`,$t=`SLASH`,en=`TILDE`,jr=`UNDERSCORE`,Mr=`EMOJI`,Fr=`SYM`;var Ir=Object.freeze({__proto__:null,ALPHANUMERICAL:de,AMPERSAND:nt,APOSTROPHE:rt,ASCIINUMERICAL:ue,ASTERISK:it,AT:`AT`,BACKSLASH:st,BACKTICK:vt,CARET:Tt,CLOSEANGLEBRACKET:ze,CLOSEBRACE:De,CLOSEBRACKET:Me,CLOSEPAREN:Ie,COLON:Et,COMMA:Dt,DOLLAR:jt,DOT:`DOT`,EMOJI:Mr,EQUALS:Ft,EXCLAMATION:It,FULLWIDTHGREATERTHAN:$e,FULLWIDTHLEFTPAREN:Be,FULLWIDTHLESSTHAN:Xe,FULLWIDTHMIDDLEDOT:Wt,FULLWIDTHRIGHTPAREN:Ve,HYPHEN:Lt,LEFTCORNERBRACKET:Ue,LEFTWHITECORNERBRACKET:Ge,LOCALHOST:fe,NL:`NL`,NUM:`NUM`,OPENANGLEBRACKET:Re,OPENBRACE:Te,OPENBRACKET:je,OPENPAREN:Pe,PERCENT:Rt,PIPE:zt,PLUS:Bt,POUND:Vt,QUERY:Ht,QUOTE:Ut,RIGHTCORNERBRACKET:We,RIGHTWHITECORNERBRACKET:Ke,SCHEME:_e,SEMI:Kt,SLASH:$t,SLASH_SCHEME:ve,SYM:`SYM`,TILDE:en,TLD:`TLD`,UNDERSCORE:jr,UTLD:ge,UWORD:ce,WORD:se,WS:`WS`});let Lr=/[a-z]/,zr=/\p{L}/u,Br=/\p{Emoji}/u,Vr=/\d/,Hr=/\s/,Ur=`\r`,Wr=`
|
|
209
209
|
`,Gr=`️`,Kr=``,qr=``,Jr=null,Yr=null;function Xr(e=[]){let t={};ee.groups=t;let S=new ee;Jr??=Hi(`aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2`),Yr??=Hi(`ελ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`),oe(S,`'`,rt),oe(S,`{`,Te),oe(S,`}`,De),oe(S,`[`,je),oe(S,`]`,Me),oe(S,`(`,Pe),oe(S,`)`,Ie),oe(S,`<`,Re),oe(S,`>`,ze),oe(S,`(`,Be),oe(S,`)`,Ve),oe(S,`「`,Ue),oe(S,`」`,We),oe(S,`『`,Ge),oe(S,`』`,Ke),oe(S,`<`,Xe),oe(S,`>`,$e),oe(S,`&`,nt),oe(S,`*`,it),oe(S,`@`,`AT`),oe(S,"`",vt),oe(S,`^`,Tt),oe(S,`:`,Et),oe(S,`,`,Dt),oe(S,`$`,jt),oe(S,`.`,`DOT`),oe(S,`=`,Ft),oe(S,`!`,It),oe(S,`-`,Lt),oe(S,`%`,Rt),oe(S,`|`,zt),oe(S,`+`,Bt),oe(S,`#`,Vt),oe(S,`?`,Ht),oe(S,`"`,Ut),oe(S,`/`,$t),oe(S,`;`,Kt),oe(S,`~`,en),oe(S,`_`,jr),oe(S,`\\`,st),oe(S,`・`,Wt);let L=ne(S,Vr,`NUM`,{[w]:!0});ne(L,Vr,L);let B=ne(L,Lr,ue,{[O]:!0}),q=ne(L,zr,de,{[k]:!0}),Y=ne(S,Lr,se,{[E]:!0});ne(Y,Vr,B),ne(Y,Lr,Y),ne(B,Vr,B),ne(B,Lr,B);let te=ne(S,zr,ce,{[D]:!0});ne(te,Lr),ne(te,Vr,q),ne(te,zr,te),ne(q,Vr,q),ne(q,Lr),ne(q,zr,q);let me=oe(S,`
|
|
210
210
|
`,`NL`,{[H]:!0}),ye=oe(S,`\r`,`WS`,{[H]:!0}),Ce=ne(S,Hr,`WS`,{[H]:!0});oe(S,``,Ce),oe(ye,`
|
|
211
211
|
`,me),oe(ye,``,Ce),ne(ye,Hr,Ce),oe(Ce,`\r`),oe(Ce,`
|
|
212
212
|
`),ne(Ce,Hr,Ce),oe(Ce,``,Ce);let we=ne(S,Br,Mr,{[F]:!0});oe(we,`#`),ne(we,Br,we),oe(we,`️`,we);let at=oe(we,``);oe(at,`#`),ne(at,Br,we);let Mt=[[Lr,Y],[Vr,B]],Fr=[[Lr,null],[zr,te],[Vr,q]];for(let e=0;e<Jr.length;e++)ji(S,Jr[e],`TLD`,se,Mt);for(let e=0;e<Yr.length;e++)ji(S,Yr[e],ge,ce,Fr);J(`TLD`,{tld:!0,ascii:!0},t),J(ge,{utld:!0,alpha:!0},t),ji(S,`file`,_e,se,Mt),ji(S,`mailto`,_e,se,Mt),ji(S,`http`,ve,se,Mt),ji(S,`https`,ve,se,Mt),ji(S,`ftp`,ve,se,Mt),ji(S,`ftps`,ve,se,Mt),J(_e,{scheme:!0,ascii:!0},t),J(ve,{slashscheme:!0,ascii:!0},t),e=e.sort((e,t)=>e[0]>t[0]?1:-1);for(let t=0;t<e.length;t++){let D=e[t][0],k=e[t][1]?{scheme:!0}:{slashscheme:!0};D.indexOf(`-`)>=0?k[j]=!0:Lr.test(D)?Vr.test(D)?k[O]=!0:k[E]=!0:k[w]=!0,ae(S,D,D,k)}return ae(S,`localhost`,fe,{ascii:!0}),S.jd=new ee(`SYM`),{start:S,tokens:Object.assign({groups:t},Ir)}}function Zr(e,t){let S=Qr(t.replace(/[A-Z]/g,e=>e.toLowerCase())),w=S.length,E=[],D=0,O=0;for(;O<w;){let k=e,j=null,F=0,L=null,B=-1,H=-1;for(;O<w&&(j=k.go(S[O]));)k=j,k.accepts()?(B=0,H=0,L=k):B>=0&&(B+=S[O].length,H++),F+=S[O].length,D+=S[O].length,O++;D-=B,O-=H,F-=B,E.push({t:L.t,v:t.slice(D-F,D),s:D-F,e:D})}return E}function Qr(e){let t=[],S=e.length,w=0;for(;w<S;){let E=e.charCodeAt(w),D,O=E<55296||E>56319||w+1===S||(D=e.charCodeAt(w+1))<56320||D>57343?e[w]:e.slice(w,w+2);t.push(O),w+=O.length}return t}function ji(e,t,S,w,E){let D,O=t.length;for(let S=0;S<O-1;S++){let O=t[S];e.j[O]?D=e.j[O]:(D=new ee(w),D.jr=E.slice(),e.j[O]=D),e=D}return D=new ee(S),D.jr=E.slice(),e.j[t[O-1]]=D,D}function Hi(e){let t=[],S=[],w=0,E=`0123456789`;for(;w<e.length;){let E=0;for(;`0123456789`.indexOf(e[w+E])>=0;)E++;if(E>0){t.push(S.join(``));for(let t=parseInt(e.substring(w,w+E),10);t>0;t--)S.pop();w+=E}else S.push(e[w]),w++}return t}let Ui={defaultProtocol:`http`,events:null,format:Ki,formatHref:Ki,nl2br:!1,tagName:`a`,target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Gi(e,t=null){let S=Object.assign({},Ui);e&&(S=Object.assign(S,e instanceof Gi?e.o:e));let w=S.ignoreTags,E=[];for(let e=0;e<w.length;e++)E.push(w[e].toUpperCase());this.o=S,t&&(this.defaultRender=t),this.ignoreTags=E}Gi.prototype={o:Ui,ignoreTags:[],defaultRender(e){return e},check(e){return this.get(`validate`,e.toString(),e)},get(e,t,S){let w=t!=null,E=this.o[e];return E&&(typeof E==`object`?(E=S.t in E?E[S.t]:Ui[e],typeof E==`function`&&w&&(E=E(t,S))):typeof E==`function`&&w&&(E=E(t,S.t,S)),E)},getObj(e,t,S){let w=this.o[e];return typeof w==`function`&&t!=null&&(w=w(t,S.t,S)),w},render(e){let t=e.render(this);return(this.get(`render`,null,e)||this.defaultRender)(t,e.t,e)}};function Ki(e){return e}function Yi(e,t){this.t=`token`,this.v=e,this.tk=t}Yi.prototype={isLink:!1,toString(){return this.v},toHref(e){return this.toString()},toFormattedString(e){let t=this.toString(),S=e.get(`truncate`,t,this),w=e.get(`format`,t,this);return S&&w.length>S?w.substring(0,S)+`…`:w},toFormattedHref(e){return e.get(`formatHref`,this.toHref(e.get(`defaultProtocol`)),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(e=Ui.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(e),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(e){return{type:this.t,value:this.toFormattedString(e),isLink:this.isLink,href:this.toFormattedHref(e),start:this.startIndex(),end:this.endIndex()}},validate(e){return e.get(`validate`,this.toString(),this)},render(e){let t=this,S=this.toHref(e.get(`defaultProtocol`)),w=e.get(`formatHref`,S,this),E=e.get(`tagName`,S,t),D=this.toFormattedString(e),O={},k=e.get(`className`,S,t),j=e.get(`target`,S,t),F=e.get(`rel`,S,t),L=e.getObj(`attributes`,S,t),B=e.getObj(`events`,S,t);return O.href=w,k&&(O.class=k),j&&(O.target=j),F&&(O.rel=F),L&&Object.assign(O,L),{tagName:E,attributes:O,content:D,eventListeners:B}}};function Xi(e,t){class S extends Yi{constructor(t,S){super(t,S),this.t=e}}for(let e in t)S.prototype[e]=t[e];return S.t=e,S}let Zi=Xi(`email`,{isLink:!0,toHref(){return`mailto:`+this.toString()}}),ka=Xi(`text`),_s=Xi(`nl`),xs=Xi(`url`,{isLink:!0,toHref(e=Ui.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){let e=this.tk;return e.length>=2&&e[0].t!==fe&&e[1].t===Et}}),Cs=e=>new ee(e);function Ts({groups:e}){let t=e.domain.concat([nt,it,`AT`,st,vt,Tt,jt,Ft,Lt,`NUM`,Rt,zt,Bt,Vt,$t,`SYM`,en,jr]),S=[rt,Et,Dt,`DOT`,It,Rt,Ht,Ut,Kt,Re,ze,Te,De,Me,je,Pe,Ie,Be,Ve,Ue,We,Ge,Ke,Xe,$e],w=[nt,rt,it,st,vt,Tt,jt,Ft,Lt,Te,De,Rt,zt,Bt,Vt,Ht,$t,`SYM`,en,jr],E=Cs(),D=oe(E,en);te(D,w,D),te(D,e.domain,D);let O=Cs(),k=Cs(),j=Cs();te(E,e.domain,O),te(E,e.scheme,k),te(E,e.slashscheme,j),te(O,w,D),te(O,e.domain,O);let F=oe(O,`AT`);oe(D,`AT`,F),oe(k,`AT`,F),oe(j,`AT`,F);let L=oe(D,`DOT`);te(L,w,D),te(L,e.domain,D);let B=Cs();te(F,e.domain,B),te(B,e.domain,B);let H=oe(B,`DOT`);te(H,e.domain,B);let q=Cs(Zi);te(H,e.tld,q),te(H,e.utld,q),oe(F,fe,q);let J=oe(B,Lt);oe(J,Lt,J),te(J,e.domain,B),te(q,e.domain,B),oe(q,`DOT`,H),oe(q,Lt,J),te(oe(q,Et),e.numeric,Zi);let Y=oe(O,Lt),ee=oe(O,`DOT`);oe(Y,Lt,Y),te(Y,e.domain,O),te(ee,w,D),te(ee,e.domain,O);let ne=Cs(xs);te(ee,e.tld,ne),te(ee,e.utld,ne),te(ne,e.domain,O),te(ne,w,D),oe(ne,`DOT`,ee),oe(ne,Lt,Y),oe(ne,`AT`,F);let ae=oe(ne,Et),se=Cs(xs);te(ae,e.numeric,se);let ce=Cs(xs),ue=Cs();te(ce,t,ce),te(ce,S,ue),te(ue,t,ce),te(ue,S,ue),oe(ne,$t,ce),oe(se,$t,ce);let de=oe(k,Et),me=oe(oe(oe(j,Et),$t),$t);te(k,e.domain,O),oe(k,`DOT`,ee),oe(k,Lt,Y),te(j,e.domain,O),oe(j,`DOT`,ee),oe(j,Lt,Y),te(de,e.domain,ce),oe(de,$t,ce),oe(de,Ht,ce),te(me,e.domain,ce),te(me,t,ce),oe(me,$t,ce);let ge=[[Te,De],[je,Me],[Pe,Ie],[Re,ze],[Be,Ve],[Ue,We],[Ge,Ke],[Xe,$e]];for(let e=0;e<ge.length;e++){let[w,E]=ge[e],D=oe(ce,w);oe(ue,w,D),oe(D,E,ce);let O=Cs(xs);te(D,t,O);let k=Cs();te(D,S),te(O,t,O),te(O,S,k),te(k,t,O),te(k,S,k),oe(O,E,ce),oe(k,E,ce)}return oe(E,fe,ne),oe(E,`NL`,_s),{start:E,tokens:Ir}}function Ds(e,t,S){let w=S.length,E=0,D=[],O=[];for(;E<w;){let k=e,j=null,F=null,L=0,B=null,H=-1;for(;E<w&&!(j=k.go(S[E].t));)O.push(S[E++]);for(;E<w&&(F=j||k.go(S[E].t));)j=null,k=F,k.accepts()?(H=0,B=k):H>=0&&H++,E++,L++;if(H<0)E-=L,E<w&&(O.push(S[E]),E++);else{O.length>0&&(D.push(Os(ka,t,O)),O=[]),E-=H,L-=H;let e=B.t,w=S.slice(E-L,E);D.push(Os(e,t,w))}}return O.length>0&&D.push(Os(ka,t,O)),D}function Os(e,t,S){let w=S[0].s,E=S[S.length-1].e;return new e(t.slice(w,E),S)}let ks=typeof console<`u`&&console&&console.warn||(()=>{}),As=`until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.`,Ns={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function Ps(){return ee.groups={},Ns.scanner=null,Ns.parser=null,Ns.tokenQueue=[],Ns.pluginQueue=[],Ns.customSchemes=[],Ns.initialized=!1,Ns}function Is(e,t=!1){if(Ns.initialized&&ks(`linkifyjs: already initialized - will not register custom scheme "${e}" until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(e))throw Error(`linkifyjs: incorrect scheme format.
|
|
213
213
|
1. Must only contain digits, lowercase ASCII letters or "-"
|
|
214
214
|
2. Cannot start or end with "-"
|
|
215
|
-
3. "-" cannot repeat`);Ns.customSchemes.push([e,t])}function Rs(){Ns.scanner=Xr(Ns.customSchemes);for(let e=0;e<Ns.tokenQueue.length;e++)Ns.tokenQueue[e][1]({scanner:Ns.scanner});Ns.parser=Ts(Ns.scanner.tokens);for(let e=0;e<Ns.pluginQueue.length;e++)Ns.pluginQueue[e][1]({scanner:Ns.scanner,parser:Ns.parser});return Ns.initialized=!0,Ns}function $s(e){return Ns.initialized||Rs(),Ds(Ns.parser.start,e,Zr(Ns.scanner.start,e))}$s.scan=Zr;function ec(e,t=null,S=null){if(t&&typeof t==`object`){if(S)throw Error(`linkifyjs: Invalid link type ${t}; must be a string`);S=t,t=null}let w=new Gi(S),E=$s(e),D=[];for(let e=0;e<E.length;e++){let S=E[e];S.isLink&&(!t||S.t===t)&&w.check(S)&&D.push(S.toFormattedObject(w))}return D}e.find=ec,e.registerCustomProtocol=Is,e.reset=Ps,e.tokenize=$s})),import_linkify=require_linkify(),UNICODE_WHITESPACE_PATTERN=`[\0- \xA0 -\u2029 ]`,UNICODE_WHITESPACE_REGEX=new RegExp(UNICODE_WHITESPACE_PATTERN),UNICODE_WHITESPACE_REGEX_END=RegExp(`${UNICODE_WHITESPACE_PATTERN}$`),UNICODE_WHITESPACE_REGEX_GLOBAL=new RegExp(UNICODE_WHITESPACE_PATTERN,`g`);function isValidLinkStructure(e){return e.length===1?e[0].isLink:e.length===3&&e[1].isLink?[`()`,`[]`].includes(e[0].value+e[2].value):!1}function autolink$1(e){return new Plugin({key:new PluginKey(`autolink`),appendTransaction:(t,S,w)=>{let E=t.some(e=>e.docChanged)&&!S.doc.eq(w.doc),D=t.some(e=>e.getMeta(`preventAutolink`));if(!E||D)return;let{tr:O}=w;if(getChangedRanges(combineTransactionSteps(S.doc,[...t])).forEach(({newRange:t})=>{let S=findChildrenInRange(w.doc,t,e=>e.isTextblock),E,D;if(S.length>1)E=S[0],D=w.doc.textBetween(E.pos,E.pos+E.node.nodeSize,void 0,` `);else if(S.length){let e=w.doc.textBetween(t.from,t.to,` `,` `);if(!UNICODE_WHITESPACE_REGEX_END.test(e))return;E=S[0],D=w.doc.textBetween(E.pos,t.to,void 0,` `)}if(E&&D){let t=D.split(UNICODE_WHITESPACE_REGEX).filter(Boolean);if(t.length<=0)return!1;let S=t[t.length-1],k=E.pos+D.lastIndexOf(S);if(!S)return!1;let j=(0,import_linkify.tokenize)(S).map(t=>t.toObject(e.defaultProtocol));if(!isValidLinkStructure(j))return!1;j.filter(e=>e.isLink).map(e=>({...e,from:k+e.start+1,to:k+e.end+1})).filter(e=>w.schema.marks.code?!w.doc.rangeHasMark(e.from,e.to,w.schema.marks.code):!0).filter(t=>e.validate(t.value)).filter(t=>e.shouldAutoLink(t.value)).forEach(t=>{getMarksBetween(t.from,t.to,w.doc).some(t=>t.mark.type===e.type)||O.addMark(t.from,t.to,e.type.create({href:t.href}))})}}),O.steps.length)return O}})}function clickHandler(e){return new Plugin({key:new PluginKey(`handleClickLink`),props:{handleClick:(t,S,w)=>{var E,D;if(w.button!==0||!t.editable)return!1;let O=null;if(w.target instanceof HTMLAnchorElement)O=w.target;else{let t=w.target;if(!t)return!1;let S=e.editor.view.dom;O=t.closest(`a`),O&&!S.contains(O)&&(O=null)}if(!O)return!1;let k=!1;if(e.enableClickSelection&&(k=e.editor.commands.extendMarkRange(e.type.name)),e.openOnClick){let S=getAttributes(t.state,e.type.name),w=O.href??S.href,E=O.target??S.target;w&&(window.open(w,E),k=!0)}return k}}})}function pasteHandler(e){return new Plugin({key:new PluginKey(`handlePasteLink`),props:{handlePaste:(t,S,w)=>{let{shouldAutoLink:E}=e,{state:D}=t,{selection:O}=D,{empty:k}=O;if(k)return!1;let j=``;w.content.forEach(e=>{j+=e.textContent});let F=(0,import_linkify.find)(j,{defaultProtocol:e.defaultProtocol}).find(e=>e.isLink&&e.value===j);return!j||!F||E!==void 0&&!E(F.value)?!1:e.editor.commands.setMark(e.type,{href:F.href})}}})}function isAllowedUri(e,t){let S=[`http`,`https`,`ftp`,`ftps`,`mailto`,`tel`,`callto`,`sms`,`cid`,`xmpp`];return t&&t.forEach(e=>{let t=typeof e==`string`?e:e.scheme;t&&S.push(t)}),!e||e.replace(UNICODE_WHITESPACE_REGEX_GLOBAL,``).match(RegExp(`^(?:(?:${S.join(`|`)}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,`i`))}var Link=Mark.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(e=>{if(typeof e==`string`){(0,import_linkify.registerCustomProtocol)(e);return}(0,import_linkify.registerCustomProtocol)(e.scheme,e.optionalSlashes)})},onDestroy(){(0,import_linkify.reset)()},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:(e,t)=>!!isAllowedUri(e,t.protocols),validate:e=>!!e,shouldAutoLink:e=>{let t=/^[a-z][a-z0-9+.-]*:\/\//i.test(e),S=/^[a-z][a-z0-9+.-]*:/i.test(e);if(t||S&&!e.includes(`@`))return!0;let w=(e.includes(`@`)?e.split(`@`).pop():e).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(w)||!/\./.test(w))}}},addAttributes(){return{href:{default:null,parseHTML(e){return e.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:e=>{let t=e.getAttribute(`href`);return!t||!this.options.isAllowedUri(t,{defaultValidate:e=>!!isAllowedUri(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:e=>!!isAllowedUri(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?[`a`,mergeAttributes(this.options.HTMLAttributes,e),0]:[`a`,mergeAttributes(this.options.HTMLAttributes,{...e,href:``}),0]},markdownTokenName:`link`,parseMarkdown:(e,t)=>t.applyMark(`link`,t.parseInline(e.tokens||[]),{href:e.href,title:e.title||null}),renderMarkdown:(e,t)=>{var S,w,E,D;let O=e.attrs?.href??``,k=e.attrs?.title??``,j=t.renderChildren(e);return k?`[${j}](${O} "${k}")`:`[${j}](${O})`},addCommands(){return{setLink:e=>({chain:t})=>{let{href:S}=e;return this.options.isAllowedUri(S,{defaultValidate:e=>!!isAllowedUri(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?t().setMark(this.name,e).setMeta(`preventAutolink`,!0).run():!1},toggleLink:e=>({chain:t})=>{let{href:S}=e||{};return S&&!this.options.isAllowedUri(S,{defaultValidate:e=>!!isAllowedUri(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:t().toggleMark(this.name,e,{extendEmptyMarkRange:!0}).setMeta(`preventAutolink`,!0).run()},unsetLink:()=>({chain:e})=>e().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta(`preventAutolink`,!0).run()}},addPasteRules(){return[markPasteRule({find:e=>{let t=[];if(e){let{protocols:S,defaultProtocol:w}=this.options,E=(0,import_linkify.find)(e).filter(e=>e.isLink&&this.options.isAllowedUri(e.value,{defaultValidate:e=>!!isAllowedUri(e,S),protocols:S,defaultProtocol:w}));E.length&&E.forEach(e=>{this.options.shouldAutoLink(e.value)&&t.push({text:e.value,data:{href:e.href},index:e.start})})}return t},type:this.type,getAttributes:e=>{var t;return{href:e.data?.href}}})]},addProseMirrorPlugins(){let e=[],{protocols:t,defaultProtocol:S}=this.options;return this.options.autolink&&e.push(autolink$1({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!isAllowedUri(e,t),protocols:t,defaultProtocol:S}),shouldAutoLink:this.options.shouldAutoLink})),e.push(clickHandler({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick===`whenNotEditable`?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&e.push(pasteHandler({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),e}}),index_default$6=Link,inputRegex$5=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,pasteRegex$2=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,Highlight=Mark.create({name:`highlight`,addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:e=>e.getAttribute(`data-color`)||e.style.backgroundColor,renderHTML:e=>e.color?{"data-color":e.color,style:`background-color: ${e.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:`mark`}]},renderHTML({HTMLAttributes:e}){return[`mark`,mergeAttributes(this.options.HTMLAttributes,e),0]},renderMarkdown:(e,t)=>`==${t.renderChildren(e)}==`,parseMarkdown:(e,t)=>t.applyMark(`highlight`,t.parseInline(e.tokens||[])),markdownTokenizer:{name:`highlight`,level:`inline`,start:e=>e.indexOf(`==`),tokenize(e,t,S){let w=/^(==)([^=]+)(==)/.exec(e);if(w){let e=w[2].trim(),t=S.inlineTokens(e);return{type:`highlight`,raw:w[0],text:e,tokens:t}}}},addCommands(){return{setHighlight:e=>({commands:t})=>t.setMark(this.name,e),toggleHighlight:e=>({commands:t})=>t.toggleMark(this.name,e),unsetHighlight:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[markInputRule({find:inputRegex$5,type:this.type})]},addPasteRules(){return[markPasteRule({find:pasteRegex$2,type:this.type})]}}),index_default$5=Highlight;let readFromCache,addToCache;if(typeof WeakMap<`u`){let e=new WeakMap;readFromCache=t=>e.get(t),addToCache=(t,S)=>(e.set(t,S),S)}else{let e=[],t=10,S=0;readFromCache=t=>{for(let S=0;S<e.length;S+=2)if(e[S]==t)return e[S+1]},addToCache=(t,w)=>(S==10&&(S=0),e[S++]=t,e[S++]=w)}var TableMap=class{constructor(e,t,S,w){this.width=e,this.height=t,this.map=S,this.problems=w}findCell(e){for(let t=0;t<this.map.length;t++){let S=this.map[t];if(S!=e)continue;let w=t%this.width,E=t/this.width|0,D=w+1,O=E+1;for(let e=1;D<this.width&&this.map[t+e]==S;e++)D++;for(let e=1;O<this.height&&this.map[t+this.width*e]==S;e++)O++;return{left:w,top:E,right:D,bottom:O}}throw RangeError(`No cell with offset ${e} found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw RangeError(`No cell with offset ${e} found`)}nextCell(e,t,S){let{left:w,right:E,top:D,bottom:O}=this.findCell(e);return t==`horiz`?(S<0?w==0:E==this.width)?null:this.map[D*this.width+(S<0?w-1:E)]:(S<0?D==0:O==this.height)?null:this.map[w+this.width*(S<0?D-1:O)]}rectBetween(e,t){let{left:S,right:w,top:E,bottom:D}=this.findCell(e),{left:O,right:k,top:j,bottom:F}=this.findCell(t);return{left:Math.min(S,O),top:Math.min(E,j),right:Math.max(w,k),bottom:Math.max(D,F)}}cellsInRect(e){let t=[],S={};for(let w=e.top;w<e.bottom;w++)for(let E=e.left;E<e.right;E++){let D=w*this.width+E,O=this.map[D];S[O]||(S[O]=!0,!(E==e.left&&E&&this.map[D-1]==O||w==e.top&&w&&this.map[D-this.width]==O)&&t.push(O))}return t}positionAt(e,t,S){for(let w=0,E=0;;w++){let D=E+S.child(w).nodeSize;if(w==e){let S=t+e*this.width,w=(e+1)*this.width;for(;S<w&&this.map[S]<E;)S++;return S==w?D-1:this.map[S]}E=D}}static get(e){return readFromCache(e)||addToCache(e,computeMap(e))}};function computeMap(e){if(e.type.spec.tableRole!=`table`)throw RangeError(`Not a table node: `+e.type.name);let t=findWidth(e),S=e.childCount,w=[],E=0,D=null,O=[];for(let e=0,E=t*S;e<E;e++)w[e]=0;for(let k=0,j=0;k<S;k++){let F=e.child(k);j++;for(let e=0;;e++){for(;E<w.length&&w[E]!=0;)E++;if(e==F.childCount)break;let L=F.child(e),{colspan:B,rowspan:H,colwidth:q}=L.attrs;for(let e=0;e<H;e++){if(e+k>=S){(D||=[]).push({type:`overlong_rowspan`,pos:j,n:H-e});break}let F=E+e*t;for(let e=0;e<B;e++){w[F+e]==0?w[F+e]=j:(D||=[]).push({type:`collision`,row:k,pos:j,n:B-e});let S=q&&q[e];if(S){let w=(F+e)%t*2,E=O[w];E==null||E!=S&&O[w+1]==1?(O[w]=S,O[w+1]=1):E==S&&O[w+1]++}}}E+=B,j+=L.nodeSize}let L=(k+1)*t,B=0;for(;E<L;)w[E++]==0&&B++;B&&(D||=[]).push({type:`missing`,row:k,n:B}),j++}(t===0||S===0)&&(D||=[]).push({type:`zero_sized`});let k=new TableMap(t,S,w,D),j=!1;for(let e=0;!j&&e<O.length;e+=2)O[e]!=null&&O[e+1]<S&&(j=!0);return j&&findBadColWidths(k,O,e),k}function findWidth(e){let t=-1,S=!1;for(let w=0;w<e.childCount;w++){let E=e.child(w),D=0;if(S)for(let t=0;t<w;t++){let S=e.child(t);for(let e=0;e<S.childCount;e++){let E=S.child(e);t+E.attrs.rowspan>w&&(D+=E.attrs.colspan)}}for(let e=0;e<E.childCount;e++){let t=E.child(e);D+=t.attrs.colspan,t.attrs.rowspan>1&&(S=!0)}t==-1?t=D:t!=D&&(t=Math.max(t,D))}return t}function findBadColWidths(e,t,S){e.problems||=[];let w={};for(let E=0;E<e.map.length;E++){let D=e.map[E];if(w[D])continue;w[D]=!0;let O=S.nodeAt(D);if(!O)throw RangeError(`No cell with offset ${D} found`);let k=null,j=O.attrs;for(let S=0;S<j.colspan;S++){let w=t[(E+S)%e.width*2];w!=null&&(!j.colwidth||j.colwidth[S]!=w)&&((k||=freshColWidth(j))[S]=w)}k&&e.problems.unshift({type:`colwidth mismatch`,pos:D,colwidth:k})}}function freshColWidth(e){if(e.colwidth)return e.colwidth.slice();let t=[];for(let S=0;S<e.colspan;S++)t.push(0);return t}function tableNodeTypes(e){let t=e.cached.tableNodeTypes;if(!t){t=e.cached.tableNodeTypes={};for(let S in e.nodes){let w=e.nodes[S],E=w.spec.tableRole;E&&(t[E]=w)}}return t}const tableEditingKey=new PluginKey(`selectingCells`);function cellAround(e){for(let t=e.depth-1;t>0;t--)if(e.node(t).type.spec.tableRole==`row`)return e.node(0).resolve(e.before(t+1));return null}function cellWrapping(e){for(let t=e.depth;t>0;t--){let S=e.node(t).type.spec.tableRole;if(S===`cell`||S===`header_cell`)return e.node(t)}return null}function isInTable(e){let t=e.selection.$head;for(let e=t.depth;e>0;e--)if(t.node(e).type.spec.tableRole==`row`)return!0;return!1}function selectionCell(e){let t=e.selection;if(`$anchorCell`in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if(`node`in t&&t.node&&t.node.type.spec.tableRole==`cell`)return t.$anchor;let S=cellAround(t.$head)||cellNear(t.$head);if(S)return S;throw RangeError(`No cell found around position ${t.head}`)}function cellNear(e){for(let t=e.nodeAfter,S=e.pos;t;t=t.firstChild,S++){let w=t.type.spec.tableRole;if(w==`cell`||w==`header_cell`)return e.doc.resolve(S)}for(let t=e.nodeBefore,S=e.pos;t;t=t.lastChild,S--){let w=t.type.spec.tableRole;if(w==`cell`||w==`header_cell`)return e.doc.resolve(S-t.nodeSize)}}function pointsAtCell(e){return e.parent.type.spec.tableRole==`row`&&!!e.nodeAfter}function moveCellForward(e){return e.node(0).resolve(e.pos+e.nodeAfter.nodeSize)}function inSameTable(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function nextCell(e,t,S){let w=e.node(-1),E=TableMap.get(w),D=e.start(-1),O=E.nextCell(e.pos-D,t,S);return O==null?null:e.node(0).resolve(D+O)}function removeColSpan(e,t,S=1){let w={...e,colspan:e.colspan-S};return w.colwidth&&(w.colwidth=w.colwidth.slice(),w.colwidth.splice(t,S),w.colwidth.some(e=>e>0)||(w.colwidth=null)),w}function addColSpan(e,t,S=1){let w={...e,colspan:e.colspan+S};if(w.colwidth){w.colwidth=w.colwidth.slice();for(let e=0;e<S;e++)w.colwidth.splice(t,0,0)}return w}function columnIsHeader(e,t,S){let w=tableNodeTypes(t.type.schema).header_cell;for(let E=0;E<e.height;E++)if(t.nodeAt(e.map[S+E*e.width]).type!=w)return!1;return!0}var CellSelection=class e extends Selection$1{constructor(e,t=e){let S=e.node(-1),w=TableMap.get(S),E=e.start(-1),D=w.rectBetween(e.pos-E,t.pos-E),O=e.node(0),k=w.cellsInRect(D).filter(e=>e!=t.pos-E);k.unshift(t.pos-E);let j=k.map(e=>{let t=S.nodeAt(e);if(!t)throw RangeError(`No cell with offset ${e} found`);let w=E+e+1;return new SelectionRange(O.resolve(w),O.resolve(w+t.content.size))});super(j[0].$from,j[0].$to,j),this.$anchorCell=e,this.$headCell=t}map(t,S){let w=t.resolve(S.map(this.$anchorCell.pos)),E=t.resolve(S.map(this.$headCell.pos));if(pointsAtCell(w)&&pointsAtCell(E)&&inSameTable(w,E)){let t=this.$anchorCell.node(-1)!=w.node(-1);return t&&this.isRowSelection()?e.rowSelection(w,E):t&&this.isColSelection()?e.colSelection(w,E):new e(w,E)}return TextSelection.between(w,E)}content(){let e=this.$anchorCell.node(-1),t=TableMap.get(e),S=this.$anchorCell.start(-1),w=t.rectBetween(this.$anchorCell.pos-S,this.$headCell.pos-S),E={},D=[];for(let S=w.top;S<w.bottom;S++){let O=[];for(let D=S*t.width+w.left,k=w.left;k<w.right;k++,D++){let S=t.map[D];if(E[S])continue;E[S]=!0;let k=t.findCell(S),j=e.nodeAt(S);if(!j)throw RangeError(`No cell with offset ${S} found`);let F=w.left-k.left,L=k.right-w.right;if(F>0||L>0){let e=j.attrs;if(F>0&&(e=removeColSpan(e,0,F)),L>0&&(e=removeColSpan(e,e.colspan-L,L)),k.left<w.left){if(j=j.type.createAndFill(e),!j)throw RangeError(`Could not create cell with attrs ${JSON.stringify(e)}`)}else j=j.type.create(e,j.content)}if(k.top<w.top||k.bottom>w.bottom){let e={...j.attrs,rowspan:Math.min(k.bottom,w.bottom)-Math.max(k.top,w.top)};j=k.top<w.top?j.type.createAndFill(e):j.type.create(e,j.content)}O.push(j)}D.push(e.child(S).copy(Fragment.from(O)))}let O=this.isColSelection()&&this.isRowSelection()?e:D;return new Slice(Fragment.from(O),1,1)}replace(e,t=Slice.empty){let S=e.steps.length,w=this.ranges;for(let E=0;E<w.length;E++){let{$from:D,$to:O}=w[E],k=e.mapping.slice(S);e.replace(k.map(D.pos),k.map(O.pos),E?Slice.empty:t)}let E=Selection$1.findFrom(e.doc.resolve(e.mapping.slice(S).map(this.to)),-1);E&&e.setSelection(E)}replaceWith(e,t){this.replace(e,new Slice(Fragment.from(t),0,0))}forEachCell(e){let t=this.$anchorCell.node(-1),S=TableMap.get(t),w=this.$anchorCell.start(-1),E=S.cellsInRect(S.rectBetween(this.$anchorCell.pos-w,this.$headCell.pos-w));for(let S=0;S<E.length;S++)e(t.nodeAt(E[S]),w+E[S])}isColSelection(){let e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;let S=e+this.$anchorCell.nodeAfter.attrs.rowspan,w=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(S,w)==this.$headCell.node(-1).childCount}static colSelection(t,S=t){let w=t.node(-1),E=TableMap.get(w),D=t.start(-1),O=E.findCell(t.pos-D),k=E.findCell(S.pos-D),j=t.node(0);return O.top<=k.top?(O.top>0&&(t=j.resolve(D+E.map[O.left])),k.bottom<E.height&&(S=j.resolve(D+E.map[E.width*(E.height-1)+k.right-1]))):(k.top>0&&(S=j.resolve(D+E.map[k.left])),O.bottom<E.height&&(t=j.resolve(D+E.map[E.width*(E.height-1)+O.right-1]))),new e(t,S)}isRowSelection(){let e=this.$anchorCell.node(-1),t=TableMap.get(e),S=this.$anchorCell.start(-1),w=t.colCount(this.$anchorCell.pos-S),E=t.colCount(this.$headCell.pos-S);if(Math.min(w,E)>0)return!1;let D=w+this.$anchorCell.nodeAfter.attrs.colspan,O=E+this.$headCell.nodeAfter.attrs.colspan;return Math.max(D,O)==t.width}eq(t){return t instanceof e&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,S=t){let w=t.node(-1),E=TableMap.get(w),D=t.start(-1),O=E.findCell(t.pos-D),k=E.findCell(S.pos-D),j=t.node(0);return O.left<=k.left?(O.left>0&&(t=j.resolve(D+E.map[O.top*E.width])),k.right<E.width&&(S=j.resolve(D+E.map[E.width*(k.top+1)-1]))):(k.left>0&&(S=j.resolve(D+E.map[k.top*E.width])),O.right<E.width&&(t=j.resolve(D+E.map[E.width*(O.top+1)-1]))),new e(t,S)}toJSON(){return{type:`cell`,anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,S){return new e(t.resolve(S.anchor),t.resolve(S.head))}static create(t,S,w=S){return new e(t.resolve(S),t.resolve(w))}getBookmark(){return new CellBookmark(this.$anchorCell.pos,this.$headCell.pos)}};CellSelection.prototype.visible=!1,Selection$1.jsonID(`cell`,CellSelection);var CellBookmark=class e{constructor(e,t){this.anchor=e,this.head=t}map(t){return new e(t.map(this.anchor),t.map(this.head))}resolve(e){let t=e.resolve(this.anchor),S=e.resolve(this.head);return t.parent.type.spec.tableRole==`row`&&S.parent.type.spec.tableRole==`row`&&t.index()<t.parent.childCount&&S.index()<S.parent.childCount&&inSameTable(t,S)?new CellSelection(t,S):Selection$1.near(S,1)}};function drawCellSelection(e){if(!(e.selection instanceof CellSelection))return null;let t=[];return e.selection.forEachCell((e,S)=>{t.push(Decoration.node(S,S+e.nodeSize,{class:`selectedCell`}))}),DecorationSet.create(e.doc,t)}function isCellBoundarySelection({$from:e,$to:t}){if(e.pos==t.pos||e.pos<t.pos-6)return!1;let S=e.pos,w=t.pos,E=e.depth;for(;E>=0&&!(e.after(E+1)<e.end(E));E--,S++);for(let e=t.depth;e>=0&&!(t.before(e+1)>t.start(e));e--,w--);return S==w&&/row|table/.test(e.node(E).type.spec.tableRole)}function isTextSelectionAcrossCells({$from:e,$to:t}){let S,w;for(let t=e.depth;t>0;t--){let w=e.node(t);if(w.type.spec.tableRole===`cell`||w.type.spec.tableRole===`header_cell`){S=w;break}}for(let e=t.depth;e>0;e--){let S=t.node(e);if(S.type.spec.tableRole===`cell`||S.type.spec.tableRole===`header_cell`){w=S;break}}return S!==w&&t.parentOffset===0}function normalizeSelection(e,t,S){let w=(t||e).selection,E=(t||e).doc,D,O;if(w instanceof NodeSelection&&(O=w.node.type.spec.tableRole)){if(O==`cell`||O==`header_cell`)D=CellSelection.create(E,w.from);else if(O==`row`){let e=E.resolve(w.from+1);D=CellSelection.rowSelection(e,e)}else if(!S){let e=TableMap.get(w.node),t=w.from+1,S=t+e.map[e.width*e.height-1];D=CellSelection.create(E,t+1,S)}}else w instanceof TextSelection&&isCellBoundarySelection(w)?D=TextSelection.create(E,w.from):w instanceof TextSelection&&isTextSelectionAcrossCells(w)&&(D=TextSelection.create(E,w.$from.start(),w.$from.end()));return D&&(t||=e.tr).setSelection(D),t}const fixTablesKey=new PluginKey(`fix-tables`);function changedDescendants(e,t,S,w){let E=e.childCount,D=t.childCount;outer:for(let O=0,k=0;O<D;O++){let D=t.child(O);for(let t=k,w=Math.min(E,O+3);t<w;t++)if(e.child(t)==D){k=t+1,S+=D.nodeSize;continue outer}w(D,S),k<E&&e.child(k).sameMarkup(D)?changedDescendants(e.child(k),D,S+1,w):D.nodesBetween(0,D.content.size,w,S+1),S+=D.nodeSize}}function fixTables(e,t){let S,w=(t,w)=>{t.type.spec.tableRole==`table`&&(S=fixTable(e,t,w,S))};return t?t.doc!=e.doc&&changedDescendants(t.doc,e.doc,0,w):e.doc.descendants(w),S}function fixTable(e,t,S,w){let E=TableMap.get(t);if(!E.problems)return w;w||=e.tr;let D=[];for(let e=0;e<E.height;e++)D.push(0);for(let e=0;e<E.problems.length;e++){let O=E.problems[e];if(O.type==`collision`){let e=t.nodeAt(O.pos);if(!e)continue;let E=e.attrs;for(let e=0;e<E.rowspan;e++)D[O.row+e]+=O.n;w.setNodeMarkup(w.mapping.map(S+1+O.pos),null,removeColSpan(E,E.colspan-O.n,O.n))}else if(O.type==`missing`)D[O.row]+=O.n;else if(O.type==`overlong_rowspan`){let e=t.nodeAt(O.pos);if(!e)continue;w.setNodeMarkup(w.mapping.map(S+1+O.pos),null,{...e.attrs,rowspan:e.attrs.rowspan-O.n})}else if(O.type==`colwidth mismatch`){let e=t.nodeAt(O.pos);if(!e)continue;w.setNodeMarkup(w.mapping.map(S+1+O.pos),null,{...e.attrs,colwidth:O.colwidth})}else if(O.type==`zero_sized`){let e=w.mapping.map(S);w.delete(e,e+t.nodeSize)}}let O,k;for(let e=0;e<D.length;e++)D[e]&&(O??=e,k=e);for(let j=0,F=S+1;j<E.height;j++){let S=t.child(j),E=F+S.nodeSize,L=D[j];if(L>0){let t=`cell`;S.firstChild&&(t=S.firstChild.type.spec.tableRole);let D=[];for(let S=0;S<L;S++){let S=tableNodeTypes(e.schema)[t].createAndFill();S&&D.push(S)}let B=(j==0||O==j-1)&&k==j?F+1:E-1;w.insert(w.mapping.map(B),D)}F=E}return w.setMeta(fixTablesKey,{fixTables:!0})}function selectedRect(e){let t=e.selection,S=selectionCell(e),w=S.node(-1),E=S.start(-1),D=TableMap.get(w);return{...t instanceof CellSelection?D.rectBetween(t.$anchorCell.pos-E,t.$headCell.pos-E):D.findCell(S.pos-E),tableStart:E,map:D,table:w}}function addColumn(e,{map:t,tableStart:S,table:w},E){let D=E>0?-1:0;columnIsHeader(t,w,E+D)&&(D=E==0||E==t.width?null:0);for(let O=0;O<t.height;O++){let k=O*t.width+E;if(E>0&&E<t.width&&t.map[k-1]==t.map[k]){let D=t.map[k],j=w.nodeAt(D);e.setNodeMarkup(e.mapping.map(S+D),null,addColSpan(j.attrs,E-t.colCount(D))),O+=j.attrs.rowspan-1}else{let j=D==null?tableNodeTypes(w.type.schema).cell:w.nodeAt(t.map[k+D]).type,F=t.positionAt(O,E,w);e.insert(e.mapping.map(S+F),j.createAndFill())}}return e}function addColumnBefore(e,t){if(!isInTable(e))return!1;if(t){let S=selectedRect(e);t(addColumn(e.tr,S,S.left))}return!0}function addColumnAfter(e,t){if(!isInTable(e))return!1;if(t){let S=selectedRect(e);t(addColumn(e.tr,S,S.right))}return!0}function removeColumn(e,{map:t,table:S,tableStart:w},E){let D=e.mapping.maps.length;for(let O=0;O<t.height;){let k=O*t.width+E,j=t.map[k],F=S.nodeAt(j),L=F.attrs;if(E>0&&t.map[k-1]==j||E<t.width-1&&t.map[k+1]==j)e.setNodeMarkup(e.mapping.slice(D).map(w+j),null,removeColSpan(L,E-t.colCount(j)));else{let t=e.mapping.slice(D).map(w+j);e.delete(t,t+F.nodeSize)}O+=L.rowspan}}function deleteColumn(e,t){if(!isInTable(e))return!1;if(t){let S=selectedRect(e),w=e.tr;if(S.left==0&&S.right==S.map.width)return!1;for(let e=S.right-1;removeColumn(w,S,e),e!=S.left;e--){let e=S.tableStart?w.doc.nodeAt(S.tableStart-1):w.doc;if(!e)throw RangeError(`No table found`);S.table=e,S.map=TableMap.get(e)}t(w)}return!0}function rowIsHeader(e,t,S){var w;let E=tableNodeTypes(t.type.schema).header_cell;for(let w=0;w<e.width;w++)if(t.nodeAt(e.map[w+S*e.width])?.type!=E)return!1;return!0}function addRow(e,{map:t,tableStart:S,table:w},E){let D=S;for(let e=0;e<E;e++)D+=w.child(e).nodeSize;let O=[],k=E>0?-1:0;rowIsHeader(t,w,E+k)&&(k=E==0||E==t.height?null:0);for(let D=0,F=t.width*E;D<t.width;D++,F++)if(E>0&&E<t.height&&t.map[F]==t.map[F-t.width]){let E=t.map[F],O=w.nodeAt(E).attrs;e.setNodeMarkup(S+E,null,{...O,rowspan:O.rowspan+1}),D+=O.colspan-1}else{var j;let e=(k==null?tableNodeTypes(w.type.schema).cell:w.nodeAt(t.map[F+k*t.width])?.type)?.createAndFill();e&&O.push(e)}return e.insert(D,tableNodeTypes(w.type.schema).row.create(null,O)),e}function addRowBefore(e,t){if(!isInTable(e))return!1;if(t){let S=selectedRect(e);t(addRow(e.tr,S,S.top))}return!0}function addRowAfter(e,t){if(!isInTable(e))return!1;if(t){let S=selectedRect(e);t(addRow(e.tr,S,S.bottom))}return!0}function removeRow(e,{map:t,table:S,tableStart:w},E){let D=0;for(let e=0;e<E;e++)D+=S.child(e).nodeSize;let O=D+S.child(E).nodeSize,k=e.mapping.maps.length;e.delete(D+w,O+w);let j=new Set;for(let D=0,O=E*t.width;D<t.width;D++,O++){let F=t.map[O];if(!j.has(F)){if(j.add(F),E>0&&F==t.map[O-t.width]){let t=S.nodeAt(F).attrs;e.setNodeMarkup(e.mapping.slice(k).map(F+w),null,{...t,rowspan:t.rowspan-1}),D+=t.colspan-1}else if(E<t.height&&F==t.map[O+t.width]){let O=S.nodeAt(F),j=O.attrs,L=O.type.create({...j,rowspan:O.attrs.rowspan-1},O.content),B=t.positionAt(E+1,D,S);e.insert(e.mapping.slice(k).map(w+B),L),D+=j.colspan-1}}}}function deleteRow(e,t){if(!isInTable(e))return!1;if(t){let S=selectedRect(e),w=e.tr;if(S.top==0&&S.bottom==S.map.height)return!1;for(let e=S.bottom-1;removeRow(w,S,e),e!=S.top;e--){let e=S.tableStart?w.doc.nodeAt(S.tableStart-1):w.doc;if(!e)throw RangeError(`No table found`);S.table=e,S.map=TableMap.get(S.table)}t(w)}return!0}function isEmpty$3(e){let t=e.content;return t.childCount==1&&t.child(0).isTextblock&&t.child(0).childCount==0}function cellsOverlapRectangle({width:e,height:t,map:S},w){let E=w.top*e+w.left,D=E,O=(w.bottom-1)*e+w.left,k=E+(w.right-w.left-1);for(let t=w.top;t<w.bottom;t++){if(w.left>0&&S[D]==S[D-1]||w.right<e&&S[k]==S[k+1])return!0;D+=e,k+=e}for(let D=w.left;D<w.right;D++){if(w.top>0&&S[E]==S[E-e]||w.bottom<t&&S[O]==S[O+e])return!0;E++,O++}return!1}function mergeCells(e,t){let S=e.selection;if(!(S instanceof CellSelection)||S.$anchorCell.pos==S.$headCell.pos)return!1;let w=selectedRect(e),{map:E}=w;if(cellsOverlapRectangle(E,w))return!1;if(t){let S=e.tr,D={},O=Fragment.empty,k,j;for(let e=w.top;e<w.bottom;e++)for(let t=w.left;t<w.right;t++){let F=E.map[e*E.width+t],L=w.table.nodeAt(F);if(!(D[F]||!L))if(D[F]=!0,k==null)k=F,j=L;else{isEmpty$3(L)||(O=O.append(L.content));let e=S.mapping.map(F+w.tableStart);S.delete(e,e+L.nodeSize)}}if(k==null||j==null)return!0;if(S.setNodeMarkup(k+w.tableStart,null,{...addColSpan(j.attrs,j.attrs.colspan,w.right-w.left-j.attrs.colspan),rowspan:w.bottom-w.top}),O.size>0){let e=k+1+j.content.size,t=isEmpty$3(j)?k+1:e;S.replaceWith(t+w.tableStart,e+w.tableStart,O)}S.setSelection(new CellSelection(S.doc.resolve(k+w.tableStart))),t(S)}return!0}function splitCell(e,t){let S=tableNodeTypes(e.schema);return splitCellWithType(({node:e})=>S[e.type.spec.tableRole])(e,t)}function splitCellWithType(e){return(t,S)=>{let w=t.selection,E,D;if(w instanceof CellSelection){if(w.$anchorCell.pos!=w.$headCell.pos)return!1;E=w.$anchorCell.nodeAfter,D=w.$anchorCell.pos}else{var O;if(E=cellWrapping(w.$from),!E)return!1;D=cellAround(w.$from)?.pos}if(E==null||D==null||E.attrs.colspan==1&&E.attrs.rowspan==1)return!1;if(S){let O=E.attrs,k=[],j=O.colwidth;O.rowspan>1&&(O={...O,rowspan:1}),O.colspan>1&&(O={...O,colspan:1});let F=selectedRect(t),L=t.tr;for(let e=0;e<F.right-F.left;e++)k.push(j?{...O,colwidth:j&&j[e]?[j[e]]:null}:O);let B;for(let t=F.top;t<F.bottom;t++){let S=F.map.positionAt(t,F.left,F.table);t==F.top&&(S+=E.nodeSize);for(let w=F.left,D=0;w<F.right;w++,D++)w==F.left&&t==F.top||L.insert(B=L.mapping.map(S+F.tableStart,1),e({node:E,row:t,col:w}).createAndFill(k[D]))}L.setNodeMarkup(D,e({node:E,row:F.top,col:F.left}),k[0]),w instanceof CellSelection&&L.setSelection(new CellSelection(L.doc.resolve(w.$anchorCell.pos),B?L.doc.resolve(B):void 0)),S(L)}return!0}}function setCellAttr(e,t){return function(S,w){if(!isInTable(S))return!1;let E=selectionCell(S);if(E.nodeAfter.attrs[e]===t)return!1;if(w){let D=S.tr;S.selection instanceof CellSelection?S.selection.forEachCell((S,w)=>{S.attrs[e]!==t&&D.setNodeMarkup(w,null,{...S.attrs,[e]:t})}):D.setNodeMarkup(E.pos,null,{...E.nodeAfter.attrs,[e]:t}),w(D)}return!0}}function deprecated_toggleHeader(e){return function(t,S){if(!isInTable(t))return!1;if(S){let w=tableNodeTypes(t.schema),E=selectedRect(t),D=t.tr,O=E.map.cellsInRect(e==`column`?{left:E.left,top:0,right:E.right,bottom:E.map.height}:e==`row`?{left:0,top:E.top,right:E.map.width,bottom:E.bottom}:E),k=O.map(e=>E.table.nodeAt(e));for(let e=0;e<O.length;e++)k[e].type==w.header_cell&&D.setNodeMarkup(E.tableStart+O[e],w.cell,k[e].attrs);if(D.steps.length===0)for(let e=0;e<O.length;e++)D.setNodeMarkup(E.tableStart+O[e],w.header_cell,k[e].attrs);S(D)}return!0}}function isHeaderEnabledByType(e,t,S){let w=t.map.cellsInRect({left:0,top:0,right:e==`row`?t.map.width:1,bottom:e==`column`?t.map.height:1});for(let e=0;e<w.length;e++){let E=t.table.nodeAt(w[e]);if(E&&E.type!==S.header_cell)return!1}return!0}function toggleHeader(e,t){return t||={useDeprecatedLogic:!1},t.useDeprecatedLogic?deprecated_toggleHeader(e):function(t,S){if(!isInTable(t))return!1;if(S){let w=tableNodeTypes(t.schema),E=selectedRect(t),D=t.tr,O=isHeaderEnabledByType(`row`,E,w),k=isHeaderEnabledByType(`column`,E,w),j=(e===`column`?O:e===`row`&&k)?1:0,F=e==`column`?{left:0,top:j,right:1,bottom:E.map.height}:e==`row`?{left:j,top:0,right:E.map.width,bottom:1}:E,L=e==`column`?k?w.cell:w.header_cell:e==`row`?O?w.cell:w.header_cell:w.cell;E.map.cellsInRect(F).forEach(e=>{let t=e+E.tableStart,S=D.doc.nodeAt(t);S&&D.setNodeMarkup(t,L,S.attrs)}),S(D)}return!0}}const toggleHeaderRow=toggleHeader(`row`,{useDeprecatedLogic:!0}),toggleHeaderColumn=toggleHeader(`column`,{useDeprecatedLogic:!0}),toggleHeaderCell=toggleHeader(`cell`,{useDeprecatedLogic:!0});function findNextCell(e,t){if(t<0){let t=e.nodeBefore;if(t)return e.pos-t.nodeSize;for(let t=e.index(-1)-1,S=e.before();t>=0;t--){let w=e.node(-1).child(t),E=w.lastChild;if(E)return S-1-E.nodeSize;S-=w.nodeSize}}else{if(e.index()<e.parent.childCount-1)return e.pos+e.nodeAfter.nodeSize;let t=e.node(-1);for(let S=e.indexAfter(-1),w=e.after();S<t.childCount;S++){let e=t.child(S);if(e.childCount)return w+1;w+=e.nodeSize}}return null}function goToNextCell(e){return function(t,S){if(!isInTable(t))return!1;let w=findNextCell(selectionCell(t),e);if(w==null)return!1;if(S){let e=t.doc.resolve(w);S(t.tr.setSelection(TextSelection.between(e,moveCellForward(e))).scrollIntoView())}return!0}}function deleteTable(e,t){let S=e.selection.$anchor;for(let w=S.depth;w>0;w--)if(S.node(w).type.spec.tableRole==`table`)return t&&t(e.tr.delete(S.before(w),S.after(w)).scrollIntoView()),!0;return!1}function deleteCellSelection(e,t){let S=e.selection;if(!(S instanceof CellSelection))return!1;if(t){let w=e.tr,E=tableNodeTypes(e.schema).cell.createAndFill().content;S.forEachCell((e,t)=>{e.content.eq(E)||w.replace(w.mapping.map(t+1),w.mapping.map(t+e.nodeSize-1),new Slice(E,0,0))}),w.docChanged&&t(w)}return!0}function pastedCells(e){if(e.size===0)return null;let{content:t,openStart:S,openEnd:w}=e;for(;t.childCount==1&&(S>0&&w>0||t.child(0).type.spec.tableRole==`table`);)S--,w--,t=t.child(0).content;let E=t.child(0),D=E.type.spec.tableRole,O=E.type.schema,k=[];if(D==`row`)for(let e=0;e<t.childCount;e++){let E=t.child(e).content,D=e?0:Math.max(0,S-1),j=e<t.childCount-1?0:Math.max(0,w-1);(D||j)&&(E=fitSlice(tableNodeTypes(O).row,new Slice(E,D,j)).content),k.push(E)}else if(D==`cell`||D==`header_cell`)k.push(S||w?fitSlice(tableNodeTypes(O).row,new Slice(t,S,w)).content:t);else return null;return ensureRectangular(O,k)}function ensureRectangular(e,t){let S=[];for(let e=0;e<t.length;e++){let w=t[e];for(let t=w.childCount-1;t>=0;t--){let{rowspan:E,colspan:D}=w.child(t).attrs;for(let t=e;t<e+E;t++)S[t]=(S[t]||0)+D}}let w=0;for(let e=0;e<S.length;e++)w=Math.max(w,S[e]);for(let E=0;E<S.length;E++)if(E>=t.length&&t.push(Fragment.empty),S[E]<w){let D=tableNodeTypes(e).cell.createAndFill(),O=[];for(let e=S[E];e<w;e++)O.push(D);t[E]=t[E].append(Fragment.from(O))}return{height:t.length,width:w,rows:t}}function fitSlice(e,t){let S=e.createAndFill();return new Transform$4(S).replace(0,S.content.size,t).doc}function clipCells({width:e,height:t,rows:S},w,E){if(e!=w){let t=[],E=[];for(let e=0;e<S.length;e++){let D=S[e],O=[];for(let S=t[e]||0,E=0;S<w;E++){let k=D.child(E%D.childCount);S+k.attrs.colspan>w&&(k=k.type.createChecked(removeColSpan(k.attrs,k.attrs.colspan,S+k.attrs.colspan-w),k.content)),O.push(k),S+=k.attrs.colspan;for(let S=1;S<k.attrs.rowspan;S++)t[e+S]=(t[e+S]||0)+k.attrs.colspan}E.push(Fragment.from(O))}S=E,e=w}if(t!=E){let e=[];for(let w=0,D=0;w<E;w++,D++){let O=[],k=S[D%t];for(let e=0;e<k.childCount;e++){let t=k.child(e);w+t.attrs.rowspan>E&&(t=t.type.create({...t.attrs,rowspan:Math.max(1,E-t.attrs.rowspan)},t.content)),O.push(t)}e.push(Fragment.from(O))}S=e,t=E}return{width:e,height:t,rows:S}}function growTable(e,t,S,w,E,D,O){let k=e.doc.type.schema,j=tableNodeTypes(k),F,L;if(E>t.width)for(let D=0,k=0;D<t.height;D++){let B=S.child(D);k+=B.nodeSize;let H=[],q;q=B.lastChild==null||B.lastChild.type==j.cell?F||=j.cell.createAndFill():L||=j.header_cell.createAndFill();for(let e=t.width;e<E;e++)H.push(q);e.insert(e.mapping.slice(O).map(k-1+w),H)}if(D>t.height){let k=[];for(let e=0,w=(t.height-1)*t.width;e<Math.max(t.width,E);e++){let E=e>=t.width?!1:S.nodeAt(t.map[w+e]).type==j.header_cell;k.push(E?L||=j.header_cell.createAndFill():F||=j.cell.createAndFill())}let B=j.row.create(null,Fragment.from(k)),H=[];for(let e=t.height;e<D;e++)H.push(B);e.insert(e.mapping.slice(O).map(w+S.nodeSize-2),H)}return!!(F||L)}function isolateHorizontal(e,t,S,w,E,D,O,k){if(O==0||O==t.height)return!1;let j=!1;for(let F=E;F<D;F++){let E=O*t.width+F,D=t.map[E];if(t.map[E-t.width]==D){j=!0;let E=S.nodeAt(D),{top:L,left:B}=t.findCell(D);e.setNodeMarkup(e.mapping.slice(k).map(D+w),null,{...E.attrs,rowspan:O-L}),e.insert(e.mapping.slice(k).map(t.positionAt(O,B,S)),E.type.createAndFill({...E.attrs,rowspan:L+E.attrs.rowspan-O})),F+=E.attrs.colspan-1}}return j}function isolateVertical(e,t,S,w,E,D,O,k){if(O==0||O==t.width)return!1;let j=!1;for(let F=E;F<D;F++){let E=F*t.width+O,D=t.map[E];if(t.map[E-1]==D){j=!0;let E=S.nodeAt(D),L=t.colCount(D),B=e.mapping.slice(k).map(D+w);e.setNodeMarkup(B,null,removeColSpan(E.attrs,O-L,E.attrs.colspan-(O-L))),e.insert(B+E.nodeSize,E.type.createAndFill(removeColSpan(E.attrs,0,O-L))),F+=E.attrs.rowspan-1}}return j}function insertCells(e,t,S,w,E){let D=S?e.doc.nodeAt(S-1):e.doc;if(!D)throw Error(`No table found`);let O=TableMap.get(D),{top:k,left:j}=w,F=j+E.width,L=k+E.height,B=e.tr,H=0;function q(){if(D=S?B.doc.nodeAt(S-1):B.doc,!D)throw Error(`No table found`);O=TableMap.get(D),H=B.mapping.maps.length}growTable(B,O,D,S,F,L,H)&&q(),isolateHorizontal(B,O,D,S,j,F,k,H)&&q(),isolateHorizontal(B,O,D,S,j,F,L,H)&&q(),isolateVertical(B,O,D,S,k,L,j,H)&&q(),isolateVertical(B,O,D,S,k,L,F,H)&&q();for(let e=k;e<L;e++){let t=O.positionAt(e,j,D),w=O.positionAt(e,F,D);B.replace(B.mapping.slice(H).map(t+S),B.mapping.slice(H).map(w+S),new Slice(E.rows[e-k],0,0))}q(),B.setSelection(new CellSelection(B.doc.resolve(S+O.positionAt(k,j,D)),B.doc.resolve(S+O.positionAt(L-1,F-1,D)))),t(B)}const handleKeyDown$1=keydownHandler({ArrowLeft:arrow$1(`horiz`,-1),ArrowRight:arrow$1(`horiz`,1),ArrowUp:arrow$1(`vert`,-1),ArrowDown:arrow$1(`vert`,1),"Shift-ArrowLeft":shiftArrow(`horiz`,-1),"Shift-ArrowRight":shiftArrow(`horiz`,1),"Shift-ArrowUp":shiftArrow(`vert`,-1),"Shift-ArrowDown":shiftArrow(`vert`,1),Backspace:deleteCellSelection,"Mod-Backspace":deleteCellSelection,Delete:deleteCellSelection,"Mod-Delete":deleteCellSelection});function maybeSetSelection(e,t,S){return S.eq(e.selection)?!1:(t&&t(e.tr.setSelection(S).scrollIntoView()),!0)}function arrow$1(e,t){return(S,w,E)=>{if(!E)return!1;let D=S.selection;if(D instanceof CellSelection)return maybeSetSelection(S,w,Selection$1.near(D.$headCell,t));if(e!=`horiz`&&!D.empty)return!1;let O=atEndOfCell(E,e,t);if(O==null)return!1;if(e==`horiz`)return maybeSetSelection(S,w,Selection$1.near(S.doc.resolve(D.head+t),t));{let E=S.doc.resolve(O),D=nextCell(E,e,t),k;return k=D?Selection$1.near(D,1):t<0?Selection$1.near(S.doc.resolve(E.before(-1)),-1):Selection$1.near(S.doc.resolve(E.after(-1)),1),maybeSetSelection(S,w,k)}}}function shiftArrow(e,t){return(S,w,E)=>{if(!E)return!1;let D=S.selection,O;if(D instanceof CellSelection)O=D;else{let w=atEndOfCell(E,e,t);if(w==null)return!1;O=new CellSelection(S.doc.resolve(w))}let k=nextCell(O.$headCell,e,t);return k?maybeSetSelection(S,w,new CellSelection(O.$anchorCell,k)):!1}}function handleTripleClick(e,t){let S=e.state.doc,w=cellAround(S.resolve(t));return w?(e.dispatch(e.state.tr.setSelection(new CellSelection(w))),!0):!1}function handlePaste(e,t,S){if(!isInTable(e.state))return!1;let w=pastedCells(S),E=e.state.selection;if(E instanceof CellSelection){w||={width:1,height:1,rows:[Fragment.from(fitSlice(tableNodeTypes(e.state.schema).cell,S))]};let t=E.$anchorCell.node(-1),D=E.$anchorCell.start(-1),O=TableMap.get(t).rectBetween(E.$anchorCell.pos-D,E.$headCell.pos-D);return w=clipCells(w,O.right-O.left,O.bottom-O.top),insertCells(e.state,e.dispatch,D,O,w),!0}else if(w){let t=selectionCell(e.state),S=t.start(-1);return insertCells(e.state,e.dispatch,S,TableMap.get(t.node(-1)).findCell(t.pos-S),w),!0}else return!1}function handleMouseDown$1(e,t){var S;if(t.button!=0||t.ctrlKey||t.metaKey)return;let w=domInCell(e,t.target),E;if(t.shiftKey&&e.state.selection instanceof CellSelection)D(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&w&&(E=cellAround(e.state.selection.$anchor))!=null&&cellUnderMouse(e,t)?.pos!=E.pos)D(E,t),t.preventDefault();else if(!w)return;function D(t,S){let w=cellUnderMouse(e,S),E=tableEditingKey.getState(e.state)==null;if(!w||!inSameTable(t,w))if(E)w=t;else return;let D=new CellSelection(t,w);if(E||!e.state.selection.eq(D)){let S=e.state.tr.setSelection(D);E&&S.setMeta(tableEditingKey,t.pos),e.dispatch(S)}}function O(){e.root.removeEventListener(`mouseup`,O),e.root.removeEventListener(`dragstart`,O),e.root.removeEventListener(`mousemove`,k),tableEditingKey.getState(e.state)!=null&&e.dispatch(e.state.tr.setMeta(tableEditingKey,-1))}function k(S){let E=S,k=tableEditingKey.getState(e.state),j;if(k!=null)j=e.state.doc.resolve(k);else if(domInCell(e,E.target)!=w&&(j=cellUnderMouse(e,t),!j))return O();j&&D(j,E)}e.root.addEventListener(`mouseup`,O),e.root.addEventListener(`dragstart`,O),e.root.addEventListener(`mousemove`,k)}function atEndOfCell(e,t,S){if(!(e.state.selection instanceof TextSelection))return null;let{$head:w}=e.state.selection;for(let E=w.depth-1;E>=0;E--){let D=w.node(E);if((S<0?w.index(E):w.indexAfter(E))!=(S<0?0:D.childCount))return null;if(D.type.spec.tableRole==`cell`||D.type.spec.tableRole==`header_cell`){let D=w.before(E),O=t==`vert`?S>0?`down`:`up`:S>0?`right`:`left`;return e.endOfTextblock(O)?D:null}}return null}function domInCell(e,t){for(;t&&t!=e.dom;t=t.parentNode)if(t.nodeName==`TD`||t.nodeName==`TH`)return t;return null}function cellUnderMouse(e,t){let S=e.posAtCoords({left:t.clientX,top:t.clientY});if(!S)return null;let{inside:w,pos:E}=S;return w>=0&&cellAround(e.state.doc.resolve(w))||cellAround(e.state.doc.resolve(E))}var TableView$1=class{constructor(e,t){this.node=e,this.defaultCellMinWidth=t,this.dom=document.createElement(`div`),this.dom.className=`tableWrapper`,this.table=this.dom.appendChild(document.createElement(`table`)),this.table.style.setProperty(`--default-cell-min-width`,`${t}px`),this.colgroup=this.table.appendChild(document.createElement(`colgroup`)),updateColumnsOnResize(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement(`tbody`))}update(e){return e.type==this.node.type?(this.node=e,updateColumnsOnResize(e,this.colgroup,this.table,this.defaultCellMinWidth),!0):!1}ignoreMutation(e){return e.type==`attributes`&&(e.target==this.table||this.colgroup.contains(e.target))}};function updateColumnsOnResize(e,t,S,w,E,D){let O=0,k=!0,j=t.firstChild,F=e.firstChild;if(F){for(let e=0,S=0;e<F.childCount;e++){let{colspan:L,colwidth:B}=F.child(e).attrs;for(let e=0;e<L;e++,S++){let F=E==S?D:B&&B[e],L=F?F+`px`:``;if(O+=F||w,F||(k=!1),j)j.style.width!=L&&(j.style.width=L),j=j.nextSibling;else{let e=document.createElement(`col`);e.style.width=L,t.appendChild(e)}}}for(;j;){var L;let e=j.nextSibling;(L=j.parentNode)==null||L.removeChild(j),j=e}k?(S.style.width=O+`px`,S.style.minWidth=``):(S.style.width=``,S.style.minWidth=O+`px`)}}const columnResizingPluginKey=new PluginKey(`tableColumnResizing`);function columnResizing({handleWidth:e=5,cellMinWidth:t=25,defaultCellMinWidth:S=100,View:w=TableView$1,lastColumnResizable:E=!0}={}){let D=new Plugin({key:columnResizingPluginKey,state:{init(e,t){var E;let O=(E=D.spec)==null||(E=E.props)==null?void 0:E.nodeViews,k=tableNodeTypes(t.schema).table.name;return w&&O&&(O[k]=(e,t)=>new w(e,S,t)),new ResizeState(-1,!1)},apply(e,t){return t.apply(e)}},props:{attributes:e=>{let t=columnResizingPluginKey.getState(e);return t&&t.activeHandle>-1?{class:`resize-cursor`}:{}},handleDOMEvents:{mousemove:(t,S)=>{handleMouseMove(t,S,e,E)},mouseleave:e=>{handleMouseLeave(e)},mousedown:(e,w)=>{handleMouseDown(e,w,t,S)}},decorations:e=>{let t=columnResizingPluginKey.getState(e);if(t&&t.activeHandle>-1)return handleDecorations(e,t.activeHandle)},nodeViews:{}}});return D}var ResizeState=class e{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(t){let S=this,w=t.getMeta(columnResizingPluginKey);if(w&&w.setHandle!=null)return new e(w.setHandle,!1);if(w&&w.setDragging!==void 0)return new e(S.activeHandle,w.setDragging);if(S.activeHandle>-1&&t.docChanged){let w=t.mapping.map(S.activeHandle,-1);return pointsAtCell(t.doc.resolve(w))||(w=-1),new e(w,S.dragging)}return S}};function handleMouseMove(e,t,S,w){if(!e.editable)return;let E=columnResizingPluginKey.getState(e.state);if(E&&!E.dragging){let D=domCellAround(t.target),O=-1;if(D){let{left:w,right:E}=D.getBoundingClientRect();t.clientX-w<=S?O=edgeCell(e,t,`left`,S):E-t.clientX<=S&&(O=edgeCell(e,t,`right`,S))}if(O!=E.activeHandle){if(!w&&O!==-1){let t=e.state.doc.resolve(O),S=t.node(-1),w=TableMap.get(S),E=t.start(-1);if(w.colCount(t.pos-E)+t.nodeAfter.attrs.colspan-1==w.width-1)return}updateHandle(e,O)}}}function handleMouseLeave(e){if(!e.editable)return;let t=columnResizingPluginKey.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&updateHandle(e,-1)}function handleMouseDown(e,t,S,w){var E;if(!e.editable)return!1;let D=e.dom.ownerDocument.defaultView??window,O=columnResizingPluginKey.getState(e.state);if(!O||O.activeHandle==-1||O.dragging)return!1;let k=e.state.doc.nodeAt(O.activeHandle),j=currentColWidth(e,O.activeHandle,k.attrs);e.dispatch(e.state.tr.setMeta(columnResizingPluginKey,{setDragging:{startX:t.clientX,startWidth:j}}));function F(t){D.removeEventListener(`mouseup`,F),D.removeEventListener(`mousemove`,L);let w=columnResizingPluginKey.getState(e.state);w?.dragging&&(updateColumnWidth(e,w.activeHandle,draggedWidth(w.dragging,t,S)),e.dispatch(e.state.tr.setMeta(columnResizingPluginKey,{setDragging:null})))}function L(t){if(!t.which)return F(t);let E=columnResizingPluginKey.getState(e.state);if(E&&E.dragging){let D=draggedWidth(E.dragging,t,S);displayColumnWidth(e,E.activeHandle,D,w)}}return displayColumnWidth(e,O.activeHandle,j,w),D.addEventListener(`mouseup`,F),D.addEventListener(`mousemove`,L),t.preventDefault(),!0}function currentColWidth(e,t,{colspan:S,colwidth:w}){let E=w&&w[w.length-1];if(E)return E;let D=e.domAtPos(t),O=D.node.childNodes[D.offset].offsetWidth,k=S;if(w)for(let e=0;e<S;e++)w[e]&&(O-=w[e],k--);return O/k}function domCellAround(e){for(;e&&e.nodeName!=`TD`&&e.nodeName!=`TH`;)e=e.classList&&e.classList.contains(`ProseMirror`)?null:e.parentNode;return e}function edgeCell(e,t,S,w){let E=S==`right`?-w:w,D=e.posAtCoords({left:t.clientX+E,top:t.clientY});if(!D)return-1;let{pos:O}=D,k=cellAround(e.state.doc.resolve(O));if(!k)return-1;if(S==`right`)return k.pos;let j=TableMap.get(k.node(-1)),F=k.start(-1),L=j.map.indexOf(k.pos-F);return L%j.width==0?-1:F+j.map[L-1]}function draggedWidth(e,t,S){let w=t.clientX-e.startX;return Math.max(S,e.startWidth+w)}function updateHandle(e,t){e.dispatch(e.state.tr.setMeta(columnResizingPluginKey,{setHandle:t}))}function updateColumnWidth(e,t,S){let w=e.state.doc.resolve(t),E=w.node(-1),D=TableMap.get(E),O=w.start(-1),k=D.colCount(w.pos-O)+w.nodeAfter.attrs.colspan-1,j=e.state.tr;for(let e=0;e<D.height;e++){let t=e*D.width+k;if(e&&D.map[t]==D.map[t-D.width])continue;let w=D.map[t],F=E.nodeAt(w).attrs,L=F.colspan==1?0:k-D.colCount(w);if(F.colwidth&&F.colwidth[L]==S)continue;let B=F.colwidth?F.colwidth.slice():zeroes(F.colspan);B[L]=S,j.setNodeMarkup(O+w,null,{...F,colwidth:B})}j.docChanged&&e.dispatch(j)}function displayColumnWidth(e,t,S,w){let E=e.state.doc.resolve(t),D=E.node(-1),O=E.start(-1),k=TableMap.get(D).colCount(E.pos-O)+E.nodeAfter.attrs.colspan-1,j=e.domAtPos(E.start(-1)).node;for(;j&&j.nodeName!=`TABLE`;)j=j.parentNode;j&&updateColumnsOnResize(D,j.firstChild,j,w,k,S)}function zeroes(e){return Array(e).fill(0)}function handleDecorations(e,t){let S=[],w=e.doc.resolve(t),E=w.node(-1);if(!E)return DecorationSet.empty;let D=TableMap.get(E),O=w.start(-1),k=D.colCount(w.pos-O)+w.nodeAfter.attrs.colspan-1;for(let t=0;t<D.height;t++){let w=k+t*D.width;if((k==D.width-1||D.map[w]!=D.map[w+1])&&(t==0||D.map[w]!=D.map[w-D.width])){var j;let t=D.map[w],k=O+t+E.nodeAt(t).nodeSize-1,F=document.createElement(`div`);F.className=`column-resize-handle`,columnResizingPluginKey.getState(e)?.dragging&&S.push(Decoration.node(O+t,O+t+E.nodeAt(t).nodeSize,{class:`column-resize-dragging`})),S.push(Decoration.widget(k,F))}}return DecorationSet.create(e.doc,S)}function tableEditing({allowTableNodeSelection:e=!1}={}){return new Plugin({key:tableEditingKey,state:{init(){return null},apply(e,t){let S=e.getMeta(tableEditingKey);if(S!=null)return S==-1?null:S;if(t==null||!e.docChanged)return t;let{deleted:w,pos:E}=e.mapping.mapResult(t);return w?null:E}},props:{decorations:drawCellSelection,handleDOMEvents:{mousedown:handleMouseDown$1},createSelectionBetween(e){return tableEditingKey.getState(e.state)==null?null:e.state.selection},handleTripleClick,handleKeyDown:handleKeyDown$1,handlePaste},appendTransaction(t,S,w){return normalizeSelection(w,fixTables(w,S),e)}})}function normalizeTableCellAlign(e){return e===`left`||e===`right`||e===`center`?e:null}function parseAlign(e){let t=(e.style.textAlign||``).trim().toLowerCase(),S=(e.getAttribute(`align`)||``).trim().toLowerCase();return normalizeTableCellAlign(t||S)}function normalizeTableCellAlignFromAttributes(e){return normalizeTableCellAlign(e?.align)}function createAlignAttribute(){return{default:null,parseHTML:e=>parseAlign(e),renderHTML:e=>e.align?{style:`text-align: ${e.align}`}:{}}}var TableCell=Node3.create({name:`tableCell`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:e=>{var t,S;let w=e.getAttribute(`colwidth`),E=w?w.split(`,`).map(e=>parseInt(e,10)):null;if(!E){let t=e.closest(`table`)?.querySelectorAll(`colgroup > col`),S=Array.from(e.parentElement?.children||[]).indexOf(e);if(S&&S>-1&&t&&t[S]){let e=t[S].getAttribute(`width`);return e?[parseInt(e,10)]:null}}return E}},align:createAlignAttribute()}},tableRole:`cell`,isolating:!0,parseHTML(){return[{tag:`td`}]},renderHTML({HTMLAttributes:e}){return[`td`,mergeAttributes(this.options.HTMLAttributes,e),0]}}),TableHeader=Node3.create({name:`tableHeader`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:e=>{let t=e.getAttribute(`colwidth`);return t?t.split(`,`).map(e=>parseInt(e,10)):null}},align:createAlignAttribute()}},tableRole:`header_cell`,isolating:!0,parseHTML(){return[{tag:`th`}]},renderHTML({HTMLAttributes:e}){return[`th`,mergeAttributes(this.options.HTMLAttributes,e),0]}}),TableRow=Node3.create({name:`tableRow`,addOptions(){return{HTMLAttributes:{}}},content:`(tableCell | tableHeader)*`,tableRole:`row`,parseHTML(){return[{tag:`tr`}]},renderHTML({HTMLAttributes:e}){return[`tr`,mergeAttributes(this.options.HTMLAttributes,e),0]}});function getColStyleDeclaration(e,t){return t?[`width`,`${Math.max(t,e)}px`]:[`min-width`,`${e}px`]}function updateColumns(e,t,S,w,E,D){var O;let k=0,j=!0,F=t.firstChild,L=e.firstChild;if(L!==null)for(let e=0,S=0;e<L.childCount;e+=1){let{colspan:O,colwidth:B}=L.child(e).attrs;for(let e=0;e<O;e+=1,S+=1){let O=E===S?D:B&&B[e],L=O?`${O}px`:``;if(k+=O||w,O||(j=!1),F){if(F.style.width!==L){let[e,t]=getColStyleDeclaration(w,O);F.style.setProperty(e,t)}F=F.nextSibling}else{let e=document.createElement(`col`),[S,E]=getColStyleDeclaration(w,O);e.style.setProperty(S,E),t.appendChild(e)}}}for(;F;){let e=F.nextSibling;(O=F.parentNode)==null||O.removeChild(F),F=e}let B=e.attrs.style&&typeof e.attrs.style==`string`&&/\bwidth\s*:/i.test(e.attrs.style);j&&!B?(S.style.width=`${k}px`,S.style.minWidth=``):(S.style.width=``,S.style.minWidth=`${k}px`)}var TableView=class{constructor(e,t){this.node=e,this.cellMinWidth=t,this.dom=document.createElement(`div`),this.dom.className=`tableWrapper`,this.table=this.dom.appendChild(document.createElement(`table`)),e.attrs.style&&(this.table.style.cssText=e.attrs.style),this.colgroup=this.table.appendChild(document.createElement(`colgroup`)),updateColumns(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement(`tbody`))}update(e){return e.type===this.node.type?(this.node=e,updateColumns(e,this.colgroup,this.table,this.cellMinWidth),!0):!1}ignoreMutation(e){let t=e.target,S=this.dom.contains(t),w=this.contentDOM.contains(t);return!!(S&&!w&&(e.type===`attributes`||e.type===`childList`||e.type===`characterData`))}};function createColGroup(e,t,S,w){let E=0,D=!0,O=[],k=e.firstChild;if(!k)return{};for(let e=0,j=0;e<k.childCount;e+=1){let{colspan:F,colwidth:L}=k.child(e).attrs;for(let e=0;e<F;e+=1,j+=1){let k=S===j?w:L&&L[e];E+=k||t,k||(D=!1);let[F,B]=getColStyleDeclaration(t,k);O.push([`col`,{style:`${F}: ${B}`}])}}let j=D?`${E}px`:``,F=D?``:`${E}px`;return{colgroup:[`colgroup`,{},...O],tableWidth:j,tableMinWidth:F}}function createCell(e,t){return t?e.createChecked(null,t):e.createAndFill()}function getTableNodeTypes(e){if(e.cached.tableNodeTypes)return e.cached.tableNodeTypes;let t={};return Object.keys(e.nodes).forEach(S=>{let w=e.nodes[S];w.spec.tableRole&&(t[w.spec.tableRole]=w)}),e.cached.tableNodeTypes=t,t}function createTable(e,t,S,w,E){let D=getTableNodeTypes(e),O=[],k=[];for(let e=0;e<S;e+=1){let e=createCell(D.cell,E);if(e&&k.push(e),w){let e=createCell(D.header_cell,E);e&&O.push(e)}}let j=[];for(let e=0;e<t;e+=1)j.push(D.row.createChecked(null,w&&e===0?O:k));return D.table.createChecked(null,j)}function isCellSelection(e){return e instanceof CellSelection}var deleteTableWhenAllCellsSelected=({editor:e})=>{let{selection:t}=e.state;if(!isCellSelection(t))return!1;let S=0;return findParentNodeClosestToPos(t.ranges[0].$from,e=>e.type.name===`table`)?.node.descendants(e=>{if(e.type.name===`table`)return!1;[`tableCell`,`tableHeader`].includes(e.type.name)&&(S+=1)}),S===t.ranges.length?(e.commands.deleteTable(),!0):!1},DEFAULT_CELL_LINE_SEPARATOR=``;function collapseWhitespace(e){return(e||``).replace(/\s+/g,` `).trim()}function renderTableToMarkdown(e,t,S={}){var w;let E=S.cellLineSeparator??``;if(!e||!e.content||e.content.length===0)return``;let D=[];e.content.forEach(e=>{let S=[];e.content&&e.content.forEach(e=>{let w=``;w=e.content&&Array.isArray(e.content)&&e.content.length>1?e.content.map(e=>t.renderChildren(e)).join(E):e.content?t.renderChildren(e.content):``;let D=collapseWhitespace(w),O=e.type===`tableHeader`,k=normalizeTableCellAlignFromAttributes(e.attrs);S.push({text:D,isHeader:O,align:k})}),D.push(S)});let O=D.reduce((e,t)=>Math.max(e,t.length),0);if(O===0)return``;let k=Array(O).fill(0);D.forEach(e=>{var t;for(let t=0;t<O;t+=1){let S=(e[t]?.text||``).length;S>k[t]&&(k[t]=S),k[t]<3&&(k[t]=3)}});let j=(e,t)=>e+` `.repeat(Math.max(0,t-e.length)),F=D[0],L=F.some(e=>e.isHeader),B=Array(O).fill(null);D.forEach(e=>{var t;for(let t=0;t<O;t+=1)!B[t]&&e[t]?.align&&(B[t]=e[t].align)});let H=`
|
|
215
|
+
3. "-" cannot repeat`);Ns.customSchemes.push([e,t])}function Rs(){Ns.scanner=Xr(Ns.customSchemes);for(let e=0;e<Ns.tokenQueue.length;e++)Ns.tokenQueue[e][1]({scanner:Ns.scanner});Ns.parser=Ts(Ns.scanner.tokens);for(let e=0;e<Ns.pluginQueue.length;e++)Ns.pluginQueue[e][1]({scanner:Ns.scanner,parser:Ns.parser});return Ns.initialized=!0,Ns}function $s(e){return Ns.initialized||Rs(),Ds(Ns.parser.start,e,Zr(Ns.scanner.start,e))}$s.scan=Zr;function ec(e,t=null,S=null){if(t&&typeof t==`object`){if(S)throw Error(`linkifyjs: Invalid link type ${t}; must be a string`);S=t,t=null}let w=new Gi(S),E=$s(e),D=[];for(let e=0;e<E.length;e++){let S=E[e];S.isLink&&(!t||S.t===t)&&w.check(S)&&D.push(S.toFormattedObject(w))}return D}e.find=ec,e.registerCustomProtocol=Is,e.reset=Ps,e.tokenize=$s})),import_linkify=require_linkify(),UNICODE_WHITESPACE_PATTERN=`[\0- \xA0 -\u2029 ]`,UNICODE_WHITESPACE_REGEX=new RegExp(UNICODE_WHITESPACE_PATTERN),UNICODE_WHITESPACE_REGEX_END=RegExp(`${UNICODE_WHITESPACE_PATTERN}$`),UNICODE_WHITESPACE_REGEX_GLOBAL=new RegExp(UNICODE_WHITESPACE_PATTERN,`g`);function isValidLinkStructure(e){return e.length===1?e[0].isLink:e.length===3&&e[1].isLink?[`()`,`[]`].includes(e[0].value+e[2].value):!1}function autolink$1(e){return new Plugin({key:new PluginKey(`autolink`),appendTransaction:(t,S,w)=>{let E=t.some(e=>e.docChanged)&&!S.doc.eq(w.doc),D=t.some(e=>e.getMeta(`preventAutolink`));if(!E||D)return;let{tr:O}=w;if(getChangedRanges(combineTransactionSteps(S.doc,[...t])).forEach(({newRange:t})=>{let S=findChildrenInRange(w.doc,t,e=>e.isTextblock),E,D;if(S.length>1)E=S[0],D=w.doc.textBetween(E.pos,E.pos+E.node.nodeSize,void 0,` `);else if(S.length){let e=w.doc.textBetween(t.from,t.to,` `,` `);if(!UNICODE_WHITESPACE_REGEX_END.test(e))return;E=S[0],D=w.doc.textBetween(E.pos,t.to,void 0,` `)}if(E&&D){let t=D.split(UNICODE_WHITESPACE_REGEX).filter(Boolean);if(t.length<=0)return!1;let S=t[t.length-1],k=E.pos+D.lastIndexOf(S);if(!S)return!1;let j=(0,import_linkify.tokenize)(S).map(t=>t.toObject(e.defaultProtocol));if(!isValidLinkStructure(j))return!1;j.filter(e=>e.isLink).map(e=>({...e,from:k+e.start+1,to:k+e.end+1})).filter(e=>w.schema.marks.code?!w.doc.rangeHasMark(e.from,e.to,w.schema.marks.code):!0).filter(t=>e.validate(t.value)).filter(t=>e.shouldAutoLink(t.value)).forEach(t=>{getMarksBetween(t.from,t.to,w.doc).some(t=>t.mark.type===e.type)||O.addMark(t.from,t.to,e.type.create({href:t.href}))})}}),O.steps.length)return O}})}function clickHandler(e){return new Plugin({key:new PluginKey(`handleClickLink`),props:{handleClick:(t,S,w)=>{var E,D;if(w.button!==0||!t.editable)return!1;let O=null;if(w.target instanceof HTMLAnchorElement)O=w.target;else{let t=w.target;if(!t)return!1;let S=e.editor.view.dom;O=t.closest(`a`),O&&!S.contains(O)&&(O=null)}if(!O)return!1;let k=!1;if(e.enableClickSelection&&(k=e.editor.commands.extendMarkRange(e.type.name)),e.openOnClick){let S=getAttributes(t.state,e.type.name),w=O.href??S.href,E=O.target??S.target;w&&(window.open(w,E),k=!0)}return k}}})}function pasteHandler(e){return new Plugin({key:new PluginKey(`handlePasteLink`),props:{handlePaste:(t,S,w)=>{let{shouldAutoLink:E}=e,{state:D}=t,{selection:O}=D,{empty:k}=O;if(k)return!1;let j=``;w.content.forEach(e=>{j+=e.textContent});let F=(0,import_linkify.find)(j,{defaultProtocol:e.defaultProtocol}).find(e=>e.isLink&&e.value===j);return!j||!F||E!==void 0&&!E(F.value)?!1:e.editor.commands.setMark(e.type,{href:F.href})}}})}function isAllowedUri(e,t){let S=[`http`,`https`,`ftp`,`ftps`,`mailto`,`tel`,`callto`,`sms`,`cid`,`xmpp`];return t&&t.forEach(e=>{let t=typeof e==`string`?e:e.scheme;t&&S.push(t)}),!e||e.replace(UNICODE_WHITESPACE_REGEX_GLOBAL,``).match(RegExp(`^(?:(?:${S.join(`|`)}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,`i`))}var Link=Mark.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(e=>{if(typeof e==`string`){(0,import_linkify.registerCustomProtocol)(e);return}(0,import_linkify.registerCustomProtocol)(e.scheme,e.optionalSlashes)})},onDestroy(){(0,import_linkify.reset)()},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:(e,t)=>!!isAllowedUri(e,t.protocols),validate:e=>!!e,shouldAutoLink:e=>{let t=/^[a-z][a-z0-9+.-]*:\/\//i.test(e),S=/^[a-z][a-z0-9+.-]*:/i.test(e);if(t||S&&!e.includes(`@`))return!0;let w=(e.includes(`@`)?e.split(`@`).pop():e).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(w)||!/\./.test(w))}}},addAttributes(){return{href:{default:null,parseHTML(e){return e.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:e=>{let t=e.getAttribute(`href`);return!t||!this.options.isAllowedUri(t,{defaultValidate:e=>!!isAllowedUri(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:e=>!!isAllowedUri(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?[`a`,mergeAttributes(this.options.HTMLAttributes,e),0]:[`a`,mergeAttributes(this.options.HTMLAttributes,{...e,href:``}),0]},markdownTokenName:`link`,parseMarkdown:(e,t)=>t.applyMark(`link`,t.parseInline(e.tokens||[]),{href:e.href,title:e.title||null}),renderMarkdown:(e,t)=>{var S,w,E,D;let O=e.attrs?.href??``,k=e.attrs?.title??``,j=t.renderChildren(e);return k?`[${j}](${O} "${k}")`:`[${j}](${O})`},addCommands(){return{setLink:e=>({chain:t})=>{let{href:S}=e;return this.options.isAllowedUri(S,{defaultValidate:e=>!!isAllowedUri(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?t().setMark(this.name,e).setMeta(`preventAutolink`,!0).run():!1},toggleLink:e=>({chain:t})=>{let{href:S}=e||{};return S&&!this.options.isAllowedUri(S,{defaultValidate:e=>!!isAllowedUri(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:t().toggleMark(this.name,e,{extendEmptyMarkRange:!0}).setMeta(`preventAutolink`,!0).run()},unsetLink:()=>({chain:e})=>e().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta(`preventAutolink`,!0).run()}},addPasteRules(){return[markPasteRule({find:e=>{let t=[];if(e){let{protocols:S,defaultProtocol:w}=this.options,E=(0,import_linkify.find)(e).filter(e=>e.isLink&&this.options.isAllowedUri(e.value,{defaultValidate:e=>!!isAllowedUri(e,S),protocols:S,defaultProtocol:w}));E.length&&E.forEach(e=>{this.options.shouldAutoLink(e.value)&&t.push({text:e.value,data:{href:e.href},index:e.start})})}return t},type:this.type,getAttributes:e=>{var t;return{href:e.data?.href}}})]},addProseMirrorPlugins(){let e=[],{protocols:t,defaultProtocol:S}=this.options;return this.options.autolink&&e.push(autolink$1({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!isAllowedUri(e,t),protocols:t,defaultProtocol:S}),shouldAutoLink:this.options.shouldAutoLink})),e.push(clickHandler({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick===`whenNotEditable`?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&e.push(pasteHandler({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),e}}),index_default$5=Link,inputRegex$4=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,pasteRegex$2=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,Highlight=Mark.create({name:`highlight`,addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:e=>e.getAttribute(`data-color`)||e.style.backgroundColor,renderHTML:e=>e.color?{"data-color":e.color,style:`background-color: ${e.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:`mark`}]},renderHTML({HTMLAttributes:e}){return[`mark`,mergeAttributes(this.options.HTMLAttributes,e),0]},renderMarkdown:(e,t)=>`==${t.renderChildren(e)}==`,parseMarkdown:(e,t)=>t.applyMark(`highlight`,t.parseInline(e.tokens||[])),markdownTokenizer:{name:`highlight`,level:`inline`,start:e=>e.indexOf(`==`),tokenize(e,t,S){let w=/^(==)([^=]+)(==)/.exec(e);if(w){let e=w[2].trim(),t=S.inlineTokens(e);return{type:`highlight`,raw:w[0],text:e,tokens:t}}}},addCommands(){return{setHighlight:e=>({commands:t})=>t.setMark(this.name,e),toggleHighlight:e=>({commands:t})=>t.toggleMark(this.name,e),unsetHighlight:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[markInputRule({find:inputRegex$4,type:this.type})]},addPasteRules(){return[markPasteRule({find:pasteRegex$2,type:this.type})]}}),index_default$4=Highlight;let readFromCache,addToCache;if(typeof WeakMap<`u`){let e=new WeakMap;readFromCache=t=>e.get(t),addToCache=(t,S)=>(e.set(t,S),S)}else{let e=[],t=10,S=0;readFromCache=t=>{for(let S=0;S<e.length;S+=2)if(e[S]==t)return e[S+1]},addToCache=(t,w)=>(S==10&&(S=0),e[S++]=t,e[S++]=w)}var TableMap=class{constructor(e,t,S,w){this.width=e,this.height=t,this.map=S,this.problems=w}findCell(e){for(let t=0;t<this.map.length;t++){let S=this.map[t];if(S!=e)continue;let w=t%this.width,E=t/this.width|0,D=w+1,O=E+1;for(let e=1;D<this.width&&this.map[t+e]==S;e++)D++;for(let e=1;O<this.height&&this.map[t+this.width*e]==S;e++)O++;return{left:w,top:E,right:D,bottom:O}}throw RangeError(`No cell with offset ${e} found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw RangeError(`No cell with offset ${e} found`)}nextCell(e,t,S){let{left:w,right:E,top:D,bottom:O}=this.findCell(e);return t==`horiz`?(S<0?w==0:E==this.width)?null:this.map[D*this.width+(S<0?w-1:E)]:(S<0?D==0:O==this.height)?null:this.map[w+this.width*(S<0?D-1:O)]}rectBetween(e,t){let{left:S,right:w,top:E,bottom:D}=this.findCell(e),{left:O,right:k,top:j,bottom:F}=this.findCell(t);return{left:Math.min(S,O),top:Math.min(E,j),right:Math.max(w,k),bottom:Math.max(D,F)}}cellsInRect(e){let t=[],S={};for(let w=e.top;w<e.bottom;w++)for(let E=e.left;E<e.right;E++){let D=w*this.width+E,O=this.map[D];S[O]||(S[O]=!0,!(E==e.left&&E&&this.map[D-1]==O||w==e.top&&w&&this.map[D-this.width]==O)&&t.push(O))}return t}positionAt(e,t,S){for(let w=0,E=0;;w++){let D=E+S.child(w).nodeSize;if(w==e){let S=t+e*this.width,w=(e+1)*this.width;for(;S<w&&this.map[S]<E;)S++;return S==w?D-1:this.map[S]}E=D}}static get(e){return readFromCache(e)||addToCache(e,computeMap(e))}};function computeMap(e){if(e.type.spec.tableRole!=`table`)throw RangeError(`Not a table node: `+e.type.name);let t=findWidth(e),S=e.childCount,w=[],E=0,D=null,O=[];for(let e=0,E=t*S;e<E;e++)w[e]=0;for(let k=0,j=0;k<S;k++){let F=e.child(k);j++;for(let e=0;;e++){for(;E<w.length&&w[E]!=0;)E++;if(e==F.childCount)break;let L=F.child(e),{colspan:B,rowspan:H,colwidth:q}=L.attrs;for(let e=0;e<H;e++){if(e+k>=S){(D||=[]).push({type:`overlong_rowspan`,pos:j,n:H-e});break}let F=E+e*t;for(let e=0;e<B;e++){w[F+e]==0?w[F+e]=j:(D||=[]).push({type:`collision`,row:k,pos:j,n:B-e});let S=q&&q[e];if(S){let w=(F+e)%t*2,E=O[w];E==null||E!=S&&O[w+1]==1?(O[w]=S,O[w+1]=1):E==S&&O[w+1]++}}}E+=B,j+=L.nodeSize}let L=(k+1)*t,B=0;for(;E<L;)w[E++]==0&&B++;B&&(D||=[]).push({type:`missing`,row:k,n:B}),j++}(t===0||S===0)&&(D||=[]).push({type:`zero_sized`});let k=new TableMap(t,S,w,D),j=!1;for(let e=0;!j&&e<O.length;e+=2)O[e]!=null&&O[e+1]<S&&(j=!0);return j&&findBadColWidths(k,O,e),k}function findWidth(e){let t=-1,S=!1;for(let w=0;w<e.childCount;w++){let E=e.child(w),D=0;if(S)for(let t=0;t<w;t++){let S=e.child(t);for(let e=0;e<S.childCount;e++){let E=S.child(e);t+E.attrs.rowspan>w&&(D+=E.attrs.colspan)}}for(let e=0;e<E.childCount;e++){let t=E.child(e);D+=t.attrs.colspan,t.attrs.rowspan>1&&(S=!0)}t==-1?t=D:t!=D&&(t=Math.max(t,D))}return t}function findBadColWidths(e,t,S){e.problems||=[];let w={};for(let E=0;E<e.map.length;E++){let D=e.map[E];if(w[D])continue;w[D]=!0;let O=S.nodeAt(D);if(!O)throw RangeError(`No cell with offset ${D} found`);let k=null,j=O.attrs;for(let S=0;S<j.colspan;S++){let w=t[(E+S)%e.width*2];w!=null&&(!j.colwidth||j.colwidth[S]!=w)&&((k||=freshColWidth(j))[S]=w)}k&&e.problems.unshift({type:`colwidth mismatch`,pos:D,colwidth:k})}}function freshColWidth(e){if(e.colwidth)return e.colwidth.slice();let t=[];for(let S=0;S<e.colspan;S++)t.push(0);return t}function tableNodeTypes(e){let t=e.cached.tableNodeTypes;if(!t){t=e.cached.tableNodeTypes={};for(let S in e.nodes){let w=e.nodes[S],E=w.spec.tableRole;E&&(t[E]=w)}}return t}const tableEditingKey=new PluginKey(`selectingCells`);function cellAround(e){for(let t=e.depth-1;t>0;t--)if(e.node(t).type.spec.tableRole==`row`)return e.node(0).resolve(e.before(t+1));return null}function cellWrapping(e){for(let t=e.depth;t>0;t--){let S=e.node(t).type.spec.tableRole;if(S===`cell`||S===`header_cell`)return e.node(t)}return null}function isInTable(e){let t=e.selection.$head;for(let e=t.depth;e>0;e--)if(t.node(e).type.spec.tableRole==`row`)return!0;return!1}function selectionCell(e){let t=e.selection;if(`$anchorCell`in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if(`node`in t&&t.node&&t.node.type.spec.tableRole==`cell`)return t.$anchor;let S=cellAround(t.$head)||cellNear(t.$head);if(S)return S;throw RangeError(`No cell found around position ${t.head}`)}function cellNear(e){for(let t=e.nodeAfter,S=e.pos;t;t=t.firstChild,S++){let w=t.type.spec.tableRole;if(w==`cell`||w==`header_cell`)return e.doc.resolve(S)}for(let t=e.nodeBefore,S=e.pos;t;t=t.lastChild,S--){let w=t.type.spec.tableRole;if(w==`cell`||w==`header_cell`)return e.doc.resolve(S-t.nodeSize)}}function pointsAtCell(e){return e.parent.type.spec.tableRole==`row`&&!!e.nodeAfter}function moveCellForward(e){return e.node(0).resolve(e.pos+e.nodeAfter.nodeSize)}function inSameTable(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function nextCell(e,t,S){let w=e.node(-1),E=TableMap.get(w),D=e.start(-1),O=E.nextCell(e.pos-D,t,S);return O==null?null:e.node(0).resolve(D+O)}function removeColSpan(e,t,S=1){let w={...e,colspan:e.colspan-S};return w.colwidth&&(w.colwidth=w.colwidth.slice(),w.colwidth.splice(t,S),w.colwidth.some(e=>e>0)||(w.colwidth=null)),w}function addColSpan(e,t,S=1){let w={...e,colspan:e.colspan+S};if(w.colwidth){w.colwidth=w.colwidth.slice();for(let e=0;e<S;e++)w.colwidth.splice(t,0,0)}return w}function columnIsHeader(e,t,S){let w=tableNodeTypes(t.type.schema).header_cell;for(let E=0;E<e.height;E++)if(t.nodeAt(e.map[S+E*e.width]).type!=w)return!1;return!0}var CellSelection=class e extends Selection$1{constructor(e,t=e){let S=e.node(-1),w=TableMap.get(S),E=e.start(-1),D=w.rectBetween(e.pos-E,t.pos-E),O=e.node(0),k=w.cellsInRect(D).filter(e=>e!=t.pos-E);k.unshift(t.pos-E);let j=k.map(e=>{let t=S.nodeAt(e);if(!t)throw RangeError(`No cell with offset ${e} found`);let w=E+e+1;return new SelectionRange(O.resolve(w),O.resolve(w+t.content.size))});super(j[0].$from,j[0].$to,j),this.$anchorCell=e,this.$headCell=t}map(t,S){let w=t.resolve(S.map(this.$anchorCell.pos)),E=t.resolve(S.map(this.$headCell.pos));if(pointsAtCell(w)&&pointsAtCell(E)&&inSameTable(w,E)){let t=this.$anchorCell.node(-1)!=w.node(-1);return t&&this.isRowSelection()?e.rowSelection(w,E):t&&this.isColSelection()?e.colSelection(w,E):new e(w,E)}return TextSelection.between(w,E)}content(){let e=this.$anchorCell.node(-1),t=TableMap.get(e),S=this.$anchorCell.start(-1),w=t.rectBetween(this.$anchorCell.pos-S,this.$headCell.pos-S),E={},D=[];for(let S=w.top;S<w.bottom;S++){let O=[];for(let D=S*t.width+w.left,k=w.left;k<w.right;k++,D++){let S=t.map[D];if(E[S])continue;E[S]=!0;let k=t.findCell(S),j=e.nodeAt(S);if(!j)throw RangeError(`No cell with offset ${S} found`);let F=w.left-k.left,L=k.right-w.right;if(F>0||L>0){let e=j.attrs;if(F>0&&(e=removeColSpan(e,0,F)),L>0&&(e=removeColSpan(e,e.colspan-L,L)),k.left<w.left){if(j=j.type.createAndFill(e),!j)throw RangeError(`Could not create cell with attrs ${JSON.stringify(e)}`)}else j=j.type.create(e,j.content)}if(k.top<w.top||k.bottom>w.bottom){let e={...j.attrs,rowspan:Math.min(k.bottom,w.bottom)-Math.max(k.top,w.top)};j=k.top<w.top?j.type.createAndFill(e):j.type.create(e,j.content)}O.push(j)}D.push(e.child(S).copy(Fragment.from(O)))}let O=this.isColSelection()&&this.isRowSelection()?e:D;return new Slice(Fragment.from(O),1,1)}replace(e,t=Slice.empty){let S=e.steps.length,w=this.ranges;for(let E=0;E<w.length;E++){let{$from:D,$to:O}=w[E],k=e.mapping.slice(S);e.replace(k.map(D.pos),k.map(O.pos),E?Slice.empty:t)}let E=Selection$1.findFrom(e.doc.resolve(e.mapping.slice(S).map(this.to)),-1);E&&e.setSelection(E)}replaceWith(e,t){this.replace(e,new Slice(Fragment.from(t),0,0))}forEachCell(e){let t=this.$anchorCell.node(-1),S=TableMap.get(t),w=this.$anchorCell.start(-1),E=S.cellsInRect(S.rectBetween(this.$anchorCell.pos-w,this.$headCell.pos-w));for(let S=0;S<E.length;S++)e(t.nodeAt(E[S]),w+E[S])}isColSelection(){let e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;let S=e+this.$anchorCell.nodeAfter.attrs.rowspan,w=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(S,w)==this.$headCell.node(-1).childCount}static colSelection(t,S=t){let w=t.node(-1),E=TableMap.get(w),D=t.start(-1),O=E.findCell(t.pos-D),k=E.findCell(S.pos-D),j=t.node(0);return O.top<=k.top?(O.top>0&&(t=j.resolve(D+E.map[O.left])),k.bottom<E.height&&(S=j.resolve(D+E.map[E.width*(E.height-1)+k.right-1]))):(k.top>0&&(S=j.resolve(D+E.map[k.left])),O.bottom<E.height&&(t=j.resolve(D+E.map[E.width*(E.height-1)+O.right-1]))),new e(t,S)}isRowSelection(){let e=this.$anchorCell.node(-1),t=TableMap.get(e),S=this.$anchorCell.start(-1),w=t.colCount(this.$anchorCell.pos-S),E=t.colCount(this.$headCell.pos-S);if(Math.min(w,E)>0)return!1;let D=w+this.$anchorCell.nodeAfter.attrs.colspan,O=E+this.$headCell.nodeAfter.attrs.colspan;return Math.max(D,O)==t.width}eq(t){return t instanceof e&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,S=t){let w=t.node(-1),E=TableMap.get(w),D=t.start(-1),O=E.findCell(t.pos-D),k=E.findCell(S.pos-D),j=t.node(0);return O.left<=k.left?(O.left>0&&(t=j.resolve(D+E.map[O.top*E.width])),k.right<E.width&&(S=j.resolve(D+E.map[E.width*(k.top+1)-1]))):(k.left>0&&(S=j.resolve(D+E.map[k.top*E.width])),O.right<E.width&&(t=j.resolve(D+E.map[E.width*(O.top+1)-1]))),new e(t,S)}toJSON(){return{type:`cell`,anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,S){return new e(t.resolve(S.anchor),t.resolve(S.head))}static create(t,S,w=S){return new e(t.resolve(S),t.resolve(w))}getBookmark(){return new CellBookmark(this.$anchorCell.pos,this.$headCell.pos)}};CellSelection.prototype.visible=!1,Selection$1.jsonID(`cell`,CellSelection);var CellBookmark=class e{constructor(e,t){this.anchor=e,this.head=t}map(t){return new e(t.map(this.anchor),t.map(this.head))}resolve(e){let t=e.resolve(this.anchor),S=e.resolve(this.head);return t.parent.type.spec.tableRole==`row`&&S.parent.type.spec.tableRole==`row`&&t.index()<t.parent.childCount&&S.index()<S.parent.childCount&&inSameTable(t,S)?new CellSelection(t,S):Selection$1.near(S,1)}};function drawCellSelection(e){if(!(e.selection instanceof CellSelection))return null;let t=[];return e.selection.forEachCell((e,S)=>{t.push(Decoration.node(S,S+e.nodeSize,{class:`selectedCell`}))}),DecorationSet.create(e.doc,t)}function isCellBoundarySelection({$from:e,$to:t}){if(e.pos==t.pos||e.pos<t.pos-6)return!1;let S=e.pos,w=t.pos,E=e.depth;for(;E>=0&&!(e.after(E+1)<e.end(E));E--,S++);for(let e=t.depth;e>=0&&!(t.before(e+1)>t.start(e));e--,w--);return S==w&&/row|table/.test(e.node(E).type.spec.tableRole)}function isTextSelectionAcrossCells({$from:e,$to:t}){let S,w;for(let t=e.depth;t>0;t--){let w=e.node(t);if(w.type.spec.tableRole===`cell`||w.type.spec.tableRole===`header_cell`){S=w;break}}for(let e=t.depth;e>0;e--){let S=t.node(e);if(S.type.spec.tableRole===`cell`||S.type.spec.tableRole===`header_cell`){w=S;break}}return S!==w&&t.parentOffset===0}function normalizeSelection(e,t,S){let w=(t||e).selection,E=(t||e).doc,D,O;if(w instanceof NodeSelection&&(O=w.node.type.spec.tableRole)){if(O==`cell`||O==`header_cell`)D=CellSelection.create(E,w.from);else if(O==`row`){let e=E.resolve(w.from+1);D=CellSelection.rowSelection(e,e)}else if(!S){let e=TableMap.get(w.node),t=w.from+1,S=t+e.map[e.width*e.height-1];D=CellSelection.create(E,t+1,S)}}else w instanceof TextSelection&&isCellBoundarySelection(w)?D=TextSelection.create(E,w.from):w instanceof TextSelection&&isTextSelectionAcrossCells(w)&&(D=TextSelection.create(E,w.$from.start(),w.$from.end()));return D&&(t||=e.tr).setSelection(D),t}const fixTablesKey=new PluginKey(`fix-tables`);function changedDescendants(e,t,S,w){let E=e.childCount,D=t.childCount;outer:for(let O=0,k=0;O<D;O++){let D=t.child(O);for(let t=k,w=Math.min(E,O+3);t<w;t++)if(e.child(t)==D){k=t+1,S+=D.nodeSize;continue outer}w(D,S),k<E&&e.child(k).sameMarkup(D)?changedDescendants(e.child(k),D,S+1,w):D.nodesBetween(0,D.content.size,w,S+1),S+=D.nodeSize}}function fixTables(e,t){let S,w=(t,w)=>{t.type.spec.tableRole==`table`&&(S=fixTable(e,t,w,S))};return t?t.doc!=e.doc&&changedDescendants(t.doc,e.doc,0,w):e.doc.descendants(w),S}function fixTable(e,t,S,w){let E=TableMap.get(t);if(!E.problems)return w;w||=e.tr;let D=[];for(let e=0;e<E.height;e++)D.push(0);for(let e=0;e<E.problems.length;e++){let O=E.problems[e];if(O.type==`collision`){let e=t.nodeAt(O.pos);if(!e)continue;let E=e.attrs;for(let e=0;e<E.rowspan;e++)D[O.row+e]+=O.n;w.setNodeMarkup(w.mapping.map(S+1+O.pos),null,removeColSpan(E,E.colspan-O.n,O.n))}else if(O.type==`missing`)D[O.row]+=O.n;else if(O.type==`overlong_rowspan`){let e=t.nodeAt(O.pos);if(!e)continue;w.setNodeMarkup(w.mapping.map(S+1+O.pos),null,{...e.attrs,rowspan:e.attrs.rowspan-O.n})}else if(O.type==`colwidth mismatch`){let e=t.nodeAt(O.pos);if(!e)continue;w.setNodeMarkup(w.mapping.map(S+1+O.pos),null,{...e.attrs,colwidth:O.colwidth})}else if(O.type==`zero_sized`){let e=w.mapping.map(S);w.delete(e,e+t.nodeSize)}}let O,k;for(let e=0;e<D.length;e++)D[e]&&(O??=e,k=e);for(let j=0,F=S+1;j<E.height;j++){let S=t.child(j),E=F+S.nodeSize,L=D[j];if(L>0){let t=`cell`;S.firstChild&&(t=S.firstChild.type.spec.tableRole);let D=[];for(let S=0;S<L;S++){let S=tableNodeTypes(e.schema)[t].createAndFill();S&&D.push(S)}let B=(j==0||O==j-1)&&k==j?F+1:E-1;w.insert(w.mapping.map(B),D)}F=E}return w.setMeta(fixTablesKey,{fixTables:!0})}function selectedRect(e){let t=e.selection,S=selectionCell(e),w=S.node(-1),E=S.start(-1),D=TableMap.get(w);return{...t instanceof CellSelection?D.rectBetween(t.$anchorCell.pos-E,t.$headCell.pos-E):D.findCell(S.pos-E),tableStart:E,map:D,table:w}}function addColumn(e,{map:t,tableStart:S,table:w},E){let D=E>0?-1:0;columnIsHeader(t,w,E+D)&&(D=E==0||E==t.width?null:0);for(let O=0;O<t.height;O++){let k=O*t.width+E;if(E>0&&E<t.width&&t.map[k-1]==t.map[k]){let D=t.map[k],j=w.nodeAt(D);e.setNodeMarkup(e.mapping.map(S+D),null,addColSpan(j.attrs,E-t.colCount(D))),O+=j.attrs.rowspan-1}else{let j=D==null?tableNodeTypes(w.type.schema).cell:w.nodeAt(t.map[k+D]).type,F=t.positionAt(O,E,w);e.insert(e.mapping.map(S+F),j.createAndFill())}}return e}function addColumnBefore(e,t){if(!isInTable(e))return!1;if(t){let S=selectedRect(e);t(addColumn(e.tr,S,S.left))}return!0}function addColumnAfter(e,t){if(!isInTable(e))return!1;if(t){let S=selectedRect(e);t(addColumn(e.tr,S,S.right))}return!0}function removeColumn(e,{map:t,table:S,tableStart:w},E){let D=e.mapping.maps.length;for(let O=0;O<t.height;){let k=O*t.width+E,j=t.map[k],F=S.nodeAt(j),L=F.attrs;if(E>0&&t.map[k-1]==j||E<t.width-1&&t.map[k+1]==j)e.setNodeMarkup(e.mapping.slice(D).map(w+j),null,removeColSpan(L,E-t.colCount(j)));else{let t=e.mapping.slice(D).map(w+j);e.delete(t,t+F.nodeSize)}O+=L.rowspan}}function deleteColumn(e,t){if(!isInTable(e))return!1;if(t){let S=selectedRect(e),w=e.tr;if(S.left==0&&S.right==S.map.width)return!1;for(let e=S.right-1;removeColumn(w,S,e),e!=S.left;e--){let e=S.tableStart?w.doc.nodeAt(S.tableStart-1):w.doc;if(!e)throw RangeError(`No table found`);S.table=e,S.map=TableMap.get(e)}t(w)}return!0}function rowIsHeader(e,t,S){var w;let E=tableNodeTypes(t.type.schema).header_cell;for(let w=0;w<e.width;w++)if(t.nodeAt(e.map[w+S*e.width])?.type!=E)return!1;return!0}function addRow(e,{map:t,tableStart:S,table:w},E){let D=S;for(let e=0;e<E;e++)D+=w.child(e).nodeSize;let O=[],k=E>0?-1:0;rowIsHeader(t,w,E+k)&&(k=E==0||E==t.height?null:0);for(let D=0,F=t.width*E;D<t.width;D++,F++)if(E>0&&E<t.height&&t.map[F]==t.map[F-t.width]){let E=t.map[F],O=w.nodeAt(E).attrs;e.setNodeMarkup(S+E,null,{...O,rowspan:O.rowspan+1}),D+=O.colspan-1}else{var j;let e=(k==null?tableNodeTypes(w.type.schema).cell:w.nodeAt(t.map[F+k*t.width])?.type)?.createAndFill();e&&O.push(e)}return e.insert(D,tableNodeTypes(w.type.schema).row.create(null,O)),e}function addRowBefore(e,t){if(!isInTable(e))return!1;if(t){let S=selectedRect(e);t(addRow(e.tr,S,S.top))}return!0}function addRowAfter(e,t){if(!isInTable(e))return!1;if(t){let S=selectedRect(e);t(addRow(e.tr,S,S.bottom))}return!0}function removeRow(e,{map:t,table:S,tableStart:w},E){let D=0;for(let e=0;e<E;e++)D+=S.child(e).nodeSize;let O=D+S.child(E).nodeSize,k=e.mapping.maps.length;e.delete(D+w,O+w);let j=new Set;for(let D=0,O=E*t.width;D<t.width;D++,O++){let F=t.map[O];if(!j.has(F)){if(j.add(F),E>0&&F==t.map[O-t.width]){let t=S.nodeAt(F).attrs;e.setNodeMarkup(e.mapping.slice(k).map(F+w),null,{...t,rowspan:t.rowspan-1}),D+=t.colspan-1}else if(E<t.height&&F==t.map[O+t.width]){let O=S.nodeAt(F),j=O.attrs,L=O.type.create({...j,rowspan:O.attrs.rowspan-1},O.content),B=t.positionAt(E+1,D,S);e.insert(e.mapping.slice(k).map(w+B),L),D+=j.colspan-1}}}}function deleteRow(e,t){if(!isInTable(e))return!1;if(t){let S=selectedRect(e),w=e.tr;if(S.top==0&&S.bottom==S.map.height)return!1;for(let e=S.bottom-1;removeRow(w,S,e),e!=S.top;e--){let e=S.tableStart?w.doc.nodeAt(S.tableStart-1):w.doc;if(!e)throw RangeError(`No table found`);S.table=e,S.map=TableMap.get(S.table)}t(w)}return!0}function isEmpty$3(e){let t=e.content;return t.childCount==1&&t.child(0).isTextblock&&t.child(0).childCount==0}function cellsOverlapRectangle({width:e,height:t,map:S},w){let E=w.top*e+w.left,D=E,O=(w.bottom-1)*e+w.left,k=E+(w.right-w.left-1);for(let t=w.top;t<w.bottom;t++){if(w.left>0&&S[D]==S[D-1]||w.right<e&&S[k]==S[k+1])return!0;D+=e,k+=e}for(let D=w.left;D<w.right;D++){if(w.top>0&&S[E]==S[E-e]||w.bottom<t&&S[O]==S[O+e])return!0;E++,O++}return!1}function mergeCells(e,t){let S=e.selection;if(!(S instanceof CellSelection)||S.$anchorCell.pos==S.$headCell.pos)return!1;let w=selectedRect(e),{map:E}=w;if(cellsOverlapRectangle(E,w))return!1;if(t){let S=e.tr,D={},O=Fragment.empty,k,j;for(let e=w.top;e<w.bottom;e++)for(let t=w.left;t<w.right;t++){let F=E.map[e*E.width+t],L=w.table.nodeAt(F);if(!(D[F]||!L))if(D[F]=!0,k==null)k=F,j=L;else{isEmpty$3(L)||(O=O.append(L.content));let e=S.mapping.map(F+w.tableStart);S.delete(e,e+L.nodeSize)}}if(k==null||j==null)return!0;if(S.setNodeMarkup(k+w.tableStart,null,{...addColSpan(j.attrs,j.attrs.colspan,w.right-w.left-j.attrs.colspan),rowspan:w.bottom-w.top}),O.size>0){let e=k+1+j.content.size,t=isEmpty$3(j)?k+1:e;S.replaceWith(t+w.tableStart,e+w.tableStart,O)}S.setSelection(new CellSelection(S.doc.resolve(k+w.tableStart))),t(S)}return!0}function splitCell(e,t){let S=tableNodeTypes(e.schema);return splitCellWithType(({node:e})=>S[e.type.spec.tableRole])(e,t)}function splitCellWithType(e){return(t,S)=>{let w=t.selection,E,D;if(w instanceof CellSelection){if(w.$anchorCell.pos!=w.$headCell.pos)return!1;E=w.$anchorCell.nodeAfter,D=w.$anchorCell.pos}else{var O;if(E=cellWrapping(w.$from),!E)return!1;D=cellAround(w.$from)?.pos}if(E==null||D==null||E.attrs.colspan==1&&E.attrs.rowspan==1)return!1;if(S){let O=E.attrs,k=[],j=O.colwidth;O.rowspan>1&&(O={...O,rowspan:1}),O.colspan>1&&(O={...O,colspan:1});let F=selectedRect(t),L=t.tr;for(let e=0;e<F.right-F.left;e++)k.push(j?{...O,colwidth:j&&j[e]?[j[e]]:null}:O);let B;for(let t=F.top;t<F.bottom;t++){let S=F.map.positionAt(t,F.left,F.table);t==F.top&&(S+=E.nodeSize);for(let w=F.left,D=0;w<F.right;w++,D++)w==F.left&&t==F.top||L.insert(B=L.mapping.map(S+F.tableStart,1),e({node:E,row:t,col:w}).createAndFill(k[D]))}L.setNodeMarkup(D,e({node:E,row:F.top,col:F.left}),k[0]),w instanceof CellSelection&&L.setSelection(new CellSelection(L.doc.resolve(w.$anchorCell.pos),B?L.doc.resolve(B):void 0)),S(L)}return!0}}function setCellAttr(e,t){return function(S,w){if(!isInTable(S))return!1;let E=selectionCell(S);if(E.nodeAfter.attrs[e]===t)return!1;if(w){let D=S.tr;S.selection instanceof CellSelection?S.selection.forEachCell((S,w)=>{S.attrs[e]!==t&&D.setNodeMarkup(w,null,{...S.attrs,[e]:t})}):D.setNodeMarkup(E.pos,null,{...E.nodeAfter.attrs,[e]:t}),w(D)}return!0}}function deprecated_toggleHeader(e){return function(t,S){if(!isInTable(t))return!1;if(S){let w=tableNodeTypes(t.schema),E=selectedRect(t),D=t.tr,O=E.map.cellsInRect(e==`column`?{left:E.left,top:0,right:E.right,bottom:E.map.height}:e==`row`?{left:0,top:E.top,right:E.map.width,bottom:E.bottom}:E),k=O.map(e=>E.table.nodeAt(e));for(let e=0;e<O.length;e++)k[e].type==w.header_cell&&D.setNodeMarkup(E.tableStart+O[e],w.cell,k[e].attrs);if(D.steps.length===0)for(let e=0;e<O.length;e++)D.setNodeMarkup(E.tableStart+O[e],w.header_cell,k[e].attrs);S(D)}return!0}}function isHeaderEnabledByType(e,t,S){let w=t.map.cellsInRect({left:0,top:0,right:e==`row`?t.map.width:1,bottom:e==`column`?t.map.height:1});for(let e=0;e<w.length;e++){let E=t.table.nodeAt(w[e]);if(E&&E.type!==S.header_cell)return!1}return!0}function toggleHeader(e,t){return t||={useDeprecatedLogic:!1},t.useDeprecatedLogic?deprecated_toggleHeader(e):function(t,S){if(!isInTable(t))return!1;if(S){let w=tableNodeTypes(t.schema),E=selectedRect(t),D=t.tr,O=isHeaderEnabledByType(`row`,E,w),k=isHeaderEnabledByType(`column`,E,w),j=(e===`column`?O:e===`row`&&k)?1:0,F=e==`column`?{left:0,top:j,right:1,bottom:E.map.height}:e==`row`?{left:j,top:0,right:E.map.width,bottom:1}:E,L=e==`column`?k?w.cell:w.header_cell:e==`row`?O?w.cell:w.header_cell:w.cell;E.map.cellsInRect(F).forEach(e=>{let t=e+E.tableStart,S=D.doc.nodeAt(t);S&&D.setNodeMarkup(t,L,S.attrs)}),S(D)}return!0}}const toggleHeaderRow=toggleHeader(`row`,{useDeprecatedLogic:!0}),toggleHeaderColumn=toggleHeader(`column`,{useDeprecatedLogic:!0}),toggleHeaderCell=toggleHeader(`cell`,{useDeprecatedLogic:!0});function findNextCell(e,t){if(t<0){let t=e.nodeBefore;if(t)return e.pos-t.nodeSize;for(let t=e.index(-1)-1,S=e.before();t>=0;t--){let w=e.node(-1).child(t),E=w.lastChild;if(E)return S-1-E.nodeSize;S-=w.nodeSize}}else{if(e.index()<e.parent.childCount-1)return e.pos+e.nodeAfter.nodeSize;let t=e.node(-1);for(let S=e.indexAfter(-1),w=e.after();S<t.childCount;S++){let e=t.child(S);if(e.childCount)return w+1;w+=e.nodeSize}}return null}function goToNextCell(e){return function(t,S){if(!isInTable(t))return!1;let w=findNextCell(selectionCell(t),e);if(w==null)return!1;if(S){let e=t.doc.resolve(w);S(t.tr.setSelection(TextSelection.between(e,moveCellForward(e))).scrollIntoView())}return!0}}function deleteTable(e,t){let S=e.selection.$anchor;for(let w=S.depth;w>0;w--)if(S.node(w).type.spec.tableRole==`table`)return t&&t(e.tr.delete(S.before(w),S.after(w)).scrollIntoView()),!0;return!1}function deleteCellSelection(e,t){let S=e.selection;if(!(S instanceof CellSelection))return!1;if(t){let w=e.tr,E=tableNodeTypes(e.schema).cell.createAndFill().content;S.forEachCell((e,t)=>{e.content.eq(E)||w.replace(w.mapping.map(t+1),w.mapping.map(t+e.nodeSize-1),new Slice(E,0,0))}),w.docChanged&&t(w)}return!0}function pastedCells(e){if(e.size===0)return null;let{content:t,openStart:S,openEnd:w}=e;for(;t.childCount==1&&(S>0&&w>0||t.child(0).type.spec.tableRole==`table`);)S--,w--,t=t.child(0).content;let E=t.child(0),D=E.type.spec.tableRole,O=E.type.schema,k=[];if(D==`row`)for(let e=0;e<t.childCount;e++){let E=t.child(e).content,D=e?0:Math.max(0,S-1),j=e<t.childCount-1?0:Math.max(0,w-1);(D||j)&&(E=fitSlice(tableNodeTypes(O).row,new Slice(E,D,j)).content),k.push(E)}else if(D==`cell`||D==`header_cell`)k.push(S||w?fitSlice(tableNodeTypes(O).row,new Slice(t,S,w)).content:t);else return null;return ensureRectangular(O,k)}function ensureRectangular(e,t){let S=[];for(let e=0;e<t.length;e++){let w=t[e];for(let t=w.childCount-1;t>=0;t--){let{rowspan:E,colspan:D}=w.child(t).attrs;for(let t=e;t<e+E;t++)S[t]=(S[t]||0)+D}}let w=0;for(let e=0;e<S.length;e++)w=Math.max(w,S[e]);for(let E=0;E<S.length;E++)if(E>=t.length&&t.push(Fragment.empty),S[E]<w){let D=tableNodeTypes(e).cell.createAndFill(),O=[];for(let e=S[E];e<w;e++)O.push(D);t[E]=t[E].append(Fragment.from(O))}return{height:t.length,width:w,rows:t}}function fitSlice(e,t){let S=e.createAndFill();return new Transform$4(S).replace(0,S.content.size,t).doc}function clipCells({width:e,height:t,rows:S},w,E){if(e!=w){let t=[],E=[];for(let e=0;e<S.length;e++){let D=S[e],O=[];for(let S=t[e]||0,E=0;S<w;E++){let k=D.child(E%D.childCount);S+k.attrs.colspan>w&&(k=k.type.createChecked(removeColSpan(k.attrs,k.attrs.colspan,S+k.attrs.colspan-w),k.content)),O.push(k),S+=k.attrs.colspan;for(let S=1;S<k.attrs.rowspan;S++)t[e+S]=(t[e+S]||0)+k.attrs.colspan}E.push(Fragment.from(O))}S=E,e=w}if(t!=E){let e=[];for(let w=0,D=0;w<E;w++,D++){let O=[],k=S[D%t];for(let e=0;e<k.childCount;e++){let t=k.child(e);w+t.attrs.rowspan>E&&(t=t.type.create({...t.attrs,rowspan:Math.max(1,E-t.attrs.rowspan)},t.content)),O.push(t)}e.push(Fragment.from(O))}S=e,t=E}return{width:e,height:t,rows:S}}function growTable(e,t,S,w,E,D,O){let k=e.doc.type.schema,j=tableNodeTypes(k),F,L;if(E>t.width)for(let D=0,k=0;D<t.height;D++){let B=S.child(D);k+=B.nodeSize;let H=[],q;q=B.lastChild==null||B.lastChild.type==j.cell?F||=j.cell.createAndFill():L||=j.header_cell.createAndFill();for(let e=t.width;e<E;e++)H.push(q);e.insert(e.mapping.slice(O).map(k-1+w),H)}if(D>t.height){let k=[];for(let e=0,w=(t.height-1)*t.width;e<Math.max(t.width,E);e++){let E=e>=t.width?!1:S.nodeAt(t.map[w+e]).type==j.header_cell;k.push(E?L||=j.header_cell.createAndFill():F||=j.cell.createAndFill())}let B=j.row.create(null,Fragment.from(k)),H=[];for(let e=t.height;e<D;e++)H.push(B);e.insert(e.mapping.slice(O).map(w+S.nodeSize-2),H)}return!!(F||L)}function isolateHorizontal(e,t,S,w,E,D,O,k){if(O==0||O==t.height)return!1;let j=!1;for(let F=E;F<D;F++){let E=O*t.width+F,D=t.map[E];if(t.map[E-t.width]==D){j=!0;let E=S.nodeAt(D),{top:L,left:B}=t.findCell(D);e.setNodeMarkup(e.mapping.slice(k).map(D+w),null,{...E.attrs,rowspan:O-L}),e.insert(e.mapping.slice(k).map(t.positionAt(O,B,S)),E.type.createAndFill({...E.attrs,rowspan:L+E.attrs.rowspan-O})),F+=E.attrs.colspan-1}}return j}function isolateVertical(e,t,S,w,E,D,O,k){if(O==0||O==t.width)return!1;let j=!1;for(let F=E;F<D;F++){let E=F*t.width+O,D=t.map[E];if(t.map[E-1]==D){j=!0;let E=S.nodeAt(D),L=t.colCount(D),B=e.mapping.slice(k).map(D+w);e.setNodeMarkup(B,null,removeColSpan(E.attrs,O-L,E.attrs.colspan-(O-L))),e.insert(B+E.nodeSize,E.type.createAndFill(removeColSpan(E.attrs,0,O-L))),F+=E.attrs.rowspan-1}}return j}function insertCells(e,t,S,w,E){let D=S?e.doc.nodeAt(S-1):e.doc;if(!D)throw Error(`No table found`);let O=TableMap.get(D),{top:k,left:j}=w,F=j+E.width,L=k+E.height,B=e.tr,H=0;function q(){if(D=S?B.doc.nodeAt(S-1):B.doc,!D)throw Error(`No table found`);O=TableMap.get(D),H=B.mapping.maps.length}growTable(B,O,D,S,F,L,H)&&q(),isolateHorizontal(B,O,D,S,j,F,k,H)&&q(),isolateHorizontal(B,O,D,S,j,F,L,H)&&q(),isolateVertical(B,O,D,S,k,L,j,H)&&q(),isolateVertical(B,O,D,S,k,L,F,H)&&q();for(let e=k;e<L;e++){let t=O.positionAt(e,j,D),w=O.positionAt(e,F,D);B.replace(B.mapping.slice(H).map(t+S),B.mapping.slice(H).map(w+S),new Slice(E.rows[e-k],0,0))}q(),B.setSelection(new CellSelection(B.doc.resolve(S+O.positionAt(k,j,D)),B.doc.resolve(S+O.positionAt(L-1,F-1,D)))),t(B)}const handleKeyDown$1=keydownHandler({ArrowLeft:arrow$1(`horiz`,-1),ArrowRight:arrow$1(`horiz`,1),ArrowUp:arrow$1(`vert`,-1),ArrowDown:arrow$1(`vert`,1),"Shift-ArrowLeft":shiftArrow(`horiz`,-1),"Shift-ArrowRight":shiftArrow(`horiz`,1),"Shift-ArrowUp":shiftArrow(`vert`,-1),"Shift-ArrowDown":shiftArrow(`vert`,1),Backspace:deleteCellSelection,"Mod-Backspace":deleteCellSelection,Delete:deleteCellSelection,"Mod-Delete":deleteCellSelection});function maybeSetSelection(e,t,S){return S.eq(e.selection)?!1:(t&&t(e.tr.setSelection(S).scrollIntoView()),!0)}function arrow$1(e,t){return(S,w,E)=>{if(!E)return!1;let D=S.selection;if(D instanceof CellSelection)return maybeSetSelection(S,w,Selection$1.near(D.$headCell,t));if(e!=`horiz`&&!D.empty)return!1;let O=atEndOfCell(E,e,t);if(O==null)return!1;if(e==`horiz`)return maybeSetSelection(S,w,Selection$1.near(S.doc.resolve(D.head+t),t));{let E=S.doc.resolve(O),D=nextCell(E,e,t),k;return k=D?Selection$1.near(D,1):t<0?Selection$1.near(S.doc.resolve(E.before(-1)),-1):Selection$1.near(S.doc.resolve(E.after(-1)),1),maybeSetSelection(S,w,k)}}}function shiftArrow(e,t){return(S,w,E)=>{if(!E)return!1;let D=S.selection,O;if(D instanceof CellSelection)O=D;else{let w=atEndOfCell(E,e,t);if(w==null)return!1;O=new CellSelection(S.doc.resolve(w))}let k=nextCell(O.$headCell,e,t);return k?maybeSetSelection(S,w,new CellSelection(O.$anchorCell,k)):!1}}function handleTripleClick(e,t){let S=e.state.doc,w=cellAround(S.resolve(t));return w?(e.dispatch(e.state.tr.setSelection(new CellSelection(w))),!0):!1}function handlePaste(e,t,S){if(!isInTable(e.state))return!1;let w=pastedCells(S),E=e.state.selection;if(E instanceof CellSelection){w||={width:1,height:1,rows:[Fragment.from(fitSlice(tableNodeTypes(e.state.schema).cell,S))]};let t=E.$anchorCell.node(-1),D=E.$anchorCell.start(-1),O=TableMap.get(t).rectBetween(E.$anchorCell.pos-D,E.$headCell.pos-D);return w=clipCells(w,O.right-O.left,O.bottom-O.top),insertCells(e.state,e.dispatch,D,O,w),!0}else if(w){let t=selectionCell(e.state),S=t.start(-1);return insertCells(e.state,e.dispatch,S,TableMap.get(t.node(-1)).findCell(t.pos-S),w),!0}else return!1}function handleMouseDown$1(e,t){var S;if(t.button!=0||t.ctrlKey||t.metaKey)return;let w=domInCell(e,t.target),E;if(t.shiftKey&&e.state.selection instanceof CellSelection)D(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&w&&(E=cellAround(e.state.selection.$anchor))!=null&&cellUnderMouse(e,t)?.pos!=E.pos)D(E,t),t.preventDefault();else if(!w)return;function D(t,S){let w=cellUnderMouse(e,S),E=tableEditingKey.getState(e.state)==null;if(!w||!inSameTable(t,w))if(E)w=t;else return;let D=new CellSelection(t,w);if(E||!e.state.selection.eq(D)){let S=e.state.tr.setSelection(D);E&&S.setMeta(tableEditingKey,t.pos),e.dispatch(S)}}function O(){e.root.removeEventListener(`mouseup`,O),e.root.removeEventListener(`dragstart`,O),e.root.removeEventListener(`mousemove`,k),tableEditingKey.getState(e.state)!=null&&e.dispatch(e.state.tr.setMeta(tableEditingKey,-1))}function k(S){let E=S,k=tableEditingKey.getState(e.state),j;if(k!=null)j=e.state.doc.resolve(k);else if(domInCell(e,E.target)!=w&&(j=cellUnderMouse(e,t),!j))return O();j&&D(j,E)}e.root.addEventListener(`mouseup`,O),e.root.addEventListener(`dragstart`,O),e.root.addEventListener(`mousemove`,k)}function atEndOfCell(e,t,S){if(!(e.state.selection instanceof TextSelection))return null;let{$head:w}=e.state.selection;for(let E=w.depth-1;E>=0;E--){let D=w.node(E);if((S<0?w.index(E):w.indexAfter(E))!=(S<0?0:D.childCount))return null;if(D.type.spec.tableRole==`cell`||D.type.spec.tableRole==`header_cell`){let D=w.before(E),O=t==`vert`?S>0?`down`:`up`:S>0?`right`:`left`;return e.endOfTextblock(O)?D:null}}return null}function domInCell(e,t){for(;t&&t!=e.dom;t=t.parentNode)if(t.nodeName==`TD`||t.nodeName==`TH`)return t;return null}function cellUnderMouse(e,t){let S=e.posAtCoords({left:t.clientX,top:t.clientY});if(!S)return null;let{inside:w,pos:E}=S;return w>=0&&cellAround(e.state.doc.resolve(w))||cellAround(e.state.doc.resolve(E))}var TableView$1=class{constructor(e,t){this.node=e,this.defaultCellMinWidth=t,this.dom=document.createElement(`div`),this.dom.className=`tableWrapper`,this.table=this.dom.appendChild(document.createElement(`table`)),this.table.style.setProperty(`--default-cell-min-width`,`${t}px`),this.colgroup=this.table.appendChild(document.createElement(`colgroup`)),updateColumnsOnResize(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement(`tbody`))}update(e){return e.type==this.node.type?(this.node=e,updateColumnsOnResize(e,this.colgroup,this.table,this.defaultCellMinWidth),!0):!1}ignoreMutation(e){return e.type==`attributes`&&(e.target==this.table||this.colgroup.contains(e.target))}};function updateColumnsOnResize(e,t,S,w,E,D){let O=0,k=!0,j=t.firstChild,F=e.firstChild;if(F){for(let e=0,S=0;e<F.childCount;e++){let{colspan:L,colwidth:B}=F.child(e).attrs;for(let e=0;e<L;e++,S++){let F=E==S?D:B&&B[e],L=F?F+`px`:``;if(O+=F||w,F||(k=!1),j)j.style.width!=L&&(j.style.width=L),j=j.nextSibling;else{let e=document.createElement(`col`);e.style.width=L,t.appendChild(e)}}}for(;j;){var L;let e=j.nextSibling;(L=j.parentNode)==null||L.removeChild(j),j=e}k?(S.style.width=O+`px`,S.style.minWidth=``):(S.style.width=``,S.style.minWidth=O+`px`)}}const columnResizingPluginKey=new PluginKey(`tableColumnResizing`);function columnResizing({handleWidth:e=5,cellMinWidth:t=25,defaultCellMinWidth:S=100,View:w=TableView$1,lastColumnResizable:E=!0}={}){let D=new Plugin({key:columnResizingPluginKey,state:{init(e,t){var E;let O=(E=D.spec)==null||(E=E.props)==null?void 0:E.nodeViews,k=tableNodeTypes(t.schema).table.name;return w&&O&&(O[k]=(e,t)=>new w(e,S,t)),new ResizeState(-1,!1)},apply(e,t){return t.apply(e)}},props:{attributes:e=>{let t=columnResizingPluginKey.getState(e);return t&&t.activeHandle>-1?{class:`resize-cursor`}:{}},handleDOMEvents:{mousemove:(t,S)=>{handleMouseMove(t,S,e,E)},mouseleave:e=>{handleMouseLeave(e)},mousedown:(e,w)=>{handleMouseDown(e,w,t,S)}},decorations:e=>{let t=columnResizingPluginKey.getState(e);if(t&&t.activeHandle>-1)return handleDecorations(e,t.activeHandle)},nodeViews:{}}});return D}var ResizeState=class e{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(t){let S=this,w=t.getMeta(columnResizingPluginKey);if(w&&w.setHandle!=null)return new e(w.setHandle,!1);if(w&&w.setDragging!==void 0)return new e(S.activeHandle,w.setDragging);if(S.activeHandle>-1&&t.docChanged){let w=t.mapping.map(S.activeHandle,-1);return pointsAtCell(t.doc.resolve(w))||(w=-1),new e(w,S.dragging)}return S}};function handleMouseMove(e,t,S,w){if(!e.editable)return;let E=columnResizingPluginKey.getState(e.state);if(E&&!E.dragging){let D=domCellAround(t.target),O=-1;if(D){let{left:w,right:E}=D.getBoundingClientRect();t.clientX-w<=S?O=edgeCell(e,t,`left`,S):E-t.clientX<=S&&(O=edgeCell(e,t,`right`,S))}if(O!=E.activeHandle){if(!w&&O!==-1){let t=e.state.doc.resolve(O),S=t.node(-1),w=TableMap.get(S),E=t.start(-1);if(w.colCount(t.pos-E)+t.nodeAfter.attrs.colspan-1==w.width-1)return}updateHandle(e,O)}}}function handleMouseLeave(e){if(!e.editable)return;let t=columnResizingPluginKey.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&updateHandle(e,-1)}function handleMouseDown(e,t,S,w){var E;if(!e.editable)return!1;let D=e.dom.ownerDocument.defaultView??window,O=columnResizingPluginKey.getState(e.state);if(!O||O.activeHandle==-1||O.dragging)return!1;let k=e.state.doc.nodeAt(O.activeHandle),j=currentColWidth(e,O.activeHandle,k.attrs);e.dispatch(e.state.tr.setMeta(columnResizingPluginKey,{setDragging:{startX:t.clientX,startWidth:j}}));function F(t){D.removeEventListener(`mouseup`,F),D.removeEventListener(`mousemove`,L);let w=columnResizingPluginKey.getState(e.state);w?.dragging&&(updateColumnWidth(e,w.activeHandle,draggedWidth(w.dragging,t,S)),e.dispatch(e.state.tr.setMeta(columnResizingPluginKey,{setDragging:null})))}function L(t){if(!t.which)return F(t);let E=columnResizingPluginKey.getState(e.state);if(E&&E.dragging){let D=draggedWidth(E.dragging,t,S);displayColumnWidth(e,E.activeHandle,D,w)}}return displayColumnWidth(e,O.activeHandle,j,w),D.addEventListener(`mouseup`,F),D.addEventListener(`mousemove`,L),t.preventDefault(),!0}function currentColWidth(e,t,{colspan:S,colwidth:w}){let E=w&&w[w.length-1];if(E)return E;let D=e.domAtPos(t),O=D.node.childNodes[D.offset].offsetWidth,k=S;if(w)for(let e=0;e<S;e++)w[e]&&(O-=w[e],k--);return O/k}function domCellAround(e){for(;e&&e.nodeName!=`TD`&&e.nodeName!=`TH`;)e=e.classList&&e.classList.contains(`ProseMirror`)?null:e.parentNode;return e}function edgeCell(e,t,S,w){let E=S==`right`?-w:w,D=e.posAtCoords({left:t.clientX+E,top:t.clientY});if(!D)return-1;let{pos:O}=D,k=cellAround(e.state.doc.resolve(O));if(!k)return-1;if(S==`right`)return k.pos;let j=TableMap.get(k.node(-1)),F=k.start(-1),L=j.map.indexOf(k.pos-F);return L%j.width==0?-1:F+j.map[L-1]}function draggedWidth(e,t,S){let w=t.clientX-e.startX;return Math.max(S,e.startWidth+w)}function updateHandle(e,t){e.dispatch(e.state.tr.setMeta(columnResizingPluginKey,{setHandle:t}))}function updateColumnWidth(e,t,S){let w=e.state.doc.resolve(t),E=w.node(-1),D=TableMap.get(E),O=w.start(-1),k=D.colCount(w.pos-O)+w.nodeAfter.attrs.colspan-1,j=e.state.tr;for(let e=0;e<D.height;e++){let t=e*D.width+k;if(e&&D.map[t]==D.map[t-D.width])continue;let w=D.map[t],F=E.nodeAt(w).attrs,L=F.colspan==1?0:k-D.colCount(w);if(F.colwidth&&F.colwidth[L]==S)continue;let B=F.colwidth?F.colwidth.slice():zeroes(F.colspan);B[L]=S,j.setNodeMarkup(O+w,null,{...F,colwidth:B})}j.docChanged&&e.dispatch(j)}function displayColumnWidth(e,t,S,w){let E=e.state.doc.resolve(t),D=E.node(-1),O=E.start(-1),k=TableMap.get(D).colCount(E.pos-O)+E.nodeAfter.attrs.colspan-1,j=e.domAtPos(E.start(-1)).node;for(;j&&j.nodeName!=`TABLE`;)j=j.parentNode;j&&updateColumnsOnResize(D,j.firstChild,j,w,k,S)}function zeroes(e){return Array(e).fill(0)}function handleDecorations(e,t){let S=[],w=e.doc.resolve(t),E=w.node(-1);if(!E)return DecorationSet.empty;let D=TableMap.get(E),O=w.start(-1),k=D.colCount(w.pos-O)+w.nodeAfter.attrs.colspan-1;for(let t=0;t<D.height;t++){let w=k+t*D.width;if((k==D.width-1||D.map[w]!=D.map[w+1])&&(t==0||D.map[w]!=D.map[w-D.width])){var j;let t=D.map[w],k=O+t+E.nodeAt(t).nodeSize-1,F=document.createElement(`div`);F.className=`column-resize-handle`,columnResizingPluginKey.getState(e)?.dragging&&S.push(Decoration.node(O+t,O+t+E.nodeAt(t).nodeSize,{class:`column-resize-dragging`})),S.push(Decoration.widget(k,F))}}return DecorationSet.create(e.doc,S)}function tableEditing({allowTableNodeSelection:e=!1}={}){return new Plugin({key:tableEditingKey,state:{init(){return null},apply(e,t){let S=e.getMeta(tableEditingKey);if(S!=null)return S==-1?null:S;if(t==null||!e.docChanged)return t;let{deleted:w,pos:E}=e.mapping.mapResult(t);return w?null:E}},props:{decorations:drawCellSelection,handleDOMEvents:{mousedown:handleMouseDown$1},createSelectionBetween(e){return tableEditingKey.getState(e.state)==null?null:e.state.selection},handleTripleClick,handleKeyDown:handleKeyDown$1,handlePaste},appendTransaction(t,S,w){return normalizeSelection(w,fixTables(w,S),e)}})}function normalizeTableCellAlign(e){return e===`left`||e===`right`||e===`center`?e:null}function parseAlign(e){let t=(e.style.textAlign||``).trim().toLowerCase(),S=(e.getAttribute(`align`)||``).trim().toLowerCase();return normalizeTableCellAlign(t||S)}function normalizeTableCellAlignFromAttributes(e){return normalizeTableCellAlign(e?.align)}function createAlignAttribute(){return{default:null,parseHTML:e=>parseAlign(e),renderHTML:e=>e.align?{style:`text-align: ${e.align}`}:{}}}var TableCell=Node3.create({name:`tableCell`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:e=>{var t,S;let w=e.getAttribute(`colwidth`),E=w?w.split(`,`).map(e=>parseInt(e,10)):null;if(!E){let t=e.closest(`table`)?.querySelectorAll(`colgroup > col`),S=Array.from(e.parentElement?.children||[]).indexOf(e);if(S&&S>-1&&t&&t[S]){let e=t[S].getAttribute(`width`);return e?[parseInt(e,10)]:null}}return E}},align:createAlignAttribute()}},tableRole:`cell`,isolating:!0,parseHTML(){return[{tag:`td`}]},renderHTML({HTMLAttributes:e}){return[`td`,mergeAttributes(this.options.HTMLAttributes,e),0]}}),TableHeader=Node3.create({name:`tableHeader`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:e=>{let t=e.getAttribute(`colwidth`);return t?t.split(`,`).map(e=>parseInt(e,10)):null}},align:createAlignAttribute()}},tableRole:`header_cell`,isolating:!0,parseHTML(){return[{tag:`th`}]},renderHTML({HTMLAttributes:e}){return[`th`,mergeAttributes(this.options.HTMLAttributes,e),0]}}),TableRow=Node3.create({name:`tableRow`,addOptions(){return{HTMLAttributes:{}}},content:`(tableCell | tableHeader)*`,tableRole:`row`,parseHTML(){return[{tag:`tr`}]},renderHTML({HTMLAttributes:e}){return[`tr`,mergeAttributes(this.options.HTMLAttributes,e),0]}});function getColStyleDeclaration(e,t){return t?[`width`,`${Math.max(t,e)}px`]:[`min-width`,`${e}px`]}function updateColumns(e,t,S,w,E,D){var O;let k=0,j=!0,F=t.firstChild,L=e.firstChild;if(L!==null)for(let e=0,S=0;e<L.childCount;e+=1){let{colspan:O,colwidth:B}=L.child(e).attrs;for(let e=0;e<O;e+=1,S+=1){let O=E===S?D:B&&B[e],L=O?`${O}px`:``;if(k+=O||w,O||(j=!1),F){if(F.style.width!==L){let[e,t]=getColStyleDeclaration(w,O);F.style.setProperty(e,t)}F=F.nextSibling}else{let e=document.createElement(`col`),[S,E]=getColStyleDeclaration(w,O);e.style.setProperty(S,E),t.appendChild(e)}}}for(;F;){let e=F.nextSibling;(O=F.parentNode)==null||O.removeChild(F),F=e}let B=e.attrs.style&&typeof e.attrs.style==`string`&&/\bwidth\s*:/i.test(e.attrs.style);j&&!B?(S.style.width=`${k}px`,S.style.minWidth=``):(S.style.width=``,S.style.minWidth=`${k}px`)}var TableView=class{constructor(e,t){this.node=e,this.cellMinWidth=t,this.dom=document.createElement(`div`),this.dom.className=`tableWrapper`,this.table=this.dom.appendChild(document.createElement(`table`)),e.attrs.style&&(this.table.style.cssText=e.attrs.style),this.colgroup=this.table.appendChild(document.createElement(`colgroup`)),updateColumns(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement(`tbody`))}update(e){return e.type===this.node.type?(this.node=e,updateColumns(e,this.colgroup,this.table,this.cellMinWidth),!0):!1}ignoreMutation(e){let t=e.target,S=this.dom.contains(t),w=this.contentDOM.contains(t);return!!(S&&!w&&(e.type===`attributes`||e.type===`childList`||e.type===`characterData`))}};function createColGroup(e,t,S,w){let E=0,D=!0,O=[],k=e.firstChild;if(!k)return{};for(let e=0,j=0;e<k.childCount;e+=1){let{colspan:F,colwidth:L}=k.child(e).attrs;for(let e=0;e<F;e+=1,j+=1){let k=S===j?w:L&&L[e];E+=k||t,k||(D=!1);let[F,B]=getColStyleDeclaration(t,k);O.push([`col`,{style:`${F}: ${B}`}])}}let j=D?`${E}px`:``,F=D?``:`${E}px`;return{colgroup:[`colgroup`,{},...O],tableWidth:j,tableMinWidth:F}}function createCell(e,t){return t?e.createChecked(null,t):e.createAndFill()}function getTableNodeTypes(e){if(e.cached.tableNodeTypes)return e.cached.tableNodeTypes;let t={};return Object.keys(e.nodes).forEach(S=>{let w=e.nodes[S];w.spec.tableRole&&(t[w.spec.tableRole]=w)}),e.cached.tableNodeTypes=t,t}function createTable(e,t,S,w,E){let D=getTableNodeTypes(e),O=[],k=[];for(let e=0;e<S;e+=1){let e=createCell(D.cell,E);if(e&&k.push(e),w){let e=createCell(D.header_cell,E);e&&O.push(e)}}let j=[];for(let e=0;e<t;e+=1)j.push(D.row.createChecked(null,w&&e===0?O:k));return D.table.createChecked(null,j)}function isCellSelection(e){return e instanceof CellSelection}var deleteTableWhenAllCellsSelected=({editor:e})=>{let{selection:t}=e.state;if(!isCellSelection(t))return!1;let S=0;return findParentNodeClosestToPos(t.ranges[0].$from,e=>e.type.name===`table`)?.node.descendants(e=>{if(e.type.name===`table`)return!1;[`tableCell`,`tableHeader`].includes(e.type.name)&&(S+=1)}),S===t.ranges.length?(e.commands.deleteTable(),!0):!1},DEFAULT_CELL_LINE_SEPARATOR=``;function collapseWhitespace(e){return(e||``).replace(/\s+/g,` `).trim()}function renderTableToMarkdown(e,t,S={}){var w;let E=S.cellLineSeparator??``;if(!e||!e.content||e.content.length===0)return``;let D=[];e.content.forEach(e=>{let S=[];e.content&&e.content.forEach(e=>{let w=``;w=e.content&&Array.isArray(e.content)&&e.content.length>1?e.content.map(e=>t.renderChildren(e)).join(E):e.content?t.renderChildren(e.content):``;let D=collapseWhitespace(w),O=e.type===`tableHeader`,k=normalizeTableCellAlignFromAttributes(e.attrs);S.push({text:D,isHeader:O,align:k})}),D.push(S)});let O=D.reduce((e,t)=>Math.max(e,t.length),0);if(O===0)return``;let k=Array(O).fill(0);D.forEach(e=>{var t;for(let t=0;t<O;t+=1){let S=(e[t]?.text||``).length;S>k[t]&&(k[t]=S),k[t]<3&&(k[t]=3)}});let j=(e,t)=>e+` `.repeat(Math.max(0,t-e.length)),F=D[0],L=F.some(e=>e.isHeader),B=Array(O).fill(null);D.forEach(e=>{var t;for(let t=0;t<O;t+=1)!B[t]&&e[t]?.align&&(B[t]=e[t].align)});let H=`
|
|
216
216
|
`,q=Array(O).fill(0).map((e,t)=>L&&F[t]&&F[t].text||``);return H+=`| ${q.map((e,t)=>j(e,k[t])).join(` | `)} |
|
|
217
217
|
`,H+=`| ${k.map((e,t)=>{let S=Math.max(3,e),w=B[t];return w===`left`?`:${`-`.repeat(S)}`:w===`right`?`${`-`.repeat(S)}:`:w===`center`?`:${`-`.repeat(S)}:`:`-`.repeat(S)}).join(` | `)} |
|
|
218
218
|
`,(L?D.slice(1):D).forEach(e=>{H+=`| ${Array(O).fill(0).map((t,S)=>j(e[S]&&e[S].text||``,k[S])).join(` | `)} |
|
|
219
|
-
`}),H}var markdown_default=renderTableToMarkdown,Table=Node3.create({name:`table`,addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:TableView,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:`tableRow+`,tableRole:`table`,isolating:!0,group:`block`,parseHTML(){return[{tag:`table`}]},renderHTML({node:e,HTMLAttributes:t}){let{colgroup:S,tableWidth:w,tableMinWidth:E}=createColGroup(e,this.options.cellMinWidth),D=t.style;function O(){return D||(w?`width: ${w}`:`min-width: ${E}`)}let k=[`table`,mergeAttributes(this.options.HTMLAttributes,t,{style:O()}),S,[`tbody`,0]];return this.options.renderWrapper?[`div`,{class:`tableWrapper`},k]:k},parseMarkdown:(e,t)=>{let S=[],w=Array.isArray(e.align)?e.align:[];if(e.header){let E=[];e.header.forEach((e,S)=>{var D;let O=normalizeTableCellAlign(w[S]??e.align),k=O?{align:O}:{};E.push(t.createNode(`tableHeader`,k,[{type:`paragraph`,content:t.parseInline(e.tokens)}]))}),S.push(t.createNode(`tableRow`,{},E))}return e.rows&&e.rows.forEach(e=>{let E=[];e.forEach((e,S)=>{var D;let O=normalizeTableCellAlign(w[S]??e.align),k=O?{align:O}:{};E.push(t.createNode(`tableCell`,k,[{type:`paragraph`,content:t.parseInline(e.tokens)}]))}),S.push(t.createNode(`tableRow`,{},E))}),t.createNode(`table`,void 0,S)},renderMarkdown:(e,t)=>markdown_default(e,t),addCommands(){return{insertTable:({rows:e=3,cols:t=3,withHeaderRow:S=!0}={})=>({tr:w,dispatch:E,editor:D})=>{let O=createTable(D.schema,e,t,S);if(E){let e=w.selection.from+1;w.replaceSelectionWith(O).scrollIntoView().setSelection(TextSelection.near(w.doc.resolve(e)))}return!0},addColumnBefore:()=>({state:e,dispatch:t})=>addColumnBefore(e,t),addColumnAfter:()=>({state:e,dispatch:t})=>addColumnAfter(e,t),deleteColumn:()=>({state:e,dispatch:t})=>deleteColumn(e,t),addRowBefore:()=>({state:e,dispatch:t})=>addRowBefore(e,t),addRowAfter:()=>({state:e,dispatch:t})=>addRowAfter(e,t),deleteRow:()=>({state:e,dispatch:t})=>deleteRow(e,t),deleteTable:()=>({state:e,dispatch:t})=>deleteTable(e,t),mergeCells:()=>({state:e,dispatch:t})=>mergeCells(e,t),splitCell:()=>({state:e,dispatch:t})=>splitCell(e,t),toggleHeaderColumn:()=>({state:e,dispatch:t})=>toggleHeader(`column`)(e,t),toggleHeaderRow:()=>({state:e,dispatch:t})=>toggleHeader(`row`)(e,t),toggleHeaderCell:()=>({state:e,dispatch:t})=>toggleHeaderCell(e,t),mergeOrSplit:()=>({state:e,dispatch:t})=>mergeCells(e,t)?!0:splitCell(e,t),setCellAttribute:(e,t)=>({state:S,dispatch:w})=>setCellAttr(e,t)(S,w),goToNextCell:()=>({state:e,dispatch:t})=>goToNextCell(1)(e,t),goToPreviousCell:()=>({state:e,dispatch:t})=>goToNextCell(-1)(e,t),fixTables:()=>({state:e,dispatch:t})=>(t&&fixTables(e),!0),setCellSelection:e=>({tr:t,dispatch:S})=>{if(S){let S=CellSelection.create(t.doc,e.anchorCell,e.headCell);t.setSelection(S)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:deleteTableWhenAllCellsSelected,"Mod-Backspace":deleteTableWhenAllCellsSelected,Delete:deleteTableWhenAllCellsSelected,"Mod-Delete":deleteTableWhenAllCellsSelected}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[columnResizing({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],tableEditing({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(e){return{tableRole:callOrReturn(getExtensionField(e,`tableRole`,{name:e.name,options:e.options,storage:e.storage}))}}}),TableKit=Extension.create({name:`tableKit`,addExtensions(){let e=[];return this.options.table!==!1&&e.push(Table.configure(this.options.table)),this.options.tableCell!==!1&&e.push(TableCell.configure(this.options.tableCell)),this.options.tableHeader!==!1&&e.push(TableHeader.configure(this.options.tableHeader)),this.options.tableRow!==!1&&e.push(TableRow.configure(this.options.tableRow)),e}}),inputRegex$
|
|
219
|
+
`}),H}var markdown_default=renderTableToMarkdown,Table=Node3.create({name:`table`,addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:TableView,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:`tableRow+`,tableRole:`table`,isolating:!0,group:`block`,parseHTML(){return[{tag:`table`}]},renderHTML({node:e,HTMLAttributes:t}){let{colgroup:S,tableWidth:w,tableMinWidth:E}=createColGroup(e,this.options.cellMinWidth),D=t.style;function O(){return D||(w?`width: ${w}`:`min-width: ${E}`)}let k=[`table`,mergeAttributes(this.options.HTMLAttributes,t,{style:O()}),S,[`tbody`,0]];return this.options.renderWrapper?[`div`,{class:`tableWrapper`},k]:k},parseMarkdown:(e,t)=>{let S=[],w=Array.isArray(e.align)?e.align:[];if(e.header){let E=[];e.header.forEach((e,S)=>{var D;let O=normalizeTableCellAlign(w[S]??e.align),k=O?{align:O}:{};E.push(t.createNode(`tableHeader`,k,[{type:`paragraph`,content:t.parseInline(e.tokens)}]))}),S.push(t.createNode(`tableRow`,{},E))}return e.rows&&e.rows.forEach(e=>{let E=[];e.forEach((e,S)=>{var D;let O=normalizeTableCellAlign(w[S]??e.align),k=O?{align:O}:{};E.push(t.createNode(`tableCell`,k,[{type:`paragraph`,content:t.parseInline(e.tokens)}]))}),S.push(t.createNode(`tableRow`,{},E))}),t.createNode(`table`,void 0,S)},renderMarkdown:(e,t)=>markdown_default(e,t),addCommands(){return{insertTable:({rows:e=3,cols:t=3,withHeaderRow:S=!0}={})=>({tr:w,dispatch:E,editor:D})=>{let O=createTable(D.schema,e,t,S);if(E){let e=w.selection.from+1;w.replaceSelectionWith(O).scrollIntoView().setSelection(TextSelection.near(w.doc.resolve(e)))}return!0},addColumnBefore:()=>({state:e,dispatch:t})=>addColumnBefore(e,t),addColumnAfter:()=>({state:e,dispatch:t})=>addColumnAfter(e,t),deleteColumn:()=>({state:e,dispatch:t})=>deleteColumn(e,t),addRowBefore:()=>({state:e,dispatch:t})=>addRowBefore(e,t),addRowAfter:()=>({state:e,dispatch:t})=>addRowAfter(e,t),deleteRow:()=>({state:e,dispatch:t})=>deleteRow(e,t),deleteTable:()=>({state:e,dispatch:t})=>deleteTable(e,t),mergeCells:()=>({state:e,dispatch:t})=>mergeCells(e,t),splitCell:()=>({state:e,dispatch:t})=>splitCell(e,t),toggleHeaderColumn:()=>({state:e,dispatch:t})=>toggleHeader(`column`)(e,t),toggleHeaderRow:()=>({state:e,dispatch:t})=>toggleHeader(`row`)(e,t),toggleHeaderCell:()=>({state:e,dispatch:t})=>toggleHeaderCell(e,t),mergeOrSplit:()=>({state:e,dispatch:t})=>mergeCells(e,t)?!0:splitCell(e,t),setCellAttribute:(e,t)=>({state:S,dispatch:w})=>setCellAttr(e,t)(S,w),goToNextCell:()=>({state:e,dispatch:t})=>goToNextCell(1)(e,t),goToPreviousCell:()=>({state:e,dispatch:t})=>goToNextCell(-1)(e,t),fixTables:()=>({state:e,dispatch:t})=>(t&&fixTables(e),!0),setCellSelection:e=>({tr:t,dispatch:S})=>{if(S){let S=CellSelection.create(t.doc,e.anchorCell,e.headCell);t.setSelection(S)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:deleteTableWhenAllCellsSelected,"Mod-Backspace":deleteTableWhenAllCellsSelected,Delete:deleteTableWhenAllCellsSelected,"Mod-Delete":deleteTableWhenAllCellsSelected}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[columnResizing({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],tableEditing({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(e){return{tableRole:callOrReturn(getExtensionField(e,`tableRole`,{name:e.name,options:e.options,storage:e.storage}))}}}),TableKit=Extension.create({name:`tableKit`,addExtensions(){let e=[];return this.options.table!==!1&&e.push(Table.configure(this.options.table)),this.options.tableCell!==!1&&e.push(TableCell.configure(this.options.tableCell)),this.options.tableHeader!==!1&&e.push(TableHeader.configure(this.options.tableHeader)),this.options.tableRow!==!1&&e.push(TableRow.configure(this.options.tableRow)),e}}),inputRegex$3=/^\s*>\s$/,Blockquote=Node3.create({name:`blockquote`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,group:`block`,defining:!0,parseHTML(){return[{tag:`blockquote`}]},renderHTML({HTMLAttributes:e}){return h$1(`blockquote`,{...mergeAttributes(this.options.HTMLAttributes,e),children:h$1(`slot`,{})})},parseMarkdown:(e,t)=>{var S;let w=t.parseBlockChildren??t.parseChildren;return t.createNode(`blockquote`,void 0,w(e.tokens||[]))},renderMarkdown:(e,t)=>{if(!e.content)return``;let S=`>`,w=[];return e.content.forEach((e,S)=>{var E,D;let O=(t.renderChild?.call(t,e,S)??t.renderChildren([e])).split(`
|
|
220
220
|
`).map(e=>e.trim()===``?`>`:`> ${e}`);w.push(O.join(`
|
|
221
221
|
`))}),w.join(`
|
|
222
222
|
>
|
|
223
|
-
`)},addCommands(){return{setBlockquote:()=>({commands:e})=>e.wrapIn(this.name),toggleBlockquote:()=>({commands:e})=>e.toggleWrap(this.name),unsetBlockquote:()=>({commands:e})=>e.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[wrappingInputRule({find:inputRegex$
|
|
223
|
+
`)},addCommands(){return{setBlockquote:()=>({commands:e})=>e.wrapIn(this.name),toggleBlockquote:()=>({commands:e})=>e.toggleWrap(this.name),unsetBlockquote:()=>({commands:e})=>e.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[wrappingInputRule({find:inputRegex$3,type:this.type})]}}),index_default$3=Blockquote,inputRegex$2=/(^|[^`])`([^`]+)`(?!`)$/,pasteRegex$1=/(^|[^`])`([^`]+)`(?!`)/g,Code=Mark.create({name:`code`,addOptions(){return{HTMLAttributes:{}}},excludes:`_`,code:!0,exitable:!0,parseHTML(){return[{tag:`code`}]},renderHTML({HTMLAttributes:e}){return[`code`,mergeAttributes(this.options.HTMLAttributes,e),0]},markdownTokenName:`codespan`,parseMarkdown:(e,t)=>t.applyMark(`code`,[{type:`text`,text:e.text||``}]),renderMarkdown:(e,t)=>e.content?`\`${t.renderChildren(e.content)}\``:``,addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[markInputRule({find:inputRegex$2,type:this.type})]},addPasteRules(){return[markPasteRule({find:pasteRegex$1,type:this.type})]}}),index_default$2=Code,Document$2=Node3.create({name:`doc`,topNode:!0,content:`block+`,renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
|
|
224
224
|
|
|
225
|
-
`):``}),HorizontalRule=Node3.create({name:`horizontalRule`,addOptions(){return{HTMLAttributes:{},nextNodeType:`paragraph`}},group:`block`,parseHTML(){return[{tag:`hr`}]},renderHTML({HTMLAttributes:e}){return[`hr`,mergeAttributes(this.options.HTMLAttributes,e)]},markdownTokenName:`hr`,parseMarkdown:(e,t)=>t.createNode(`horizontalRule`),renderMarkdown:()=>`---`,addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{if(!canInsertNode(t,t.schema.nodes[this.name]))return!1;let{selection:S}=t,{$to:w}=S,E=e();return isNodeSelection(S)?E.insertContentAt(w.pos,{type:this.name}):E.insertContent({type:this.name}),E.command(({state:e,tr:t,dispatch:S})=>{if(S){let{$to:S}=t.selection,w=S.end();if(S.nodeAfter)S.nodeAfter.isTextblock?t.setSelection(TextSelection.create(t.doc,S.pos+1)):S.nodeAfter.isBlock?t.setSelection(NodeSelection.create(t.doc,S.pos)):t.setSelection(TextSelection.create(t.doc,S.pos));else{let E=(e.schema.nodes[this.options.nextNodeType]||S.parent.type.contentMatch.defaultType)?.create();E&&(t.insert(w,E),t.setSelection(TextSelection.create(t.doc,w+1)))}t.scrollIntoView()}return!0}).run()}}},addInputRules(){return[nodeInputRule({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),index_default$
|
|
225
|
+
`):``}),HorizontalRule=Node3.create({name:`horizontalRule`,addOptions(){return{HTMLAttributes:{},nextNodeType:`paragraph`}},group:`block`,parseHTML(){return[{tag:`hr`}]},renderHTML({HTMLAttributes:e}){return[`hr`,mergeAttributes(this.options.HTMLAttributes,e)]},markdownTokenName:`hr`,parseMarkdown:(e,t)=>t.createNode(`horizontalRule`),renderMarkdown:()=>`---`,addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{if(!canInsertNode(t,t.schema.nodes[this.name]))return!1;let{selection:S}=t,{$to:w}=S,E=e();return isNodeSelection(S)?E.insertContentAt(w.pos,{type:this.name}):E.insertContent({type:this.name}),E.command(({state:e,tr:t,dispatch:S})=>{if(S){let{$to:S}=t.selection,w=S.end();if(S.nodeAfter)S.nodeAfter.isTextblock?t.setSelection(TextSelection.create(t.doc,S.pos+1)):S.nodeAfter.isBlock?t.setSelection(NodeSelection.create(t.doc,S.pos)):t.setSelection(TextSelection.create(t.doc,S.pos));else{let E=(e.schema.nodes[this.options.nextNodeType]||S.parent.type.contentMatch.defaultType)?.create();E&&(t.insert(w,E),t.setSelection(TextSelection.create(t.doc,w+1)))}t.scrollIntoView()}return!0}).run()}}},addInputRules(){return[nodeInputRule({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),index_default$1=HorizontalRule,__defProp$1=Object.defineProperty,__export=(e,t)=>{for(var S in t)__defProp$1(e,S,{get:t[S],enumerable:!0})},ListItemName=`listItem`,TextStyleName=`textStyle`,bulletListInputRegex=/^\s*([-+*])\s$/,BulletList=Node3.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:e}){return[`ul`,mergeAttributes(this.options.HTMLAttributes,e),0]},markdownTokenName:`list`,parseMarkdown:(e,t)=>e.type!==`list`||e.ordered?[]:{type:`bulletList`,content:e.items?t.parseChildren(e.items):[]},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
|
|
226
226
|
`):``,markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(ListItemName,this.editor.getAttributes(TextStyleName)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=wrappingInputRule({find:bulletListInputRegex,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=wrappingInputRule({find:bulletListInputRegex,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(TextStyleName),editor:this.editor})),[e]}}),ListItem$1=Node3.create({name:`listItem`,addOptions(){return{HTMLAttributes:{},bulletListTypeName:`bulletList`,orderedListTypeName:`orderedList`}},content:`paragraph block*`,defining:!0,parseHTML(){return[{tag:`li`}]},renderHTML({HTMLAttributes:e}){return[`li`,mergeAttributes(this.options.HTMLAttributes,e),0]},markdownTokenName:`list_item`,parseMarkdown:(e,t)=>{var S;if(e.type!==`list_item`)return[];let w=t.parseBlockChildren??t.parseChildren,E=[];if(e.tokens&&e.tokens.length>0)if(e.tokens.some(e=>e.type===`paragraph`))E=w(e.tokens);else{let S=e.tokens[0];if(S&&S.type===`text`&&S.tokens&&S.tokens.length>0){if(E=[{type:`paragraph`,content:t.parseInline(S.tokens)}],e.tokens.length>1){let t=w(e.tokens.slice(1));E.push(...t)}}else E=w(e.tokens)}return E.length===0&&(E=[{type:`paragraph`,content:[]}]),{type:`listItem`,content:E}},renderMarkdown:(e,t,S)=>renderNestedMarkdownContent(e,t,e=>{var t,S;return e.parentType===`bulletList`?`- `:e.parentType===`orderedList`?`${(e.meta?.parentAttrs?.start||1)+e.index}. `:`- `},S),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),listHelpers_exports={};__export(listHelpers_exports,{findListItemPos:()=>findListItemPos,getNextListDepth:()=>getNextListDepth,handleBackspace:()=>handleBackspace,handleDelete:()=>handleDelete$1,hasListBefore:()=>hasListBefore,hasListItemAfter:()=>hasListItemAfter,hasListItemBefore:()=>hasListItemBefore,listItemHasSubList:()=>listItemHasSubList,nextListIsDeeper:()=>nextListIsDeeper,nextListIsHigher:()=>nextListIsHigher});var findListItemPos=(e,t)=>{let{$from:S}=t.selection,w=getNodeType(e,t.schema),E=null,D=S.depth,O=S.pos,k=null;for(;D>0&&k===null;)E=S.node(D),E.type===w?k=D:(--D,--O);return k===null?null:{$pos:t.doc.resolve(O),depth:k}},getNextListDepth=(e,t)=>{let S=findListItemPos(e,t);if(!S)return!1;let[,w]=getNodeAtPosition(t,e,S.$pos.pos+4);return w},hasListBefore=(e,t,S)=>{let{$anchor:w}=e.selection,E=Math.max(0,w.pos-2),D=e.doc.resolve(E).node();return!(!D||!S.includes(D.type.name))},hasListItemBefore=(e,t)=>{var S;let{$anchor:w}=t.selection,E=t.doc.resolve(w.pos-2);return!(E.index()===0||E.nodeBefore?.type.name!==e)},listItemHasSubList=(e,t,S)=>{if(!S)return!1;let w=getNodeType(e,t.schema),E=!1;return S.descendants(e=>{e.type===w&&(E=!0)}),E},handleBackspace=(e,t,S)=>{if(e.commands.undoInputRule())return!0;if(e.state.selection.from!==e.state.selection.to)return!1;if(!isNodeActive(e.state,t)&&hasListBefore(e.state,t,S)){let{$anchor:S}=e.state.selection,w=e.state.doc.resolve(S.before()-1),E=[];w.node().descendants((e,S)=>{e.type.name===t&&E.push({node:e,pos:S})});let D=E.at(-1);if(!D)return!1;let O=e.state.doc.resolve(w.start()+D.pos+1);return e.chain().cut({from:S.start()-1,to:S.end()+1},O.end()).joinForward().run()}if(!isNodeActive(e.state,t)||!isAtStartOfNode(e.state))return!1;let w=findListItemPos(t,e.state);if(!w)return!1;let E=e.state.doc.resolve(w.$pos.pos-2).node(w.depth),D=listItemHasSubList(t,e.state,E);return hasListItemBefore(t,e.state)&&!D?e.commands.joinItemBackward():e.chain().liftListItem(t).run()},nextListIsDeeper=(e,t)=>{let S=getNextListDepth(e,t),w=findListItemPos(e,t);return!w||!S?!1:S>w.depth},nextListIsHigher=(e,t)=>{let S=getNextListDepth(e,t),w=findListItemPos(e,t);return!w||!S?!1:S<w.depth},handleDelete$1=(e,t)=>{if(!isNodeActive(e.state,t)||!isAtEndOfNode(e.state,t))return!1;let{selection:S}=e.state,{$from:w,$to:E}=S;return!S.empty&&w.sameParent(E)?!1:nextListIsDeeper(t,e.state)?e.chain().focus(e.state.selection.from+4).lift(t).joinBackward().run():nextListIsHigher(t,e.state)?e.chain().joinForward().joinBackward().run():e.commands.joinItemForward()},hasListItemAfter=(e,t)=>{var S;let{$anchor:w}=t.selection,E=t.doc.resolve(w.pos-w.parentOffset-2);return!(E.index()===E.parent.childCount-1||E.nodeAfter?.type.name!==e)},ListKeymap=Extension.create({name:`listKeymap`,addOptions(){return{listTypes:[{itemName:`listItem`,wrapperNames:[`bulletList`,`orderedList`]},{itemName:`taskItem`,wrapperNames:[`taskList`]}]}},addKeyboardShortcuts(){return{Delete:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:S})=>{e.state.schema.nodes[S]!==void 0&&handleDelete$1(e,S)&&(t=!0)}),t},"Mod-Delete":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:S})=>{e.state.schema.nodes[S]!==void 0&&handleDelete$1(e,S)&&(t=!0)}),t},Backspace:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:S,wrapperNames:w})=>{e.state.schema.nodes[S]!==void 0&&handleBackspace(e,S,w)&&(t=!0)}),t},"Mod-Backspace":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:S,wrapperNames:w})=>{e.state.schema.nodes[S]!==void 0&&handleBackspace(e,S,w)&&(t=!0)}),t}}}}),ORDERED_LIST_ITEM_REGEX=/^(\s*)(\d+)\.\s+(.*)$/,INDENTED_LINE_REGEX=/^\s/;function collectOrderedListItems(e){let t=[],S=0,w=0;for(;S<e.length;){let E=e[S],D=E.match(ORDERED_LIST_ITEM_REGEX);if(!D)break;let[,O,k,j]=D,F=O.length,L=j,B=S+1,H=[E];for(;B<e.length;){let t=e[B];if(t.match(ORDERED_LIST_ITEM_REGEX))break;if(t.trim()===``)H.push(t),L+=`
|
|
227
227
|
`,B+=1;else if(t.match(INDENTED_LINE_REGEX))H.push(t),L+=`
|
|
228
228
|
${t.slice(F+2)}`,B+=1;else break}t.push({indent:F,number:parseInt(k,10),content:L.trim(),raw:H.join(`
|
|
@@ -232,8 +232,8 @@ ${t.slice(F+2)}`,B+=1;else break}t.push({indent:F,number:parseInt(k,10),content:
|
|
|
232
232
|
`)})}E.push({type:`list_item`,raw:w.raw,tokens:j}),D=L}else D+=1}return E}function parseListItems(e,t){return e.map(e=>{if(e.type!==`list_item`)return t.parseChildren([e])[0];let S=[];return e.tokens&&e.tokens.length>0&&e.tokens.forEach(e=>{if(e.type===`paragraph`||e.type===`list`||e.type===`blockquote`||e.type===`code`)S.push(...t.parseChildren([e]));else if(e.type===`text`&&e.tokens){let w=t.parseChildren([e]);S.push({type:`paragraph`,content:w})}else{let w=t.parseChildren([e]);w.length>0&&S.push(...w)}}),{type:`listItem`,content:S}})}var ListItemName2=`listItem`,TextStyleName2=`textStyle`,orderedListInputRegex=/^(\d+)\.\s$/,OrderedList=Node3.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:e=>e.hasAttribute(`start`)?parseInt(e.getAttribute(`start`)||``,10):1},type:{default:null,parseHTML:e=>e.getAttribute(`type`)}}},parseHTML(){return[{tag:`ol`}]},renderHTML({HTMLAttributes:e}){let{start:t,...S}=e;return t===1?[`ol`,mergeAttributes(this.options.HTMLAttributes,S),0]:[`ol`,mergeAttributes(this.options.HTMLAttributes,e),0]},markdownTokenName:`list`,parseMarkdown:(e,t)=>{if(e.type!==`list`||!e.ordered)return[];let S=e.start||1,w=e.items?parseListItems(e.items,t):[];return S===1?{type:`orderedList`,content:w}:{type:`orderedList`,attrs:{start:S},content:w}},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
|
|
233
233
|
`):``,markdownTokenizer:{name:`orderedList`,level:`block`,start:e=>{let t=e.match(/^(\s*)(\d+)\.\s+/)?.index;return t===void 0?-1:t},tokenize:(e,t,S)=>{var w;let E=e.split(`
|
|
234
234
|
`),[D,O]=collectOrderedListItems(E);if(D.length===0)return;let k=buildNestedStructure(D,0,S);if(k.length!==0)return{type:`list`,ordered:!0,start:D[0]?.number||1,items:k,raw:E.slice(0,O).join(`
|
|
235
|
-
`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(ListItemName2,this.editor.getAttributes(TextStyleName2)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=wrappingInputRule({find:orderedListInputRegex,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)&&(e=wrappingInputRule({find:orderedListInputRegex,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(TextStyleName2)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[e]}}),inputRegex$
|
|
236
|
-
`):``,markdownTokenizer:{name:`taskList`,level:`block`,start(e){var t;let S=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/)?.index;return S===void 0?-1:S},tokenize(e,t,S){let w=e=>{let t=parseIndentedBlocks(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:S.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:w},S);return t?[{type:`taskList`,raw:t.raw,items:t.items}]:S.blockTokens(e)},E=parseIndentedBlocks(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:S.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:w},S);if(E)return{type:`taskList`,raw:E.raw,items:E.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),ListKit=Extension.create({name:`listKit`,addExtensions(){let e=[];return this.options.bulletList!==!1&&e.push(BulletList.configure(this.options.bulletList)),this.options.listItem!==!1&&e.push(ListItem$1.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(ListKeymap.configure(this.options.listKeymap)),this.options.orderedList!==!1&&e.push(OrderedList.configure(this.options.orderedList)),this.options.taskItem!==!1&&e.push(TaskItem.configure(this.options.taskItem)),this.options.taskList!==!1&&e.push(TaskList.configure(this.options.taskList)),e}}),EMPTY_PARAGRAPH_MARKDOWN=` `,NBSP_CHAR=`\xA0`,Paragraph=Node3.create({name:`paragraph`,priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:`block`,content:`inline*`,parseHTML(){return[{tag:`p`}]},renderHTML({HTMLAttributes:e}){return[`p`,mergeAttributes(this.options.HTMLAttributes,e),0]},parseMarkdown:(e,t)=>{let S=e.tokens||[];if(S.length===1&&S[0].type===`image`)return t.parseChildren([S[0]]);let w=t.parseInline(S);return S.length===1&&S[0].type===`text`&&(S[0].raw===EMPTY_PARAGRAPH_MARKDOWN||S[0].text===EMPTY_PARAGRAPH_MARKDOWN||S[0].raw===NBSP_CHAR||S[0].text===NBSP_CHAR)&&w.length===1&&w[0].type===`text`&&(w[0].text===EMPTY_PARAGRAPH_MARKDOWN||w[0].text===NBSP_CHAR)?t.createNode(`paragraph`,void 0,[]):t.createNode(`paragraph`,void 0,w)},renderMarkdown:(e,t,S)=>{var w,E;if(!e)return``;let D=Array.isArray(e.content)?e.content:[];if(D.length===0){let e=Array.isArray(S?.previousNode?.content)?S.previousNode.content:[];return S?.previousNode?.type===`paragraph`&&e.length===0?EMPTY_PARAGRAPH_MARKDOWN:``}return t.renderChildren(D)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),inputRegex$1=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,pasteRegex=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Strike=Mark.create({name:`strike`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`s`},{tag:`del`},{tag:`strike`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`line-through`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`s`,mergeAttributes(this.options.HTMLAttributes,e),0]},markdownTokenName:`del`,parseMarkdown:(e,t)=>t.applyMark(`strike`,t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`~~${t.renderChildren(e)}~~`,addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[markInputRule({find:inputRegex$1,type:this.type})]},addPasteRules(){return[markPasteRule({find:pasteRegex,type:this.type})]}}),Text=Node3.create({name:`text`,group:`inline`,parseMarkdown:e=>({type:`text`,text:e.text||``}),renderMarkdown:e=>e.text||``}),Underline=Mark.create({name:`underline`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`u`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`underline`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`u`,mergeAttributes(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||`underline`,t.parseInline(e.tokens||[]))},renderMarkdown(e,t){return`++${t.renderChildren(e)}++`},markdownTokenizer:{name:`underline`,level:`inline`,start(e){return e.indexOf(`++`)},tokenize(e,t,S){let w=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!w)return;let E=w[2].trim();return{type:`underline`,raw:w[0],text:E,tokens:S.inlineTokens(E)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function dropCursor(e={}){return new Plugin({view(t){return new DropCursorView(t,e)}})}var DropCursorView=class{constructor(e,t){var S;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=t.width??1,this.color=t.color===!1?void 0:t.color||`black`,this.class=t.class,this.handlers=[`dragover`,`dragend`,`drop`,`dragleave`].map(t=>{let S=e=>{this[t](e)};return e.dom.addEventListener(t,S),{name:t,handler:S}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,S,w=this.editorView.dom,E=w.getBoundingClientRect(),D=E.width/w.offsetWidth,O=E.height/w.offsetHeight;if(t){let t=e.nodeBefore,w=e.nodeAfter;if(t||w){let e=this.editorView.nodeDOM(this.cursorPos-(t?t.nodeSize:0));if(e){let E=e.getBoundingClientRect(),D=t?E.bottom:E.top;t&&w&&(D=(D+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let k=this.width/2*O;S={left:E.left,right:E.right,top:D-k,bottom:D+k}}}}if(!S){let e=this.editorView.coordsAtPos(this.cursorPos),t=this.width/2*D;S={left:e.left-t,right:e.left+t,top:e.top,bottom:e.bottom}}let k=this.editorView.dom.offsetParent;this.element||(this.element=k.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 j,F;if(!k||k==document.body&&getComputedStyle(k).position==`static`)j=-pageXOffset,F=-pageYOffset;else{let e=k.getBoundingClientRect(),t=e.width/k.offsetWidth,S=e.height/k.offsetHeight;j=e.left-k.scrollLeft*t,F=e.top-k.scrollTop*S}this.element.style.left=(S.left-j)/D+`px`,this.element.style.top=(S.top-F)/O+`px`,this.element.style.width=(S.right-S.left)/D+`px`,this.element.style.height=(S.bottom-S.top)/O+`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}),S=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),w=S&&S.type.spec.disableDropCursor,E=typeof w==`function`?w(this.editorView,t,e):w;if(t&&!E){let e=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let t=dropPoint(this.editorView.state.doc,e,this.editorView.dragging.slice);t!=null&&(e=t)}this.setCursor(e),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}},GapCursor=class e extends Selection$1{constructor(e){super(e,e)}map(t,S){let w=t.resolve(S.map(this.head));return e.valid(w)?new e(w):Selection$1.near(w)}content(){return Slice.empty}eq(t){return t instanceof e&&t.head==this.head}toJSON(){return{type:`gapcursor`,pos:this.head}}static fromJSON(t,S){if(typeof S.pos!=`number`)throw RangeError(`Invalid input for GapCursor.fromJSON`);return new e(t.resolve(S.pos))}getBookmark(){return new GapBookmark(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!closedBefore(e)||!closedAfter(e))return!1;let S=t.type.spec.allowGapCursor;if(S!=null)return S;let w=t.contentMatchAt(e.index()).defaultType;return w&&w.isTextblock}static findGapCursorFrom(t,S,w=!1){search:for(;;){if(!w&&e.valid(t))return t;let E=t.pos,D=null;for(let w=t.depth;;w--){let O=t.node(w);if(S>0?t.indexAfter(w)<O.childCount:t.index(w)>0){D=O.child(S>0?t.indexAfter(w):t.index(w)-1);break}else if(w==0)return null;E+=S;let k=t.doc.resolve(E);if(e.valid(k))return k}for(;;){let O=S>0?D.firstChild:D.lastChild;if(!O){if(D.isAtom&&!D.isText&&!NodeSelection.isSelectable(D)){t=t.doc.resolve(E+D.nodeSize*S),w=!1;continue search}break}D=O,E+=S;let k=t.doc.resolve(E);if(e.valid(k))return k}return null}}};GapCursor.prototype.visible=!1,GapCursor.findFrom=GapCursor.findGapCursorFrom,Selection$1.jsonID(`gapcursor`,GapCursor);var GapBookmark=class e{constructor(e){this.pos=e}map(t){return new e(t.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return GapCursor.valid(t)?new GapCursor(t):Selection$1.near(t)}};function needsGap(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}function closedBefore(e){for(let t=e.depth;t>=0;t--){let S=e.index(t),w=e.node(t);if(S==0){if(w.type.spec.isolating)return!0;continue}for(let e=w.child(S-1);;e=e.lastChild){if(e.childCount==0&&!e.inlineContent||needsGap(e.type))return!0;if(e.inlineContent)return!1}}return!0}function closedAfter(e){for(let t=e.depth;t>=0;t--){let S=e.indexAfter(t),w=e.node(t);if(S==w.childCount){if(w.type.spec.isolating)return!0;continue}for(let e=w.child(S);;e=e.firstChild){if(e.childCount==0&&!e.inlineContent||needsGap(e.type))return!0;if(e.inlineContent)return!1}}return!0}function gapCursor(){return new Plugin({props:{decorations:drawGapCursor,createSelectionBetween(e,t,S){return t.pos==S.pos&&GapCursor.valid(S)?new GapCursor(S):null},handleClick,handleKeyDown,handleDOMEvents:{beforeinput}}})}const handleKeyDown=keydownHandler({ArrowLeft:arrow(`horiz`,-1),ArrowRight:arrow(`horiz`,1),ArrowUp:arrow(`vert`,-1),ArrowDown:arrow(`vert`,1)});function arrow(e,t){let S=e==`vert`?t>0?`down`:`up`:t>0?`right`:`left`;return function(e,w,E){let D=e.selection,O=t>0?D.$to:D.$from,k=D.empty;if(D instanceof TextSelection){if(!E.endOfTextblock(S)||O.depth==0)return!1;k=!1,O=e.doc.resolve(t>0?O.after():O.before())}let j=GapCursor.findGapCursorFrom(O,t,k);return j?(w&&w(e.tr.setSelection(new GapCursor(j))),!0):!1}}function handleClick(e,t,S){if(!e||!e.editable)return!1;let w=e.state.doc.resolve(t);if(!GapCursor.valid(w))return!1;let E=e.posAtCoords({left:S.clientX,top:S.clientY});return E&&E.inside>-1&&NodeSelection.isSelectable(e.state.doc.nodeAt(E.inside))?!1:(e.dispatch(e.state.tr.setSelection(new GapCursor(w))),!0)}function beforeinput(e,t){if(t.inputType!=`insertCompositionText`||!(e.state.selection instanceof GapCursor))return!1;let{$from:S}=e.state.selection,w=S.parent.contentMatchAt(S.index()).findWrapping(e.state.schema.nodes.text);if(!w)return!1;let E=Fragment.empty;for(let e=w.length-1;e>=0;e--)E=Fragment.from(w[e].createAndFill(null,E));let D=e.state.tr.replace(S.pos,S.pos,new Slice(E,0,0));return D.setSelection(TextSelection.near(D.doc.resolve(S.pos+1))),e.dispatch(D),!1}function drawGapCursor(e){if(!(e.selection instanceof GapCursor))return null;let t=document.createElement(`div`);return t.className=`ProseMirror-gapcursor`,DecorationSet.create(e.doc,[Decoration.widget(e.selection.head,t,{key:`gapcursor`})])}var GOOD_LEAF_SIZE=200,RopeSequence=function(){};RopeSequence.prototype.append=function(e){return e.length?(e=RopeSequence.from(e),!this.length&&e||e.length<GOOD_LEAF_SIZE&&this.leafAppend(e)||this.length<GOOD_LEAF_SIZE&&e.leafPrepend(this)||this.appendInner(e)):this},RopeSequence.prototype.prepend=function(e){return e.length?RopeSequence.from(e).append(this):this},RopeSequence.prototype.appendInner=function(e){return new Append(this,e)},RopeSequence.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?RopeSequence.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},RopeSequence.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},RopeSequence.prototype.forEach=function(e,t,S){t===void 0&&(t=0),S===void 0&&(S=this.length),t<=S?this.forEachInner(e,t,S,0):this.forEachInvertedInner(e,t,S,0)},RopeSequence.prototype.map=function(e,t,S){t===void 0&&(t=0),S===void 0&&(S=this.length);var w=[];return this.forEach(function(t,S){return w.push(e(t,S))},t,S),w},RopeSequence.from=function(e){return e instanceof RopeSequence?e:e&&e.length?new Leaf(e):RopeSequence.empty};var Leaf=function(e){function t(t){e.call(this),this.values=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var S={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,S){return e==0&&S==this.length?this:new t(this.values.slice(e,S))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,S,w){for(var E=t;E<S;E++)if(e(this.values[E],w+E)===!1)return!1},t.prototype.forEachInvertedInner=function(e,t,S,w){for(var E=t-1;E>=S;E--)if(e(this.values[E],w+E)===!1)return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=GOOD_LEAF_SIZE)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=GOOD_LEAF_SIZE)return new t(e.flatten().concat(this.values))},S.length.get=function(){return this.values.length},S.depth.get=function(){return 0},Object.defineProperties(t.prototype,S),t}(RopeSequence);RopeSequence.empty=new Leaf([]);var Append=function(e){function t(t,S){e.call(this),this.left=t,this.right=S,this.length=t.length+S.length,this.depth=Math.max(t.depth,S.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,S,w){var E=this.left.length;if(t<E&&this.left.forEachInner(e,t,Math.min(S,E),w)===!1||S>E&&this.right.forEachInner(e,Math.max(t-E,0),Math.min(this.length,S)-E,w+E)===!1)return!1},t.prototype.forEachInvertedInner=function(e,t,S,w){var E=this.left.length;if(t>E&&this.right.forEachInvertedInner(e,t-E,Math.max(S,E)-E,w+E)===!1||S<E&&this.left.forEachInvertedInner(e,Math.min(t,E),S,w)===!1)return!1},t.prototype.sliceInner=function(e,t){if(e==0&&t==this.length)return this;var S=this.left.length;return t<=S?this.left.slice(e,t):e>=S?this.right.slice(e-S,t-S):this.left.slice(e,S).append(this.right.slice(0,t-S))},t.prototype.leafAppend=function(e){var S=this.right.leafAppend(e);if(S)return new t(this.left,S)},t.prototype.leafPrepend=function(e){var S=this.left.leafPrepend(e);if(S)return new t(S,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(RopeSequence);const max_empty_items=500;var Branch=class e{constructor(e,t){this.items=e,this.eventCount=t}popEvent(t,S){if(this.eventCount==0)return null;let w=this.items.length;for(;;w--)if(this.items.get(w-1).selection){--w;break}let E,D;S&&(E=this.remapping(w,this.items.length),D=E.maps.length);let O=t.tr,k,j,F=[],L=[];return this.items.forEach((t,S)=>{if(!t.step){E||(E=this.remapping(w,S+1),D=E.maps.length),D--,L.push(t);return}if(E){L.push(new Item$1(t.map));let e=t.step.map(E.slice(D)),S;e&&O.maybeStep(e).doc&&(S=O.mapping.maps[O.mapping.maps.length-1],F.push(new Item$1(S,void 0,void 0,F.length+L.length))),D--,S&&E.appendMap(S,D)}else O.maybeStep(t.step);if(t.selection)return k=E?t.selection.map(E.slice(D)):t.selection,j=new e(this.items.slice(0,w).append(L.reverse().concat(F)),this.eventCount-1),!1},this.items.length,0),{remaining:j,transform:O,selection:k}}addTransform(t,S,w,E){let D=[],O=this.eventCount,k=this.items,j=!E&&k.length?k.get(k.length-1):null;for(let e=0;e<t.steps.length;e++){let w=t.steps[e].invert(t.docs[e]),F=new Item$1(t.mapping.maps[e],w,S),L;(L=j&&j.merge(F))&&(F=L,e?D.pop():k=k.slice(0,k.length-1)),D.push(F),S&&=(O++,void 0),E||(j=F)}let F=O-w.depth;return F>DEPTH_OVERFLOW&&(k=cutOffEvents(k,F),O-=F),new e(k.append(D),O)}remapping(e,t){let S=new Mapping;return this.items.forEach((t,w)=>{let E=t.mirrorOffset!=null&&w-t.mirrorOffset>=e?S.maps.length-t.mirrorOffset:void 0;S.appendMap(t.map,E)},e,t),S}addMaps(t){return this.eventCount==0?this:new e(this.items.append(t.map(e=>new Item$1(e))),this.eventCount)}rebased(t,S){if(!this.eventCount)return this;let w=[],E=Math.max(0,this.items.length-S),D=t.mapping,O=t.steps.length,k=this.eventCount;this.items.forEach(e=>{e.selection&&k--},E);let j=S;this.items.forEach(e=>{let S=D.getMirror(--j);if(S==null)return;O=Math.min(O,S);let E=D.maps[S];if(e.step){let O=t.steps[S].invert(t.docs[S]),F=e.selection&&e.selection.map(D.slice(j+1,S));F&&k++,w.push(new Item$1(E,O,F))}else w.push(new Item$1(E))},E);let F=[];for(let e=S;e<O;e++)F.push(new Item$1(D.maps[e]));let L=new e(this.items.slice(0,E).append(F).append(w),k);return L.emptyItemCount()>max_empty_items&&(L=L.compress(this.items.length-w.length)),L}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(t=this.items.length){let S=this.remapping(0,t),w=S.maps.length,E=[],D=0;return this.items.forEach((e,O)=>{if(O>=t)E.push(e),e.selection&&D++;else if(e.step){let t=e.step.map(S.slice(w)),O=t&&t.getMap();if(w--,O&&S.appendMap(O,w),t){let k=e.selection&&e.selection.map(S.slice(w));k&&D++;let j=new Item$1(O.invert(),t,k),F,L=E.length-1;(F=E.length&&E[L].merge(j))?E[L]=F:E.push(j)}}else e.map&&w--},this.items.length,0),new e(RopeSequence.from(E.reverse()),D)}};Branch.empty=new Branch(RopeSequence.empty,0);function cutOffEvents(e,t){let S;return e.forEach((e,w)=>{if(e.selection&&t--==0)return S=w,!1}),e.slice(S)}var Item$1=class e{constructor(e,t,S,w){this.map=e,this.step=t,this.selection=S,this.mirrorOffset=w}merge(t){if(this.step&&t.step&&!t.selection){let S=t.step.merge(this.step);if(S)return new e(S.getMap().invert(),S,this.selection)}}},HistoryState=class{constructor(e,t,S,w,E){this.done=e,this.undone=t,this.prevRanges=S,this.prevTime=w,this.prevComposition=E}};const DEPTH_OVERFLOW=20;function applyTransaction(e,t,S,w){let E=S.getMeta(historyKey),D;if(E)return E.historyState;S.getMeta(closeHistoryKey)&&(e=new HistoryState(e.done,e.undone,null,0,-1));let O=S.getMeta(`appendedTransaction`);if(S.steps.length==0)return e;if(O&&O.getMeta(historyKey))return O.getMeta(historyKey).redo?new HistoryState(e.done.addTransform(S,void 0,w,mustPreserveItems(t)),e.undone,rangesFor(S.mapping.maps),e.prevTime,e.prevComposition):new HistoryState(e.done,e.undone.addTransform(S,void 0,w,mustPreserveItems(t)),null,e.prevTime,e.prevComposition);if(S.getMeta(`addToHistory`)!==!1&&!(O&&O.getMeta(`addToHistory`)===!1)){let E=S.getMeta(`composition`),D=e.prevTime==0||!O&&e.prevComposition!=E&&(e.prevTime<(S.time||0)-w.newGroupDelay||!isAdjacentTo(S,e.prevRanges)),k=O?mapRanges(e.prevRanges,S.mapping):rangesFor(S.mapping.maps);return new HistoryState(e.done.addTransform(S,D?t.selection.getBookmark():void 0,w,mustPreserveItems(t)),Branch.empty,k,S.time,E??e.prevComposition)}else if(D=S.getMeta(`rebased`))return new HistoryState(e.done.rebased(S,D),e.undone.rebased(S,D),mapRanges(e.prevRanges,S.mapping),e.prevTime,e.prevComposition);else return new HistoryState(e.done.addMaps(S.mapping.maps),e.undone.addMaps(S.mapping.maps),mapRanges(e.prevRanges,S.mapping),e.prevTime,e.prevComposition)}function isAdjacentTo(e,t){if(!t)return!1;if(!e.docChanged)return!0;let S=!1;return e.mapping.maps[0].forEach((e,w)=>{for(let E=0;E<t.length;E+=2)e<=t[E+1]&&w>=t[E]&&(S=!0)}),S}function rangesFor(e){let t=[];for(let S=e.length-1;S>=0&&t.length==0;S--)e[S].forEach((e,S,w,E)=>t.push(w,E));return t}function mapRanges(e,t){if(!e)return null;let S=[];for(let w=0;w<e.length;w+=2){let E=t.map(e[w],1),D=t.map(e[w+1],-1);E<=D&&S.push(E,D)}return S}function histTransaction(e,t,S){let w=mustPreserveItems(t),E=historyKey.get(t).spec.config,D=(S?e.undone:e.done).popEvent(t,w);if(!D)return null;let O=D.selection.resolve(D.transform.doc),k=(S?e.done:e.undone).addTransform(D.transform,t.selection.getBookmark(),E,w),j=new HistoryState(S?k:D.remaining,S?D.remaining:k,null,0,-1);return D.transform.setSelection(O).setMeta(historyKey,{redo:S,historyState:j})}let cachedPreserveItems=!1,cachedPreserveItemsPlugins=null;function mustPreserveItems(e){let t=e.plugins;if(cachedPreserveItemsPlugins!=t){cachedPreserveItems=!1,cachedPreserveItemsPlugins=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){cachedPreserveItems=!0;break}}return cachedPreserveItems}const historyKey=new PluginKey(`history`),closeHistoryKey=new PluginKey(`closeHistory`);function history(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new Plugin({key:historyKey,state:{init(){return new HistoryState(Branch.empty,Branch.empty,null,0,-1)},apply(t,S,w){return applyTransaction(S,w,t,e)}},config:e,props:{handleDOMEvents:{beforeinput(e,t){let S=t.inputType,w=S==`historyUndo`?undo:S==`historyRedo`?redo:null;return!w||!e.editable?!1:(t.preventDefault(),w(e.state,e.dispatch))}}}})}function buildCommand(e,t){return(S,w)=>{let E=historyKey.getState(S);if(!E||(e?E.undone:E.done).eventCount==0)return!1;if(w){let D=histTransaction(E,S,e);D&&w(t?D.scrollIntoView():D)}return!0}}const undo=buildCommand(!1,!0),redo=buildCommand(!0,!0),undoNoScroll=buildCommand(!1,!1),redoNoScroll=buildCommand(!0,!1);var CharacterCount=Extension.create({name:`characterCount`,addOptions(){return{limit:null,mode:`textSize`,textCounter:e=>e.length,wordCounter:e=>e.split(` `).filter(e=>e!==``).length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=e=>{let t=e?.node||this.editor.state.doc;if((e?.mode||this.options.mode)===`textSize`){let e=t.textBetween(0,t.content.size,void 0,` `);return this.options.textCounter(e)}return t.nodeSize},this.storage.words=e=>{let t=e?.node||this.editor.state.doc,S=t.textBetween(0,t.content.size,` `,` `);return this.options.wordCounter(S)}},addProseMirrorPlugins(){let e=!1;return[new Plugin({key:new PluginKey(`characterCount`),appendTransaction:(t,S,w)=>{if(e)return;let E=this.options.limit;if(E==null||E===0){e=!0;return}let D=this.storage.characters({node:w.doc});if(D>E){let t=D-E,S=0,O=t;console.warn(`[CharacterCount] Initial content exceeded limit of ${E} characters. Content was automatically trimmed.`);let k=w.tr.deleteRange(0,O);return e=!0,k}e=!0},filterTransaction:(e,t)=>{let S=this.options.limit;if(!e.docChanged||S===0||S==null)return!0;let w=this.storage.characters({node:t.doc}),E=this.storage.characters({node:e.doc});if(E<=S||w>S&&E>S&&E<=w)return!0;if(w>S&&E>S&&E>w||!e.getMeta(`paste`))return!1;let D=e.selection.$head.pos,O=D-(E-S),k=D;return e.deleteRange(O,k),!(this.storage.characters({node:e.doc})>S)}})]}}),Dropcursor=Extension.create({name:`dropCursor`,addOptions(){return{color:`currentColor`,width:1,class:void 0}},addProseMirrorPlugins(){return[dropCursor(this.options)]}}),Focus=Extension.create({name:`focus`,addOptions(){return{className:`has-focus`,mode:`all`}},addProseMirrorPlugins(){return[new Plugin({key:new PluginKey(`focus`),props:{decorations:({doc:e,selection:t})=>{let{isEditable:S,isFocused:w}=this.editor,{anchor:E}=t,D=[];if(!S||!w)return DecorationSet.create(e,[]);let O=0;this.options.mode===`deepest`&&e.descendants((e,t)=>{if(!e.isText){if(!(E>=t&&E<=t+e.nodeSize-1))return!1;O+=1}});let k=0;return e.descendants((e,t)=>{if(e.isText||!(E>=t&&E<=t+e.nodeSize-1))return!1;if(k+=1,this.options.mode===`deepest`&&O-k>0||this.options.mode===`shallowest`&&k>1)return this.options.mode===`deepest`;D.push(Decoration.node(t,t+e.nodeSize,{class:this.options.className}))}),DecorationSet.create(e,D)}}})]}}),Gapcursor=Extension.create({name:`gapCursor`,addProseMirrorPlugins(){return[gapCursor()]},extendNodeSchema(e){var t;return{allowGapCursor:callOrReturn(getExtensionField(e,`allowGapCursor`,{name:e.name,options:e.options,storage:e.storage}))??null}}}),DEFAULT_DATA_ATTRIBUTE=`placeholder`;function preparePlaceholderAttribute(e){return e.replace(/\s+/g,`-`).replace(/[^a-zA-Z0-9-]/g,``).replace(/^[0-9-]+/,``).replace(/^-+/,``).toLowerCase()}var Placeholder=Extension.create({name:`placeholder`,addOptions(){return{emptyEditorClass:`is-editor-empty`,emptyNodeClass:`is-empty`,dataAttribute:DEFAULT_DATA_ATTRIBUTE,placeholder:`Write something …`,showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){let e=this.options.dataAttribute?`data-${preparePlaceholderAttribute(this.options.dataAttribute)}`:`data-${DEFAULT_DATA_ATTRIBUTE}`;return[new Plugin({key:new PluginKey(`placeholder`),props:{decorations:({doc:t,selection:S})=>{let w=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:E}=S,D=[];if(!w)return null;let O=this.editor.isEmpty;return t.descendants((t,S)=>{let w=E>=S&&E<=S+t.nodeSize,k=!t.isLeaf&&isNodeEmpty(t);if(!t.type.isTextblock)return this.options.includeChildren;if((w||!this.options.showOnlyCurrent)&&k){let E=[this.options.emptyNodeClass];O&&E.push(this.options.emptyEditorClass);let k=Decoration.node(S,S+t.nodeSize,{class:E.join(` `),[e]:typeof this.options.placeholder==`function`?this.options.placeholder({editor:this.editor,node:t,pos:S,hasAnchor:w}):this.options.placeholder});D.push(k)}return this.options.includeChildren}),DecorationSet.create(t,D)}}})]}}),Selection=Extension.create({name:`selection`,addOptions(){return{className:`selection`}},addProseMirrorPlugins(){let{editor:e,options:t}=this;return[new Plugin({key:new PluginKey(`selection`),props:{decorations(S){return S.selection.empty||e.isFocused||!e.isEditable||isNodeSelection(S.selection)||e.view.dragging?null:DecorationSet.create(S.doc,[Decoration.inline(S.selection.from,S.selection.to,{class:t.className})])}}})]}}),skipTrailingNodeMeta=`skipTrailingNode`;function nodeEqualsType({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||t?.type===e}var TrailingNode=Extension.create({name:`trailingNode`,addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var e;let t=new PluginKey(this.name),S=this.options.node||this.editor.schema.topNodeType.contentMatch.defaultType?.name||`paragraph`,w=Object.entries(this.editor.schema.nodes).map(([,e])=>e).filter(e=>(this.options.notAfter||[]).concat(S).includes(e.name));return[new Plugin({key:t,appendTransaction:(e,w,E)=>{let{doc:D,tr:O,schema:k}=E,j=t.getState(E),F=D.content.size,L=k.nodes[S];if(!e.some(e=>e.getMeta(`skipTrailingNode`))&&j)return O.insert(F,L.create())},state:{init:(e,t)=>{let S=t.tr.doc.lastChild;return!nodeEqualsType({node:S,types:w})},apply:(e,t)=>{if(!e.docChanged||e.getMeta(`__uniqueIDTransaction`))return t;let S=e.doc.lastChild;return!nodeEqualsType({node:S,types:w})}}})]}}),UndoRedo=Extension.create({name:`undoRedo`,addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>undo(e,t),redo:()=>({state:e,dispatch:t})=>redo(e,t)}},addProseMirrorPlugins(){return[history(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()}}}),StarterKit=Extension.create({name:`starterKit`,addExtensions(){var e,t,S,w;let E=[];return this.options.bold!==!1&&E.push(Bold.configure(this.options.bold)),this.options.blockquote!==!1&&E.push(Blockquote.configure(this.options.blockquote)),this.options.bulletList!==!1&&E.push(BulletList.configure(this.options.bulletList)),this.options.code!==!1&&E.push(Code.configure(this.options.code)),this.options.codeBlock!==!1&&E.push(CodeBlock.configure(this.options.codeBlock)),this.options.document!==!1&&E.push(Document$2.configure(this.options.document)),this.options.dropcursor!==!1&&E.push(Dropcursor.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&E.push(Gapcursor.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&E.push(HardBreak.configure(this.options.hardBreak)),this.options.heading!==!1&&E.push(Heading.configure(this.options.heading)),this.options.undoRedo!==!1&&E.push(UndoRedo.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&E.push(HorizontalRule.configure(this.options.horizontalRule)),this.options.italic!==!1&&E.push(Italic.configure(this.options.italic)),this.options.listItem!==!1&&E.push(ListItem$1.configure(this.options.listItem)),this.options.listKeymap!==!1&&E.push(ListKeymap.configure(this.options?.listKeymap)),this.options.link!==!1&&E.push(Link.configure(this.options?.link)),this.options.orderedList!==!1&&E.push(OrderedList.configure(this.options.orderedList)),this.options.paragraph!==!1&&E.push(Paragraph.configure(this.options.paragraph)),this.options.strike!==!1&&E.push(Strike.configure(this.options.strike)),this.options.text!==!1&&E.push(Text.configure(this.options.text)),this.options.underline!==!1&&E.push(Underline.configure(this.options?.underline)),this.options.trailingNode!==!1&&E.push(TrailingNode.configure(this.options?.trailingNode)),E}}),index_default$1=StarterKit,inputRegex=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,Image=Node3.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:e}){return[`img`,mergeAttributes(this.options.HTMLAttributes,e)]},parseMarkdown:(e,t)=>t.createNode(`image`,{src:e.href,title:e.title,alt:e.text}),renderMarkdown:e=>{var t,S,w,E,D,O;let k=e.attrs?.src??``,j=e.attrs?.alt??``,F=e.attrs?.title??``;return F?``:``},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>`u`)return null;let{directions:e,minWidth:t,minHeight:S,alwaysPreserveAspectRatio:w}=this.options.resize;return({node:E,getPos:D,HTMLAttributes:O,editor:k})=>{let j=document.createElement(`img`);Object.entries(O).forEach(([e,t])=>{if(t!=null)switch(e){case`width`:case`height`:break;default:j.setAttribute(e,t);break}}),j.src=O.src;let F=new ResizableNodeView({element:j,editor:k,node:E,getPos:D,onResize:(e,t)=>{j.style.width=`${e}px`,j.style.height=`${t}px`},onCommit:(e,t)=>{let S=D();S!==void 0&&this.editor.chain().setNodeSelection(S).updateAttributes(this.name,{width:e,height:t}).run()},onUpdate:(e,t,S)=>e.type===E.type,options:{directions:e,min:{width:t,height:S},preserveAspectRatio:w===!0}}),L=F.dom;return L.style.visibility=`hidden`,L.style.pointerEvents=`none`,j.onload=()=>{L.style.visibility=``,L.style.pointerEvents=``},F}},addCommands(){return{setImage:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}},addInputRules(){return[nodeInputRule({find:inputRegex,type:this.type,getAttributes:e=>{let[,,t,S,w]=e;return{src:S,alt:t,title:w}}})]}}),index_default=Image;function ok$2(){}var Schema=class{constructor(e,t,S){this.normal=t,this.property=e,S&&(this.space=S)}};Schema.prototype.normal={},Schema.prototype.property={},Schema.prototype.space=void 0;function merge(e,t){let S={},w={};for(let t of e)Object.assign(S,t.property),Object.assign(w,t.normal);return new Schema(S,w,t)}function normalize$3(e){return e.toLowerCase()}var Info=class{constructor(e,t){this.attribute=t,this.property=e}};Info.prototype.attribute=``,Info.prototype.booleanish=!1,Info.prototype.boolean=!1,Info.prototype.commaOrSpaceSeparated=!1,Info.prototype.commaSeparated=!1,Info.prototype.defined=!1,Info.prototype.mustUseProperty=!1,Info.prototype.number=!1,Info.prototype.overloadedBoolean=!1,Info.prototype.property=``,Info.prototype.spaceSeparated=!1,Info.prototype.space=void 0;var types_exports=__exportAll({boolean:()=>boolean,booleanish:()=>booleanish,commaOrSpaceSeparated:()=>commaOrSpaceSeparated,commaSeparated:()=>commaSeparated,number:()=>number,overloadedBoolean:()=>overloadedBoolean,spaceSeparated:()=>spaceSeparated});let powers=0;const boolean=increment(),booleanish=increment(),overloadedBoolean=increment(),number=increment(),spaceSeparated=increment(),commaSeparated=increment(),commaOrSpaceSeparated=increment();function increment(){return 2**++powers}const checks=Object.keys(types_exports);var DefinedInfo=class extends Info{constructor(e,t,S,w){let E=-1;if(super(e,t),mark(this,`space`,w),typeof S==`number`)for(;++E<checks.length;){let e=checks[E];mark(this,checks[E],(S&types_exports[e])===types_exports[e])}}};DefinedInfo.prototype.defined=!0;function mark(e,t,S){S&&(e[t]=S)}function create$15(e){let t={},S={};for(let[w,E]of Object.entries(e.properties)){let D=new DefinedInfo(w,e.transform(e.attributes||{},w),E,e.space);e.mustUseProperty&&e.mustUseProperty.includes(w)&&(D.mustUseProperty=!0),t[w]=D,S[normalize$3(w)]=w,S[normalize$3(D.attribute)]=w}return new Schema(t,S,e.space)}const aria=create$15({properties:{ariaActiveDescendant:null,ariaAtomic:booleanish,ariaAutoComplete:null,ariaBusy:booleanish,ariaChecked:booleanish,ariaColCount:number,ariaColIndex:number,ariaColSpan:number,ariaControls:spaceSeparated,ariaCurrent:null,ariaDescribedBy:spaceSeparated,ariaDetails:null,ariaDisabled:booleanish,ariaDropEffect:spaceSeparated,ariaErrorMessage:null,ariaExpanded:booleanish,ariaFlowTo:spaceSeparated,ariaGrabbed:booleanish,ariaHasPopup:null,ariaHidden:booleanish,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:spaceSeparated,ariaLevel:number,ariaLive:null,ariaModal:booleanish,ariaMultiLine:booleanish,ariaMultiSelectable:booleanish,ariaOrientation:null,ariaOwns:spaceSeparated,ariaPlaceholder:null,ariaPosInSet:number,ariaPressed:booleanish,ariaReadOnly:booleanish,ariaRelevant:null,ariaRequired:booleanish,ariaRoleDescription:spaceSeparated,ariaRowCount:number,ariaRowIndex:number,ariaRowSpan:number,ariaSelected:booleanish,ariaSetSize:number,ariaSort:null,ariaValueMax:number,ariaValueMin:number,ariaValueNow:number,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function caseSensitiveTransform(e,t){return t in e?e[t]:t}function caseInsensitiveTransform(e,t){return caseSensitiveTransform(e,t.toLowerCase())}const html$2=create$15({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:commaSeparated,acceptCharset:spaceSeparated,accessKey:spaceSeparated,action:null,allow:null,allowFullScreen:boolean,allowPaymentRequest:boolean,allowUserMedia:boolean,alt:null,as:null,async:boolean,autoCapitalize:null,autoComplete:spaceSeparated,autoFocus:boolean,autoPlay:boolean,blocking:spaceSeparated,capture:null,charSet:null,checked:boolean,cite:null,className:spaceSeparated,cols:number,colSpan:null,content:null,contentEditable:booleanish,controls:boolean,controlsList:spaceSeparated,coords:number|commaSeparated,crossOrigin:null,data:null,dateTime:null,decoding:null,default:boolean,defer:boolean,dir:null,dirName:null,disabled:boolean,download:overloadedBoolean,draggable:booleanish,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:boolean,formTarget:null,headers:spaceSeparated,height:number,hidden:overloadedBoolean,high:number,href:null,hrefLang:null,htmlFor:spaceSeparated,httpEquiv:spaceSeparated,id:null,imageSizes:null,imageSrcSet:null,inert:boolean,inputMode:null,integrity:null,is:null,isMap:boolean,itemId:null,itemProp:spaceSeparated,itemRef:spaceSeparated,itemScope:boolean,itemType:spaceSeparated,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:boolean,low:number,manifest:null,max:null,maxLength:number,media:null,method:null,min:null,minLength:number,multiple:boolean,muted:boolean,name:null,nonce:null,noModule:boolean,noValidate:boolean,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:boolean,optimum:number,pattern:null,ping:spaceSeparated,placeholder:null,playsInline:boolean,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:boolean,referrerPolicy:null,rel:spaceSeparated,required:boolean,reversed:boolean,rows:number,rowSpan:number,sandbox:spaceSeparated,scope:null,scoped:boolean,seamless:boolean,selected:boolean,shadowRootClonable:boolean,shadowRootDelegatesFocus:boolean,shadowRootMode:null,shape:null,size:number,sizes:null,slot:null,span:number,spellCheck:booleanish,src:null,srcDoc:null,srcLang:null,srcSet:null,start:number,step:null,style:null,tabIndex:number,target:null,title:null,translate:null,type:null,typeMustMatch:boolean,useMap:null,value:booleanish,width:number,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:spaceSeparated,axis:null,background:null,bgColor:null,border:number,borderColor:null,bottomMargin:number,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:boolean,declare:boolean,event:null,face:null,frame:null,frameBorder:null,hSpace:number,leftMargin:number,link:null,longDesc:null,lowSrc:null,marginHeight:number,marginWidth:number,noResize:boolean,noHref:boolean,noShade:boolean,noWrap:boolean,object:null,profile:null,prompt:null,rev:null,rightMargin:number,rules:null,scheme:null,scrolling:booleanish,standby:null,summary:null,text:null,topMargin:number,valueType:null,version:null,vAlign:null,vLink:null,vSpace:number,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:boolean,disableRemotePlayback:boolean,prefix:null,property:null,results:number,security:null,unselectable:null},space:`html`,transform:caseInsensitiveTransform}),svg$1=create$15({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,dominantBaseline:`dominant-baseline`,enableBackground:`enable-background`,fillOpacity:`fill-opacity`,fillRule:`fill-rule`,floodColor:`flood-color`,floodOpacity:`flood-opacity`,fontFamily:`font-family`,fontSize:`font-size`,fontSizeAdjust:`font-size-adjust`,fontStretch:`font-stretch`,fontStyle:`font-style`,fontVariant:`font-variant`,fontWeight:`font-weight`,glyphName:`glyph-name`,glyphOrientationHorizontal:`glyph-orientation-horizontal`,glyphOrientationVertical:`glyph-orientation-vertical`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,renderingIntent:`rendering-intent`,shapeRendering:`shape-rendering`,stopColor:`stop-color`,stopOpacity:`stop-opacity`,strikethroughPosition:`strikethrough-position`,strikethroughThickness:`strikethrough-thickness`,strokeDashArray:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeLineCap:`stroke-linecap`,strokeLineJoin:`stroke-linejoin`,strokeMiterLimit:`stroke-miterlimit`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,underlinePosition:`underline-position`,underlineThickness:`underline-thickness`,unicodeBidi:`unicode-bidi`,unicodeRange:`unicode-range`,unitsPerEm:`units-per-em`,vAlphabetic:`v-alphabetic`,vHanging:`v-hanging`,vIdeographic:`v-ideographic`,vMathematical:`v-mathematical`,vectorEffect:`vector-effect`,vertAdvY:`vert-adv-y`,vertOriginX:`vert-origin-x`,vertOriginY:`vert-origin-y`,wordSpacing:`word-spacing`,writingMode:`writing-mode`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:commaOrSpaceSeparated,accentHeight:number,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:number,amplitude:number,arabicForm:null,ascent:number,attributeName:null,attributeType:null,azimuth:number,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:number,by:null,calcMode:null,capHeight:number,className:spaceSeparated,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:number,diffuseConstant:number,direction:null,display:null,dur:null,divisor:number,dominantBaseline:null,download:boolean,dx:null,dy:null,edgeMode:null,editable:null,elevation:number,enableBackground:null,end:null,event:null,exponent:number,externalResourcesRequired:null,fill:null,fillOpacity:number,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:commaSeparated,g2:commaSeparated,glyphName:commaSeparated,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:number,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:number,horizOriginX:number,horizOriginY:number,id:null,ideographic:number,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:number,k:number,k1:number,k2:number,k3:number,k4:number,kernelMatrix:commaOrSpaceSeparated,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:number,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:number,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:number,overlineThickness:number,paintOrder:null,panose1:null,path:null,pathLength:number,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:spaceSeparated,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:number,pointsAtY:number,pointsAtZ:number,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:commaOrSpaceSeparated,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:commaOrSpaceSeparated,rev:commaOrSpaceSeparated,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:commaOrSpaceSeparated,requiredFeatures:commaOrSpaceSeparated,requiredFonts:commaOrSpaceSeparated,requiredFormats:commaOrSpaceSeparated,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:number,specularExponent:number,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:number,strikethroughThickness:number,string:null,stroke:null,strokeDashArray:commaOrSpaceSeparated,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:number,strokeOpacity:number,strokeWidth:null,style:null,surfaceScale:number,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:commaOrSpaceSeparated,tabIndex:number,tableValues:null,target:null,targetX:number,targetY:number,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:commaOrSpaceSeparated,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:number,underlineThickness:number,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:number,values:null,vAlphabetic:number,vMathematical:number,vectorEffect:null,vHanging:number,vIdeographic:number,version:null,vertAdvY:number,vertOriginX:number,vertOriginY:number,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:number,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:caseSensitiveTransform}),xlink=create$15({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),xmlns=create$15({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:caseInsensitiveTransform}),xml=create$15({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),cap=/[A-Z]/g,dash=/-[a-z]/g,valid=/^data[-\w.:]+$/i;function find$1(e,t){let S=normalize$3(t),w=t,E=Info;if(S in e.normal)return e.property[e.normal[S]];if(S.length>4&&S.slice(0,4)===`data`&&valid.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(dash,camelcase$1);w=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!dash.test(e)){let S=e.replace(cap,kebab);S.charAt(0)!==`-`&&(S=`-`+S),t=`data`+S}}E=DefinedInfo}return new E(w,t)}function kebab(e){return`-`+e.toLowerCase()}function camelcase$1(e){return e.charAt(1).toUpperCase()}const html$1=merge([aria,html$2,xlink,xmlns,xml],`html`),svg=merge([aria,svg$1,xlink,xmlns,xml],`svg`);function parse$4(e){let t=[],S=String(e||``),w=S.indexOf(`,`),E=0,D=!1;for(;!D;){w===-1&&(w=S.length,D=!0);let e=S.slice(E,w).trim();(e||!D)&&t.push(e),E=w+1,w=S.indexOf(`,`,E)}return t}const search$3=/[#.]/g;function parseSelector(e,t){let S=e||``,w={},E=0,D,O;for(;E<S.length;){search$3.lastIndex=E;let e=search$3.exec(S),t=S.slice(E,e?e.index:S.length);t&&(D?D===`#`?w.id=t:Array.isArray(w.className)?w.className.push(t):w.className=[t]:O=t,E+=t.length),e&&(D=e[0],E++)}return{type:`element`,tagName:O||t||`div`,properties:w,children:[]}}function parse$3(e){let t=String(e||``).trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function createH(e,t,S){let w=S?createAdjustMap(S):void 0;function E(S,E,...D){let O;if(S==null){O={type:`root`,children:[]};let e=E;D.unshift(e)}else{O=parseSelector(S,t);let k=O.tagName.toLowerCase(),j=w?w.get(k):void 0;if(O.tagName=j||k,isChild(E))D.unshift(E);else for(let[t,S]of Object.entries(E))addProperty(e,O.properties,t,S)}for(let e of D)addChild(O.children,e);return O.type===`element`&&O.tagName===`template`&&(O.content={type:`root`,children:O.children},O.children=[]),O}return E}function isChild(e){if(typeof e!=`object`||!e||Array.isArray(e))return!0;if(typeof e.type!=`string`)return!1;let t=e,S=Object.keys(e);for(let e of S){let S=t[e];if(S&&typeof S==`object`){if(!Array.isArray(S))return!0;let e=S;for(let t of e)if(typeof t!=`number`&&typeof t!=`string`)return!0}}return!!(`children`in e&&Array.isArray(e.children))}function addProperty(e,t,S,w){let E=find$1(e,S),D;if(w!=null){if(typeof w==`number`){if(Number.isNaN(w))return;D=w}else D=typeof w==`boolean`?w:typeof w==`string`?E.spaceSeparated?parse$3(w):E.commaSeparated?parse$4(w):E.commaOrSpaceSeparated?parse$3(parse$4(w).join(` `)):parsePrimitive(E,E.property,w):Array.isArray(w)?[...w]:E.property===`style`?style(w):String(w);if(Array.isArray(D)){let e=[];for(let t of D)e.push(parsePrimitive(E,E.property,t));D=e}E.property===`className`&&Array.isArray(t.className)&&(D=t.className.concat(D)),t[E.property]=D}}function addChild(e,t){if(t!=null)if(typeof t==`number`||typeof t==`string`)e.push({type:`text`,value:String(t)});else if(Array.isArray(t))for(let S of t)addChild(e,S);else if(typeof t==`object`&&`type`in t)t.type===`root`?addChild(e,t.children):e.push(t);else throw Error("Expected node, nodes, or string, got `"+t+"`")}function parsePrimitive(e,t,S){if(typeof S==`string`){if(e.number&&S&&!Number.isNaN(Number(S)))return Number(S);if((e.boolean||e.overloadedBoolean)&&(S===``||normalize$3(S)===normalize$3(t)))return!0}return S}function style(e){let t=[];for(let[S,w]of Object.entries(e))t.push([S,w].join(`: `));return t.join(`; `)}function createAdjustMap(e){let t=new Map;for(let S of e)t.set(S.toLowerCase(),S);return t}const svgCaseSensitiveTagNames=`altGlyph.altGlyphDef.altGlyphItem.animateColor.animateMotion.animateTransform.clipPath.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feDistantLight.feDropShadow.feFlood.feFuncA.feFuncB.feFuncG.feFuncR.feGaussianBlur.feImage.feMerge.feMergeNode.feMorphology.feOffset.fePointLight.feSpecularLighting.feSpotLight.feTile.feTurbulence.foreignObject.glyphRef.linearGradient.radialGradient.solidColor.textArea.textPath`.split(`.`),h=createH(html$1,`div`),s=createH(svg,`g`,svgCaseSensitiveTagNames);function location$1(e){let t=String(e),S=[];return{toOffset:E,toPoint:w};function w(e){if(typeof e==`number`&&e>-1&&e<=t.length){let w=0;for(;;){let E=S[w];if(E===void 0){let e=next(t,S[w-1]);E=e===-1?t.length+1:e+1,S[w]=E}if(E>e)return{line:w+1,column:e-(w>0?S[w-1]:0)+1,offset:e};w++}}}function E(e){if(e&&typeof e.line==`number`&&typeof e.column==`number`&&!Number.isNaN(e.line)&&!Number.isNaN(e.column)){for(;S.length<e.line;){let e=S[S.length-1],w=next(t,e),E=w===-1?t.length+1:w+1;if(e===E)break;S.push(E)}let w=(e.line>1?S[e.line-2]:0)+e.column-1;if(w<S[e.line-1])return w}}}function next(e,t){let S=e.indexOf(`\r`,t),w=e.indexOf(`
|
|
235
|
+
`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(ListItemName2,this.editor.getAttributes(TextStyleName2)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=wrappingInputRule({find:orderedListInputRegex,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)&&(e=wrappingInputRule({find:orderedListInputRegex,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(TextStyleName2)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[e]}}),inputRegex$1=/^\s*(\[([( |x])?\])\s$/,TaskItem=Node3.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:e=>{let t=e.getAttribute(`data-checked`);return t===``||t===`true`},renderHTML:e=>({"data-checked":e.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:e,HTMLAttributes:t}){return[`li`,mergeAttributes(this.options.HTMLAttributes,t,{"data-type":this.name}),[`label`,[`input`,{type:`checkbox`,checked:e.attrs.checked?`checked`:null}],[`span`]],[`div`,0]]},parseMarkdown:(e,t)=>{let S=[];if(e.tokens&&e.tokens.length>0?S.push(t.createNode(`paragraph`,{},t.parseInline(e.tokens))):e.text?S.push(t.createNode(`paragraph`,{},[t.createNode(`text`,{text:e.text})])):S.push(t.createNode(`paragraph`,{},[])),e.nestedTokens&&e.nestedTokens.length>0){let w=t.parseChildren(e.nestedTokens);S.push(...w)}return t.createNode(`taskItem`,{checked:e.checked||!1},S)},renderMarkdown:(e,t)=>{var S;return renderNestedMarkdownContent(e,t,`- [${e.attrs?.checked?`x`:` `}] `)},addKeyboardShortcuts(){let e={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...e,Tab:()=>this.editor.commands.sinkListItem(this.name)}:e},addNodeView(){return({node:e,HTMLAttributes:t,getPos:S,editor:w})=>{let E=document.createElement(`li`),D=document.createElement(`label`),O=document.createElement(`span`),k=document.createElement(`input`),j=document.createElement(`div`),F=e=>{var t,S;k.ariaLabel=((t=this.options.a11y)?.checkboxLabel)?.call(t,e,k.checked)||`Task item checkbox for ${e.textContent||`empty task item`}`};F(e),D.contentEditable=`false`,k.type=`checkbox`,k.addEventListener(`mousedown`,e=>e.preventDefault()),k.addEventListener(`change`,t=>{if(!w.isEditable&&!this.options.onReadOnlyChecked){k.checked=!k.checked;return}let{checked:E}=t.target;w.isEditable&&typeof S==`function`&&w.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:e})=>{let t=S();if(typeof t!=`number`)return!1;let w=e.doc.nodeAt(t);return e.setNodeMarkup(t,void 0,{...w?.attrs,checked:E}),!0}).run(),!w.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(e,E)||(k.checked=!k.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([e,t])=>{E.setAttribute(e,t)}),E.dataset.checked=e.attrs.checked,k.checked=e.attrs.checked,D.append(k,O),E.append(D,j),Object.entries(t).forEach(([e,t])=>{E.setAttribute(e,t)});let L=new Set(Object.keys(t));return{dom:E,contentDOM:j,update:e=>{if(e.type!==this.type)return!1;E.dataset.checked=e.attrs.checked,k.checked=e.attrs.checked,F(e);let t=w.extensionManager.attributes,S=getRenderedAttributes(e,t),D=new Set(Object.keys(S)),O=this.options.HTMLAttributes;return L.forEach(e=>{D.has(e)||(e in O?E.setAttribute(e,O[e]):E.removeAttribute(e))}),Object.entries(S).forEach(([e,t])=>{t==null?e in O?E.setAttribute(e,O[e]):E.removeAttribute(e):E.setAttribute(e,t)}),L=D,!0}}}},addInputRules(){return[wrappingInputRule({find:inputRegex$1,type:this.type,getAttributes:e=>({checked:e[e.length-1]===`x`})})]}}),TaskList=Node3.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:e}){return[`ul`,mergeAttributes(this.options.HTMLAttributes,e,{"data-type":this.name}),0]},parseMarkdown:(e,t)=>t.createNode(`taskList`,{},t.parseChildren(e.items||[])),renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
|
|
236
|
+
`):``,markdownTokenizer:{name:`taskList`,level:`block`,start(e){var t;let S=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/)?.index;return S===void 0?-1:S},tokenize(e,t,S){let w=e=>{let t=parseIndentedBlocks(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:S.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:w},S);return t?[{type:`taskList`,raw:t.raw,items:t.items}]:S.blockTokens(e)},E=parseIndentedBlocks(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:S.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:w},S);if(E)return{type:`taskList`,raw:E.raw,items:E.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),ListKit=Extension.create({name:`listKit`,addExtensions(){let e=[];return this.options.bulletList!==!1&&e.push(BulletList.configure(this.options.bulletList)),this.options.listItem!==!1&&e.push(ListItem$1.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(ListKeymap.configure(this.options.listKeymap)),this.options.orderedList!==!1&&e.push(OrderedList.configure(this.options.orderedList)),this.options.taskItem!==!1&&e.push(TaskItem.configure(this.options.taskItem)),this.options.taskList!==!1&&e.push(TaskList.configure(this.options.taskList)),e}}),EMPTY_PARAGRAPH_MARKDOWN=` `,NBSP_CHAR=`\xA0`,Paragraph=Node3.create({name:`paragraph`,priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:`block`,content:`inline*`,parseHTML(){return[{tag:`p`}]},renderHTML({HTMLAttributes:e}){return[`p`,mergeAttributes(this.options.HTMLAttributes,e),0]},parseMarkdown:(e,t)=>{let S=e.tokens||[];if(S.length===1&&S[0].type===`image`)return t.parseChildren([S[0]]);let w=t.parseInline(S);return S.length===1&&S[0].type===`text`&&(S[0].raw===EMPTY_PARAGRAPH_MARKDOWN||S[0].text===EMPTY_PARAGRAPH_MARKDOWN||S[0].raw===NBSP_CHAR||S[0].text===NBSP_CHAR)&&w.length===1&&w[0].type===`text`&&(w[0].text===EMPTY_PARAGRAPH_MARKDOWN||w[0].text===NBSP_CHAR)?t.createNode(`paragraph`,void 0,[]):t.createNode(`paragraph`,void 0,w)},renderMarkdown:(e,t,S)=>{var w,E;if(!e)return``;let D=Array.isArray(e.content)?e.content:[];if(D.length===0){let e=Array.isArray(S?.previousNode?.content)?S.previousNode.content:[];return S?.previousNode?.type===`paragraph`&&e.length===0?EMPTY_PARAGRAPH_MARKDOWN:``}return t.renderChildren(D)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),inputRegex=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,pasteRegex=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Strike=Mark.create({name:`strike`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`s`},{tag:`del`},{tag:`strike`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`line-through`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`s`,mergeAttributes(this.options.HTMLAttributes,e),0]},markdownTokenName:`del`,parseMarkdown:(e,t)=>t.applyMark(`strike`,t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`~~${t.renderChildren(e)}~~`,addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[markInputRule({find:inputRegex,type:this.type})]},addPasteRules(){return[markPasteRule({find:pasteRegex,type:this.type})]}}),Text=Node3.create({name:`text`,group:`inline`,parseMarkdown:e=>({type:`text`,text:e.text||``}),renderMarkdown:e=>e.text||``}),Underline=Mark.create({name:`underline`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`u`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`underline`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`u`,mergeAttributes(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||`underline`,t.parseInline(e.tokens||[]))},renderMarkdown(e,t){return`++${t.renderChildren(e)}++`},markdownTokenizer:{name:`underline`,level:`inline`,start(e){return e.indexOf(`++`)},tokenize(e,t,S){let w=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!w)return;let E=w[2].trim();return{type:`underline`,raw:w[0],text:E,tokens:S.inlineTokens(E)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function dropCursor(e={}){return new Plugin({view(t){return new DropCursorView(t,e)}})}var DropCursorView=class{constructor(e,t){var S;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=t.width??1,this.color=t.color===!1?void 0:t.color||`black`,this.class=t.class,this.handlers=[`dragover`,`dragend`,`drop`,`dragleave`].map(t=>{let S=e=>{this[t](e)};return e.dom.addEventListener(t,S),{name:t,handler:S}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,S,w=this.editorView.dom,E=w.getBoundingClientRect(),D=E.width/w.offsetWidth,O=E.height/w.offsetHeight;if(t){let t=e.nodeBefore,w=e.nodeAfter;if(t||w){let e=this.editorView.nodeDOM(this.cursorPos-(t?t.nodeSize:0));if(e){let E=e.getBoundingClientRect(),D=t?E.bottom:E.top;t&&w&&(D=(D+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let k=this.width/2*O;S={left:E.left,right:E.right,top:D-k,bottom:D+k}}}}if(!S){let e=this.editorView.coordsAtPos(this.cursorPos),t=this.width/2*D;S={left:e.left-t,right:e.left+t,top:e.top,bottom:e.bottom}}let k=this.editorView.dom.offsetParent;this.element||(this.element=k.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 j,F;if(!k||k==document.body&&getComputedStyle(k).position==`static`)j=-pageXOffset,F=-pageYOffset;else{let e=k.getBoundingClientRect(),t=e.width/k.offsetWidth,S=e.height/k.offsetHeight;j=e.left-k.scrollLeft*t,F=e.top-k.scrollTop*S}this.element.style.left=(S.left-j)/D+`px`,this.element.style.top=(S.top-F)/O+`px`,this.element.style.width=(S.right-S.left)/D+`px`,this.element.style.height=(S.bottom-S.top)/O+`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}),S=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),w=S&&S.type.spec.disableDropCursor,E=typeof w==`function`?w(this.editorView,t,e):w;if(t&&!E){let e=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let t=dropPoint(this.editorView.state.doc,e,this.editorView.dragging.slice);t!=null&&(e=t)}this.setCursor(e),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}},GapCursor=class e extends Selection$1{constructor(e){super(e,e)}map(t,S){let w=t.resolve(S.map(this.head));return e.valid(w)?new e(w):Selection$1.near(w)}content(){return Slice.empty}eq(t){return t instanceof e&&t.head==this.head}toJSON(){return{type:`gapcursor`,pos:this.head}}static fromJSON(t,S){if(typeof S.pos!=`number`)throw RangeError(`Invalid input for GapCursor.fromJSON`);return new e(t.resolve(S.pos))}getBookmark(){return new GapBookmark(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!closedBefore(e)||!closedAfter(e))return!1;let S=t.type.spec.allowGapCursor;if(S!=null)return S;let w=t.contentMatchAt(e.index()).defaultType;return w&&w.isTextblock}static findGapCursorFrom(t,S,w=!1){search:for(;;){if(!w&&e.valid(t))return t;let E=t.pos,D=null;for(let w=t.depth;;w--){let O=t.node(w);if(S>0?t.indexAfter(w)<O.childCount:t.index(w)>0){D=O.child(S>0?t.indexAfter(w):t.index(w)-1);break}else if(w==0)return null;E+=S;let k=t.doc.resolve(E);if(e.valid(k))return k}for(;;){let O=S>0?D.firstChild:D.lastChild;if(!O){if(D.isAtom&&!D.isText&&!NodeSelection.isSelectable(D)){t=t.doc.resolve(E+D.nodeSize*S),w=!1;continue search}break}D=O,E+=S;let k=t.doc.resolve(E);if(e.valid(k))return k}return null}}};GapCursor.prototype.visible=!1,GapCursor.findFrom=GapCursor.findGapCursorFrom,Selection$1.jsonID(`gapcursor`,GapCursor);var GapBookmark=class e{constructor(e){this.pos=e}map(t){return new e(t.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return GapCursor.valid(t)?new GapCursor(t):Selection$1.near(t)}};function needsGap(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}function closedBefore(e){for(let t=e.depth;t>=0;t--){let S=e.index(t),w=e.node(t);if(S==0){if(w.type.spec.isolating)return!0;continue}for(let e=w.child(S-1);;e=e.lastChild){if(e.childCount==0&&!e.inlineContent||needsGap(e.type))return!0;if(e.inlineContent)return!1}}return!0}function closedAfter(e){for(let t=e.depth;t>=0;t--){let S=e.indexAfter(t),w=e.node(t);if(S==w.childCount){if(w.type.spec.isolating)return!0;continue}for(let e=w.child(S);;e=e.firstChild){if(e.childCount==0&&!e.inlineContent||needsGap(e.type))return!0;if(e.inlineContent)return!1}}return!0}function gapCursor(){return new Plugin({props:{decorations:drawGapCursor,createSelectionBetween(e,t,S){return t.pos==S.pos&&GapCursor.valid(S)?new GapCursor(S):null},handleClick,handleKeyDown,handleDOMEvents:{beforeinput}}})}const handleKeyDown=keydownHandler({ArrowLeft:arrow(`horiz`,-1),ArrowRight:arrow(`horiz`,1),ArrowUp:arrow(`vert`,-1),ArrowDown:arrow(`vert`,1)});function arrow(e,t){let S=e==`vert`?t>0?`down`:`up`:t>0?`right`:`left`;return function(e,w,E){let D=e.selection,O=t>0?D.$to:D.$from,k=D.empty;if(D instanceof TextSelection){if(!E.endOfTextblock(S)||O.depth==0)return!1;k=!1,O=e.doc.resolve(t>0?O.after():O.before())}let j=GapCursor.findGapCursorFrom(O,t,k);return j?(w&&w(e.tr.setSelection(new GapCursor(j))),!0):!1}}function handleClick(e,t,S){if(!e||!e.editable)return!1;let w=e.state.doc.resolve(t);if(!GapCursor.valid(w))return!1;let E=e.posAtCoords({left:S.clientX,top:S.clientY});return E&&E.inside>-1&&NodeSelection.isSelectable(e.state.doc.nodeAt(E.inside))?!1:(e.dispatch(e.state.tr.setSelection(new GapCursor(w))),!0)}function beforeinput(e,t){if(t.inputType!=`insertCompositionText`||!(e.state.selection instanceof GapCursor))return!1;let{$from:S}=e.state.selection,w=S.parent.contentMatchAt(S.index()).findWrapping(e.state.schema.nodes.text);if(!w)return!1;let E=Fragment.empty;for(let e=w.length-1;e>=0;e--)E=Fragment.from(w[e].createAndFill(null,E));let D=e.state.tr.replace(S.pos,S.pos,new Slice(E,0,0));return D.setSelection(TextSelection.near(D.doc.resolve(S.pos+1))),e.dispatch(D),!1}function drawGapCursor(e){if(!(e.selection instanceof GapCursor))return null;let t=document.createElement(`div`);return t.className=`ProseMirror-gapcursor`,DecorationSet.create(e.doc,[Decoration.widget(e.selection.head,t,{key:`gapcursor`})])}var GOOD_LEAF_SIZE=200,RopeSequence=function(){};RopeSequence.prototype.append=function(e){return e.length?(e=RopeSequence.from(e),!this.length&&e||e.length<GOOD_LEAF_SIZE&&this.leafAppend(e)||this.length<GOOD_LEAF_SIZE&&e.leafPrepend(this)||this.appendInner(e)):this},RopeSequence.prototype.prepend=function(e){return e.length?RopeSequence.from(e).append(this):this},RopeSequence.prototype.appendInner=function(e){return new Append(this,e)},RopeSequence.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?RopeSequence.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},RopeSequence.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},RopeSequence.prototype.forEach=function(e,t,S){t===void 0&&(t=0),S===void 0&&(S=this.length),t<=S?this.forEachInner(e,t,S,0):this.forEachInvertedInner(e,t,S,0)},RopeSequence.prototype.map=function(e,t,S){t===void 0&&(t=0),S===void 0&&(S=this.length);var w=[];return this.forEach(function(t,S){return w.push(e(t,S))},t,S),w},RopeSequence.from=function(e){return e instanceof RopeSequence?e:e&&e.length?new Leaf(e):RopeSequence.empty};var Leaf=function(e){function t(t){e.call(this),this.values=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var S={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,S){return e==0&&S==this.length?this:new t(this.values.slice(e,S))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,S,w){for(var E=t;E<S;E++)if(e(this.values[E],w+E)===!1)return!1},t.prototype.forEachInvertedInner=function(e,t,S,w){for(var E=t-1;E>=S;E--)if(e(this.values[E],w+E)===!1)return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=GOOD_LEAF_SIZE)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=GOOD_LEAF_SIZE)return new t(e.flatten().concat(this.values))},S.length.get=function(){return this.values.length},S.depth.get=function(){return 0},Object.defineProperties(t.prototype,S),t}(RopeSequence);RopeSequence.empty=new Leaf([]);var Append=function(e){function t(t,S){e.call(this),this.left=t,this.right=S,this.length=t.length+S.length,this.depth=Math.max(t.depth,S.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,S,w){var E=this.left.length;if(t<E&&this.left.forEachInner(e,t,Math.min(S,E),w)===!1||S>E&&this.right.forEachInner(e,Math.max(t-E,0),Math.min(this.length,S)-E,w+E)===!1)return!1},t.prototype.forEachInvertedInner=function(e,t,S,w){var E=this.left.length;if(t>E&&this.right.forEachInvertedInner(e,t-E,Math.max(S,E)-E,w+E)===!1||S<E&&this.left.forEachInvertedInner(e,Math.min(t,E),S,w)===!1)return!1},t.prototype.sliceInner=function(e,t){if(e==0&&t==this.length)return this;var S=this.left.length;return t<=S?this.left.slice(e,t):e>=S?this.right.slice(e-S,t-S):this.left.slice(e,S).append(this.right.slice(0,t-S))},t.prototype.leafAppend=function(e){var S=this.right.leafAppend(e);if(S)return new t(this.left,S)},t.prototype.leafPrepend=function(e){var S=this.left.leafPrepend(e);if(S)return new t(S,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(RopeSequence);const max_empty_items=500;var Branch=class e{constructor(e,t){this.items=e,this.eventCount=t}popEvent(t,S){if(this.eventCount==0)return null;let w=this.items.length;for(;;w--)if(this.items.get(w-1).selection){--w;break}let E,D;S&&(E=this.remapping(w,this.items.length),D=E.maps.length);let O=t.tr,k,j,F=[],L=[];return this.items.forEach((t,S)=>{if(!t.step){E||(E=this.remapping(w,S+1),D=E.maps.length),D--,L.push(t);return}if(E){L.push(new Item$1(t.map));let e=t.step.map(E.slice(D)),S;e&&O.maybeStep(e).doc&&(S=O.mapping.maps[O.mapping.maps.length-1],F.push(new Item$1(S,void 0,void 0,F.length+L.length))),D--,S&&E.appendMap(S,D)}else O.maybeStep(t.step);if(t.selection)return k=E?t.selection.map(E.slice(D)):t.selection,j=new e(this.items.slice(0,w).append(L.reverse().concat(F)),this.eventCount-1),!1},this.items.length,0),{remaining:j,transform:O,selection:k}}addTransform(t,S,w,E){let D=[],O=this.eventCount,k=this.items,j=!E&&k.length?k.get(k.length-1):null;for(let e=0;e<t.steps.length;e++){let w=t.steps[e].invert(t.docs[e]),F=new Item$1(t.mapping.maps[e],w,S),L;(L=j&&j.merge(F))&&(F=L,e?D.pop():k=k.slice(0,k.length-1)),D.push(F),S&&=(O++,void 0),E||(j=F)}let F=O-w.depth;return F>DEPTH_OVERFLOW&&(k=cutOffEvents(k,F),O-=F),new e(k.append(D),O)}remapping(e,t){let S=new Mapping;return this.items.forEach((t,w)=>{let E=t.mirrorOffset!=null&&w-t.mirrorOffset>=e?S.maps.length-t.mirrorOffset:void 0;S.appendMap(t.map,E)},e,t),S}addMaps(t){return this.eventCount==0?this:new e(this.items.append(t.map(e=>new Item$1(e))),this.eventCount)}rebased(t,S){if(!this.eventCount)return this;let w=[],E=Math.max(0,this.items.length-S),D=t.mapping,O=t.steps.length,k=this.eventCount;this.items.forEach(e=>{e.selection&&k--},E);let j=S;this.items.forEach(e=>{let S=D.getMirror(--j);if(S==null)return;O=Math.min(O,S);let E=D.maps[S];if(e.step){let O=t.steps[S].invert(t.docs[S]),F=e.selection&&e.selection.map(D.slice(j+1,S));F&&k++,w.push(new Item$1(E,O,F))}else w.push(new Item$1(E))},E);let F=[];for(let e=S;e<O;e++)F.push(new Item$1(D.maps[e]));let L=new e(this.items.slice(0,E).append(F).append(w),k);return L.emptyItemCount()>max_empty_items&&(L=L.compress(this.items.length-w.length)),L}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(t=this.items.length){let S=this.remapping(0,t),w=S.maps.length,E=[],D=0;return this.items.forEach((e,O)=>{if(O>=t)E.push(e),e.selection&&D++;else if(e.step){let t=e.step.map(S.slice(w)),O=t&&t.getMap();if(w--,O&&S.appendMap(O,w),t){let k=e.selection&&e.selection.map(S.slice(w));k&&D++;let j=new Item$1(O.invert(),t,k),F,L=E.length-1;(F=E.length&&E[L].merge(j))?E[L]=F:E.push(j)}}else e.map&&w--},this.items.length,0),new e(RopeSequence.from(E.reverse()),D)}};Branch.empty=new Branch(RopeSequence.empty,0);function cutOffEvents(e,t){let S;return e.forEach((e,w)=>{if(e.selection&&t--==0)return S=w,!1}),e.slice(S)}var Item$1=class e{constructor(e,t,S,w){this.map=e,this.step=t,this.selection=S,this.mirrorOffset=w}merge(t){if(this.step&&t.step&&!t.selection){let S=t.step.merge(this.step);if(S)return new e(S.getMap().invert(),S,this.selection)}}},HistoryState=class{constructor(e,t,S,w,E){this.done=e,this.undone=t,this.prevRanges=S,this.prevTime=w,this.prevComposition=E}};const DEPTH_OVERFLOW=20;function applyTransaction(e,t,S,w){let E=S.getMeta(historyKey),D;if(E)return E.historyState;S.getMeta(closeHistoryKey)&&(e=new HistoryState(e.done,e.undone,null,0,-1));let O=S.getMeta(`appendedTransaction`);if(S.steps.length==0)return e;if(O&&O.getMeta(historyKey))return O.getMeta(historyKey).redo?new HistoryState(e.done.addTransform(S,void 0,w,mustPreserveItems(t)),e.undone,rangesFor(S.mapping.maps),e.prevTime,e.prevComposition):new HistoryState(e.done,e.undone.addTransform(S,void 0,w,mustPreserveItems(t)),null,e.prevTime,e.prevComposition);if(S.getMeta(`addToHistory`)!==!1&&!(O&&O.getMeta(`addToHistory`)===!1)){let E=S.getMeta(`composition`),D=e.prevTime==0||!O&&e.prevComposition!=E&&(e.prevTime<(S.time||0)-w.newGroupDelay||!isAdjacentTo(S,e.prevRanges)),k=O?mapRanges(e.prevRanges,S.mapping):rangesFor(S.mapping.maps);return new HistoryState(e.done.addTransform(S,D?t.selection.getBookmark():void 0,w,mustPreserveItems(t)),Branch.empty,k,S.time,E??e.prevComposition)}else if(D=S.getMeta(`rebased`))return new HistoryState(e.done.rebased(S,D),e.undone.rebased(S,D),mapRanges(e.prevRanges,S.mapping),e.prevTime,e.prevComposition);else return new HistoryState(e.done.addMaps(S.mapping.maps),e.undone.addMaps(S.mapping.maps),mapRanges(e.prevRanges,S.mapping),e.prevTime,e.prevComposition)}function isAdjacentTo(e,t){if(!t)return!1;if(!e.docChanged)return!0;let S=!1;return e.mapping.maps[0].forEach((e,w)=>{for(let E=0;E<t.length;E+=2)e<=t[E+1]&&w>=t[E]&&(S=!0)}),S}function rangesFor(e){let t=[];for(let S=e.length-1;S>=0&&t.length==0;S--)e[S].forEach((e,S,w,E)=>t.push(w,E));return t}function mapRanges(e,t){if(!e)return null;let S=[];for(let w=0;w<e.length;w+=2){let E=t.map(e[w],1),D=t.map(e[w+1],-1);E<=D&&S.push(E,D)}return S}function histTransaction(e,t,S){let w=mustPreserveItems(t),E=historyKey.get(t).spec.config,D=(S?e.undone:e.done).popEvent(t,w);if(!D)return null;let O=D.selection.resolve(D.transform.doc),k=(S?e.done:e.undone).addTransform(D.transform,t.selection.getBookmark(),E,w),j=new HistoryState(S?k:D.remaining,S?D.remaining:k,null,0,-1);return D.transform.setSelection(O).setMeta(historyKey,{redo:S,historyState:j})}let cachedPreserveItems=!1,cachedPreserveItemsPlugins=null;function mustPreserveItems(e){let t=e.plugins;if(cachedPreserveItemsPlugins!=t){cachedPreserveItems=!1,cachedPreserveItemsPlugins=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){cachedPreserveItems=!0;break}}return cachedPreserveItems}const historyKey=new PluginKey(`history`),closeHistoryKey=new PluginKey(`closeHistory`);function history(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new Plugin({key:historyKey,state:{init(){return new HistoryState(Branch.empty,Branch.empty,null,0,-1)},apply(t,S,w){return applyTransaction(S,w,t,e)}},config:e,props:{handleDOMEvents:{beforeinput(e,t){let S=t.inputType,w=S==`historyUndo`?undo:S==`historyRedo`?redo:null;return!w||!e.editable?!1:(t.preventDefault(),w(e.state,e.dispatch))}}}})}function buildCommand(e,t){return(S,w)=>{let E=historyKey.getState(S);if(!E||(e?E.undone:E.done).eventCount==0)return!1;if(w){let D=histTransaction(E,S,e);D&&w(t?D.scrollIntoView():D)}return!0}}const undo=buildCommand(!1,!0),redo=buildCommand(!0,!0),undoNoScroll=buildCommand(!1,!1),redoNoScroll=buildCommand(!0,!1);var CharacterCount=Extension.create({name:`characterCount`,addOptions(){return{limit:null,mode:`textSize`,textCounter:e=>e.length,wordCounter:e=>e.split(` `).filter(e=>e!==``).length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=e=>{let t=e?.node||this.editor.state.doc;if((e?.mode||this.options.mode)===`textSize`){let e=t.textBetween(0,t.content.size,void 0,` `);return this.options.textCounter(e)}return t.nodeSize},this.storage.words=e=>{let t=e?.node||this.editor.state.doc,S=t.textBetween(0,t.content.size,` `,` `);return this.options.wordCounter(S)}},addProseMirrorPlugins(){let e=!1;return[new Plugin({key:new PluginKey(`characterCount`),appendTransaction:(t,S,w)=>{if(e)return;let E=this.options.limit;if(E==null||E===0){e=!0;return}let D=this.storage.characters({node:w.doc});if(D>E){let t=D-E,S=0,O=t;console.warn(`[CharacterCount] Initial content exceeded limit of ${E} characters. Content was automatically trimmed.`);let k=w.tr.deleteRange(0,O);return e=!0,k}e=!0},filterTransaction:(e,t)=>{let S=this.options.limit;if(!e.docChanged||S===0||S==null)return!0;let w=this.storage.characters({node:t.doc}),E=this.storage.characters({node:e.doc});if(E<=S||w>S&&E>S&&E<=w)return!0;if(w>S&&E>S&&E>w||!e.getMeta(`paste`))return!1;let D=e.selection.$head.pos,O=D-(E-S),k=D;return e.deleteRange(O,k),!(this.storage.characters({node:e.doc})>S)}})]}}),Dropcursor=Extension.create({name:`dropCursor`,addOptions(){return{color:`currentColor`,width:1,class:void 0}},addProseMirrorPlugins(){return[dropCursor(this.options)]}}),Focus=Extension.create({name:`focus`,addOptions(){return{className:`has-focus`,mode:`all`}},addProseMirrorPlugins(){return[new Plugin({key:new PluginKey(`focus`),props:{decorations:({doc:e,selection:t})=>{let{isEditable:S,isFocused:w}=this.editor,{anchor:E}=t,D=[];if(!S||!w)return DecorationSet.create(e,[]);let O=0;this.options.mode===`deepest`&&e.descendants((e,t)=>{if(!e.isText){if(!(E>=t&&E<=t+e.nodeSize-1))return!1;O+=1}});let k=0;return e.descendants((e,t)=>{if(e.isText||!(E>=t&&E<=t+e.nodeSize-1))return!1;if(k+=1,this.options.mode===`deepest`&&O-k>0||this.options.mode===`shallowest`&&k>1)return this.options.mode===`deepest`;D.push(Decoration.node(t,t+e.nodeSize,{class:this.options.className}))}),DecorationSet.create(e,D)}}})]}}),Gapcursor=Extension.create({name:`gapCursor`,addProseMirrorPlugins(){return[gapCursor()]},extendNodeSchema(e){var t;return{allowGapCursor:callOrReturn(getExtensionField(e,`allowGapCursor`,{name:e.name,options:e.options,storage:e.storage}))??null}}}),DEFAULT_DATA_ATTRIBUTE=`placeholder`;function preparePlaceholderAttribute(e){return e.replace(/\s+/g,`-`).replace(/[^a-zA-Z0-9-]/g,``).replace(/^[0-9-]+/,``).replace(/^-+/,``).toLowerCase()}var Placeholder=Extension.create({name:`placeholder`,addOptions(){return{emptyEditorClass:`is-editor-empty`,emptyNodeClass:`is-empty`,dataAttribute:DEFAULT_DATA_ATTRIBUTE,placeholder:`Write something …`,showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){let e=this.options.dataAttribute?`data-${preparePlaceholderAttribute(this.options.dataAttribute)}`:`data-${DEFAULT_DATA_ATTRIBUTE}`;return[new Plugin({key:new PluginKey(`placeholder`),props:{decorations:({doc:t,selection:S})=>{let w=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:E}=S,D=[];if(!w)return null;let O=this.editor.isEmpty;return t.descendants((t,S)=>{let w=E>=S&&E<=S+t.nodeSize,k=!t.isLeaf&&isNodeEmpty(t);if(!t.type.isTextblock)return this.options.includeChildren;if((w||!this.options.showOnlyCurrent)&&k){let E=[this.options.emptyNodeClass];O&&E.push(this.options.emptyEditorClass);let k=Decoration.node(S,S+t.nodeSize,{class:E.join(` `),[e]:typeof this.options.placeholder==`function`?this.options.placeholder({editor:this.editor,node:t,pos:S,hasAnchor:w}):this.options.placeholder});D.push(k)}return this.options.includeChildren}),DecorationSet.create(t,D)}}})]}}),Selection=Extension.create({name:`selection`,addOptions(){return{className:`selection`}},addProseMirrorPlugins(){let{editor:e,options:t}=this;return[new Plugin({key:new PluginKey(`selection`),props:{decorations(S){return S.selection.empty||e.isFocused||!e.isEditable||isNodeSelection(S.selection)||e.view.dragging?null:DecorationSet.create(S.doc,[Decoration.inline(S.selection.from,S.selection.to,{class:t.className})])}}})]}}),skipTrailingNodeMeta=`skipTrailingNode`;function nodeEqualsType({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||t?.type===e}var TrailingNode=Extension.create({name:`trailingNode`,addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var e;let t=new PluginKey(this.name),S=this.options.node||this.editor.schema.topNodeType.contentMatch.defaultType?.name||`paragraph`,w=Object.entries(this.editor.schema.nodes).map(([,e])=>e).filter(e=>(this.options.notAfter||[]).concat(S).includes(e.name));return[new Plugin({key:t,appendTransaction:(e,w,E)=>{let{doc:D,tr:O,schema:k}=E,j=t.getState(E),F=D.content.size,L=k.nodes[S];if(!e.some(e=>e.getMeta(`skipTrailingNode`))&&j)return O.insert(F,L.create())},state:{init:(e,t)=>{let S=t.tr.doc.lastChild;return!nodeEqualsType({node:S,types:w})},apply:(e,t)=>{if(!e.docChanged||e.getMeta(`__uniqueIDTransaction`))return t;let S=e.doc.lastChild;return!nodeEqualsType({node:S,types:w})}}})]}}),UndoRedo=Extension.create({name:`undoRedo`,addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>undo(e,t),redo:()=>({state:e,dispatch:t})=>redo(e,t)}},addProseMirrorPlugins(){return[history(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()}}}),StarterKit=Extension.create({name:`starterKit`,addExtensions(){var e,t,S,w;let E=[];return this.options.bold!==!1&&E.push(Bold.configure(this.options.bold)),this.options.blockquote!==!1&&E.push(Blockquote.configure(this.options.blockquote)),this.options.bulletList!==!1&&E.push(BulletList.configure(this.options.bulletList)),this.options.code!==!1&&E.push(Code.configure(this.options.code)),this.options.codeBlock!==!1&&E.push(CodeBlock.configure(this.options.codeBlock)),this.options.document!==!1&&E.push(Document$2.configure(this.options.document)),this.options.dropcursor!==!1&&E.push(Dropcursor.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&E.push(Gapcursor.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&E.push(HardBreak.configure(this.options.hardBreak)),this.options.heading!==!1&&E.push(Heading.configure(this.options.heading)),this.options.undoRedo!==!1&&E.push(UndoRedo.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&E.push(HorizontalRule.configure(this.options.horizontalRule)),this.options.italic!==!1&&E.push(Italic.configure(this.options.italic)),this.options.listItem!==!1&&E.push(ListItem$1.configure(this.options.listItem)),this.options.listKeymap!==!1&&E.push(ListKeymap.configure(this.options?.listKeymap)),this.options.link!==!1&&E.push(Link.configure(this.options?.link)),this.options.orderedList!==!1&&E.push(OrderedList.configure(this.options.orderedList)),this.options.paragraph!==!1&&E.push(Paragraph.configure(this.options.paragraph)),this.options.strike!==!1&&E.push(Strike.configure(this.options.strike)),this.options.text!==!1&&E.push(Text.configure(this.options.text)),this.options.underline!==!1&&E.push(Underline.configure(this.options?.underline)),this.options.trailingNode!==!1&&E.push(TrailingNode.configure(this.options?.trailingNode)),E}}),index_default=StarterKit;function ok$2(){}var Schema=class{constructor(e,t,S){this.normal=t,this.property=e,S&&(this.space=S)}};Schema.prototype.normal={},Schema.prototype.property={},Schema.prototype.space=void 0;function merge(e,t){let S={},w={};for(let t of e)Object.assign(S,t.property),Object.assign(w,t.normal);return new Schema(S,w,t)}function normalize$3(e){return e.toLowerCase()}var Info=class{constructor(e,t){this.attribute=t,this.property=e}};Info.prototype.attribute=``,Info.prototype.booleanish=!1,Info.prototype.boolean=!1,Info.prototype.commaOrSpaceSeparated=!1,Info.prototype.commaSeparated=!1,Info.prototype.defined=!1,Info.prototype.mustUseProperty=!1,Info.prototype.number=!1,Info.prototype.overloadedBoolean=!1,Info.prototype.property=``,Info.prototype.spaceSeparated=!1,Info.prototype.space=void 0;var types_exports=__exportAll({boolean:()=>boolean,booleanish:()=>booleanish,commaOrSpaceSeparated:()=>commaOrSpaceSeparated,commaSeparated:()=>commaSeparated,number:()=>number,overloadedBoolean:()=>overloadedBoolean,spaceSeparated:()=>spaceSeparated});let powers=0;const boolean=increment(),booleanish=increment(),overloadedBoolean=increment(),number=increment(),spaceSeparated=increment(),commaSeparated=increment(),commaOrSpaceSeparated=increment();function increment(){return 2**++powers}const checks=Object.keys(types_exports);var DefinedInfo=class extends Info{constructor(e,t,S,w){let E=-1;if(super(e,t),mark(this,`space`,w),typeof S==`number`)for(;++E<checks.length;){let e=checks[E];mark(this,checks[E],(S&types_exports[e])===types_exports[e])}}};DefinedInfo.prototype.defined=!0;function mark(e,t,S){S&&(e[t]=S)}function create$15(e){let t={},S={};for(let[w,E]of Object.entries(e.properties)){let D=new DefinedInfo(w,e.transform(e.attributes||{},w),E,e.space);e.mustUseProperty&&e.mustUseProperty.includes(w)&&(D.mustUseProperty=!0),t[w]=D,S[normalize$3(w)]=w,S[normalize$3(D.attribute)]=w}return new Schema(t,S,e.space)}const aria=create$15({properties:{ariaActiveDescendant:null,ariaAtomic:booleanish,ariaAutoComplete:null,ariaBusy:booleanish,ariaChecked:booleanish,ariaColCount:number,ariaColIndex:number,ariaColSpan:number,ariaControls:spaceSeparated,ariaCurrent:null,ariaDescribedBy:spaceSeparated,ariaDetails:null,ariaDisabled:booleanish,ariaDropEffect:spaceSeparated,ariaErrorMessage:null,ariaExpanded:booleanish,ariaFlowTo:spaceSeparated,ariaGrabbed:booleanish,ariaHasPopup:null,ariaHidden:booleanish,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:spaceSeparated,ariaLevel:number,ariaLive:null,ariaModal:booleanish,ariaMultiLine:booleanish,ariaMultiSelectable:booleanish,ariaOrientation:null,ariaOwns:spaceSeparated,ariaPlaceholder:null,ariaPosInSet:number,ariaPressed:booleanish,ariaReadOnly:booleanish,ariaRelevant:null,ariaRequired:booleanish,ariaRoleDescription:spaceSeparated,ariaRowCount:number,ariaRowIndex:number,ariaRowSpan:number,ariaSelected:booleanish,ariaSetSize:number,ariaSort:null,ariaValueMax:number,ariaValueMin:number,ariaValueNow:number,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function caseSensitiveTransform(e,t){return t in e?e[t]:t}function caseInsensitiveTransform(e,t){return caseSensitiveTransform(e,t.toLowerCase())}const html$2=create$15({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:commaSeparated,acceptCharset:spaceSeparated,accessKey:spaceSeparated,action:null,allow:null,allowFullScreen:boolean,allowPaymentRequest:boolean,allowUserMedia:boolean,alt:null,as:null,async:boolean,autoCapitalize:null,autoComplete:spaceSeparated,autoFocus:boolean,autoPlay:boolean,blocking:spaceSeparated,capture:null,charSet:null,checked:boolean,cite:null,className:spaceSeparated,cols:number,colSpan:null,content:null,contentEditable:booleanish,controls:boolean,controlsList:spaceSeparated,coords:number|commaSeparated,crossOrigin:null,data:null,dateTime:null,decoding:null,default:boolean,defer:boolean,dir:null,dirName:null,disabled:boolean,download:overloadedBoolean,draggable:booleanish,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:boolean,formTarget:null,headers:spaceSeparated,height:number,hidden:overloadedBoolean,high:number,href:null,hrefLang:null,htmlFor:spaceSeparated,httpEquiv:spaceSeparated,id:null,imageSizes:null,imageSrcSet:null,inert:boolean,inputMode:null,integrity:null,is:null,isMap:boolean,itemId:null,itemProp:spaceSeparated,itemRef:spaceSeparated,itemScope:boolean,itemType:spaceSeparated,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:boolean,low:number,manifest:null,max:null,maxLength:number,media:null,method:null,min:null,minLength:number,multiple:boolean,muted:boolean,name:null,nonce:null,noModule:boolean,noValidate:boolean,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:boolean,optimum:number,pattern:null,ping:spaceSeparated,placeholder:null,playsInline:boolean,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:boolean,referrerPolicy:null,rel:spaceSeparated,required:boolean,reversed:boolean,rows:number,rowSpan:number,sandbox:spaceSeparated,scope:null,scoped:boolean,seamless:boolean,selected:boolean,shadowRootClonable:boolean,shadowRootDelegatesFocus:boolean,shadowRootMode:null,shape:null,size:number,sizes:null,slot:null,span:number,spellCheck:booleanish,src:null,srcDoc:null,srcLang:null,srcSet:null,start:number,step:null,style:null,tabIndex:number,target:null,title:null,translate:null,type:null,typeMustMatch:boolean,useMap:null,value:booleanish,width:number,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:spaceSeparated,axis:null,background:null,bgColor:null,border:number,borderColor:null,bottomMargin:number,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:boolean,declare:boolean,event:null,face:null,frame:null,frameBorder:null,hSpace:number,leftMargin:number,link:null,longDesc:null,lowSrc:null,marginHeight:number,marginWidth:number,noResize:boolean,noHref:boolean,noShade:boolean,noWrap:boolean,object:null,profile:null,prompt:null,rev:null,rightMargin:number,rules:null,scheme:null,scrolling:booleanish,standby:null,summary:null,text:null,topMargin:number,valueType:null,version:null,vAlign:null,vLink:null,vSpace:number,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:boolean,disableRemotePlayback:boolean,prefix:null,property:null,results:number,security:null,unselectable:null},space:`html`,transform:caseInsensitiveTransform}),svg$1=create$15({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,dominantBaseline:`dominant-baseline`,enableBackground:`enable-background`,fillOpacity:`fill-opacity`,fillRule:`fill-rule`,floodColor:`flood-color`,floodOpacity:`flood-opacity`,fontFamily:`font-family`,fontSize:`font-size`,fontSizeAdjust:`font-size-adjust`,fontStretch:`font-stretch`,fontStyle:`font-style`,fontVariant:`font-variant`,fontWeight:`font-weight`,glyphName:`glyph-name`,glyphOrientationHorizontal:`glyph-orientation-horizontal`,glyphOrientationVertical:`glyph-orientation-vertical`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,renderingIntent:`rendering-intent`,shapeRendering:`shape-rendering`,stopColor:`stop-color`,stopOpacity:`stop-opacity`,strikethroughPosition:`strikethrough-position`,strikethroughThickness:`strikethrough-thickness`,strokeDashArray:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeLineCap:`stroke-linecap`,strokeLineJoin:`stroke-linejoin`,strokeMiterLimit:`stroke-miterlimit`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,underlinePosition:`underline-position`,underlineThickness:`underline-thickness`,unicodeBidi:`unicode-bidi`,unicodeRange:`unicode-range`,unitsPerEm:`units-per-em`,vAlphabetic:`v-alphabetic`,vHanging:`v-hanging`,vIdeographic:`v-ideographic`,vMathematical:`v-mathematical`,vectorEffect:`vector-effect`,vertAdvY:`vert-adv-y`,vertOriginX:`vert-origin-x`,vertOriginY:`vert-origin-y`,wordSpacing:`word-spacing`,writingMode:`writing-mode`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:commaOrSpaceSeparated,accentHeight:number,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:number,amplitude:number,arabicForm:null,ascent:number,attributeName:null,attributeType:null,azimuth:number,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:number,by:null,calcMode:null,capHeight:number,className:spaceSeparated,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:number,diffuseConstant:number,direction:null,display:null,dur:null,divisor:number,dominantBaseline:null,download:boolean,dx:null,dy:null,edgeMode:null,editable:null,elevation:number,enableBackground:null,end:null,event:null,exponent:number,externalResourcesRequired:null,fill:null,fillOpacity:number,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:commaSeparated,g2:commaSeparated,glyphName:commaSeparated,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:number,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:number,horizOriginX:number,horizOriginY:number,id:null,ideographic:number,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:number,k:number,k1:number,k2:number,k3:number,k4:number,kernelMatrix:commaOrSpaceSeparated,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:number,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:number,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:number,overlineThickness:number,paintOrder:null,panose1:null,path:null,pathLength:number,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:spaceSeparated,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:number,pointsAtY:number,pointsAtZ:number,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:commaOrSpaceSeparated,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:commaOrSpaceSeparated,rev:commaOrSpaceSeparated,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:commaOrSpaceSeparated,requiredFeatures:commaOrSpaceSeparated,requiredFonts:commaOrSpaceSeparated,requiredFormats:commaOrSpaceSeparated,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:number,specularExponent:number,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:number,strikethroughThickness:number,string:null,stroke:null,strokeDashArray:commaOrSpaceSeparated,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:number,strokeOpacity:number,strokeWidth:null,style:null,surfaceScale:number,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:commaOrSpaceSeparated,tabIndex:number,tableValues:null,target:null,targetX:number,targetY:number,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:commaOrSpaceSeparated,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:number,underlineThickness:number,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:number,values:null,vAlphabetic:number,vMathematical:number,vectorEffect:null,vHanging:number,vIdeographic:number,version:null,vertAdvY:number,vertOriginX:number,vertOriginY:number,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:number,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:caseSensitiveTransform}),xlink=create$15({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),xmlns=create$15({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:caseInsensitiveTransform}),xml=create$15({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),cap=/[A-Z]/g,dash=/-[a-z]/g,valid=/^data[-\w.:]+$/i;function find$1(e,t){let S=normalize$3(t),w=t,E=Info;if(S in e.normal)return e.property[e.normal[S]];if(S.length>4&&S.slice(0,4)===`data`&&valid.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(dash,camelcase$1);w=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!dash.test(e)){let S=e.replace(cap,kebab);S.charAt(0)!==`-`&&(S=`-`+S),t=`data`+S}}E=DefinedInfo}return new E(w,t)}function kebab(e){return`-`+e.toLowerCase()}function camelcase$1(e){return e.charAt(1).toUpperCase()}const html$1=merge([aria,html$2,xlink,xmlns,xml],`html`),svg=merge([aria,svg$1,xlink,xmlns,xml],`svg`);function parse$4(e){let t=[],S=String(e||``),w=S.indexOf(`,`),E=0,D=!1;for(;!D;){w===-1&&(w=S.length,D=!0);let e=S.slice(E,w).trim();(e||!D)&&t.push(e),E=w+1,w=S.indexOf(`,`,E)}return t}const search$3=/[#.]/g;function parseSelector(e,t){let S=e||``,w={},E=0,D,O;for(;E<S.length;){search$3.lastIndex=E;let e=search$3.exec(S),t=S.slice(E,e?e.index:S.length);t&&(D?D===`#`?w.id=t:Array.isArray(w.className)?w.className.push(t):w.className=[t]:O=t,E+=t.length),e&&(D=e[0],E++)}return{type:`element`,tagName:O||t||`div`,properties:w,children:[]}}function parse$3(e){let t=String(e||``).trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function createH(e,t,S){let w=S?createAdjustMap(S):void 0;function E(S,E,...D){let O;if(S==null){O={type:`root`,children:[]};let e=E;D.unshift(e)}else{O=parseSelector(S,t);let k=O.tagName.toLowerCase(),j=w?w.get(k):void 0;if(O.tagName=j||k,isChild(E))D.unshift(E);else for(let[t,S]of Object.entries(E))addProperty(e,O.properties,t,S)}for(let e of D)addChild(O.children,e);return O.type===`element`&&O.tagName===`template`&&(O.content={type:`root`,children:O.children},O.children=[]),O}return E}function isChild(e){if(typeof e!=`object`||!e||Array.isArray(e))return!0;if(typeof e.type!=`string`)return!1;let t=e,S=Object.keys(e);for(let e of S){let S=t[e];if(S&&typeof S==`object`){if(!Array.isArray(S))return!0;let e=S;for(let t of e)if(typeof t!=`number`&&typeof t!=`string`)return!0}}return!!(`children`in e&&Array.isArray(e.children))}function addProperty(e,t,S,w){let E=find$1(e,S),D;if(w!=null){if(typeof w==`number`){if(Number.isNaN(w))return;D=w}else D=typeof w==`boolean`?w:typeof w==`string`?E.spaceSeparated?parse$3(w):E.commaSeparated?parse$4(w):E.commaOrSpaceSeparated?parse$3(parse$4(w).join(` `)):parsePrimitive(E,E.property,w):Array.isArray(w)?[...w]:E.property===`style`?style(w):String(w);if(Array.isArray(D)){let e=[];for(let t of D)e.push(parsePrimitive(E,E.property,t));D=e}E.property===`className`&&Array.isArray(t.className)&&(D=t.className.concat(D)),t[E.property]=D}}function addChild(e,t){if(t!=null)if(typeof t==`number`||typeof t==`string`)e.push({type:`text`,value:String(t)});else if(Array.isArray(t))for(let S of t)addChild(e,S);else if(typeof t==`object`&&`type`in t)t.type===`root`?addChild(e,t.children):e.push(t);else throw Error("Expected node, nodes, or string, got `"+t+"`")}function parsePrimitive(e,t,S){if(typeof S==`string`){if(e.number&&S&&!Number.isNaN(Number(S)))return Number(S);if((e.boolean||e.overloadedBoolean)&&(S===``||normalize$3(S)===normalize$3(t)))return!0}return S}function style(e){let t=[];for(let[S,w]of Object.entries(e))t.push([S,w].join(`: `));return t.join(`; `)}function createAdjustMap(e){let t=new Map;for(let S of e)t.set(S.toLowerCase(),S);return t}const svgCaseSensitiveTagNames=`altGlyph.altGlyphDef.altGlyphItem.animateColor.animateMotion.animateTransform.clipPath.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feDistantLight.feDropShadow.feFlood.feFuncA.feFuncB.feFuncG.feFuncR.feGaussianBlur.feImage.feMerge.feMergeNode.feMorphology.feOffset.fePointLight.feSpecularLighting.feSpotLight.feTile.feTurbulence.foreignObject.glyphRef.linearGradient.radialGradient.solidColor.textArea.textPath`.split(`.`),h=createH(html$1,`div`),s=createH(svg,`g`,svgCaseSensitiveTagNames);function location$1(e){let t=String(e),S=[];return{toOffset:E,toPoint:w};function w(e){if(typeof e==`number`&&e>-1&&e<=t.length){let w=0;for(;;){let E=S[w];if(E===void 0){let e=next(t,S[w-1]);E=e===-1?t.length+1:e+1,S[w]=E}if(E>e)return{line:w+1,column:e-(w>0?S[w-1]:0)+1,offset:e};w++}}}function E(e){if(e&&typeof e.line==`number`&&typeof e.column==`number`&&!Number.isNaN(e.line)&&!Number.isNaN(e.column)){for(;S.length<e.line;){let e=S[S.length-1],w=next(t,e),E=w===-1?t.length+1:w+1;if(e===E)break;S.push(E)}let w=(e.line>1?S[e.line-2]:0)+e.column-1;if(w<S[e.line-1])return w}}}function next(e,t){let S=e.indexOf(`\r`,t),w=e.indexOf(`
|
|
237
237
|
`,t);return w===-1?S:S===-1||S+1===w?w:S<w?S:w}const webNamespaces={html:`http://www.w3.org/1999/xhtml`,mathml:`http://www.w3.org/1998/Math/MathML`,svg:`http://www.w3.org/2000/svg`,xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`,xmlns:`http://www.w3.org/2000/xmlns/`},own$7={}.hasOwnProperty,proto=Object.prototype;function fromParse5(e,t){let S=t||{};return one$1({file:S.file||void 0,location:!1,schema:S.space===`svg`?svg:html$1,verbose:S.verbose||!1},e)}function one$1(e,t){let S;switch(t.nodeName){case`#comment`:{let w=t;return S={type:`comment`,value:w.data},patch(e,w,S),S}case`#document`:case`#document-fragment`:{let w=t,E=`mode`in w?w.mode===`quirks`||w.mode===`limited-quirks`:!1;if(S={type:`root`,children:all$2(e,t.childNodes),data:{quirksMode:E}},e.file&&e.location){let t=String(e.file),w=location$1(t),E=w.toPoint(0),D=w.toPoint(t.length);S.position={start:E,end:D}}return S}case`#documentType`:{let w=t;return S={type:`doctype`},patch(e,w,S),S}case`#text`:{let w=t;return S={type:`text`,value:w.value},patch(e,w,S),S}default:return S=element(e,t),S}}function all$2(e,t){let S=-1,w=[];for(;++S<t.length;){let E=one$1(e,t[S]);w.push(E)}return w}function element(e,t){let S=e.schema;e.schema=t.namespaceURI===webNamespaces.svg?svg:html$1;let w=-1,E={};for(;++w<t.attrs.length;){let e=t.attrs[w],S=(e.prefix?e.prefix+`:`:``)+e.name;own$7.call(proto,S)||(E[S]=e.value)}let D=(e.schema.space===`svg`?s:h)(t.tagName,E,all$2(e,t.childNodes));if(patch(e,t,D),D.tagName===`template`){let S=t,w=S.sourceCodeLocation,E=w&&w.startTag&&position(w.startTag),O=w&&w.endTag&&position(w.endTag),k=one$1(e,S.content);E&&O&&e.file&&(k.position={start:E.end,end:O.start}),D.content=k}return e.schema=S,D}function patch(e,t,S){if(`sourceCodeLocation`in t&&t.sourceCodeLocation&&e.file){let w=createLocation(e,S,t.sourceCodeLocation);w&&(e.location=!0,S.position=w)}}function createLocation(e,t,S){let w=position(S);if(t.type===`element`){let E=t.children[t.children.length-1];if(w&&!S.endTag&&E&&E.position&&E.position.end&&(w.end=Object.assign({},E.position.end)),e.verbose){let w={},E;if(S.attrs)for(E in S.attrs)own$7.call(S.attrs,E)&&(w[find$1(e.schema,E).property]=position(S.attrs[E]));S.startTag;let D=position(S.startTag),O=S.endTag?position(S.endTag):void 0,k={opening:D};O&&(k.closing=O),k.properties=w,t.data={position:k}}}return w}function position(e){let t=point$1({line:e.startLine,column:e.startCol,offset:e.startOffset}),S=point$1({line:e.endLine,column:e.endCol,offset:e.endOffset});return t||S?{start:t,end:S}:void 0}function point$1(e){return e.line&&e.column?e:void 0}const UNDEFINED_CODE_POINTS=new Set([65534,65535,131070,131071,196606,196607,262142,262143,327678,327679,393214,393215,458750,458751,524286,524287,589822,589823,655358,655359,720894,720895,786430,786431,851966,851967,917502,917503,983038,983039,1048574,1048575,1114110,1114111]),REPLACEMENT_CHARACTER=`�`;var CODE_POINTS;(function(e){e[e.EOF=-1]=`EOF`,e[e.NULL=0]=`NULL`,e[e.TABULATION=9]=`TABULATION`,e[e.CARRIAGE_RETURN=13]=`CARRIAGE_RETURN`,e[e.LINE_FEED=10]=`LINE_FEED`,e[e.FORM_FEED=12]=`FORM_FEED`,e[e.SPACE=32]=`SPACE`,e[e.EXCLAMATION_MARK=33]=`EXCLAMATION_MARK`,e[e.QUOTATION_MARK=34]=`QUOTATION_MARK`,e[e.AMPERSAND=38]=`AMPERSAND`,e[e.APOSTROPHE=39]=`APOSTROPHE`,e[e.HYPHEN_MINUS=45]=`HYPHEN_MINUS`,e[e.SOLIDUS=47]=`SOLIDUS`,e[e.DIGIT_0=48]=`DIGIT_0`,e[e.DIGIT_9=57]=`DIGIT_9`,e[e.SEMICOLON=59]=`SEMICOLON`,e[e.LESS_THAN_SIGN=60]=`LESS_THAN_SIGN`,e[e.EQUALS_SIGN=61]=`EQUALS_SIGN`,e[e.GREATER_THAN_SIGN=62]=`GREATER_THAN_SIGN`,e[e.QUESTION_MARK=63]=`QUESTION_MARK`,e[e.LATIN_CAPITAL_A=65]=`LATIN_CAPITAL_A`,e[e.LATIN_CAPITAL_Z=90]=`LATIN_CAPITAL_Z`,e[e.RIGHT_SQUARE_BRACKET=93]=`RIGHT_SQUARE_BRACKET`,e[e.GRAVE_ACCENT=96]=`GRAVE_ACCENT`,e[e.LATIN_SMALL_A=97]=`LATIN_SMALL_A`,e[e.LATIN_SMALL_Z=122]=`LATIN_SMALL_Z`})(CODE_POINTS||={});const SEQUENCES={DASH_DASH:`--`,CDATA_START:`[CDATA[`,DOCTYPE:`doctype`,SCRIPT:`script`,PUBLIC:`public`,SYSTEM:`system`};function isSurrogate(e){return e>=55296&&e<=57343}function isSurrogatePair(e){return e>=56320&&e<=57343}function getSurrogatePairCodePoint(e,t){return(e-55296)*1024+9216+t}function isControlCodePoint(e){return e!==32&&e!==10&&e!==13&&e!==9&&e!==12&&e>=1&&e<=31||e>=127&&e<=159}function isUndefinedCodePoint(e){return e>=64976&&e<=65007||UNDEFINED_CODE_POINTS.has(e)}var ERR;(function(e){e.controlCharacterInInputStream=`control-character-in-input-stream`,e.noncharacterInInputStream=`noncharacter-in-input-stream`,e.surrogateInInputStream=`surrogate-in-input-stream`,e.nonVoidHtmlElementStartTagWithTrailingSolidus=`non-void-html-element-start-tag-with-trailing-solidus`,e.endTagWithAttributes=`end-tag-with-attributes`,e.endTagWithTrailingSolidus=`end-tag-with-trailing-solidus`,e.unexpectedSolidusInTag=`unexpected-solidus-in-tag`,e.unexpectedNullCharacter=`unexpected-null-character`,e.unexpectedQuestionMarkInsteadOfTagName=`unexpected-question-mark-instead-of-tag-name`,e.invalidFirstCharacterOfTagName=`invalid-first-character-of-tag-name`,e.unexpectedEqualsSignBeforeAttributeName=`unexpected-equals-sign-before-attribute-name`,e.missingEndTagName=`missing-end-tag-name`,e.unexpectedCharacterInAttributeName=`unexpected-character-in-attribute-name`,e.unknownNamedCharacterReference=`unknown-named-character-reference`,e.missingSemicolonAfterCharacterReference=`missing-semicolon-after-character-reference`,e.unexpectedCharacterAfterDoctypeSystemIdentifier=`unexpected-character-after-doctype-system-identifier`,e.unexpectedCharacterInUnquotedAttributeValue=`unexpected-character-in-unquoted-attribute-value`,e.eofBeforeTagName=`eof-before-tag-name`,e.eofInTag=`eof-in-tag`,e.missingAttributeValue=`missing-attribute-value`,e.missingWhitespaceBetweenAttributes=`missing-whitespace-between-attributes`,e.missingWhitespaceAfterDoctypePublicKeyword=`missing-whitespace-after-doctype-public-keyword`,e.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers=`missing-whitespace-between-doctype-public-and-system-identifiers`,e.missingWhitespaceAfterDoctypeSystemKeyword=`missing-whitespace-after-doctype-system-keyword`,e.missingQuoteBeforeDoctypePublicIdentifier=`missing-quote-before-doctype-public-identifier`,e.missingQuoteBeforeDoctypeSystemIdentifier=`missing-quote-before-doctype-system-identifier`,e.missingDoctypePublicIdentifier=`missing-doctype-public-identifier`,e.missingDoctypeSystemIdentifier=`missing-doctype-system-identifier`,e.abruptDoctypePublicIdentifier=`abrupt-doctype-public-identifier`,e.abruptDoctypeSystemIdentifier=`abrupt-doctype-system-identifier`,e.cdataInHtmlContent=`cdata-in-html-content`,e.incorrectlyOpenedComment=`incorrectly-opened-comment`,e.eofInScriptHtmlCommentLikeText=`eof-in-script-html-comment-like-text`,e.eofInDoctype=`eof-in-doctype`,e.nestedComment=`nested-comment`,e.abruptClosingOfEmptyComment=`abrupt-closing-of-empty-comment`,e.eofInComment=`eof-in-comment`,e.incorrectlyClosedComment=`incorrectly-closed-comment`,e.eofInCdata=`eof-in-cdata`,e.absenceOfDigitsInNumericCharacterReference=`absence-of-digits-in-numeric-character-reference`,e.nullCharacterReference=`null-character-reference`,e.surrogateCharacterReference=`surrogate-character-reference`,e.characterReferenceOutsideUnicodeRange=`character-reference-outside-unicode-range`,e.controlCharacterReference=`control-character-reference`,e.noncharacterCharacterReference=`noncharacter-character-reference`,e.missingWhitespaceBeforeDoctypeName=`missing-whitespace-before-doctype-name`,e.missingDoctypeName=`missing-doctype-name`,e.invalidCharacterSequenceAfterDoctypeName=`invalid-character-sequence-after-doctype-name`,e.duplicateAttribute=`duplicate-attribute`,e.nonConformingDoctype=`non-conforming-doctype`,e.missingDoctype=`missing-doctype`,e.misplacedDoctype=`misplaced-doctype`,e.endTagWithoutMatchingOpenElement=`end-tag-without-matching-open-element`,e.closingOfElementWithOpenChildElements=`closing-of-element-with-open-child-elements`,e.disallowedContentInNoscriptInHead=`disallowed-content-in-noscript-in-head`,e.openElementsLeftAfterEof=`open-elements-left-after-eof`,e.abandonedHeadElementChild=`abandoned-head-element-child`,e.misplacedStartTagForHeadElement=`misplaced-start-tag-for-head-element`,e.nestedNoscriptInHead=`nested-noscript-in-head`,e.eofInElementThatCanContainOnlyText=`eof-in-element-that-can-contain-only-text`})(ERR||={});const DEFAULT_BUFFER_WATERLINE=65536;var Preprocessor=class{constructor(e){this.handler=e,this.html=``,this.pos=-1,this.lastGapPos=-2,this.gapStack=[],this.skipNextNewLine=!1,this.lastChunkWritten=!1,this.endOfChunkHit=!1,this.bufferWaterline=DEFAULT_BUFFER_WATERLINE,this.isEol=!1,this.lineStartPos=0,this.droppedBufferSize=0,this.line=1,this.lastErrOffset=-1}get col(){return this.pos-this.lineStartPos+Number(this.lastGapPos!==this.pos)}get offset(){return this.droppedBufferSize+this.pos}getError(e,t){let{line:S,col:w,offset:E}=this,D=w+t,O=E+t;return{code:e,startLine:S,endLine:S,startCol:D,endCol:D,startOffset:O,endOffset:O}}_err(e){this.handler.onParseError&&this.lastErrOffset!==this.offset&&(this.lastErrOffset=this.offset,this.handler.onParseError(this.getError(e,0)))}_addGap(){this.gapStack.push(this.lastGapPos),this.lastGapPos=this.pos}_processSurrogate(e){if(this.pos!==this.html.length-1){let t=this.html.charCodeAt(this.pos+1);if(isSurrogatePair(t))return this.pos++,this._addGap(),getSurrogatePairCodePoint(e,t)}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,CODE_POINTS.EOF;return this._err(ERR.surrogateInInputStream),e}willDropParsedChunk(){return this.pos>this.bufferWaterline}dropParsedChunk(){this.willDropParsedChunk()&&(this.html=this.html.substring(this.pos),this.lineStartPos-=this.pos,this.droppedBufferSize+=this.pos,this.pos=0,this.lastGapPos=-2,this.gapStack.length=0)}write(e,t){this.html.length>0?this.html+=e:this.html=e,this.endOfChunkHit=!1,this.lastChunkWritten=t}insertHtmlAtCurrentPos(e){this.html=this.html.substring(0,this.pos+1)+e+this.html.substring(this.pos+1),this.endOfChunkHit=!1}startsWith(e,t){if(this.pos+e.length>this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,!1;if(t)return this.html.startsWith(e,this.pos);for(let t=0;t<e.length;t++)if((this.html.charCodeAt(this.pos+t)|32)!==e.charCodeAt(t))return!1;return!0}peek(e){let t=this.pos+e;if(t>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,CODE_POINTS.EOF;let S=this.html.charCodeAt(t);return S===CODE_POINTS.CARRIAGE_RETURN?CODE_POINTS.LINE_FEED:S}advance(){if(this.pos++,this.isEol&&(this.isEol=!1,this.line++,this.lineStartPos=this.pos),this.pos>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,CODE_POINTS.EOF;let e=this.html.charCodeAt(this.pos);return e===CODE_POINTS.CARRIAGE_RETURN?(this.isEol=!0,this.skipNextNewLine=!0,CODE_POINTS.LINE_FEED):e===CODE_POINTS.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine)?(this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance()):(this.skipNextNewLine=!1,isSurrogate(e)&&(e=this._processSurrogate(e)),this.handler.onParseError===null||e>31&&e<127||e===CODE_POINTS.LINE_FEED||e===CODE_POINTS.CARRIAGE_RETURN||e>159&&e<64976||this._checkForProblematicCharacters(e),e)}_checkForProblematicCharacters(e){isControlCodePoint(e)?this._err(ERR.controlCharacterInInputStream):isUndefinedCodePoint(e)&&this._err(ERR.noncharacterInInputStream)}retreat(e){for(this.pos-=e;this.pos<this.lastGapPos;)this.lastGapPos=this.gapStack.pop(),this.pos--;this.isEol=!1}},TokenType;(function(e){e[e.CHARACTER=0]=`CHARACTER`,e[e.NULL_CHARACTER=1]=`NULL_CHARACTER`,e[e.WHITESPACE_CHARACTER=2]=`WHITESPACE_CHARACTER`,e[e.START_TAG=3]=`START_TAG`,e[e.END_TAG=4]=`END_TAG`,e[e.COMMENT=5]=`COMMENT`,e[e.DOCTYPE=6]=`DOCTYPE`,e[e.EOF=7]=`EOF`,e[e.HIBERNATION=8]=`HIBERNATION`})(TokenType||={});function getTokenAttr(e,t){for(let S=e.attrs.length-1;S>=0;S--)if(e.attrs[S].name===t)return e.attrs[S].value;return null}const htmlDecodeTree=new Uint16Array(`ᵁ<Õıʊҝջאٵ۞ޢߖࠏઑඡ༉༦ረዡᐕᒝᓃᓟᔥ\0\0\0\0\0\0ᕫᛍᦍᰒᷝ↰⊍⏀⏻⑂⠤⤒ⴈ⹈⿎〖㊺㘹㞬㣾㨨㩱㫠㬮ࠀEMabcfglmnoprstu\\bfms¦³¹ÈÏlig耻Æ䃆P耻&䀦cute耻Á䃁reve;䄂Āiyx}rc耻Â䃂;䐐r;쀀𝔄rave耻À䃀pha;䎑acr;䄀d;橓Āgp¡on;䄄f;쀀𝔸plyFunction;恡ing耻Å䃅Ācs¾Ãr;쀀𝒜ign;扔ilde耻Ã䃃ml耻Ä䃄ЀaceforsuåûþėĜĢħĪĀcrêòkslash;或Ŷöø;櫧ed;挆y;䐑ƀcrtąċĔause;戵noullis;愬a;䎒r;쀀𝔅pf;쀀𝔹eve;䋘còēmpeq;扎܀HOacdefhilorsuōőŖƀƞƢƵƷƺǜȕɳɸɾcy;䐧PY耻©䂩ƀcpyŝŢźute;䄆Ā;iŧŨ拒talDifferentialD;慅leys;愭ȀaeioƉƎƔƘron;䄌dil耻Ç䃇rc;䄈nint;戰ot;䄊ĀdnƧƭilla;䂸terDot;䂷òſi;䎧rcleȀDMPTLJNjǑǖot;抙inus;抖lus;投imes;抗oĀcsǢǸkwiseContourIntegral;戲eCurlyĀDQȃȏoubleQuote;思uote;怙ȀlnpuȞȨɇɕonĀ;eȥȦ户;橴ƀgitȯȶȺruent;扡nt;戯ourIntegral;戮ĀfrɌɎ;愂oduct;成nterClockwiseContourIntegral;戳oss;樯cr;쀀𝒞pĀ;Cʄʅ拓ap;才րDJSZacefiosʠʬʰʴʸˋ˗ˡ˦̳ҍĀ;oŹʥtrahd;椑cy;䐂cy;䐅cy;䐏ƀgrsʿ˄ˇger;怡r;憡hv;櫤Āayː˕ron;䄎;䐔lĀ;t˝˞戇a;䎔r;쀀𝔇Āaf˫̧Ācm˰̢riticalȀADGT̖̜̀̆cute;䂴oŴ̋̍;䋙bleAcute;䋝rave;䁠ilde;䋜ond;拄ferentialD;慆Ѱ̽\0\0\0͔͂\0Ѕf;쀀𝔻ƀ;DE͈͉͍䂨ot;惜qual;扐blèCDLRUVͣͲϏϢϸontourIntegraìȹoɴ\0\0ͻ»͉nArrow;懓Āeo·ΤftƀARTΐΖΡrrow;懐ightArrow;懔eåˊngĀLRΫτeftĀARγιrrow;柸ightArrow;柺ightArrow;柹ightĀATϘϞrrow;懒ee;抨pɁϩ\0\0ϯrrow;懑ownArrow;懕erticalBar;戥ǹABLRTaВЪаўѿͼrrowƀ;BUНОТ憓ar;椓pArrow;懵reve;䌑eft˒к\0ц\0ѐightVector;楐eeVector;楞ectorĀ;Bљњ憽ar;楖ightǔѧ\0ѱeeVector;楟ectorĀ;BѺѻ懁ar;楗eeĀ;A҆҇护rrow;憧ĀctҒҗr;쀀𝒟rok;䄐ࠀNTacdfglmopqstuxҽӀӄӋӞӢӧӮӵԡԯԶՒ՝ՠեG;䅊H耻Ð䃐cute耻É䃉ƀaiyӒӗӜron;䄚rc耻Ê䃊;䐭ot;䄖r;쀀𝔈rave耻È䃈ement;戈ĀapӺӾcr;䄒tyɓԆ\0\0ԒmallSquare;旻erySmallSquare;斫ĀgpԦԪon;䄘f;쀀𝔼silon;䎕uĀaiԼՉlĀ;TՂՃ橵ilde;扂librium;懌Āci՚r;愰m;橳a;䎗ml耻Ë䃋Āipժկsts;戃onentialE;慇ʀcfiosօֈ֍ֲy;䐤r;쀀𝔉lledɓ֗\0\0֣mallSquare;旼erySmallSquare;斪Ͱֺ\0ֿ\0\0ׄf;쀀𝔽All;戀riertrf;愱còJTabcdfgorstרׯؒؖ؛؝أ٬ٲcy;䐃耻>䀾mmaĀ;d䎓;䏜reve;䄞ƀeiy؇،ؐdil;䄢rc;䄜;䐓ot;䄠r;쀀𝔊;拙pf;쀀𝔾eater̀EFGLSTصلَٖٛ٦qualĀ;Lؾؿ扥ess;招ullEqual;执reater;檢ess;扷lantEqual;橾ilde;扳cr;쀀𝒢;扫ЀAacfiosuڅڋږڛڞڪھۊRDcy;䐪Āctڐڔek;䋇;䁞irc;䄤r;愌lbertSpace;愋ǰگ\0ڲf;愍izontalLine;攀Āctۃۅòکrok;䄦mpńېۘownHumðįqual;扏܀EJOacdfgmnostuۺ۾܃܇ܚܞܡܨ݄ݸދޏޕcy;䐕lig;䄲cy;䐁cute耻Í䃍Āiyܓܘrc耻Î䃎;䐘ot;䄰r;愑rave耻Ì䃌ƀ;apܠܯܿĀcgܴܷr;䄪inaryI;慈lieóϝǴ݉\0ݢĀ;eݍݎ戬Āgrݓݘral;戫section;拂isibleĀCTݬݲomma;恣imes;恢ƀgptݿރވon;䄮f;쀀𝕀a;䎙cr;愐ilde;䄨ǫޚ\0ޞcy;䐆l耻Ï䃏ʀcfosuެ߂ߐĀiyޱrc;䄴;䐙r;쀀𝔍pf;쀀𝕁ǣ߇\0ߌr;쀀𝒥rcy;䐈kcy;䐄HJacfosߤߨ߽߬߱ࠂࠈcy;䐥cy;䐌ppa;䎚Āey߶dil;䄶;䐚r;쀀𝔎pf;쀀𝕂cr;쀀𝒦րJTaceflmostࠥࠩࠬࡐࡣসে্ੇcy;䐉耻<䀼ʀcmnpr࠷࠼ࡁࡄࡍute;䄹bda;䎛g;柪lacetrf;愒r;憞ƀaeyࡗࡡron;䄽dil;䄻;䐛Āfsࡨ॰tԀACDFRTUVarࡾࢩࢱࣦ࣠ࣼयज़ΐ४ĀnrࢃgleBracket;柨rowƀ;BR࢙࢚࢞憐ar;懤ightArrow;懆eiling;挈oǵࢷ\0ࣃbleBracket;柦nǔࣈ\0࣒eeVector;楡ectorĀ;Bࣛࣜ懃ar;楙loor;挊ightĀAV࣯ࣵrrow;憔ector;楎Āerँगeƀ;AVउऊऐ抣rrow;憤ector;楚iangleƀ;BEतथऩ抲ar;槏qual;抴pƀDTVषूौownVector;楑eeVector;楠ectorĀ;Bॖॗ憿ar;楘ectorĀ;B॥०憼ar;楒ightáΜs̀EFGLSTॾঋকঝঢভqualGreater;拚ullEqual;扦reater;扶ess;檡lantEqual;橽ilde;扲r;쀀𝔏Ā;eঽা拘ftarrow;懚idot;䄿ƀnpwਖਛgȀLRlr৷ਂਐeftĀAR০৬rrow;柵ightArrow;柷ightArrow;柶eftĀarγਊightáοightáϊf;쀀𝕃erĀLRਢਬeftArrow;憙ightArrow;憘ƀchtਾੀੂòࡌ;憰rok;䅁;扪Ѐacefiosuਗ਼અઋp;椅y;䐜Ādl੯iumSpace;恟lintrf;愳r;쀀𝔐nusPlus;戓pf;쀀𝕄cò੶;䎜ҀJacefostuણધભીଔଙඑඞcy;䐊cute;䅃ƀaeyહાron;䅇dil;䅅;䐝ƀgswે૰ativeƀMTV૨ediumSpace;怋hiĀcn૦ëeryThiîtedĀGLଆreaterGreateòٳessLesóੈLine;䀊r;쀀𝔑ȀBnptଢନଷreak;恠BreakingSpace;䂠f;愕ڀ;CDEGHLNPRSTV୕ୖ୪௫ఄ಄ದൡඅ櫬Āoungruent;扢pCap;扭oubleVerticalBar;戦ƀlqxஃஊement;戉ualĀ;Tஒஓ扠ilde;쀀≂̸ists;戄reater;EFGLSTஶஷ扯qual;扱ullEqual;쀀≧̸reater;쀀≫̸ess;批lantEqual;쀀⩾̸ilde;扵umpń௲ownHump;쀀≎̸qual;쀀≏̸eĀfsఊధtTriangleƀ;BEచఛడ拪ar;쀀⧏̸qual;括s̀;EGLSTవశ఼ౄోౘ扮qual;扰reater;扸ess;쀀≪̸lantEqual;쀀⩽̸ilde;扴estedĀGL౨౹reaterGreater;쀀⪢̸essLess;쀀⪡̸recedesƀ;ESಒಓಛ技qual;쀀⪯̸lantEqual;拠ĀeiಫಹverseElement;戌ghtTriangleƀ;BEೋೌ拫ar;쀀⧐̸qual;拭ĀquೝഌuareSuĀbp೨setĀ;Eೳ쀀⊏̸qual;拢ersetĀ;Eഃആ쀀⊐̸qual;拣ƀbcpഓതൎsetĀ;Eഛഞ쀀⊂⃒qual;抈ceedsȀ;ESTലള഻െ抁qual;쀀⪰̸lantEqual;拡ilde;쀀≿̸ersetĀ;E൘൛쀀⊃⃒qual;抉ildeȀ;EFT൮൯൵ൿ扁qual;扄ullEqual;扇ilde;扉erticalBar;戤cr;쀀𝒩ilde耻Ñ䃑;䎝܀Eacdfgmoprstuvලෂෛ෧ขภยา฿ไlig;䅒cute耻Ó䃓Āiyීrc耻Ô䃔;䐞blac;䅐r;쀀𝔒rave耻Ò䃒ƀaei෮ෲcr;䅌ga;䎩cron;䎟pf;쀀𝕆enCurlyĀDQฎบoubleQuote;怜uote;怘;橔Āclวฬr;쀀𝒪ash耻Ø䃘iŬืde耻Õ䃕es;樷ml耻Ö䃖erĀBP๋Āar๐๓r;怾acĀek๚;揞et;掴arenthesis;揜ҀacfhilorsງຊຏຒດຝະrtialD;戂y;䐟r;쀀𝔓i;䎦;䎠usMinus;䂱Āipຢອncareplanåڝf;愙Ȁ;eio຺ູ檻cedesȀ;EST່້扺qual;檯lantEqual;扼ilde;找me;怳Ādpuct;戏ortionĀ;aȥl;戝Āci༁༆r;쀀𝒫;䎨ȀUfos༑༖༛༟OT耻"䀢r;쀀𝔔pf;愚cr;쀀𝒬BEacefhiorsu༾གྷཇའཱིྦྷྪྭ႖ႩႴႾarr;椐G耻®䂮ƀcnrཎནབute;䅔g;柫rĀ;tཛྷཝ憠l;椖ƀaeyཧཬཱron;䅘dil;䅖;䐠Ā;vླྀཹ愜erseĀEUྂྙĀlq྇ྎement;戋uilibrium;懋pEquilibrium;楯r»ཹo;䎡ghtЀACDFTUVa࿁ဢဨၛႇϘĀnr࿆࿒gleBracket;柩rowƀ;BL憒ar;懥eftArrow;懄eiling;按oǵ\0စbleBracket;柧nǔည\0နeeVector;楝ectorĀ;Bဝသ懂ar;楕loor;挋Āerိ၃eƀ;AVဵံြ抢rrow;憦ector;楛iangleƀ;BEၐၑၕ抳ar;槐qual;抵pƀDTVၣၮၸownVector;楏eeVector;楜ectorĀ;Bႂႃ憾ar;楔ectorĀ;B႑႒懀ar;楓Āpuႛ႞f;愝ndImplies;楰ightarrow;懛ĀchႹႼr;愛;憱leDelayed;槴ڀHOacfhimoqstuფჱჷჽᄙᄞᅑᅖᅡᅧᆵᆻᆿĀCcჩხHcy;䐩y;䐨FTcy;䐬cute;䅚ʀ;aeiyᄈᄉᄎᄓᄗ檼ron;䅠dil;䅞rc;䅜;䐡r;쀀𝔖ortȀDLRUᄪᄴᄾᅉownArrow»ОeftArrow»࢚ightArrow»pArrow;憑gma;䎣allCircle;战pf;쀀𝕊ɲᅭ\0\0ᅰt;戚areȀ;ISUᅻᅼᆉᆯ斡ntersection;抓uĀbpᆏᆞsetĀ;Eᆗᆘ抏qual;抑ersetĀ;Eᆨᆩ抐qual;抒nion;抔cr;쀀𝒮ar;拆ȀbcmpᇈᇛሉላĀ;sᇍᇎ拐etĀ;Eᇍᇕqual;抆ĀchᇠህeedsȀ;ESTᇭᇮᇴᇿ扻qual;檰lantEqual;扽ilde;承Tháྌ;我ƀ;esሒሓሣ拑rsetĀ;Eሜም抃qual;抇et»ሓրHRSacfhiorsሾቄቕቱቶኟዂወዑORN耻Þ䃞ADE;愢ĀHcቒcy;䐋y;䐦Ābuቚቜ;䀉;䎤ƀaeyብቪቯron;䅤dil;䅢;䐢r;쀀𝔗ĀeiቻDzኀ\0ኇefore;戴a;䎘ĀcnኘkSpace;쀀 Space;怉ldeȀ;EFTካኬኲኼ戼qual;扃ullEqual;扅ilde;扈pf;쀀𝕋ipleDot;惛Āctዖዛr;쀀𝒯rok;䅦ૡዷጎጚጦ\0ጬጱ\0\0\0\0\0ጸጽ፷ᎅ\0ᐄᐊᐐĀcrዻጁute耻Ú䃚rĀ;oጇገ憟cir;楉rǣጓ\0y;䐎ve;䅬Āiyጞጣrc耻Û䃛;䐣blac;䅰r;쀀𝔘rave耻Ù䃙acr;䅪Ādiፁ፩erĀBPፈ፝Āarፍፐr;䁟acĀekፗፙ;揟et;掵arenthesis;揝onĀ;P፰፱拃lus;抎Āgp፻on;䅲f;쀀𝕌ЀADETadps᎕ᎮᎸᏄϨᏒᏗᏳrrowƀ;BDᅐᎠᎤar;椒ownArrow;懅ownArrow;憕quilibrium;楮eeĀ;AᏋᏌ报rrow;憥ownáϳerĀLRᏞᏨeftArrow;憖ightArrow;憗iĀ;lᏹᏺ䏒on;䎥ing;䅮cr;쀀𝒰ilde;䅨ml耻Ü䃜ҀDbcdefosvᐧᐬᐰᐳᐾᒅᒊᒐᒖash;披ar;櫫y;䐒ashĀ;lᐻᐼ抩;櫦Āerᑃᑅ;拁ƀbtyᑌᑐᑺar;怖Ā;iᑏᑕcalȀBLSTᑡᑥᑪᑴar;戣ine;䁼eparator;杘ilde;所ThinSpace;怊r;쀀𝔙pf;쀀𝕍cr;쀀𝒱dash;抪ʀcefosᒧᒬᒱᒶᒼirc;䅴dge;拀r;쀀𝔚pf;쀀𝕎cr;쀀𝒲Ȁfiosᓋᓐᓒᓘr;쀀𝔛;䎞pf;쀀𝕏cr;쀀𝒳ҀAIUacfosuᓱᓵᓹᓽᔄᔏᔔᔚᔠcy;䐯cy;䐇cy;䐮cute耻Ý䃝Āiyᔉᔍrc;䅶;䐫r;쀀𝔜pf;쀀𝕐cr;쀀𝒴ml;䅸ЀHacdefosᔵᔹᔿᕋᕏᕝᕠᕤcy;䐖cute;䅹Āayᕄᕉron;䅽;䐗ot;䅻Dzᕔ\0ᕛoWidtèa;䎖r;愨pf;愤cr;쀀𝒵ᖃᖊᖐ\0ᖰᖶᖿ\0\0\0\0ᗆᗛᗫᙟ᙭\0ᚕ᚛ᚲᚹ\0ᚾcute耻á䃡reve;䄃̀;Ediuyᖜᖝᖡᖣᖨᖭ戾;쀀∾̳;房rc耻â䃢te肻´̆;䐰lig耻æ䃦Ā;r²ᖺ;쀀𝔞rave耻à䃠ĀepᗊᗖĀfpᗏᗔsym;愵èᗓha;䎱ĀapᗟcĀclᗤᗧr;䄁g;樿ɤᗰ\0\0ᘊʀ;adsvᗺᗻᗿᘁᘇ戧nd;橕;橜lope;橘;橚;elmrszᘘᘙᘛᘞᘿᙏᙙ戠;榤e»ᘙsdĀ;aᘥᘦ戡ѡᘰᘲᘴᘶᘸᘺᘼᘾ;榨;榩;榪;榫;榬;榭;榮;榯tĀ;vᙅᙆ戟bĀ;dᙌᙍ抾;榝Āptᙔᙗh;戢»¹arr;捼Āgpᙣᙧon;䄅f;쀀𝕒;Eaeiopᙻᙽᚂᚄᚇᚊ;橰cir;橯;扊d;手s;䀧roxĀ;eᚒñᚃing耻å䃥ƀctyᚡᚦᚨr;쀀𝒶;䀪mpĀ;eᚯñʈilde耻ã䃣ml耻ä䃤Āciᛂᛈoninôɲnt;樑ࠀNabcdefiklnoprsu᛭ᛱᜰᝃᝈ០៦ᠹᡐᜍ᥈ᥰot;櫭ĀcrᛶkȀcepsᜀᜅᜍᜓong;扌psilon;䏶rime;怵imĀ;e戽q;拍Ŷᜢᜦee;抽edĀ;gᜬᜭ挅e»ᜭrkĀ;tbrk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯᝳ;䎲;愶een;扬r;쀀𝔟gcostuvwឍឝឳេ៕៛ƀaiuបពរðݠrc;旯p»፱ƀdptឤឨឭot;樀lus;樁imes;樂ɱឹ\0\0ើcup;樆ar;昅riangleĀdu៍្own;施p;斳plus;樄eåᑄåᒭarow;植ƀakoᠦᠵĀcn៲ᠣkƀlst֫᠂ozenge;槫riangleȀ;dlr᠒᠓᠘斴own;斾eft;旂ight;斸k;搣Ʊᠫ\0ᠳƲᠯ\0ᠱ;斒;斑4;斓ck;斈ĀeoᠾᡍĀ;qᡃᡆ쀀=⃥uiv;쀀≡⃥t;挐Ȁptwxᡙᡞᡧᡬf;쀀𝕓Ā;tᏋᡣom»Ꮜtie;拈DHUVbdhmptuvᢅᢖᢪᢻᣗᣛᣬᤅᤊᤐᤡȀLRlrᢎᢐᢒᢔ;敗;敔;敖;敓ʀ;DUduᢡᢢᢤᢦᢨ敐;敦;敩;敤;敧ȀLRlrᢳᢵᢷᢹ;敝;敚;敜;教;HLRhlrᣊᣋᣍᣏᣑᣓᣕ救;敬;散;敠;敫;敢;敟ox;槉ȀLRlrᣤᣦᣨᣪ;敕;敒;攐;攌ʀ;DUduڽ;敥;敨;攬;攴inus;抟lus;択imes;抠ȀLRlrᤙᤛᤝ;敛;敘;攘;攔;HLRhlrᤰᤱᤳᤵᤷ᤻᤹攂;敪;敡;敞;攼;攤;攜Āevģbar耻¦䂦Ȁceioᥑᥖᥚᥠr;쀀𝒷mi;恏mĀ;elƀ;bhᥨᥩᥫ䁜;槅sub;柈ŬᥴlĀ;e怢t»pƀ;Eeįᦅᦇ;檮Ā;qۜۛೡᦧ\0᧨ᨑᨕᨲ\0ᨷᩐ\0\0᪴\0\0᫁\0\0ᬡᬮ᭒\0᯽\0ᰌƀcprᦲute;䄇̀;abcdsᦿᧀᧄ᧕᧙戩nd;橄rcup;橉Āau᧒p;橋p;橇ot;橀;쀀∩︀Āeo᧢᧥t;恁îړȀaeiu᧰᧻ᨁᨅǰ᧵\0᧸s;橍on;䄍dil耻ç䃧rc;䄉psĀ;sᨌᨍ橌m;橐ot;䄋ƀdmnᨛᨠᨦil肻¸ƭptyv;榲t脀¢;eᨭᨮ䂢räƲr;쀀𝔠ƀceiᨽᩀᩍy;䑇ckĀ;mᩇᩈ朓ark»ᩈ;䏇r;Ecefms᩠ᩢᩫ᪤᪪旋;槃ƀ;elᩩᩪᩭ䋆q;扗eɡᩴ\0\0᪈rrowĀlr᩼᪁eft;憺ight;憻ʀRSacd᪒᪔᪖»ཇ;擈st;抛irc;抚ash;抝nint;樐id;櫯cir;槂ubsĀ;u᪻᪼晣it»᪼ˬ᫇\0ᬊonĀ;eᫍᫎ䀺Ā;qÇÆɭ\0\0aĀ;t䀬;䁀ƀ;fl戁îᅠeĀmxent»eóɍǧ\0ᬇĀ;dኻᬂot;橭nôɆƀfryᬐᬔᬗ;쀀𝕔oäɔ脀©;sŕᬝr;愗Āaoᬥᬩrr;憵ss;朗Ācuᬲᬷr;쀀𝒸Ābpᬼ᭄Ā;eᭁᭂ櫏;櫑Ā;eᭉᭊ櫐;櫒dot;拯delprvw᭠᭬᭷ᮂᮬᯔarrĀlr᭨᭪;椸;椵ɰ᭲\0\0᭵r;拞c;拟arrĀ;pᮀ憶;椽̀;bcdosᮏᮐᮖᮡᮥᮨ截rcap;橈Āauᮛᮞp;橆p;橊ot;抍r;橅;쀀∪︀Ȁalrv᮵ᮿᯞᯣrrĀ;mᮼᮽ憷;椼yƀevwᯇᯔᯘqɰᯎ\0\0ᯒreã᭳uã᭵ee;拎edge;拏en耻¤䂤earrowĀlrᯮ᯳eft»ᮀight»ᮽeäᯝĀciᰁᰇoninôǷnt;戱lcty;挭ঀAHabcdefhijlorstuwz᰻᰿ᱝᱩᱵᲞᲬᲷᴍᵻᶑᶫᶻ᷆᷍ròar;楥Ȁglrs᱈ᱍ᱒᱔ger;怠eth;愸òᄳhĀ;vᱚᱛ怐»ऊūᱡᱧarow;椏aã̕Āayᱮᱳron;䄏;䐴ƀ;ao̲ᱼᲄĀgrʿᲁr;懊tseq;橷ƀglmᲑᲔᲘ耻°䂰ta;䎴ptyv;榱ĀirᲣᲨsht;楿;쀀𝔡arĀlrᲳᲵ»ࣜ»သʀaegsv᳂᳖᳜᳠mƀ;oș᳔ndĀ;ș᳑uit;晦amma;䏝in;拲ƀ;io᳧᳨᳸䃷de脀÷;o᳧ᳰntimes;拇nø᳷cy;䑒cɯᴆ\0\0ᴊrn;挞op;挍ʀlptuwᴘᴝᴢᵉᵕlar;䀤f;쀀𝕕ʀ;emps̋ᴭᴷᴽᵂqĀ;d͒ᴳot;扑inus;戸lus;戔quare;抡blebarwedgåúnƀadhᄮᵝᵧownarrowóᲃarpoonĀlrᵲᵶefôᲴighôᲶŢᵿᶅkaro÷གɯᶊ\0\0ᶎrn;挟op;挌ƀcotᶘᶣᶦĀryᶝᶡ;쀀𝒹;䑕l;槶rok;䄑Ādrᶰᶴot;拱iĀ;fᶺ᠖斿Āah᷀᷃ròЩaòྦangle;榦Āci᷒ᷕy;䑟grarr;柿ऀDacdefglmnopqrstuxḁḉḙḸոḼṉṡṾấắẽỡἪἷὄĀDoḆᴴoôĀcsḎḔute耻é䃩ter;橮ȀaioyḢḧḱḶron;䄛rĀ;cḭḮ扖耻ê䃪lon;払;䑍ot;䄗ĀDrṁṅot;扒;쀀𝔢ƀ;rsṐṑṗ檚ave耻è䃨Ā;dṜṝ檖ot;檘Ȁ;ilsṪṫṲṴ檙nters;揧;愓Ā;dṹṺ檕ot;檗ƀapsẅẉẗcr;䄓tyƀ;svẒẓẕ戅et»ẓpĀ1;ẝẤijạả;怄;怅怃ĀgsẪẬ;䅋p;怂ĀgpẴẸon;䄙f;쀀𝕖ƀalsỄỎỒrĀ;sỊị拕l;槣us;橱iƀ;lvỚớở䎵on»ớ;䏵ȀcsuvỪỳἋἣĀioữḱrc»Ḯɩỹ\0\0ỻíՈantĀglἂἆtr»ṝess»ṺƀaeiἒἚls;䀽st;扟vĀ;DȵἠD;橸parsl;槥ĀDaἯἳot;打rr;楱ƀcdiἾὁỸr;愯oô͒ĀahὉὋ;䎷耻ð䃰Āmrὓὗl耻ë䃫o;悬ƀcipὡὤὧl;䀡sôծĀeoὬὴctatioîՙnentialåչৡᾒ\0ᾞ\0ᾡᾧ\0\0ῆῌ\0ΐ\0ῦῪ \0 ⁚llingdotseñṄy;䑄male;晀ƀilrᾭᾳ῁lig;耀ffiɩᾹ\0\0᾽g;耀ffig;耀ffl;쀀𝔣lig;耀filig;쀀fjƀaltῙῡt;晭ig;耀flns;斱of;䆒ǰ΅\0ῳf;쀀𝕗ĀakֿῷĀ;vῼ´拔;櫙artint;樍Āao⁕Ācs‑⁒ႉ‸⁅⁈\0⁐β•‥‧\0耻½䂽;慓耻¼䂼;慕;慙;慛Ƴ‴\0‶;慔;慖ʴ‾⁁\0\0⁃耻¾䂾;慗;慜5;慘ƶ⁌\0⁎;慚;慝8;慞l;恄wn;挢cr;쀀𝒻ࢀEabcdefgijlnorstv₂₉₥₰₴⃰℃ℒℸ̗ℾ⅒↞Ā;lٍ₇;檌ƀcmpₐₕute;䇵maĀ;dₜ᳚䎳;檆reve;䄟Āiy₪₮rc;䄝;䐳ot;䄡Ȁ;lqsؾق₽ƀ;qsؾٌlanô٥Ȁ;cdl٥⃒⃥⃕c;檩otĀ;o⃜⃝檀Ā;l⃢⃣檂;檄Ā;e⃪⃭쀀⋛︀s;檔r;쀀𝔤Ā;gٳ؛mel;愷cy;䑓Ȁ;Eajٚℌℎℐ;檒;檥;檤ȀEaesℛℝ℩ℴ;扩pĀ;p℣ℤ檊rox»ℤĀ;q℮ℯ檈Ā;q℮ℛim;拧pf;쀀𝕘Āci⅃ⅆr;愊mƀ;el٫ⅎ⅐;檎;檐茀>;cdlqrⅠⅪⅮⅳⅹĀciⅥⅧ;檧r;橺ot;拗Par;榕uest;橼ʀadelsↄⅪ←ٖ↛ǰ↉\0proør;楸qĀlqؿ↖lesó₈ií٫Āen↣↭rtneqq;쀀≩︀Å↪ԀAabcefkosy⇄⇇⇱⇵⇺∘∝∯≨≽ròΠȀilmr⇐⇔⇗⇛rsðᒄf»․ilôکĀdr⇠⇤cy;䑊ƀ;cwࣴ⇫⇯ir;楈;憭ar;意irc;䄥ƀalr∁∎∓rtsĀ;u∉∊晥it»∊lip;怦con;抹r;쀀𝔥sĀew∣∩arow;椥arow;椦ʀamopr∺∾≃≞≣rr;懿tht;戻kĀlr≉≓eftarrow;憩ightarrow;憪f;쀀𝕙bar;怕ƀclt≯≴≸r;쀀𝒽asè⇴rok;䄧Ābp⊂⊇ull;恃hen»ᱛૡ⊣\0⊪\0⊸⋅⋎\0⋕⋳\0\0⋸⌢⍧⍢⍿\0⎆⎪⎴cute耻í䃭ƀ;iyݱ⊰⊵rc耻î䃮;䐸Ācx⊼⊿y;䐵cl耻¡䂡ĀfrΟ⋉;쀀𝔦rave耻ì䃬Ȁ;inoܾ⋝⋩⋮Āin⋢⋦nt;樌t;戭fin;槜ta;愩lig;䄳ƀaop⋾⌚⌝ƀcgt⌅⌈⌗r;䄫ƀelpܟ⌏⌓inåގarôܠh;䄱f;抷ed;䆵ʀ;cfotӴ⌬⌱⌽⍁are;愅inĀ;t⌸⌹戞ie;槝doô⌙ʀ;celpݗ⍌⍐⍛⍡al;抺Āgr⍕⍙eróᕣã⍍arhk;樗rod;樼Ȁcgpt⍯⍲⍶⍻y;䑑on;䄯f;쀀𝕚a;䎹uest耻¿䂿Āci⎊⎏r;쀀𝒾nʀ;EdsvӴ⎛⎝⎡ӳ;拹ot;拵Ā;v⎦⎧拴;拳Ā;iݷ⎮lde;䄩ǫ⎸\0⎼cy;䑖l耻ï䃯̀cfmosu⏌⏗⏜⏡⏧⏵Āiy⏑⏕rc;䄵;䐹r;쀀𝔧ath;䈷pf;쀀𝕛ǣ⏬\0⏱r;쀀𝒿rcy;䑘kcy;䑔Ѐacfghjos␋␖␢ppaĀ;v␓␔䎺;䏰Āey␛␠dil;䄷;䐺r;쀀𝔨reen;䄸cy;䑅cy;䑜pf;쀀𝕜cr;쀀𝓀ABEHabcdefghjlmnoprstuv⑰⒁⒆⒍⒑┎┽╚▀♎♞♥♹♽⚚⚲⛘❝❨➋⟀⠁⠒ƀart⑷⑺⑼ròòΕail;椛arr;椎Ā;gঔ⒋;檋ar;楢ॣ⒥\0⒪\0⒱\0\0\0\0\0⒵Ⓔ\0ⓆⓈⓍ\0⓹ute;䄺mptyv;榴raîࡌbda;䎻gƀ;dlࢎⓁⓃ;榑åࢎ;檅uo耻«䂫rЀ;bfhlpst࢙ⓞⓦⓩ⓫⓮⓱⓵Ā;f࢝ⓣs;椟s;椝ë≒p;憫l;椹im;楳l;憢ƀ;ae⓿─┄檫il;椙Ā;s┉┊檭;쀀⪭︀ƀabr┕┙┝rr;椌rk;杲Āak┢┬cĀek┨┪;䁻;䁛Āes┱┳;榋lĀdu┹┻;榏;榍Ȁaeuy╆╋╖╘ron;䄾Ādi═╔il;䄼ìࢰâ┩;䐻Ȁcqrs╣╦╭╽a;椶uoĀ;rนᝆĀdu╲╷har;楧shar;楋h;憲ʀ;fgqs▋▌উ◳◿扤tʀahlrt▘▤▷◂◨rrowĀ;t࢙□aé⓶arpoonĀdu▯▴own»њp»०eftarrows;懇ightƀahs◍◖◞rrowĀ;sࣴࢧarpoonóquigarro÷⇰hreetimes;拋ƀ;qs▋ও◺lanôবʀ;cdgsব☊☍☝☨c;檨otĀ;o☔☕橿Ā;r☚☛檁;檃Ā;e☢☥쀀⋚︀s;檓ʀadegs☳☹☽♉♋pproøⓆot;拖qĀgq♃♅ôউgtò⒌ôছiíলƀilr♕࣡♚sht;楼;쀀𝔩Ā;Eজ♣;檑š♩♶rĀdu▲♮Ā;l॥♳;楪lk;斄cy;䑙ʀ;achtੈ⚈⚋⚑⚖rò◁orneòᴈard;楫ri;旺Āio⚟⚤dot;䅀ustĀ;a⚬⚭掰che»⚭ȀEaes⚻⚽⛉⛔;扨pĀ;p⛃⛄檉rox»⛄Ā;q⛎⛏檇Ā;q⛎⚻im;拦Ѐabnoptwz⛩⛴⛷✚✯❁❇❐Ānr⛮⛱g;柬r;懽rëࣁgƀlmr⛿✍✔eftĀar০✇ightá৲apsto;柼ightá৽parrowĀlr✥✩efô⓭ight;憬ƀafl✶✹✽r;榅;쀀𝕝us;樭imes;樴š❋❏st;戗áፎƀ;ef❗❘᠀旊nge»❘arĀ;l❤❥䀨t;榓ʀachmt❳❶❼➅➇ròࢨorneòᶌarĀ;d➃;業;怎ri;抿̀achiqt➘➝ੀ➢➮➻quo;怹r;쀀𝓁mƀ;egল➪➬;檍;檏Ābu┪➳oĀ;rฟ➹;怚rok;䅂萀<;cdhilqrࠫ⟒☹⟜⟠⟥⟪⟰Āci⟗⟙;檦r;橹reå◲mes;拉arr;楶uest;橻ĀPi⟵⟹ar;榖ƀ;ef⠀भ旃rĀdu⠇⠍shar;楊har;楦Āen⠗⠡rtneqq;쀀≨︀Å⠞܀Dacdefhilnopsu⡀⡅⢂⢎⢓⢠⢥⢨⣚⣢⣤ઃ⣳⤂Dot;戺Ȁclpr⡎⡒⡣⡽r耻¯䂯Āet⡗⡙;時Ā;e⡞⡟朠se»⡟Ā;sျ⡨toȀ;dluျ⡳⡷⡻owîҌefôएðᏑker;斮Āoy⢇⢌mma;権;䐼ash;怔asuredangle»ᘦr;쀀𝔪o;愧ƀcdn⢯⢴⣉ro耻µ䂵Ȁ;acdᑤ⢽⣀⣄sôᚧir;櫰ot肻·Ƶusƀ;bd⣒ᤃ⣓戒Ā;uᴼ⣘;横ţ⣞⣡p;櫛ò−ðઁĀdp⣩⣮els;抧f;쀀𝕞Āct⣸⣽r;쀀𝓂pos»ᖝƀ;lm⤉⤊⤍䎼timap;抸ఀGLRVabcdefghijlmoprstuvw⥂⥓⥾⦉⦘⧚⧩⨕⨚⩘⩝⪃⪕⪤⪨⬄⬇⭄⭿⮮ⰴⱧⱼ⳩Āgt⥇⥋;쀀⋙̸Ā;v⥐쀀≫⃒ƀelt⥚⥲⥶ftĀar⥡⥧rrow;懍ightarrow;懎;쀀⋘̸Ā;v⥻ే쀀≪⃒ightarrow;懏ĀDd⦎⦓ash;抯ash;抮ʀbcnpt⦣⦧⦬⦱⧌la»˞ute;䅄g;쀀∠⃒ʀ;Eiop⦼⧀⧅⧈;쀀⩰̸d;쀀≋̸s;䅉roøurĀ;a⧓⧔普lĀ;s⧓ସdz⧟\0⧣p肻\xA0ଷmpĀ;e௹ఀʀaeouy⧴⧾⨃⨐⨓ǰ⧹\0⧻;橃on;䅈dil;䅆ngĀ;dൾ⨊ot;쀀⩭̸p;橂;䐽ash;怓;Aadqsxஒ⨩⨭⨻⩁⩅⩐rr;懗rĀhr⨳⨶k;椤Ā;oᏲᏰot;쀀≐̸uiöୣĀei⩊⩎ar;椨íistĀ;sடr;쀀𝔫ȀEest⩦⩹⩼ƀ;qs⩭ƀ;qs⩴lanôií௪Ā;rஶ⪁»ஷƀAap⪊⪍⪑rò⥱rr;憮ar;櫲ƀ;svྍ⪜ྌĀ;d⪡⪢拼;拺cy;䑚AEadest⪷⪺⪾⫂⫅⫶⫹rò⥦;쀀≦̸rr;憚r;急Ȁ;fqs⫎⫣⫯tĀar⫔⫙rro÷⫁ightarro÷⪐ƀ;qs⪺⫪lanôౕĀ;sౕ⫴»శiíౝĀ;rవ⫾iĀ;eచథiäඐĀpt⬌⬑f;쀀𝕟膀¬;in⬙⬚⬶䂬nȀ;Edvஉ⬤⬨⬮;쀀⋹̸ot;쀀⋵̸ǡஉ⬳⬵;拷;拶iĀ;vಸ⬼ǡಸ⭁⭃;拾;拽ƀaor⭋⭣⭩rȀ;ast⭕⭚⭟lleìl;쀀⫽⃥;쀀∂̸lint;樔ƀ;ceಒ⭰⭳uåಥĀ;cಘ⭸Ā;eಒ⭽ñಘȀAait⮈⮋⮝⮧rò⦈rrƀ;cw⮔⮕⮙憛;쀀⤳̸;쀀↝̸ghtarrow»⮕riĀ;eೋೖchimpqu⮽⯍⯙⬄⯤⯯Ȁ;cerല⯆ഷ⯉uå;쀀𝓃ortɭ⬅\0\0⯖ará⭖mĀ;e൮⯟Ā;q൴൳suĀbp⯫⯭ååഋƀbcp⯶ⰑⰙȀ;Ees⯿ⰀഢⰄ抄;쀀⫅̸etĀ;eഛⰋqĀ;qണⰀcĀ;eലⰗñസȀ;EesⰢⰣൟⰧ抅;쀀⫆̸etĀ;e൘ⰮqĀ;qൠⰣȀgilrⰽⰿⱅⱇìௗlde耻ñ䃱çృiangleĀlrⱒⱜeftĀ;eచⱚñదightĀ;eೋⱥñĀ;mⱬⱭ䎽ƀ;esⱴⱵⱹ䀣ro;愖p;怇ҀDHadgilrsⲏⲔⲙⲞⲣⲰⲶⳓⳣash;抭arr;椄p;쀀≍⃒ash;抬ĀetⲨⲬ;쀀≥⃒;쀀>⃒nfin;槞ƀAetⲽⳁⳅrr;椂;쀀≤⃒Ā;rⳊⳍ쀀<⃒ie;쀀⊴⃒ĀAtⳘⳜrr;椃rie;쀀⊵⃒im;쀀∼⃒ƀAan⳰ⴂrr;懖rĀhr⳺⳽k;椣Ā;oᏧᏥear;椧ቓ᪕\0\0\0\0\0\0\0\0\0\0\0\0\0ⴭ\0ⴸⵈⵠⵥⶄᬇ\0\0ⶍⶫ\0ⷈⷎ\0ⷜ⸙⸫⸾⹃Ācsⴱ᪗ute耻ó䃳ĀiyⴼⵅrĀ;cⵂ耻ô䃴;䐾ʀabios᪠ⵒⵗLjⵚlac;䅑v;樸old;榼lig;䅓Ācrir;榿;쀀𝔬ͯ\0\0\0ⶂn;䋛ave耻ò䃲;槁Ābmⶈ෴ar;榵Ȁacitⶕⶥⶨrò᪀Āirⶠr;榾oss;榻nå๒;槀ƀaeiⶱⶵⶹcr;䅍ga;䏉ƀcdnⷀⷅǍron;䎿;榶pf;쀀𝕠ƀaelⷔǒr;榷rp;榹;adiosvⷪⷫⷮ⸈⸍⸐⸖戨rò᪆Ȁ;efmⷷⷸ⸂⸅橝rĀ;oⷾⷿ愴f»ⷿ耻ª䂪耻º䂺gof;抶r;橖lope;橗;橛ƀclo⸟⸡⸧ò⸁ash耻ø䃸l;折iŬⸯ⸴de耻õ䃵esĀ;aǛ⸺s;樶ml耻ö䃶bar;挽ૡ\0\0⺀⺝\0⺢⺹\0\0⻋ຜ\0⼓\0\0⼫⾼\0⿈rȀ;astЃ脀¶;l䂶leìЃɩ\0\0m;櫳;櫽y;䐿rʀcimpt⺋⺏⺓ᡥ⺗nt;䀥od;䀮il;怰enk;怱r;쀀𝔭ƀimo⺨⺰⺴Ā;v⺭⺮䏆;䏕maô੶ne;明ƀ;tv⺿⻀⻈䏀chfork»´;䏖Āau⻏⻟nĀck⻕⻝kĀ;h⇴⻛;愎ö⇴sҀ;abcdemst⻳ᤈ⼄⼆⼊⼎䀫cir;樣ir;樢Āouᵀ⼂;樥;橲n肻±ຝim;樦wo;樧ƀipu⼙⼠⼥ntint;樕f;쀀𝕡nd耻£䂣Ԁ;Eaceinosu່⼿⽁⽄⽇⾁⾉⾒⽾⾶;檳p;檷uå໙Ā;c໎⽌̀;acens່⽙⽟⽦⽨⽾pproø⽃urlyeñ໙ñ໎ƀaes⽯⽶⽺pprox;檹qq;檵im;拨iíໟmeĀ;s⾈ຮ怲ƀEas⽸⾐⽺ð⽵ƀdfp⾙⾯ƀals⾠⾥⾪lar;挮ine;挒urf;挓Ā;t⾴ïrel;抰Āci⿀⿅r;쀀𝓅;䏈ncsp;怈̀fiopsu⋢⿱r;쀀𝔮pf;쀀𝕢rime;恗cr;쀀𝓆ƀaeo⿸〉〓tĀei々rnionóڰnt;樖stĀ;e【】䀿ñἙô༔ABHabcdefhilmnoprstuxけさすムㄎㄫㅇㅢㅲㆎ㈆㈕㈤㈩㉘㉮㉲㊐㊰㊷ƀartぇおがròႳòϝail;検aròᱥar;楤cdenqrtとふへみわゔヌĀeuねぱ;쀀∽̱te;䅕iãᅮmptyv;榳gȀ;del࿑らるろ;榒;榥å࿑uo耻»䂻rր;abcfhlpstwガクシスゼゾダッデナp;極Ā;fゴs;椠;椳s;椞ë≝ð✮l;楅im;楴l;憣;憝Āaiパフil;椚oĀ;nホボ戶aló༞ƀabrョリヮrò៥rk;杳ĀakンヽcĀekヹ・;䁽;䁝Āes;榌lĀduㄊㄌ;榎;榐Ȁaeuyㄗㄜㄧㄩron;䅙Ādiㄡㄥil;䅗ìâヺ;䑀Ȁclqsㄴㄷㄽㅄa;椷dhar;楩uoĀ;rȎȍh;憳ƀacgㅎㅟངlȀ;ipsླྀㅘㅛႜnåႻarôྩt;断ƀilrㅩဣㅮsht;楽;쀀𝔯ĀaoㅷㆆrĀduㅽㅿ»ѻĀ;l႑ㆄ;楬Ā;vㆋㆌ䏁;䏱ƀgns㆕ㇹㇼht̀ahlrstㆤㆰ㇂㇘rrowĀ;tㆭaéトarpoonĀduㆻㆿowîㅾp»႒eftĀah㇊㇐rrowóarpoonóՑightarrows;應quigarro÷ニhreetimes;拌g;䋚ingdotseñἲƀahm㈍㈐㈓ròaòՑ;怏oustĀ;a㈞掱che»mid;櫮Ȁabpt㈲㈽㉀㉒Ānr㈷㈺g;柭r;懾rëဃƀafl㉇㉊㉎r;榆;쀀𝕣us;樮imes;樵Āap㉝㉧rĀ;g㉣㉤䀩t;榔olint;樒arò㇣Ȁachq㉻㊀Ⴜ㊅quo;怺r;쀀𝓇Ābu・㊊oĀ;rȔȓƀhir㊗㊛㊠reåㇸmes;拊iȀ;efl㊪ၙᠡ㊫方tri;槎luhar;楨;愞ൡ㋕㋛㋟㌬㌸㍱\0㍺㎤\0\0㏬㏰\0㐨㑈㑚㒭㒱㓊㓱\0㘖\0\0㘳cute;䅛quï➺Ԁ;Eaceinpsyᇭ㋳㋵㋿㌂㌋㌏㌟㌦㌩;檴ǰ㋺\0㋼;檸on;䅡uåᇾĀ;dᇳ㌇il;䅟rc;䅝ƀEas㌖㌘㌛;檶p;檺im;择olint;樓iíሄ;䑁otƀ;be㌴ᵇ㌵担;橦Aacmstx㍆㍊㍗㍛㍞㍣㍭rr;懘rĀhr㍐㍒ë∨Ā;oਸ਼t耻§䂧i;䀻war;椩mĀin㍩ðnuóñt;朶rĀ;o㍶⁕쀀𝔰Ȁacoy㎂㎆㎑㎠rp;景Āhy㎋㎏cy;䑉;䑈rtɭ㎙\0\0㎜iäᑤaraì耻䂭Āgm㎨㎴maƀ;fv㎱㎲㎲䏃;䏂Ѐ;deglnprካ㏅㏉㏎㏖㏞㏡㏦ot;橪Ā;qኰĀ;E㏓㏔檞;檠Ā;E㏛㏜檝;檟e;扆lus;樤arr;楲aròᄽȀaeit㏸㐈㐏㐗Āls㏽㐄lsetmé㍪hp;樳parsl;槤Ādlᑣ㐔e;挣Ā;e㐜㐝檪Ā;s㐢㐣檬;쀀⪬︀ƀflp㐮㐳㑂tcy;䑌Ā;b㐸㐹䀯Ā;a㐾㐿槄r;挿f;쀀𝕤aĀdr㑍ЂesĀ;u㑔㑕晠it»㑕ƀcsu㑠㑹㒟Āau㑥㑯pĀ;sᆈ㑫;쀀⊓︀pĀ;sᆴ㑵;쀀⊔︀uĀbp㑿㒏ƀ;esᆗᆜ㒆etĀ;eᆗ㒍ñᆝƀ;esᆨᆭ㒖etĀ;eᆨ㒝ñᆮƀ;afᅻ㒦ְrť㒫ֱ»ᅼaròᅈȀcemt㒹㒾㓂㓅r;쀀𝓈tmîñiì㐕aræᆾĀar㓎㓕rĀ;f㓔ឿ昆Āan㓚㓭ightĀep㓣㓪psiloîỠhé⺯s»⡒ʀbcmnp㓻㕞ሉ㖋㖎Ҁ;Edemnprs㔎㔏㔑㔕㔞㔣㔬㔱㔶抂;櫅ot;檽Ā;dᇚ㔚ot;櫃ult;櫁ĀEe㔨㔪;櫋;把lus;檿arr;楹ƀeiu㔽㕒㕕tƀ;en㔎㕅㕋qĀ;qᇚ㔏eqĀ;q㔫㔨m;櫇Ābp㕚㕜;櫕;櫓c̀;acensᇭ㕬㕲㕹㕻㌦pproø㋺urlyeñᇾñᇳƀaes㖂㖈㌛pproø㌚qñ㌗g;晪ڀ123;Edehlmnps㖩㖬㖯ሜ㖲㖴㗀㗉㗕㗚㗟㗨㗭耻¹䂹耻²䂲耻³䂳;櫆Āos㖹㖼t;檾ub;櫘Ā;dሢ㗅ot;櫄sĀou㗏㗒l;柉b;櫗arr;楻ult;櫂ĀEe㗤㗦;櫌;抋lus;櫀ƀeiu㗴㘉㘌tƀ;enሜ㗼㘂qĀ;qሢ㖲eqĀ;q㗧㗤m;櫈Ābp㘑㘓;櫔;櫖ƀAan㘜㘠㘭rr;懙rĀhr㘦㘨ë∮Ā;oਫwar;椪lig耻ß䃟㙑㙝㙠ዎ㙳㙹\0㙾㛂\0\0\0\0\0㛛㜃\0㜉㝬\0\0\0㞇ɲ㙖\0\0㙛get;挖;䏄rëƀaey㙦㙫㙰ron;䅥dil;䅣;䑂lrec;挕r;쀀𝔱Ȁeiko㚆㚝㚵㚼Dz㚋\0㚑eĀ4fኄኁaƀ;sv㚘㚙㚛䎸ym;䏑Ācn㚢㚲kĀas㚨㚮pproøim»ኬsðኞĀas㚺㚮ðrn耻þ䃾Ǭ̟㛆⋧es膀×;bd㛏㛐㛘䃗Ā;aᤏ㛕r;樱;樰ƀeps㛡㛣㜀á⩍Ȁ;bcf҆㛬㛰㛴ot;挶ir;櫱Ā;o㛹㛼쀀𝕥rk;櫚á㍢rime;怴ƀaip㜏㜒㝤dåቈadempst㜡㝍㝀㝑㝗㝜㝟ngleʀ;dlqr㜰㜱㜶㝀㝂斵own»ᶻeftĀ;e⠀㜾ñम;扜ightĀ;e㊪㝋ñၚot;旬inus;樺lus;樹b;槍ime;樻ezium;揢ƀcht㝲㝽㞁Āry㝷㝻;쀀𝓉;䑆cy;䑛rok;䅧Āio㞋㞎xôheadĀlr㞗㞠eftarro÷ࡏightarrow»ཝऀAHabcdfghlmoprstuw㟐㟓㟗㟤㟰㟼㠎㠜㠣㠴㡑㡝㡫㢩㣌㣒㣪㣶ròϭar;楣Ācr㟜㟢ute耻ú䃺òᅐrǣ㟪\0㟭y;䑞ve;䅭Āiy㟵㟺rc耻û䃻;䑃ƀabh㠃㠆㠋ròᎭlac;䅱aòᏃĀir㠓㠘sht;楾;쀀𝔲rave耻ù䃹š㠧㠱rĀlr㠬㠮»ॗ»ႃlk;斀Āct㠹㡍ɯ㠿\0\0㡊rnĀ;e㡅㡆挜r»㡆op;挏ri;旸Āal㡖㡚cr;䅫肻¨͉Āgp㡢㡦on;䅳f;쀀𝕦̀adhlsuᅋ㡸㡽፲㢑㢠ownáᎳarpoonĀlr㢈㢌efô㠭ighô㠯iƀ;hl㢙㢚㢜䏅»ᏺon»㢚parrows;懈ƀcit㢰㣄㣈ɯ㢶\0\0㣁rnĀ;e㢼㢽挝r»㢽op;挎ng;䅯ri;旹cr;쀀𝓊ƀdir㣙㣝㣢ot;拰lde;䅩iĀ;f㜰㣨»᠓Āam㣯㣲rò㢨l耻ü䃼angle;榧ހABDacdeflnoprsz㤜㤟㤩㤭㦵㦸㦽㧟㧤㧨㧳㧹㧽㨁㨠ròϷarĀ;v㤦㤧櫨;櫩asèϡĀnr㤲㤷grt;榜eknprst㓣㥆㥋㥒㥝㥤㦖appá␕othinçẖƀhir㓫⻈㥙opô⾵Ā;hᎷ㥢ïㆍĀiu㥩㥭gmá㎳Ābp㥲㦄setneqĀ;q㥽㦀쀀⊊︀;쀀⫋︀setneqĀ;q㦏㦒쀀⊋︀;쀀⫌︀Āhr㦛㦟etá㚜iangleĀlr㦪㦯eft»थight»ၑy;䐲ash»ံƀelr㧄㧒㧗ƀ;beⷪ㧋㧏ar;抻q;扚lip;拮Ābt㧜ᑨaòᑩr;쀀𝔳tré㦮suĀbp㧯㧱»ജ»൙pf;쀀𝕧roðtré㦴Ācu㨆㨋r;쀀𝓋Ābp㨐㨘nĀEe㦀㨖»㥾nĀEe㦒㨞»㦐igzag;榚cefoprs㨶㨻㩖㩛㩔㩡㩪irc;䅵Ādi㩀㩑Ābg㩅㩉ar;機eĀ;qᗺ㩏;扙erp;愘r;쀀𝔴pf;쀀𝕨Ā;eᑹ㩦atèᑹcr;쀀𝓌ૣណ㪇\0㪋\0㪐㪛\0\0㪝㪨㪫㪯\0\0㫃㫎\0㫘ៜtré៑r;쀀𝔵ĀAa㪔㪗ròσrò৶;䎾ĀAa㪡㪤ròθrò৫að✓is;拻ƀdptឤ㪵㪾Āfl㪺ឩ;쀀𝕩imåឲĀAa㫇㫊ròώròਁĀcq㫒ីr;쀀𝓍Āpt៖㫜ré។Ѐacefiosu㫰㫽㬈㬌㬑㬕㬛㬡cĀuy㫶㫻te耻ý䃽;䑏Āiy㬂㬆rc;䅷;䑋n耻¥䂥r;쀀𝔶cy;䑗pf;쀀𝕪cr;쀀𝓎Ācm㬦㬩y;䑎l耻ÿ䃿Ԁacdefhiosw㭂㭈㭔㭘㭤㭩㭭㭴㭺㮀cute;䅺Āay㭍㭒ron;䅾;䐷ot;䅼Āet㭝㭡træᕟa;䎶r;쀀𝔷cy;䐶grarr;懝pf;쀀𝕫cr;쀀𝓏Ājn㮅㮇;怍j;怌`.split(``).map(e=>e.charCodeAt(0)));var _a$1;const decodeMap=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]),fromCodePoint$1=(_a$1=String.fromCodePoint)??function(e){let t=``;return e>65535&&(e-=65536,t+=String.fromCharCode(e>>>10&1023|55296),e=56320|e&1023),t+=String.fromCharCode(e),t};function replaceCodePoint(e){var t;return e>=55296&&e<=57343||e>1114111?65533:decodeMap.get(e)??e}var CharCodes;(function(e){e[e.NUM=35]=`NUM`,e[e.SEMI=59]=`SEMI`,e[e.EQUALS=61]=`EQUALS`,e[e.ZERO=48]=`ZERO`,e[e.NINE=57]=`NINE`,e[e.LOWER_A=97]=`LOWER_A`,e[e.LOWER_F=102]=`LOWER_F`,e[e.LOWER_X=120]=`LOWER_X`,e[e.LOWER_Z=122]=`LOWER_Z`,e[e.UPPER_A=65]=`UPPER_A`,e[e.UPPER_F=70]=`UPPER_F`,e[e.UPPER_Z=90]=`UPPER_Z`})(CharCodes||={});const TO_LOWER_BIT=32;var BinTrieFlags;(function(e){e[e.VALUE_LENGTH=49152]=`VALUE_LENGTH`,e[e.BRANCH_LENGTH=16256]=`BRANCH_LENGTH`,e[e.JUMP_TABLE=127]=`JUMP_TABLE`})(BinTrieFlags||={});function isNumber(e){return e>=CharCodes.ZERO&&e<=CharCodes.NINE}function isHexadecimalCharacter(e){return e>=CharCodes.UPPER_A&&e<=CharCodes.UPPER_F||e>=CharCodes.LOWER_A&&e<=CharCodes.LOWER_F}function isAsciiAlphaNumeric$1(e){return e>=CharCodes.UPPER_A&&e<=CharCodes.UPPER_Z||e>=CharCodes.LOWER_A&&e<=CharCodes.LOWER_Z||isNumber(e)}function isEntityInAttributeInvalidEnd(e){return e===CharCodes.EQUALS||isAsciiAlphaNumeric$1(e)}var EntityDecoderState;(function(e){e[e.EntityStart=0]=`EntityStart`,e[e.NumericStart=1]=`NumericStart`,e[e.NumericDecimal=2]=`NumericDecimal`,e[e.NumericHex=3]=`NumericHex`,e[e.NamedEntity=4]=`NamedEntity`})(EntityDecoderState||={});var DecodingMode;(function(e){e[e.Legacy=0]=`Legacy`,e[e.Strict=1]=`Strict`,e[e.Attribute=2]=`Attribute`})(DecodingMode||={});var EntityDecoder=class{constructor(e,t,S){this.decodeTree=e,this.emitCodePoint=t,this.errors=S,this.state=EntityDecoderState.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=DecodingMode.Strict}startEntity(e){this.decodeMode=e,this.state=EntityDecoderState.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(e,t){switch(this.state){case EntityDecoderState.EntityStart:return e.charCodeAt(t)===CharCodes.NUM?(this.state=EntityDecoderState.NumericStart,this.consumed+=1,this.stateNumericStart(e,t+1)):(this.state=EntityDecoderState.NamedEntity,this.stateNamedEntity(e,t));case EntityDecoderState.NumericStart:return this.stateNumericStart(e,t);case EntityDecoderState.NumericDecimal:return this.stateNumericDecimal(e,t);case EntityDecoderState.NumericHex:return this.stateNumericHex(e,t);case EntityDecoderState.NamedEntity:return this.stateNamedEntity(e,t)}}stateNumericStart(e,t){return t>=e.length?-1:(e.charCodeAt(t)|TO_LOWER_BIT)===CharCodes.LOWER_X?(this.state=EntityDecoderState.NumericHex,this.consumed+=1,this.stateNumericHex(e,t+1)):(this.state=EntityDecoderState.NumericDecimal,this.stateNumericDecimal(e,t))}addToNumericResult(e,t,S,w){if(t!==S){let E=S-t;this.result=this.result*w**+E+Number.parseInt(e.substr(t,E),w),this.consumed+=E}}stateNumericHex(e,t){let S=t;for(;t<e.length;){let w=e.charCodeAt(t);if(isNumber(w)||isHexadecimalCharacter(w))t+=1;else return this.addToNumericResult(e,S,t,16),this.emitNumericEntity(w,3)}return this.addToNumericResult(e,S,t,16),-1}stateNumericDecimal(e,t){let S=t;for(;t<e.length;){let w=e.charCodeAt(t);if(isNumber(w))t+=1;else return this.addToNumericResult(e,S,t,10),this.emitNumericEntity(w,2)}return this.addToNumericResult(e,S,t,10),-1}emitNumericEntity(e,t){var S;if(this.consumed<=t)return(S=this.errors)==null||S.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(e===CharCodes.SEMI)this.consumed+=1;else if(this.decodeMode===DecodingMode.Strict)return 0;return this.emitCodePoint(replaceCodePoint(this.result),this.consumed),this.errors&&(e!==CharCodes.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(e,t){let{decodeTree:S}=this,w=S[this.treeIndex],E=(w&BinTrieFlags.VALUE_LENGTH)>>14;for(;t<e.length;t++,this.excess++){let D=e.charCodeAt(t);if(this.treeIndex=determineBranch(S,w,this.treeIndex+Math.max(1,E),D),this.treeIndex<0)return this.result===0||this.decodeMode===DecodingMode.Attribute&&(E===0||isEntityInAttributeInvalidEnd(D))?0:this.emitNotTerminatedNamedEntity();if(w=S[this.treeIndex],E=(w&BinTrieFlags.VALUE_LENGTH)>>14,E!==0){if(D===CharCodes.SEMI)return this.emitNamedEntityData(this.treeIndex,E,this.consumed+this.excess);this.decodeMode!==DecodingMode.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var e;let{result:t,decodeTree:S}=this,w=(S[t]&BinTrieFlags.VALUE_LENGTH)>>14;return this.emitNamedEntityData(t,w,this.consumed),(e=this.errors)==null||e.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(e,t,S){let{decodeTree:w}=this;return this.emitCodePoint(t===1?w[e]&~BinTrieFlags.VALUE_LENGTH:w[e+1],S),t===3&&this.emitCodePoint(w[e+2],S),S}end(){var e;switch(this.state){case EntityDecoderState.NamedEntity:return this.result!==0&&(this.decodeMode!==DecodingMode.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case EntityDecoderState.NumericDecimal:return this.emitNumericEntity(0,2);case EntityDecoderState.NumericHex:return this.emitNumericEntity(0,3);case EntityDecoderState.NumericStart:return(e=this.errors)==null||e.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case EntityDecoderState.EntityStart:return 0}}};function determineBranch(e,t,S,w){let E=(t&BinTrieFlags.BRANCH_LENGTH)>>7,D=t&BinTrieFlags.JUMP_TABLE;if(E===0)return D!==0&&w===D?S:-1;if(D){let t=w-D;return t<0||t>=E?-1:e[S+t]-1}let O=S,k=O+E-1;for(;O<=k;){let t=O+k>>>1,S=e[t];if(S<w)O=t+1;else if(S>w)k=t-1;else return e[t+E]}return-1}var NS;(function(e){e.HTML=`http://www.w3.org/1999/xhtml`,e.MATHML=`http://www.w3.org/1998/Math/MathML`,e.SVG=`http://www.w3.org/2000/svg`,e.XLINK=`http://www.w3.org/1999/xlink`,e.XML=`http://www.w3.org/XML/1998/namespace`,e.XMLNS=`http://www.w3.org/2000/xmlns/`})(NS||={});var ATTRS;(function(e){e.TYPE=`type`,e.ACTION=`action`,e.ENCODING=`encoding`,e.PROMPT=`prompt`,e.NAME=`name`,e.COLOR=`color`,e.FACE=`face`,e.SIZE=`size`})(ATTRS||={});var DOCUMENT_MODE;(function(e){e.NO_QUIRKS=`no-quirks`,e.QUIRKS=`quirks`,e.LIMITED_QUIRKS=`limited-quirks`})(DOCUMENT_MODE||={});var TAG_NAMES;(function(e){e.A=`a`,e.ADDRESS=`address`,e.ANNOTATION_XML=`annotation-xml`,e.APPLET=`applet`,e.AREA=`area`,e.ARTICLE=`article`,e.ASIDE=`aside`,e.B=`b`,e.BASE=`base`,e.BASEFONT=`basefont`,e.BGSOUND=`bgsound`,e.BIG=`big`,e.BLOCKQUOTE=`blockquote`,e.BODY=`body`,e.BR=`br`,e.BUTTON=`button`,e.CAPTION=`caption`,e.CENTER=`center`,e.CODE=`code`,e.COL=`col`,e.COLGROUP=`colgroup`,e.DD=`dd`,e.DESC=`desc`,e.DETAILS=`details`,e.DIALOG=`dialog`,e.DIR=`dir`,e.DIV=`div`,e.DL=`dl`,e.DT=`dt`,e.EM=`em`,e.EMBED=`embed`,e.FIELDSET=`fieldset`,e.FIGCAPTION=`figcaption`,e.FIGURE=`figure`,e.FONT=`font`,e.FOOTER=`footer`,e.FOREIGN_OBJECT=`foreignObject`,e.FORM=`form`,e.FRAME=`frame`,e.FRAMESET=`frameset`,e.H1=`h1`,e.H2=`h2`,e.H3=`h3`,e.H4=`h4`,e.H5=`h5`,e.H6=`h6`,e.HEAD=`head`,e.HEADER=`header`,e.HGROUP=`hgroup`,e.HR=`hr`,e.HTML=`html`,e.I=`i`,e.IMG=`img`,e.IMAGE=`image`,e.INPUT=`input`,e.IFRAME=`iframe`,e.KEYGEN=`keygen`,e.LABEL=`label`,e.LI=`li`,e.LINK=`link`,e.LISTING=`listing`,e.MAIN=`main`,e.MALIGNMARK=`malignmark`,e.MARQUEE=`marquee`,e.MATH=`math`,e.MENU=`menu`,e.META=`meta`,e.MGLYPH=`mglyph`,e.MI=`mi`,e.MO=`mo`,e.MN=`mn`,e.MS=`ms`,e.MTEXT=`mtext`,e.NAV=`nav`,e.NOBR=`nobr`,e.NOFRAMES=`noframes`,e.NOEMBED=`noembed`,e.NOSCRIPT=`noscript`,e.OBJECT=`object`,e.OL=`ol`,e.OPTGROUP=`optgroup`,e.OPTION=`option`,e.P=`p`,e.PARAM=`param`,e.PLAINTEXT=`plaintext`,e.PRE=`pre`,e.RB=`rb`,e.RP=`rp`,e.RT=`rt`,e.RTC=`rtc`,e.RUBY=`ruby`,e.S=`s`,e.SCRIPT=`script`,e.SEARCH=`search`,e.SECTION=`section`,e.SELECT=`select`,e.SOURCE=`source`,e.SMALL=`small`,e.SPAN=`span`,e.STRIKE=`strike`,e.STRONG=`strong`,e.STYLE=`style`,e.SUB=`sub`,e.SUMMARY=`summary`,e.SUP=`sup`,e.TABLE=`table`,e.TBODY=`tbody`,e.TEMPLATE=`template`,e.TEXTAREA=`textarea`,e.TFOOT=`tfoot`,e.TD=`td`,e.TH=`th`,e.THEAD=`thead`,e.TITLE=`title`,e.TR=`tr`,e.TRACK=`track`,e.TT=`tt`,e.U=`u`,e.UL=`ul`,e.SVG=`svg`,e.VAR=`var`,e.WBR=`wbr`,e.XMP=`xmp`})(TAG_NAMES||={});var TAG_ID;(function(e){e[e.UNKNOWN=0]=`UNKNOWN`,e[e.A=1]=`A`,e[e.ADDRESS=2]=`ADDRESS`,e[e.ANNOTATION_XML=3]=`ANNOTATION_XML`,e[e.APPLET=4]=`APPLET`,e[e.AREA=5]=`AREA`,e[e.ARTICLE=6]=`ARTICLE`,e[e.ASIDE=7]=`ASIDE`,e[e.B=8]=`B`,e[e.BASE=9]=`BASE`,e[e.BASEFONT=10]=`BASEFONT`,e[e.BGSOUND=11]=`BGSOUND`,e[e.BIG=12]=`BIG`,e[e.BLOCKQUOTE=13]=`BLOCKQUOTE`,e[e.BODY=14]=`BODY`,e[e.BR=15]=`BR`,e[e.BUTTON=16]=`BUTTON`,e[e.CAPTION=17]=`CAPTION`,e[e.CENTER=18]=`CENTER`,e[e.CODE=19]=`CODE`,e[e.COL=20]=`COL`,e[e.COLGROUP=21]=`COLGROUP`,e[e.DD=22]=`DD`,e[e.DESC=23]=`DESC`,e[e.DETAILS=24]=`DETAILS`,e[e.DIALOG=25]=`DIALOG`,e[e.DIR=26]=`DIR`,e[e.DIV=27]=`DIV`,e[e.DL=28]=`DL`,e[e.DT=29]=`DT`,e[e.EM=30]=`EM`,e[e.EMBED=31]=`EMBED`,e[e.FIELDSET=32]=`FIELDSET`,e[e.FIGCAPTION=33]=`FIGCAPTION`,e[e.FIGURE=34]=`FIGURE`,e[e.FONT=35]=`FONT`,e[e.FOOTER=36]=`FOOTER`,e[e.FOREIGN_OBJECT=37]=`FOREIGN_OBJECT`,e[e.FORM=38]=`FORM`,e[e.FRAME=39]=`FRAME`,e[e.FRAMESET=40]=`FRAMESET`,e[e.H1=41]=`H1`,e[e.H2=42]=`H2`,e[e.H3=43]=`H3`,e[e.H4=44]=`H4`,e[e.H5=45]=`H5`,e[e.H6=46]=`H6`,e[e.HEAD=47]=`HEAD`,e[e.HEADER=48]=`HEADER`,e[e.HGROUP=49]=`HGROUP`,e[e.HR=50]=`HR`,e[e.HTML=51]=`HTML`,e[e.I=52]=`I`,e[e.IMG=53]=`IMG`,e[e.IMAGE=54]=`IMAGE`,e[e.INPUT=55]=`INPUT`,e[e.IFRAME=56]=`IFRAME`,e[e.KEYGEN=57]=`KEYGEN`,e[e.LABEL=58]=`LABEL`,e[e.LI=59]=`LI`,e[e.LINK=60]=`LINK`,e[e.LISTING=61]=`LISTING`,e[e.MAIN=62]=`MAIN`,e[e.MALIGNMARK=63]=`MALIGNMARK`,e[e.MARQUEE=64]=`MARQUEE`,e[e.MATH=65]=`MATH`,e[e.MENU=66]=`MENU`,e[e.META=67]=`META`,e[e.MGLYPH=68]=`MGLYPH`,e[e.MI=69]=`MI`,e[e.MO=70]=`MO`,e[e.MN=71]=`MN`,e[e.MS=72]=`MS`,e[e.MTEXT=73]=`MTEXT`,e[e.NAV=74]=`NAV`,e[e.NOBR=75]=`NOBR`,e[e.NOFRAMES=76]=`NOFRAMES`,e[e.NOEMBED=77]=`NOEMBED`,e[e.NOSCRIPT=78]=`NOSCRIPT`,e[e.OBJECT=79]=`OBJECT`,e[e.OL=80]=`OL`,e[e.OPTGROUP=81]=`OPTGROUP`,e[e.OPTION=82]=`OPTION`,e[e.P=83]=`P`,e[e.PARAM=84]=`PARAM`,e[e.PLAINTEXT=85]=`PLAINTEXT`,e[e.PRE=86]=`PRE`,e[e.RB=87]=`RB`,e[e.RP=88]=`RP`,e[e.RT=89]=`RT`,e[e.RTC=90]=`RTC`,e[e.RUBY=91]=`RUBY`,e[e.S=92]=`S`,e[e.SCRIPT=93]=`SCRIPT`,e[e.SEARCH=94]=`SEARCH`,e[e.SECTION=95]=`SECTION`,e[e.SELECT=96]=`SELECT`,e[e.SOURCE=97]=`SOURCE`,e[e.SMALL=98]=`SMALL`,e[e.SPAN=99]=`SPAN`,e[e.STRIKE=100]=`STRIKE`,e[e.STRONG=101]=`STRONG`,e[e.STYLE=102]=`STYLE`,e[e.SUB=103]=`SUB`,e[e.SUMMARY=104]=`SUMMARY`,e[e.SUP=105]=`SUP`,e[e.TABLE=106]=`TABLE`,e[e.TBODY=107]=`TBODY`,e[e.TEMPLATE=108]=`TEMPLATE`,e[e.TEXTAREA=109]=`TEXTAREA`,e[e.TFOOT=110]=`TFOOT`,e[e.TD=111]=`TD`,e[e.TH=112]=`TH`,e[e.THEAD=113]=`THEAD`,e[e.TITLE=114]=`TITLE`,e[e.TR=115]=`TR`,e[e.TRACK=116]=`TRACK`,e[e.TT=117]=`TT`,e[e.U=118]=`U`,e[e.UL=119]=`UL`,e[e.SVG=120]=`SVG`,e[e.VAR=121]=`VAR`,e[e.WBR=122]=`WBR`,e[e.XMP=123]=`XMP`})(TAG_ID||={});const TAG_NAME_TO_ID=new Map([[TAG_NAMES.A,TAG_ID.A],[TAG_NAMES.ADDRESS,TAG_ID.ADDRESS],[TAG_NAMES.ANNOTATION_XML,TAG_ID.ANNOTATION_XML],[TAG_NAMES.APPLET,TAG_ID.APPLET],[TAG_NAMES.AREA,TAG_ID.AREA],[TAG_NAMES.ARTICLE,TAG_ID.ARTICLE],[TAG_NAMES.ASIDE,TAG_ID.ASIDE],[TAG_NAMES.B,TAG_ID.B],[TAG_NAMES.BASE,TAG_ID.BASE],[TAG_NAMES.BASEFONT,TAG_ID.BASEFONT],[TAG_NAMES.BGSOUND,TAG_ID.BGSOUND],[TAG_NAMES.BIG,TAG_ID.BIG],[TAG_NAMES.BLOCKQUOTE,TAG_ID.BLOCKQUOTE],[TAG_NAMES.BODY,TAG_ID.BODY],[TAG_NAMES.BR,TAG_ID.BR],[TAG_NAMES.BUTTON,TAG_ID.BUTTON],[TAG_NAMES.CAPTION,TAG_ID.CAPTION],[TAG_NAMES.CENTER,TAG_ID.CENTER],[TAG_NAMES.CODE,TAG_ID.CODE],[TAG_NAMES.COL,TAG_ID.COL],[TAG_NAMES.COLGROUP,TAG_ID.COLGROUP],[TAG_NAMES.DD,TAG_ID.DD],[TAG_NAMES.DESC,TAG_ID.DESC],[TAG_NAMES.DETAILS,TAG_ID.DETAILS],[TAG_NAMES.DIALOG,TAG_ID.DIALOG],[TAG_NAMES.DIR,TAG_ID.DIR],[TAG_NAMES.DIV,TAG_ID.DIV],[TAG_NAMES.DL,TAG_ID.DL],[TAG_NAMES.DT,TAG_ID.DT],[TAG_NAMES.EM,TAG_ID.EM],[TAG_NAMES.EMBED,TAG_ID.EMBED],[TAG_NAMES.FIELDSET,TAG_ID.FIELDSET],[TAG_NAMES.FIGCAPTION,TAG_ID.FIGCAPTION],[TAG_NAMES.FIGURE,TAG_ID.FIGURE],[TAG_NAMES.FONT,TAG_ID.FONT],[TAG_NAMES.FOOTER,TAG_ID.FOOTER],[TAG_NAMES.FOREIGN_OBJECT,TAG_ID.FOREIGN_OBJECT],[TAG_NAMES.FORM,TAG_ID.FORM],[TAG_NAMES.FRAME,TAG_ID.FRAME],[TAG_NAMES.FRAMESET,TAG_ID.FRAMESET],[TAG_NAMES.H1,TAG_ID.H1],[TAG_NAMES.H2,TAG_ID.H2],[TAG_NAMES.H3,TAG_ID.H3],[TAG_NAMES.H4,TAG_ID.H4],[TAG_NAMES.H5,TAG_ID.H5],[TAG_NAMES.H6,TAG_ID.H6],[TAG_NAMES.HEAD,TAG_ID.HEAD],[TAG_NAMES.HEADER,TAG_ID.HEADER],[TAG_NAMES.HGROUP,TAG_ID.HGROUP],[TAG_NAMES.HR,TAG_ID.HR],[TAG_NAMES.HTML,TAG_ID.HTML],[TAG_NAMES.I,TAG_ID.I],[TAG_NAMES.IMG,TAG_ID.IMG],[TAG_NAMES.IMAGE,TAG_ID.IMAGE],[TAG_NAMES.INPUT,TAG_ID.INPUT],[TAG_NAMES.IFRAME,TAG_ID.IFRAME],[TAG_NAMES.KEYGEN,TAG_ID.KEYGEN],[TAG_NAMES.LABEL,TAG_ID.LABEL],[TAG_NAMES.LI,TAG_ID.LI],[TAG_NAMES.LINK,TAG_ID.LINK],[TAG_NAMES.LISTING,TAG_ID.LISTING],[TAG_NAMES.MAIN,TAG_ID.MAIN],[TAG_NAMES.MALIGNMARK,TAG_ID.MALIGNMARK],[TAG_NAMES.MARQUEE,TAG_ID.MARQUEE],[TAG_NAMES.MATH,TAG_ID.MATH],[TAG_NAMES.MENU,TAG_ID.MENU],[TAG_NAMES.META,TAG_ID.META],[TAG_NAMES.MGLYPH,TAG_ID.MGLYPH],[TAG_NAMES.MI,TAG_ID.MI],[TAG_NAMES.MO,TAG_ID.MO],[TAG_NAMES.MN,TAG_ID.MN],[TAG_NAMES.MS,TAG_ID.MS],[TAG_NAMES.MTEXT,TAG_ID.MTEXT],[TAG_NAMES.NAV,TAG_ID.NAV],[TAG_NAMES.NOBR,TAG_ID.NOBR],[TAG_NAMES.NOFRAMES,TAG_ID.NOFRAMES],[TAG_NAMES.NOEMBED,TAG_ID.NOEMBED],[TAG_NAMES.NOSCRIPT,TAG_ID.NOSCRIPT],[TAG_NAMES.OBJECT,TAG_ID.OBJECT],[TAG_NAMES.OL,TAG_ID.OL],[TAG_NAMES.OPTGROUP,TAG_ID.OPTGROUP],[TAG_NAMES.OPTION,TAG_ID.OPTION],[TAG_NAMES.P,TAG_ID.P],[TAG_NAMES.PARAM,TAG_ID.PARAM],[TAG_NAMES.PLAINTEXT,TAG_ID.PLAINTEXT],[TAG_NAMES.PRE,TAG_ID.PRE],[TAG_NAMES.RB,TAG_ID.RB],[TAG_NAMES.RP,TAG_ID.RP],[TAG_NAMES.RT,TAG_ID.RT],[TAG_NAMES.RTC,TAG_ID.RTC],[TAG_NAMES.RUBY,TAG_ID.RUBY],[TAG_NAMES.S,TAG_ID.S],[TAG_NAMES.SCRIPT,TAG_ID.SCRIPT],[TAG_NAMES.SEARCH,TAG_ID.SEARCH],[TAG_NAMES.SECTION,TAG_ID.SECTION],[TAG_NAMES.SELECT,TAG_ID.SELECT],[TAG_NAMES.SOURCE,TAG_ID.SOURCE],[TAG_NAMES.SMALL,TAG_ID.SMALL],[TAG_NAMES.SPAN,TAG_ID.SPAN],[TAG_NAMES.STRIKE,TAG_ID.STRIKE],[TAG_NAMES.STRONG,TAG_ID.STRONG],[TAG_NAMES.STYLE,TAG_ID.STYLE],[TAG_NAMES.SUB,TAG_ID.SUB],[TAG_NAMES.SUMMARY,TAG_ID.SUMMARY],[TAG_NAMES.SUP,TAG_ID.SUP],[TAG_NAMES.TABLE,TAG_ID.TABLE],[TAG_NAMES.TBODY,TAG_ID.TBODY],[TAG_NAMES.TEMPLATE,TAG_ID.TEMPLATE],[TAG_NAMES.TEXTAREA,TAG_ID.TEXTAREA],[TAG_NAMES.TFOOT,TAG_ID.TFOOT],[TAG_NAMES.TD,TAG_ID.TD],[TAG_NAMES.TH,TAG_ID.TH],[TAG_NAMES.THEAD,TAG_ID.THEAD],[TAG_NAMES.TITLE,TAG_ID.TITLE],[TAG_NAMES.TR,TAG_ID.TR],[TAG_NAMES.TRACK,TAG_ID.TRACK],[TAG_NAMES.TT,TAG_ID.TT],[TAG_NAMES.U,TAG_ID.U],[TAG_NAMES.UL,TAG_ID.UL],[TAG_NAMES.SVG,TAG_ID.SVG],[TAG_NAMES.VAR,TAG_ID.VAR],[TAG_NAMES.WBR,TAG_ID.WBR],[TAG_NAMES.XMP,TAG_ID.XMP]]);function getTagID(e){var t;return TAG_NAME_TO_ID.get(e)??TAG_ID.UNKNOWN}const $$1=TAG_ID,SPECIAL_ELEMENTS={[NS.HTML]:new Set([$$1.ADDRESS,$$1.APPLET,$$1.AREA,$$1.ARTICLE,$$1.ASIDE,$$1.BASE,$$1.BASEFONT,$$1.BGSOUND,$$1.BLOCKQUOTE,$$1.BODY,$$1.BR,$$1.BUTTON,$$1.CAPTION,$$1.CENTER,$$1.COL,$$1.COLGROUP,$$1.DD,$$1.DETAILS,$$1.DIR,$$1.DIV,$$1.DL,$$1.DT,$$1.EMBED,$$1.FIELDSET,$$1.FIGCAPTION,$$1.FIGURE,$$1.FOOTER,$$1.FORM,$$1.FRAME,$$1.FRAMESET,$$1.H1,$$1.H2,$$1.H3,$$1.H4,$$1.H5,$$1.H6,$$1.HEAD,$$1.HEADER,$$1.HGROUP,$$1.HR,$$1.HTML,$$1.IFRAME,$$1.IMG,$$1.INPUT,$$1.LI,$$1.LINK,$$1.LISTING,$$1.MAIN,$$1.MARQUEE,$$1.MENU,$$1.META,$$1.NAV,$$1.NOEMBED,$$1.NOFRAMES,$$1.NOSCRIPT,$$1.OBJECT,$$1.OL,$$1.P,$$1.PARAM,$$1.PLAINTEXT,$$1.PRE,$$1.SCRIPT,$$1.SECTION,$$1.SELECT,$$1.SOURCE,$$1.STYLE,$$1.SUMMARY,$$1.TABLE,$$1.TBODY,$$1.TD,$$1.TEMPLATE,$$1.TEXTAREA,$$1.TFOOT,$$1.TH,$$1.THEAD,$$1.TITLE,$$1.TR,$$1.TRACK,$$1.UL,$$1.WBR,$$1.XMP]),[NS.MATHML]:new Set([$$1.MI,$$1.MO,$$1.MN,$$1.MS,$$1.MTEXT,$$1.ANNOTATION_XML]),[NS.SVG]:new Set([$$1.TITLE,$$1.FOREIGN_OBJECT,$$1.DESC]),[NS.XLINK]:new Set,[NS.XML]:new Set,[NS.XMLNS]:new Set},NUMBERED_HEADERS=new Set([$$1.H1,$$1.H2,$$1.H3,$$1.H4,$$1.H5,$$1.H6]),UNESCAPED_TEXT=new Set([TAG_NAMES.STYLE,TAG_NAMES.SCRIPT,TAG_NAMES.XMP,TAG_NAMES.IFRAME,TAG_NAMES.NOEMBED,TAG_NAMES.NOFRAMES,TAG_NAMES.PLAINTEXT]);var State;(function(e){e[e.DATA=0]=`DATA`,e[e.RCDATA=1]=`RCDATA`,e[e.RAWTEXT=2]=`RAWTEXT`,e[e.SCRIPT_DATA=3]=`SCRIPT_DATA`,e[e.PLAINTEXT=4]=`PLAINTEXT`,e[e.TAG_OPEN=5]=`TAG_OPEN`,e[e.END_TAG_OPEN=6]=`END_TAG_OPEN`,e[e.TAG_NAME=7]=`TAG_NAME`,e[e.RCDATA_LESS_THAN_SIGN=8]=`RCDATA_LESS_THAN_SIGN`,e[e.RCDATA_END_TAG_OPEN=9]=`RCDATA_END_TAG_OPEN`,e[e.RCDATA_END_TAG_NAME=10]=`RCDATA_END_TAG_NAME`,e[e.RAWTEXT_LESS_THAN_SIGN=11]=`RAWTEXT_LESS_THAN_SIGN`,e[e.RAWTEXT_END_TAG_OPEN=12]=`RAWTEXT_END_TAG_OPEN`,e[e.RAWTEXT_END_TAG_NAME=13]=`RAWTEXT_END_TAG_NAME`,e[e.SCRIPT_DATA_LESS_THAN_SIGN=14]=`SCRIPT_DATA_LESS_THAN_SIGN`,e[e.SCRIPT_DATA_END_TAG_OPEN=15]=`SCRIPT_DATA_END_TAG_OPEN`,e[e.SCRIPT_DATA_END_TAG_NAME=16]=`SCRIPT_DATA_END_TAG_NAME`,e[e.SCRIPT_DATA_ESCAPE_START=17]=`SCRIPT_DATA_ESCAPE_START`,e[e.SCRIPT_DATA_ESCAPE_START_DASH=18]=`SCRIPT_DATA_ESCAPE_START_DASH`,e[e.SCRIPT_DATA_ESCAPED=19]=`SCRIPT_DATA_ESCAPED`,e[e.SCRIPT_DATA_ESCAPED_DASH=20]=`SCRIPT_DATA_ESCAPED_DASH`,e[e.SCRIPT_DATA_ESCAPED_DASH_DASH=21]=`SCRIPT_DATA_ESCAPED_DASH_DASH`,e[e.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN=22]=`SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN`,e[e.SCRIPT_DATA_ESCAPED_END_TAG_OPEN=23]=`SCRIPT_DATA_ESCAPED_END_TAG_OPEN`,e[e.SCRIPT_DATA_ESCAPED_END_TAG_NAME=24]=`SCRIPT_DATA_ESCAPED_END_TAG_NAME`,e[e.SCRIPT_DATA_DOUBLE_ESCAPE_START=25]=`SCRIPT_DATA_DOUBLE_ESCAPE_START`,e[e.SCRIPT_DATA_DOUBLE_ESCAPED=26]=`SCRIPT_DATA_DOUBLE_ESCAPED`,e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH=27]=`SCRIPT_DATA_DOUBLE_ESCAPED_DASH`,e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH=28]=`SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH`,e[e.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN=29]=`SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN`,e[e.SCRIPT_DATA_DOUBLE_ESCAPE_END=30]=`SCRIPT_DATA_DOUBLE_ESCAPE_END`,e[e.BEFORE_ATTRIBUTE_NAME=31]=`BEFORE_ATTRIBUTE_NAME`,e[e.ATTRIBUTE_NAME=32]=`ATTRIBUTE_NAME`,e[e.AFTER_ATTRIBUTE_NAME=33]=`AFTER_ATTRIBUTE_NAME`,e[e.BEFORE_ATTRIBUTE_VALUE=34]=`BEFORE_ATTRIBUTE_VALUE`,e[e.ATTRIBUTE_VALUE_DOUBLE_QUOTED=35]=`ATTRIBUTE_VALUE_DOUBLE_QUOTED`,e[e.ATTRIBUTE_VALUE_SINGLE_QUOTED=36]=`ATTRIBUTE_VALUE_SINGLE_QUOTED`,e[e.ATTRIBUTE_VALUE_UNQUOTED=37]=`ATTRIBUTE_VALUE_UNQUOTED`,e[e.AFTER_ATTRIBUTE_VALUE_QUOTED=38]=`AFTER_ATTRIBUTE_VALUE_QUOTED`,e[e.SELF_CLOSING_START_TAG=39]=`SELF_CLOSING_START_TAG`,e[e.BOGUS_COMMENT=40]=`BOGUS_COMMENT`,e[e.MARKUP_DECLARATION_OPEN=41]=`MARKUP_DECLARATION_OPEN`,e[e.COMMENT_START=42]=`COMMENT_START`,e[e.COMMENT_START_DASH=43]=`COMMENT_START_DASH`,e[e.COMMENT=44]=`COMMENT`,e[e.COMMENT_LESS_THAN_SIGN=45]=`COMMENT_LESS_THAN_SIGN`,e[e.COMMENT_LESS_THAN_SIGN_BANG=46]=`COMMENT_LESS_THAN_SIGN_BANG`,e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH=47]=`COMMENT_LESS_THAN_SIGN_BANG_DASH`,e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH=48]=`COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH`,e[e.COMMENT_END_DASH=49]=`COMMENT_END_DASH`,e[e.COMMENT_END=50]=`COMMENT_END`,e[e.COMMENT_END_BANG=51]=`COMMENT_END_BANG`,e[e.DOCTYPE=52]=`DOCTYPE`,e[e.BEFORE_DOCTYPE_NAME=53]=`BEFORE_DOCTYPE_NAME`,e[e.DOCTYPE_NAME=54]=`DOCTYPE_NAME`,e[e.AFTER_DOCTYPE_NAME=55]=`AFTER_DOCTYPE_NAME`,e[e.AFTER_DOCTYPE_PUBLIC_KEYWORD=56]=`AFTER_DOCTYPE_PUBLIC_KEYWORD`,e[e.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER=57]=`BEFORE_DOCTYPE_PUBLIC_IDENTIFIER`,e[e.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED=58]=`DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED`,e[e.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED=59]=`DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED`,e[e.AFTER_DOCTYPE_PUBLIC_IDENTIFIER=60]=`AFTER_DOCTYPE_PUBLIC_IDENTIFIER`,e[e.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS=61]=`BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS`,e[e.AFTER_DOCTYPE_SYSTEM_KEYWORD=62]=`AFTER_DOCTYPE_SYSTEM_KEYWORD`,e[e.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER=63]=`BEFORE_DOCTYPE_SYSTEM_IDENTIFIER`,e[e.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED=64]=`DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED`,e[e.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED=65]=`DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED`,e[e.AFTER_DOCTYPE_SYSTEM_IDENTIFIER=66]=`AFTER_DOCTYPE_SYSTEM_IDENTIFIER`,e[e.BOGUS_DOCTYPE=67]=`BOGUS_DOCTYPE`,e[e.CDATA_SECTION=68]=`CDATA_SECTION`,e[e.CDATA_SECTION_BRACKET=69]=`CDATA_SECTION_BRACKET`,e[e.CDATA_SECTION_END=70]=`CDATA_SECTION_END`,e[e.CHARACTER_REFERENCE=71]=`CHARACTER_REFERENCE`,e[e.AMBIGUOUS_AMPERSAND=72]=`AMBIGUOUS_AMPERSAND`})(State||={});const TokenizerMode={DATA:State.DATA,RCDATA:State.RCDATA,RAWTEXT:State.RAWTEXT,SCRIPT_DATA:State.SCRIPT_DATA,PLAINTEXT:State.PLAINTEXT,CDATA_SECTION:State.CDATA_SECTION};function isAsciiDigit(e){return e>=CODE_POINTS.DIGIT_0&&e<=CODE_POINTS.DIGIT_9}function isAsciiUpper(e){return e>=CODE_POINTS.LATIN_CAPITAL_A&&e<=CODE_POINTS.LATIN_CAPITAL_Z}function isAsciiLower(e){return e>=CODE_POINTS.LATIN_SMALL_A&&e<=CODE_POINTS.LATIN_SMALL_Z}function isAsciiLetter(e){return isAsciiLower(e)||isAsciiUpper(e)}function isAsciiAlphaNumeric(e){return isAsciiLetter(e)||isAsciiDigit(e)}function toAsciiLower(e){return e+32}function isWhitespace$1(e){return e===CODE_POINTS.SPACE||e===CODE_POINTS.LINE_FEED||e===CODE_POINTS.TABULATION||e===CODE_POINTS.FORM_FEED}function isScriptDataDoubleEscapeSequenceEnd(e){return isWhitespace$1(e)||e===CODE_POINTS.SOLIDUS||e===CODE_POINTS.GREATER_THAN_SIGN}function getErrorForNumericCharacterReference(e){return e===CODE_POINTS.NULL?ERR.nullCharacterReference:e>1114111?ERR.characterReferenceOutsideUnicodeRange:isSurrogate(e)?ERR.surrogateCharacterReference:isUndefinedCodePoint(e)?ERR.noncharacterCharacterReference:isControlCodePoint(e)||e===CODE_POINTS.CARRIAGE_RETURN?ERR.controlCharacterReference:null}var Tokenizer=class{constructor(e,t){this.options=e,this.handler=t,this.paused=!1,this.inLoop=!1,this.inForeignNode=!1,this.lastStartTagName=``,this.active=!1,this.state=State.DATA,this.returnState=State.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:``,value:``},this.preprocessor=new Preprocessor(t),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new EntityDecoder(htmlDecodeTree,(e,t)=>{this.preprocessor.pos=this.entityStartPos+t-1,this._flushCodePointConsumedAsCharacterReference(e)},t.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err(ERR.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:e=>{this._err(ERR.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+e)},validateNumericCharacterReference:e=>{let t=getErrorForNumericCharacterReference(e);t&&this._err(t,1)}}:void 0)}_err(e,t=0){var S,w;(w=(S=this.handler).onParseError)==null||w.call(S,this.preprocessor.getError(e,t))}getCurrentLocation(e){return this.options.sourceCodeLocationInfo?{startLine:this.preprocessor.line,startCol:this.preprocessor.col-e,startOffset:this.preprocessor.offset-e,endLine:-1,endCol:-1,endOffset:-1}:null}_runParsingLoop(){if(!this.inLoop){for(this.inLoop=!0;this.active&&!this.paused;){this.consumedAfterSnapshot=0;let e=this._consume();this._ensureHibernation()||this._callState(e)}this.inLoop=!1}}pause(){this.paused=!0}resume(e){if(!this.paused)throw Error(`Parser was already resumed`);this.paused=!1,!this.inLoop&&(this._runParsingLoop(),this.paused||e?.())}write(e,t,S){this.active=!0,this.preprocessor.write(e,t),this._runParsingLoop(),this.paused||S?.()}insertHtmlAtCurrentPos(e){this.active=!0,this.preprocessor.insertHtmlAtCurrentPos(e),this._runParsingLoop()}_ensureHibernation(){return this.preprocessor.endOfChunkHit?(this.preprocessor.retreat(this.consumedAfterSnapshot),this.consumedAfterSnapshot=0,this.active=!1,!0):!1}_consume(){return this.consumedAfterSnapshot++,this.preprocessor.advance()}_advanceBy(e){this.consumedAfterSnapshot+=e;for(let t=0;t<e;t++)this.preprocessor.advance()}_consumeSequenceIfMatch(e,t){return this.preprocessor.startsWith(e,t)?(this._advanceBy(e.length-1),!0):!1}_createStartTagToken(){this.currentToken={type:TokenType.START_TAG,tagName:``,tagID:TAG_ID.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(1)}}_createEndTagToken(){this.currentToken={type:TokenType.END_TAG,tagName:``,tagID:TAG_ID.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(2)}}_createCommentToken(e){this.currentToken={type:TokenType.COMMENT,data:``,location:this.getCurrentLocation(e)}}_createDoctypeToken(e){this.currentToken={type:TokenType.DOCTYPE,name:e,forceQuirks:!1,publicId:null,systemId:null,location:this.currentLocation}}_createCharacterToken(e,t){this.currentCharacterToken={type:e,chars:t,location:this.currentLocation}}_createAttr(e){this.currentAttr={name:e,value:``},this.currentLocation=this.getCurrentLocation(0)}_leaveAttrName(){var e,t;let S=this.currentToken;if(getTokenAttr(S,this.currentAttr.name)===null){if(S.attrs.push(this.currentAttr),S.location&&this.currentLocation){let e=(t=S.location).attrs??(t.attrs=Object.create(null));e[this.currentAttr.name]=this.currentLocation,this._leaveAttrValue()}}else this._err(ERR.duplicateAttribute)}_leaveAttrValue(){this.currentLocation&&(this.currentLocation.endLine=this.preprocessor.line,this.currentLocation.endCol=this.preprocessor.col,this.currentLocation.endOffset=this.preprocessor.offset)}prepareToken(e){this._emitCurrentCharacterToken(e.location),this.currentToken=null,e.location&&(e.location.endLine=this.preprocessor.line,e.location.endCol=this.preprocessor.col+1,e.location.endOffset=this.preprocessor.offset+1),this.currentLocation=this.getCurrentLocation(-1)}emitCurrentTagToken(){let e=this.currentToken;this.prepareToken(e),e.tagID=getTagID(e.tagName),e.type===TokenType.START_TAG?(this.lastStartTagName=e.tagName,this.handler.onStartTag(e)):(e.attrs.length>0&&this._err(ERR.endTagWithAttributes),e.selfClosing&&this._err(ERR.endTagWithTrailingSolidus),this.handler.onEndTag(e)),this.preprocessor.dropParsedChunk()}emitCurrentComment(e){this.prepareToken(e),this.handler.onComment(e),this.preprocessor.dropParsedChunk()}emitCurrentDoctype(e){this.prepareToken(e),this.handler.onDoctype(e),this.preprocessor.dropParsedChunk()}_emitCurrentCharacterToken(e){if(this.currentCharacterToken){switch(e&&this.currentCharacterToken.location&&(this.currentCharacterToken.location.endLine=e.startLine,this.currentCharacterToken.location.endCol=e.startCol,this.currentCharacterToken.location.endOffset=e.startOffset),this.currentCharacterToken.type){case TokenType.CHARACTER:this.handler.onCharacter(this.currentCharacterToken);break;case TokenType.NULL_CHARACTER:this.handler.onNullCharacter(this.currentCharacterToken);break;case TokenType.WHITESPACE_CHARACTER:this.handler.onWhitespaceCharacter(this.currentCharacterToken);break}this.currentCharacterToken=null}}_emitEOFToken(){let e=this.getCurrentLocation(0);e&&(e.endLine=e.startLine,e.endCol=e.startCol,e.endOffset=e.startOffset),this._emitCurrentCharacterToken(e),this.handler.onEof({type:TokenType.EOF,location:e}),this.active=!1}_appendCharToCurrentCharacterToken(e,t){if(this.currentCharacterToken)if(this.currentCharacterToken.type===e){this.currentCharacterToken.chars+=t;return}else this.currentLocation=this.getCurrentLocation(0),this._emitCurrentCharacterToken(this.currentLocation),this.preprocessor.dropParsedChunk();this._createCharacterToken(e,t)}_emitCodePoint(e){let t=isWhitespace$1(e)?TokenType.WHITESPACE_CHARACTER:e===CODE_POINTS.NULL?TokenType.NULL_CHARACTER:TokenType.CHARACTER;this._appendCharToCurrentCharacterToken(t,String.fromCodePoint(e))}_emitChars(e){this._appendCharToCurrentCharacterToken(TokenType.CHARACTER,e)}_startCharacterReference(){this.returnState=this.state,this.state=State.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?DecodingMode.Attribute:DecodingMode.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===State.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===State.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===State.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(e){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(e):this._emitCodePoint(e)}_callState(e){switch(this.state){case State.DATA:this._stateData(e);break;case State.RCDATA:this._stateRcdata(e);break;case State.RAWTEXT:this._stateRawtext(e);break;case State.SCRIPT_DATA:this._stateScriptData(e);break;case State.PLAINTEXT:this._statePlaintext(e);break;case State.TAG_OPEN:this._stateTagOpen(e);break;case State.END_TAG_OPEN:this._stateEndTagOpen(e);break;case State.TAG_NAME:this._stateTagName(e);break;case State.RCDATA_LESS_THAN_SIGN:this._stateRcdataLessThanSign(e);break;case State.RCDATA_END_TAG_OPEN:this._stateRcdataEndTagOpen(e);break;case State.RCDATA_END_TAG_NAME:this._stateRcdataEndTagName(e);break;case State.RAWTEXT_LESS_THAN_SIGN:this._stateRawtextLessThanSign(e);break;case State.RAWTEXT_END_TAG_OPEN:this._stateRawtextEndTagOpen(e);break;case State.RAWTEXT_END_TAG_NAME:this._stateRawtextEndTagName(e);break;case State.SCRIPT_DATA_LESS_THAN_SIGN:this._stateScriptDataLessThanSign(e);break;case State.SCRIPT_DATA_END_TAG_OPEN:this._stateScriptDataEndTagOpen(e);break;case State.SCRIPT_DATA_END_TAG_NAME:this._stateScriptDataEndTagName(e);break;case State.SCRIPT_DATA_ESCAPE_START:this._stateScriptDataEscapeStart(e);break;case State.SCRIPT_DATA_ESCAPE_START_DASH:this._stateScriptDataEscapeStartDash(e);break;case State.SCRIPT_DATA_ESCAPED:this._stateScriptDataEscaped(e);break;case State.SCRIPT_DATA_ESCAPED_DASH:this._stateScriptDataEscapedDash(e);break;case State.SCRIPT_DATA_ESCAPED_DASH_DASH:this._stateScriptDataEscapedDashDash(e);break;case State.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:this._stateScriptDataEscapedLessThanSign(e);break;case State.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:this._stateScriptDataEscapedEndTagOpen(e);break;case State.SCRIPT_DATA_ESCAPED_END_TAG_NAME:this._stateScriptDataEscapedEndTagName(e);break;case State.SCRIPT_DATA_DOUBLE_ESCAPE_START:this._stateScriptDataDoubleEscapeStart(e);break;case State.SCRIPT_DATA_DOUBLE_ESCAPED:this._stateScriptDataDoubleEscaped(e);break;case State.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:this._stateScriptDataDoubleEscapedDash(e);break;case State.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:this._stateScriptDataDoubleEscapedDashDash(e);break;case State.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:this._stateScriptDataDoubleEscapedLessThanSign(e);break;case State.SCRIPT_DATA_DOUBLE_ESCAPE_END:this._stateScriptDataDoubleEscapeEnd(e);break;case State.BEFORE_ATTRIBUTE_NAME:this._stateBeforeAttributeName(e);break;case State.ATTRIBUTE_NAME:this._stateAttributeName(e);break;case State.AFTER_ATTRIBUTE_NAME:this._stateAfterAttributeName(e);break;case State.BEFORE_ATTRIBUTE_VALUE:this._stateBeforeAttributeValue(e);break;case State.ATTRIBUTE_VALUE_DOUBLE_QUOTED:this._stateAttributeValueDoubleQuoted(e);break;case State.ATTRIBUTE_VALUE_SINGLE_QUOTED:this._stateAttributeValueSingleQuoted(e);break;case State.ATTRIBUTE_VALUE_UNQUOTED:this._stateAttributeValueUnquoted(e);break;case State.AFTER_ATTRIBUTE_VALUE_QUOTED:this._stateAfterAttributeValueQuoted(e);break;case State.SELF_CLOSING_START_TAG:this._stateSelfClosingStartTag(e);break;case State.BOGUS_COMMENT:this._stateBogusComment(e);break;case State.MARKUP_DECLARATION_OPEN:this._stateMarkupDeclarationOpen(e);break;case State.COMMENT_START:this._stateCommentStart(e);break;case State.COMMENT_START_DASH:this._stateCommentStartDash(e);break;case State.COMMENT:this._stateComment(e);break;case State.COMMENT_LESS_THAN_SIGN:this._stateCommentLessThanSign(e);break;case State.COMMENT_LESS_THAN_SIGN_BANG:this._stateCommentLessThanSignBang(e);break;case State.COMMENT_LESS_THAN_SIGN_BANG_DASH:this._stateCommentLessThanSignBangDash(e);break;case State.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:this._stateCommentLessThanSignBangDashDash(e);break;case State.COMMENT_END_DASH:this._stateCommentEndDash(e);break;case State.COMMENT_END:this._stateCommentEnd(e);break;case State.COMMENT_END_BANG:this._stateCommentEndBang(e);break;case State.DOCTYPE:this._stateDoctype(e);break;case State.BEFORE_DOCTYPE_NAME:this._stateBeforeDoctypeName(e);break;case State.DOCTYPE_NAME:this._stateDoctypeName(e);break;case State.AFTER_DOCTYPE_NAME:this._stateAfterDoctypeName(e);break;case State.AFTER_DOCTYPE_PUBLIC_KEYWORD:this._stateAfterDoctypePublicKeyword(e);break;case State.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:this._stateBeforeDoctypePublicIdentifier(e);break;case State.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:this._stateDoctypePublicIdentifierDoubleQuoted(e);break;case State.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:this._stateDoctypePublicIdentifierSingleQuoted(e);break;case State.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:this._stateAfterDoctypePublicIdentifier(e);break;case State.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:this._stateBetweenDoctypePublicAndSystemIdentifiers(e);break;case State.AFTER_DOCTYPE_SYSTEM_KEYWORD:this._stateAfterDoctypeSystemKeyword(e);break;case State.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:this._stateBeforeDoctypeSystemIdentifier(e);break;case State.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:this._stateDoctypeSystemIdentifierDoubleQuoted(e);break;case State.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:this._stateDoctypeSystemIdentifierSingleQuoted(e);break;case State.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:this._stateAfterDoctypeSystemIdentifier(e);break;case State.BOGUS_DOCTYPE:this._stateBogusDoctype(e);break;case State.CDATA_SECTION:this._stateCdataSection(e);break;case State.CDATA_SECTION_BRACKET:this._stateCdataSectionBracket(e);break;case State.CDATA_SECTION_END:this._stateCdataSectionEnd(e);break;case State.CHARACTER_REFERENCE:this._stateCharacterReference();break;case State.AMBIGUOUS_AMPERSAND:this._stateAmbiguousAmpersand(e);break;default:throw Error(`Unknown state`)}}_stateData(e){switch(e){case CODE_POINTS.LESS_THAN_SIGN:this.state=State.TAG_OPEN;break;case CODE_POINTS.AMPERSAND:this._startCharacterReference();break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),this._emitCodePoint(e);break;case CODE_POINTS.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateRcdata(e){switch(e){case CODE_POINTS.AMPERSAND:this._startCharacterReference();break;case CODE_POINTS.LESS_THAN_SIGN:this.state=State.RCDATA_LESS_THAN_SIGN;break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),this._emitChars(`�`);break;case CODE_POINTS.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateRawtext(e){switch(e){case CODE_POINTS.LESS_THAN_SIGN:this.state=State.RAWTEXT_LESS_THAN_SIGN;break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),this._emitChars(`�`);break;case CODE_POINTS.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateScriptData(e){switch(e){case CODE_POINTS.LESS_THAN_SIGN:this.state=State.SCRIPT_DATA_LESS_THAN_SIGN;break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),this._emitChars(`�`);break;case CODE_POINTS.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_statePlaintext(e){switch(e){case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),this._emitChars(`�`);break;case CODE_POINTS.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateTagOpen(e){if(isAsciiLetter(e))this._createStartTagToken(),this.state=State.TAG_NAME,this._stateTagName(e);else switch(e){case CODE_POINTS.EXCLAMATION_MARK:this.state=State.MARKUP_DECLARATION_OPEN;break;case CODE_POINTS.SOLIDUS:this.state=State.END_TAG_OPEN;break;case CODE_POINTS.QUESTION_MARK:this._err(ERR.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=State.BOGUS_COMMENT,this._stateBogusComment(e);break;case CODE_POINTS.EOF:this._err(ERR.eofBeforeTagName),this._emitChars(`<`),this._emitEOFToken();break;default:this._err(ERR.invalidFirstCharacterOfTagName),this._emitChars(`<`),this.state=State.DATA,this._stateData(e)}}_stateEndTagOpen(e){if(isAsciiLetter(e))this._createEndTagToken(),this.state=State.TAG_NAME,this._stateTagName(e);else switch(e){case CODE_POINTS.GREATER_THAN_SIGN:this._err(ERR.missingEndTagName),this.state=State.DATA;break;case CODE_POINTS.EOF:this._err(ERR.eofBeforeTagName),this._emitChars(`</`),this._emitEOFToken();break;default:this._err(ERR.invalidFirstCharacterOfTagName),this._createCommentToken(2),this.state=State.BOGUS_COMMENT,this._stateBogusComment(e)}}_stateTagName(e){let t=this.currentToken;switch(e){case CODE_POINTS.SPACE:case CODE_POINTS.LINE_FEED:case CODE_POINTS.TABULATION:case CODE_POINTS.FORM_FEED:this.state=State.BEFORE_ATTRIBUTE_NAME;break;case CODE_POINTS.SOLIDUS:this.state=State.SELF_CLOSING_START_TAG;break;case CODE_POINTS.GREATER_THAN_SIGN:this.state=State.DATA,this.emitCurrentTagToken();break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),t.tagName+=`�`;break;case CODE_POINTS.EOF:this._err(ERR.eofInTag),this._emitEOFToken();break;default:t.tagName+=String.fromCodePoint(isAsciiUpper(e)?toAsciiLower(e):e)}}_stateRcdataLessThanSign(e){e===CODE_POINTS.SOLIDUS?this.state=State.RCDATA_END_TAG_OPEN:(this._emitChars(`<`),this.state=State.RCDATA,this._stateRcdata(e))}_stateRcdataEndTagOpen(e){isAsciiLetter(e)?(this.state=State.RCDATA_END_TAG_NAME,this._stateRcdataEndTagName(e)):(this._emitChars(`</`),this.state=State.RCDATA,this._stateRcdata(e))}handleSpecialEndTag(e){if(!this.preprocessor.startsWith(this.lastStartTagName,!1))return!this._ensureHibernation();this._createEndTagToken();let t=this.currentToken;switch(t.tagName=this.lastStartTagName,this.preprocessor.peek(this.lastStartTagName.length)){case CODE_POINTS.SPACE:case CODE_POINTS.LINE_FEED:case CODE_POINTS.TABULATION:case CODE_POINTS.FORM_FEED:return this._advanceBy(this.lastStartTagName.length),this.state=State.BEFORE_ATTRIBUTE_NAME,!1;case CODE_POINTS.SOLIDUS:return this._advanceBy(this.lastStartTagName.length),this.state=State.SELF_CLOSING_START_TAG,!1;case CODE_POINTS.GREATER_THAN_SIGN:return this._advanceBy(this.lastStartTagName.length),this.emitCurrentTagToken(),this.state=State.DATA,!1;default:return!this._ensureHibernation()}}_stateRcdataEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars(`</`),this.state=State.RCDATA,this._stateRcdata(e))}_stateRawtextLessThanSign(e){e===CODE_POINTS.SOLIDUS?this.state=State.RAWTEXT_END_TAG_OPEN:(this._emitChars(`<`),this.state=State.RAWTEXT,this._stateRawtext(e))}_stateRawtextEndTagOpen(e){isAsciiLetter(e)?(this.state=State.RAWTEXT_END_TAG_NAME,this._stateRawtextEndTagName(e)):(this._emitChars(`</`),this.state=State.RAWTEXT,this._stateRawtext(e))}_stateRawtextEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars(`</`),this.state=State.RAWTEXT,this._stateRawtext(e))}_stateScriptDataLessThanSign(e){switch(e){case CODE_POINTS.SOLIDUS:this.state=State.SCRIPT_DATA_END_TAG_OPEN;break;case CODE_POINTS.EXCLAMATION_MARK:this.state=State.SCRIPT_DATA_ESCAPE_START,this._emitChars(`<!`);break;default:this._emitChars(`<`),this.state=State.SCRIPT_DATA,this._stateScriptData(e)}}_stateScriptDataEndTagOpen(e){isAsciiLetter(e)?(this.state=State.SCRIPT_DATA_END_TAG_NAME,this._stateScriptDataEndTagName(e)):(this._emitChars(`</`),this.state=State.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars(`</`),this.state=State.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscapeStart(e){e===CODE_POINTS.HYPHEN_MINUS?(this.state=State.SCRIPT_DATA_ESCAPE_START_DASH,this._emitChars(`-`)):(this.state=State.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscapeStartDash(e){e===CODE_POINTS.HYPHEN_MINUS?(this.state=State.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars(`-`)):(this.state=State.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscaped(e){switch(e){case CODE_POINTS.HYPHEN_MINUS:this.state=State.SCRIPT_DATA_ESCAPED_DASH,this._emitChars(`-`);break;case CODE_POINTS.LESS_THAN_SIGN:this.state=State.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),this._emitChars(`�`);break;case CODE_POINTS.EOF:this._err(ERR.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateScriptDataEscapedDash(e){switch(e){case CODE_POINTS.HYPHEN_MINUS:this.state=State.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars(`-`);break;case CODE_POINTS.LESS_THAN_SIGN:this.state=State.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),this.state=State.SCRIPT_DATA_ESCAPED,this._emitChars(`�`);break;case CODE_POINTS.EOF:this._err(ERR.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=State.SCRIPT_DATA_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataEscapedDashDash(e){switch(e){case CODE_POINTS.HYPHEN_MINUS:this._emitChars(`-`);break;case CODE_POINTS.LESS_THAN_SIGN:this.state=State.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break;case CODE_POINTS.GREATER_THAN_SIGN:this.state=State.SCRIPT_DATA,this._emitChars(`>`);break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),this.state=State.SCRIPT_DATA_ESCAPED,this._emitChars(`�`);break;case CODE_POINTS.EOF:this._err(ERR.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=State.SCRIPT_DATA_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataEscapedLessThanSign(e){e===CODE_POINTS.SOLIDUS?this.state=State.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:isAsciiLetter(e)?(this._emitChars(`<`),this.state=State.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(e)):(this._emitChars(`<`),this.state=State.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataEscapedEndTagOpen(e){isAsciiLetter(e)?(this.state=State.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(e)):(this._emitChars(`</`),this.state=State.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataEscapedEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars(`</`),this.state=State.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataDoubleEscapeStart(e){if(this.preprocessor.startsWith(SEQUENCES.SCRIPT,!1)&&isScriptDataDoubleEscapeSequenceEnd(this.preprocessor.peek(SEQUENCES.SCRIPT.length))){this._emitCodePoint(e);for(let e=0;e<SEQUENCES.SCRIPT.length;e++)this._emitCodePoint(this._consume());this.state=State.SCRIPT_DATA_DOUBLE_ESCAPED}else this._ensureHibernation()||(this.state=State.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataDoubleEscaped(e){switch(e){case CODE_POINTS.HYPHEN_MINUS:this.state=State.SCRIPT_DATA_DOUBLE_ESCAPED_DASH,this._emitChars(`-`);break;case CODE_POINTS.LESS_THAN_SIGN:this.state=State.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars(`<`);break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),this._emitChars(`�`);break;case CODE_POINTS.EOF:this._err(ERR.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedDash(e){switch(e){case CODE_POINTS.HYPHEN_MINUS:this.state=State.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH,this._emitChars(`-`);break;case CODE_POINTS.LESS_THAN_SIGN:this.state=State.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars(`<`);break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),this.state=State.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(`�`);break;case CODE_POINTS.EOF:this._err(ERR.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=State.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedDashDash(e){switch(e){case CODE_POINTS.HYPHEN_MINUS:this._emitChars(`-`);break;case CODE_POINTS.LESS_THAN_SIGN:this.state=State.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars(`<`);break;case CODE_POINTS.GREATER_THAN_SIGN:this.state=State.SCRIPT_DATA,this._emitChars(`>`);break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),this.state=State.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(`�`);break;case CODE_POINTS.EOF:this._err(ERR.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=State.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedLessThanSign(e){e===CODE_POINTS.SOLIDUS?(this.state=State.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars(`/`)):(this.state=State.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(e))}_stateScriptDataDoubleEscapeEnd(e){if(this.preprocessor.startsWith(SEQUENCES.SCRIPT,!1)&&isScriptDataDoubleEscapeSequenceEnd(this.preprocessor.peek(SEQUENCES.SCRIPT.length))){this._emitCodePoint(e);for(let e=0;e<SEQUENCES.SCRIPT.length;e++)this._emitCodePoint(this._consume());this.state=State.SCRIPT_DATA_ESCAPED}else this._ensureHibernation()||(this.state=State.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(e))}_stateBeforeAttributeName(e){switch(e){case CODE_POINTS.SPACE:case CODE_POINTS.LINE_FEED:case CODE_POINTS.TABULATION:case CODE_POINTS.FORM_FEED:break;case CODE_POINTS.SOLIDUS:case CODE_POINTS.GREATER_THAN_SIGN:case CODE_POINTS.EOF:this.state=State.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(e);break;case CODE_POINTS.EQUALS_SIGN:this._err(ERR.unexpectedEqualsSignBeforeAttributeName),this._createAttr(`=`),this.state=State.ATTRIBUTE_NAME;break;default:this._createAttr(``),this.state=State.ATTRIBUTE_NAME,this._stateAttributeName(e)}}_stateAttributeName(e){switch(e){case CODE_POINTS.SPACE:case CODE_POINTS.LINE_FEED:case CODE_POINTS.TABULATION:case CODE_POINTS.FORM_FEED:case CODE_POINTS.SOLIDUS:case CODE_POINTS.GREATER_THAN_SIGN:case CODE_POINTS.EOF:this._leaveAttrName(),this.state=State.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(e);break;case CODE_POINTS.EQUALS_SIGN:this._leaveAttrName(),this.state=State.BEFORE_ATTRIBUTE_VALUE;break;case CODE_POINTS.QUOTATION_MARK:case CODE_POINTS.APOSTROPHE:case CODE_POINTS.LESS_THAN_SIGN:this._err(ERR.unexpectedCharacterInAttributeName),this.currentAttr.name+=String.fromCodePoint(e);break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),this.currentAttr.name+=`�`;break;default:this.currentAttr.name+=String.fromCodePoint(isAsciiUpper(e)?toAsciiLower(e):e)}}_stateAfterAttributeName(e){switch(e){case CODE_POINTS.SPACE:case CODE_POINTS.LINE_FEED:case CODE_POINTS.TABULATION:case CODE_POINTS.FORM_FEED:break;case CODE_POINTS.SOLIDUS:this.state=State.SELF_CLOSING_START_TAG;break;case CODE_POINTS.EQUALS_SIGN:this.state=State.BEFORE_ATTRIBUTE_VALUE;break;case CODE_POINTS.GREATER_THAN_SIGN:this.state=State.DATA,this.emitCurrentTagToken();break;case CODE_POINTS.EOF:this._err(ERR.eofInTag),this._emitEOFToken();break;default:this._createAttr(``),this.state=State.ATTRIBUTE_NAME,this._stateAttributeName(e)}}_stateBeforeAttributeValue(e){switch(e){case CODE_POINTS.SPACE:case CODE_POINTS.LINE_FEED:case CODE_POINTS.TABULATION:case CODE_POINTS.FORM_FEED:break;case CODE_POINTS.QUOTATION_MARK:this.state=State.ATTRIBUTE_VALUE_DOUBLE_QUOTED;break;case CODE_POINTS.APOSTROPHE:this.state=State.ATTRIBUTE_VALUE_SINGLE_QUOTED;break;case CODE_POINTS.GREATER_THAN_SIGN:this._err(ERR.missingAttributeValue),this.state=State.DATA,this.emitCurrentTagToken();break;default:this.state=State.ATTRIBUTE_VALUE_UNQUOTED,this._stateAttributeValueUnquoted(e)}}_stateAttributeValueDoubleQuoted(e){switch(e){case CODE_POINTS.QUOTATION_MARK:this.state=State.AFTER_ATTRIBUTE_VALUE_QUOTED;break;case CODE_POINTS.AMPERSAND:this._startCharacterReference();break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),this.currentAttr.value+=`�`;break;case CODE_POINTS.EOF:this._err(ERR.eofInTag),this._emitEOFToken();break;default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAttributeValueSingleQuoted(e){switch(e){case CODE_POINTS.APOSTROPHE:this.state=State.AFTER_ATTRIBUTE_VALUE_QUOTED;break;case CODE_POINTS.AMPERSAND:this._startCharacterReference();break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),this.currentAttr.value+=`�`;break;case CODE_POINTS.EOF:this._err(ERR.eofInTag),this._emitEOFToken();break;default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAttributeValueUnquoted(e){switch(e){case CODE_POINTS.SPACE:case CODE_POINTS.LINE_FEED:case CODE_POINTS.TABULATION:case CODE_POINTS.FORM_FEED:this._leaveAttrValue(),this.state=State.BEFORE_ATTRIBUTE_NAME;break;case CODE_POINTS.AMPERSAND:this._startCharacterReference();break;case CODE_POINTS.GREATER_THAN_SIGN:this._leaveAttrValue(),this.state=State.DATA,this.emitCurrentTagToken();break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),this.currentAttr.value+=`�`;break;case CODE_POINTS.QUOTATION_MARK:case CODE_POINTS.APOSTROPHE:case CODE_POINTS.LESS_THAN_SIGN:case CODE_POINTS.EQUALS_SIGN:case CODE_POINTS.GRAVE_ACCENT:this._err(ERR.unexpectedCharacterInUnquotedAttributeValue),this.currentAttr.value+=String.fromCodePoint(e);break;case CODE_POINTS.EOF:this._err(ERR.eofInTag),this._emitEOFToken();break;default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAfterAttributeValueQuoted(e){switch(e){case CODE_POINTS.SPACE:case CODE_POINTS.LINE_FEED:case CODE_POINTS.TABULATION:case CODE_POINTS.FORM_FEED:this._leaveAttrValue(),this.state=State.BEFORE_ATTRIBUTE_NAME;break;case CODE_POINTS.SOLIDUS:this._leaveAttrValue(),this.state=State.SELF_CLOSING_START_TAG;break;case CODE_POINTS.GREATER_THAN_SIGN:this._leaveAttrValue(),this.state=State.DATA,this.emitCurrentTagToken();break;case CODE_POINTS.EOF:this._err(ERR.eofInTag),this._emitEOFToken();break;default:this._err(ERR.missingWhitespaceBetweenAttributes),this.state=State.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(e)}}_stateSelfClosingStartTag(e){switch(e){case CODE_POINTS.GREATER_THAN_SIGN:{let e=this.currentToken;e.selfClosing=!0,this.state=State.DATA,this.emitCurrentTagToken();break}case CODE_POINTS.EOF:this._err(ERR.eofInTag),this._emitEOFToken();break;default:this._err(ERR.unexpectedSolidusInTag),this.state=State.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(e)}}_stateBogusComment(e){let t=this.currentToken;switch(e){case CODE_POINTS.GREATER_THAN_SIGN:this.state=State.DATA,this.emitCurrentComment(t);break;case CODE_POINTS.EOF:this.emitCurrentComment(t),this._emitEOFToken();break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),t.data+=`�`;break;default:t.data+=String.fromCodePoint(e)}}_stateMarkupDeclarationOpen(e){this._consumeSequenceIfMatch(SEQUENCES.DASH_DASH,!0)?(this._createCommentToken(SEQUENCES.DASH_DASH.length+1),this.state=State.COMMENT_START):this._consumeSequenceIfMatch(SEQUENCES.DOCTYPE,!1)?(this.currentLocation=this.getCurrentLocation(SEQUENCES.DOCTYPE.length+1),this.state=State.DOCTYPE):this._consumeSequenceIfMatch(SEQUENCES.CDATA_START,!0)?this.inForeignNode?this.state=State.CDATA_SECTION:(this._err(ERR.cdataInHtmlContent),this._createCommentToken(SEQUENCES.CDATA_START.length+1),this.currentToken.data=`[CDATA[`,this.state=State.BOGUS_COMMENT):this._ensureHibernation()||(this._err(ERR.incorrectlyOpenedComment),this._createCommentToken(2),this.state=State.BOGUS_COMMENT,this._stateBogusComment(e))}_stateCommentStart(e){switch(e){case CODE_POINTS.HYPHEN_MINUS:this.state=State.COMMENT_START_DASH;break;case CODE_POINTS.GREATER_THAN_SIGN:{this._err(ERR.abruptClosingOfEmptyComment),this.state=State.DATA;let e=this.currentToken;this.emitCurrentComment(e);break}default:this.state=State.COMMENT,this._stateComment(e)}}_stateCommentStartDash(e){let t=this.currentToken;switch(e){case CODE_POINTS.HYPHEN_MINUS:this.state=State.COMMENT_END;break;case CODE_POINTS.GREATER_THAN_SIGN:this._err(ERR.abruptClosingOfEmptyComment),this.state=State.DATA,this.emitCurrentComment(t);break;case CODE_POINTS.EOF:this._err(ERR.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=`-`,this.state=State.COMMENT,this._stateComment(e)}}_stateComment(e){let t=this.currentToken;switch(e){case CODE_POINTS.HYPHEN_MINUS:this.state=State.COMMENT_END_DASH;break;case CODE_POINTS.LESS_THAN_SIGN:t.data+=`<`,this.state=State.COMMENT_LESS_THAN_SIGN;break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),t.data+=`�`;break;case CODE_POINTS.EOF:this._err(ERR.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=String.fromCodePoint(e)}}_stateCommentLessThanSign(e){let t=this.currentToken;switch(e){case CODE_POINTS.EXCLAMATION_MARK:t.data+=`!`,this.state=State.COMMENT_LESS_THAN_SIGN_BANG;break;case CODE_POINTS.LESS_THAN_SIGN:t.data+=`<`;break;default:this.state=State.COMMENT,this._stateComment(e)}}_stateCommentLessThanSignBang(e){e===CODE_POINTS.HYPHEN_MINUS?this.state=State.COMMENT_LESS_THAN_SIGN_BANG_DASH:(this.state=State.COMMENT,this._stateComment(e))}_stateCommentLessThanSignBangDash(e){e===CODE_POINTS.HYPHEN_MINUS?this.state=State.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:(this.state=State.COMMENT_END_DASH,this._stateCommentEndDash(e))}_stateCommentLessThanSignBangDashDash(e){e!==CODE_POINTS.GREATER_THAN_SIGN&&e!==CODE_POINTS.EOF&&this._err(ERR.nestedComment),this.state=State.COMMENT_END,this._stateCommentEnd(e)}_stateCommentEndDash(e){let t=this.currentToken;switch(e){case CODE_POINTS.HYPHEN_MINUS:this.state=State.COMMENT_END;break;case CODE_POINTS.EOF:this._err(ERR.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=`-`,this.state=State.COMMENT,this._stateComment(e)}}_stateCommentEnd(e){let t=this.currentToken;switch(e){case CODE_POINTS.GREATER_THAN_SIGN:this.state=State.DATA,this.emitCurrentComment(t);break;case CODE_POINTS.EXCLAMATION_MARK:this.state=State.COMMENT_END_BANG;break;case CODE_POINTS.HYPHEN_MINUS:t.data+=`-`;break;case CODE_POINTS.EOF:this._err(ERR.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=`--`,this.state=State.COMMENT,this._stateComment(e)}}_stateCommentEndBang(e){let t=this.currentToken;switch(e){case CODE_POINTS.HYPHEN_MINUS:t.data+=`--!`,this.state=State.COMMENT_END_DASH;break;case CODE_POINTS.GREATER_THAN_SIGN:this._err(ERR.incorrectlyClosedComment),this.state=State.DATA,this.emitCurrentComment(t);break;case CODE_POINTS.EOF:this._err(ERR.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=`--!`,this.state=State.COMMENT,this._stateComment(e)}}_stateDoctype(e){switch(e){case CODE_POINTS.SPACE:case CODE_POINTS.LINE_FEED:case CODE_POINTS.TABULATION:case CODE_POINTS.FORM_FEED:this.state=State.BEFORE_DOCTYPE_NAME;break;case CODE_POINTS.GREATER_THAN_SIGN:this.state=State.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(e);break;case CODE_POINTS.EOF:{this._err(ERR.eofInDoctype),this._createDoctypeToken(null);let e=this.currentToken;e.forceQuirks=!0,this.emitCurrentDoctype(e),this._emitEOFToken();break}default:this._err(ERR.missingWhitespaceBeforeDoctypeName),this.state=State.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(e)}}_stateBeforeDoctypeName(e){if(isAsciiUpper(e))this._createDoctypeToken(String.fromCharCode(toAsciiLower(e))),this.state=State.DOCTYPE_NAME;else switch(e){case CODE_POINTS.SPACE:case CODE_POINTS.LINE_FEED:case CODE_POINTS.TABULATION:case CODE_POINTS.FORM_FEED:break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),this._createDoctypeToken(`�`),this.state=State.DOCTYPE_NAME;break;case CODE_POINTS.GREATER_THAN_SIGN:{this._err(ERR.missingDoctypeName),this._createDoctypeToken(null);let e=this.currentToken;e.forceQuirks=!0,this.emitCurrentDoctype(e),this.state=State.DATA;break}case CODE_POINTS.EOF:{this._err(ERR.eofInDoctype),this._createDoctypeToken(null);let e=this.currentToken;e.forceQuirks=!0,this.emitCurrentDoctype(e),this._emitEOFToken();break}default:this._createDoctypeToken(String.fromCodePoint(e)),this.state=State.DOCTYPE_NAME}}_stateDoctypeName(e){let t=this.currentToken;switch(e){case CODE_POINTS.SPACE:case CODE_POINTS.LINE_FEED:case CODE_POINTS.TABULATION:case CODE_POINTS.FORM_FEED:this.state=State.AFTER_DOCTYPE_NAME;break;case CODE_POINTS.GREATER_THAN_SIGN:this.state=State.DATA,this.emitCurrentDoctype(t);break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),t.name+=`�`;break;case CODE_POINTS.EOF:this._err(ERR.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.name+=String.fromCodePoint(isAsciiUpper(e)?toAsciiLower(e):e)}}_stateAfterDoctypeName(e){let t=this.currentToken;switch(e){case CODE_POINTS.SPACE:case CODE_POINTS.LINE_FEED:case CODE_POINTS.TABULATION:case CODE_POINTS.FORM_FEED:break;case CODE_POINTS.GREATER_THAN_SIGN:this.state=State.DATA,this.emitCurrentDoctype(t);break;case CODE_POINTS.EOF:this._err(ERR.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._consumeSequenceIfMatch(SEQUENCES.PUBLIC,!1)?this.state=State.AFTER_DOCTYPE_PUBLIC_KEYWORD:this._consumeSequenceIfMatch(SEQUENCES.SYSTEM,!1)?this.state=State.AFTER_DOCTYPE_SYSTEM_KEYWORD:this._ensureHibernation()||(this._err(ERR.invalidCharacterSequenceAfterDoctypeName),t.forceQuirks=!0,this.state=State.BOGUS_DOCTYPE,this._stateBogusDoctype(e))}}_stateAfterDoctypePublicKeyword(e){let t=this.currentToken;switch(e){case CODE_POINTS.SPACE:case CODE_POINTS.LINE_FEED:case CODE_POINTS.TABULATION:case CODE_POINTS.FORM_FEED:this.state=State.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER;break;case CODE_POINTS.QUOTATION_MARK:this._err(ERR.missingWhitespaceAfterDoctypePublicKeyword),t.publicId=``,this.state=State.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break;case CODE_POINTS.APOSTROPHE:this._err(ERR.missingWhitespaceAfterDoctypePublicKeyword),t.publicId=``,this.state=State.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break;case CODE_POINTS.GREATER_THAN_SIGN:this._err(ERR.missingDoctypePublicIdentifier),t.forceQuirks=!0,this.state=State.DATA,this.emitCurrentDoctype(t);break;case CODE_POINTS.EOF:this._err(ERR.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(ERR.missingQuoteBeforeDoctypePublicIdentifier),t.forceQuirks=!0,this.state=State.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBeforeDoctypePublicIdentifier(e){let t=this.currentToken;switch(e){case CODE_POINTS.SPACE:case CODE_POINTS.LINE_FEED:case CODE_POINTS.TABULATION:case CODE_POINTS.FORM_FEED:break;case CODE_POINTS.QUOTATION_MARK:t.publicId=``,this.state=State.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break;case CODE_POINTS.APOSTROPHE:t.publicId=``,this.state=State.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break;case CODE_POINTS.GREATER_THAN_SIGN:this._err(ERR.missingDoctypePublicIdentifier),t.forceQuirks=!0,this.state=State.DATA,this.emitCurrentDoctype(t);break;case CODE_POINTS.EOF:this._err(ERR.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(ERR.missingQuoteBeforeDoctypePublicIdentifier),t.forceQuirks=!0,this.state=State.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateDoctypePublicIdentifierDoubleQuoted(e){let t=this.currentToken;switch(e){case CODE_POINTS.QUOTATION_MARK:this.state=State.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),t.publicId+=`�`;break;case CODE_POINTS.GREATER_THAN_SIGN:this._err(ERR.abruptDoctypePublicIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=State.DATA;break;case CODE_POINTS.EOF:this._err(ERR.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.publicId+=String.fromCodePoint(e)}}_stateDoctypePublicIdentifierSingleQuoted(e){let t=this.currentToken;switch(e){case CODE_POINTS.APOSTROPHE:this.state=State.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),t.publicId+=`�`;break;case CODE_POINTS.GREATER_THAN_SIGN:this._err(ERR.abruptDoctypePublicIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=State.DATA;break;case CODE_POINTS.EOF:this._err(ERR.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.publicId+=String.fromCodePoint(e)}}_stateAfterDoctypePublicIdentifier(e){let t=this.currentToken;switch(e){case CODE_POINTS.SPACE:case CODE_POINTS.LINE_FEED:case CODE_POINTS.TABULATION:case CODE_POINTS.FORM_FEED:this.state=State.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS;break;case CODE_POINTS.GREATER_THAN_SIGN:this.state=State.DATA,this.emitCurrentDoctype(t);break;case CODE_POINTS.QUOTATION_MARK:this._err(ERR.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),t.systemId=``,this.state=State.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case CODE_POINTS.APOSTROPHE:this._err(ERR.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),t.systemId=``,this.state=State.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case CODE_POINTS.EOF:this._err(ERR.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(ERR.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=State.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBetweenDoctypePublicAndSystemIdentifiers(e){let t=this.currentToken;switch(e){case CODE_POINTS.SPACE:case CODE_POINTS.LINE_FEED:case CODE_POINTS.TABULATION:case CODE_POINTS.FORM_FEED:break;case CODE_POINTS.GREATER_THAN_SIGN:this.emitCurrentDoctype(t),this.state=State.DATA;break;case CODE_POINTS.QUOTATION_MARK:t.systemId=``,this.state=State.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case CODE_POINTS.APOSTROPHE:t.systemId=``,this.state=State.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case CODE_POINTS.EOF:this._err(ERR.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(ERR.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=State.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateAfterDoctypeSystemKeyword(e){let t=this.currentToken;switch(e){case CODE_POINTS.SPACE:case CODE_POINTS.LINE_FEED:case CODE_POINTS.TABULATION:case CODE_POINTS.FORM_FEED:this.state=State.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER;break;case CODE_POINTS.QUOTATION_MARK:this._err(ERR.missingWhitespaceAfterDoctypeSystemKeyword),t.systemId=``,this.state=State.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case CODE_POINTS.APOSTROPHE:this._err(ERR.missingWhitespaceAfterDoctypeSystemKeyword),t.systemId=``,this.state=State.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case CODE_POINTS.GREATER_THAN_SIGN:this._err(ERR.missingDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=State.DATA,this.emitCurrentDoctype(t);break;case CODE_POINTS.EOF:this._err(ERR.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(ERR.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=State.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBeforeDoctypeSystemIdentifier(e){let t=this.currentToken;switch(e){case CODE_POINTS.SPACE:case CODE_POINTS.LINE_FEED:case CODE_POINTS.TABULATION:case CODE_POINTS.FORM_FEED:break;case CODE_POINTS.QUOTATION_MARK:t.systemId=``,this.state=State.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case CODE_POINTS.APOSTROPHE:t.systemId=``,this.state=State.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case CODE_POINTS.GREATER_THAN_SIGN:this._err(ERR.missingDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=State.DATA,this.emitCurrentDoctype(t);break;case CODE_POINTS.EOF:this._err(ERR.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(ERR.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=State.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateDoctypeSystemIdentifierDoubleQuoted(e){let t=this.currentToken;switch(e){case CODE_POINTS.QUOTATION_MARK:this.state=State.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),t.systemId+=`�`;break;case CODE_POINTS.GREATER_THAN_SIGN:this._err(ERR.abruptDoctypeSystemIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=State.DATA;break;case CODE_POINTS.EOF:this._err(ERR.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.systemId+=String.fromCodePoint(e)}}_stateDoctypeSystemIdentifierSingleQuoted(e){let t=this.currentToken;switch(e){case CODE_POINTS.APOSTROPHE:this.state=State.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter),t.systemId+=`�`;break;case CODE_POINTS.GREATER_THAN_SIGN:this._err(ERR.abruptDoctypeSystemIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=State.DATA;break;case CODE_POINTS.EOF:this._err(ERR.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.systemId+=String.fromCodePoint(e)}}_stateAfterDoctypeSystemIdentifier(e){let t=this.currentToken;switch(e){case CODE_POINTS.SPACE:case CODE_POINTS.LINE_FEED:case CODE_POINTS.TABULATION:case CODE_POINTS.FORM_FEED:break;case CODE_POINTS.GREATER_THAN_SIGN:this.emitCurrentDoctype(t),this.state=State.DATA;break;case CODE_POINTS.EOF:this._err(ERR.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(ERR.unexpectedCharacterAfterDoctypeSystemIdentifier),this.state=State.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBogusDoctype(e){let t=this.currentToken;switch(e){case CODE_POINTS.GREATER_THAN_SIGN:this.emitCurrentDoctype(t),this.state=State.DATA;break;case CODE_POINTS.NULL:this._err(ERR.unexpectedNullCharacter);break;case CODE_POINTS.EOF:this.emitCurrentDoctype(t),this._emitEOFToken();break;default:}}_stateCdataSection(e){switch(e){case CODE_POINTS.RIGHT_SQUARE_BRACKET:this.state=State.CDATA_SECTION_BRACKET;break;case CODE_POINTS.EOF:this._err(ERR.eofInCdata),this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateCdataSectionBracket(e){e===CODE_POINTS.RIGHT_SQUARE_BRACKET?this.state=State.CDATA_SECTION_END:(this._emitChars(`]`),this.state=State.CDATA_SECTION,this._stateCdataSection(e))}_stateCdataSectionEnd(e){switch(e){case CODE_POINTS.GREATER_THAN_SIGN:this.state=State.DATA;break;case CODE_POINTS.RIGHT_SQUARE_BRACKET:this._emitChars(`]`);break;default:this._emitChars(`]]`),this.state=State.CDATA_SECTION,this._stateCdataSection(e)}}_stateCharacterReference(){let e=this.entityDecoder.write(this.preprocessor.html,this.preprocessor.pos);if(e<0)if(this.preprocessor.lastChunkWritten)e=this.entityDecoder.end();else{this.active=!1,this.preprocessor.pos=this.preprocessor.html.length-1,this.consumedAfterSnapshot=0,this.preprocessor.endOfChunkHit=!0;return}e===0?(this.preprocessor.pos=this.entityStartPos,this._flushCodePointConsumedAsCharacterReference(CODE_POINTS.AMPERSAND),this.state=!this._isCharacterReferenceInAttribute()&&isAsciiAlphaNumeric(this.preprocessor.peek(1))?State.AMBIGUOUS_AMPERSAND:this.returnState):this.state=this.returnState}_stateAmbiguousAmpersand(e){isAsciiAlphaNumeric(e)?this._flushCodePointConsumedAsCharacterReference(e):(e===CODE_POINTS.SEMICOLON&&this._err(ERR.unknownNamedCharacterReference),this.state=this.returnState,this._callState(e))}};const IMPLICIT_END_TAG_REQUIRED=new Set([TAG_ID.DD,TAG_ID.DT,TAG_ID.LI,TAG_ID.OPTGROUP,TAG_ID.OPTION,TAG_ID.P,TAG_ID.RB,TAG_ID.RP,TAG_ID.RT,TAG_ID.RTC]),IMPLICIT_END_TAG_REQUIRED_THOROUGHLY=new Set([...IMPLICIT_END_TAG_REQUIRED,TAG_ID.CAPTION,TAG_ID.COLGROUP,TAG_ID.TBODY,TAG_ID.TD,TAG_ID.TFOOT,TAG_ID.TH,TAG_ID.THEAD,TAG_ID.TR]),SCOPING_ELEMENTS_HTML=new Set([TAG_ID.APPLET,TAG_ID.CAPTION,TAG_ID.HTML,TAG_ID.MARQUEE,TAG_ID.OBJECT,TAG_ID.TABLE,TAG_ID.TD,TAG_ID.TEMPLATE,TAG_ID.TH]),SCOPING_ELEMENTS_HTML_LIST=new Set([...SCOPING_ELEMENTS_HTML,TAG_ID.OL,TAG_ID.UL]),SCOPING_ELEMENTS_HTML_BUTTON=new Set([...SCOPING_ELEMENTS_HTML,TAG_ID.BUTTON]),SCOPING_ELEMENTS_MATHML=new Set([TAG_ID.ANNOTATION_XML,TAG_ID.MI,TAG_ID.MN,TAG_ID.MO,TAG_ID.MS,TAG_ID.MTEXT]),SCOPING_ELEMENTS_SVG=new Set([TAG_ID.DESC,TAG_ID.FOREIGN_OBJECT,TAG_ID.TITLE]),TABLE_ROW_CONTEXT=new Set([TAG_ID.TR,TAG_ID.TEMPLATE,TAG_ID.HTML]),TABLE_BODY_CONTEXT=new Set([TAG_ID.TBODY,TAG_ID.TFOOT,TAG_ID.THEAD,TAG_ID.TEMPLATE,TAG_ID.HTML]),TABLE_CONTEXT=new Set([TAG_ID.TABLE,TAG_ID.TEMPLATE,TAG_ID.HTML]),TABLE_CELLS=new Set([TAG_ID.TD,TAG_ID.TH]);var OpenElementStack=class{get currentTmplContentOrNode(){return this._isInTemplate()?this.treeAdapter.getTemplateContent(this.current):this.current}constructor(e,t,S){this.treeAdapter=t,this.handler=S,this.items=[],this.tagIDs=[],this.stackTop=-1,this.tmplCount=0,this.currentTagId=TAG_ID.UNKNOWN,this.current=e}_indexOf(e){return this.items.lastIndexOf(e,this.stackTop)}_isInTemplate(){return this.currentTagId===TAG_ID.TEMPLATE&&this.treeAdapter.getNamespaceURI(this.current)===NS.HTML}_updateCurrentElement(){this.current=this.items[this.stackTop],this.currentTagId=this.tagIDs[this.stackTop]}push(e,t){this.stackTop++,this.items[this.stackTop]=e,this.current=e,this.tagIDs[this.stackTop]=t,this.currentTagId=t,this._isInTemplate()&&this.tmplCount++,this.handler.onItemPush(e,t,!0)}pop(){let e=this.current;this.tmplCount>0&&this._isInTemplate()&&this.tmplCount--,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(e,!0)}replace(e,t){let S=this._indexOf(e);this.items[S]=t,S===this.stackTop&&(this.current=t)}insertAfter(e,t,S){let w=this._indexOf(e)+1;this.items.splice(w,0,t),this.tagIDs.splice(w,0,S),this.stackTop++,w===this.stackTop&&this._updateCurrentElement(),this.current&&this.currentTagId!==void 0&&this.handler.onItemPush(this.current,this.currentTagId,w===this.stackTop)}popUntilTagNamePopped(e){let t=this.stackTop+1;do t=this.tagIDs.lastIndexOf(e,t-1);while(t>0&&this.treeAdapter.getNamespaceURI(this.items[t])!==NS.HTML);this.shortenToLength(Math.max(t,0))}shortenToLength(e){for(;this.stackTop>=e;){let t=this.current;this.tmplCount>0&&this._isInTemplate()&&--this.tmplCount,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,this.stackTop<e)}}popUntilElementPopped(e){let t=this._indexOf(e);this.shortenToLength(Math.max(t,0))}popUntilPopped(e,t){let S=this._indexOfTagNames(e,t);this.shortenToLength(Math.max(S,0))}popUntilNumberedHeaderPopped(){this.popUntilPopped(NUMBERED_HEADERS,NS.HTML)}popUntilTableCellPopped(){this.popUntilPopped(TABLE_CELLS,NS.HTML)}popAllUpToHtmlElement(){this.tmplCount=0,this.shortenToLength(1)}_indexOfTagNames(e,t){for(let S=this.stackTop;S>=0;S--)if(e.has(this.tagIDs[S])&&this.treeAdapter.getNamespaceURI(this.items[S])===t)return S;return-1}clearBackTo(e,t){let S=this._indexOfTagNames(e,t);this.shortenToLength(S+1)}clearBackToTableContext(){this.clearBackTo(TABLE_CONTEXT,NS.HTML)}clearBackToTableBodyContext(){this.clearBackTo(TABLE_BODY_CONTEXT,NS.HTML)}clearBackToTableRowContext(){this.clearBackTo(TABLE_ROW_CONTEXT,NS.HTML)}remove(e){let t=this._indexOf(e);t>=0&&(t===this.stackTop?this.pop():(this.items.splice(t,1),this.tagIDs.splice(t,1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(e,!1)))}tryPeekProperlyNestedBodyElement(){return this.stackTop>=1&&this.tagIDs[1]===TAG_ID.BODY?this.items[1]:null}contains(e){return this._indexOf(e)>-1}getCommonAncestor(e){let t=this._indexOf(e)-1;return t>=0?this.items[t]:null}isRootHtmlElementCurrent(){return this.stackTop===0&&this.tagIDs[0]===TAG_ID.HTML}hasInDynamicScope(e,t){for(let S=this.stackTop;S>=0;S--){let w=this.tagIDs[S];switch(this.treeAdapter.getNamespaceURI(this.items[S])){case NS.HTML:if(w===e)return!0;if(t.has(w))return!1;break;case NS.SVG:if(SCOPING_ELEMENTS_SVG.has(w))return!1;break;case NS.MATHML:if(SCOPING_ELEMENTS_MATHML.has(w))return!1;break}}return!0}hasInScope(e){return this.hasInDynamicScope(e,SCOPING_ELEMENTS_HTML)}hasInListItemScope(e){return this.hasInDynamicScope(e,SCOPING_ELEMENTS_HTML_LIST)}hasInButtonScope(e){return this.hasInDynamicScope(e,SCOPING_ELEMENTS_HTML_BUTTON)}hasNumberedHeaderInScope(){for(let e=this.stackTop;e>=0;e--){let t=this.tagIDs[e];switch(this.treeAdapter.getNamespaceURI(this.items[e])){case NS.HTML:if(NUMBERED_HEADERS.has(t))return!0;if(SCOPING_ELEMENTS_HTML.has(t))return!1;break;case NS.SVG:if(SCOPING_ELEMENTS_SVG.has(t))return!1;break;case NS.MATHML:if(SCOPING_ELEMENTS_MATHML.has(t))return!1;break}}return!0}hasInTableScope(e){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===NS.HTML)switch(this.tagIDs[t]){case e:return!0;case TAG_ID.TABLE:case TAG_ID.HTML:return!1}return!0}hasTableBodyContextInTableScope(){for(let e=this.stackTop;e>=0;e--)if(this.treeAdapter.getNamespaceURI(this.items[e])===NS.HTML)switch(this.tagIDs[e]){case TAG_ID.TBODY:case TAG_ID.THEAD:case TAG_ID.TFOOT:return!0;case TAG_ID.TABLE:case TAG_ID.HTML:return!1}return!0}hasInSelectScope(e){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===NS.HTML)switch(this.tagIDs[t]){case e:return!0;case TAG_ID.OPTION:case TAG_ID.OPTGROUP:break;default:return!1}return!0}generateImpliedEndTags(){for(;this.currentTagId!==void 0&&IMPLICIT_END_TAG_REQUIRED.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;this.currentTagId!==void 0&&IMPLICIT_END_TAG_REQUIRED_THOROUGHLY.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(e){for(;this.currentTagId!==void 0&&this.currentTagId!==e&&IMPLICIT_END_TAG_REQUIRED_THOROUGHLY.has(this.currentTagId);)this.pop()}};const NOAH_ARK_CAPACITY=3;var EntryType;(function(e){e[e.Marker=0]=`Marker`,e[e.Element=1]=`Element`})(EntryType||={});const MARKER={type:EntryType.Marker};var FormattingElementList=class{constructor(e){this.treeAdapter=e,this.entries=[],this.bookmark=null}_getNoahArkConditionCandidates(e,t){let S=[],w=t.length,E=this.treeAdapter.getTagName(e),D=this.treeAdapter.getNamespaceURI(e);for(let e=0;e<this.entries.length;e++){let t=this.entries[e];if(t.type===EntryType.Marker)break;let{element:O}=t;if(this.treeAdapter.getTagName(O)===E&&this.treeAdapter.getNamespaceURI(O)===D){let t=this.treeAdapter.getAttrList(O);t.length===w&&S.push({idx:e,attrs:t})}}return S}_ensureNoahArkCondition(e){if(this.entries.length<NOAH_ARK_CAPACITY)return;let t=this.treeAdapter.getAttrList(e),S=this._getNoahArkConditionCandidates(e,t);if(S.length<NOAH_ARK_CAPACITY)return;let w=new Map(t.map(e=>[e.name,e.value])),E=0;for(let e=0;e<S.length;e++){let t=S[e];t.attrs.every(e=>w.get(e.name)===e.value)&&(E+=1,E>=NOAH_ARK_CAPACITY&&this.entries.splice(t.idx,1))}}insertMarker(){this.entries.unshift(MARKER)}pushElement(e,t){this._ensureNoahArkCondition(e),this.entries.unshift({type:EntryType.Element,element:e,token:t})}insertElementAfterBookmark(e,t){let S=this.entries.indexOf(this.bookmark);this.entries.splice(S,0,{type:EntryType.Element,element:e,token:t})}removeEntry(e){let t=this.entries.indexOf(e);t!==-1&&this.entries.splice(t,1)}clearToLastMarker(){let e=this.entries.indexOf(MARKER);e===-1?this.entries.length=0:this.entries.splice(0,e+1)}getElementEntryInScopeWithTagName(e){let t=this.entries.find(t=>t.type===EntryType.Marker||this.treeAdapter.getTagName(t.element)===e);return t&&t.type===EntryType.Element?t:null}getElementEntry(e){return this.entries.find(t=>t.type===EntryType.Element&&t.element===e)}};const defaultTreeAdapter={createDocument(){return{nodeName:`#document`,mode:DOCUMENT_MODE.NO_QUIRKS,childNodes:[]}},createDocumentFragment(){return{nodeName:`#document-fragment`,childNodes:[]}},createElement(e,t,S){return{nodeName:e,tagName:e,attrs:S,namespaceURI:t,childNodes:[],parentNode:null}},createCommentNode(e){return{nodeName:`#comment`,data:e,parentNode:null}},createTextNode(e){return{nodeName:`#text`,value:e,parentNode:null}},appendChild(e,t){e.childNodes.push(t),t.parentNode=e},insertBefore(e,t,S){let w=e.childNodes.indexOf(S);e.childNodes.splice(w,0,t),t.parentNode=e},setTemplateContent(e,t){e.content=t},getTemplateContent(e){return e.content},setDocumentType(e,t,S,w){let E=e.childNodes.find(e=>e.nodeName===`#documentType`);if(E)E.name=t,E.publicId=S,E.systemId=w;else{let E={nodeName:`#documentType`,name:t,publicId:S,systemId:w,parentNode:null};defaultTreeAdapter.appendChild(e,E)}},setDocumentMode(e,t){e.mode=t},getDocumentMode(e){return e.mode},detachNode(e){if(e.parentNode){let t=e.parentNode.childNodes.indexOf(e);e.parentNode.childNodes.splice(t,1),e.parentNode=null}},insertText(e,t){if(e.childNodes.length>0){let S=e.childNodes[e.childNodes.length-1];if(defaultTreeAdapter.isTextNode(S)){S.value+=t;return}}defaultTreeAdapter.appendChild(e,defaultTreeAdapter.createTextNode(t))},insertTextBefore(e,t,S){let w=e.childNodes[e.childNodes.indexOf(S)-1];w&&defaultTreeAdapter.isTextNode(w)?w.value+=t:defaultTreeAdapter.insertBefore(e,defaultTreeAdapter.createTextNode(t),S)},adoptAttributes(e,t){let S=new Set(e.attrs.map(e=>e.name));for(let w=0;w<t.length;w++)S.has(t[w].name)||e.attrs.push(t[w])},getFirstChild(e){return e.childNodes[0]},getChildNodes(e){return e.childNodes},getParentNode(e){return e.parentNode},getAttrList(e){return e.attrs},getTagName(e){return e.tagName},getNamespaceURI(e){return e.namespaceURI},getTextNodeContent(e){return e.value},getCommentNodeContent(e){return e.data},getDocumentTypeNodeName(e){return e.name},getDocumentTypeNodePublicId(e){return e.publicId},getDocumentTypeNodeSystemId(e){return e.systemId},isTextNode(e){return e.nodeName===`#text`},isCommentNode(e){return e.nodeName===`#comment`},isDocumentTypeNode(e){return e.nodeName===`#documentType`},isElementNode(e){return Object.prototype.hasOwnProperty.call(e,`tagName`)},setNodeSourceCodeLocation(e,t){e.sourceCodeLocation=t},getNodeSourceCodeLocation(e){return e.sourceCodeLocation},updateNodeSourceCodeLocation(e,t){e.sourceCodeLocation={...e.sourceCodeLocation,...t}}},VALID_DOCTYPE_NAME=`html`,VALID_SYSTEM_ID=`about:legacy-compat`,QUIRKS_MODE_SYSTEM_ID=`http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd`,QUIRKS_MODE_PUBLIC_ID_PREFIXES=`+//silmaril//dtd html pro v0r11 19970101//,-//as//dtd html 3.0 aswedit + extensions//,-//advasoft ltd//dtd html 3.0 aswedit + extensions//,-//ietf//dtd html 2.0 level 1//,-//ietf//dtd html 2.0 level 2//,-//ietf//dtd html 2.0 strict level 1//,-//ietf//dtd html 2.0 strict level 2//,-//ietf//dtd html 2.0 strict//,-//ietf//dtd html 2.0//,-//ietf//dtd html 2.1e//,-//ietf//dtd html 3.0//,-//ietf//dtd html 3.2 final//,-//ietf//dtd html 3.2//,-//ietf//dtd html 3//,-//ietf//dtd html level 0//,-//ietf//dtd html level 1//,-//ietf//dtd html level 2//,-//ietf//dtd html level 3//,-//ietf//dtd html strict level 0//,-//ietf//dtd html strict level 1//,-//ietf//dtd html strict level 2//,-//ietf//dtd html strict level 3//,-//ietf//dtd html strict//,-//ietf//dtd html//,-//metrius//dtd metrius presentational//,-//microsoft//dtd internet explorer 2.0 html strict//,-//microsoft//dtd internet explorer 2.0 html//,-//microsoft//dtd internet explorer 2.0 tables//,-//microsoft//dtd internet explorer 3.0 html strict//,-//microsoft//dtd internet explorer 3.0 html//,-//microsoft//dtd internet explorer 3.0 tables//,-//netscape comm. corp.//dtd html//,-//netscape comm. corp.//dtd strict html//,-//o'reilly and associates//dtd html 2.0//,-//o'reilly and associates//dtd html extended 1.0//,-//o'reilly and associates//dtd html extended relaxed 1.0//,-//sq//dtd html 2.0 hotmetal + extensions//,-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//,-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//,-//spyglass//dtd html 2.0 extended//,-//sun microsystems corp.//dtd hotjava html//,-//sun microsystems corp.//dtd hotjava strict html//,-//w3c//dtd html 3 1995-03-24//,-//w3c//dtd html 3.2 draft//,-//w3c//dtd html 3.2 final//,-//w3c//dtd html 3.2//,-//w3c//dtd html 3.2s draft//,-//w3c//dtd html 4.0 frameset//,-//w3c//dtd html 4.0 transitional//,-//w3c//dtd html experimental 19960712//,-//w3c//dtd html experimental 970421//,-//w3c//dtd w3 html//,-//w3o//dtd w3 html 3.0//,-//webtechs//dtd mozilla html 2.0//,-//webtechs//dtd mozilla html//`.split(`,`),QUIRKS_MODE_NO_SYSTEM_ID_PUBLIC_ID_PREFIXES=[...QUIRKS_MODE_PUBLIC_ID_PREFIXES,`-//w3c//dtd html 4.01 frameset//`,`-//w3c//dtd html 4.01 transitional//`],QUIRKS_MODE_PUBLIC_IDS=new Set([`-//w3o//dtd w3 html strict 3.0//en//`,`-/w3c/dtd html 4.0 transitional/en`,`html`]),LIMITED_QUIRKS_PUBLIC_ID_PREFIXES=[`-//w3c//dtd xhtml 1.0 frameset//`,`-//w3c//dtd xhtml 1.0 transitional//`],LIMITED_QUIRKS_WITH_SYSTEM_ID_PUBLIC_ID_PREFIXES=[...LIMITED_QUIRKS_PUBLIC_ID_PREFIXES,`-//w3c//dtd html 4.01 frameset//`,`-//w3c//dtd html 4.01 transitional//`];function hasPrefix(e,t){return t.some(t=>e.startsWith(t))}function isConforming(e){return e.name===VALID_DOCTYPE_NAME&&e.publicId===null&&(e.systemId===null||e.systemId===VALID_SYSTEM_ID)}function getDocumentMode(e){if(e.name!==VALID_DOCTYPE_NAME)return DOCUMENT_MODE.QUIRKS;let{systemId:t}=e;if(t&&t.toLowerCase()===QUIRKS_MODE_SYSTEM_ID)return DOCUMENT_MODE.QUIRKS;let{publicId:S}=e;if(S!==null){if(S=S.toLowerCase(),QUIRKS_MODE_PUBLIC_IDS.has(S))return DOCUMENT_MODE.QUIRKS;let e=t===null?QUIRKS_MODE_NO_SYSTEM_ID_PUBLIC_ID_PREFIXES:QUIRKS_MODE_PUBLIC_ID_PREFIXES;if(hasPrefix(S,e))return DOCUMENT_MODE.QUIRKS;if(e=t===null?LIMITED_QUIRKS_PUBLIC_ID_PREFIXES:LIMITED_QUIRKS_WITH_SYSTEM_ID_PUBLIC_ID_PREFIXES,hasPrefix(S,e))return DOCUMENT_MODE.LIMITED_QUIRKS}return DOCUMENT_MODE.NO_QUIRKS}const MIME_TYPES={TEXT_HTML:`text/html`,APPLICATION_XML:`application/xhtml+xml`},DEFINITION_URL_ATTR=`definitionurl`,ADJUSTED_DEFINITION_URL_ATTR=`definitionURL`,SVG_ATTRS_ADJUSTMENT_MAP=new Map(`attributeName.attributeType.baseFrequency.baseProfile.calcMode.clipPathUnits.diffuseConstant.edgeMode.filterUnits.glyphRef.gradientTransform.gradientUnits.kernelMatrix.kernelUnitLength.keyPoints.keySplines.keyTimes.lengthAdjust.limitingConeAngle.markerHeight.markerUnits.markerWidth.maskContentUnits.maskUnits.numOctaves.pathLength.patternContentUnits.patternTransform.patternUnits.pointsAtX.pointsAtY.pointsAtZ.preserveAlpha.preserveAspectRatio.primitiveUnits.refX.refY.repeatCount.repeatDur.requiredExtensions.requiredFeatures.specularConstant.specularExponent.spreadMethod.startOffset.stdDeviation.stitchTiles.surfaceScale.systemLanguage.tableValues.targetX.targetY.textLength.viewBox.viewTarget.xChannelSelector.yChannelSelector.zoomAndPan`.split(`.`).map(e=>[e.toLowerCase(),e])),XML_ATTRS_ADJUSTMENT_MAP=new Map([[`xlink:actuate`,{prefix:`xlink`,name:`actuate`,namespace:NS.XLINK}],[`xlink:arcrole`,{prefix:`xlink`,name:`arcrole`,namespace:NS.XLINK}],[`xlink:href`,{prefix:`xlink`,name:`href`,namespace:NS.XLINK}],[`xlink:role`,{prefix:`xlink`,name:`role`,namespace:NS.XLINK}],[`xlink:show`,{prefix:`xlink`,name:`show`,namespace:NS.XLINK}],[`xlink:title`,{prefix:`xlink`,name:`title`,namespace:NS.XLINK}],[`xlink:type`,{prefix:`xlink`,name:`type`,namespace:NS.XLINK}],[`xml:lang`,{prefix:`xml`,name:`lang`,namespace:NS.XML}],[`xml:space`,{prefix:`xml`,name:`space`,namespace:NS.XML}],[`xmlns`,{prefix:``,name:`xmlns`,namespace:NS.XMLNS}],[`xmlns:xlink`,{prefix:`xmlns`,name:`xlink`,namespace:NS.XMLNS}]]),SVG_TAG_NAMES_ADJUSTMENT_MAP=new Map(`altGlyph.altGlyphDef.altGlyphItem.animateColor.animateMotion.animateTransform.clipPath.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feDistantLight.feFlood.feFuncA.feFuncB.feFuncG.feFuncR.feGaussianBlur.feImage.feMerge.feMergeNode.feMorphology.feOffset.fePointLight.feSpecularLighting.feSpotLight.feTile.feTurbulence.foreignObject.glyphRef.linearGradient.radialGradient.textPath`.split(`.`).map(e=>[e.toLowerCase(),e])),EXITS_FOREIGN_CONTENT=new Set([TAG_ID.B,TAG_ID.BIG,TAG_ID.BLOCKQUOTE,TAG_ID.BODY,TAG_ID.BR,TAG_ID.CENTER,TAG_ID.CODE,TAG_ID.DD,TAG_ID.DIV,TAG_ID.DL,TAG_ID.DT,TAG_ID.EM,TAG_ID.EMBED,TAG_ID.H1,TAG_ID.H2,TAG_ID.H3,TAG_ID.H4,TAG_ID.H5,TAG_ID.H6,TAG_ID.HEAD,TAG_ID.HR,TAG_ID.I,TAG_ID.IMG,TAG_ID.LI,TAG_ID.LISTING,TAG_ID.MENU,TAG_ID.META,TAG_ID.NOBR,TAG_ID.OL,TAG_ID.P,TAG_ID.PRE,TAG_ID.RUBY,TAG_ID.S,TAG_ID.SMALL,TAG_ID.SPAN,TAG_ID.STRONG,TAG_ID.STRIKE,TAG_ID.SUB,TAG_ID.SUP,TAG_ID.TABLE,TAG_ID.TT,TAG_ID.U,TAG_ID.UL,TAG_ID.VAR]);function causesExit(e){let t=e.tagID;return t===TAG_ID.FONT&&e.attrs.some(({name:e})=>e===ATTRS.COLOR||e===ATTRS.SIZE||e===ATTRS.FACE)||EXITS_FOREIGN_CONTENT.has(t)}function adjustTokenMathMLAttrs(e){for(let t=0;t<e.attrs.length;t++)if(e.attrs[t].name===DEFINITION_URL_ATTR){e.attrs[t].name=ADJUSTED_DEFINITION_URL_ATTR;break}}function adjustTokenSVGAttrs(e){for(let t=0;t<e.attrs.length;t++){let S=SVG_ATTRS_ADJUSTMENT_MAP.get(e.attrs[t].name);S!=null&&(e.attrs[t].name=S)}}function adjustTokenXMLAttrs(e){for(let t=0;t<e.attrs.length;t++){let S=XML_ATTRS_ADJUSTMENT_MAP.get(e.attrs[t].name);S&&(e.attrs[t].prefix=S.prefix,e.attrs[t].name=S.name,e.attrs[t].namespace=S.namespace)}}function adjustTokenSVGTagName(e){let t=SVG_TAG_NAMES_ADJUSTMENT_MAP.get(e.tagName);t!=null&&(e.tagName=t,e.tagID=getTagID(e.tagName))}function isMathMLTextIntegrationPoint(e,t){return t===NS.MATHML&&(e===TAG_ID.MI||e===TAG_ID.MO||e===TAG_ID.MN||e===TAG_ID.MS||e===TAG_ID.MTEXT)}function isHtmlIntegrationPoint(e,t,S){if(t===NS.MATHML&&e===TAG_ID.ANNOTATION_XML){for(let e=0;e<S.length;e++)if(S[e].name===ATTRS.ENCODING){let t=S[e].value.toLowerCase();return t===MIME_TYPES.TEXT_HTML||t===MIME_TYPES.APPLICATION_XML}}return t===NS.SVG&&(e===TAG_ID.FOREIGN_OBJECT||e===TAG_ID.DESC||e===TAG_ID.TITLE)}function isIntegrationPoint(e,t,S,w){return(!w||w===NS.HTML)&&isHtmlIntegrationPoint(e,t,S)||(!w||w===NS.MATHML)&&isMathMLTextIntegrationPoint(e,t)}const HIDDEN_INPUT_TYPE=`hidden`,AA_OUTER_LOOP_ITER=8,AA_INNER_LOOP_ITER=3;var InsertionMode;(function(e){e[e.INITIAL=0]=`INITIAL`,e[e.BEFORE_HTML=1]=`BEFORE_HTML`,e[e.BEFORE_HEAD=2]=`BEFORE_HEAD`,e[e.IN_HEAD=3]=`IN_HEAD`,e[e.IN_HEAD_NO_SCRIPT=4]=`IN_HEAD_NO_SCRIPT`,e[e.AFTER_HEAD=5]=`AFTER_HEAD`,e[e.IN_BODY=6]=`IN_BODY`,e[e.TEXT=7]=`TEXT`,e[e.IN_TABLE=8]=`IN_TABLE`,e[e.IN_TABLE_TEXT=9]=`IN_TABLE_TEXT`,e[e.IN_CAPTION=10]=`IN_CAPTION`,e[e.IN_COLUMN_GROUP=11]=`IN_COLUMN_GROUP`,e[e.IN_TABLE_BODY=12]=`IN_TABLE_BODY`,e[e.IN_ROW=13]=`IN_ROW`,e[e.IN_CELL=14]=`IN_CELL`,e[e.IN_SELECT=15]=`IN_SELECT`,e[e.IN_SELECT_IN_TABLE=16]=`IN_SELECT_IN_TABLE`,e[e.IN_TEMPLATE=17]=`IN_TEMPLATE`,e[e.AFTER_BODY=18]=`AFTER_BODY`,e[e.IN_FRAMESET=19]=`IN_FRAMESET`,e[e.AFTER_FRAMESET=20]=`AFTER_FRAMESET`,e[e.AFTER_AFTER_BODY=21]=`AFTER_AFTER_BODY`,e[e.AFTER_AFTER_FRAMESET=22]=`AFTER_AFTER_FRAMESET`})(InsertionMode||={});const BASE_LOC={startLine:-1,startCol:-1,startOffset:-1,endLine:-1,endCol:-1,endOffset:-1},TABLE_STRUCTURE_TAGS=new Set([TAG_ID.TABLE,TAG_ID.TBODY,TAG_ID.TFOOT,TAG_ID.THEAD,TAG_ID.TR]),defaultParserOptions={scriptingEnabled:!0,sourceCodeLocationInfo:!1,treeAdapter:defaultTreeAdapter,onParseError:null};var Parser=class{constructor(e,t,S=null,w=null){this.fragmentContext=S,this.scriptHandler=w,this.currentToken=null,this.stopped=!1,this.insertionMode=InsertionMode.INITIAL,this.originalInsertionMode=InsertionMode.INITIAL,this.headElement=null,this.formElement=null,this.currentNotInHTML=!1,this.tmplInsertionModeStack=[],this.pendingCharacterTokens=[],this.hasNonWhitespacePendingCharacterToken=!1,this.framesetOk=!0,this.skipNextNewLine=!1,this.fosterParentingEnabled=!1,this.options={...defaultParserOptions,...e},this.treeAdapter=this.options.treeAdapter,this.onParseError=this.options.onParseError,this.onParseError&&(this.options.sourceCodeLocationInfo=!0),this.document=t??this.treeAdapter.createDocument(),this.tokenizer=new Tokenizer(this.options,this),this.activeFormattingElements=new FormattingElementList(this.treeAdapter),this.fragmentContextID=S?getTagID(this.treeAdapter.getTagName(S)):TAG_ID.UNKNOWN,this._setContextModes(S??this.document,this.fragmentContextID),this.openElements=new OpenElementStack(this.document,this.treeAdapter,this)}static parse(e,t){let S=new this(t);return S.tokenizer.write(e,!0),S.document}static getFragmentParser(e,t){let S={...defaultParserOptions,...t};e??=S.treeAdapter.createElement(TAG_NAMES.TEMPLATE,NS.HTML,[]);let w=S.treeAdapter.createElement(`documentmock`,NS.HTML,[]),E=new this(S,w,e);return E.fragmentContextID===TAG_ID.TEMPLATE&&E.tmplInsertionModeStack.unshift(InsertionMode.IN_TEMPLATE),E._initTokenizerForFragmentParsing(),E._insertFakeRootElement(),E._resetInsertionMode(),E._findFormInFragmentContext(),E}getFragment(){let e=this.treeAdapter.getFirstChild(this.document),t=this.treeAdapter.createDocumentFragment();return this._adoptNodes(e,t),t}_err(e,t,S){var w;if(!this.onParseError)return;let E=e.location??BASE_LOC,D={code:t,startLine:E.startLine,startCol:E.startCol,startOffset:E.startOffset,endLine:S?E.startLine:E.endLine,endCol:S?E.startCol:E.endCol,endOffset:S?E.startOffset:E.endOffset};this.onParseError(D)}onItemPush(e,t,S){var w,E;(E=(w=this.treeAdapter).onItemPush)==null||E.call(w,e),S&&this.openElements.stackTop>0&&this._setContextModes(e,t)}onItemPop(e,t){var S,w;if(this.options.sourceCodeLocationInfo&&this._setEndLocation(e,this.currentToken),(w=(S=this.treeAdapter).onItemPop)==null||w.call(S,e,this.openElements.current),t){let e,t;this.openElements.stackTop===0&&this.fragmentContext?(e=this.fragmentContext,t=this.fragmentContextID):{current:e,currentTagId:t}=this.openElements,this._setContextModes(e,t)}}_setContextModes(e,t){let S=e===this.document||e&&this.treeAdapter.getNamespaceURI(e)===NS.HTML;this.currentNotInHTML=!S,this.tokenizer.inForeignNode=!S&&e!==void 0&&t!==void 0&&!this._isIntegrationPoint(t,e)}_switchToTextParsing(e,t){this._insertElement(e,NS.HTML),this.tokenizer.state=t,this.originalInsertionMode=this.insertionMode,this.insertionMode=InsertionMode.TEXT}switchToPlaintextParsing(){this.insertionMode=InsertionMode.TEXT,this.originalInsertionMode=InsertionMode.IN_BODY,this.tokenizer.state=TokenizerMode.PLAINTEXT}_getAdjustedCurrentElement(){return this.openElements.stackTop===0&&this.fragmentContext?this.fragmentContext:this.openElements.current}_findFormInFragmentContext(){let e=this.fragmentContext;for(;e;){if(this.treeAdapter.getTagName(e)===TAG_NAMES.FORM){this.formElement=e;break}e=this.treeAdapter.getParentNode(e)}}_initTokenizerForFragmentParsing(){if(!(!this.fragmentContext||this.treeAdapter.getNamespaceURI(this.fragmentContext)!==NS.HTML))switch(this.fragmentContextID){case TAG_ID.TITLE:case TAG_ID.TEXTAREA:this.tokenizer.state=TokenizerMode.RCDATA;break;case TAG_ID.STYLE:case TAG_ID.XMP:case TAG_ID.IFRAME:case TAG_ID.NOEMBED:case TAG_ID.NOFRAMES:case TAG_ID.NOSCRIPT:this.tokenizer.state=TokenizerMode.RAWTEXT;break;case TAG_ID.SCRIPT:this.tokenizer.state=TokenizerMode.SCRIPT_DATA;break;case TAG_ID.PLAINTEXT:this.tokenizer.state=TokenizerMode.PLAINTEXT;break;default:}}_setDocumentType(e){let t=e.name||``,S=e.publicId||``,w=e.systemId||``;if(this.treeAdapter.setDocumentType(this.document,t,S,w),e.location){let t=this.treeAdapter.getChildNodes(this.document).find(e=>this.treeAdapter.isDocumentTypeNode(e));t&&this.treeAdapter.setNodeSourceCodeLocation(t,e.location)}}_attachElementToTree(e,t){if(this.options.sourceCodeLocationInfo){let S=t&&{...t,startTag:t};this.treeAdapter.setNodeSourceCodeLocation(e,S)}if(this._shouldFosterParentOnInsertion())this._fosterParentElement(e);else{let t=this.openElements.currentTmplContentOrNode;this.treeAdapter.appendChild(t??this.document,e)}}_appendElement(e,t){let S=this.treeAdapter.createElement(e.tagName,t,e.attrs);this._attachElementToTree(S,e.location)}_insertElement(e,t){let S=this.treeAdapter.createElement(e.tagName,t,e.attrs);this._attachElementToTree(S,e.location),this.openElements.push(S,e.tagID)}_insertFakeElement(e,t){let S=this.treeAdapter.createElement(e,NS.HTML,[]);this._attachElementToTree(S,null),this.openElements.push(S,t)}_insertTemplate(e){let t=this.treeAdapter.createElement(e.tagName,NS.HTML,e.attrs),S=this.treeAdapter.createDocumentFragment();this.treeAdapter.setTemplateContent(t,S),this._attachElementToTree(t,e.location),this.openElements.push(t,e.tagID),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(S,null)}_insertFakeRootElement(){let e=this.treeAdapter.createElement(TAG_NAMES.HTML,NS.HTML,[]);this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(e,null),this.treeAdapter.appendChild(this.openElements.current,e),this.openElements.push(e,TAG_ID.HTML)}_appendCommentNode(e,t){let S=this.treeAdapter.createCommentNode(e.data);this.treeAdapter.appendChild(t,S),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(S,e.location)}_insertCharacters(e){let t,S;if(this._shouldFosterParentOnInsertion()?({parent:t,beforeElement:S}=this._findFosterParentingLocation(),S?this.treeAdapter.insertTextBefore(t,e.chars,S):this.treeAdapter.insertText(t,e.chars)):(t=this.openElements.currentTmplContentOrNode,this.treeAdapter.insertText(t,e.chars)),!e.location)return;let w=this.treeAdapter.getChildNodes(t),E=w[(S?w.lastIndexOf(S):w.length)-1];if(this.treeAdapter.getNodeSourceCodeLocation(E)){let{endLine:t,endCol:S,endOffset:w}=e.location;this.treeAdapter.updateNodeSourceCodeLocation(E,{endLine:t,endCol:S,endOffset:w})}else this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(E,e.location)}_adoptNodes(e,t){for(let S=this.treeAdapter.getFirstChild(e);S;S=this.treeAdapter.getFirstChild(e))this.treeAdapter.detachNode(S),this.treeAdapter.appendChild(t,S)}_setEndLocation(e,t){if(this.treeAdapter.getNodeSourceCodeLocation(e)&&t.location){let S=t.location,w=this.treeAdapter.getTagName(e),E=t.type===TokenType.END_TAG&&w===t.tagName?{endTag:{...S},endLine:S.endLine,endCol:S.endCol,endOffset:S.endOffset}:{endLine:S.startLine,endCol:S.startCol,endOffset:S.startOffset};this.treeAdapter.updateNodeSourceCodeLocation(e,E)}}shouldProcessStartTagTokenInForeignContent(e){if(!this.currentNotInHTML)return!1;let t,S;return this.openElements.stackTop===0&&this.fragmentContext?(t=this.fragmentContext,S=this.fragmentContextID):{current:t,currentTagId:S}=this.openElements,e.tagID===TAG_ID.SVG&&this.treeAdapter.getTagName(t)===TAG_NAMES.ANNOTATION_XML&&this.treeAdapter.getNamespaceURI(t)===NS.MATHML?!1:this.tokenizer.inForeignNode||(e.tagID===TAG_ID.MGLYPH||e.tagID===TAG_ID.MALIGNMARK)&&S!==void 0&&!this._isIntegrationPoint(S,t,NS.HTML)}_processToken(e){switch(e.type){case TokenType.CHARACTER:this.onCharacter(e);break;case TokenType.NULL_CHARACTER:this.onNullCharacter(e);break;case TokenType.COMMENT:this.onComment(e);break;case TokenType.DOCTYPE:this.onDoctype(e);break;case TokenType.START_TAG:this._processStartTag(e);break;case TokenType.END_TAG:this.onEndTag(e);break;case TokenType.EOF:this.onEof(e);break;case TokenType.WHITESPACE_CHARACTER:this.onWhitespaceCharacter(e);break}}_isIntegrationPoint(e,t,S){return isIntegrationPoint(e,this.treeAdapter.getNamespaceURI(t),this.treeAdapter.getAttrList(t),S)}_reconstructActiveFormattingElements(){let e=this.activeFormattingElements.entries.length;if(e){let t=this.activeFormattingElements.entries.findIndex(e=>e.type===EntryType.Marker||this.openElements.contains(e.element)),S=t===-1?e-1:t-1;for(let e=S;e>=0;e--){let t=this.activeFormattingElements.entries[e];this._insertElement(t.token,this.treeAdapter.getNamespaceURI(t.element)),t.element=this.openElements.current}}}_closeTableCell(){this.openElements.generateImpliedEndTags(),this.openElements.popUntilTableCellPopped(),this.activeFormattingElements.clearToLastMarker(),this.insertionMode=InsertionMode.IN_ROW}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(TAG_ID.P),this.openElements.popUntilTagNamePopped(TAG_ID.P)}_resetInsertionMode(){for(let e=this.openElements.stackTop;e>=0;e--)switch(e===0&&this.fragmentContext?this.fragmentContextID:this.openElements.tagIDs[e]){case TAG_ID.TR:this.insertionMode=InsertionMode.IN_ROW;return;case TAG_ID.TBODY:case TAG_ID.THEAD:case TAG_ID.TFOOT:this.insertionMode=InsertionMode.IN_TABLE_BODY;return;case TAG_ID.CAPTION:this.insertionMode=InsertionMode.IN_CAPTION;return;case TAG_ID.COLGROUP:this.insertionMode=InsertionMode.IN_COLUMN_GROUP;return;case TAG_ID.TABLE:this.insertionMode=InsertionMode.IN_TABLE;return;case TAG_ID.BODY:this.insertionMode=InsertionMode.IN_BODY;return;case TAG_ID.FRAMESET:this.insertionMode=InsertionMode.IN_FRAMESET;return;case TAG_ID.SELECT:this._resetInsertionModeForSelect(e);return;case TAG_ID.TEMPLATE:this.insertionMode=this.tmplInsertionModeStack[0];return;case TAG_ID.HTML:this.insertionMode=this.headElement?InsertionMode.AFTER_HEAD:InsertionMode.BEFORE_HEAD;return;case TAG_ID.TD:case TAG_ID.TH:if(e>0){this.insertionMode=InsertionMode.IN_CELL;return}break;case TAG_ID.HEAD:if(e>0){this.insertionMode=InsertionMode.IN_HEAD;return}break}this.insertionMode=InsertionMode.IN_BODY}_resetInsertionModeForSelect(e){if(e>0)for(let t=e-1;t>0;t--){let e=this.openElements.tagIDs[t];if(e===TAG_ID.TEMPLATE)break;if(e===TAG_ID.TABLE){this.insertionMode=InsertionMode.IN_SELECT_IN_TABLE;return}}this.insertionMode=InsertionMode.IN_SELECT}_isElementCausesFosterParenting(e){return TABLE_STRUCTURE_TAGS.has(e)}_shouldFosterParentOnInsertion(){return this.fosterParentingEnabled&&this.openElements.currentTagId!==void 0&&this._isElementCausesFosterParenting(this.openElements.currentTagId)}_findFosterParentingLocation(){for(let e=this.openElements.stackTop;e>=0;e--){let t=this.openElements.items[e];switch(this.openElements.tagIDs[e]){case TAG_ID.TEMPLATE:if(this.treeAdapter.getNamespaceURI(t)===NS.HTML)return{parent:this.treeAdapter.getTemplateContent(t),beforeElement:null};break;case TAG_ID.TABLE:{let S=this.treeAdapter.getParentNode(t);return S?{parent:S,beforeElement:t}:{parent:this.openElements.items[e-1],beforeElement:null}}default:}}return{parent:this.openElements.items[0],beforeElement:null}}_fosterParentElement(e){let t=this._findFosterParentingLocation();t.beforeElement?this.treeAdapter.insertBefore(t.parent,e,t.beforeElement):this.treeAdapter.appendChild(t.parent,e)}_isSpecialElement(e,t){return SPECIAL_ELEMENTS[this.treeAdapter.getNamespaceURI(e)].has(t)}onCharacter(e){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){characterInForeignContent(this,e);return}switch(this.insertionMode){case InsertionMode.INITIAL:tokenInInitialMode(this,e);break;case InsertionMode.BEFORE_HTML:tokenBeforeHtml(this,e);break;case InsertionMode.BEFORE_HEAD:tokenBeforeHead(this,e);break;case InsertionMode.IN_HEAD:tokenInHead(this,e);break;case InsertionMode.IN_HEAD_NO_SCRIPT:tokenInHeadNoScript(this,e);break;case InsertionMode.AFTER_HEAD:tokenAfterHead(this,e);break;case InsertionMode.IN_BODY:case InsertionMode.IN_CAPTION:case InsertionMode.IN_CELL:case InsertionMode.IN_TEMPLATE:characterInBody(this,e);break;case InsertionMode.TEXT:case InsertionMode.IN_SELECT:case InsertionMode.IN_SELECT_IN_TABLE:this._insertCharacters(e);break;case InsertionMode.IN_TABLE:case InsertionMode.IN_TABLE_BODY:case InsertionMode.IN_ROW:characterInTable(this,e);break;case InsertionMode.IN_TABLE_TEXT:characterInTableText(this,e);break;case InsertionMode.IN_COLUMN_GROUP:tokenInColumnGroup(this,e);break;case InsertionMode.AFTER_BODY:tokenAfterBody(this,e);break;case InsertionMode.AFTER_AFTER_BODY:tokenAfterAfterBody(this,e);break;default:}}onNullCharacter(e){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){nullCharacterInForeignContent(this,e);return}switch(this.insertionMode){case InsertionMode.INITIAL:tokenInInitialMode(this,e);break;case InsertionMode.BEFORE_HTML:tokenBeforeHtml(this,e);break;case InsertionMode.BEFORE_HEAD:tokenBeforeHead(this,e);break;case InsertionMode.IN_HEAD:tokenInHead(this,e);break;case InsertionMode.IN_HEAD_NO_SCRIPT:tokenInHeadNoScript(this,e);break;case InsertionMode.AFTER_HEAD:tokenAfterHead(this,e);break;case InsertionMode.TEXT:this._insertCharacters(e);break;case InsertionMode.IN_TABLE:case InsertionMode.IN_TABLE_BODY:case InsertionMode.IN_ROW:characterInTable(this,e);break;case InsertionMode.IN_COLUMN_GROUP:tokenInColumnGroup(this,e);break;case InsertionMode.AFTER_BODY:tokenAfterBody(this,e);break;case InsertionMode.AFTER_AFTER_BODY:tokenAfterAfterBody(this,e);break;default:}}onComment(e){if(this.skipNextNewLine=!1,this.currentNotInHTML){appendComment(this,e);return}switch(this.insertionMode){case InsertionMode.INITIAL:case InsertionMode.BEFORE_HTML:case InsertionMode.BEFORE_HEAD:case InsertionMode.IN_HEAD:case InsertionMode.IN_HEAD_NO_SCRIPT:case InsertionMode.AFTER_HEAD:case InsertionMode.IN_BODY:case InsertionMode.IN_TABLE:case InsertionMode.IN_CAPTION:case InsertionMode.IN_COLUMN_GROUP:case InsertionMode.IN_TABLE_BODY:case InsertionMode.IN_ROW:case InsertionMode.IN_CELL:case InsertionMode.IN_SELECT:case InsertionMode.IN_SELECT_IN_TABLE:case InsertionMode.IN_TEMPLATE:case InsertionMode.IN_FRAMESET:case InsertionMode.AFTER_FRAMESET:appendComment(this,e);break;case InsertionMode.IN_TABLE_TEXT:tokenInTableText(this,e);break;case InsertionMode.AFTER_BODY:appendCommentToRootHtmlElement(this,e);break;case InsertionMode.AFTER_AFTER_BODY:case InsertionMode.AFTER_AFTER_FRAMESET:appendCommentToDocument(this,e);break;default:}}onDoctype(e){switch(this.skipNextNewLine=!1,this.insertionMode){case InsertionMode.INITIAL:doctypeInInitialMode(this,e);break;case InsertionMode.BEFORE_HEAD:case InsertionMode.IN_HEAD:case InsertionMode.IN_HEAD_NO_SCRIPT:case InsertionMode.AFTER_HEAD:this._err(e,ERR.misplacedDoctype);break;case InsertionMode.IN_TABLE_TEXT:tokenInTableText(this,e);break;default:}}onStartTag(e){this.skipNextNewLine=!1,this.currentToken=e,this._processStartTag(e),e.selfClosing&&!e.ackSelfClosing&&this._err(e,ERR.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(e){this.shouldProcessStartTagTokenInForeignContent(e)?startTagInForeignContent(this,e):this._startTagOutsideForeignContent(e)}_startTagOutsideForeignContent(e){switch(this.insertionMode){case InsertionMode.INITIAL:tokenInInitialMode(this,e);break;case InsertionMode.BEFORE_HTML:startTagBeforeHtml(this,e);break;case InsertionMode.BEFORE_HEAD:startTagBeforeHead(this,e);break;case InsertionMode.IN_HEAD:startTagInHead(this,e);break;case InsertionMode.IN_HEAD_NO_SCRIPT:startTagInHeadNoScript(this,e);break;case InsertionMode.AFTER_HEAD:startTagAfterHead(this,e);break;case InsertionMode.IN_BODY:startTagInBody(this,e);break;case InsertionMode.IN_TABLE:startTagInTable(this,e);break;case InsertionMode.IN_TABLE_TEXT:tokenInTableText(this,e);break;case InsertionMode.IN_CAPTION:startTagInCaption(this,e);break;case InsertionMode.IN_COLUMN_GROUP:startTagInColumnGroup(this,e);break;case InsertionMode.IN_TABLE_BODY:startTagInTableBody(this,e);break;case InsertionMode.IN_ROW:startTagInRow(this,e);break;case InsertionMode.IN_CELL:startTagInCell(this,e);break;case InsertionMode.IN_SELECT:startTagInSelect(this,e);break;case InsertionMode.IN_SELECT_IN_TABLE:startTagInSelectInTable(this,e);break;case InsertionMode.IN_TEMPLATE:startTagInTemplate(this,e);break;case InsertionMode.AFTER_BODY:startTagAfterBody(this,e);break;case InsertionMode.IN_FRAMESET:startTagInFrameset(this,e);break;case InsertionMode.AFTER_FRAMESET:startTagAfterFrameset(this,e);break;case InsertionMode.AFTER_AFTER_BODY:startTagAfterAfterBody(this,e);break;case InsertionMode.AFTER_AFTER_FRAMESET:startTagAfterAfterFrameset(this,e);break;default:}}onEndTag(e){this.skipNextNewLine=!1,this.currentToken=e,this.currentNotInHTML?endTagInForeignContent(this,e):this._endTagOutsideForeignContent(e)}_endTagOutsideForeignContent(e){switch(this.insertionMode){case InsertionMode.INITIAL:tokenInInitialMode(this,e);break;case InsertionMode.BEFORE_HTML:endTagBeforeHtml(this,e);break;case InsertionMode.BEFORE_HEAD:endTagBeforeHead(this,e);break;case InsertionMode.IN_HEAD:endTagInHead(this,e);break;case InsertionMode.IN_HEAD_NO_SCRIPT:endTagInHeadNoScript(this,e);break;case InsertionMode.AFTER_HEAD:endTagAfterHead(this,e);break;case InsertionMode.IN_BODY:endTagInBody(this,e);break;case InsertionMode.TEXT:endTagInText(this,e);break;case InsertionMode.IN_TABLE:endTagInTable(this,e);break;case InsertionMode.IN_TABLE_TEXT:tokenInTableText(this,e);break;case InsertionMode.IN_CAPTION:endTagInCaption(this,e);break;case InsertionMode.IN_COLUMN_GROUP:endTagInColumnGroup(this,e);break;case InsertionMode.IN_TABLE_BODY:endTagInTableBody(this,e);break;case InsertionMode.IN_ROW:endTagInRow(this,e);break;case InsertionMode.IN_CELL:endTagInCell(this,e);break;case InsertionMode.IN_SELECT:endTagInSelect(this,e);break;case InsertionMode.IN_SELECT_IN_TABLE:endTagInSelectInTable(this,e);break;case InsertionMode.IN_TEMPLATE:endTagInTemplate(this,e);break;case InsertionMode.AFTER_BODY:endTagAfterBody(this,e);break;case InsertionMode.IN_FRAMESET:endTagInFrameset(this,e);break;case InsertionMode.AFTER_FRAMESET:endTagAfterFrameset(this,e);break;case InsertionMode.AFTER_AFTER_BODY:tokenAfterAfterBody(this,e);break;default:}}onEof(e){switch(this.insertionMode){case InsertionMode.INITIAL:tokenInInitialMode(this,e);break;case InsertionMode.BEFORE_HTML:tokenBeforeHtml(this,e);break;case InsertionMode.BEFORE_HEAD:tokenBeforeHead(this,e);break;case InsertionMode.IN_HEAD:tokenInHead(this,e);break;case InsertionMode.IN_HEAD_NO_SCRIPT:tokenInHeadNoScript(this,e);break;case InsertionMode.AFTER_HEAD:tokenAfterHead(this,e);break;case InsertionMode.IN_BODY:case InsertionMode.IN_TABLE:case InsertionMode.IN_CAPTION:case InsertionMode.IN_COLUMN_GROUP:case InsertionMode.IN_TABLE_BODY:case InsertionMode.IN_ROW:case InsertionMode.IN_CELL:case InsertionMode.IN_SELECT:case InsertionMode.IN_SELECT_IN_TABLE:eofInBody(this,e);break;case InsertionMode.TEXT:eofInText(this,e);break;case InsertionMode.IN_TABLE_TEXT:tokenInTableText(this,e);break;case InsertionMode.IN_TEMPLATE:eofInTemplate(this,e);break;case InsertionMode.AFTER_BODY:case InsertionMode.IN_FRAMESET:case InsertionMode.AFTER_FRAMESET:case InsertionMode.AFTER_AFTER_BODY:case InsertionMode.AFTER_AFTER_FRAMESET:stopParsing(this,e);break;default:}}onWhitespaceCharacter(e){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,e.chars.charCodeAt(0)===CODE_POINTS.LINE_FEED)){if(e.chars.length===1)return;e.chars=e.chars.substr(1)}if(this.tokenizer.inForeignNode){this._insertCharacters(e);return}switch(this.insertionMode){case InsertionMode.IN_HEAD:case InsertionMode.IN_HEAD_NO_SCRIPT:case InsertionMode.AFTER_HEAD:case InsertionMode.TEXT:case InsertionMode.IN_COLUMN_GROUP:case InsertionMode.IN_SELECT:case InsertionMode.IN_SELECT_IN_TABLE:case InsertionMode.IN_FRAMESET:case InsertionMode.AFTER_FRAMESET:this._insertCharacters(e);break;case InsertionMode.IN_BODY:case InsertionMode.IN_CAPTION:case InsertionMode.IN_CELL:case InsertionMode.IN_TEMPLATE:case InsertionMode.AFTER_BODY:case InsertionMode.AFTER_AFTER_BODY:case InsertionMode.AFTER_AFTER_FRAMESET:whitespaceCharacterInBody(this,e);break;case InsertionMode.IN_TABLE:case InsertionMode.IN_TABLE_BODY:case InsertionMode.IN_ROW:characterInTable(this,e);break;case InsertionMode.IN_TABLE_TEXT:whitespaceCharacterInTableText(this,e);break;default:}}};function aaObtainFormattingElementEntry(e,t){let S=e.activeFormattingElements.getElementEntryInScopeWithTagName(t.tagName);return S?e.openElements.contains(S.element)?e.openElements.hasInScope(t.tagID)||(S=null):(e.activeFormattingElements.removeEntry(S),S=null):genericEndTagInBody(e,t),S}function aaObtainFurthestBlock(e,t){let S=null,w=e.openElements.stackTop;for(;w>=0;w--){let E=e.openElements.items[w];if(E===t.element)break;e._isSpecialElement(E,e.openElements.tagIDs[w])&&(S=E)}return S||(e.openElements.shortenToLength(Math.max(w,0)),e.activeFormattingElements.removeEntry(t)),S}function aaInnerLoop(e,t,S){let w=t,E=e.openElements.getCommonAncestor(t);for(let D=0,O=E;O!==S;D++,O=E){E=e.openElements.getCommonAncestor(O);let S=e.activeFormattingElements.getElementEntry(O),k=S&&D>=AA_INNER_LOOP_ITER;!S||k?(k&&e.activeFormattingElements.removeEntry(S),e.openElements.remove(O)):(O=aaRecreateElementFromEntry(e,S),w===t&&(e.activeFormattingElements.bookmark=S),e.treeAdapter.detachNode(w),e.treeAdapter.appendChild(O,w),w=O)}return w}function aaRecreateElementFromEntry(e,t){let S=e.treeAdapter.getNamespaceURI(t.element),w=e.treeAdapter.createElement(t.token.tagName,S,t.token.attrs);return e.openElements.replace(t.element,w),t.element=w,w}function aaInsertLastNodeInCommonAncestor(e,t,S){let w=getTagID(e.treeAdapter.getTagName(t));if(e._isElementCausesFosterParenting(w))e._fosterParentElement(S);else{let E=e.treeAdapter.getNamespaceURI(t);w===TAG_ID.TEMPLATE&&E===NS.HTML&&(t=e.treeAdapter.getTemplateContent(t)),e.treeAdapter.appendChild(t,S)}}function aaReplaceFormattingElement(e,t,S){let w=e.treeAdapter.getNamespaceURI(S.element),{token:E}=S,D=e.treeAdapter.createElement(E.tagName,w,E.attrs);e._adoptNodes(t,D),e.treeAdapter.appendChild(t,D),e.activeFormattingElements.insertElementAfterBookmark(D,E),e.activeFormattingElements.removeEntry(S),e.openElements.remove(S.element),e.openElements.insertAfter(t,D,E.tagID)}function callAdoptionAgency(e,t){for(let S=0;S<AA_OUTER_LOOP_ITER;S++){let S=aaObtainFormattingElementEntry(e,t);if(!S)break;let w=aaObtainFurthestBlock(e,S);if(!w)break;e.activeFormattingElements.bookmark=S;let E=aaInnerLoop(e,w,S.element),D=e.openElements.getCommonAncestor(S.element);e.treeAdapter.detachNode(E),D&&aaInsertLastNodeInCommonAncestor(e,D,E),aaReplaceFormattingElement(e,w,S)}}function appendComment(e,t){e._appendCommentNode(t,e.openElements.currentTmplContentOrNode)}function appendCommentToRootHtmlElement(e,t){e._appendCommentNode(t,e.openElements.items[0])}function appendCommentToDocument(e,t){e._appendCommentNode(t,e.document)}function stopParsing(e,t){if(e.stopped=!0,t.location){let S=e.fragmentContext?0:2;for(let w=e.openElements.stackTop;w>=S;w--)e._setEndLocation(e.openElements.items[w],t);if(!e.fragmentContext&&e.openElements.stackTop>=0){let S=e.openElements.items[0],w=e.treeAdapter.getNodeSourceCodeLocation(S);if(w&&!w.endTag&&(e._setEndLocation(S,t),e.openElements.stackTop>=1)){let S=e.openElements.items[1],w=e.treeAdapter.getNodeSourceCodeLocation(S);w&&!w.endTag&&e._setEndLocation(S,t)}}}}function doctypeInInitialMode(e,t){e._setDocumentType(t);let S=t.forceQuirks?DOCUMENT_MODE.QUIRKS:getDocumentMode(t);isConforming(t)||e._err(t,ERR.nonConformingDoctype),e.treeAdapter.setDocumentMode(e.document,S),e.insertionMode=InsertionMode.BEFORE_HTML}function tokenInInitialMode(e,t){e._err(t,ERR.missingDoctype,!0),e.treeAdapter.setDocumentMode(e.document,DOCUMENT_MODE.QUIRKS),e.insertionMode=InsertionMode.BEFORE_HTML,e._processToken(t)}function startTagBeforeHtml(e,t){t.tagID===TAG_ID.HTML?(e._insertElement(t,NS.HTML),e.insertionMode=InsertionMode.BEFORE_HEAD):tokenBeforeHtml(e,t)}function endTagBeforeHtml(e,t){let S=t.tagID;(S===TAG_ID.HTML||S===TAG_ID.HEAD||S===TAG_ID.BODY||S===TAG_ID.BR)&&tokenBeforeHtml(e,t)}function tokenBeforeHtml(e,t){e._insertFakeRootElement(),e.insertionMode=InsertionMode.BEFORE_HEAD,e._processToken(t)}function startTagBeforeHead(e,t){switch(t.tagID){case TAG_ID.HTML:startTagInBody(e,t);break;case TAG_ID.HEAD:e._insertElement(t,NS.HTML),e.headElement=e.openElements.current,e.insertionMode=InsertionMode.IN_HEAD;break;default:tokenBeforeHead(e,t)}}function endTagBeforeHead(e,t){let S=t.tagID;S===TAG_ID.HEAD||S===TAG_ID.BODY||S===TAG_ID.HTML||S===TAG_ID.BR?tokenBeforeHead(e,t):e._err(t,ERR.endTagWithoutMatchingOpenElement)}function tokenBeforeHead(e,t){e._insertFakeElement(TAG_NAMES.HEAD,TAG_ID.HEAD),e.headElement=e.openElements.current,e.insertionMode=InsertionMode.IN_HEAD,e._processToken(t)}function startTagInHead(e,t){switch(t.tagID){case TAG_ID.HTML:startTagInBody(e,t);break;case TAG_ID.BASE:case TAG_ID.BASEFONT:case TAG_ID.BGSOUND:case TAG_ID.LINK:case TAG_ID.META:e._appendElement(t,NS.HTML),t.ackSelfClosing=!0;break;case TAG_ID.TITLE:e._switchToTextParsing(t,TokenizerMode.RCDATA);break;case TAG_ID.NOSCRIPT:e.options.scriptingEnabled?e._switchToTextParsing(t,TokenizerMode.RAWTEXT):(e._insertElement(t,NS.HTML),e.insertionMode=InsertionMode.IN_HEAD_NO_SCRIPT);break;case TAG_ID.NOFRAMES:case TAG_ID.STYLE:e._switchToTextParsing(t,TokenizerMode.RAWTEXT);break;case TAG_ID.SCRIPT:e._switchToTextParsing(t,TokenizerMode.SCRIPT_DATA);break;case TAG_ID.TEMPLATE:e._insertTemplate(t),e.activeFormattingElements.insertMarker(),e.framesetOk=!1,e.insertionMode=InsertionMode.IN_TEMPLATE,e.tmplInsertionModeStack.unshift(InsertionMode.IN_TEMPLATE);break;case TAG_ID.HEAD:e._err(t,ERR.misplacedStartTagForHeadElement);break;default:tokenInHead(e,t)}}function endTagInHead(e,t){switch(t.tagID){case TAG_ID.HEAD:e.openElements.pop(),e.insertionMode=InsertionMode.AFTER_HEAD;break;case TAG_ID.BODY:case TAG_ID.BR:case TAG_ID.HTML:tokenInHead(e,t);break;case TAG_ID.TEMPLATE:templateEndTagInHead(e,t);break;default:e._err(t,ERR.endTagWithoutMatchingOpenElement)}}function templateEndTagInHead(e,t){e.openElements.tmplCount>0?(e.openElements.generateImpliedEndTagsThoroughly(),e.openElements.currentTagId!==TAG_ID.TEMPLATE&&e._err(t,ERR.closingOfElementWithOpenChildElements),e.openElements.popUntilTagNamePopped(TAG_ID.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode()):e._err(t,ERR.endTagWithoutMatchingOpenElement)}function tokenInHead(e,t){e.openElements.pop(),e.insertionMode=InsertionMode.AFTER_HEAD,e._processToken(t)}function startTagInHeadNoScript(e,t){switch(t.tagID){case TAG_ID.HTML:startTagInBody(e,t);break;case TAG_ID.BASEFONT:case TAG_ID.BGSOUND:case TAG_ID.HEAD:case TAG_ID.LINK:case TAG_ID.META:case TAG_ID.NOFRAMES:case TAG_ID.STYLE:startTagInHead(e,t);break;case TAG_ID.NOSCRIPT:e._err(t,ERR.nestedNoscriptInHead);break;default:tokenInHeadNoScript(e,t)}}function endTagInHeadNoScript(e,t){switch(t.tagID){case TAG_ID.NOSCRIPT:e.openElements.pop(),e.insertionMode=InsertionMode.IN_HEAD;break;case TAG_ID.BR:tokenInHeadNoScript(e,t);break;default:e._err(t,ERR.endTagWithoutMatchingOpenElement)}}function tokenInHeadNoScript(e,t){let S=t.type===TokenType.EOF?ERR.openElementsLeftAfterEof:ERR.disallowedContentInNoscriptInHead;e._err(t,S),e.openElements.pop(),e.insertionMode=InsertionMode.IN_HEAD,e._processToken(t)}function startTagAfterHead(e,t){switch(t.tagID){case TAG_ID.HTML:startTagInBody(e,t);break;case TAG_ID.BODY:e._insertElement(t,NS.HTML),e.framesetOk=!1,e.insertionMode=InsertionMode.IN_BODY;break;case TAG_ID.FRAMESET:e._insertElement(t,NS.HTML),e.insertionMode=InsertionMode.IN_FRAMESET;break;case TAG_ID.BASE:case TAG_ID.BASEFONT:case TAG_ID.BGSOUND:case TAG_ID.LINK:case TAG_ID.META:case TAG_ID.NOFRAMES:case TAG_ID.SCRIPT:case TAG_ID.STYLE:case TAG_ID.TEMPLATE:case TAG_ID.TITLE:e._err(t,ERR.abandonedHeadElementChild),e.openElements.push(e.headElement,TAG_ID.HEAD),startTagInHead(e,t),e.openElements.remove(e.headElement);break;case TAG_ID.HEAD:e._err(t,ERR.misplacedStartTagForHeadElement);break;default:tokenAfterHead(e,t)}}function endTagAfterHead(e,t){switch(t.tagID){case TAG_ID.BODY:case TAG_ID.HTML:case TAG_ID.BR:tokenAfterHead(e,t);break;case TAG_ID.TEMPLATE:templateEndTagInHead(e,t);break;default:e._err(t,ERR.endTagWithoutMatchingOpenElement)}}function tokenAfterHead(e,t){e._insertFakeElement(TAG_NAMES.BODY,TAG_ID.BODY),e.insertionMode=InsertionMode.IN_BODY,modeInBody(e,t)}function modeInBody(e,t){switch(t.type){case TokenType.CHARACTER:characterInBody(e,t);break;case TokenType.WHITESPACE_CHARACTER:whitespaceCharacterInBody(e,t);break;case TokenType.COMMENT:appendComment(e,t);break;case TokenType.START_TAG:startTagInBody(e,t);break;case TokenType.END_TAG:endTagInBody(e,t);break;case TokenType.EOF:eofInBody(e,t);break;default:}}function whitespaceCharacterInBody(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t)}function characterInBody(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t),e.framesetOk=!1}function htmlStartTagInBody(e,t){e.openElements.tmplCount===0&&e.treeAdapter.adoptAttributes(e.openElements.items[0],t.attrs)}function bodyStartTagInBody(e,t){let S=e.openElements.tryPeekProperlyNestedBodyElement();S&&e.openElements.tmplCount===0&&(e.framesetOk=!1,e.treeAdapter.adoptAttributes(S,t.attrs))}function framesetStartTagInBody(e,t){let S=e.openElements.tryPeekProperlyNestedBodyElement();e.framesetOk&&S&&(e.treeAdapter.detachNode(S),e.openElements.popAllUpToHtmlElement(),e._insertElement(t,NS.HTML),e.insertionMode=InsertionMode.IN_FRAMESET)}function addressStartTagInBody(e,t){e.openElements.hasInButtonScope(TAG_ID.P)&&e._closePElement(),e._insertElement(t,NS.HTML)}function numberedHeaderStartTagInBody(e,t){e.openElements.hasInButtonScope(TAG_ID.P)&&e._closePElement(),e.openElements.currentTagId!==void 0&&NUMBERED_HEADERS.has(e.openElements.currentTagId)&&e.openElements.pop(),e._insertElement(t,NS.HTML)}function preStartTagInBody(e,t){e.openElements.hasInButtonScope(TAG_ID.P)&&e._closePElement(),e._insertElement(t,NS.HTML),e.skipNextNewLine=!0,e.framesetOk=!1}function formStartTagInBody(e,t){let S=e.openElements.tmplCount>0;(!e.formElement||S)&&(e.openElements.hasInButtonScope(TAG_ID.P)&&e._closePElement(),e._insertElement(t,NS.HTML),S||(e.formElement=e.openElements.current))}function listItemStartTagInBody(e,t){e.framesetOk=!1;let S=t.tagID;for(let t=e.openElements.stackTop;t>=0;t--){let w=e.openElements.tagIDs[t];if(S===TAG_ID.LI&&w===TAG_ID.LI||(S===TAG_ID.DD||S===TAG_ID.DT)&&(w===TAG_ID.DD||w===TAG_ID.DT)){e.openElements.generateImpliedEndTagsWithExclusion(w),e.openElements.popUntilTagNamePopped(w);break}if(w!==TAG_ID.ADDRESS&&w!==TAG_ID.DIV&&w!==TAG_ID.P&&e._isSpecialElement(e.openElements.items[t],w))break}e.openElements.hasInButtonScope(TAG_ID.P)&&e._closePElement(),e._insertElement(t,NS.HTML)}function plaintextStartTagInBody(e,t){e.openElements.hasInButtonScope(TAG_ID.P)&&e._closePElement(),e._insertElement(t,NS.HTML),e.tokenizer.state=TokenizerMode.PLAINTEXT}function buttonStartTagInBody(e,t){e.openElements.hasInScope(TAG_ID.BUTTON)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(TAG_ID.BUTTON)),e._reconstructActiveFormattingElements(),e._insertElement(t,NS.HTML),e.framesetOk=!1}function aStartTagInBody(e,t){let S=e.activeFormattingElements.getElementEntryInScopeWithTagName(TAG_NAMES.A);S&&(callAdoptionAgency(e,t),e.openElements.remove(S.element),e.activeFormattingElements.removeEntry(S)),e._reconstructActiveFormattingElements(),e._insertElement(t,NS.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function bStartTagInBody(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,NS.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function nobrStartTagInBody(e,t){e._reconstructActiveFormattingElements(),e.openElements.hasInScope(TAG_ID.NOBR)&&(callAdoptionAgency(e,t),e._reconstructActiveFormattingElements()),e._insertElement(t,NS.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function appletStartTagInBody(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,NS.HTML),e.activeFormattingElements.insertMarker(),e.framesetOk=!1}function tableStartTagInBody(e,t){e.treeAdapter.getDocumentMode(e.document)!==DOCUMENT_MODE.QUIRKS&&e.openElements.hasInButtonScope(TAG_ID.P)&&e._closePElement(),e._insertElement(t,NS.HTML),e.framesetOk=!1,e.insertionMode=InsertionMode.IN_TABLE}function areaStartTagInBody(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,NS.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function isHiddenInput(e){let t=getTokenAttr(e,ATTRS.TYPE);return t!=null&&t.toLowerCase()===HIDDEN_INPUT_TYPE}function inputStartTagInBody(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,NS.HTML),isHiddenInput(t)||(e.framesetOk=!1),t.ackSelfClosing=!0}function paramStartTagInBody(e,t){e._appendElement(t,NS.HTML),t.ackSelfClosing=!0}function hrStartTagInBody(e,t){e.openElements.hasInButtonScope(TAG_ID.P)&&e._closePElement(),e._appendElement(t,NS.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function imageStartTagInBody(e,t){t.tagName=TAG_NAMES.IMG,t.tagID=TAG_ID.IMG,areaStartTagInBody(e,t)}function textareaStartTagInBody(e,t){e._insertElement(t,NS.HTML),e.skipNextNewLine=!0,e.tokenizer.state=TokenizerMode.RCDATA,e.originalInsertionMode=e.insertionMode,e.framesetOk=!1,e.insertionMode=InsertionMode.TEXT}function xmpStartTagInBody(e,t){e.openElements.hasInButtonScope(TAG_ID.P)&&e._closePElement(),e._reconstructActiveFormattingElements(),e.framesetOk=!1,e._switchToTextParsing(t,TokenizerMode.RAWTEXT)}function iframeStartTagInBody(e,t){e.framesetOk=!1,e._switchToTextParsing(t,TokenizerMode.RAWTEXT)}function rawTextStartTagInBody(e,t){e._switchToTextParsing(t,TokenizerMode.RAWTEXT)}function selectStartTagInBody(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,NS.HTML),e.framesetOk=!1,e.insertionMode=e.insertionMode===InsertionMode.IN_TABLE||e.insertionMode===InsertionMode.IN_CAPTION||e.insertionMode===InsertionMode.IN_TABLE_BODY||e.insertionMode===InsertionMode.IN_ROW||e.insertionMode===InsertionMode.IN_CELL?InsertionMode.IN_SELECT_IN_TABLE:InsertionMode.IN_SELECT}function optgroupStartTagInBody(e,t){e.openElements.currentTagId===TAG_ID.OPTION&&e.openElements.pop(),e._reconstructActiveFormattingElements(),e._insertElement(t,NS.HTML)}function rbStartTagInBody(e,t){e.openElements.hasInScope(TAG_ID.RUBY)&&e.openElements.generateImpliedEndTags(),e._insertElement(t,NS.HTML)}function rtStartTagInBody(e,t){e.openElements.hasInScope(TAG_ID.RUBY)&&e.openElements.generateImpliedEndTagsWithExclusion(TAG_ID.RTC),e._insertElement(t,NS.HTML)}function mathStartTagInBody(e,t){e._reconstructActiveFormattingElements(),adjustTokenMathMLAttrs(t),adjustTokenXMLAttrs(t),t.selfClosing?e._appendElement(t,NS.MATHML):e._insertElement(t,NS.MATHML),t.ackSelfClosing=!0}function svgStartTagInBody(e,t){e._reconstructActiveFormattingElements(),adjustTokenSVGAttrs(t),adjustTokenXMLAttrs(t),t.selfClosing?e._appendElement(t,NS.SVG):e._insertElement(t,NS.SVG),t.ackSelfClosing=!0}function genericStartTagInBody(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,NS.HTML)}function startTagInBody(e,t){switch(t.tagID){case TAG_ID.I:case TAG_ID.S:case TAG_ID.B:case TAG_ID.U:case TAG_ID.EM:case TAG_ID.TT:case TAG_ID.BIG:case TAG_ID.CODE:case TAG_ID.FONT:case TAG_ID.SMALL:case TAG_ID.STRIKE:case TAG_ID.STRONG:bStartTagInBody(e,t);break;case TAG_ID.A:aStartTagInBody(e,t);break;case TAG_ID.H1:case TAG_ID.H2:case TAG_ID.H3:case TAG_ID.H4:case TAG_ID.H5:case TAG_ID.H6:numberedHeaderStartTagInBody(e,t);break;case TAG_ID.P:case TAG_ID.DL:case TAG_ID.OL:case TAG_ID.UL:case TAG_ID.DIV:case TAG_ID.DIR:case TAG_ID.NAV:case TAG_ID.MAIN:case TAG_ID.MENU:case TAG_ID.ASIDE:case TAG_ID.CENTER:case TAG_ID.FIGURE:case TAG_ID.FOOTER:case TAG_ID.HEADER:case TAG_ID.HGROUP:case TAG_ID.DIALOG:case TAG_ID.DETAILS:case TAG_ID.ADDRESS:case TAG_ID.ARTICLE:case TAG_ID.SEARCH:case TAG_ID.SECTION:case TAG_ID.SUMMARY:case TAG_ID.FIELDSET:case TAG_ID.BLOCKQUOTE:case TAG_ID.FIGCAPTION:addressStartTagInBody(e,t);break;case TAG_ID.LI:case TAG_ID.DD:case TAG_ID.DT:listItemStartTagInBody(e,t);break;case TAG_ID.BR:case TAG_ID.IMG:case TAG_ID.WBR:case TAG_ID.AREA:case TAG_ID.EMBED:case TAG_ID.KEYGEN:areaStartTagInBody(e,t);break;case TAG_ID.HR:hrStartTagInBody(e,t);break;case TAG_ID.RB:case TAG_ID.RTC:rbStartTagInBody(e,t);break;case TAG_ID.RT:case TAG_ID.RP:rtStartTagInBody(e,t);break;case TAG_ID.PRE:case TAG_ID.LISTING:preStartTagInBody(e,t);break;case TAG_ID.XMP:xmpStartTagInBody(e,t);break;case TAG_ID.SVG:svgStartTagInBody(e,t);break;case TAG_ID.HTML:htmlStartTagInBody(e,t);break;case TAG_ID.BASE:case TAG_ID.LINK:case TAG_ID.META:case TAG_ID.STYLE:case TAG_ID.TITLE:case TAG_ID.SCRIPT:case TAG_ID.BGSOUND:case TAG_ID.BASEFONT:case TAG_ID.TEMPLATE:startTagInHead(e,t);break;case TAG_ID.BODY:bodyStartTagInBody(e,t);break;case TAG_ID.FORM:formStartTagInBody(e,t);break;case TAG_ID.NOBR:nobrStartTagInBody(e,t);break;case TAG_ID.MATH:mathStartTagInBody(e,t);break;case TAG_ID.TABLE:tableStartTagInBody(e,t);break;case TAG_ID.INPUT:inputStartTagInBody(e,t);break;case TAG_ID.PARAM:case TAG_ID.TRACK:case TAG_ID.SOURCE:paramStartTagInBody(e,t);break;case TAG_ID.IMAGE:imageStartTagInBody(e,t);break;case TAG_ID.BUTTON:buttonStartTagInBody(e,t);break;case TAG_ID.APPLET:case TAG_ID.OBJECT:case TAG_ID.MARQUEE:appletStartTagInBody(e,t);break;case TAG_ID.IFRAME:iframeStartTagInBody(e,t);break;case TAG_ID.SELECT:selectStartTagInBody(e,t);break;case TAG_ID.OPTION:case TAG_ID.OPTGROUP:optgroupStartTagInBody(e,t);break;case TAG_ID.NOEMBED:case TAG_ID.NOFRAMES:rawTextStartTagInBody(e,t);break;case TAG_ID.FRAMESET:framesetStartTagInBody(e,t);break;case TAG_ID.TEXTAREA:textareaStartTagInBody(e,t);break;case TAG_ID.NOSCRIPT:e.options.scriptingEnabled?rawTextStartTagInBody(e,t):genericStartTagInBody(e,t);break;case TAG_ID.PLAINTEXT:plaintextStartTagInBody(e,t);break;case TAG_ID.COL:case TAG_ID.TH:case TAG_ID.TD:case TAG_ID.TR:case TAG_ID.HEAD:case TAG_ID.FRAME:case TAG_ID.TBODY:case TAG_ID.TFOOT:case TAG_ID.THEAD:case TAG_ID.CAPTION:case TAG_ID.COLGROUP:break;default:genericStartTagInBody(e,t)}}function bodyEndTagInBody(e,t){if(e.openElements.hasInScope(TAG_ID.BODY)&&(e.insertionMode=InsertionMode.AFTER_BODY,e.options.sourceCodeLocationInfo)){let S=e.openElements.tryPeekProperlyNestedBodyElement();S&&e._setEndLocation(S,t)}}function htmlEndTagInBody(e,t){e.openElements.hasInScope(TAG_ID.BODY)&&(e.insertionMode=InsertionMode.AFTER_BODY,endTagAfterBody(e,t))}function addressEndTagInBody(e,t){let S=t.tagID;e.openElements.hasInScope(S)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(S))}function formEndTagInBody(e){let t=e.openElements.tmplCount>0,{formElement:S}=e;t||(e.formElement=null),(S||t)&&e.openElements.hasInScope(TAG_ID.FORM)&&(e.openElements.generateImpliedEndTags(),t?e.openElements.popUntilTagNamePopped(TAG_ID.FORM):S&&e.openElements.remove(S))}function pEndTagInBody(e){e.openElements.hasInButtonScope(TAG_ID.P)||e._insertFakeElement(TAG_NAMES.P,TAG_ID.P),e._closePElement()}function liEndTagInBody(e){e.openElements.hasInListItemScope(TAG_ID.LI)&&(e.openElements.generateImpliedEndTagsWithExclusion(TAG_ID.LI),e.openElements.popUntilTagNamePopped(TAG_ID.LI))}function ddEndTagInBody(e,t){let S=t.tagID;e.openElements.hasInScope(S)&&(e.openElements.generateImpliedEndTagsWithExclusion(S),e.openElements.popUntilTagNamePopped(S))}function numberedHeaderEndTagInBody(e){e.openElements.hasNumberedHeaderInScope()&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilNumberedHeaderPopped())}function appletEndTagInBody(e,t){let S=t.tagID;e.openElements.hasInScope(S)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(S),e.activeFormattingElements.clearToLastMarker())}function brEndTagInBody(e){e._reconstructActiveFormattingElements(),e._insertFakeElement(TAG_NAMES.BR,TAG_ID.BR),e.openElements.pop(),e.framesetOk=!1}function genericEndTagInBody(e,t){let S=t.tagName,w=t.tagID;for(let t=e.openElements.stackTop;t>0;t--){let E=e.openElements.items[t],D=e.openElements.tagIDs[t];if(w===D&&(w!==TAG_ID.UNKNOWN||e.treeAdapter.getTagName(E)===S)){e.openElements.generateImpliedEndTagsWithExclusion(w),e.openElements.stackTop>=t&&e.openElements.shortenToLength(t);break}if(e._isSpecialElement(E,D))break}}function endTagInBody(e,t){switch(t.tagID){case TAG_ID.A:case TAG_ID.B:case TAG_ID.I:case TAG_ID.S:case TAG_ID.U:case TAG_ID.EM:case TAG_ID.TT:case TAG_ID.BIG:case TAG_ID.CODE:case TAG_ID.FONT:case TAG_ID.NOBR:case TAG_ID.SMALL:case TAG_ID.STRIKE:case TAG_ID.STRONG:callAdoptionAgency(e,t);break;case TAG_ID.P:pEndTagInBody(e);break;case TAG_ID.DL:case TAG_ID.UL:case TAG_ID.OL:case TAG_ID.DIR:case TAG_ID.DIV:case TAG_ID.NAV:case TAG_ID.PRE:case TAG_ID.MAIN:case TAG_ID.MENU:case TAG_ID.ASIDE:case TAG_ID.BUTTON:case TAG_ID.CENTER:case TAG_ID.FIGURE:case TAG_ID.FOOTER:case TAG_ID.HEADER:case TAG_ID.HGROUP:case TAG_ID.DIALOG:case TAG_ID.ADDRESS:case TAG_ID.ARTICLE:case TAG_ID.DETAILS:case TAG_ID.SEARCH:case TAG_ID.SECTION:case TAG_ID.SUMMARY:case TAG_ID.LISTING:case TAG_ID.FIELDSET:case TAG_ID.BLOCKQUOTE:case TAG_ID.FIGCAPTION:addressEndTagInBody(e,t);break;case TAG_ID.LI:liEndTagInBody(e);break;case TAG_ID.DD:case TAG_ID.DT:ddEndTagInBody(e,t);break;case TAG_ID.H1:case TAG_ID.H2:case TAG_ID.H3:case TAG_ID.H4:case TAG_ID.H5:case TAG_ID.H6:numberedHeaderEndTagInBody(e);break;case TAG_ID.BR:brEndTagInBody(e);break;case TAG_ID.BODY:bodyEndTagInBody(e,t);break;case TAG_ID.HTML:htmlEndTagInBody(e,t);break;case TAG_ID.FORM:formEndTagInBody(e);break;case TAG_ID.APPLET:case TAG_ID.OBJECT:case TAG_ID.MARQUEE:appletEndTagInBody(e,t);break;case TAG_ID.TEMPLATE:templateEndTagInHead(e,t);break;default:genericEndTagInBody(e,t)}}function eofInBody(e,t){e.tmplInsertionModeStack.length>0?eofInTemplate(e,t):stopParsing(e,t)}function endTagInText(e,t){var S;t.tagID===TAG_ID.SCRIPT&&((S=e.scriptHandler)==null||S.call(e,e.openElements.current)),e.openElements.pop(),e.insertionMode=e.originalInsertionMode}function eofInText(e,t){e._err(t,ERR.eofInElementThatCanContainOnlyText),e.openElements.pop(),e.insertionMode=e.originalInsertionMode,e.onEof(t)}function characterInTable(e,t){if(e.openElements.currentTagId!==void 0&&TABLE_STRUCTURE_TAGS.has(e.openElements.currentTagId))switch(e.pendingCharacterTokens.length=0,e.hasNonWhitespacePendingCharacterToken=!1,e.originalInsertionMode=e.insertionMode,e.insertionMode=InsertionMode.IN_TABLE_TEXT,t.type){case TokenType.CHARACTER:characterInTableText(e,t);break;case TokenType.WHITESPACE_CHARACTER:whitespaceCharacterInTableText(e,t);break}else tokenInTable(e,t)}function captionStartTagInTable(e,t){e.openElements.clearBackToTableContext(),e.activeFormattingElements.insertMarker(),e._insertElement(t,NS.HTML),e.insertionMode=InsertionMode.IN_CAPTION}function colgroupStartTagInTable(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,NS.HTML),e.insertionMode=InsertionMode.IN_COLUMN_GROUP}function colStartTagInTable(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(TAG_NAMES.COLGROUP,TAG_ID.COLGROUP),e.insertionMode=InsertionMode.IN_COLUMN_GROUP,startTagInColumnGroup(e,t)}function tbodyStartTagInTable(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,NS.HTML),e.insertionMode=InsertionMode.IN_TABLE_BODY}function tdStartTagInTable(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(TAG_NAMES.TBODY,TAG_ID.TBODY),e.insertionMode=InsertionMode.IN_TABLE_BODY,startTagInTableBody(e,t)}function tableStartTagInTable(e,t){e.openElements.hasInTableScope(TAG_ID.TABLE)&&(e.openElements.popUntilTagNamePopped(TAG_ID.TABLE),e._resetInsertionMode(),e._processStartTag(t))}function inputStartTagInTable(e,t){isHiddenInput(t)?e._appendElement(t,NS.HTML):tokenInTable(e,t),t.ackSelfClosing=!0}function formStartTagInTable(e,t){!e.formElement&&e.openElements.tmplCount===0&&(e._insertElement(t,NS.HTML),e.formElement=e.openElements.current,e.openElements.pop())}function startTagInTable(e,t){switch(t.tagID){case TAG_ID.TD:case TAG_ID.TH:case TAG_ID.TR:tdStartTagInTable(e,t);break;case TAG_ID.STYLE:case TAG_ID.SCRIPT:case TAG_ID.TEMPLATE:startTagInHead(e,t);break;case TAG_ID.COL:colStartTagInTable(e,t);break;case TAG_ID.FORM:formStartTagInTable(e,t);break;case TAG_ID.TABLE:tableStartTagInTable(e,t);break;case TAG_ID.TBODY:case TAG_ID.TFOOT:case TAG_ID.THEAD:tbodyStartTagInTable(e,t);break;case TAG_ID.INPUT:inputStartTagInTable(e,t);break;case TAG_ID.CAPTION:captionStartTagInTable(e,t);break;case TAG_ID.COLGROUP:colgroupStartTagInTable(e,t);break;default:tokenInTable(e,t)}}function endTagInTable(e,t){switch(t.tagID){case TAG_ID.TABLE:e.openElements.hasInTableScope(TAG_ID.TABLE)&&(e.openElements.popUntilTagNamePopped(TAG_ID.TABLE),e._resetInsertionMode());break;case TAG_ID.TEMPLATE:templateEndTagInHead(e,t);break;case TAG_ID.BODY:case TAG_ID.CAPTION:case TAG_ID.COL:case TAG_ID.COLGROUP:case TAG_ID.HTML:case TAG_ID.TBODY:case TAG_ID.TD:case TAG_ID.TFOOT:case TAG_ID.TH:case TAG_ID.THEAD:case TAG_ID.TR:break;default:tokenInTable(e,t)}}function tokenInTable(e,t){let S=e.fosterParentingEnabled;e.fosterParentingEnabled=!0,modeInBody(e,t),e.fosterParentingEnabled=S}function whitespaceCharacterInTableText(e,t){e.pendingCharacterTokens.push(t)}function characterInTableText(e,t){e.pendingCharacterTokens.push(t),e.hasNonWhitespacePendingCharacterToken=!0}function tokenInTableText(e,t){let S=0;if(e.hasNonWhitespacePendingCharacterToken)for(;S<e.pendingCharacterTokens.length;S++)tokenInTable(e,e.pendingCharacterTokens[S]);else for(;S<e.pendingCharacterTokens.length;S++)e._insertCharacters(e.pendingCharacterTokens[S]);e.insertionMode=e.originalInsertionMode,e._processToken(t)}const TABLE_VOID_ELEMENTS=new Set([TAG_ID.CAPTION,TAG_ID.COL,TAG_ID.COLGROUP,TAG_ID.TBODY,TAG_ID.TD,TAG_ID.TFOOT,TAG_ID.TH,TAG_ID.THEAD,TAG_ID.TR]);function startTagInCaption(e,t){let S=t.tagID;TABLE_VOID_ELEMENTS.has(S)?e.openElements.hasInTableScope(TAG_ID.CAPTION)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(TAG_ID.CAPTION),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=InsertionMode.IN_TABLE,startTagInTable(e,t)):startTagInBody(e,t)}function endTagInCaption(e,t){let S=t.tagID;switch(S){case TAG_ID.CAPTION:case TAG_ID.TABLE:e.openElements.hasInTableScope(TAG_ID.CAPTION)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(TAG_ID.CAPTION),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=InsertionMode.IN_TABLE,S===TAG_ID.TABLE&&endTagInTable(e,t));break;case TAG_ID.BODY:case TAG_ID.COL:case TAG_ID.COLGROUP:case TAG_ID.HTML:case TAG_ID.TBODY:case TAG_ID.TD:case TAG_ID.TFOOT:case TAG_ID.TH:case TAG_ID.THEAD:case TAG_ID.TR:break;default:endTagInBody(e,t)}}function startTagInColumnGroup(e,t){switch(t.tagID){case TAG_ID.HTML:startTagInBody(e,t);break;case TAG_ID.COL:e._appendElement(t,NS.HTML),t.ackSelfClosing=!0;break;case TAG_ID.TEMPLATE:startTagInHead(e,t);break;default:tokenInColumnGroup(e,t)}}function endTagInColumnGroup(e,t){switch(t.tagID){case TAG_ID.COLGROUP:e.openElements.currentTagId===TAG_ID.COLGROUP&&(e.openElements.pop(),e.insertionMode=InsertionMode.IN_TABLE);break;case TAG_ID.TEMPLATE:templateEndTagInHead(e,t);break;case TAG_ID.COL:break;default:tokenInColumnGroup(e,t)}}function tokenInColumnGroup(e,t){e.openElements.currentTagId===TAG_ID.COLGROUP&&(e.openElements.pop(),e.insertionMode=InsertionMode.IN_TABLE,e._processToken(t))}function startTagInTableBody(e,t){switch(t.tagID){case TAG_ID.TR:e.openElements.clearBackToTableBodyContext(),e._insertElement(t,NS.HTML),e.insertionMode=InsertionMode.IN_ROW;break;case TAG_ID.TH:case TAG_ID.TD:e.openElements.clearBackToTableBodyContext(),e._insertFakeElement(TAG_NAMES.TR,TAG_ID.TR),e.insertionMode=InsertionMode.IN_ROW,startTagInRow(e,t);break;case TAG_ID.CAPTION:case TAG_ID.COL:case TAG_ID.COLGROUP:case TAG_ID.TBODY:case TAG_ID.TFOOT:case TAG_ID.THEAD:e.openElements.hasTableBodyContextInTableScope()&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=InsertionMode.IN_TABLE,startTagInTable(e,t));break;default:startTagInTable(e,t)}}function endTagInTableBody(e,t){let S=t.tagID;switch(t.tagID){case TAG_ID.TBODY:case TAG_ID.TFOOT:case TAG_ID.THEAD:e.openElements.hasInTableScope(S)&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=InsertionMode.IN_TABLE);break;case TAG_ID.TABLE:e.openElements.hasTableBodyContextInTableScope()&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=InsertionMode.IN_TABLE,endTagInTable(e,t));break;case TAG_ID.BODY:case TAG_ID.CAPTION:case TAG_ID.COL:case TAG_ID.COLGROUP:case TAG_ID.HTML:case TAG_ID.TD:case TAG_ID.TH:case TAG_ID.TR:break;default:endTagInTable(e,t)}}function startTagInRow(e,t){switch(t.tagID){case TAG_ID.TH:case TAG_ID.TD:e.openElements.clearBackToTableRowContext(),e._insertElement(t,NS.HTML),e.insertionMode=InsertionMode.IN_CELL,e.activeFormattingElements.insertMarker();break;case TAG_ID.CAPTION:case TAG_ID.COL:case TAG_ID.COLGROUP:case TAG_ID.TBODY:case TAG_ID.TFOOT:case TAG_ID.THEAD:case TAG_ID.TR:e.openElements.hasInTableScope(TAG_ID.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=InsertionMode.IN_TABLE_BODY,startTagInTableBody(e,t));break;default:startTagInTable(e,t)}}function endTagInRow(e,t){switch(t.tagID){case TAG_ID.TR:e.openElements.hasInTableScope(TAG_ID.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=InsertionMode.IN_TABLE_BODY);break;case TAG_ID.TABLE:e.openElements.hasInTableScope(TAG_ID.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=InsertionMode.IN_TABLE_BODY,endTagInTableBody(e,t));break;case TAG_ID.TBODY:case TAG_ID.TFOOT:case TAG_ID.THEAD:(e.openElements.hasInTableScope(t.tagID)||e.openElements.hasInTableScope(TAG_ID.TR))&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=InsertionMode.IN_TABLE_BODY,endTagInTableBody(e,t));break;case TAG_ID.BODY:case TAG_ID.CAPTION:case TAG_ID.COL:case TAG_ID.COLGROUP:case TAG_ID.HTML:case TAG_ID.TD:case TAG_ID.TH:break;default:endTagInTable(e,t)}}function startTagInCell(e,t){let S=t.tagID;TABLE_VOID_ELEMENTS.has(S)?(e.openElements.hasInTableScope(TAG_ID.TD)||e.openElements.hasInTableScope(TAG_ID.TH))&&(e._closeTableCell(),startTagInRow(e,t)):startTagInBody(e,t)}function endTagInCell(e,t){let S=t.tagID;switch(S){case TAG_ID.TD:case TAG_ID.TH:e.openElements.hasInTableScope(S)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(S),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=InsertionMode.IN_ROW);break;case TAG_ID.TABLE:case TAG_ID.TBODY:case TAG_ID.TFOOT:case TAG_ID.THEAD:case TAG_ID.TR:e.openElements.hasInTableScope(S)&&(e._closeTableCell(),endTagInRow(e,t));break;case TAG_ID.BODY:case TAG_ID.CAPTION:case TAG_ID.COL:case TAG_ID.COLGROUP:case TAG_ID.HTML:break;default:endTagInBody(e,t)}}function startTagInSelect(e,t){switch(t.tagID){case TAG_ID.HTML:startTagInBody(e,t);break;case TAG_ID.OPTION:e.openElements.currentTagId===TAG_ID.OPTION&&e.openElements.pop(),e._insertElement(t,NS.HTML);break;case TAG_ID.OPTGROUP:e.openElements.currentTagId===TAG_ID.OPTION&&e.openElements.pop(),e.openElements.currentTagId===TAG_ID.OPTGROUP&&e.openElements.pop(),e._insertElement(t,NS.HTML);break;case TAG_ID.HR:e.openElements.currentTagId===TAG_ID.OPTION&&e.openElements.pop(),e.openElements.currentTagId===TAG_ID.OPTGROUP&&e.openElements.pop(),e._appendElement(t,NS.HTML),t.ackSelfClosing=!0;break;case TAG_ID.INPUT:case TAG_ID.KEYGEN:case TAG_ID.TEXTAREA:case TAG_ID.SELECT:e.openElements.hasInSelectScope(TAG_ID.SELECT)&&(e.openElements.popUntilTagNamePopped(TAG_ID.SELECT),e._resetInsertionMode(),t.tagID!==TAG_ID.SELECT&&e._processStartTag(t));break;case TAG_ID.SCRIPT:case TAG_ID.TEMPLATE:startTagInHead(e,t);break;default:}}function endTagInSelect(e,t){switch(t.tagID){case TAG_ID.OPTGROUP:e.openElements.stackTop>0&&e.openElements.currentTagId===TAG_ID.OPTION&&e.openElements.tagIDs[e.openElements.stackTop-1]===TAG_ID.OPTGROUP&&e.openElements.pop(),e.openElements.currentTagId===TAG_ID.OPTGROUP&&e.openElements.pop();break;case TAG_ID.OPTION:e.openElements.currentTagId===TAG_ID.OPTION&&e.openElements.pop();break;case TAG_ID.SELECT:e.openElements.hasInSelectScope(TAG_ID.SELECT)&&(e.openElements.popUntilTagNamePopped(TAG_ID.SELECT),e._resetInsertionMode());break;case TAG_ID.TEMPLATE:templateEndTagInHead(e,t);break;default:}}function startTagInSelectInTable(e,t){let S=t.tagID;S===TAG_ID.CAPTION||S===TAG_ID.TABLE||S===TAG_ID.TBODY||S===TAG_ID.TFOOT||S===TAG_ID.THEAD||S===TAG_ID.TR||S===TAG_ID.TD||S===TAG_ID.TH?(e.openElements.popUntilTagNamePopped(TAG_ID.SELECT),e._resetInsertionMode(),e._processStartTag(t)):startTagInSelect(e,t)}function endTagInSelectInTable(e,t){let S=t.tagID;S===TAG_ID.CAPTION||S===TAG_ID.TABLE||S===TAG_ID.TBODY||S===TAG_ID.TFOOT||S===TAG_ID.THEAD||S===TAG_ID.TR||S===TAG_ID.TD||S===TAG_ID.TH?e.openElements.hasInTableScope(S)&&(e.openElements.popUntilTagNamePopped(TAG_ID.SELECT),e._resetInsertionMode(),e.onEndTag(t)):endTagInSelect(e,t)}function startTagInTemplate(e,t){switch(t.tagID){case TAG_ID.BASE:case TAG_ID.BASEFONT:case TAG_ID.BGSOUND:case TAG_ID.LINK:case TAG_ID.META:case TAG_ID.NOFRAMES:case TAG_ID.SCRIPT:case TAG_ID.STYLE:case TAG_ID.TEMPLATE:case TAG_ID.TITLE:startTagInHead(e,t);break;case TAG_ID.CAPTION:case TAG_ID.COLGROUP:case TAG_ID.TBODY:case TAG_ID.TFOOT:case TAG_ID.THEAD:e.tmplInsertionModeStack[0]=InsertionMode.IN_TABLE,e.insertionMode=InsertionMode.IN_TABLE,startTagInTable(e,t);break;case TAG_ID.COL:e.tmplInsertionModeStack[0]=InsertionMode.IN_COLUMN_GROUP,e.insertionMode=InsertionMode.IN_COLUMN_GROUP,startTagInColumnGroup(e,t);break;case TAG_ID.TR:e.tmplInsertionModeStack[0]=InsertionMode.IN_TABLE_BODY,e.insertionMode=InsertionMode.IN_TABLE_BODY,startTagInTableBody(e,t);break;case TAG_ID.TD:case TAG_ID.TH:e.tmplInsertionModeStack[0]=InsertionMode.IN_ROW,e.insertionMode=InsertionMode.IN_ROW,startTagInRow(e,t);break;default:e.tmplInsertionModeStack[0]=InsertionMode.IN_BODY,e.insertionMode=InsertionMode.IN_BODY,startTagInBody(e,t)}}function endTagInTemplate(e,t){t.tagID===TAG_ID.TEMPLATE&&templateEndTagInHead(e,t)}function eofInTemplate(e,t){e.openElements.tmplCount>0?(e.openElements.popUntilTagNamePopped(TAG_ID.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode(),e.onEof(t)):stopParsing(e,t)}function startTagAfterBody(e,t){t.tagID===TAG_ID.HTML?startTagInBody(e,t):tokenAfterBody(e,t)}function endTagAfterBody(e,t){var S;if(t.tagID===TAG_ID.HTML){if(e.fragmentContext||(e.insertionMode=InsertionMode.AFTER_AFTER_BODY),e.options.sourceCodeLocationInfo&&e.openElements.tagIDs[0]===TAG_ID.HTML){e._setEndLocation(e.openElements.items[0],t);let S=e.openElements.items[1];S&&!e.treeAdapter.getNodeSourceCodeLocation(S)?.endTag&&e._setEndLocation(S,t)}}else tokenAfterBody(e,t)}function tokenAfterBody(e,t){e.insertionMode=InsertionMode.IN_BODY,modeInBody(e,t)}function startTagInFrameset(e,t){switch(t.tagID){case TAG_ID.HTML:startTagInBody(e,t);break;case TAG_ID.FRAMESET:e._insertElement(t,NS.HTML);break;case TAG_ID.FRAME:e._appendElement(t,NS.HTML),t.ackSelfClosing=!0;break;case TAG_ID.NOFRAMES:startTagInHead(e,t);break;default:}}function endTagInFrameset(e,t){t.tagID===TAG_ID.FRAMESET&&!e.openElements.isRootHtmlElementCurrent()&&(e.openElements.pop(),!e.fragmentContext&&e.openElements.currentTagId!==TAG_ID.FRAMESET&&(e.insertionMode=InsertionMode.AFTER_FRAMESET))}function startTagAfterFrameset(e,t){switch(t.tagID){case TAG_ID.HTML:startTagInBody(e,t);break;case TAG_ID.NOFRAMES:startTagInHead(e,t);break;default:}}function endTagAfterFrameset(e,t){t.tagID===TAG_ID.HTML&&(e.insertionMode=InsertionMode.AFTER_AFTER_FRAMESET)}function startTagAfterAfterBody(e,t){t.tagID===TAG_ID.HTML?startTagInBody(e,t):tokenAfterAfterBody(e,t)}function tokenAfterAfterBody(e,t){e.insertionMode=InsertionMode.IN_BODY,modeInBody(e,t)}function startTagAfterAfterFrameset(e,t){switch(t.tagID){case TAG_ID.HTML:startTagInBody(e,t);break;case TAG_ID.NOFRAMES:startTagInHead(e,t);break;default:}}function nullCharacterInForeignContent(e,t){t.chars=`�`,e._insertCharacters(t)}function characterInForeignContent(e,t){e._insertCharacters(t),e.framesetOk=!1}function popUntilHtmlOrIntegrationPoint(e){for(;e.treeAdapter.getNamespaceURI(e.openElements.current)!==NS.HTML&&e.openElements.currentTagId!==void 0&&!e._isIntegrationPoint(e.openElements.currentTagId,e.openElements.current);)e.openElements.pop()}function startTagInForeignContent(e,t){if(causesExit(t))popUntilHtmlOrIntegrationPoint(e),e._startTagOutsideForeignContent(t);else{let S=e._getAdjustedCurrentElement(),w=e.treeAdapter.getNamespaceURI(S);w===NS.MATHML?adjustTokenMathMLAttrs(t):w===NS.SVG&&(adjustTokenSVGTagName(t),adjustTokenSVGAttrs(t)),adjustTokenXMLAttrs(t),t.selfClosing?e._appendElement(t,w):e._insertElement(t,w),t.ackSelfClosing=!0}}function endTagInForeignContent(e,t){if(t.tagID===TAG_ID.P||t.tagID===TAG_ID.BR){popUntilHtmlOrIntegrationPoint(e),e._endTagOutsideForeignContent(t);return}for(let S=e.openElements.stackTop;S>0;S--){let w=e.openElements.items[S];if(e.treeAdapter.getNamespaceURI(w)===NS.HTML){e._endTagOutsideForeignContent(t);break}let E=e.treeAdapter.getTagName(w);if(E.toLowerCase()===t.tagName){t.tagName=E,e.openElements.shortenToLength(S);break}}}const VOID_ELEMENTS=new Set([TAG_NAMES.AREA,TAG_NAMES.BASE,TAG_NAMES.BASEFONT,TAG_NAMES.BGSOUND,TAG_NAMES.BR,TAG_NAMES.COL,TAG_NAMES.EMBED,TAG_NAMES.FRAME,TAG_NAMES.HR,TAG_NAMES.IMG,TAG_NAMES.INPUT,TAG_NAMES.KEYGEN,TAG_NAMES.LINK,TAG_NAMES.META,TAG_NAMES.PARAM,TAG_NAMES.SOURCE,TAG_NAMES.TRACK,TAG_NAMES.WBR]);function parse$2(e,t){return Parser.parse(e,t)}function parseFragment(e,t,S){typeof e==`string`&&(S=t,t=e,e=null);let w=Parser.getFragmentParser(e,S);return w.tokenizer.write(t,!0),w.getFragment()}function isUrl(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}const order=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`];var VFile=class{constructor(e){let t;t=e?isUrl(e)?{path:e}:typeof e==`string`||isUint8Array$2(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:minproc.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let S=-1;for(;++S<order.length;){let e=order[S];e in t&&t[e]!==void 0&&t[e]!==null&&(this[e]=e===`history`?[...t[e]]:t[e])}let w;for(w in t)order.includes(w)||(this[w]=t[w])}get basename(){return typeof this.path==`string`?minpath.basename(this.path):void 0}set basename(e){assertNonEmpty(e,`basename`),assertPart(e,`basename`),this.path=minpath.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?minpath.dirname(this.path):void 0}set dirname(e){assertPath(this.basename,`dirname`),this.path=minpath.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?minpath.extname(this.path):void 0}set extname(e){if(assertPart(e,`extname`),assertPath(this.dirname,`extname`),e){if(e.codePointAt(0)!==46)throw Error("`extname` must start with `.`");if(e.includes(`.`,1))throw Error("`extname` cannot contain multiple dots")}this.path=minpath.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){isUrl(e)&&(e=urlToPath(e)),assertNonEmpty(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?minpath.basename(this.path,this.extname):void 0}set stem(e){assertNonEmpty(e,`stem`),assertPart(e,`stem`),this.path=minpath.join(this.dirname||``,e+(this.extname||``))}fail(e,t,S){let w=this.message(e,t,S);throw w.fatal=!0,w}info(e,t,S){let w=this.message(e,t,S);return w.fatal=void 0,w}message(e,t,S){let w=new VFileMessage(e,t,S);return this.path&&(w.name=this.path+`:`+w.name,w.file=this.path),w.fatal=!1,this.messages.push(w),w}toString(e){return this.value===void 0?``:typeof this.value==`string`?this.value:new TextDecoder(e||void 0).decode(this.value)}};function assertPart(e,t){if(e&&e.includes(minpath.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+minpath.sep+"`")}function assertNonEmpty(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function assertPath(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function isUint8Array$2(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}const errors$1={abandonedHeadElementChild:{reason:`Unexpected metadata element after head`,description:"Unexpected element after head. Expected the element before `</head>`",url:!1},abruptClosingOfEmptyComment:{reason:`Unexpected abruptly closed empty comment`,description:"Unexpected `>` or `->`. Expected `-->` to close comments"},abruptDoctypePublicIdentifier:{reason:`Unexpected abruptly closed public identifier`,description:"Unexpected `>`. Expected a closing `\"` or `'` after the public identifier"},abruptDoctypeSystemIdentifier:{reason:`Unexpected abruptly closed system identifier`,description:"Unexpected `>`. Expected a closing `\"` or `'` after the identifier identifier"},absenceOfDigitsInNumericCharacterReference:{reason:`Unexpected non-digit at start of numeric character reference`,description:"Unexpected `%c`. Expected `[0-9]` for decimal references or `[0-9a-fA-F]` for hexadecimal references"},cdataInHtmlContent:{reason:`Unexpected CDATA section in HTML`,description:"Unexpected `<![CDATA[` in HTML. Remove it, use a comment, or encode special characters instead"},characterReferenceOutsideUnicodeRange:{reason:`Unexpected too big numeric character reference`,description:`Unexpectedly high character reference. Expected character references to be at most hexadecimal 10ffff (or decimal 1114111)`},closingOfElementWithOpenChildElements:{reason:`Unexpected closing tag with open child elements`,description:`Unexpectedly closing tag. Expected other tags to be closed first`,url:!1},controlCharacterInInputStream:{reason:`Unexpected control character`,description:"Unexpected control character `%x`. Expected a non-control code point, 0x00, or ASCII whitespace"},controlCharacterReference:{reason:`Unexpected control character reference`,description:`Unexpectedly control character in reference. Expected a non-control code point, 0x00, or ASCII whitespace`},disallowedContentInNoscriptInHead:{reason:"Disallowed content inside `<noscript>` in `<head>`",description:"Unexpected text character `%c`. Only use text in `<noscript>`s in `<body>`",url:!1},duplicateAttribute:{reason:`Unexpected duplicate attribute`,description:`Unexpectedly double attribute. Expected attributes to occur only once`},endTagWithAttributes:{reason:`Unexpected attribute on closing tag`,description:"Unexpected attribute. Expected `>` instead"},endTagWithTrailingSolidus:{reason:`Unexpected slash at end of closing tag`,description:"Unexpected `%c-1`. Expected `>` instead"},endTagWithoutMatchingOpenElement:{reason:`Unexpected unopened end tag`,description:`Unexpected end tag. Expected no end tag or another end tag`,url:!1},eofBeforeTagName:{reason:`Unexpected end of file`,description:`Unexpected end of file. Expected tag name instead`},eofInCdata:{reason:`Unexpected end of file in CDATA`,description:"Unexpected end of file. Expected `]]>` to close the CDATA"},eofInComment:{reason:`Unexpected end of file in comment`,description:"Unexpected end of file. Expected `-->` to close the comment"},eofInDoctype:{reason:`Unexpected end of file in doctype`,description:"Unexpected end of file. Expected a valid doctype (such as `<!doctype html>`)"},eofInElementThatCanContainOnlyText:{reason:`Unexpected end of file in element that can only contain text`,description:`Unexpected end of file. Expected text or a closing tag`,url:!1},eofInScriptHtmlCommentLikeText:{reason:`Unexpected end of file in comment inside script`,description:"Unexpected end of file. Expected `-->` to close the comment"},eofInTag:{reason:`Unexpected end of file in tag`,description:"Unexpected end of file. Expected `>` to close the tag"},incorrectlyClosedComment:{reason:`Incorrectly closed comment`,description:"Unexpected `%c-1`. Expected `-->` to close the comment"},incorrectlyOpenedComment:{reason:`Incorrectly opened comment`,description:"Unexpected `%c`. Expected `<!--` to open the comment"},invalidCharacterSequenceAfterDoctypeName:{reason:`Invalid sequence after doctype name`,description:"Unexpected sequence at `%c`. Expected `public` or `system`"},invalidFirstCharacterOfTagName:{reason:`Invalid first character in tag name`,description:"Unexpected `%c`. Expected an ASCII letter instead"},misplacedDoctype:{reason:`Misplaced doctype`,description:`Unexpected doctype. Expected doctype before head`,url:!1},misplacedStartTagForHeadElement:{reason:"Misplaced `<head>` start tag",description:"Unexpected start tag `<head>`. Expected `<head>` directly after doctype",url:!1},missingAttributeValue:{reason:`Missing attribute value`,description:"Unexpected `%c-1`. Expected an attribute value or no `%c-1` instead"},missingDoctype:{reason:`Missing doctype before other content`,description:"Expected a `<!doctype html>` before anything else",url:!1},missingDoctypeName:{reason:`Missing doctype name`,description:"Unexpected doctype end at `%c`. Expected `html` instead"},missingDoctypePublicIdentifier:{reason:`Missing public identifier in doctype`,description:"Unexpected `%c`. Expected identifier for `public` instead"},missingDoctypeSystemIdentifier:{reason:`Missing system identifier in doctype`,description:'Unexpected `%c`. Expected identifier for `system` instead (suggested: `"about:legacy-compat"`)'},missingEndTagName:{reason:`Missing name in end tag`,description:"Unexpected `%c`. Expected an ASCII letter instead"},missingQuoteBeforeDoctypePublicIdentifier:{reason:`Missing quote before public identifier in doctype`,description:"Unexpected `%c`. Expected `\"` or `'` instead"},missingQuoteBeforeDoctypeSystemIdentifier:{reason:`Missing quote before system identifier in doctype`,description:"Unexpected `%c`. Expected `\"` or `'` instead"},missingSemicolonAfterCharacterReference:{reason:`Missing semicolon after character reference`,description:"Unexpected `%c`. Expected `;` instead"},missingWhitespaceAfterDoctypePublicKeyword:{reason:`Missing whitespace after public identifier in doctype`,description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceAfterDoctypeSystemKeyword:{reason:`Missing whitespace after system identifier in doctype`,description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceBeforeDoctypeName:{reason:`Missing whitespace before doctype name`,description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceBetweenAttributes:{reason:`Missing whitespace between attributes`,description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers:{reason:`Missing whitespace between public and system identifiers in doctype`,description:"Unexpected `%c`. Expected ASCII whitespace instead"},nestedComment:{reason:`Unexpected nested comment`,description:"Unexpected `<!--`. Expected `-->`"},nestedNoscriptInHead:{reason:"Unexpected nested `<noscript>` in `<head>`",description:"Unexpected `<noscript>`. Expected a closing tag or a meta element",url:!1},nonConformingDoctype:{reason:`Unexpected non-conforming doctype declaration`,description:'Expected `<!doctype html>` or `<!doctype html system "about:legacy-compat">`',url:!1},nonVoidHtmlElementStartTagWithTrailingSolidus:{reason:`Unexpected trailing slash on start tag of non-void element`,description:"Unexpected `/`. Expected `>` instead"},noncharacterCharacterReference:{reason:`Unexpected noncharacter code point referenced by character reference`,description:`Unexpected code point. Do not use noncharacters in HTML`},noncharacterInInputStream:{reason:`Unexpected noncharacter character`,description:"Unexpected code point `%x`. Do not use noncharacters in HTML"},nullCharacterReference:{reason:`Unexpected NULL character referenced by character reference`,description:`Unexpected code point. Do not use NULL characters in HTML`},openElementsLeftAfterEof:{reason:`Unexpected end of file`,description:`Unexpected end of file. Expected closing tag instead`,url:!1},surrogateCharacterReference:{reason:`Unexpected surrogate character referenced by character reference`,description:`Unexpected code point. Do not use lone surrogate characters in HTML`},surrogateInInputStream:{reason:`Unexpected surrogate character`,description:"Unexpected code point `%x`. Do not use lone surrogate characters in HTML"},unexpectedCharacterAfterDoctypeSystemIdentifier:{reason:`Invalid character after system identifier in doctype`,description:"Unexpected character at `%c`. Expected `>`"},unexpectedCharacterInAttributeName:{reason:`Unexpected character in attribute name`,description:"Unexpected `%c`. Expected whitespace, `/`, `>`, `=`, or probably an ASCII letter"},unexpectedCharacterInUnquotedAttributeValue:{reason:`Unexpected character in unquoted attribute value`,description:"Unexpected `%c`. Quote the attribute value to include it"},unexpectedEqualsSignBeforeAttributeName:{reason:`Unexpected equals sign before attribute name`,description:"Unexpected `%c`. Add an attribute name before it"},unexpectedNullCharacter:{reason:`Unexpected NULL character`,description:"Unexpected code point `%x`. Do not use NULL characters in HTML"},unexpectedQuestionMarkInsteadOfTagName:{reason:`Unexpected question mark instead of tag name`,description:"Unexpected `%c`. Expected an ASCII letter instead"},unexpectedSolidusInTag:{reason:`Unexpected slash in tag`,description:"Unexpected `%c-1`. Expected it followed by `>` or in a quoted attribute value"},unknownNamedCharacterReference:{reason:`Unexpected unknown named character reference`,description:`Unexpected character reference. Expected known named character references`}},base=`https://html.spec.whatwg.org/multipage/parsing.html#parse-error-`,dashToCamelRe=/-[a-z]/g,formatCRe=/%c(?:([-+])(\d+))?/g,formatXRe=/%x/g,fatalities={2:!0,1:!1,0:null},emptyOptions$5={};function fromHtml(e,t){let S=t||emptyOptions$5,w=S.onerror,E=e instanceof VFile?e:new VFile(e),D=S.fragment?parseFragment:parse$2,O=String(E);return fromParse5(D(O,{sourceCodeLocationInfo:!0,onParseError:S.onerror?k:null,scriptingEnabled:!1}),{file:E,space:S.space,verbose:S.verbose});function k(e){let t=e.code,D=camelcase(t),k=S[D]??!0,j=typeof k==`number`?k:k?1:0;if(j){let S=errors$1[D],O=new VFileMessage(F(S.reason),{place:{start:{line:e.startLine,column:e.startCol,offset:e.startOffset},end:{line:e.endLine,column:e.endCol,offset:e.endOffset}},ruleId:t,source:`hast-util-from-html`});E.path&&(O.file=E.path,O.name=E.path+`:`+O.name),O.fatal=fatalities[j],O.note=F(S.description),O.url=S.url===!1?void 0:base+t,w(O)}function F(t){return t.replace(formatCRe,S).replace(formatXRe,w);function S(t,S,w){let E=(w?Number.parseInt(w,10):0)*(S===`-`?-1:1);return visualizeCharacter(O.charAt(e.startOffset+E))}function w(){return visualizeCharacterCode(O.charCodeAt(e.startOffset))}}}}function camelcase(e){return e.replace(dashToCamelRe,dashToCamel)}function dashToCamel(e){return e.charAt(1).toUpperCase()}function visualizeCharacter(e){return e==="`"?"` ` `":e}function visualizeCharacterCode(e){return`0x`+e.toString(16).toUpperCase()}const is$1=(function(e,t,S,w,E){let D=convert(t);if(S!=null&&(typeof S!=`number`||S<0||S===1/0))throw Error(`Expected positive finite index`);if(w!=null&&(!is$1(w)||!w.children))throw Error(`Expected parent node`);if(w==null!=(S==null))throw Error(`Expected both parent and index`);return looksLikeANode(e)?D.call(E,e,S,w):!1}),convert=(function(e){if(e==null)return ok$1;if(typeof e==`function`)return castFactory(e);if(typeof e==`object`)return Array.isArray(e)?anyFactory(e):propertiesFactory(e);if(typeof e==`string`)return typeFactory(e);throw Error(`Expected function, string, or object as test`)});function anyFactory(e){let t=[],S=-1;for(;++S<e.length;)t[S]=convert(e[S]);return castFactory(w);function w(...e){let S=-1;for(;++S<t.length;)if(t[S].apply(this,e))return!0;return!1}}function propertiesFactory(e){let t=e;return castFactory(S);function S(S){let w=S,E;for(E in e)if(w[E]!==t[E])return!1;return!0}}function typeFactory(e){return castFactory(t);function t(t){return t&&t.type===e}}function castFactory(e){return t;function t(t,S,w){return!!(looksLikeANode(t)&&e.call(this,t,typeof S==`number`?S:void 0,w||void 0))}}function ok$1(){return!0}function looksLikeANode(e){return typeof e==`object`&&!!e&&`type`in e}function color$1(e){return`\x1B[33m`+e+`\x1B[39m`}const empty$1=[],CONTINUE$1=!0,EXIT$1=!1,SKIP$1=`skip`;function visitParents(e,t,S,w){let E;typeof t==`function`&&typeof S!=`function`?(w=S,S=t):E=t;let D=convert(E),O=w?-1:1;k(e,void 0,[])();function k(e,E,j){let F=e&&typeof e==`object`?e:{};if(typeof F.type==`string`){let t=typeof F.tagName==`string`?F.tagName:typeof F.name==`string`?F.name:void 0;Object.defineProperty(L,`name`,{value:`node (`+color$1(e.type+(t?`<`+t+`>`:``))+`)`})}return L;function L(){let F=empty$1,L,B,H;if((!t||D(e,E,j[j.length-1]||void 0))&&(F=toResult$1(S(e,j)),F[0]===!1))return F;if(`children`in e&&e.children){let t=e;if(t.children&&F[0]!==`skip`)for(B=(w?t.children.length:-1)+O,H=j.concat(t);B>-1&&B<t.children.length;){let e=t.children[B];if(L=k(e,B,H)(),L[0]===!1)return L;B=typeof L[1]==`number`?L[1]:B+O}}return F}}}function toResult$1(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?empty$1:[e]}function visit$1(e,t,S,w){let E,D,O;typeof t==`function`&&typeof S!=`function`?(D=void 0,O=t,E=S):(D=t,O=S,E=w),visitParents(e,D,k,E);function k(e,t){let S=t[t.length-1],w=S?S.children.indexOf(e):void 0;return O(e,w,S)}}const emptyOptions$4={};function toString(e,t){let S=t||emptyOptions$4;return one(e,typeof S.includeImageAlt==`boolean`?S.includeImageAlt:!0,typeof S.includeHtml==`boolean`?S.includeHtml:!0)}function one(e,t,S){if(node(e)){if(`value`in e)return e.type===`html`&&!S?``:e.value;if(t&&`alt`in e&&e.alt)return e.alt;if(`children`in e)return all$1(e.children,t,S)}return Array.isArray(e)?all$1(e,t,S):``}function all$1(e,t,S){let w=[],E=-1;for(;++E<e.length;)w[E]=one(e[E],t,S);return w.join(``)}function node(e){return!!(e&&typeof e==`object`)}const phrasing=convert([`break`,`delete`,`emphasis`,`footnote`,`footnoteReference`,`image`,`imageReference`,`inlineCode`,`inlineMath`,`link`,`linkReference`,`mdxJsxTextElement`,`mdxTextExpression`,`strong`,`text`,`textDirective`]);function ccount(e,t){let S=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let w=0,E=S.indexOf(t);for(;E!==-1;)w++,E=S.indexOf(t,E+t.length);return w}const asciiAlpha=regexCheck(/[A-Za-z]/),asciiAlphanumeric=regexCheck(/[\dA-Za-z]/),asciiAtext=regexCheck(/[#-'*+\--9=?A-Z^-~]/);function asciiControl(e){return e!==null&&(e<32||e===127)}const asciiDigit=regexCheck(/\d/),asciiHexDigit=regexCheck(/[\dA-Fa-f]/),asciiPunctuation=regexCheck(/[!-/:-@[-`{-~]/);function markdownLineEnding(e){return e!==null&&e<-2}function markdownLineEndingOrSpace(e){return e!==null&&(e<0||e===32)}function markdownSpace(e){return e===-2||e===-1||e===32}const unicodePunctuation=regexCheck(/\p{P}|\p{S}/u),unicodeWhitespace=regexCheck(/\s/);function regexCheck(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function escapeStringRegexp(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}function findAndReplace(e,t,S){let w=convert((S||{}).ignore||[]),E=toPairs(t),D=-1;for(;++D<E.length;)visitParents(e,`text`,O);function O(e,t){let S=-1,E;for(;++S<t.length;){let e=t[S],D=E?E.children:void 0;if(w(e,D?D.indexOf(e):void 0,E))return;E=e}if(E)return k(e,t)}function k(e,t){let S=t[t.length-1],w=E[D][0],O=E[D][1],k=0,j=S.children.indexOf(e),F=!1,L=[];w.lastIndex=0;let B=w.exec(e.value);for(;B;){let S=B.index,E={index:B.index,input:B.input,stack:[...t,e]},D=O(...B,E);if(typeof D==`string`&&(D=D.length>0?{type:`text`,value:D}:void 0),D===!1?w.lastIndex=S+1:(k!==S&&L.push({type:`text`,value:e.value.slice(k,S)}),Array.isArray(D)?L.push(...D):D&&L.push(D),k=S+B[0].length,F=!0),!w.global)break;B=w.exec(e.value)}return F?(k<e.value.length&&L.push({type:`text`,value:e.value.slice(k)}),S.children.splice(j,1,...L)):L=[e],j+L.length}}function toPairs(e){let t=[];if(!Array.isArray(e))throw TypeError(`Expected find and replace tuple or list of tuples`);let S=!e[0]||Array.isArray(e[0])?e:[e],w=-1;for(;++w<S.length;){let e=S[w];t.push([toExpression(e[0]),toFunction(e[1])])}return t}function toExpression(e){return typeof e==`string`?new RegExp(escapeStringRegexp(e),`g`):e}function toFunction(e){return typeof e==`function`?e:function(){return e}}const inConstruct=`phrasing`,notInConstruct=[`autolink`,`link`,`image`,`label`];function gfmAutolinkLiteralFromMarkdown(){return{transforms:[transformGfmAutolinkLiterals],enter:{literalAutolink:enterLiteralAutolink,literalAutolinkEmail:enterLiteralAutolinkValue,literalAutolinkHttp:enterLiteralAutolinkValue,literalAutolinkWww:enterLiteralAutolinkValue},exit:{literalAutolink:exitLiteralAutolink,literalAutolinkEmail:exitLiteralAutolinkEmail,literalAutolinkHttp:exitLiteralAutolinkHttp,literalAutolinkWww:exitLiteralAutolinkWww}}}function gfmAutolinkLiteralToMarkdown(){return{unsafe:[{character:`@`,before:`[+\\-.\\w]`,after:`[\\-.\\w]`,inConstruct,notInConstruct},{character:`.`,before:`[Ww]`,after:`[\\-.\\w]`,inConstruct,notInConstruct},{character:`:`,before:`[ps]`,after:`\\/`,inConstruct,notInConstruct}]}}function enterLiteralAutolink(e){this.enter({type:`link`,title:null,url:``,children:[]},e)}function enterLiteralAutolinkValue(e){this.config.enter.autolinkProtocol.call(this,e)}function exitLiteralAutolinkHttp(e){this.config.exit.autolinkProtocol.call(this,e)}function exitLiteralAutolinkWww(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];t.type,t.url=`http://`+this.sliceSerialize(e)}function exitLiteralAutolinkEmail(e){this.config.exit.autolinkEmail.call(this,e)}function exitLiteralAutolink(e){this.exit(e)}function transformGfmAutolinkLiterals(e){findAndReplace(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,findUrl],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,findEmail]],{ignore:[`link`,`linkReference`]})}function findUrl(e,t,S,w,E){let D=``;if(!previous$2(E)||(/^w/i.test(t)&&(S=t+S,t=``,D=`http://`),!isCorrectDomain(S)))return!1;let O=splitUrl(S+w);if(!O[0])return!1;let k={type:`link`,title:null,url:D+t+O[0],children:[{type:`text`,value:t+O[0]}]};return O[1]?[k,{type:`text`,value:O[1]}]:k}function findEmail(e,t,S,w){return!previous$2(w,!0)||/[-\d_]$/.test(S)?!1:{type:`link`,title:null,url:`mailto:`+t+`@`+S,children:[{type:`text`,value:t+`@`+S}]}}function isCorrectDomain(e){let t=e.split(`.`);return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function splitUrl(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let S=t[0],w=S.indexOf(`)`),E=ccount(e,`(`),D=ccount(e,`)`);for(;w!==-1&&E>D;)e+=S.slice(0,w+1),S=S.slice(w+1),w=S.indexOf(`)`),D++;return[e,S]}function previous$2(e,t){let S=e.input.charCodeAt(e.index-1);return(e.index===0||unicodeWhitespace(S)||unicodePunctuation(S))&&(!t||S!==47)}function normalizeIdentifier(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}footnoteReference.peek=footnoteReferencePeek;function enterFootnoteCallString(){this.buffer()}function enterFootnoteCall(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function enterFootnoteDefinitionLabelString(){this.buffer()}function enterFootnoteDefinition(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function exitFootnoteCallString(e){let t=this.resume(),S=this.stack[this.stack.length-1];S.type,S.identifier=normalizeIdentifier(this.sliceSerialize(e)).toLowerCase(),S.label=t}function exitFootnoteCall(e){this.exit(e)}function exitFootnoteDefinitionLabelString(e){let t=this.resume(),S=this.stack[this.stack.length-1];S.type,S.identifier=normalizeIdentifier(this.sliceSerialize(e)).toLowerCase(),S.label=t}function exitFootnoteDefinition(e){this.exit(e)}function footnoteReferencePeek(){return`[`}function footnoteReference(e,t,S,w){let E=S.createTracker(w),D=E.move(`[^`),O=S.enter(`footnoteReference`),k=S.enter(`reference`);return D+=E.move(S.safe(S.associationId(e),{after:`]`,before:D})),k(),O(),D+=E.move(`]`),D}function gfmFootnoteFromMarkdown(){return{enter:{gfmFootnoteCallString:enterFootnoteCallString,gfmFootnoteCall:enterFootnoteCall,gfmFootnoteDefinitionLabelString:enterFootnoteDefinitionLabelString,gfmFootnoteDefinition:enterFootnoteDefinition},exit:{gfmFootnoteCallString:exitFootnoteCallString,gfmFootnoteCall:exitFootnoteCall,gfmFootnoteDefinitionLabelString:exitFootnoteDefinitionLabelString,gfmFootnoteDefinition:exitFootnoteDefinition}}}function gfmFootnoteToMarkdown(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:S,footnoteReference},unsafe:[{character:`[`,inConstruct:[`label`,`phrasing`,`reference`]}]};function S(e,S,w,E){let D=w.createTracker(E),O=D.move(`[^`),k=w.enter(`footnoteDefinition`),j=w.enter(`label`);return O+=D.move(w.safe(w.associationId(e),{before:O,after:`]`})),j(),O+=D.move(`]:`),e.children&&e.children.length>0&&(D.shift(4),O+=D.move((t?`
|
|
238
238
|
`:` `)+w.indentLines(w.containerFlow(e,D.current()),t?mapAll:mapExceptFirst))),k(),O}}function mapExceptFirst(e,t,S){return t===0?e:mapAll(e,t,S)}function mapAll(e,t,S){return(S?``:` `)+e}const constructsWithoutStrikethrough=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`];handleDelete.peek=peekDelete;function gfmStrikethroughFromMarkdown(){return{canContainEols:[`delete`],enter:{strikethrough:enterStrikethrough},exit:{strikethrough:exitStrikethrough}}}function gfmStrikethroughToMarkdown(){return{unsafe:[{character:`~`,inConstruct:`phrasing`,notInConstruct:constructsWithoutStrikethrough}],handlers:{delete:handleDelete}}}function enterStrikethrough(e){this.enter({type:`delete`,children:[]},e)}function exitStrikethrough(e){this.exit(e)}function handleDelete(e,t,S,w){let E=S.createTracker(w),D=S.enter(`strikethrough`),O=E.move(`~~`);return O+=S.containerPhrasing(e,{...E.current(),before:O,after:`~`}),O+=E.move(`~~`),D(),O}function peekDelete(){return`~`}function defaultStringLength(e){return e.length}function markdownTable(e,t){let S=t||{},w=(S.align||[]).concat(),E=S.stringLength||defaultStringLength,D=[],O=[],k=[],j=[],F=0,L=-1;for(;++L<e.length;){let t=[],w=[],D=-1;for(e[L].length>F&&(F=e[L].length);++D<e[L].length;){let O=serialize(e[L][D]);if(S.alignDelimiters!==!1){let e=E(O);w[D]=e,(j[D]===void 0||e>j[D])&&(j[D]=e)}t.push(O)}O[L]=t,k[L]=w}let B=-1;if(typeof w==`object`&&`length`in w)for(;++B<F;)D[B]=toAlignment(w[B]);else{let e=toAlignment(w);for(;++B<F;)D[B]=e}B=-1;let H=[],q=[];for(;++B<F;){let e=D[B],t=``,w=``;e===99?(t=`:`,w=`:`):e===108?t=`:`:e===114&&(w=`:`);let E=S.alignDelimiters===!1?1:Math.max(1,j[B]-t.length-w.length),O=t+`-`.repeat(E)+w;S.alignDelimiters!==!1&&(E=t.length+E+w.length,E>j[B]&&(j[B]=E),q[B]=E),H[B]=O}O.splice(1,0,H),k.splice(1,0,q),L=-1;let J=[];for(;++L<O.length;){let e=O[L],t=k[L];B=-1;let w=[];for(;++B<F;){let E=e[B]||``,O=``,k=``;if(S.alignDelimiters!==!1){let e=j[B]-(t[B]||0),S=D[B];S===114?O=` `.repeat(e):S===99?e%2?(O=` `.repeat(e/2+.5),k=` `.repeat(e/2-.5)):(O=` `.repeat(e/2),k=O):k=` `.repeat(e)}S.delimiterStart!==!1&&!B&&w.push(`|`),S.padding!==!1&&!(S.alignDelimiters===!1&&E===``)&&(S.delimiterStart!==!1||B)&&w.push(` `),S.alignDelimiters!==!1&&w.push(O),w.push(E),S.alignDelimiters!==!1&&w.push(k),S.padding!==!1&&w.push(` `),(S.delimiterEnd!==!1||B!==F-1)&&w.push(`|`)}J.push(S.delimiterEnd===!1?w.join(``).replace(/ +$/,``):w.join(``))}return J.join(`
|
|
239
239
|
`)}function serialize(e){return e==null?``:String(e)}function toAlignment(e){let t=typeof e==`string`?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}const own$6={}.hasOwnProperty;function zwitch(e,t){let S=t||{};function w(t,...S){let E=w.invalid,D=w.handlers;if(t&&own$6.call(t,e)){let S=String(t[e]);E=own$6.call(D,S)?D[S]:w.unknown}if(E)return E.call(this,t,...S)}return w.handlers=S.handlers||{},w.invalid=S.invalid,w.unknown=S.unknown,w}const own$5={}.hasOwnProperty;function configure$1(e,t){let S=-1,w;if(t.extensions)for(;++S<t.extensions.length;)configure$1(e,t.extensions[S]);for(w in t)if(own$5.call(t,w))switch(w){case`extensions`:break;case`unsafe`:list$2(e[w],t[w]);break;case`join`:list$2(e[w],t[w]);break;case`handlers`:map$2(e[w],t[w]);break;default:e.options[w]=t[w]}return e}function list$2(e,t){t&&e.push(...t)}function map$2(e,t){t&&Object.assign(e,t)}function blockquote(e,t,S,w){let E=S.enter(`blockquote`),D=S.createTracker(w);D.move(`> `),D.shift(2);let O=S.indentLines(S.containerFlow(e,D.current()),map$1);return E(),O}function map$1(e,t,S){return`>`+(S?``:` `)+e}function patternInScope(e,t){return listInScope(e,t.inConstruct,!0)&&!listInScope(e,t.notInConstruct,!1)}function listInScope(e,t,S){if(typeof t==`string`&&(t=[t]),!t||t.length===0)return S;let w=-1;for(;++w<t.length;)if(e.includes(t[w]))return!0;return!1}function hardBreak(e,t,S,w){let E=-1;for(;++E<S.unsafe.length;)if(S.unsafe[E].character===`
|
|
@@ -387,7 +387,7 @@ $2`).split(`
|
|
|
387
387
|
});
|
|
388
388
|
<\/script>
|
|
389
389
|
</div>`}];function previewEmbedFence(e){return["```html preview",e.html,"```"].join(`
|
|
390
|
-
`)}const PREVIEW_THEME_TOKENS=[{name:`--chart-1`,light:`oklch(0.62 0.19 259)`,dark:`oklch(0.72 0.14 259)`},{name:`--chart-2`,light:`oklch(0.58 0.14 145)`,dark:`oklch(0.73 0.13 145)`},{name:`--chart-3`,light:`oklch(0.62 0.15 70)`,dark:`oklch(0.77 0.14 70)`},{name:`--chart-4`,light:`oklch(0.55 0.18 290)`,dark:`oklch(0.72 0.16 290)`},{name:`--chart-5`,light:`oklch(0.58 0.21 25)`,dark:`oklch(0.72 0.2 25)`},{name:`--primary`,light:`oklch(0.6321 0.1983 259.59)`,dark:`#69a3ff`},{name:`--primary-foreground`,light:`oklch(0.985 0 0)`,dark:`oklch(0.205 0 0)`},{name:`--foreground`,light:`oklch(0.145 0 0)`,dark:`oklch(0.985 0 0)`},{name:`--background`,light:`oklch(1 0 0)`,dark:`oklch(0.145 0 0)`},{name:`--card`,light:`oklch(1 0 0)`,dark:`oklch(0.205 0 0)`},{name:`--card-foreground`,light:`oklch(0.145 0 0)`,dark:`oklch(0.985 0 0)`},{name:`--muted-foreground`,light:`oklch(0.556 0 0)`,dark:`oklch(0.708 0 0)`},{name:`--border`,light:`oklch(0.922 0 0)`,dark:`oklch(1 0 0 / 10%)`},{name:`--destructive`,light:`oklch(0.577 0.245 27.325)`,dark:`oklch(0.704 0.191 22.216)`},{name:`--radius`,light:`0.625rem`,dark:`0.625rem`}],DEFAULT_SERVER_HOST=`localhost`,ALLOWED_IMAGE_MIME_TYPES=[`image/jpeg`,`image/png`,`image/gif`,`image/webp`,`image/svg+xml`],ALLOWED_VIDEO_MIME_TYPES=[`video/mp4`,`video/webm`,`video/ogg`],ALLOWED_AUDIO_MIME_TYPES=[`audio/mpeg`,`audio/wav`,`audio/ogg`],ALLOWED_PDF_MIME_TYPES=[`application/pdf`],IMAGE_EXTENSIONS=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`,`svg`]),VIDEO_EXTENSIONS=new Set([`mp4`,`webm`,`mov`,`m4v`,`mkv`]),PDF_EXTENSIONS=new Set([`pdf`]),AUDIO_EXTENSIONS=new Set([`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`]),FILE_ATTACHMENT_EXTENSIONS=new Set(`pdf.docx.xlsx.pptx.doc.xls.ppt.zip.7z.tar.gz.rar.csv.tsv.rtf.json.yaml.yml.xml.txt.pages.numbers.key.odt.ods.odp.epub.mobi`.split(`.`)),EXECUTABLE_BLOCKLIST_EXTENSIONS=new Set(`exe.bat.cmd.ps1.com.msi.vbs.js.jse.wsf.wsh.hta.sh.command.csh.ksh.bash.zsh.fish.desktop.action.workflow.html.htm.svg.xml.mhtml.svgz.dmg.pkg.mpkg.scpt.applescript.terminal.prefpane.webloc.inetloc.fileloc.jar.appimage.deb.rpm.msix.appx.ipa.apk.pif.scr.lnk.url`.split(`.`)),ASSET_EXTENSIONS=new Set(`png.jpg.jpeg.gif.webp.avif.svg.apng.heic.heif.tiff.bmp.ico.pdf.mp4.webm.mov.m4v.mkv.avi.flv.wmv.mpeg.mpg.mp3.wav.ogg.m4a.flac.aac.opus.zip.woff.woff2.ttf.otf.eot.docx.xlsx.pptx.csv.txt.rtf.json.toml`.split(`.`)),INLINE_RENDERABLE_EXTENSIONS=new Set(`png.jpg.jpeg.gif.webp.avif.apng.heic.heif.tiff.bmp.ico.svg.pdf.mp4.webm.mov.m4v.mkv.mp3.wav.ogg.m4a.flac.aac.opus.json.toml`.split(`.`)),DEFAULT_DEDUP_MODE=`same-dir`,WIKI_EMBED_EXTENSIONS=new Set(`png.jpg.jpeg.gif.webp.avif.svg.pdf.mp4.webm.mov.m4v.mkv.mp3.wav.ogg.m4a.flac.aac.opus.docx.xlsx.pptx.doc.xls.ppt.zip.7z.tar.gz.rar.csv.tsv.rtf.json.yaml.yml.xml.txt.pages.numbers.key.odt.ods.odp.epub.mobi`.split(`.`)),SIDEBAR_IMAGE_EXTENSIONS=[`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`],SIDEBAR_VIDEO_EXTENSIONS=[`mp4`,`webm`,`mov`,`m4v`],SIDEBAR_AUDIO_EXTENSIONS=[`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`],SIDEBAR_PDF_EXTENSIONS=[`pdf`],SIDEBAR_TEXT_EXTENSIONS=[`json`,`toml`];function assertSubset(e,t,S){for(let w of t)if(!S.has(w))throw Error(`${e}: ${w} is not present in canonical upload constants`)}assertSubset(`SIDEBAR_IMAGE_ASSET_EXTENSIONS`,SIDEBAR_IMAGE_EXTENSIONS,IMAGE_EXTENSIONS),assertSubset(`SIDEBAR_VIDEO_ASSET_EXTENSIONS`,SIDEBAR_VIDEO_EXTENSIONS,VIDEO_EXTENSIONS),assertSubset(`SIDEBAR_AUDIO_ASSET_EXTENSIONS`,SIDEBAR_AUDIO_EXTENSIONS,AUDIO_EXTENSIONS),assertSubset(`SIDEBAR_PDF_ASSET_EXTENSIONS`,SIDEBAR_PDF_EXTENSIONS,PDF_EXTENSIONS),assertSubset(`FILE_ATTACHMENT_EXTENSIONS`,[...FILE_ATTACHMENT_EXTENSIONS],WIKI_EMBED_EXTENSIONS);const SIDEBAR_IMAGE_ASSET_EXTENSIONS=new Set(SIDEBAR_IMAGE_EXTENSIONS),SIDEBAR_VIDEO_ASSET_EXTENSIONS=new Set(SIDEBAR_VIDEO_EXTENSIONS),SIDEBAR_AUDIO_ASSET_EXTENSIONS=new Set(SIDEBAR_AUDIO_EXTENSIONS),SIDEBAR_PDF_ASSET_EXTENSIONS=new Set(SIDEBAR_PDF_EXTENSIONS),SIDEBAR_TEXT_ASSET_EXTENSIONS=new Set(SIDEBAR_TEXT_EXTENSIONS),SIDEBAR_RENDERABLE_ASSET_EXTENSIONS=new Set([...SIDEBAR_IMAGE_EXTENSIONS,...SIDEBAR_VIDEO_EXTENSIONS,...SIDEBAR_AUDIO_EXTENSIONS,...SIDEBAR_PDF_EXTENSIONS,...SIDEBAR_TEXT_EXTENSIONS]);assertSubset(`SIDEBAR_RENDERABLE_ASSET_EXTENSIONS`,[...SIDEBAR_RENDERABLE_ASSET_EXTENSIONS],INLINE_RENDERABLE_EXTENSIONS);function mediaKindForSidebarAssetExtension(e){let t=e.toLowerCase().replace(/^\./,``);return SIDEBAR_IMAGE_ASSET_EXTENSIONS.has(t)?`image`:SIDEBAR_VIDEO_ASSET_EXTENSIONS.has(t)?`video`:SIDEBAR_AUDIO_ASSET_EXTENSIONS.has(t)?`audio`:SIDEBAR_PDF_ASSET_EXTENSIONS.has(t)?`pdf`:SIDEBAR_TEXT_ASSET_EXTENSIONS.has(t)?`text`:null}const CodeBlockFidelity=index_default$11.extend({priority:60,addAttributes(){return{...this.parent?.(),fenceDelimiter:{default:"`"},fenceLength:{default:3},meta:{default:null},sourceStyle:{default:`fenced`}}}}),EmphasisFidelity=index_default$9.extend({name:`emphasis`,priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`*`}}},addInputRules(){return[markInputRule({find:starInputRegex,type:this.type,getAttributes:{sourceDelimiter:`*`}}),markInputRule({find:underscoreInputRegex,type:this.type,getAttributes:{sourceDelimiter:`_`}})]}}),StrongFidelity=index_default$10.extend({name:`strong`,priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`**`}}},addInputRules(){return[markInputRule({find:starInputRegex$1,type:this.type,getAttributes:{sourceDelimiter:`**`}}),markInputRule({find:underscoreInputRegex$1,type:this.type,getAttributes:{sourceDelimiter:`__`}})]}}),EscapeMark=Mark.create({name:`escapeMark`,priority:10,excludes:``,inclusive:!1,parseHTML(){return[{tag:`span[data-escape-mark]`}]},renderHTML(){return[`span`,{"data-escape-mark":``},0]}}),HardBreakFidelity=index_default$8.extend({priority:60,addAttributes(){return{...this.parent?.(),hardBreakStyle:{default:`backslash`}}}}),HeadingFidelity=index_default$7.extend({priority:60,addAttributes(){return{...this.parent?.(),headingStyle:{default:`atx`},sourceTrailingHashes:{default:null},sourceUnderlineLength:{default:null},sourceContiguousNext:{default:!1}}}}),HtmlBlockFidelity=Node3.create({name:`htmlBlock`,group:`block`,atom:!0,priority:60,addAttributes(){return{content:{default:``}}},parseHTML(){return[{tag:`div[data-html-block]`}]},renderHTML({node:e}){return[`div`,{"data-html-block":``,class:`html-block`},e.attrs.content]}}),JsxComponent=Node3.create({name:`jsxComponent`,group:`block`,atom:!1,content:`block*`,isolating:!0,selectable:!0,defining:!0,priority:60,addAttributes(){return{componentName:{default:``},kind:{default:`element`},attributes:{default:[]},sourceRaw:{default:``},sourceDirty:{default:!1},props:{default:{}}}},parseHTML(){return[{tag:`div[data-jsx-component]`,getAttrs:e=>typeof e==`string`?!1:{componentName:e.getAttribute(`data-component-name`)||``,sourceRaw:e.getAttribute(`data-source-raw`)||``}}]},renderHTML({HTMLAttributes:e}){return[`div`,{"data-jsx-component":``,"data-component-name":e.componentName,"data-source-raw":e.sourceRaw},0]},addCommands(){return{insertJsxComponent:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{sourceRaw:e}})}}}),JsxInline=Node3.create({name:`jsxInline`,group:`inline`,inline:!0,atom:!1,content:`text*`,isolating:!1,selectable:!0,priority:60,addAttributes(){return{}},parseHTML(){return[{tag:`span[data-jsx-inline]`}]},renderHTML(){return[`span`,{"data-jsx-inline":``},0]}}),SAFE_URL_SCHEMES=[`https`,`http`,`mailto`,`tel`,`ftp`,`sms`],SCHEME_ALT=SAFE_URL_SCHEMES.map(e=>`${e}:`).join(`|`),SAFE_URL_SCHEME_RE=RegExp(`^(?:${SCHEME_ALT}|\\/|#|\\?|\\.\\/|\\.\\.\\/)`,`i`);function isRelativeUrl(e){let t=e.trim();if(t===``)return!0;let S=t.indexOf(`:`);if(S===-1)return!0;let w=t.indexOf(`/`),E=t.indexOf(`?`),D=t.indexOf(`#`);return S>Math.min(w===-1?1/0:w,E===-1?1/0:E,D===-1?1/0:D)}const ALLOWED_LINK_SCHEMES=new Set(SAFE_URL_SCHEMES.map(e=>`${e}:`)),PLACEHOLDER_BASE=`https://placeholder.invalid`;function isAllowedLinkUri(e){try{let t=new URL(e,PLACEHOLDER_BASE);return ALLOWED_LINK_SCHEMES.has(t.protocol.toLowerCase())}catch{return!1}}const LinkFidelity=index_default$6.extend({priority:60,addOptions(){return{openOnClick:!1,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:`http`,HTMLAttributes:{target:`_blank`,rel:`noopener noreferrer`},isAllowedUri:isAllowedLinkUri,validate:isAllowedLinkUri,shouldAutoLink:()=>!0}},addAttributes(){return{...this.parent?.(),linkStyle:{default:`inline`,rendered:!1},refLabel:{default:null,rendered:!1},sourceForm:{default:null,rendered:!1},target:{default:null,rendered:!1},anchor:{default:null,rendered:!1},alias:{default:null,rendered:!1},sourceUrlForm:{default:null,rendered:!1},sourceTitleMarker:{default:null,rendered:!1}}}}),LinkRefDefFidelity=Node3.create({name:`linkRefDef`,group:`block`,atom:!0,priority:60,addAttributes(){return{label:{default:``},href:{default:``},title:{default:null},sourceLayout:{default:null},sourceTitleMarker:{default:null}}},parseHTML(){return[{tag:`div[data-link-ref-def]`}]},renderHTML({node:e}){let{label:t,href:S,title:w}=e.attrs,E=w?`[${t}]: ${S} "${w}"`:`[${t}]: ${S}`;return[`div`,{"data-link-ref-def":``,class:`link-ref-def`},E]}});function isBulletList(e){return e.type.name===`list`&&!e.attrs.ordered}function isOrderedList(e){return e.type.name===`list`&&!!e.attrs.ordered}function hasTaskItems(e){let t=!1;return e.forEach(e=>{e.type.name===`listItem`&&e.attrs.checked!==null&&(t=!0)}),t}function toggleListKind(e,t,S,w,E,D,O){let k=findParentNode(e=>e.type.name===`list`)(e.selection);if(k&&E(k.node)){let{$from:S,$to:E}=e.selection;return S.blockRange(E)?liftListItem$1(w)(e,t):!1}if(k){if(!t)return!0;let{tr:S}=e;return S.setNodeMarkup(k.pos,void 0,{...k.node.attrs,...D}),O!==void 0&&k.node.forEach((e,t)=>{if(e.type.name===`listItem`){let w=k.pos+1+t;S.setNodeMarkup(w,void 0,{...e.attrs,...O})}}),t(S),!0}return wrapInList$1(S,D)(e,void 0)?t?wrapInList$1(S,D)(e,S=>{if(O){let t=S.mapping.map(e.selection.$from.pos),w=S.doc.resolve(t);for(let e=w.depth;e>0;e--){let t=w.node(e);if(t.type.name===`listItem`){S.setNodeMarkup(w.before(e),void 0,{...t.attrs,...O});break}}}t(S)}):!0:!1}const ListNode=Node3.create({name:`list`,group:`block list`,content:`listItem+`,priority:60,addAttributes(){return{ordered:{default:!1},start:{default:1},spread:{default:!1},bulletMarker:{default:null},listMarkerDelimiter:{default:null}}},parseHTML(){return[{tag:`ul`,getAttrs:()=>({ordered:!1})},{tag:`ol`,getAttrs:e=>({ordered:!0,start:e.getAttribute(`start`)?Number(e.getAttribute(`start`)):1})}]},renderHTML({node:e,HTMLAttributes:t}){let S=e.attrs.ordered?`ol`:`ul`,w={};return e.attrs.ordered&&e.attrs.start!==1&&(w.start=e.attrs.start),[S,mergeAttributes(t,w),0]},addCommands(){return{toggleBulletList:()=>({state:e,dispatch:t})=>{let S=e.schema.nodes.list,w=e.schema.nodes.listItem;return!S||!w?!1:toggleListKind(e,t,S,w,e=>isBulletList(e)&&!hasTaskItems(e),{ordered:!1},{checked:null})},toggleOrderedList:()=>({state:e,dispatch:t})=>{let S=e.schema.nodes.list,w=e.schema.nodes.listItem;return!S||!w?!1:toggleListKind(e,t,S,w,e=>isOrderedList(e),{ordered:!0},{checked:null})},toggleTaskList:()=>({state:e,dispatch:t})=>{let S=e.schema.nodes.list,w=e.schema.nodes.listItem;return!S||!w?!1:toggleListKind(e,t,S,w,e=>isBulletList(e)&&hasTaskItems(e),{ordered:!1},{checked:!1})}}},addInputRules(){return[wrappingInputRule({find:/^\s*([-+*])(?!\s*\[[ xX]\])\s$/,type:this.type,getAttributes:e=>({ordered:!1,bulletMarker:e[1]})}),wrappingInputRule({find:/^\s*(\d+)([.)])\s$/,type:this.type,getAttributes:e=>({ordered:!0,start:Number(e[1]),listMarkerDelimiter:e[2]})}),new InputRule({find:/^\s*[-*+]\s\[([ xX])\]\s$/,handler:({state:e,range:t,match:S})=>{let w=e.schema.nodes.list;if(!w)return null;let E=S[1]!==` `,D=e.tr.delete(t.from,t.to),O=D.doc.resolve(t.from).blockRange();if(!O)return null;let k=findWrapping(O,w,{ordered:!1});if(!k)return null;D.wrap(O,k);let j=D.doc.resolve(D.mapping.map(t.from));for(let e=j.depth;e>0;e--){let t=j.node(e);if(t.type.name===`listItem`){D.setNodeMarkup(j.before(e),void 0,{...t.attrs,checked:E});break}}}})]},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList(),"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList(),"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),ListItemNode=Node3.create({name:`listItem`,content:`paragraph block*`,defining:!0,addAttributes(){return{checked:{default:null},spread:{default:!1}}},parseHTML(){return[{tag:`li`,getAttrs:e=>{let t=e.querySelector(`input[type="checkbox"]`);return{checked:t?t.checked:null}}}]},renderHTML({node:e,HTMLAttributes:t}){return e.attrs.checked===null?[`li`,mergeAttributes(t),0]:[`li`,mergeAttributes(t,{"data-type":`taskItem`,"data-checked":e.attrs.checked?`true`:`false`}),[`label`,{contenteditable:`false`},[`input`,{type:`checkbox`,...e.attrs.checked?{checked:`checked`}:{}}]],[`div`,0]]},addNodeView(){return({node:e,getPos:t,editor:S,HTMLAttributes:w})=>{let E=document.createElement(`li`);Object.entries(mergeAttributes(w,e.attrs.checked===null?{}:{"data-type":`taskItem`,"data-checked":String(!!e.attrs.checked)})).forEach(([e,t])=>{t!=null&&E.setAttribute(e,String(t))});let D=null,O=null,k=document.createElement(`div`);return e.attrs.checked!==null&&(D=document.createElement(`label`),D.contentEditable=`false`,O=document.createElement(`input`),O.type=`checkbox`,O.checked=!!e.attrs.checked,S.isEditable||(O.disabled=!0),O.addEventListener(`change`,()=>{let w=t();w===void 0||typeof w!=`number`||S.view.dispatch(S.view.state.tr.setNodeMarkup(w,void 0,{...e.attrs,checked:O?.checked??!1}))}),D.appendChild(O),E.appendChild(D)),E.appendChild(k),{dom:E,contentDOM:k,update(t){return t.type!==e.type||t.attrs.checked!==null!=(e.attrs.checked!==null)?!1:(O&&t.attrs.checked!==null&&(O.checked=!!t.attrs.checked,E.setAttribute(`data-checked`,String(!!t.attrs.checked))),e=t,!0)}}}},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>{let{$from:e}=this.editor.state.selection;for(let t=e.depth;t>0;t--)if(e.node(t).type.name===`listItem`)return this.editor.commands.sinkListItem(this.name);return!1},"Shift-Tab":()=>{let{$from:e}=this.editor.state.selection;for(let t=e.depth;t>0;t--)if(e.node(t).type.name===`listItem`)return this.editor.commands.liftListItem(this.name);return!1}}}}),List=ListNode,ListItem=ListItemNode,MathInline=Node3.create({name:`mathInline`,group:`inline`,inline:!0,atom:!0,selectable:!0,priority:60,addAttributes(){return{formula:{default:``},id:{default:null},language:{default:`latex`}}},parseHTML(){return[{tag:`span[data-math-inline]`,getAttrs:e=>typeof e==`string`?!1:{formula:e.getAttribute(`data-formula`)||``,id:e.getAttribute(`id`)||null,language:e.getAttribute(`data-language`)||`latex`}}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-math-inline":``,"data-formula":e.formula,"data-language":e.language,...e.id?{id:e.id}:{}}]},addCommands(){return{insertMathInline:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{formula:e}})}}}),RawMdxFallback=Node3.create({name:`rawMdxFallback`,group:`block`,atom:!1,content:`text*`,isolating:!0,selectable:!0,defining:!0,priority:60,addAttributes(){return{reason:{default:``},originalSpan:{default:{start:0,end:0}}}},parseHTML(){let e=e=>typeof e==`string`?!1:{reason:e.getAttribute(`data-reason`)||``};return[{tag:`div[data-raw-mdx-fallback]`,getAttrs:e},{tag:`pre[data-raw-mdx-fallback]`,getAttrs:e}]},renderHTML({HTMLAttributes:e}){return[`div`,{"data-raw-mdx-fallback":``,"data-raw-badge":`raw`,"data-reason":e.reason,contenteditable:`false`,class:`raw-mdx-fallback`},0]},addNodeView(){return({HTMLAttributes:e})=>{let t=document.createElement(`div`);t.setAttribute(`data-raw-mdx-fallback`,``),t.setAttribute(`data-raw-badge`,`raw`),t.setAttribute(`contenteditable`,`false`),t.classList.add(`raw-mdx-fallback`),e.reason&&t.setAttribute(`data-reason`,e.reason);let S=document.createElement(`pre`);return S.classList.add(`raw-mdx-fallback-content`),S.setAttribute(`contenteditable`,`false`),t.appendChild(S),{dom:t,contentDOM:S,ignoreMutation:()=>!0}}}}),BlockquoteFidelity=index_default$4.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceMarkerSpacings:{default:null}}}}),CodeMarkFidelity=index_default$3.extend({excludes:``,addAttributes(){return{...this.parent?.(),sourceFenceChar:{default:"`"},sourceFenceLength:{default:1}}}}),CommentBlock=Node3.create({name:`commentBlock`,group:`block`,content:`block+`,defining:!0,priority:60,addAttributes(){return{sourceForm:{default:`percent`,parseHTML:e=>e.getAttribute(`data-source-form`)===`html`?`html`:`percent`,renderHTML:e=>e.sourceForm===`html`?{"data-source-form":`html`}:{}},sourceLayout:{default:`block`,parseHTML:e=>e.getAttribute(`data-source-layout`)===`inline`?`inline`:`block`,renderHTML:e=>e.sourceLayout===`inline`?{"data-source-layout":`inline`}:{}}}},parseHTML(){return[{tag:`aside[data-comment-block]`},{tag:`aside.comment-block`}]},renderHTML({HTMLAttributes:e}){return[`aside`,{"data-comment-block":``,"data-clipboard-omit":`true`,class:`comment-block`,style:`display: none;`,...e},0]},addCommands(){return{setCommentBlock:()=>({commands:e})=>e.wrapIn(this.name),toggleCommentBlock:()=>({commands:e})=>e.toggleWrap(this.name),unsetCommentBlock:()=>({commands:e})=>e.lift(this.name)}}}),CommentMark=Mark.create({name:`comment`,priority:10,excludes:``,inclusive:!1,addAttributes(){return{sourceForm:{default:`percent`,parseHTML:e=>e.getAttribute(`data-source-form`)===`html`?`html`:`percent`,renderHTML:e=>e.sourceForm===`html`?{"data-source-form":`html`}:{}}}},parseHTML(){return[{tag:`span[data-comment-mark]`}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-comment-mark":``,"data-clipboard-omit":`true`,class:`comment-mark`,style:`display: none;`,...e},0]},addCommands(){return{setComment:()=>({commands:e})=>e.setMark(this.name),toggleComment:()=>({commands:e})=>e.toggleMark(this.name),unsetComment:()=>({commands:e})=>e.unsetMark(this.name)}}}),FootnoteDefinition=Node3.create({name:`footnoteDefinition`,group:`block`,content:`block+`,defining:!0,priority:60,addAttributes(){return{identifier:{default:``},label:{default:null}}},parseHTML(){let e=e=>{if(typeof e==`string`)return!1;let t=e.getAttribute(`data-footnote-id`)||``;return{identifier:t,label:t||null}};return[{tag:`aside[data-footnote-def]`,getAttrs:e},{tag:`aside.footnote-def`,getAttrs:e}]},renderHTML({node:e,HTMLAttributes:t}){let S=String(e.attrs.identifier??``);return[`aside`,{...t,"data-footnote-def":``,"data-footnote-id":S,id:`fn-${S}`,class:`footnote-def`},[`div`,{class:`footnote-body`},0],[`a`,{href:`#fnref-${S}`,class:`footnote-backref`,contentEditable:`false`,"aria-label":`Back to reference`},`↩`]]},addCommands(){return{insertFootnoteDefinition:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{identifier:e,label:e},content:[{type:`paragraph`}]})}}}),FootnoteReference=Node3.create({name:`footnoteReference`,group:`inline`,inline:!0,atom:!0,selectable:!0,draggable:!1,priority:60,addAttributes(){return{identifier:{default:``},label:{default:null}}},parseHTML(){return[{tag:`sup[data-footnote-ref]`,getAttrs:e=>{if(typeof e==`string`)return!1;let t=e.getAttribute(`data-footnote-id`)||``;return{identifier:t,label:t||null}}}]},renderHTML({node:e}){let t=String(e.attrs.identifier??``);return[`sup`,{id:`fnref-${t}`,"data-footnote-ref":``,"data-footnote-id":t,class:`footnote-ref`},[`a`,{href:`#fn-${t}`,class:`footnote-ref-link`},`[${t}]`]]},addCommands(){return{insertFootnoteReference:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{identifier:e,label:e}})}}}),ImageReferenceFidelity=Node3.create({name:`imageReference`,group:`inline`,inline:!0,atom:!0,priority:60,addAttributes(){return{alt:{default:``},label:{default:``},identifier:{default:``},referenceType:{default:`shortcut`}}},parseHTML(){return[{tag:`img[data-image-reference]`}]},renderHTML({node:e}){let{alt:t,label:S,referenceType:w}=e.attrs,E=t||S;return[`img`,{"data-image-reference":``,"data-reference-type":w,"data-label":S,alt:E}]}});function toDesktopAssetHref(e){if(typeof e!=`string`||!e.startsWith(`/`))return e;let t=globalThis.window?.okDesktop?.config?.apiOrigin;return typeof t==`string`&&t?t+e:e}const ImageSrcFidelity=index_default.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceUrl:{default:null,rendered:!1}}},renderHTML({HTMLAttributes:e}){let t=mergeAttributes(this.options.HTMLAttributes,e);return typeof t.src==`string`&&(t.src=toDesktopAssetHref(t.src)),[`img`,t]}}),SourceLiteralMark=Mark.create({name:`sourceLiteral`,priority:10,excludes:``,inclusive:!1,addAttributes(){return{sourceRaw:{default:``}}},parseHTML(){return[{tag:`span[data-source-literal]`}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-source-literal":``,...e},0]}});function isValidSourceLiteralRaw(e,t){if(typeof e!=`string`||typeof t!=`string`||/[\x00-\x1F\x7F]/.test(e))return!1;let S=e.replaceAll(`\xA0`,` `),w=t.replaceAll(`\xA0`,` `);return S===w?!0:stripMarkdownBackslashEscapes(S)===w}function stripMarkdownBackslashEscapes(e){return e.replace(/\\([!-/:-@[-`{-~])/g,`$1`)}const TableFidelity=Table.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceDashCounts:{default:null}}}}),TableCellFidelity=TableCell.extend({priority:60,addAttributes(){return{...this.parent?.(),sourcePadding:{default:null}}}}),TableHeaderFidelity=TableHeader.extend({priority:60,addAttributes(){return{...this.parent?.(),sourcePadding:{default:null}}}}),Tag=Node3.create({name:`tag`,group:`inline`,inline:!0,atom:!0,selectable:!0,priority:60,addAttributes(){return{value:{default:``}}},parseHTML(){return[{tag:`a[data-tag]`,getAttrs:e=>typeof e==`string`?!1:{value:e.getAttribute(`data-tag`)||``}}]},renderHTML({node:e,HTMLAttributes:t}){let S=String(e.attrs.value??``);return[`a`,{...t,"data-tag":S,href:`#tag/${S}`,class:`tag`},`#${S}`]},addCommands(){return{insertTag:e=>({chain:t})=>t().insertContent({type:`tag`,attrs:{value:e}}).run()}}}),THEMATIC_BREAK_INPUT_RE=/^(?:---|—-|___\s|\*\*\*\s)$/;function thematicBreakSourceRawFromMatch(e){let t=String(e[0]??``).replace(/\s+$/,``);return t===`—-`?`---`:t}const ThematicBreakFidelity=index_default$2.extend({name:`thematicBreak`,priority:60,addAttributes(){return{...this.parent?.(),sourceRaw:{default:`---`}}},addInputRules(){return[nodeInputRule({find:THEMATIC_BREAK_INPUT_RE,type:this.type,getAttributes:e=>({sourceRaw:thematicBreakSourceRawFromMatch(e)})})]}});function normalizeNullableString(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function getWikiLinkText(e){return e.alias?e.alias:e.anchor?`${e.target}#${e.anchor}`:e.target}const WikiLink=Node3.create({name:`wikiLink`,group:`inline`,inline:!0,atom:!0,priority:60,addAttributes(){return{target:{default:``},alias:{default:null},anchor:{default:null},resolved:{default:!1}}},parseHTML(){return[{tag:`span[data-wiki-link]`,getAttrs:e=>typeof e==`string`?!1:{target:e.getAttribute(`data-target`)||``,alias:normalizeNullableString(e.getAttribute(`data-alias`)),anchor:normalizeNullableString(e.getAttribute(`data-anchor`)),resolved:e.getAttribute(`data-resolved`)===`true`}},{tag:`a.wiki-link[data-target]`,priority:100,getAttrs:e=>{if(typeof e==`string`)return!1;let t=e.getAttribute(`data-target`)??``;return t?{target:t,alias:normalizeNullableString(e.getAttribute(`data-alias`)),anchor:normalizeNullableString(e.getAttribute(`data-anchor`)),resolved:!1}:!1}}]},renderHTML({node:e,HTMLAttributes:t}){let S=String(e.attrs.target??``),w=normalizeNullableString(e.attrs.alias),E=normalizeNullableString(e.attrs.anchor),D=e.attrs.resolved===!0;return[`span`,{...t,"data-wiki-link":``,"data-target":S,"data-alias":w??``,"data-anchor":E??``,"data-resolved":D?`true`:`false`},getWikiLinkText({target:S,alias:w,anchor:E})]}});function extensionOf(e){let t=e.split(`/`).pop()??e,S=t.lastIndexOf(`.`);return S<=0||S===t.length-1?``:t.slice(S+1).toLowerCase()}function labelFor(e){return e.alias?e.alias:e.anchor?`${e.target}#${e.anchor}`:e.target}const WikiLinkEmbed=Node3.create({name:`wikiLinkEmbed`,group:`inline`,inline:!0,atom:!0,priority:60,addAttributes(){return{target:{default:``},alias:{default:null},anchor:{default:null},resolvedSrc:{default:null,rendered:!1,parseHTML:()=>null}}},parseHTML(){let e=e=>typeof e==`string`||!e.hasAttribute(`data-wiki-embed`)?!1:{target:e.getAttribute(`data-target`)||``,alias:normalizeNullableString(e.getAttribute(`data-alias`)),anchor:normalizeNullableString(e.getAttribute(`data-anchor`))};return[{tag:`img[data-wiki-embed]`,getAttrs:e,priority:100},{tag:`a[data-wiki-embed]`,getAttrs:e,priority:100}]},renderHTML({node:e,HTMLAttributes:t}){let S=String(e.attrs.target??``),w=normalizeNullableString(e.attrs.alias),E=normalizeNullableString(e.attrs.anchor),D=normalizeNullableString(e.attrs.resolvedSrc),O=extensionOf(S);if(IMAGE_EXTENSIONS.has(O))return[`img`,{...t,"data-wiki-embed":``,"data-target":S,"data-alias":w??``,"data-anchor":E??``,src:D??S,alt:w??S}];let k=D??S;return[`a`,{...t,"data-wiki-embed":``,"data-target":S,"data-alias":w??``,"data-anchor":E??``,href:E?`${k}#${E}`:k,target:`_blank`,rel:`noopener noreferrer`},labelFor({target:S,alias:w,anchor:E})]}}),sharedExtensions=[JsxComponent,RawMdxFallback,JsxInline,MathInline,WikiLink,WikiLinkEmbed,Tag,List,ListItem,EmphasisFidelity,StrongFidelity,CodeMarkFidelity,CodeBlockFidelity,BlockquoteFidelity,HeadingFidelity,ThematicBreakFidelity,LinkFidelity,HtmlBlockFidelity,LinkRefDefFidelity,HardBreakFidelity,EscapeMark,SourceLiteralMark,index_default$1.configure({undoRedo:!1,bulletList:!1,orderedList:!1,listItem:!1,italic:!1,bold:!1,code:!1,codeBlock:!1,heading:!1,horizontalRule:!1,hardBreak:!1,link:!1,blockquote:!1,dropcursor:{color:`color-mix(in oklch, var(--primary) 50%, transparent)`,width:2}}),TableFidelity.configure({resizable:!0}),TableRow,TableHeaderFidelity,TableCellFidelity,ImageSrcFidelity.configure({inline:!0}),ImageReferenceFidelity,index_default$5,CommentMark,CommentBlock,FootnoteReference,FootnoteDefinition],FRONTMATTER_TAG_VALUE_RE=/^[a-zA-Z][\w/-]*$/;function stripLeadingHash(e){return e.startsWith(`#`)?e.slice(1):e}function coerceCandidates(e){return typeof e==`string`?[e]:Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function extractFrontmatterTags(e){if(!e||e.trim()===``)return[];let{map:t}=parseFrontmatterYaml(e);if(!t)return[];let S=coerceCandidates(t.tags),w=[];for(let e of S){let t=stripLeadingHash(e);FRONTMATTER_TAG_VALUE_RE.test(t)?w.push(t):console.warn(`[frontmatter-tags] dropping invalid tag entry: ${JSON.stringify(e)}`)}return w}const safeDocNameField=string$2().refine(e=>!e.includes(`..`)&&!e.startsWith(`/`)&&!e.includes(`\0`)&&!e.includes(`\\`),{message:`docName contains unsafe path characters`}).optional(),agentIdentityFields={agentId:string$2().optional(),agentName:string$2().optional(),colorSeed:string$2().optional(),clientName:string$2().optional(),clientVersion:string$2().optional(),label:string$2().optional()},summaryField=string$2().optional(),URN_UUID_RE=/^urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,ShareConstructUrlRequestSchema=object$1({docPath:string$2().min(1)}).loose(),ShareConstructUrlErrorCodeSchema=_enum([`no-remote`,`detached-head`,`branch-not-on-origin`,`non-github-remote`,`invalid-path`]),ShareConstructUrlResponseSchema=discriminatedUnion(`ok`,[object$1({ok:literal(!0),shareUrl:string$2().min(1),blobUrl:string$2().min(1),branch:string$2().min(1)}).loose(),object$1({ok:literal(!1),error:ShareConstructUrlErrorCodeSchema,branch:string$2().min(1).optional()}).loose()]),SharePublishOwnerKindSchema=_enum([`user`,`org`]),SharePublishOwnerSchema=object$1({login:string$2().min(1),kind:SharePublishOwnerKindSchema,avatarUrl:string$2().optional()}).loose(),SharePublishOwnersErrorCodeSchema=_enum([`auth-required`,`network`]),SharePublishOwnersResponseSchema=discriminatedUnion(`ok`,[object$1({ok:literal(!0),owners:array(SharePublishOwnerSchema)}).loose(),object$1({ok:literal(!1),error:SharePublishOwnersErrorCodeSchema}).loose()]),SharePublishNameCheckResponseSchema=discriminatedUnion(`ok`,[object$1({ok:literal(!0),available:boolean$1()}).loose(),object$1({ok:literal(!1),error:SharePublishOwnersErrorCodeSchema}).loose()]),SharePublishVisibilitySchema=_enum([`public`,`private`]),SharePublishRequestSchema=object$1({owner:string$2().min(1),name:string$2().min(1),visibility:SharePublishVisibilitySchema,description:string$2().optional()}).loose(),SharePublishErrorCodeSchema=_enum([`name-conflict`,`saml-sso`,`auth-required`,`push-failed`,`init-failed`,`network`,`no-project`]),SharePublishResponseSchema=discriminatedUnion(`ok`,[object$1({ok:literal(!0),ownerLogin:string$2().min(1),repoName:string$2().min(1),cloneUrl:string$2().min(1),defaultBranch:string$2().min(1)}).loose(),object$1({ok:literal(!1),error:SharePublishErrorCodeSchema}).loose()]);function isValidBranchName(e){return!(typeof e!=`string`||e.length===0||e.startsWith(`-`)||/[\x00-\x1F\x7F]/.test(e)||/\s/.test(e)||e.includes(`:`)||e.split(`/`).includes(`..`))}const refineBranchName=e=>e.refine(isValidBranchName,`invalid branch name`);function isBranchNotFoundGitError(e){if(e==null)return!1;let t=e instanceof Error?e.message:String(e);return/couldn'?t find remote ref|Remote branch .+ not found/i.test(t)}const BranchInfoSharedFields={shareFileExists:boolean$1(),dirtyConflicts:object$1({conflicts:boolean$1(),files:array(string$2().min(1))}).loose(),branchIsLocal:boolean$1()},BranchInfoResponseSchema=discriminatedUnion(`detached`,[object$1({detached:literal(!1),currentBranch:string$2().min(1).nullable(),currentHeadSha:_null(),...BranchInfoSharedFields}).loose(),object$1({detached:literal(!0),currentBranch:_null(),currentHeadSha:string$2().min(1),...BranchInfoSharedFields}).loose()]),CheckoutRequestSchema=object$1({branch:refineBranchName(string$2().min(1)),principalId:string$2().optional()}).loose(),CheckoutFailureReasonSchema=_enum([`dirty-conflict`,`branch-not-found`,`fetch-failed`,`checkout-failed`]),CheckoutResponseSchema=discriminatedUnion(`ok`,[object$1({ok:literal(!0)}).loose(),object$1({ok:literal(!1),reason:CheckoutFailureReasonSchema,files:array(string$2().min(1)).optional()}).loose()]),ServerInfoSuccessSchema=object$1({serverInstanceId:string$2().min(1),currentBranch:string$2().min(1).optional(),currentDiskAckSVs:record(string$2().min(1),string$2().min(1)).optional()}).loose(),PrincipalSuccessSchema=object$1({id:string$2().min(1),display_name:string$2().min(1),display_email:string$2(),source:_enum([`git-config`,`synthesized`]),created_at:string$2().min(1)}).loose(),ProblemTypeSchema=_enum(`urn:ok:error:malformed-upload.urn:ok:error:collision-exhaustion.urn:ok:error:storage-full.urn:ok:error:storage-readonly.urn:ok:error:storage-error.urn:ok:error:no-file-received.urn:ok:error:path-escape.urn:ok:error:method-not-allowed.urn:ok:error:invalid-request.urn:ok:error:payload-too-large.urn:ok:error:request-timeout.urn:ok:error:internal-server-error.urn:ok:error:loopback-required.urn:ok:error:invalid-origin.urn:ok:error:url-not-allowed.urn:ok:error:dir-outside-home.urn:ok:error:concurrent-operation.urn:ok:error:clone-failed.urn:ok:error:clone-timeout.urn:ok:error:server-start-failed.urn:ok:error:reserved-doc-name.urn:ok:error:target-not-found.urn:ok:error:stale-target.urn:ok:error:frontmatter-edit-not-supported.urn:ok:error:invalid-frontmatter-patch.urn:ok:error:no-active-session.urn:ok:error:too-many-agent-sessions.urn:ok:error:doc-not-found.urn:ok:error:doc-already-exists.urn:ok:error:doc-not-open.urn:ok:error:rollback-not-configured.urn:ok:error:doc-not-available.urn:ok:error:backlink-index-not-configured.urn:ok:error:file-rescan-not-configured.urn:ok:error:shadow-not-configured.urn:ok:error:host-not-allowed.urn:ok:error:principal-not-available.urn:ok:error:not-found.urn:ok:error:auth-failed.urn:ok:error:no-project-dir.urn:ok:error:server-open-failed.urn:ok:error:doc-in-conflict.urn:ok:error:no-conflict-tracked.urn:ok:error:sync-not-active.urn:ok:error:project-repo-not-configured.urn:ok:error:seed-prerequisite-missing.urn:ok:error:seed-invalid-root.urn:ok:error:tag-index-not-configured.urn:ok:error:template-not-found.urn:ok:error:unsupported-asset-type.urn:ok:error:asset-not-found.urn:ok:error:collab-server-not-running.urn:ok:error:gateway-timeout.urn:ok:error:cursor-not-installed.urn:ok:error:cursor-spawn-timeout.urn:ok:error:cursor-spawn-failed.urn:ok:error:handoff-target-not-installed.urn:ok:error:handoff-spawn-timeout.urn:ok:error:handoff-spawn-failed`.split(`.`));function assertNeverProblemType(e){throw Error(`Unexpected ProblemType variant: ${JSON.stringify(e)}`)}const ProblemDetailsSchema=object$1({type:ProblemTypeSchema,title:string$2().min(1),status:number$1().int().min(400).max(599),instance:string$2().regex(URN_UUID_RE,`instance must be urn:uuid:<uuid>`).optional(),detail:string$2().optional()}).loose(),UploadRequestSchema=object$1({parentDocName:string$2().min(1),agentId:string$2().min(1).optional(),agentName:string$2().min(1).optional()}).loose(),UploadAssetSuccessSchema=object$1({src:string$2().min(1),path:string$2().min(1).optional(),deduped:boolean$1().optional()}).loose(),LocalOpCloneRequestSchema=object$1({url:string$2().min(1),dir:string$2().min(1),branch:string$2().min(1).refine(isValidBranchName,`invalid branch name`).optional()}).loose(),StreamingProblemEventSchema=object$1({type:literal(`error`),problem:ProblemDetailsSchema}).loose();function reconstructAttrs(e,t){let S=Array.isArray(e.attrs.attributes)?e.attrs.attributes.filter(e=>typeof e==`object`&&!!e&&`type`in e):[],w=e.attrs.props??{},E=new Map,D=new Set;if(t)for(let e of t)e.omitOnDefault===!0&&`defaultValue`in e&&e.defaultValue!==void 0&&E.set(e.name,e.defaultValue),e.type===`string`&&e.required===!1&&e.defaultValue===void 0&&D.add(e.name);for(let[e,t]of Object.entries(w)){let w=S.findIndex(t=>t.type===`mdxJsxAttribute`&&t.name===e);if(E.has(e)&&Object.is(E.get(e),t)){w>=0&&S.splice(w,1);continue}if(D.has(e)&&t===``){w>=0&&S.splice(w,1);continue}let O=propToMdxJsxAttribute(e,t);w>=0?S[w]=O:S.push(O)}return S}function propToMdxJsxAttribute(e,t){if(t===!0)return{type:`mdxJsxAttribute`,name:e,value:null};if(t===!1)return{type:`mdxJsxAttribute`,name:e,value:{type:`mdxJsxAttributeValueExpression`,value:`false`}};if(t==null)return{type:`mdxJsxAttribute`,name:e,value:null};if(typeof t==`string`)return{type:`mdxJsxAttribute`,name:e,value:t};if(typeof t==`number`)return{type:`mdxJsxAttribute`,name:e,value:{type:`mdxJsxAttributeValueExpression`,value:JSON.stringify(t)}};if(typeof t==`object`){let S;try{S=JSON.stringify(t)}catch{S=String(t)}return{type:`mdxJsxAttribute`,name:e,value:{type:`mdxJsxAttributeValueExpression`,value:S}}}return{type:`mdxJsxAttribute`,name:e,value:String(t)}}function emitMdxJsx(e,t,S,w){return{type:`mdxJsxFlowElement`,name:e,attributes:reconstructAttrs(t,w),children:S.all(t),data:{}}}const LOOM_ID_RE=/^[A-Za-z0-9]{20,}$/,LOOM_TIMESTAMP_RE=/^(?:\d+s?|(?:\d+h)?(?:\d+m)?(?:\d+s)?)$/;function isLoomHost(e){let t=e.toLowerCase();return t===`loom.com`||t===`www.loom.com`}function extractLoomId(e){let t=e.pathname.match(/^\/(?:share|embed)\/([A-Za-z0-9]+)\/?$/);if(!t)return null;let S=t[1]??``;return LOOM_ID_RE.test(S)?S:null}function parseLoomUrl(e){if(typeof e!=`string`||e.length===0)return null;let t;try{t=new URL(e)}catch{return null}if(t.protocol!==`http:`&&t.protocol!==`https:`||!isLoomHost(t.hostname))return null;let S=extractLoomId(t);if(!S)return null;let w=t.searchParams.get(`t`);return{id:S,startRaw:w&&w.length>0&&LOOM_TIMESTAMP_RE.test(w)?w:null}}function isLoomUrl(e){return parseLoomUrl(e)!==null}function isVimeoHost(e){let t=e.toLowerCase();return t===`vimeo.com`||t===`www.vimeo.com`||t===`player.vimeo.com`}function isVimeoUrl(e){if(typeof e!=`string`||e.length===0)return!1;let t;try{t=new URL(e)}catch{return!1}return t.protocol!==`http:`&&t.protocol!==`https:`?!1:isVimeoHost(t.hostname)}const YOUTUBE_VIDEO_ID_RE=/^[A-Za-z0-9_-]{11}$/;function isYouTubeHost(e){let t=e.toLowerCase();return t===`youtube.com`||t===`www.youtube.com`||t===`m.youtube.com`||t===`music.youtube.com`||t===`youtu.be`||t===`youtube-nocookie.com`||t===`www.youtube-nocookie.com`}function parseTimestampToSeconds(e){if(e.length===0)return null;if(/^[0-9]+$/.test(e)){let t=Number.parseInt(e,10);return t>0?t:null}let t=e.match(/^(?:([0-9]+)h)?(?:([0-9]+)m)?(?:([0-9]+)s?)?$/);if(!t)return null;let S=t[1]?Number.parseInt(t[1],10):0,w=t[2]?Number.parseInt(t[2],10):0,E=t[3]?Number.parseInt(t[3],10):0,D=S*3600+w*60+E;return D>0?D:null}function extractVideoId(e){if(e.hostname.toLowerCase()===`youtu.be`){let t=e.pathname.replace(/^\//,``).split(`/`)[0]??``;return YOUTUBE_VIDEO_ID_RE.test(t)?t:null}if(e.pathname===`/watch`){let t=e.searchParams.get(`v`)??``;return YOUTUBE_VIDEO_ID_RE.test(t)?t:null}let t=e.pathname.match(/^\/(?:embed|shorts|v)\/([A-Za-z0-9_-]{11})\/?$/);return t?t[1]??null:null}function parseYouTubeUrl(e){if(typeof e!=`string`||e.length===0)return null;let t;try{t=new URL(e)}catch{return null}if(t.protocol!==`http:`&&t.protocol!==`https:`||!isYouTubeHost(t.hostname))return null;let S=extractVideoId(t);if(!S)return null;let w=t.searchParams.get(`t`)??t.searchParams.get(`start`)??``;return{id:S,startSeconds:w.length>0?parseTimestampToSeconds(w):null,noCookie:t.hostname.toLowerCase().endsWith(`youtube-nocookie.com`)}}const calloutProps=[{name:`type`,type:`enum`,enumValues:[`note`,`tip`,`important`,`warning`,`caution`,`abstract`,`info`,`todo`,`success`,`question`,`failure`,`danger`,`bug`,`example`,`quote`],defaultValue:`note`,required:!1,description:`Callout variant`},{name:`title`,type:`string`,required:!1,description:`Optional heading shown above the body`},{name:`icon`,type:`string`,required:!1,advanced:!0,description:"Custom lucide icon override (e.g. `lucide:Lightbulb`)"},{name:`color`,type:`string`,required:!1,advanced:!0,description:"Optional accent color override (hex — e.g. `#F05032`)"},{name:`collapsible`,type:`boolean`,required:!1,defaultValue:!1,advanced:!0,description:"Render as a foldable `<details>` (Obsidian `[!TYPE]+/-`)"},{name:`defaultOpen`,type:`boolean`,required:!1,defaultValue:!0,advanced:!0,description:`When collapsible, start in the open state`},{name:`children`,type:`reactnode`,required:!0,description:`Callout content`}],htmlImgProps=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Image source URL`,accept:ALLOWED_IMAGE_MIME_TYPES,autoFocus:!0},{name:`alt`,type:`string`,required:!0,description:`Alt text`},{name:`width`,type:`number`,required:!1,advanced:!0,description:`Image width`},{name:`height`,type:`number`,required:!1,advanced:!0,description:`Image height`},{name:`srcset`,type:`string`,required:!1,advanced:!0,description:`Responsive image candidate set (e.g. "x.png 1x, y.png 2x")`},{name:`sizes`,type:`string`,required:!1,advanced:!0,description:`Responsive image sizes hint paired with srcset`},{name:`loading`,type:`enum`,enumValues:[`eager`,`lazy`],defaultValue:`lazy`,required:!1,advanced:!0,omitOnDefault:!0,description:`Native img loading strategy (defaults to lazy)`},{name:`title`,type:`string`,required:!1,advanced:!0,description:`Native HTML title attribute (tooltip)`},{name:`decoding`,type:`enum`,enumValues:[`sync`,`async`,`auto`],defaultValue:`auto`,required:!1,advanced:!0,omitOnDefault:!0,description:`Hint for how the browser should decode the image`},{name:`fetchpriority`,type:`enum`,enumValues:[`high`,`low`,`auto`],defaultValue:`auto`,required:!1,advanced:!0,omitOnDefault:!0,description:`Resource fetch priority hint`},{name:`crossorigin`,type:`enum`,enumValues:[`anonymous`,`use-credentials`],required:!1,advanced:!0,description:`CORS mode for the image fetch`},{name:`referrerpolicy`,type:`string`,required:!1,advanced:!0,description:`Referrer policy for the image fetch (HTML referrerpolicy values)`},{name:`align`,type:`enum`,enumValues:[`center`,`left`,`right`],defaultValue:`center`,required:!1,omitOnDefault:!0,description:`Alignment within the column`}],embedProps=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Embedded page URL (must start with http:// or https://)`,autoFocus:!0},{name:`title`,type:`string`,required:!1,description:`Iframe title (accessible label for screen readers)`},{name:`width`,type:`string`,required:!1,advanced:!0,description:`Embed width as a CSS length (e.g. "100%", "640px")`},{name:`height`,type:`string`,required:!1,advanced:!0,description:`Embed height as a CSS length (e.g. "26rem", "480px")`},{name:`align`,type:`enum`,enumValues:[`center`,`left`,`right`],defaultValue:`center`,required:!1,omitOnDefault:!0,description:`Alignment within the column`}],htmlVideoProps=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Video source URL`,accept:ALLOWED_VIDEO_MIME_TYPES,autoFocus:!0},{name:`controls`,type:`boolean`,required:!1,defaultValue:!0,advanced:!0,omitOnDefault:!0,description:`Show native HTML5 video controls (defaults to true)`,hideWhen:e=>typeof e.src==`string`&&(isVimeoUrl(e.src)||isLoomUrl(e.src))},{name:`autoplay`,type:`boolean`,required:!1,advanced:!0,description:`Begin playback as soon as possible (usually requires muted)`},{name:`poster`,type:`string`,required:!1,advanced:!0,description:`Poster image URL shown before playback`,accept:ALLOWED_IMAGE_MIME_TYPES,hideWhen:e=>typeof e.src==`string`&&(isVimeoUrl(e.src)||isLoomUrl(e.src))},{name:`width`,type:`number`,required:!1,advanced:!0,description:`Video width`},{name:`height`,type:`number`,required:!1,advanced:!0,description:`Video height`},{name:`title`,type:`string`,required:!1,advanced:!0,description:`Native HTML title attribute (tooltip)`},{name:`muted`,type:`boolean`,required:!1,advanced:!0,description:`Mute audio on load`},{name:`loop`,type:`boolean`,required:!1,advanced:!0,description:`Restart from the beginning when playback ends`,hideWhen:e=>typeof e.src==`string`&&isLoomUrl(e.src)},{name:`playsinline`,type:`boolean`,required:!1,advanced:!0,description:`Play inline on iOS rather than entering fullscreen`,hideWhen:e=>typeof e.src==`string`&&(isVimeoUrl(e.src)||isLoomUrl(e.src))},{name:`preload`,type:`enum`,enumValues:[`none`,`metadata`,`auto`],required:!1,advanced:!0,description:`Hint for how much of the video to preload`,hideWhen:e=>typeof e.src==`string`&&(parseYouTubeUrl(e.src)!==null||isVimeoUrl(e.src)||isLoomUrl(e.src))}],htmlAudioProps=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Audio source URL`,accept:ALLOWED_AUDIO_MIME_TYPES,autoFocus:!0},{name:`controls`,type:`boolean`,required:!1,defaultValue:!0,advanced:!0,omitOnDefault:!0,description:`Show native HTML5 audio controls (defaults to true)`},{name:`autoplay`,type:`boolean`,required:!1,advanced:!0,description:`Begin playback as soon as possible (usually requires muted)`},{name:`title`,type:`string`,required:!1,advanced:!0,description:`Native HTML title attribute (tooltip)`},{name:`muted`,type:`boolean`,required:!1,advanced:!0,description:`Mute audio on load`},{name:`loop`,type:`boolean`,required:!1,advanced:!0,description:`Restart from the beginning when playback ends`},{name:`preload`,type:`enum`,enumValues:[`none`,`metadata`,`auto`],required:!1,advanced:!0,description:`Hint for how much of the audio to preload`}],accordionProps=[{name:`title`,type:`string`,required:!0,description:`Accordion heading shown inside the <summary>`},{name:`defaultOpen`,type:`boolean`,required:!1,defaultValue:!1,description:`When true, the accordion renders expanded on initial load`},{name:`icon`,type:`string`,required:!1,advanced:!0,description:"Custom lucide icon override (e.g. `lucide:Rocket`)"},{name:`description`,type:`string`,required:!1,advanced:!0,description:`Optional subtitle rendered below the title inside <summary>`},{name:`id`,type:`string`,required:!1,advanced:!0,description:"HTML id attribute for deep-linking (e.g. `#advanced-options`)"},{name:`name`,type:`string`,required:!1,advanced:!0,description:`HTML5 <details name=> group — siblings with the same name are mutually exclusive`}],gfmCalloutProps=[calloutProps[0],calloutProps[1],calloutProps[4],calloutProps[5],calloutProps[6]],commonMarkImageProps=[htmlImgProps[0],htmlImgProps[1],htmlImgProps[7]],htmlDetailsAccordionProps=[accordionProps[0],accordionProps[1],accordionProps[4],accordionProps[5]],wikiEmbedImageProps=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Alt text (Obsidian alias syntax: `![[file.png|alt text]]`)"}],wikiEmbedVideoProps=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Title text (Obsidian alias syntax: `![[clip.mp4|title]]`)"}],wikiEmbedAudioProps=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Title text (Obsidian alias syntax: `![[song.mp3|title]]`)"}],tabsProps=[{name:`id`,type:`string`,required:!1,advanced:!0,description:"HTML id attribute for deep-linking (e.g. `#install-tabs`)"}],tabProps=[{name:`label`,type:`string`,required:!0,autoFocus:!0,defaultValue:`Tab`,description:`Tab strip label — shown in the clickable pill at the top`},{name:`id`,type:`string`,required:!1,advanced:!0,description:"HTML id attribute for deep-linking (e.g. `#tab-npm`)"}],mathProps=[{name:`formula`,type:`string`,required:!0,autoFocus:!0,language:`latex`,description:`LaTeX math source (rendered with KaTeX in the browser)`},{name:`id`,type:`string`,required:!1,advanced:!0,description:"HTML id attribute for deep-linking (e.g. `#eq-pythagoras`)"},{name:`language`,type:`string`,required:!1,advanced:!0,description:"Forward-compat hint for the math source language (default `latex`). Reserved for future MathJax / Typst / AsciiMath substrates."}],dollarMathProps=[mathProps[0]],mathFenceProps=[mathProps[0]],mermaidProps=[{name:`chart`,type:`string`,required:!0,autoFocus:!0,language:`mermaid`,description:`Mermaid chart source (graph / flowchart / sequenceDiagram / class / state / etc.)`}],wikiEmbedFileProps=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Display name override (Obsidian alias syntax: `![[file.zip|label]]`)"}],fileProps=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`File URL`,accept:[`*/*`],autoFocus:!0}],pdfProps=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`PDF source URL`,accept:ALLOWED_PDF_MIME_TYPES,autoFocus:!0},{name:`title`,type:`string`,required:!1,advanced:!0,description:`Accessible label for the embedded PDF viewer`},{name:`anchor`,type:`string`,required:!1,advanced:!0,description:"PDF viewer parameters as a single URL-fragment string (e.g. `page=3&height=600`)"}],mirrorProps=[{name:`src`,type:`string`,required:!0,description:"Path of the source doc, extension-less (e.g. `api-spec`).",autoFocus:!0},{name:`anchor`,type:`string`,required:!0,description:"Id of the `<MirrorSource>` block within the source doc."}],mirrorSourceProps=[{name:`id`,type:`string`,required:!0,description:"Stable id agents and authors use to reference this block from `<Mirror>` elsewhere.",autoFocus:!0},{name:`children`,type:`reactnode`,required:!0,description:`Block content this MirrorSource owns — paragraphs, callouts, code, nested JSX, anything.`}];function escapeHtmlAttr(e){return e.replace(/&/g,`&`).replace(/"/g,`"`).replace(/</g,`<`).replace(/>/g,`>`)}function escapeHtmlText(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`)}function serializeWikiEmbed(e){let t=e.attrs.props,S=t?.target??``,w=typeof t?.alias==`string`&&t.alias.length>0?t.alias:null,E=typeof t?.anchor==`string`&&t.anchor.length>0?t.anchor:null,D=w??(E?`${S}#${E}`:S);return{type:`wikiLinkEmbed`,value:D,data:{target:S,anchor:E,alias:w},children:[{type:`text`,value:D}]}}const builtInComponents=[{name:`Callout`,surface:`canonical`,hasChildren:!0,props:calloutProps,icon:`MessageSquareWarning`,category:`content`,displayName:`Callout`,description:`Alert / admonition with 15 type variants — 5 GFM (note, tip, important, warning, caution) plus 10 Obsidian-parity (abstract, info, todo, success, question, failure, danger, bug, example, quote)`,searchTerms:[`note`,`tip`,`important`,`warning`,`caution`,`abstract`,`info`,`todo`,`success`,`question`,`failure`,`danger`,`bug`,`example`,`quote`,`alert`,`admonition`,`callout`],serialize:(e,t)=>emitMdxJsx(`Callout`,e,t,calloutProps)},{name:`img`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:htmlImgProps,icon:`Image`,category:`media`,displayName:`Image`,description:`Image with click-to-zoom and HTML-native attributes`,searchTerms:[`image`,`zoom`,`picture`,`photo`],placeholder:{label:`Add an image`},serialize:(e,t)=>emitMdxJsx(`img`,e,t,htmlImgProps)},{name:`video`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:htmlVideoProps,icon:`SquarePlay`,category:`media`,displayName:`Video`,description:`HTML5 video player with native controls`,searchTerms:[`video`,`media`,`player`,`mp4`,`webm`,`movie`],placeholder:{label:`Add a video`},serialize:(e,t)=>emitMdxJsx(`video`,e,t,htmlVideoProps)},{name:`audio`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:htmlAudioProps,icon:`Volume2`,category:`media`,displayName:`Audio`,description:`HTML5 audio player with native controls`,searchTerms:[`audio`,`sound`,`music`,`mp3`,`podcast`,`player`],placeholder:{label:`Add audio`},serialize:(e,t)=>emitMdxJsx(`audio`,e,t,htmlAudioProps)},{name:`Pdf`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:pdfProps,icon:`FileText`,category:`media`,displayName:`PDF`,description:"Embedded PDF viewer (`#page=N` to open at page N, `#height=N` for viewer height)",searchTerms:[`pdf`,`document`,`embed`,`pdfjs`],placeholder:{label:`Add a PDF`},serialize:(e,t)=>emitMdxJsx(`Pdf`,e,t,pdfProps)},{name:`File`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:fileProps,icon:`Paperclip`,category:`media`,displayName:`File`,description:`Downloadable file attachment — inline row with name + size + download link`,searchTerms:[`file`,`attachment`,`download`,`document`,`zip`,`docx`,`doc`],placeholder:{label:`Add a file`},serialize:(e,t)=>emitMdxJsx(`File`,e,t,fileProps)},{name:`Embed`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:embedProps,icon:`AppWindow`,category:`media`,displayName:`Embed`,description:`Inline web embed (iframe) — drop a URL, get a resizable preview pane`,searchTerms:[`embed`,`iframe`,`website`,`page`,`inline`,`frame`,`preview`],placeholder:{label:`Embed a URL`},serialize:(e,t)=>emitMdxJsx(`Embed`,e,t,embedProps)},{name:`Accordion`,surface:`canonical`,hasChildren:!0,props:accordionProps,icon:`ChevronRight`,category:`content`,displayName:`Accordion`,description:"Standalone expand/collapse via native HTML5 <details>/<summary>. Group siblings with the `name` prop for exclusive-accordion UX.",searchTerms:[`toggle`,`accordion`,`expandable`,`details`,`disclosure`,`collapse`,`fold`],exampleBody:`Body content revealed when the accordion is expanded.`,serialize:(e,t)=>emitMdxJsx(`Accordion`,e,t,accordionProps)},{name:`Tabs`,surface:`canonical`,hasChildren:!0,emptyChildName:`Tab`,props:tabsProps,icon:`LayoutPanelTop`,category:`content`,displayName:`Tabs`,description:"Horizontal tab strip + active panel below. Each `<Tab>` child is one panel; clickable pills at the top switch the active one. Active selection is ephemeral (resets on reload).",searchTerms:[`tabs`,`tabbed`,`panels`,`tabgroup`,`switcher`],exampleBody:`<Tab label="One">Body of the first tab panel.</Tab>
|
|
390
|
+
`)}const PREVIEW_THEME_TOKENS=[{name:`--chart-1`,light:`oklch(0.62 0.19 259)`,dark:`oklch(0.72 0.14 259)`},{name:`--chart-2`,light:`oklch(0.58 0.14 145)`,dark:`oklch(0.73 0.13 145)`},{name:`--chart-3`,light:`oklch(0.62 0.15 70)`,dark:`oklch(0.77 0.14 70)`},{name:`--chart-4`,light:`oklch(0.55 0.18 290)`,dark:`oklch(0.72 0.16 290)`},{name:`--chart-5`,light:`oklch(0.58 0.21 25)`,dark:`oklch(0.72 0.2 25)`},{name:`--primary`,light:`oklch(0.6321 0.1983 259.59)`,dark:`#69a3ff`},{name:`--primary-foreground`,light:`oklch(0.985 0 0)`,dark:`oklch(0.205 0 0)`},{name:`--foreground`,light:`oklch(0.145 0 0)`,dark:`oklch(0.985 0 0)`},{name:`--background`,light:`oklch(1 0 0)`,dark:`oklch(0.145 0 0)`},{name:`--card`,light:`oklch(1 0 0)`,dark:`oklch(0.205 0 0)`},{name:`--card-foreground`,light:`oklch(0.145 0 0)`,dark:`oklch(0.985 0 0)`},{name:`--muted-foreground`,light:`oklch(0.556 0 0)`,dark:`oklch(0.708 0 0)`},{name:`--border`,light:`oklch(0.922 0 0)`,dark:`oklch(1 0 0 / 10%)`},{name:`--destructive`,light:`oklch(0.577 0.245 27.325)`,dark:`oklch(0.704 0.191 22.216)`},{name:`--radius`,light:`0.625rem`,dark:`0.625rem`}],DEFAULT_SERVER_HOST=`localhost`,ALLOWED_IMAGE_MIME_TYPES=[`image/jpeg`,`image/png`,`image/gif`,`image/webp`,`image/svg+xml`],ALLOWED_VIDEO_MIME_TYPES=[`video/mp4`,`video/webm`,`video/ogg`],ALLOWED_AUDIO_MIME_TYPES=[`audio/mpeg`,`audio/wav`,`audio/ogg`],ALLOWED_PDF_MIME_TYPES=[`application/pdf`],IMAGE_EXTENSIONS=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`,`svg`]),VIDEO_EXTENSIONS=new Set([`mp4`,`webm`,`mov`,`m4v`,`mkv`]),PDF_EXTENSIONS=new Set([`pdf`]),AUDIO_EXTENSIONS=new Set([`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`]),FILE_ATTACHMENT_EXTENSIONS=new Set(`pdf.docx.xlsx.pptx.doc.xls.ppt.zip.7z.tar.gz.rar.csv.tsv.rtf.json.yaml.yml.xml.txt.pages.numbers.key.odt.ods.odp.epub.mobi`.split(`.`)),EXECUTABLE_BLOCKLIST_EXTENSIONS=new Set(`exe.bat.cmd.ps1.com.msi.vbs.js.jse.wsf.wsh.hta.sh.command.csh.ksh.bash.zsh.fish.desktop.action.workflow.html.htm.svg.xml.mhtml.svgz.dmg.pkg.mpkg.scpt.applescript.terminal.prefpane.webloc.inetloc.fileloc.jar.appimage.deb.rpm.msix.appx.ipa.apk.pif.scr.lnk.url`.split(`.`)),ASSET_EXTENSIONS=new Set(`png.jpg.jpeg.gif.webp.avif.svg.apng.heic.heif.tiff.bmp.ico.pdf.mp4.webm.mov.m4v.mkv.avi.flv.wmv.mpeg.mpg.mp3.wav.ogg.m4a.flac.aac.opus.zip.woff.woff2.ttf.otf.eot.docx.xlsx.pptx.csv.txt.rtf.json.toml`.split(`.`)),INLINE_RENDERABLE_EXTENSIONS=new Set(`png.jpg.jpeg.gif.webp.avif.apng.heic.heif.tiff.bmp.ico.svg.pdf.mp4.webm.mov.m4v.mkv.mp3.wav.ogg.m4a.flac.aac.opus.json.toml`.split(`.`)),DEFAULT_DEDUP_MODE=`same-dir`,WIKI_EMBED_EXTENSIONS=new Set(`png.jpg.jpeg.gif.webp.avif.svg.pdf.mp4.webm.mov.m4v.mkv.mp3.wav.ogg.m4a.flac.aac.opus.docx.xlsx.pptx.doc.xls.ppt.zip.7z.tar.gz.rar.csv.tsv.rtf.json.yaml.yml.xml.txt.pages.numbers.key.odt.ods.odp.epub.mobi`.split(`.`)),SIDEBAR_IMAGE_EXTENSIONS=[`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`],SIDEBAR_VIDEO_EXTENSIONS=[`mp4`,`webm`,`mov`,`m4v`],SIDEBAR_AUDIO_EXTENSIONS=[`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`],SIDEBAR_PDF_EXTENSIONS=[`pdf`],SIDEBAR_TEXT_EXTENSIONS=[`json`,`toml`];function assertSubset(e,t,S){for(let w of t)if(!S.has(w))throw Error(`${e}: ${w} is not present in canonical upload constants`)}assertSubset(`SIDEBAR_IMAGE_ASSET_EXTENSIONS`,SIDEBAR_IMAGE_EXTENSIONS,IMAGE_EXTENSIONS),assertSubset(`SIDEBAR_VIDEO_ASSET_EXTENSIONS`,SIDEBAR_VIDEO_EXTENSIONS,VIDEO_EXTENSIONS),assertSubset(`SIDEBAR_AUDIO_ASSET_EXTENSIONS`,SIDEBAR_AUDIO_EXTENSIONS,AUDIO_EXTENSIONS),assertSubset(`SIDEBAR_PDF_ASSET_EXTENSIONS`,SIDEBAR_PDF_EXTENSIONS,PDF_EXTENSIONS),assertSubset(`FILE_ATTACHMENT_EXTENSIONS`,[...FILE_ATTACHMENT_EXTENSIONS],WIKI_EMBED_EXTENSIONS);const SIDEBAR_IMAGE_ASSET_EXTENSIONS=new Set(SIDEBAR_IMAGE_EXTENSIONS),SIDEBAR_VIDEO_ASSET_EXTENSIONS=new Set(SIDEBAR_VIDEO_EXTENSIONS),SIDEBAR_AUDIO_ASSET_EXTENSIONS=new Set(SIDEBAR_AUDIO_EXTENSIONS),SIDEBAR_PDF_ASSET_EXTENSIONS=new Set(SIDEBAR_PDF_EXTENSIONS),SIDEBAR_TEXT_ASSET_EXTENSIONS=new Set(SIDEBAR_TEXT_EXTENSIONS),SIDEBAR_RENDERABLE_ASSET_EXTENSIONS=new Set([...SIDEBAR_IMAGE_EXTENSIONS,...SIDEBAR_VIDEO_EXTENSIONS,...SIDEBAR_AUDIO_EXTENSIONS,...SIDEBAR_PDF_EXTENSIONS,...SIDEBAR_TEXT_EXTENSIONS]);assertSubset(`SIDEBAR_RENDERABLE_ASSET_EXTENSIONS`,[...SIDEBAR_RENDERABLE_ASSET_EXTENSIONS],INLINE_RENDERABLE_EXTENSIONS);function mediaKindForSidebarAssetExtension(e){let t=e.toLowerCase().replace(/^\./,``);return SIDEBAR_IMAGE_ASSET_EXTENSIONS.has(t)?`image`:SIDEBAR_VIDEO_ASSET_EXTENSIONS.has(t)?`video`:SIDEBAR_AUDIO_ASSET_EXTENSIONS.has(t)?`audio`:SIDEBAR_PDF_ASSET_EXTENSIONS.has(t)?`pdf`:SIDEBAR_TEXT_ASSET_EXTENSIONS.has(t)?`text`:null}const CodeBlockFidelity=index_default$11.extend({priority:60,addAttributes(){return{...this.parent?.(),fenceDelimiter:{default:"`"},fenceLength:{default:3},meta:{default:null},sourceStyle:{default:`fenced`}}}}),EmphasisFidelity=index_default$9.extend({name:`emphasis`,priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`*`}}},addInputRules(){return[markInputRule({find:starInputRegex,type:this.type,getAttributes:{sourceDelimiter:`*`}}),markInputRule({find:underscoreInputRegex,type:this.type,getAttributes:{sourceDelimiter:`_`}})]}}),StrongFidelity=index_default$10.extend({name:`strong`,priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`**`}}},addInputRules(){return[markInputRule({find:starInputRegex$1,type:this.type,getAttributes:{sourceDelimiter:`**`}}),markInputRule({find:underscoreInputRegex$1,type:this.type,getAttributes:{sourceDelimiter:`__`}})]}}),EscapeMark=Mark.create({name:`escapeMark`,priority:10,excludes:``,inclusive:!1,parseHTML(){return[{tag:`span[data-escape-mark]`}]},renderHTML(){return[`span`,{"data-escape-mark":``},0]}}),HardBreakFidelity=index_default$8.extend({priority:60,addAttributes(){return{...this.parent?.(),hardBreakStyle:{default:`backslash`}}}}),HeadingFidelity=index_default$7.extend({priority:60,addAttributes(){return{...this.parent?.(),headingStyle:{default:`atx`},sourceTrailingHashes:{default:null},sourceUnderlineLength:{default:null},sourceContiguousNext:{default:!1}}}}),HtmlBlockFidelity=Node3.create({name:`htmlBlock`,group:`block`,atom:!0,priority:60,addAttributes(){return{content:{default:``}}},parseHTML(){return[{tag:`div[data-html-block]`}]},renderHTML({node:e}){return[`div`,{"data-html-block":``,class:`html-block`},e.attrs.content]}});function toDesktopAssetHref(e){if(typeof e!=`string`||!e.startsWith(`/`))return e;let t=globalThis.window?.okDesktop?.config?.apiOrigin;return typeof t==`string`&&t?t+e:e}const ImageSrcFidelity=index_default$6.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceUrl:{default:null,rendered:!1}}},renderHTML({HTMLAttributes:e}){let t=mergeAttributes(this.options.HTMLAttributes,e);return typeof t.src==`string`&&(t.src=toDesktopAssetHref(t.src)),[`img`,t]}}),JsxComponent=Node3.create({name:`jsxComponent`,group:`block`,atom:!1,content:`block*`,isolating:!0,selectable:!0,defining:!0,priority:60,addAttributes(){return{componentName:{default:``},kind:{default:`element`},attributes:{default:[]},sourceRaw:{default:``},sourceDirty:{default:!1},props:{default:{}}}},parseHTML(){return[{tag:`div[data-jsx-component]`,getAttrs:e=>typeof e==`string`?!1:{componentName:e.getAttribute(`data-component-name`)||``,sourceRaw:e.getAttribute(`data-source-raw`)||``}}]},renderHTML({HTMLAttributes:e}){return[`div`,{"data-jsx-component":``,"data-component-name":e.componentName,"data-source-raw":e.sourceRaw},0]},addCommands(){return{insertJsxComponent:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{sourceRaw:e}})}}}),JsxInline=Node3.create({name:`jsxInline`,group:`inline`,inline:!0,atom:!1,content:`text*`,isolating:!1,selectable:!0,priority:60,addAttributes(){return{}},parseHTML(){return[{tag:`span[data-jsx-inline]`}]},renderHTML(){return[`span`,{"data-jsx-inline":``},0]}}),SAFE_URL_SCHEMES=[`https`,`http`,`mailto`,`tel`,`ftp`,`sms`],SCHEME_ALT=SAFE_URL_SCHEMES.map(e=>`${e}:`).join(`|`),SAFE_URL_SCHEME_RE=RegExp(`^(?:${SCHEME_ALT}|\\/|#|\\?|\\.\\/|\\.\\.\\/)`,`i`);function isRelativeUrl(e){let t=e.trim();if(t===``)return!0;let S=t.indexOf(`:`);if(S===-1)return!0;let w=t.indexOf(`/`),E=t.indexOf(`?`),D=t.indexOf(`#`);return S>Math.min(w===-1?1/0:w,E===-1?1/0:E,D===-1?1/0:D)}const ALLOWED_LINK_SCHEMES=new Set(SAFE_URL_SCHEMES.map(e=>`${e}:`)),PLACEHOLDER_BASE=`https://placeholder.invalid`;function isAllowedLinkUri(e){try{let t=new URL(e,PLACEHOLDER_BASE);return ALLOWED_LINK_SCHEMES.has(t.protocol.toLowerCase())}catch{return!1}}const LinkFidelity=index_default$5.extend({priority:60,addOptions(){return{openOnClick:!1,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:`http`,HTMLAttributes:{target:`_blank`,rel:`noopener noreferrer`},isAllowedUri:isAllowedLinkUri,validate:isAllowedLinkUri,shouldAutoLink:()=>!0}},addAttributes(){return{...this.parent?.(),linkStyle:{default:`inline`,rendered:!1},refLabel:{default:null,rendered:!1},sourceForm:{default:null,rendered:!1},target:{default:null,rendered:!1},anchor:{default:null,rendered:!1},alias:{default:null,rendered:!1},sourceUrlForm:{default:null,rendered:!1},sourceTitleMarker:{default:null,rendered:!1}}}}),LinkRefDefFidelity=Node3.create({name:`linkRefDef`,group:`block`,atom:!0,priority:60,addAttributes(){return{label:{default:``},href:{default:``},title:{default:null},sourceLayout:{default:null},sourceTitleMarker:{default:null}}},parseHTML(){return[{tag:`div[data-link-ref-def]`}]},renderHTML({node:e}){let{label:t,href:S,title:w}=e.attrs,E=w?`[${t}]: ${S} "${w}"`:`[${t}]: ${S}`;return[`div`,{"data-link-ref-def":``,class:`link-ref-def`},E]}});function isBulletList(e){return e.type.name===`list`&&!e.attrs.ordered}function isOrderedList(e){return e.type.name===`list`&&!!e.attrs.ordered}function hasTaskItems(e){let t=!1;return e.forEach(e=>{e.type.name===`listItem`&&e.attrs.checked!==null&&(t=!0)}),t}function toggleListKind(e,t,S,w,E,D,O){let k=findParentNode(e=>e.type.name===`list`)(e.selection);if(k&&E(k.node)){let{$from:S,$to:E}=e.selection;return S.blockRange(E)?liftListItem$1(w)(e,t):!1}if(k){if(!t)return!0;let{tr:S}=e;return S.setNodeMarkup(k.pos,void 0,{...k.node.attrs,...D}),O!==void 0&&k.node.forEach((e,t)=>{if(e.type.name===`listItem`){let w=k.pos+1+t;S.setNodeMarkup(w,void 0,{...e.attrs,...O})}}),t(S),!0}return wrapInList$1(S,D)(e,void 0)?t?wrapInList$1(S,D)(e,S=>{if(O){let t=S.mapping.map(e.selection.$from.pos),w=S.doc.resolve(t);for(let e=w.depth;e>0;e--){let t=w.node(e);if(t.type.name===`listItem`){S.setNodeMarkup(w.before(e),void 0,{...t.attrs,...O});break}}}t(S)}):!0:!1}const ListNode=Node3.create({name:`list`,group:`block list`,content:`listItem+`,priority:60,addAttributes(){return{ordered:{default:!1},start:{default:1},spread:{default:!1},bulletMarker:{default:null},listMarkerDelimiter:{default:null}}},parseHTML(){return[{tag:`ul`,getAttrs:()=>({ordered:!1})},{tag:`ol`,getAttrs:e=>({ordered:!0,start:e.getAttribute(`start`)?Number(e.getAttribute(`start`)):1})}]},renderHTML({node:e,HTMLAttributes:t}){let S=e.attrs.ordered?`ol`:`ul`,w={};return e.attrs.ordered&&e.attrs.start!==1&&(w.start=e.attrs.start),[S,mergeAttributes(t,w),0]},addCommands(){return{toggleBulletList:()=>({state:e,dispatch:t})=>{let S=e.schema.nodes.list,w=e.schema.nodes.listItem;return!S||!w?!1:toggleListKind(e,t,S,w,e=>isBulletList(e)&&!hasTaskItems(e),{ordered:!1},{checked:null})},toggleOrderedList:()=>({state:e,dispatch:t})=>{let S=e.schema.nodes.list,w=e.schema.nodes.listItem;return!S||!w?!1:toggleListKind(e,t,S,w,e=>isOrderedList(e),{ordered:!0},{checked:null})},toggleTaskList:()=>({state:e,dispatch:t})=>{let S=e.schema.nodes.list,w=e.schema.nodes.listItem;return!S||!w?!1:toggleListKind(e,t,S,w,e=>isBulletList(e)&&hasTaskItems(e),{ordered:!1},{checked:!1})}}},addInputRules(){return[wrappingInputRule({find:/^\s*([-+*])(?!\s*\[[ xX]\])\s$/,type:this.type,getAttributes:e=>({ordered:!1,bulletMarker:e[1]})}),wrappingInputRule({find:/^\s*(\d+)([.)])\s$/,type:this.type,getAttributes:e=>({ordered:!0,start:Number(e[1]),listMarkerDelimiter:e[2]})}),new InputRule({find:/^\s*[-*+]\s\[([ xX])\]\s$/,handler:({state:e,range:t,match:S})=>{let w=e.schema.nodes.list;if(!w)return null;let E=S[1]!==` `,D=e.tr.delete(t.from,t.to),O=D.doc.resolve(t.from).blockRange();if(!O)return null;let k=findWrapping(O,w,{ordered:!1});if(!k)return null;D.wrap(O,k);let j=D.doc.resolve(D.mapping.map(t.from));for(let e=j.depth;e>0;e--){let t=j.node(e);if(t.type.name===`listItem`){D.setNodeMarkup(j.before(e),void 0,{...t.attrs,checked:E});break}}}})]},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList(),"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList(),"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),ListItemNode=Node3.create({name:`listItem`,content:`paragraph block*`,defining:!0,addAttributes(){return{checked:{default:null},spread:{default:!1}}},parseHTML(){return[{tag:`li`,getAttrs:e=>{let t=e.querySelector(`input[type="checkbox"]`);return{checked:t?t.checked:null}}}]},renderHTML({node:e,HTMLAttributes:t}){return e.attrs.checked===null?[`li`,mergeAttributes(t),0]:[`li`,mergeAttributes(t,{"data-type":`taskItem`,"data-checked":e.attrs.checked?`true`:`false`}),[`label`,{contenteditable:`false`},[`input`,{type:`checkbox`,...e.attrs.checked?{checked:`checked`}:{}}]],[`div`,0]]},addNodeView(){return({node:e,getPos:t,editor:S,HTMLAttributes:w})=>{let E=document.createElement(`li`);Object.entries(mergeAttributes(w,e.attrs.checked===null?{}:{"data-type":`taskItem`,"data-checked":String(!!e.attrs.checked)})).forEach(([e,t])=>{t!=null&&E.setAttribute(e,String(t))});let D=null,O=null,k=document.createElement(`div`);return e.attrs.checked!==null&&(D=document.createElement(`label`),D.contentEditable=`false`,O=document.createElement(`input`),O.type=`checkbox`,O.checked=!!e.attrs.checked,S.isEditable||(O.disabled=!0),O.addEventListener(`change`,()=>{let w=t();w===void 0||typeof w!=`number`||S.view.dispatch(S.view.state.tr.setNodeMarkup(w,void 0,{...e.attrs,checked:O?.checked??!1}))}),D.appendChild(O),E.appendChild(D)),E.appendChild(k),{dom:E,contentDOM:k,update(t){return t.type!==e.type||t.attrs.checked!==null!=(e.attrs.checked!==null)?!1:(O&&t.attrs.checked!==null&&(O.checked=!!t.attrs.checked,E.setAttribute(`data-checked`,String(!!t.attrs.checked))),e=t,!0)}}}},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>{let{$from:e}=this.editor.state.selection;for(let t=e.depth;t>0;t--)if(e.node(t).type.name===`listItem`)return this.editor.commands.sinkListItem(this.name);return!1},"Shift-Tab":()=>{let{$from:e}=this.editor.state.selection;for(let t=e.depth;t>0;t--)if(e.node(t).type.name===`listItem`)return this.editor.commands.liftListItem(this.name);return!1}}}}),List=ListNode,ListItem=ListItemNode,MathInline=Node3.create({name:`mathInline`,group:`inline`,inline:!0,atom:!0,selectable:!0,priority:60,addAttributes(){return{formula:{default:``},id:{default:null},language:{default:`latex`}}},parseHTML(){return[{tag:`span[data-math-inline]`,getAttrs:e=>typeof e==`string`?!1:{formula:e.getAttribute(`data-formula`)||``,id:e.getAttribute(`id`)||null,language:e.getAttribute(`data-language`)||`latex`}}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-math-inline":``,"data-formula":e.formula,"data-language":e.language,...e.id?{id:e.id}:{}}]},addCommands(){return{insertMathInline:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{formula:e}})}}}),RawMdxFallback=Node3.create({name:`rawMdxFallback`,group:`block`,atom:!1,content:`text*`,isolating:!0,selectable:!0,defining:!0,priority:60,addAttributes(){return{reason:{default:``},originalSpan:{default:{start:0,end:0}}}},parseHTML(){let e=e=>typeof e==`string`?!1:{reason:e.getAttribute(`data-reason`)||``};return[{tag:`div[data-raw-mdx-fallback]`,getAttrs:e},{tag:`pre[data-raw-mdx-fallback]`,getAttrs:e}]},renderHTML({HTMLAttributes:e}){return[`div`,{"data-raw-mdx-fallback":``,"data-raw-badge":`raw`,"data-reason":e.reason,contenteditable:`false`,class:`raw-mdx-fallback`},0]},addNodeView(){return({HTMLAttributes:e})=>{let t=document.createElement(`div`);t.setAttribute(`data-raw-mdx-fallback`,``),t.setAttribute(`data-raw-badge`,`raw`),t.setAttribute(`contenteditable`,`false`),t.classList.add(`raw-mdx-fallback`),e.reason&&t.setAttribute(`data-reason`,e.reason);let S=document.createElement(`pre`);return S.classList.add(`raw-mdx-fallback-content`),S.setAttribute(`contenteditable`,`false`),t.appendChild(S),{dom:t,contentDOM:S,ignoreMutation:()=>!0}}}}),BlockquoteFidelity=index_default$3.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceMarkerSpacings:{default:null}}}}),CodeMarkFidelity=index_default$2.extend({excludes:``,addAttributes(){return{...this.parent?.(),sourceFenceChar:{default:"`"},sourceFenceLength:{default:1}}}}),CommentBlock=Node3.create({name:`commentBlock`,group:`block`,content:`block+`,defining:!0,priority:60,addAttributes(){return{sourceForm:{default:`percent`,parseHTML:e=>e.getAttribute(`data-source-form`)===`html`?`html`:`percent`,renderHTML:e=>e.sourceForm===`html`?{"data-source-form":`html`}:{}},sourceLayout:{default:`block`,parseHTML:e=>e.getAttribute(`data-source-layout`)===`inline`?`inline`:`block`,renderHTML:e=>e.sourceLayout===`inline`?{"data-source-layout":`inline`}:{}}}},parseHTML(){return[{tag:`aside[data-comment-block]`},{tag:`aside.comment-block`}]},renderHTML({HTMLAttributes:e}){return[`aside`,{"data-comment-block":``,"data-clipboard-omit":`true`,class:`comment-block`,style:`display: none;`,...e},0]},addCommands(){return{setCommentBlock:()=>({commands:e})=>e.wrapIn(this.name),toggleCommentBlock:()=>({commands:e})=>e.toggleWrap(this.name),unsetCommentBlock:()=>({commands:e})=>e.lift(this.name)}}}),CommentMark=Mark.create({name:`comment`,priority:10,excludes:``,inclusive:!1,addAttributes(){return{sourceForm:{default:`percent`,parseHTML:e=>e.getAttribute(`data-source-form`)===`html`?`html`:`percent`,renderHTML:e=>e.sourceForm===`html`?{"data-source-form":`html`}:{}}}},parseHTML(){return[{tag:`span[data-comment-mark]`}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-comment-mark":``,"data-clipboard-omit":`true`,class:`comment-mark`,style:`display: none;`,...e},0]},addCommands(){return{setComment:()=>({commands:e})=>e.setMark(this.name),toggleComment:()=>({commands:e})=>e.toggleMark(this.name),unsetComment:()=>({commands:e})=>e.unsetMark(this.name)}}}),FootnoteDefinition=Node3.create({name:`footnoteDefinition`,group:`block`,content:`block+`,defining:!0,priority:60,addAttributes(){return{identifier:{default:``},label:{default:null}}},parseHTML(){let e=e=>{if(typeof e==`string`)return!1;let t=e.getAttribute(`data-footnote-id`)||``;return{identifier:t,label:t||null}};return[{tag:`aside[data-footnote-def]`,getAttrs:e},{tag:`aside.footnote-def`,getAttrs:e}]},renderHTML({node:e,HTMLAttributes:t}){let S=String(e.attrs.identifier??``);return[`aside`,{...t,"data-footnote-def":``,"data-footnote-id":S,id:`fn-${S}`,class:`footnote-def`},[`div`,{class:`footnote-body`},0],[`a`,{href:`#fnref-${S}`,class:`footnote-backref`,contentEditable:`false`,"aria-label":`Back to reference`},`↩`]]},addCommands(){return{insertFootnoteDefinition:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{identifier:e,label:e},content:[{type:`paragraph`}]})}}}),FootnoteReference=Node3.create({name:`footnoteReference`,group:`inline`,inline:!0,atom:!0,selectable:!0,draggable:!1,priority:60,addAttributes(){return{identifier:{default:``},label:{default:null}}},parseHTML(){return[{tag:`sup[data-footnote-ref]`,getAttrs:e=>{if(typeof e==`string`)return!1;let t=e.getAttribute(`data-footnote-id`)||``;return{identifier:t,label:t||null}}}]},renderHTML({node:e}){let t=String(e.attrs.identifier??``);return[`sup`,{id:`fnref-${t}`,"data-footnote-ref":``,"data-footnote-id":t,class:`footnote-ref`},[`a`,{href:`#fn-${t}`,class:`footnote-ref-link`},`[${t}]`]]},addCommands(){return{insertFootnoteReference:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{identifier:e,label:e}})}}}),ImageReferenceFidelity=Node3.create({name:`imageReference`,group:`inline`,inline:!0,atom:!0,priority:60,addAttributes(){return{alt:{default:``},label:{default:``},identifier:{default:``},referenceType:{default:`shortcut`}}},parseHTML(){return[{tag:`img[data-image-reference]`}]},renderHTML({node:e}){let{alt:t,label:S,referenceType:w}=e.attrs,E=t||S;return[`img`,{"data-image-reference":``,"data-reference-type":w,"data-label":S,alt:E}]}}),SourceLiteralMark=Mark.create({name:`sourceLiteral`,priority:10,excludes:``,inclusive:!1,addAttributes(){return{sourceRaw:{default:``}}},parseHTML(){return[{tag:`span[data-source-literal]`}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-source-literal":``,...e},0]}});function isValidSourceLiteralRaw(e,t){if(typeof e!=`string`||typeof t!=`string`||/[\x00-\x1F\x7F]/.test(e))return!1;let S=e.replaceAll(`\xA0`,` `),w=t.replaceAll(`\xA0`,` `);return S===w?!0:stripMarkdownBackslashEscapes(S)===w}function stripMarkdownBackslashEscapes(e){return e.replace(/\\([!-/:-@[-`{-~])/g,`$1`)}const TableFidelity=Table.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceDashCounts:{default:null}}}}),TableCellFidelity=TableCell.extend({priority:60,addAttributes(){return{...this.parent?.(),sourcePadding:{default:null}}}}),TableHeaderFidelity=TableHeader.extend({priority:60,addAttributes(){return{...this.parent?.(),sourcePadding:{default:null}}}}),Tag=Node3.create({name:`tag`,group:`inline`,inline:!0,atom:!0,selectable:!0,priority:60,addAttributes(){return{value:{default:``}}},parseHTML(){return[{tag:`a[data-tag]`,getAttrs:e=>typeof e==`string`?!1:{value:e.getAttribute(`data-tag`)||``}}]},renderHTML({node:e,HTMLAttributes:t}){let S=String(e.attrs.value??``);return[`a`,{...t,"data-tag":S,href:`#tag/${S}`,class:`tag`},`#${S}`]},addCommands(){return{insertTag:e=>({chain:t})=>t().insertContent({type:`tag`,attrs:{value:e}}).run()}}}),THEMATIC_BREAK_INPUT_RE=/^(?:---|—-|___\s|\*\*\*\s)$/;function thematicBreakSourceRawFromMatch(e){let t=String(e[0]??``).replace(/\s+$/,``);return t===`—-`?`---`:t}const ThematicBreakFidelity=index_default$1.extend({name:`thematicBreak`,priority:60,addAttributes(){return{...this.parent?.(),sourceRaw:{default:`---`}}},addInputRules(){return[nodeInputRule({find:THEMATIC_BREAK_INPUT_RE,type:this.type,getAttributes:e=>({sourceRaw:thematicBreakSourceRawFromMatch(e)})})]}});function normalizeNullableString(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function getWikiLinkText(e){return e.alias?e.alias:e.anchor?`${e.target}#${e.anchor}`:e.target}const WikiLink=Node3.create({name:`wikiLink`,group:`inline`,inline:!0,atom:!0,priority:60,addAttributes(){return{target:{default:``},alias:{default:null},anchor:{default:null},resolved:{default:!1}}},parseHTML(){return[{tag:`span[data-wiki-link]`,getAttrs:e=>typeof e==`string`?!1:{target:e.getAttribute(`data-target`)||``,alias:normalizeNullableString(e.getAttribute(`data-alias`)),anchor:normalizeNullableString(e.getAttribute(`data-anchor`)),resolved:e.getAttribute(`data-resolved`)===`true`}},{tag:`a.wiki-link[data-target]`,priority:100,getAttrs:e=>{if(typeof e==`string`)return!1;let t=e.getAttribute(`data-target`)??``;return t?{target:t,alias:normalizeNullableString(e.getAttribute(`data-alias`)),anchor:normalizeNullableString(e.getAttribute(`data-anchor`)),resolved:!1}:!1}}]},renderHTML({node:e,HTMLAttributes:t}){let S=String(e.attrs.target??``),w=normalizeNullableString(e.attrs.alias),E=normalizeNullableString(e.attrs.anchor),D=e.attrs.resolved===!0;return[`span`,{...t,"data-wiki-link":``,"data-target":S,"data-alias":w??``,"data-anchor":E??``,"data-resolved":D?`true`:`false`},getWikiLinkText({target:S,alias:w,anchor:E})]}});function extensionOf(e){let t=e.split(`/`).pop()??e,S=t.lastIndexOf(`.`);return S<=0||S===t.length-1?``:t.slice(S+1).toLowerCase()}function labelFor(e){return e.alias?e.alias:e.anchor?`${e.target}#${e.anchor}`:e.target}const WikiLinkEmbed=Node3.create({name:`wikiLinkEmbed`,group:`inline`,inline:!0,atom:!0,priority:60,addAttributes(){return{target:{default:``},alias:{default:null},anchor:{default:null},resolvedSrc:{default:null,rendered:!1,parseHTML:()=>null}}},parseHTML(){let e=e=>typeof e==`string`||!e.hasAttribute(`data-wiki-embed`)?!1:{target:e.getAttribute(`data-target`)||``,alias:normalizeNullableString(e.getAttribute(`data-alias`)),anchor:normalizeNullableString(e.getAttribute(`data-anchor`))};return[{tag:`img[data-wiki-embed]`,getAttrs:e,priority:100},{tag:`a[data-wiki-embed]`,getAttrs:e,priority:100}]},renderHTML({node:e,HTMLAttributes:t}){let S=String(e.attrs.target??``),w=normalizeNullableString(e.attrs.alias),E=normalizeNullableString(e.attrs.anchor),D=normalizeNullableString(e.attrs.resolvedSrc),O=extensionOf(S);if(IMAGE_EXTENSIONS.has(O))return[`img`,{...t,"data-wiki-embed":``,"data-target":S,"data-alias":w??``,"data-anchor":E??``,src:D??S,alt:w??S}];let k=D??S;return[`a`,{...t,"data-wiki-embed":``,"data-target":S,"data-alias":w??``,"data-anchor":E??``,href:E?`${k}#${E}`:k,target:`_blank`,rel:`noopener noreferrer`},labelFor({target:S,alias:w,anchor:E})]}}),sharedExtensions=[JsxComponent,RawMdxFallback,JsxInline,MathInline,WikiLink,WikiLinkEmbed,Tag,List,ListItem,EmphasisFidelity,StrongFidelity,CodeMarkFidelity,CodeBlockFidelity,BlockquoteFidelity,HeadingFidelity,ThematicBreakFidelity,LinkFidelity,HtmlBlockFidelity,LinkRefDefFidelity,HardBreakFidelity,EscapeMark,SourceLiteralMark,index_default.configure({undoRedo:!1,bulletList:!1,orderedList:!1,listItem:!1,italic:!1,bold:!1,code:!1,codeBlock:!1,heading:!1,horizontalRule:!1,hardBreak:!1,link:!1,blockquote:!1,dropcursor:{color:`color-mix(in oklch, var(--primary) 50%, transparent)`,width:2}}),TableFidelity.configure({resizable:!0}),TableRow,TableHeaderFidelity,TableCellFidelity,ImageSrcFidelity.configure({inline:!0}),ImageReferenceFidelity,index_default$4,CommentMark,CommentBlock,FootnoteReference,FootnoteDefinition],FRONTMATTER_TAG_VALUE_RE=/^[a-zA-Z][\w/-]*$/;function stripLeadingHash(e){return e.startsWith(`#`)?e.slice(1):e}function coerceCandidates(e){return typeof e==`string`?[e]:Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function extractFrontmatterTags(e){if(!e||e.trim()===``)return[];let{map:t}=parseFrontmatterYaml(e);if(!t)return[];let S=coerceCandidates(t.tags),w=[];for(let e of S){let t=stripLeadingHash(e);FRONTMATTER_TAG_VALUE_RE.test(t)?w.push(t):console.warn(`[frontmatter-tags] dropping invalid tag entry: ${JSON.stringify(e)}`)}return w}const safeDocNameField=string$2().refine(e=>!e.includes(`..`)&&!e.startsWith(`/`)&&!e.includes(`\0`)&&!e.includes(`\\`),{message:`docName contains unsafe path characters`}).optional(),agentIdentityFields={agentId:string$2().optional(),agentName:string$2().optional(),colorSeed:string$2().optional(),clientName:string$2().optional(),clientVersion:string$2().optional(),label:string$2().optional()},summaryField=string$2().optional(),URN_UUID_RE=/^urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,ShareConstructUrlRequestSchema=object$1({docPath:string$2().min(1)}).loose(),ShareConstructUrlErrorCodeSchema=_enum([`no-remote`,`detached-head`,`branch-not-on-origin`,`non-github-remote`,`invalid-path`]),ShareConstructUrlResponseSchema=discriminatedUnion(`ok`,[object$1({ok:literal(!0),shareUrl:string$2().min(1),blobUrl:string$2().min(1),branch:string$2().min(1)}).loose(),object$1({ok:literal(!1),error:ShareConstructUrlErrorCodeSchema,branch:string$2().min(1).optional()}).loose()]),SharePublishOwnerKindSchema=_enum([`user`,`org`]),SharePublishOwnerSchema=object$1({login:string$2().min(1),kind:SharePublishOwnerKindSchema,avatarUrl:string$2().optional()}).loose(),SharePublishOwnersErrorCodeSchema=_enum([`auth-required`,`network`]),SharePublishOwnersResponseSchema=discriminatedUnion(`ok`,[object$1({ok:literal(!0),owners:array(SharePublishOwnerSchema)}).loose(),object$1({ok:literal(!1),error:SharePublishOwnersErrorCodeSchema}).loose()]),SharePublishNameCheckResponseSchema=discriminatedUnion(`ok`,[object$1({ok:literal(!0),available:boolean$1()}).loose(),object$1({ok:literal(!1),error:SharePublishOwnersErrorCodeSchema}).loose()]),SharePublishVisibilitySchema=_enum([`public`,`private`]),SharePublishRequestSchema=object$1({owner:string$2().min(1),name:string$2().min(1),visibility:SharePublishVisibilitySchema,description:string$2().optional()}).loose(),SharePublishErrorCodeSchema=_enum([`name-conflict`,`saml-sso`,`auth-required`,`push-failed`,`init-failed`,`network`,`no-project`]),SharePublishResponseSchema=discriminatedUnion(`ok`,[object$1({ok:literal(!0),ownerLogin:string$2().min(1),repoName:string$2().min(1),cloneUrl:string$2().min(1),defaultBranch:string$2().min(1)}).loose(),object$1({ok:literal(!1),error:SharePublishErrorCodeSchema}).loose()]);function isValidBranchName(e){return!(typeof e!=`string`||e.length===0||e.startsWith(`-`)||/[\x00-\x1F\x7F]/.test(e)||/\s/.test(e)||e.includes(`:`)||e.split(`/`).includes(`..`))}const refineBranchName=e=>e.refine(isValidBranchName,`invalid branch name`);function isBranchNotFoundGitError(e){if(e==null)return!1;let t=e instanceof Error?e.message:String(e);return/couldn'?t find remote ref|Remote branch .+ not found/i.test(t)}const BranchInfoSharedFields={shareFileExists:boolean$1(),dirtyConflicts:object$1({conflicts:boolean$1(),files:array(string$2().min(1))}).loose(),branchIsLocal:boolean$1()},BranchInfoResponseSchema=discriminatedUnion(`detached`,[object$1({detached:literal(!1),currentBranch:string$2().min(1).nullable(),currentHeadSha:_null(),...BranchInfoSharedFields}).loose(),object$1({detached:literal(!0),currentBranch:_null(),currentHeadSha:string$2().min(1),...BranchInfoSharedFields}).loose()]),CheckoutRequestSchema=object$1({branch:refineBranchName(string$2().min(1)),principalId:string$2().optional()}).loose(),CheckoutFailureReasonSchema=_enum([`dirty-conflict`,`branch-not-found`,`fetch-failed`,`checkout-failed`]),CheckoutResponseSchema=discriminatedUnion(`ok`,[object$1({ok:literal(!0)}).loose(),object$1({ok:literal(!1),reason:CheckoutFailureReasonSchema,files:array(string$2().min(1)).optional()}).loose()]),ServerInfoSuccessSchema=object$1({serverInstanceId:string$2().min(1),currentBranch:string$2().min(1).optional(),currentDiskAckSVs:record(string$2().min(1),string$2().min(1)).optional()}).loose(),PrincipalSuccessSchema=object$1({id:string$2().min(1),display_name:string$2().min(1),display_email:string$2(),source:_enum([`git-config`,`synthesized`]),created_at:string$2().min(1)}).loose(),ProblemTypeSchema=_enum(`urn:ok:error:malformed-upload.urn:ok:error:collision-exhaustion.urn:ok:error:storage-full.urn:ok:error:storage-readonly.urn:ok:error:storage-error.urn:ok:error:no-file-received.urn:ok:error:path-escape.urn:ok:error:method-not-allowed.urn:ok:error:invalid-request.urn:ok:error:payload-too-large.urn:ok:error:request-timeout.urn:ok:error:internal-server-error.urn:ok:error:loopback-required.urn:ok:error:invalid-origin.urn:ok:error:url-not-allowed.urn:ok:error:dir-outside-home.urn:ok:error:concurrent-operation.urn:ok:error:clone-failed.urn:ok:error:clone-timeout.urn:ok:error:server-start-failed.urn:ok:error:reserved-doc-name.urn:ok:error:target-not-found.urn:ok:error:stale-target.urn:ok:error:frontmatter-edit-not-supported.urn:ok:error:invalid-frontmatter-patch.urn:ok:error:no-active-session.urn:ok:error:too-many-agent-sessions.urn:ok:error:doc-not-found.urn:ok:error:doc-already-exists.urn:ok:error:doc-not-open.urn:ok:error:rollback-not-configured.urn:ok:error:doc-not-available.urn:ok:error:backlink-index-not-configured.urn:ok:error:file-rescan-not-configured.urn:ok:error:shadow-not-configured.urn:ok:error:host-not-allowed.urn:ok:error:principal-not-available.urn:ok:error:not-found.urn:ok:error:auth-failed.urn:ok:error:no-project-dir.urn:ok:error:server-open-failed.urn:ok:error:doc-in-conflict.urn:ok:error:no-conflict-tracked.urn:ok:error:sync-not-active.urn:ok:error:project-repo-not-configured.urn:ok:error:seed-prerequisite-missing.urn:ok:error:seed-invalid-root.urn:ok:error:tag-index-not-configured.urn:ok:error:template-not-found.urn:ok:error:unsupported-asset-type.urn:ok:error:asset-not-found.urn:ok:error:collab-server-not-running.urn:ok:error:gateway-timeout.urn:ok:error:cursor-not-installed.urn:ok:error:cursor-spawn-timeout.urn:ok:error:cursor-spawn-failed.urn:ok:error:handoff-target-not-installed.urn:ok:error:handoff-spawn-timeout.urn:ok:error:handoff-spawn-failed`.split(`.`));function assertNeverProblemType(e){throw Error(`Unexpected ProblemType variant: ${JSON.stringify(e)}`)}const ProblemDetailsSchema=object$1({type:ProblemTypeSchema,title:string$2().min(1),status:number$1().int().min(400).max(599),instance:string$2().regex(URN_UUID_RE,`instance must be urn:uuid:<uuid>`).optional(),detail:string$2().optional()}).loose(),UploadRequestSchema=object$1({parentDocName:string$2().min(1),agentId:string$2().min(1).optional(),agentName:string$2().min(1).optional()}).loose(),UploadAssetSuccessSchema=object$1({src:string$2().min(1),path:string$2().min(1).optional(),deduped:boolean$1().optional()}).loose(),LocalOpCloneRequestSchema=object$1({url:string$2().min(1),dir:string$2().min(1),branch:string$2().min(1).refine(isValidBranchName,`invalid branch name`).optional()}).loose(),StreamingProblemEventSchema=object$1({type:literal(`error`),problem:ProblemDetailsSchema}).loose();function reconstructAttrs(e,t){let S=Array.isArray(e.attrs.attributes)?e.attrs.attributes.filter(e=>typeof e==`object`&&!!e&&`type`in e):[],w=e.attrs.props??{},E=new Map,D=new Set;if(t)for(let e of t)e.omitOnDefault===!0&&`defaultValue`in e&&e.defaultValue!==void 0&&E.set(e.name,e.defaultValue),e.type===`string`&&e.required===!1&&e.defaultValue===void 0&&D.add(e.name);for(let[e,t]of Object.entries(w)){let w=S.findIndex(t=>t.type===`mdxJsxAttribute`&&t.name===e);if(E.has(e)&&Object.is(E.get(e),t)){w>=0&&S.splice(w,1);continue}if(D.has(e)&&t===``){w>=0&&S.splice(w,1);continue}let O=propToMdxJsxAttribute(e,t);w>=0?S[w]=O:S.push(O)}return S}function propToMdxJsxAttribute(e,t){if(t===!0)return{type:`mdxJsxAttribute`,name:e,value:null};if(t===!1)return{type:`mdxJsxAttribute`,name:e,value:{type:`mdxJsxAttributeValueExpression`,value:`false`}};if(t==null)return{type:`mdxJsxAttribute`,name:e,value:null};if(typeof t==`string`)return{type:`mdxJsxAttribute`,name:e,value:t};if(typeof t==`number`)return{type:`mdxJsxAttribute`,name:e,value:{type:`mdxJsxAttributeValueExpression`,value:JSON.stringify(t)}};if(typeof t==`object`){let S;try{S=JSON.stringify(t)}catch{S=String(t)}return{type:`mdxJsxAttribute`,name:e,value:{type:`mdxJsxAttributeValueExpression`,value:S}}}return{type:`mdxJsxAttribute`,name:e,value:String(t)}}function emitMdxJsx(e,t,S,w){return{type:`mdxJsxFlowElement`,name:e,attributes:reconstructAttrs(t,w),children:S.all(t),data:{}}}const LOOM_ID_RE=/^[A-Za-z0-9]{20,}$/,LOOM_TIMESTAMP_RE=/^(?:\d+s?|(?:\d+h)?(?:\d+m)?(?:\d+s)?)$/;function isLoomHost(e){let t=e.toLowerCase();return t===`loom.com`||t===`www.loom.com`}function extractLoomId(e){let t=e.pathname.match(/^\/(?:share|embed)\/([A-Za-z0-9]+)\/?$/);if(!t)return null;let S=t[1]??``;return LOOM_ID_RE.test(S)?S:null}function parseLoomUrl(e){if(typeof e!=`string`||e.length===0)return null;let t;try{t=new URL(e)}catch{return null}if(t.protocol!==`http:`&&t.protocol!==`https:`||!isLoomHost(t.hostname))return null;let S=extractLoomId(t);if(!S)return null;let w=t.searchParams.get(`t`);return{id:S,startRaw:w&&w.length>0&&LOOM_TIMESTAMP_RE.test(w)?w:null}}function isLoomUrl(e){return parseLoomUrl(e)!==null}function isVimeoHost(e){let t=e.toLowerCase();return t===`vimeo.com`||t===`www.vimeo.com`||t===`player.vimeo.com`}function isVimeoUrl(e){if(typeof e!=`string`||e.length===0)return!1;let t;try{t=new URL(e)}catch{return!1}return t.protocol!==`http:`&&t.protocol!==`https:`?!1:isVimeoHost(t.hostname)}const YOUTUBE_VIDEO_ID_RE=/^[A-Za-z0-9_-]{11}$/;function isYouTubeHost(e){let t=e.toLowerCase();return t===`youtube.com`||t===`www.youtube.com`||t===`m.youtube.com`||t===`music.youtube.com`||t===`youtu.be`||t===`youtube-nocookie.com`||t===`www.youtube-nocookie.com`}function parseTimestampToSeconds(e){if(e.length===0)return null;if(/^[0-9]+$/.test(e)){let t=Number.parseInt(e,10);return t>0?t:null}let t=e.match(/^(?:([0-9]+)h)?(?:([0-9]+)m)?(?:([0-9]+)s?)?$/);if(!t)return null;let S=t[1]?Number.parseInt(t[1],10):0,w=t[2]?Number.parseInt(t[2],10):0,E=t[3]?Number.parseInt(t[3],10):0,D=S*3600+w*60+E;return D>0?D:null}function extractVideoId(e){if(e.hostname.toLowerCase()===`youtu.be`){let t=e.pathname.replace(/^\//,``).split(`/`)[0]??``;return YOUTUBE_VIDEO_ID_RE.test(t)?t:null}if(e.pathname===`/watch`){let t=e.searchParams.get(`v`)??``;return YOUTUBE_VIDEO_ID_RE.test(t)?t:null}let t=e.pathname.match(/^\/(?:embed|shorts|v)\/([A-Za-z0-9_-]{11})\/?$/);return t?t[1]??null:null}function parseYouTubeUrl(e){if(typeof e!=`string`||e.length===0)return null;let t;try{t=new URL(e)}catch{return null}if(t.protocol!==`http:`&&t.protocol!==`https:`||!isYouTubeHost(t.hostname))return null;let S=extractVideoId(t);if(!S)return null;let w=t.searchParams.get(`t`)??t.searchParams.get(`start`)??``;return{id:S,startSeconds:w.length>0?parseTimestampToSeconds(w):null,noCookie:t.hostname.toLowerCase().endsWith(`youtube-nocookie.com`)}}const calloutProps=[{name:`type`,type:`enum`,enumValues:[`note`,`tip`,`important`,`warning`,`caution`,`abstract`,`info`,`todo`,`success`,`question`,`failure`,`danger`,`bug`,`example`,`quote`],defaultValue:`note`,required:!1,description:`Callout variant`},{name:`title`,type:`string`,required:!1,description:`Optional heading shown above the body`},{name:`icon`,type:`string`,required:!1,advanced:!0,description:"Custom lucide icon override (e.g. `lucide:Lightbulb`)"},{name:`color`,type:`string`,required:!1,advanced:!0,description:"Optional accent color override (hex — e.g. `#F05032`)"},{name:`collapsible`,type:`boolean`,required:!1,defaultValue:!1,advanced:!0,description:"Render as a foldable `<details>` (Obsidian `[!TYPE]+/-`)"},{name:`defaultOpen`,type:`boolean`,required:!1,defaultValue:!0,advanced:!0,description:`When collapsible, start in the open state`},{name:`children`,type:`reactnode`,required:!0,description:`Callout content`}],htmlImgProps=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Image source URL`,accept:ALLOWED_IMAGE_MIME_TYPES,autoFocus:!0},{name:`alt`,type:`string`,required:!0,description:`Alt text`},{name:`width`,type:`number`,required:!1,advanced:!0,description:`Image width`},{name:`height`,type:`number`,required:!1,advanced:!0,description:`Image height`},{name:`srcset`,type:`string`,required:!1,advanced:!0,description:`Responsive image candidate set (e.g. "x.png 1x, y.png 2x")`},{name:`sizes`,type:`string`,required:!1,advanced:!0,description:`Responsive image sizes hint paired with srcset`},{name:`loading`,type:`enum`,enumValues:[`eager`,`lazy`],defaultValue:`lazy`,required:!1,advanced:!0,omitOnDefault:!0,description:`Native img loading strategy (defaults to lazy)`},{name:`title`,type:`string`,required:!1,advanced:!0,description:`Native HTML title attribute (tooltip)`},{name:`decoding`,type:`enum`,enumValues:[`sync`,`async`,`auto`],defaultValue:`auto`,required:!1,advanced:!0,omitOnDefault:!0,description:`Hint for how the browser should decode the image`},{name:`fetchpriority`,type:`enum`,enumValues:[`high`,`low`,`auto`],defaultValue:`auto`,required:!1,advanced:!0,omitOnDefault:!0,description:`Resource fetch priority hint`},{name:`crossorigin`,type:`enum`,enumValues:[`anonymous`,`use-credentials`],required:!1,advanced:!0,description:`CORS mode for the image fetch`},{name:`referrerpolicy`,type:`string`,required:!1,advanced:!0,description:`Referrer policy for the image fetch (HTML referrerpolicy values)`},{name:`align`,type:`enum`,enumValues:[`center`,`left`,`right`],defaultValue:`center`,required:!1,omitOnDefault:!0,description:`Alignment within the column`}],embedProps=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Embedded page URL (must start with http:// or https://)`,autoFocus:!0},{name:`title`,type:`string`,required:!1,description:`Iframe title (accessible label for screen readers)`},{name:`width`,type:`string`,required:!1,advanced:!0,description:`Embed width as a CSS length (e.g. "100%", "640px")`},{name:`height`,type:`string`,required:!1,advanced:!0,description:`Embed height as a CSS length (e.g. "26rem", "480px")`},{name:`align`,type:`enum`,enumValues:[`center`,`left`,`right`],defaultValue:`center`,required:!1,omitOnDefault:!0,description:`Alignment within the column`}],htmlVideoProps=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Video source URL`,accept:ALLOWED_VIDEO_MIME_TYPES,autoFocus:!0},{name:`controls`,type:`boolean`,required:!1,defaultValue:!0,advanced:!0,omitOnDefault:!0,description:`Show native HTML5 video controls (defaults to true)`,hideWhen:e=>typeof e.src==`string`&&(isVimeoUrl(e.src)||isLoomUrl(e.src))},{name:`autoplay`,type:`boolean`,required:!1,advanced:!0,description:`Begin playback as soon as possible (usually requires muted)`},{name:`poster`,type:`string`,required:!1,advanced:!0,description:`Poster image URL shown before playback`,accept:ALLOWED_IMAGE_MIME_TYPES,hideWhen:e=>typeof e.src==`string`&&(isVimeoUrl(e.src)||isLoomUrl(e.src))},{name:`width`,type:`number`,required:!1,advanced:!0,description:`Video width`},{name:`height`,type:`number`,required:!1,advanced:!0,description:`Video height`},{name:`title`,type:`string`,required:!1,advanced:!0,description:`Native HTML title attribute (tooltip)`},{name:`muted`,type:`boolean`,required:!1,advanced:!0,description:`Mute audio on load`},{name:`loop`,type:`boolean`,required:!1,advanced:!0,description:`Restart from the beginning when playback ends`,hideWhen:e=>typeof e.src==`string`&&isLoomUrl(e.src)},{name:`playsinline`,type:`boolean`,required:!1,advanced:!0,description:`Play inline on iOS rather than entering fullscreen`,hideWhen:e=>typeof e.src==`string`&&(isVimeoUrl(e.src)||isLoomUrl(e.src))},{name:`preload`,type:`enum`,enumValues:[`none`,`metadata`,`auto`],required:!1,advanced:!0,description:`Hint for how much of the video to preload`,hideWhen:e=>typeof e.src==`string`&&(parseYouTubeUrl(e.src)!==null||isVimeoUrl(e.src)||isLoomUrl(e.src))}],htmlAudioProps=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Audio source URL`,accept:ALLOWED_AUDIO_MIME_TYPES,autoFocus:!0},{name:`controls`,type:`boolean`,required:!1,defaultValue:!0,advanced:!0,omitOnDefault:!0,description:`Show native HTML5 audio controls (defaults to true)`},{name:`autoplay`,type:`boolean`,required:!1,advanced:!0,description:`Begin playback as soon as possible (usually requires muted)`},{name:`title`,type:`string`,required:!1,advanced:!0,description:`Native HTML title attribute (tooltip)`},{name:`muted`,type:`boolean`,required:!1,advanced:!0,description:`Mute audio on load`},{name:`loop`,type:`boolean`,required:!1,advanced:!0,description:`Restart from the beginning when playback ends`},{name:`preload`,type:`enum`,enumValues:[`none`,`metadata`,`auto`],required:!1,advanced:!0,description:`Hint for how much of the audio to preload`}],accordionProps=[{name:`title`,type:`string`,required:!0,description:`Accordion heading shown inside the <summary>`},{name:`defaultOpen`,type:`boolean`,required:!1,defaultValue:!1,description:`When true, the accordion renders expanded on initial load`},{name:`icon`,type:`string`,required:!1,advanced:!0,description:"Custom lucide icon override (e.g. `lucide:Rocket`)"},{name:`description`,type:`string`,required:!1,advanced:!0,description:`Optional subtitle rendered below the title inside <summary>`},{name:`id`,type:`string`,required:!1,advanced:!0,description:"HTML id attribute for deep-linking (e.g. `#advanced-options`)"},{name:`name`,type:`string`,required:!1,advanced:!0,description:`HTML5 <details name=> group — siblings with the same name are mutually exclusive`}],gfmCalloutProps=[calloutProps[0],calloutProps[1],calloutProps[4],calloutProps[5],calloutProps[6]],commonMarkImageProps=[htmlImgProps[0],htmlImgProps[1],htmlImgProps[7]],htmlDetailsAccordionProps=[accordionProps[0],accordionProps[1],accordionProps[4],accordionProps[5]],wikiEmbedImageProps=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Alt text (Obsidian alias syntax: `![[file.png|alt text]]`)"}],wikiEmbedVideoProps=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Title text (Obsidian alias syntax: `![[clip.mp4|title]]`)"}],wikiEmbedAudioProps=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Title text (Obsidian alias syntax: `![[song.mp3|title]]`)"}],tabsProps=[{name:`id`,type:`string`,required:!1,advanced:!0,description:"HTML id attribute for deep-linking (e.g. `#install-tabs`)"}],tabProps=[{name:`label`,type:`string`,required:!0,autoFocus:!0,defaultValue:`Tab`,description:`Tab strip label — shown in the clickable pill at the top`},{name:`id`,type:`string`,required:!1,advanced:!0,description:"HTML id attribute for deep-linking (e.g. `#tab-npm`)"}],mathProps=[{name:`formula`,type:`string`,required:!0,autoFocus:!0,language:`latex`,description:`LaTeX math source (rendered with KaTeX in the browser)`},{name:`id`,type:`string`,required:!1,advanced:!0,description:"HTML id attribute for deep-linking (e.g. `#eq-pythagoras`)"},{name:`language`,type:`string`,required:!1,advanced:!0,description:"Forward-compat hint for the math source language (default `latex`). Reserved for future MathJax / Typst / AsciiMath substrates."}],dollarMathProps=[mathProps[0]],mathFenceProps=[mathProps[0]],mermaidProps=[{name:`chart`,type:`string`,required:!0,autoFocus:!0,language:`mermaid`,description:`Mermaid chart source (graph / flowchart / sequenceDiagram / class / state / etc.)`}],wikiEmbedFileProps=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Display name override (Obsidian alias syntax: `![[file.zip|label]]`)"}],fileProps=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`File URL`,accept:[`*/*`],autoFocus:!0}],pdfProps=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`PDF source URL`,accept:ALLOWED_PDF_MIME_TYPES,autoFocus:!0},{name:`title`,type:`string`,required:!1,advanced:!0,description:`Accessible label for the embedded PDF viewer`},{name:`anchor`,type:`string`,required:!1,advanced:!0,description:"PDF viewer parameters as a single URL-fragment string (e.g. `page=3&height=600`)"}],mirrorProps=[{name:`src`,type:`string`,required:!0,description:"Path of the source doc, extension-less (e.g. `api-spec`).",autoFocus:!0},{name:`anchor`,type:`string`,required:!0,description:"Id of the `<MirrorSource>` block within the source doc."}],mirrorSourceProps=[{name:`id`,type:`string`,required:!0,description:"Stable id agents and authors use to reference this block from `<Mirror>` elsewhere.",autoFocus:!0},{name:`children`,type:`reactnode`,required:!0,description:`Block content this MirrorSource owns — paragraphs, callouts, code, nested JSX, anything.`}];function escapeHtmlAttr(e){return e.replace(/&/g,`&`).replace(/"/g,`"`).replace(/</g,`<`).replace(/>/g,`>`)}function escapeHtmlText(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`)}function serializeWikiEmbed(e){let t=e.attrs.props,S=t?.target??``,w=typeof t?.alias==`string`&&t.alias.length>0?t.alias:null,E=typeof t?.anchor==`string`&&t.anchor.length>0?t.anchor:null,D=w??(E?`${S}#${E}`:S);return{type:`wikiLinkEmbed`,value:D,data:{target:S,anchor:E,alias:w},children:[{type:`text`,value:D}]}}const builtInComponents=[{name:`Callout`,surface:`canonical`,hasChildren:!0,props:calloutProps,icon:`MessageSquareWarning`,category:`content`,displayName:`Callout`,description:`Alert / admonition with 15 type variants — 5 GFM (note, tip, important, warning, caution) plus 10 Obsidian-parity (abstract, info, todo, success, question, failure, danger, bug, example, quote)`,searchTerms:[`note`,`tip`,`important`,`warning`,`caution`,`abstract`,`info`,`todo`,`success`,`question`,`failure`,`danger`,`bug`,`example`,`quote`,`alert`,`admonition`,`callout`],serialize:(e,t)=>emitMdxJsx(`Callout`,e,t,calloutProps)},{name:`img`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:htmlImgProps,icon:`Image`,category:`media`,displayName:`Image`,description:`Image with click-to-zoom and HTML-native attributes`,searchTerms:[`image`,`zoom`,`picture`,`photo`],placeholder:{label:`Add an image`},serialize:(e,t)=>emitMdxJsx(`img`,e,t,htmlImgProps)},{name:`video`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:htmlVideoProps,icon:`SquarePlay`,category:`media`,displayName:`Video`,description:`HTML5 video player with native controls`,searchTerms:[`video`,`media`,`player`,`mp4`,`webm`,`movie`],placeholder:{label:`Add a video`},serialize:(e,t)=>emitMdxJsx(`video`,e,t,htmlVideoProps)},{name:`audio`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:htmlAudioProps,icon:`Volume2`,category:`media`,displayName:`Audio`,description:`HTML5 audio player with native controls`,searchTerms:[`audio`,`sound`,`music`,`mp3`,`podcast`,`player`],placeholder:{label:`Add audio`},serialize:(e,t)=>emitMdxJsx(`audio`,e,t,htmlAudioProps)},{name:`Pdf`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:pdfProps,icon:`FileText`,category:`media`,displayName:`PDF`,description:"Embedded PDF viewer (`#page=N` to open at page N, `#height=N` for viewer height)",searchTerms:[`pdf`,`document`,`embed`,`pdfjs`],placeholder:{label:`Add a PDF`},serialize:(e,t)=>emitMdxJsx(`Pdf`,e,t,pdfProps)},{name:`File`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:fileProps,icon:`Paperclip`,category:`media`,displayName:`File`,description:`Downloadable file attachment — inline row with name + size + download link`,searchTerms:[`file`,`attachment`,`download`,`document`,`zip`,`docx`,`doc`],placeholder:{label:`Add a file`},serialize:(e,t)=>emitMdxJsx(`File`,e,t,fileProps)},{name:`Embed`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:embedProps,icon:`AppWindow`,category:`media`,displayName:`Embed`,description:`Inline web embed (iframe) — drop a URL, get a resizable preview pane`,searchTerms:[`embed`,`iframe`,`website`,`page`,`inline`,`frame`,`preview`],placeholder:{label:`Embed a URL`},serialize:(e,t)=>emitMdxJsx(`Embed`,e,t,embedProps)},{name:`Accordion`,surface:`canonical`,hasChildren:!0,props:accordionProps,icon:`ChevronRight`,category:`content`,displayName:`Accordion`,description:"Standalone expand/collapse via native HTML5 <details>/<summary>. Group siblings with the `name` prop for exclusive-accordion UX.",searchTerms:[`toggle`,`accordion`,`expandable`,`details`,`disclosure`,`collapse`,`fold`],exampleBody:`Body content revealed when the accordion is expanded.`,serialize:(e,t)=>emitMdxJsx(`Accordion`,e,t,accordionProps)},{name:`Tabs`,surface:`canonical`,hasChildren:!0,emptyChildName:`Tab`,props:tabsProps,icon:`LayoutPanelTop`,category:`content`,displayName:`Tabs`,description:"Horizontal tab strip + active panel below. Each `<Tab>` child is one panel; clickable pills at the top switch the active one. Active selection is ephemeral (resets on reload).",searchTerms:[`tabs`,`tabbed`,`panels`,`tabgroup`,`switcher`],exampleBody:`<Tab label="One">Body of the first tab panel.</Tab>
|
|
391
391
|
<Tab label="Two">Body of the second tab panel.</Tab>`,serialize:(e,t)=>emitMdxJsx(`Tabs`,e,t,tabsProps)},{name:`Tab`,surface:`canonical`,hasChildren:!0,props:tabProps,icon:`PanelTop`,category:`content`,displayName:`Tab`,description:"A single tab panel inside a `<Tabs>` container — carries the strip label and the block-content body.",searchTerms:[`tab`,`panel`],exampleBody:"Panel content — must be nested inside a `<Tabs>` parent.",serialize:(e,t)=>emitMdxJsx(`Tab`,e,t,tabProps)},{name:`Math`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:mathProps,icon:`Sigma`,category:`content`,displayName:`Math`,description:`Block math equation rendered with KaTeX from a LaTeX source string`,searchTerms:[`math`,`latex`,`equation`,`formula`,`katex`,`tex`],serialize:(e,t)=>emitMdxJsx(`Math`,e,t,mathProps)},{name:`MermaidFence`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:mermaidProps,icon:`Workflow`,category:`content`,displayName:`Mermaid`,description:"Diagram rendered from Mermaid source (flowchart, sequence, class, state, ER, gantt, pie). Authored exclusively as ` ```mermaid ` fenced code.",searchTerms:[`mermaid`,`diagram`,`flowchart`,`graph`,`sequence`,`sequencediagram`,`class`,`state`,`er`,`erdiagram`,`gantt`,`pie`,`chart`],serialize:e=>({type:`code`,lang:`mermaid`,meta:null,value:e.attrs.props?.chart??``})},{name:`Mirror`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:mirrorProps,icon:`CopyPlus`,category:`content`,displayName:`Mirror`,description:"Render a read-only copy of a `<MirrorSource>` block from another doc. Use to keep the same content in sync across multiple docs without copy-paste — edits land at the source, every Mirror reflects the change.",searchTerms:[`mirror`,`sync`,`synced`,`transclude`,`embed`,`reference`,`shared block`],serialize:(e,t)=>emitMdxJsx(`Mirror`,e,t,mirrorProps)},{name:`MirrorSource`,surface:`canonical`,hasChildren:!0,props:mirrorSourceProps,icon:`GitBranch`,category:`content`,displayName:`Mirror Source`,description:'Mark a block as the source of truth for content that appears in multiple docs. Wrap any block content; `<Mirror src="…" anchor="<id>">` references render this verbatim read-only at every call-site. Edit here, propagate everywhere.',searchTerms:[`mirror source`,`sync source`,`source block`,`master block`,`shared`],exampleBody:"Authoritative content lives inside this block — edits here propagate to every `<Mirror>` that references this id.",serialize:(e,t)=>emitMdxJsx(`MirrorSource`,e,t,mirrorSourceProps)},{name:`GFMCallout`,surface:`compat`,hasChildren:!0,props:gfmCalloutProps,icon:`MessageSquareWarning`,category:`content`,displayName:`GFM Callout`,description:"GFM blockquote alert (`> [!NOTE]`) — read-only compat. Preserves `> [!NOTE]` syntax on round-trip; insert a fresh Callout block for the full prop surface.",rendersAs:`Callout`,translateProps:e=>e,serialize:(e,t)=>{let S=e.attrs.props,w=new Set([`note`,`tip`,`important`,`warning`,`caution`,`abstract`,`info`,`todo`,`success`,`question`,`failure`,`danger`,`bug`,`example`,`quote`]),E=S?.type??`note`;return{type:`blockquote`,children:[{type:`html`,value:`[!${(w.has(E.toLowerCase())?E:`note`).toUpperCase()}]${S?.collapsible?S.defaultOpen===!1?`-`:`+`:``}${S?.title?` ${S.title}`:``}`},...t.all(e).filter(e=>{if(e.type!==`paragraph`)return!0;let t=e;return Array.isArray(t.children)&&t.children.length>0})]}}},{name:`CommonMarkImage`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:commonMarkImageProps,icon:`Image`,category:`media`,displayName:`CommonMark Image`,description:'CommonMark image (``) — read-only compat. Preserves `` syntax on round-trip; insert a fresh Image block for the full HTML-native attribute surface (srcset, sizes, decoding, etc.).',rendersAs:`img`,translateProps:e=>e,serialize:e=>{let t=e.attrs.props;return{type:`paragraph`,children:[{type:`image`,url:t?.sourceUrl??t?.src??``,alt:t?.alt??``,title:t?.title??null}]}}},{name:`WikiEmbedImage`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:wikiEmbedImageProps,icon:`ZoomIn`,category:`media`,displayName:`Wiki Embed Image`,description:"Obsidian-style `![[file.png]]` wiki-embed — read-only compat. Edit the alt-text via the alias slot; the embed target / anchor stay on the prop bag and round-trip byte-identical.",rendersAs:`img`,translateProps:e=>{let t=typeof e.alias==`string`&&e.alias.length>0?e.alias:null,S=typeof e.target==`string`?e.target:``;return{src:e.src,alt:t??S}},serialize:serializeWikiEmbed},{name:`WikiEmbedVideo`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:wikiEmbedVideoProps,icon:`Film`,category:`media`,displayName:`Wiki Embed Video`,description:"Obsidian-style `![[clip.mp4]]` wiki-embed — read-only compat. Edit the title via the alias slot; the embed target / anchor stay on the prop bag and round-trip byte-identical.",rendersAs:`video`,translateProps:e=>{let t=typeof e.alias==`string`&&e.alias.length>0?e.alias:null,S=typeof e.target==`string`?e.target:``;return{src:e.src,title:t??S}},serialize:serializeWikiEmbed},{name:`WikiEmbedAudio`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:wikiEmbedAudioProps,icon:`Volume2`,category:`media`,displayName:`Wiki Embed Audio`,description:"Obsidian-style `![[song.mp3]]` wiki-embed — read-only compat. Edit the title via the alias slot; the embed target / anchor stay on the prop bag and round-trip byte-identical.",rendersAs:`audio`,translateProps:e=>{let t=typeof e.alias==`string`&&e.alias.length>0?e.alias:null,S=typeof e.target==`string`?e.target:``;return{src:e.src,title:t??S}},serialize:serializeWikiEmbed},{name:`WikiEmbedFile`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:wikiEmbedFileProps,icon:`Paperclip`,category:`media`,displayName:`Wiki Embed File`,description:"Obsidian-style `![[file.zip]]` wiki-embed — read-only compat for arbitrary downloadable attachments. Renders through the `File` canonical (inline row with file-up icon + bold name + optional dim size). Edit the display name via the alias slot.",rendersAs:`File`,translateProps:e=>{let t=typeof e.alias==`string`&&e.alias.length>0?e.alias:null,S=typeof e.size==`string`&&e.size.length>0?e.size:null;return{src:e.src,name:t??void 0,size:S??void 0}},serialize:serializeWikiEmbed},{name:`HtmlDetailsAccordion`,surface:`compat`,hasChildren:!0,props:htmlDetailsAccordionProps,icon:`ChevronRight`,category:`content`,displayName:`HTML5 Details`,description:"HTML5 `<details><summary>` collapsible — read-only compat. Preserves `<details>` syntax on round-trip; insert a fresh Accordion block for icon / description / group-name props.",rendersAs:`Accordion`,translateProps:e=>e,serialize:(e,t)=>{let S=e.attrs.props,w=S?.defaultOpen?` open`:``,E=S?.name?` name="${escapeHtmlAttr(S.name)}"`:``,D=S?.id?` id="${escapeHtmlAttr(S.id)}"`:``,O=S?.title?.trim(),k=O?`<summary>${escapeHtmlText(O)}</summary>`:``;return{type:`mdxJsxFlowElement`,name:`HtmlDetailsAccordion`,attributes:[],children:t.all(e),data:{htmlBoundary:{opener:`<details${w}${E}${D}>\n${k}`,closer:`</details>`}}}}},{name:`DollarMath`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:dollarMathProps,icon:`Sigma`,category:`content`,displayName:`Dollar Math`,description:"Block math via `$$…$$` syntax — read-only compat. Preserves `$$…$$` form on round-trip; insert a fresh Math block for the full prop surface (id, language).",rendersAs:`Math`,translateProps:e=>e,serialize:e=>({type:`math`,value:e.attrs.props?.formula??``})},{name:`MathFence`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:mathFenceProps,icon:`Sigma`,category:`content`,displayName:`Math Fence`,description:"Block math via ` ```math ` fenced code syntax — read-only compat. Preserves the fence form on round-trip; insert a fresh Math block for the full prop surface (id, language).",rendersAs:`Math`,translateProps:e=>e,serialize:e=>({type:`code`,lang:`math`,meta:null,value:e.attrs.props?.formula??``})}],wildcardMeta={name:`*`,surface:`canonical`,hasChildren:!0,props:[],description:`Unregistered component — children editable as markdown`,serialize:(e,t)=>emitMdxJsx(e.attrs.componentName||`*`,e,t)};function createRegistry(){let e=new Map;e.set(`*`,wildcardMeta);for(let t of builtInComponents)e.set(t.name,t);return{get(t){return e.get(t)},getOrWildcard(t){return e.get(t)??e.get(`*`)},set(t,S){e.set(t,S)},has(t){return e.has(t)},entries(){return e.entries()}}}function ypsCounters(){let e=globalThis;return e.__okYpsCounters||={block:0,inline:0},e.__okYpsCounters}const metrics={parseFallback:{blockLevel:0,wholeDoc:0},jsxRenderFailure:{},jsxAutoConvertFailed:{},jsxAutoConvertSucceeded:{},jsxPropDropped:{},jsxMoveFailed:{},jsxStuckCopyFailed:{},jsxStuckDeleteFailed:{},jsxPopoverCloseRestoreFailed:{},jsxKeyboardDeleteFailed:{},blockGripClickSelectFailed:{},jsxArrowNodeSelectFailed:{}};function incrementBlockFallback(){metrics.parseFallback.blockLevel++}function incrementWholeDocFallback(){metrics.parseFallback.wholeDoc++}function getParseHealth(){let e=ypsCounters();return{parseFallback:{...metrics.parseFallback},ypsMismatch:{block:e.block,inline:e.inline},jsxRenderFailure:{...metrics.jsxRenderFailure},jsxAutoConvertFailed:{...metrics.jsxAutoConvertFailed},jsxAutoConvertSucceeded:{...metrics.jsxAutoConvertSucceeded},jsxPropDropped:{...metrics.jsxPropDropped},jsxMoveFailed:{...metrics.jsxMoveFailed},jsxStuckCopyFailed:{...metrics.jsxStuckCopyFailed},jsxStuckDeleteFailed:{...metrics.jsxStuckDeleteFailed},jsxPopoverCloseRestoreFailed:{...metrics.jsxPopoverCloseRestoreFailed},jsxKeyboardDeleteFailed:{...metrics.jsxKeyboardDeleteFailed},blockGripClickSelectFailed:{...metrics.blockGripClickSelectFailed},jsxArrowNodeSelectFailed:{...metrics.jsxArrowNodeSelectFailed}}}const FENCE_RE=/^(`{3,}|~{3,})/gm;function findFencedRegions(e){let t=[],S=null;for(let w of e.matchAll(FENCE_RE)){let e=w[1],E=w.index;S?e[0]===S.marker[0]&&e.length>=S.marker.length&&(t.push([S.offset,E+w[0].length]),S=null):S={marker:e,offset:E}}return S&&t.push([S.offset,e.length]),t}function isInsideFence(e,t){return t.some(([t,S])=>e>=t&&e<S)}const REF_DEF_RE=/^[ \t]{0,3}\[([^\]]+)\]:\s*(\S+)(\s+(?:"[^"]*"|'[^']*'|\([^)]*\)))?\s*$/gm;function hoistRefDefs(e){let t=findFencedRegions(e),S=[];for(let w of e.matchAll(REF_DEF_RE))isInsideFence(w.index,t)||S.push(w[0].trimEnd());return S.length>0?`${S.join(`
|
|
392
392
|
`)}\n\n`:``}const MAX_PARSE_WALLCLOCK_MS=500,MAX_TOTAL_PARSE_CALLS=1e3;function parseWithFallback(e,t){let S={startMs:typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now(),calls:0};return parseRecursive(e,t.parse,0,S)}function budgetExhausted(e){return e.calls>=MAX_TOTAL_PARSE_CALLS?!0:(typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now())-e.startMs>=MAX_PARSE_WALLCLOCK_MS}const MAX_ERROR_MESSAGE_LEN=500;function errorPayload(e){return e instanceof Error?{name:e.name,message:e.message.slice(0,MAX_ERROR_MESSAGE_LEN),stack:e.stack?.split(`
|
|
393
393
|
`).slice(0,4).join(`
|
|
@@ -3300,4 +3300,4 @@ In headless mode, write the recap into the research article's "Further reading"
|
|
|
3300
3300
|
`),S=[],w=!1,E=``;for(let e of t){let t=/^\s{0,3}([`~]{3,})/.exec(e);if(t){w?RegExp(`^\\s{0,3}${E[0]==="`"?"`":`~`}{${E.length},}\\s*$`).test(e)&&(w=!1,E=``):(w=!0,E=t[1]);continue}if(w)continue;let D=stripInlineCodeSpans(e);for(TAG_VALUE_RE.lastIndex=0;;){let e=TAG_VALUE_RE.exec(D);if(e===null)break;let t=e[2];t&&S.push(t)}}return S}var TagIndex=class{contentDir;contentFilter;state=createEmptyState();constructor(e){this.contentDir=e.contentDir,this.contentFilter=e.contentFilter}updateDocumentFromMarkdown(e,t){if(!(isSystemDoc(e)||isConfigDoc(e)))try{let{frontmatter:S,body:w}=stripFrontmatter(t),E=extractFrontmatterTags(S?unwrapFrontmatterFences(S):``),D=extractInlineTagsFromBody(w),O=new Set([...E,...D]),k=new Set;for(let e of O)for(let t of expandTagToHierarchy(e))k.add(t);this.applyDocSnapshot(e,O,k)}catch(t){console.warn(`[tag-index] Failed to scan ${e} for tag extraction:`,t),this.deleteDocument(e)}}deleteDocument(e){if(isSystemDoc(e)||isConfigDoc(e))return;let t=this.state.byDoc.get(e);if(t){for(let S of t){let t=this.state.byTag.get(S);t&&(t.delete(e),t.size===0&&this.state.byTag.delete(S))}this.state.byDoc.delete(e),this.state.byDocLiteral.delete(e)}}renameDocument(e,t,S){this.deleteDocument(e),this.updateDocumentFromMarkdown(t,S)}getDocsForTag(e){let t=this.state.byTag.get(e);return t?[...t].sort((e,t)=>e.localeCompare(t)):[]}getDocsForTagWithMatches(e){let t=this.state.byTag.get(e);if(!t)return[];let S=[];for(let w of t){let t=this.state.byDocLiteral.get(w);if(!t)continue;let E=tagsMatchingPrefix(t,e);S.push({docName:w,matchingTags:[...E].sort((e,t)=>e.localeCompare(t))})}return S.sort((e,t)=>e.docName.localeCompare(t.docName))}getAllTags(){let e=[...this.state.byTag.entries()],t=e.map(([e])=>e),S=new Set;for(let e of t){let t=e.indexOf(`/`);t>0&&S.add(e.slice(0,t));let w=t;for(;w>0;)S.add(e.slice(0,w)),w=e.indexOf(`/`,w+1)}return e.map(([e,t])=>({name:e,count:t.size,isLeaf:!S.has(e)})).sort((e,t)=>e.name.localeCompare(t.name))}init(){if(this.state=createEmptyState(),!existsSync(this.contentDir))return;let e=this.listDocsWithPaths();for(let{docName:t,filePath:S}of e)try{let e=readFileSync(S,`utf-8`);this.updateDocumentFromMarkdown(t,e)}catch(e){console.warn(`[tag-index] Failed to read ${t} during init:`,e)}}applyDocSnapshot(e,t,S){let w=this.state.byDoc.get(e)??new Set;for(let t of w){if(S.has(t))continue;let w=this.state.byTag.get(t);w&&(w.delete(e),w.size===0&&this.state.byTag.delete(t))}for(let t of S){let S=this.state.byTag.get(t);S||(S=new Set,this.state.byTag.set(t,S)),S.add(e)}S.size===0?(this.state.byDoc.delete(e),this.state.byDocLiteral.delete(e)):(this.state.byDoc.set(e,S),this.state.byDocLiteral.set(e,t))}listDocsWithPaths(){let e=[];this.walkContentDir(this.contentDir,e),e.sort((e,t)=>e.docName===t.docName?t.filePath.localeCompare(e.filePath):e.docName.localeCompare(t.docName));let t=new Set;return e.filter(({docName:e})=>t.has(e)?!1:(t.add(e),!0))}walkContentDir(e,t){let S;try{S=readdirSync(e,{withFileTypes:!0})}catch(t){console.warn(`[tag-index] Failed to read directory ${e}:`,t);return}for(let w of S){let S=join(e,w.name);if(w.isDirectory()){let e=relative(this.contentDir,S);if(this.contentFilter&&e&&this.contentFilter.isDirExcluded(e))continue;this.walkContentDir(S,t);continue}if(!w.isFile()||!isSupportedDocFile(w.name))continue;let E=relative(this.contentDir,S);this.contentFilter?.isExcluded(E)||t.push({docName:stripDocExtension(E),filePath:S})}}};const PARK_SNAPSHOT_ORIGIN=(()=>{let e=Object.freeze({origin:`park-snapshot`,paired:!0});return Object.freeze({source:`local`,skipStoreHooks:!1,context:e})})();function createServer$1(e){let{contentDir:t,projectDir:S=t,quiet:w=!0,debounce:E=2e3,maxDebounce:D=1e4,gitEnabled:O=!0,commitDebounceMs:k=3e4,wipRef:j=`refs/wip/main`,configHomedirOverride:F,enableTestRoutes:L=!1,shadowRepo:B,contentRoot:H,destroyTimeoutMs:q=1e4,localOpCliArgs:J,skipStateManifestCheck:Y=!1}=e,ee=getLogger(`server`);function te(){let e=readConfigSafely({absPath:resolveConfigPath(`project-local`,S),sideline:!1,warn:e=>ee.warn({message:e},`[config] could not read project-local config`)}),t=e.value.autoSync?.enabled;return t==null?(e.valid||ee.warn({},`[config] project-local autoSync.enabled unavailable (config invalid) — falling back to project config`),readConfigSafely({absPath:resolveConfigPath(`project`,S),sideline:!1,warn:e=>ee.warn({message:e},`[config] could not read project config`)}).value.autoSync?.enabled===!0):t===!0}initTelemetry();let ne=randomUUID(),ae=getLocalDir(S);if(acquireServerLock(ae,{port:e.port??0,worktreeRoot:S,kind:e.lockKind??`interactive`,capabilities:[`http`,`ws`]}),!Y)try{assertCompatibleStateManifest({lockDir:ae,shadowRepoDir:resolveShadowDir(S)})}catch(e){throw releaseServerLock(ae),e}let oe=createBasenameIndex(),se=(e,t)=>oe.resolveEmbed(e,t),ce=(e,S)=>{let w=oe.resolveEmbed(e,S);if(!w&&e.includes(`/`)&&(w=e.replace(/^\.?\//,``)),!w)return null;let E=resolve(t,w),D=resolve(t);if(E!==D&&!E.startsWith(`${D}/`))return null;try{let e=statSync(E);return e.isFile()?e.size:null}catch{return null}},ue,de,fe,me,ge,_e,ve,ye=null,Ce=null,we=null,Te=null,De=new Set,je=!1,Me,Pe,Ie,Re=new Promise((e,t)=>{Pe=e,Ie=t});function ze(e){ye?.signal(e)}let Be=2e3,Ve=null;function Ue(){Ve!==null&&clearTimeout(Ve),Ve=setTimeout(()=>{Ve=null,de.saveToDisk().catch(e=>{console.warn(`[backlinks] Failed to persist debounced cache:`,e)})},2e3)}let We=new RecentlyRemovedDocs(void 0,{onEviction:()=>incrementRecentlyRemovedDocsEviction(),onSizeChange:e=>setRecentlyRemovedDocsSize(e)}),Ge=(e,t)=>{isSystemDoc(e)||isConfigDoc(e)||We.setRenamed(e,t)},Ke=e=>{if(!(isSystemDoc(e)||isConfigDoc(e))){if(We.peek(e)?.kind===`renamed`){console.info(JSON.stringify({event:`recently-removed-docs-unpaired-delete-suppressed`,docName:e,source:`watcher-delete`}));return}We.setDeleted(e)}},Xe=e=>{isSystemDoc(e)||isConfigDoc(e)||We.delete(e)};try{ue=createContentFilter({projectDir:S,contentDir:t,onAfterRebuild:()=>{de.rebuildFromDisk(getActiveBranch()).catch(e=>{getLogger(`server-factory`).warn({err:e},`[content-filter] backlink-index rebuild failed after onAfterRebuild`)});try{fe.init()}catch(e){getLogger(`server-factory`).warn({err:e},`[content-filter] tag-index rebuild failed after onAfterRebuild`)}try{let e=Rt?.pruneFileIndexNowExcluded()??0,t=Rt?.pruneFolderIndexNowExcluded()??0,S=e+t;S>0&&getLogger(`server-factory`).info({pruned:S,prunedFiles:e,prunedFolders:t},`[content-filter] pruned now-excluded entries from file indexes`)}catch(e){getLogger(`server-factory`).warn({err:e},`[content-filter] file index prune failed after onAfterRebuild`)}}}),de=new BacklinkIndex({projectDir:S,contentDir:t,contentFilter:ue}),fe=new TagIndex({contentDir:t,contentFilter:ue});try{fe.init()}catch(e){console.warn(`[server-factory] tag-index init failed; continuing with empty index:`,e)}me={current:B},ge=createPersistenceExtension({contentDir:t,projectDir:S,gitEnabled:O,commitDebounceMs:k,wipRef:j,shadowRef:me,contentRoot:H,backlinkIndex:de,configHomedirOverride:F,getCurrentBranch:()=>zt?.getLastKnownBranch()??null,resolveEmbed:se,resolveSize:ce,getPrincipal:()=>Te,onAgentCommit:()=>ye?.signal(`session-activity`),onDiskFlush:(e,t)=>ye?.emitDiskAck(e,t),onConfigRejected:(e,t)=>ye?.emitConfigValidationRejected(e,t),mdManager:e.mdManager}),_e=new Hocuspocus({quiet:w,debounce:E,maxDebounce:D,extensions:[ge.extension]});let q=_e.shouldUnloadDocument.bind(_e);_e.shouldUnloadDocument=e=>{if(De.has(e)||je&&q(e))return!0;let t=e.name;return isSystemDoc(t)||isConfigDoc(t)||getReconciledBase(t)!==void 0||e.getXmlFragment(`default`).length!==0||e.getText(`source`).length!==0?!1:q(e)},Me=async e=>{De.add(e);try{await _e.unloadDocument(e)}finally{De.delete(e)}},ye=new CC1Broadcaster(_e),Ce=new AgentFocusBroadcaster(_e),we=new AgentPresenceBroadcaster(_e),ve=new AgentSessionManager(_e);let Y=createLiveDerivedIndexExtension({backlinkIndex:de,tagIndex:fe,signalChannel:ze});_e.configuration.extensions.push(Y),_e.configuration.extensions.push({__kind:`principal-auth`,async onAuthenticate(e){let t=e.token,S=parseHocuspocusAuthToken(t),w=S?.expectedServerInstanceId;if(typeof w==`string`&&w.length>0&&w!==ne)throw new HocuspocusAuthRejection(`server-instance-mismatch`,`server instance mismatch: client claimed ${w}, this server is ${ne}`);let E=S?.expectedBranch,D=getActiveBranch();if(typeof E==`string`&&E.length>0&&E!==D)throw new HocuspocusAuthRejection(`branch-mismatch`,`branch mismatch: client claimed ${E}, server is on ${D}`);if(!S)return;let O=e.context;typeof S.principalId==`string`&&(Te&&S.principalId===Te.id?O.principalId=Te.id:Te?console.warn(JSON.stringify({event:`principal-token-mismatch`,claimed:S.principalId,loaded:Te.id})):O.principalId=S.principalId),typeof S.tabSessionId==`string`&&(O.tabSessionId=S.tabSessionId),O.kind=`human`}}),_e.configuration.extensions.push({__kind:`config-doc-admission-guard`,async onAuthenticate(e){if(!isConfigDoc(e.documentName))return;let t=e.request,S=t.socket?.remoteAddress;if(S!==void 0&&!isLoopbackAddress(S))throw Error(`config-doc admission requires loopback peer (peer=${S}, doc=${e.documentName})`);let w=e.requestHeaders,E=(w&&typeof w.get==`function`?w.get(`host`):null)??t.headers?.host??void 0;if(!isAllowedWorkspaceHostHeader(E))throw Error(`config-doc admission requires loopback Host header (host=${E??`<absent>`}, doc=${e.documentName})`)}});let ee=resolve(t);function te(e){if(!isSafeDocName(e))return null;let t=resolve(ee,`${e}${getDocExtension(e)}`);return!t.startsWith(`${ee}/`)&&t!==ee?null:t}_e.configuration.extensions.push({__kind:`removal-redirect-guard`,async onAuthenticate(e){await runRemovalRedirectGuard(e.documentName,{recentlyRemovedDocs:We,resolveFilePath:te,fileExists:existsSync})}}),_e.configuration.extensions.push({__kind:`system-doc-broadcast-guard`,async beforeHandleMessage(e){if(e.documentName!==`__system__`)return;let t=new IncomingMessage(e.update);if(t.readVarString(),t.readVarUint()===MessageType.BroadcastStateless)throw Error(`inbound BroadcastStateless on ${SYSTEM_DOC_NAME} rejected — server-only channel`)}});let ae=createApiExtension({hocuspocus:_e,sessionManager:ve,contentDir:t,contentFilter:ue,serverInstanceId:ne,getFileIndex:()=>Rt?Rt.getFileIndex():new Map,getFolderIndex:()=>Rt?Rt.getFolderIndex():new Map,getAliasMap:()=>Rt?Rt.getAliasMap():new Map,rescanFiles:()=>Rt?.rescanFromDisk(),enableTestRoutes:L,shadowRef:me,flushGitCommit:()=>ge.flushPendingGitCommit(),flushContributors:()=>ge.flushContributors(),getCurrentBranch:()=>zt?.getLastKnownBranch()??null,getDiskAckSVs:()=>ye?.getLatestDiskAckSVsAsBase64()??{},contentRoot:H,backlinkIndex:de,tagIndex:fe,signalChannel:ze,agentFocusBroadcaster:Ce,agentPresenceBroadcaster:we,onAgentWrite:e.onAgentWrite,getSyncEngine:()=>Bt,localOpCliArgs:J,projectDir:S,resolveEmbed:se,getPrincipal:()=>Te,forceUnloadDocument:Me,ready:Re,recentlyRemovedDocs:We,serializeDoc:at});_e.configuration.extensions.push(ae),_e.configuration.extensions.push(createServerObserverExtension({mdManager,schema,shadowRef:me,contentRoot:H,getCurrentBranch:()=>zt?.getLastKnownBranch()??null,resolveEmbed:se,resolveSize:ce})),_e.configuration.extensions.push(createSyncHandshakeSpanExtension()),_e.configuration.extensions.push(createConflictLifecycleSeedExtension({getSyncEngine:()=>Bt,projectDir:S,contentDir:t}))}catch(e){throw releaseServerLock(ae),e}let $e=null,nt=new Map,rt=[];function it(e,t){let S=resolve(e,`rescue`),w=resolve(S,`${t}${getDocExtension(t)}`);return w.startsWith(`${S}/`)?w:null}function at(e){let t=_e.documents.get(e);if(!t)return null;let{frontmatter:S,body:w}=stripFrontmatter(t.getText(`source`).toString());return prependFrontmatter(S,w)}let st=(e,t)=>applyExternalChange(_e,e,t,se,ce);function vt(e){if(!isDocInConflict(e))return;let t=e.getMap(`lifecycle`);t.delete(`status`),t.delete(`reason`)}let Tt=e=>{if(!e)return;let t=`[[${e}]]`;for(let[S]of _e.documents){if(isSystemDoc(S)||isConfigDoc(S))continue;let w=_e.documents.get(S);if(!w)continue;let E=w.getText(`source`).toString();if(E.includes(t))try{w.transact(()=>{applyDiskContentToDoc(w,E,se,S)},FILE_WATCHER_ORIGIN)}catch(t){ee.error({err:t,docName:S,assetBasename:e},`[asset-event] failed to re-render ${S} for asset basename ${e}`)}}},Et=null,Dt=e=>{e&&(Et===null&&(Et=new Set,setImmediate(()=>{let e=Et;if(Et=null,e)try{for(let t of e)Tt(t)}catch(t){ee.error({err:t,basenames:[...e]},`[asset-event] dedup rerender pass crashed`)}})),Et.add(e))};function jt(e){switch(e.kind){case`rename`:return e.newDocName;case`asset-create`:case`asset-delete`:case`folder-create`:case`folder-delete`:return e.relativePath;case`create`:case`update`:case`delete`:case`conflict`:return e.docName;default:return assertNeverDiskEvent(e)}}async function Mt(e){try{switch(e.kind){case`create`:ee.info({docName:e.docName},`[reconcile] create: ${e.docName}`),de.updateDocumentFromMarkdown(e.docName,e.content),Ue(),fe.updateDocumentFromMarkdown(e.docName,e.content),ze(`files`),ze(`backlinks`),ze(`graph`),ze(`tags`),Xe(e.docName);break;case`update`:{let{docName:t,content:S}=e,w=_e.documents.get(t);if(!w){de.updateDocumentFromMarkdown(t,S),Ue(),fe.updateDocumentFromMarkdown(t,S),ze(`backlinks`),ze(`graph`),ze(`tags`);return}let E=getReconciledBase(t)??``,D=at(t)??E,O=reconcile({docName:t,base:E,ours:D,theirs:S}),k=contentHash(E).slice(0,6),j=contentHash(D).slice(0,6),F=contentHash(S).slice(0,6);switch(ee.info({docName:t,base:k,ours:j,theirs:F,result:O.kind},`[reconcile] ${t} base=${k} ours=${j} theirs=${F} result=${O.kind}`),O.kind){case`noop`:vt(w),de.updateDocumentFromMarkdown(t,S),Ue(),fe.updateDocumentFromMarkdown(t,S),ze(`backlinks`),ze(`graph`),ze(`tags`);break;case`clean`:try{st(t,O.newContent),setReconciledBase(t,O.newContent),incrementReconcile(),vt(w),de.updateDocumentFromMarkdown(t,S),Ue(),fe.updateDocumentFromMarkdown(t,S),ze(`backlinks`),ze(`graph`),ze(`tags`)}catch(e){ee.error({err:e,docName:t},`[reconcile] failed to apply clean content to Y.Doc for ${t}`),setReconciledBase(t,S),vt(w)}break;case`merged`:try{st(t,O.newContent),setReconciledBase(t,O.newContent),incrementReconcile(),vt(w),de.updateDocumentFromMarkdown(t,S),Ue(),fe.updateDocumentFromMarkdown(t,S),ze(`backlinks`),ze(`graph`),ze(`tags`)}catch(e){ee.error({err:e,docName:t},`[reconcile] failed to apply merged content to Y.Doc for ${t}`),setReconciledBase(t,S),vt(w)}break;case`conflicts`:try{st(t,O.newContent),setReconciledBase(t,O.newContent),incrementReconcile(),incrementConflict(),de.updateDocumentFromMarkdown(t,S),Ue(),fe.updateDocumentFromMarkdown(t,S),ze(`backlinks`),ze(`graph`),ze(`tags`)}catch(e){ee.error({err:e,docName:t},`[reconcile] failed to apply conflict content to Y.Doc for ${t}`),setReconciledBase(t,S)}{let e=w.getMap(`lifecycle`);e.set(`status`,`conflict`),e.set(`reason`,`merged-with-markers`)}break;case`refused`:{incrementConflict();let e=w.getMap(`lifecycle`);e.set(`status`,`conflict`),e.set(`reason`,O.reason);break}}break}case`delete`:{let{docName:t}=e,S=_e.documents.get(t);if(!S){de.deleteDocument(t),Ue(),fe.deleteDocument(t),ze(`files`),ze(`backlinks`),ze(`graph`),ze(`tags`),Ke(t),console.info(JSON.stringify({event:`recently-removed-docs-populate`,docName:t,kind:`deleted`,source:`watcher-delete`}));return}let w=getReconciledBase(t)??``,E=at(t)??``,D=E!==w;if(D&&me.current){let e=me.current,S=zt?.getLastKnownBranch()??`main`;queueMicrotask(()=>{saveInMemoryCheckpoint(e,H??``,{kind:`external-change-rescue`,docName:t,contents:E,label:`External change recovered @ ${new Date().toISOString()}`,branch:S,metadata:{incomingDiskSha:``}}).then(()=>{incrementRescueBuffer(),ee.info({docName:t},`[reconcile] rescue checkpoint saved (delete): ${t}`)}).catch(e=>{ee.error({docName:t,err:e},`[reconcile] rescue checkpoint write failed: ${t}`)})})}S.getMap(`lifecycle`).set(`status`,`deleted-upstream`),deleteReconciledBase(t),de.deleteDocument(t),Ue(),fe.deleteDocument(t),ee.info({docName:t,isDirty:D},`[reconcile] delete: ${t} (dirty=${D})`),_e.closeConnections(t),await Me(S),ze(`files`),ze(`backlinks`),ze(`graph`),ze(`tags`),Ke(t),console.info(JSON.stringify({event:`recently-removed-docs-populate`,docName:t,kind:`deleted`,source:`watcher-delete`}));break}case`rename`:{let{oldDocName:t,newDocName:S,content:w}=e,E=_e.documents.get(t);if(deleteReconciledBase(t),setReconciledBase(S,w),de.renameDocument(t,S,w),Ue(),fe.renameDocument(t,S,w),E){let e=E.getMap(`lifecycle`);e.set(`status`,`renamed`),e.set(`newPath`,S)}ee.info({oldDocName:t,newDocName:S},`[reconcile] rename: ${t} → ${S}`),ze(`files`),ze(`backlinks`),ze(`graph`),ze(`tags`),Ge(t,S),console.info(JSON.stringify({event:`recently-removed-docs-populate`,from:t,to:S,kind:`renamed`,source:`watcher-rename`}));break}case`conflict`:{let{docName:t}=e,S=_e.documents.get(t);if(!S)return;let w=at(t);w===null?ee.warn({docName:t},`[reconcile] case 'conflict': serializeDoc returned null for ${t}; reconciledBase snapshot skipped — post-resolution reconcile may degrade to 3-way merge`):setReconciledBase(t,w);let E=S.getMap(`lifecycle`);E.set(`status`,`conflict`),E.set(`reason`,`conflict-markers`),ee.info({docName:t},`[reconcile] conflict markers detected: ${t}`);break}case`asset-create`:oe.add(e.relativePath),ze(`files`),Dt(basename(e.relativePath));break;case`asset-delete`:oe.remove(e.relativePath),ze(`files`),Dt(basename(e.relativePath));break;case`folder-create`:case`folder-delete`:ze(`files`);break;default:assertNeverDiskEvent(e)}}catch(t){let S=jt(e);ee.error({err:t,kind:e.kind,label:S},`[reconcile] failed to handle ${e.kind} for ${S}`)}}let Ft=[];async function It(e){if(isBatchInProgress()){Ft.push(e);return}await Mt(e)}async function Lt(){let e=Ft.splice(0,Ft.length);for(let t of e)await Mt(t)}let Rt=null,zt=null,Bt=null,Vt=null;async function Ht(e){if(_e.documents.size===0)return;let t=!1,S=new Promise(e=>{_e.configuration.extensions.push({async afterUnloadDocument({instance:S}){!t&&S.getDocumentsCount()===0&&(t=!0,e())}})}),w=Array.from(_e.documents.keys());_e.closeConnections(),_e.flushPendingStores();for(let e of _e.documents.values())e.getConnectionsCount()===0&&_e.unloadDocument(e).catch(t=>{console.warn(JSON.stringify({event:`ok-shutdown-unload-document-failed`,docName:e.name,reason:t instanceof Error?t.message:String(t)}))});let E,D=new Promise((S,D)=>{E=setTimeout(()=>{t=!0;let S=Array.from(_e.documents.keys()),E=[],O=[];if(me.current){for(let e of S)if(!(isSystemDoc(e)||isConfigDoc(e)))try{let t=at(e);if(t===null){ee.warn({docName:e},`[rescue] skipping ${e} — document dropped from map mid-rescue`),O.push(e);continue}let S=it(me.current.gitDir,e);if(!S){ee.warn({docName:e,gitDir:me.current.gitDir},`[rescue] path-traversal guard rejected docName: ${e}`),O.push(e);continue}mkdirSync(dirname(S),{recursive:!0}),writeFileSync(S,t,`utf-8`),incrementRescueBuffer(),E.push(e),ee.info({docName:e},`[rescue] rescue buffer saved on flush timeout: ${e}`)}catch(t){O.push(e),ee.error({err:t,docName:e},`[rescue] failed to write rescue buffer for ${e}`)}}else ee.warn({stillLoadedCount:S.length},`[rescue] shadow repo unavailable at flush timeout — ${S.length} doc(s) will be lost: [${S.join(`, `)}]`),O.push(...S);let k=E.length>0||O.length>0?` — rescued [${E.join(`, `)}]${O.length>0?`, lost [${O.join(`, `)}]`:``}`:``;D(Error(`flushAllStoresAndWait timeout after ${e}ms — ${S.length}/${w.length} docs did not unload: [${S.join(`, `)}]${k}`))},e)});try{await Promise.race([S,D])}finally{E!==void 0&&clearTimeout(E)}}async function Ut(){return Vt||(Vt=(async()=>{let e=Date.now(),t=[];je=!0,Ve!==null&&(clearTimeout(Ve),Ve=null);let w,E=await Promise.race([Re.then(()=>`completed`,e=>(ee.debug({err:e},`[server] init incomplete during shutdown`),`failed`)),new Promise(e=>{w=setTimeout(()=>e(`timeout`),5e3)})]);w!==void 0&&clearTimeout(w),E===`timeout`&&ee.warn({},`[server] init did not complete within 5s during shutdown`);let D=_e.documents.size;try{try{try{zt&&=(await zt.unsubscribe(),null),Rt&&=(await Rt.unsubscribe(),null);for(let{docName:e,cleanup:t}of rt)try{await t()}catch(t){ee.warn({err:t,docName:e},`[server] failed to stop config-file-watcher for ${e}`)}rt.length=0}catch(e){t.push({phase:`watcher-unsubscribe`,error:e instanceof Error?e.message:String(e)}),ee.error({err:e},`[server] shutdown phase-1 watcher unsubscribe failed`)}try{ye?.destroy(),we?.destroy(),$e&&=(await $e.disconnect(),null);for(let[e,t]of nt)try{await t.disconnect()}catch(t){ee.warn({err:t,docName:e},`[server] failed to disconnect ${e} during shutdown`)}nt.clear()}catch(e){t.push({phase:`cc1-teardown`,error:e instanceof Error?e.message:String(e)}),ee.error({err:e},`[server] shutdown phase-1b CC1 teardown failed`)}try{await ve.closeAll()}catch(e){t.push({phase:`agent-session-drain`,error:e instanceof Error?e.message:String(e)}),ee.error({err:e},`[server] shutdown phase-2 agent session drain failed`)}try{await Ht(q)}catch(e){t.push({phase:`flush-all-stores`,error:e instanceof Error?e.message:String(e)}),ee.error({err:e},`[server] shutdown phase-3 flush failed`)}let e;try{await Promise.race([(async()=>{await ge.flushPendingGitCommit(),await ge.waitForPendingCommits()})(),new Promise((t,S)=>{e=setTimeout(()=>S(Error(`L2 git flush timeout`)),q)})])}catch(e){t.push({phase:`git-commit-flush`,error:e instanceof Error?e.message:String(e)}),ee.error({err:e},`[server] shutdown phase-4 git commit flush failed`)}finally{e!==void 0&&clearTimeout(e)}try{Bt&&=(await Bt.destroy(),null)}catch(e){t.push({phase:`sync-engine-stop`,error:e instanceof Error?e.message:String(e)}),ee.error({err:e},`[server] shutdown sync-engine-stop failed`)}}finally{if(me.current){try{let e=(await esm_default({baseDir:S,timeout:{block:5e3}}).revparse(`HEAD`)).trim();e&&writeFileSync(resolve(me.current.gitDir,`last-known-head`),e,`utf-8`)}catch{}try{destroyShadowRepo(me.current)}catch(e){t.push({phase:`shadow-repo-release`,error:e instanceof Error?e.message:String(e)}),ee.error({err:e},`[server] shutdown phase-5 destroyShadowRepo failed`)}}let w=Date.now()-e;t.length===0?ee.info({documentCount:D,durationMs:w},`[server] shutdown flushed ${D} documents in ${w}ms`):ee.warn({documentCount:D,durationMs:w,phaseErrors:t},`[server] shutdown flushed ${D} documents in ${w}ms with ${t.length} phase error(s)`)}}finally{try{releaseServerLock(ae)}catch(e){t.push({phase:`server-lock-release`,error:e instanceof Error?e.message:String(e)}),ee.error({err:e},`[server] shutdown phase-6 releaseServerLock failed`)}try{await shutdownTelemetry()}catch(e){t.push({phase:`telemetry-shutdown`,error:e instanceof Error?e.message:String(e)})}}})(),Vt)}let Wt=[];async function Kt(){try{Te=await loadPrincipal(S),ee.info({principalId:Te.id},`[server] principal loaded`)}catch(e){ee.warn({err:e},`[server] principal load failed — browser writes will use SERVICE_WRITER`)}if(!me.current)try{me.current=await initShadowRepo(S),ee.info({gitDir:me.current.gitDir},`[server] history repo initialized at ${me.current.gitDir}`)}catch(e){ee.error({err:e},`[server] history repo init failed`),Wt.push(`shadow-repo`)}if(me.current){let e=null;try{e=loadRenameLogIndex(me.current.gitDir),sweepLazyPopOrphans(me.current.gitDir,e),setRenameLogIndex(me.current.gitDir,e),ee.info({entries:e.byTo.size},`[server] rename log loaded (${e.byTo.size} entries)`)}catch(e){ee.warn({err:e},`[rename-log] boot-time load/sweep failed; rename history unavailable`)}if(e){let t=1e4;try{await Promise.race([gcRenameLog(me.current,e,{rebuild:!0}),new Promise((e,S)=>setTimeout(()=>S(Error(`boot-time GC exceeded ${t}ms`)),t))])}catch(e){ee.warn({err:e},`[rename-log] boot-time GC/rebuild failed; index loaded without GC`)}}}if(me.current)try{await shadowGit(me.current).raw(`rev-parse`,`--git-dir`)}catch(e){let t=e instanceof Error?e.message:String(e);if(t.includes(`not a git repository`)||t.includes(`invalid object`)){ee.warn({},`[server] history repo appears corrupted — reinitializing`);try{me.current=await initShadowRepo(S)}catch(e){ee.error({err:e},`[server] history repo reinit failed`),me.current=void 0,Wt.includes(`shadow-repo`)||Wt.push(`shadow-repo`)}}else ee.error({err:e},`[server] history repo check failed (transient?)`)}if(me.current)try{let e=resolve(me.current.gitDir,`last-known-head`),t=null;try{t=readFileSync(e,`utf-8`).trim()||null}catch{}let w=null;try{w=(await esm_default({baseDir:S,timeout:{block:1e4}}).revparse(`HEAD`)).trim()||null}catch{}if(w!==null){if(w!==t){let e=`main`;try{let t=(await esm_default({baseDir:S,timeout:{block:1e4}}).raw(`rev-parse`,`--abbrev-ref`,`HEAD`)).trim();t&&t!==`HEAD`&&(e=t)}catch{}ee.info({lastKnownHead:t,currentHead:w,branch:e},`[head-drift] lastKnownHead=${t??`null`}, currentHead=${w}, action=import`);try{await commitUpstreamImport(me.current,H??``,t,w,e),incrementUpstreamImport()}catch(e){ee.warn({err:e},`[head-drift] commitUpstreamImport failed — continuing`)}}else ee.info({currentHead:w},`[head-drift] lastKnownHead=${t??`null`}, currentHead=${w}, action=noop`);try{writeFileSync(e,w,`utf-8`)}catch(e){ee.warn({err:e},`[head-drift] failed to write last-known-head`)}}}catch(e){ee.warn({err:e},`[head-drift] check failed — continuing`)}try{let e=recoverPendingManagedRename(t,S);if(e.recovered&&e.journal){let t=e.journal.version===2?e.journal.fromPath:e.journal.sourceDocName,S=e.journal.version===2?e.journal.toPath:e.journal.destinationDocName;ee.warn({journalVersion:e.journal.version,fromPath:t,toPath:S,restoredDocNames:e.restoredDocNames},`[managed-rename] recovered pending rename ${t} -> ${S}`)}}catch(e){ee.error({err:e},`[server] managed rename recovery failed`),Wt.push(`managed-rename-recovery`)}try{let e=cleanupOrphanUploadTempfiles(S);(e.deleted>0||e.errors>0)&&ee.info({scanned:e.scanned,deleted:e.deleted,errors:e.errors},`[upload-tempfile-sweep] swept ${e.deleted} orphan tempfile(s)`)}catch(e){ee.error({err:e},`[server] upload-tempfile sweep failed`),Wt.push(`upload-tempfile-sweep`)}try{$e=await _e.openDirectConnection(SYSTEM_DOC_NAME),ye?.emitServerInfo(ne,getActiveBranch())}catch(e){ee.error({err:e},`[server] failed to open __system__ direct connection — CC1 push disabled`),Wt.push(`cc1-push`)}for(let e of CONFIG_DOC_NAMES)try{let t=await _e.openDirectConnection(e);nt.set(e,t)}catch(t){ee.error({err:t,docName:e},`[server] failed to open ${e} direct connection — config bind degraded`),Wt.push(`config-doc:${e}`)}let e=new Map([[CONFIG_DOC_NAME_PROJECT,resolveConfigPath(`project`,S)],[CONFIG_DOC_NAME_PROJECT_LOCAL,resolveConfigPath(`project-local`,S)],[CONFIG_DOC_NAME_USER,resolveConfigPath(`user`,S,F)]]);for(let t of CONFIG_DOC_NAMES){let S=e.get(t);if(S)try{ee.info({docName:t,path:S},`[config-file-watcher] starting`);let e=await startConfigFileWatcher(S,e=>{let S=_e.documents.get(t);ee.info({docName:t,hasDocument:S!==void 0,contentLength:e.length},`[config-file-watcher] file changed`);let w=applyExternalConfigChange(S??null,t,e,ge.configPersistenceCtx);if(ee.info({docName:t,outcome:w},`[config-file-watcher] applyExternalConfigChange outcome`),t===`__config__/project`||t===`__local__/project`){let e=te();Bt?.setEnabled(e).catch(t=>{ee.warn({err:t,enabled:e},`[sync] failed to apply autoSync.enabled from config`)})}});rt.push({docName:t,cleanup:e}),ee.info({docName:t,path:S},`[config-file-watcher] started`)}catch(e){ee.warn({err:e,docName:t,path:S},`[config-file-watcher] failed to start for ${t}`),Wt.push(`config-file-watcher:${t}`)}}try{let e=resolve(t,`.okignore`),w=resolve(S,`.gitignore`),E=ee;E.info({okignorePath:e,gitignorePath:w},`[ignore-watcher] starting multi-path watcher for .okignore + .gitignore`);let D=await startMultiPathConfigFileWatcher([e,w],(t,w)=>{(async()=>{if(t===e)try{let e=applyExternalConfigChange(_e.documents.get(`__config__/okignore`)??null,CONFIG_DOC_NAME_OKIGNORE,w,ge.configPersistenceCtx);E.info({docName:CONFIG_DOC_NAME_OKIGNORE,outcome:e},`[ignore-watcher] applyExternalConfigChange outcome`)}catch(e){E.error({err:e,changedPath:relative(S,t)},`[ignore-watcher] applyExternalConfigChange failed; rebuild proceeds independently`)}let D=await ue.rebuildIgnorePatterns();if(D.ok)E.info({changedPath:relative(S,t),patternCount:D.patternCount,nestedFileCount:D.nestedFileCount,durationMs:D.durationMs},`[ignore-watcher] rebuild succeeded — broadcasting files channel`),ye?.signal(`files`);else{let e=relative(S,t)||`.`;E.warn({changedPath:e,error:D.error.message},`[ignore-watcher] rebuild failed — emitting config-ignore-nested-error`),ye?.emitConfigIgnoreNestedError(e,D.error.message)}})().catch(e=>{E.error({err:e,changedPath:relative(S,t)||`.`},`[ignore-watcher] handler threw`)})});rt.push({docName:`__ignore-files__`,cleanup:D}),E.info({okignorePath:e,gitignorePath:w},`[ignore-watcher] multi-path watcher started`)}catch(e){ee.warn({err:e,projectDir:S,contentDir:t},`[ignore-watcher] failed to start multi-path watcher`),Wt.push(`ignore-files-watcher`)}let w=resolveGitDir(S),E=w?readBranchFromHead(w)??`main`:`main`;switchReconciledBaseScope(E),de.switchBranch(E);try{{let e=getActiveBranch();try{if(await de.loadFromDisk(e)){let t=await de.reconcileWithDisk(e);(t.added>0||t.updated>0||t.deleted>0)&&ee.info(t,`[backlinks] startup reconcile: offline changes applied`)}else await de.rebuildFromDisk(e);de.saveToDisk().catch(t=>{console.warn(`[backlinks] Failed to persist startup cache for ${e}:`,t)})}catch(t){ee.error({err:t,branch:e},`[backlinks] startup init failed; index will populate incrementally via watcher`)}}Rt=await startWatcher(t,It,ue),fe.init();let e=0;try{seedBasenameIndex({contentDir:t,contentFilter:ue,basenameIndex:oe,onSkip:(t,S,w)=>{e++,ee.warn({reason:t,code:S,path:w},`[basename-index] skipped entry during seed (${t}${S?` ${S}`:``})`)}}),e>0&&(ee.warn({count:e},`[basename-index] startup seed completed with ${e} skipped entries — embeds under inaccessible subtrees will not resolve`),Wt.push(`basename-index-partial`))}catch(e){ee.error({err:e},`[basename-index] startup seed failed`),Wt.push(`basename-index`)}}catch(e){ee.error({err:e},`[server] disk bridge watcher failed to start`),Wt.push(`file-watcher`)}try{zt=await startHeadWatcher(S,async({trigger:e})=>{if(ee.info({trigger:e},`[batch] begin trigger=${e}`),incrementBatch(),_e.flushPendingStores(),await ge.flushPendingGitCommit(),setBatchInProgress(!0),me.current){let e=getActiveBranch(),t=resolveGitDir(S),w=t?readBranchFromHead(t)??e:e,E=[];for(let[e,t]of _e.documents){if(isSystemDoc(e)||isConfigDoc(e))continue;let S=null;if(t.transact(()=>{S=at(e)},PARK_SNAPSHOT_ORIGIN),S===null)continue;let w=getReconciledBase(e)??S;E.push({docName:e,markdown:S,diskSnapshot:w})}if(E.length>0)try{let t=await parkBranch(me.current,e,SERVICE_WRITER.id,E,w);t&&(incrementPark(),ee.info({count:E.length,branch:e,sha:t.slice(0,8)},`[history] parked ${E.length} docs on ${e} → ${t.slice(0,8)}`))}catch(e){ee.error({err:e},`[shadow] park failed`)}}},async e=>{let S=Ft.length,w=e.newBranch??`main`;if(ee.info({kind:e.batchKind,headMoved:e.headMoved,docs:S,timeout:!!e.timeout},`[batch] end kind=${e.batchKind} headMoved=${e.headMoved} docs=${S}${e.timeout?` timeout`:``}`),e.batchKind===`within-branch`){if(setBatchInProgress(!1),await Lt(),await ge.flushDeferredStores(`within-branch`),Bt!==null)try{await Bt.reconcileConflictsFromGit()}catch(e){ee.warn({err:e},`[head-watcher] sync engine conflict reconcile failed`)}}else{incrementBranchSwitch(),Ft.splice(0,Ft.length),switchReconciledBaseScope(w),Ve!==null&&(clearTimeout(Ve),Ve=null),de.switchBranch(w),ue.rebuildDirCount();try{let e=0;oe.clear(),seedBasenameIndex({contentDir:t,contentFilter:ue,basenameIndex:oe,onSkip:(t,S,E)=>{e++,ee.warn({reason:t,code:S,path:E,branch:w},`[basename-index] skipped entry during branch-switch reseed (${t}${S?` ${S}`:``})`)}}),e>0&&(ee.warn({count:e,branch:w},`[basename-index] branch-switch reseed completed with ${e} skipped entries — embeds under inaccessible subtrees will not resolve on this branch`),Wt.includes(`basename-index-partial`)||Wt.push(`basename-index-partial`))}catch(e){ee.error({err:e,branch:w},`[basename-index] branch-switch reseed failed`)}for(let[e,S]of _e.documents)if(!(isSystemDoc(e)||isConfigDoc(e)))try{let E=safeContentPath(e,t);if(!existsSync(E)){let t=getReconciledBase(e)??``,E=at(e)??``;if(E!==t&&me.current){let t=me.current;queueMicrotask(()=>{saveInMemoryCheckpoint(t,H??``,{kind:`external-change-rescue`,docName:e,contents:E,label:`External change recovered @ ${new Date().toISOString()}`,branch:w,metadata:{incomingDiskSha:``}}).then(()=>{incrementRescueBuffer(),ee.info({docName:e},`[reconcile] rescue checkpoint saved on branch switch: ${e}`)}).catch(t=>{ee.error({docName:e,err:t},`[reconcile] rescue checkpoint write failed: ${e}`)})})}S.getMap(`lifecycle`).set(`status`,`deleted-upstream`),ee.info({docName:e,branch:w},`[branch-switch] tombstone: ${e} (not on ${w})`);continue}let D=readFileSync(E,`utf-8`);st(e,D),setReconciledBase(e,D),ee.info({docName:e},`[branch-switch] reset: ${e}`)}catch(t){ee.error({err:t,docName:e},`[branch-switch] failed to reset ${e}`)}ee.info({branch:w,docCount:_e.documents.size},`[branch-switch] loaded branch ${w} (${_e.documents.size} docs)`);try{if(await de.loadFromDisk(w)){let e=await de.reconcileWithDisk(w);(e.added>0||e.updated>0||e.deleted>0)&&ee.info(e,`[backlinks] branch-switch reconcile for ${w}`)}else await de.rebuildFromDisk(w);de.saveToDisk(w).catch(e=>{console.warn(`[backlinks] Failed to persist branch cache for ${w}:`,e)})}catch(e){ee.error({err:e,branch:w},`[backlinks] branch-switch rebuild failed; backlinks may be stale`)}if(fe.init(),me.current&&e.batchKind===`cross-branch`){let e=0;for(let[t]of _e.documents)if(!(isSystemDoc(t)||isConfigDoc(t)))try{let S=await readParkedState(me.current,w,SERVICE_WRITER.id,t);if(!S||S.markdown===S.diskSnapshot)continue;let E=getReconciledBase(t);if(!E)continue;let D=reconcile({docName:t,base:S.diskSnapshot,ours:S.markdown,theirs:E});switch(D.kind){case`merged`:case`clean`:st(t,D.newContent),setReconciledBase(t,D.newContent),e++;break;case`conflicts`:st(t,D.newContent),setReconciledBase(t,D.newContent),incrementConflict(),e++;{let e=_e.documents.get(t);if(e){let t=e.getMap(`lifecycle`);t.set(`status`,`conflict`),t.set(`reason`,`merged-with-markers`)}}break;case`noop`:case`refused`:break}}catch(e){ee.error({err:e,docName:t},`[branch-switch] restore WIP failed for ${t}`)}e>0&&ee.info({count:e,branch:w},`[branch-switch] restored ${e} parked docs on ${w}`)}if(e.oldBranch?.startsWith(`detached-`)&&me.current)try{let t=shadowGit(me.current),S=(await t.raw(`for-each-ref`,`refs/wip/${e.oldBranch}/`,`--format=%(refname)`)).trim();if(S){for(let e of S.split(`
|
|
3301
3301
|
`))e&&await t.raw(`update-ref`,`-d`,e);ee.info({context:e.oldBranch},`[branch-switch] cleaned up detached context ${e.oldBranch}`)}}catch(e){ee.error({err:e},`[branch-switch] detached cleanup failed`)}setBatchInProgress(!1),await ge.flushDeferredStores(`discard-stale`),ye?.emitBranchSwitched(w)}if(e.headMoved&&e.newHead&&me.current&&S>0){let t=H??`.`;try{let S=await commitUpstreamImport(me.current,t,e.oldHead,e.newHead,w);incrementUpstreamImport(),ee.info({oldHead:e.oldHead?.slice(0,8)??`null`,newHead:e.newHead.slice(0,8),sha:S.slice(0,8)},`[history] upstream-import from ${e.oldHead?.slice(0,8)??`null`}..${e.newHead.slice(0,8)} → ${S.slice(0,8)}`)}catch(e){ee.error({err:e},`[shadow] upstream-import failed`)}}})}catch(e){ee.error({err:e},`[server] HEAD watcher failed to start`),Wt.push(`head-watcher`)}let D=J?.[0]??`open-knowledge`,O=[`-c`,`credential.helper=!${J&&J.length>1?J.join(` `):D} auth git-credential`];try{Bt=new SyncEngine({projectDir:S,contentDir:t,contentFilter:ue,contentRoot:H,syncEnabled:te(),credentialArgs:O,cc1Broadcaster:ye,setBatchInProgress:e=>{setBatchInProgress(e),e||ge.flushDeferredStores(`within-branch`).catch(e=>{ee.error({err:e},`[persistence] deferred store drain failed after sync batch`)})},onStateChange:e=>{ee.info({state:e},`[sync] state → ${e}`)},onAutoDisable:async e=>{ee.warn({reason:e},`[sync] auto-disabled — persisting to project-local config`);let t=await writeConfigPatch({cwd:S,scope:`project-local`,patch:{autoSync:{enabled:!1}}});t.ok||ee.error({result:t,reason:e,humanError:humanFormat(t.error),configPath:resolveConfigPath(`project-local`,S)},`[sync] failed to persist auto-disable — next restart WILL re-enable sync and re-trigger the same failure. Check permissions on the config path.`)}}),await Bt.start()}catch(e){ee.warn({err:e},`[server] SyncEngine failed to start — sync disabled`),Bt=null}ze(`files`),ze(`backlinks`),ze(`graph`),ze(`tags`)}return Kt().then(Pe,Ie),{hocuspocus:_e,sessionManager:ve,cc1Broadcaster:ye,agentFocusBroadcaster:Ce,agentPresenceBroadcaster:we,contentFilter:ue,basenameIndex:oe,serverInstanceId:ne,destroy:Ut,ready:Re,degraded:Wt,lockDir:ae,get syncEngine(){return Bt}}}const LEGACY_RUNTIME_FILENAMES=[`server.lock`,`ui.lock`,`state.json`,`principal.json`,`sync-state.json`,`conflicts.json`,`last-spawn-error.log`],LEGACY_RUNTIME_DIRNAMES=[`cache`,`tmp`];function findLegacyRuntimeFiles(e){let t=resolve(e,LOCAL_DIR);if(!(()=>{if(!existsSync(t))return!0;try{return readdirSync(t).length===0}catch{return!0}})())return[];let S=[];for(let t of LEGACY_RUNTIME_FILENAMES)existsSync(resolve(e,t))&&S.push(t);for(let t of LEGACY_RUNTIME_DIRNAMES){let w=resolve(e,t);try{existsSync(w)&&statSync(w).isDirectory()&&S.push(`${t}/`)}catch{}}return S}function computeWorktreeAttributes(e){let t=resolveGitDirDetailed(e);switch(t.kind){case`directory`:return{kind:`main`,gitdir:t.path};case`linked`:return{kind:`linked`,gitdir:t.path};case`malformed-pointer`:return{kind:`linked`,gitdir:null};case`inaccessible`:case`absent`:return{kind:`main`,gitdir:null}}}const DEFAULT_IDLE_THRESHOLD_MS=1800*1e3,DESTROY_STEP_TIMEOUT_MS=5e3;async function bootServer(e){initTelemetry();let{kind:t,gitdir:S}=computeWorktreeAttributes(e.projectDir??e.contentDir),w={"ok.worktree.kind":t};return S!==null&&(w[`ok.worktree.gitdir`]=normalizeFsPath(S)),withSpan(`ok.boot`,{attributes:w},async()=>bootServerInner(e))}async function bootServerInner(e){let t=e.skipAutoInit??!1,S=e.attachUiSibling??!0,w=e.idleShutdownMs,E=e.log??getLogger(`boot`),D=process.env.OK_LOCK_KIND===`mcp-spawned`||process.env.OK_LOCK_KIND===`interactive`?process.env.OK_LOCK_KIND:void 0,O=e.lockKind??D??`interactive`,{createServer:k}=await import(`node:http`),{updateServerLockPort:j}=await import(`./server-lock-BniQ3qki-DjKtnzVr.mjs`).then(e=>e.a),F=!1;if(!t&&e.autoInitFn)try{F=!!await e.autoInitFn()}catch(e){E.warn({err:e},`autoInitFn failed`)}let L=e.projectDir??e.contentDir,B=resolve(L,`.ok`);if(!existsSync(resolve(B,`config.yml`)))throw new MissingOkConfigError(existsSync(B)?`config`:`okdir`,L);existsSync(resolve(B,`.gitignore`))||console.warn("[boot] Note: .ok/.gitignore is missing — per-machine state files in .ok/ may show up as untracked changes. Run `ok init` to add the recommended ignore entries.");let H=findLegacyRuntimeFiles(B);H.length>0&&console.warn(`[boot] Found legacy runtime files at .ok/${H.join(`, `)}. Delete .ok/ and re-init — these files moved to .ok/${LOCAL_DIR}/.`);let q=createServer$1({contentDir:e.contentDir,projectDir:e.projectDir,contentRoot:e.contentRoot,port:e.port,host:e.host,quiet:e.quiet??!1,debounce:e.debounce,maxDebounce:e.maxDebounce,gitEnabled:e.gitEnabled,commitDebounceMs:e.commitDebounceMs,wipRef:e.wipRef,enableTestRoutes:e.enableTestRoutes,shadowRepo:e.shadowRepo,destroyTimeoutMs:e.destroyTimeoutMs,localOpCliArgs:e.localOpCliArgs,onAgentWrite:e.onAgentWrite,lockKind:O,skipStateManifestCheck:e.skipStateManifestCheck}),{hocuspocus:J,destroy:Y,ready:ee,degraded:te,lockDir:ne,sessionManager:ae,agentFocusBroadcaster:oe,agentPresenceBroadcaster:se}=q,ce=(()=>{let t=e.host??`localhost`;return t===`0.0.0.0`||t===`::`?`localhost`:t.includes(`:`)&&!t.startsWith(`[`)?`[${t}]`:t})(),ue=e.port??0,de=createMcpHttpHandler({contentDir:e.contentDir,projectDir:e.projectDir??e.contentDir,config:e.config,getServerUrl:()=>`http://${ce}:${ue}`,log:E}),fe=k();fe.headersTimeout=3e4,fe.requestTimeout=6e4;let me=e.serveContentAssets?createAssetServeMiddleware({contentFilter:q.contentFilter,contentSirv:build_default(e.contentDir,{dev:!0,dotfiles:!1}),inlineExtensions:INLINE_RENDERABLE_EXTENSIONS,assetExtensions:ASSET_EXTENSIONS,blocklistExtensions:EXECUTABLE_BLOCKLIST_EXTENSIONS}):void 0,ge=!1;if(e.reactShellDistDir)try{acquireUiLock(ne,{port:0,worktreeRoot:e.projectDir??e.contentDir}),ge=!0}catch(e){if(e instanceof UiLockCollisionError)E.info({event:`ui-lock-yielded-to-live-holder`,pid:process.pid,existingPid:e.existing.pid,existingPort:e.existing.port,lockDir:ne},`ui.lock already held by a live process — yielding (advertisement is fulfilled)`);else throw await Y().catch(()=>{}),e}let _e=e.reactShellDistDir?build_default(e.reactShellDistDir,{single:!0,gzip:!0,immutable:!0}):void 0,ve=mountMcpAndApi({httpServer:fe,hocuspocus:J,mcpHttpHandler:de,log:E,sessionManager:ae,agentFocusBroadcaster:oe,agentPresenceBroadcaster:se,keepaliveGraceMs:e.keepaliveGraceMs,contentAssetMiddleware:me,reactShellMiddleware:_e}),ye=async()=>{throw Error(`bootServer: destroy() invoked before initialization — boot did not complete`)},Ce=null;w!==null&&(Ce=attachIdleShutdown({httpServer:fe,thresholdMs:w??DEFAULT_IDLE_THRESHOLD_MS,log:E,onShutdown:(e.idleShutdownHandler??(e=>async()=>{await e()}))(async()=>{await ye()})})),await restoreLifecycleFromConflictsJson({hocuspocus:J,projectDir:e.projectDir??e.contentDir,log:E});try{await new Promise((t,S)=>{let w=e=>S(e);fe.once(`error`,w),fe.listen(e.port,e.host,()=>{fe.removeListener(`error`,w),t()})})}catch(e){if(ge)try{releaseUiLock(ne)}catch(e){E.warn({err:e},`releaseUiLock failed during listen-error cleanup`)}throw await Y().catch(()=>{}),e}let we=fe.address(),Te=typeof we==`object`&&we?we.port:e.port??0;if(ue=Te,j(ne,Te),ge&&updateUiLockPort(ne,Te),S&&e.spawnUiSiblingFn)try{await e.spawnUiSiblingFn({lockDir:ne,log:E})}catch(e){E.warn({err:e},`spawnUiSiblingFn failed`)}let De=!1,je=async(e,t)=>{let S;try{await Promise.race([t(),new Promise((t,w)=>{S=setTimeout(()=>{w(Error(`${e} timed out after ${DESTROY_STEP_TIMEOUT_MS}ms`))},DESTROY_STEP_TIMEOUT_MS),S.unref?.()})])}finally{S!==void 0&&clearTimeout(S)}};return ye=async()=>{if(De)return;De=!0;let e=[],t=async(t,S)=>{try{await je(t,S)}catch(S){e.push(S),E.warn({err:S,step:t},`bootServer destroy step failed`)}};try{Ce?.detach()}catch(t){e.push(t),E.warn({err:t,step:`idleHandle.detach`},`bootServer destroy step failed`)}if(await t(`mount.shutdown`,()=>ve.shutdown()),await t(`mcpHttpHandler.close`,()=>de.close()),await t(`mount.wss.close`,()=>new Promise((e,t)=>{ve.wss.close(S=>S?t(S):e())})),await t(`httpServer.closeAllConnections`,async()=>{fe.closeAllConnections?.()}),await t(`httpServer.close`,()=>new Promise((e,t)=>{fe.close(S=>S&&S.code!==`ERR_SERVER_NOT_RUNNING`?t(S):e())})),await t(`destroyHocuspocus`,()=>Y()),ge&&await t(`releaseUiLock`,async()=>releaseUiLock(ne)),await t(`shutdownTelemetry`,()=>shutdownTelemetry()),e.length>0)throw AggregateError(e,`bootServer destroy completed with errors`)},{httpServer:fe,destroy:ye,lockDir:ne,contentDir:e.contentDir,port:Te,ready:ee,degraded:te,didAutoInit:F,serverInstance:q}}async function restoreLifecycleFromConflictsJson(e){let{hocuspocus:t,projectDir:S,log:w}=e,E,D;try{E=new ConflictStore(S),D=E.list()}catch(e){w.warn({err:e,projectDir:S},`[boot] lifecycle restore: failed to read conflicts.json — skipping`);return}if(D.length===0)return;let O=null;try{let e=resolveGitDir(S),t=e?join(e,`MERGE_HEAD`):null;if(!t||!existsSync(t)){E.clear(),console.warn(JSON.stringify({event:`lifecycle-restore-cleared-stale-conflicts`,reason:`no-merge-head`,count:D.length}));return}let w=(await simpleGit({baseDir:S,timeout:{block:5e3}}).raw([`diff`,`--name-only`,`--diff-filter=U`])).trim();O=new Set(w?w.split(`
|
|
3302
3302
|
`).map(e=>e.trim()).filter(Boolean):[])}catch(e){w.warn({err:e,projectDir:S},`[boot] lifecycle restore: git unmerged probe failed — restoring all entries`)}if(O!==null){let e=0;for(let t of D)O.has(t.file)||(E.removeConflict(t.file),e++);if(e>0&&console.warn(JSON.stringify({event:`lifecycle-restore-pruned-resolved-entries`,pruned:e,remaining:D.length-e})),D=D.filter(e=>O?.has(e.file)),D.length===0)return}for(let e of D){let S=stripDocExtension(e.file),E=null,D=!1;try{E=await t.openDirectConnection(S);let e=E.document;if(!e)continue;let w=e.getMap(`lifecycle`);w.set(`status`,`conflict`),w.set(`reason`,`conflict-markers`),D=!0,console.warn(JSON.stringify({event:`lifecycle-restored-from-conflicts-json`,"doc.name":S}))}catch(e){w.warn({err:e,docName:S},`[boot] lifecycle restore: failed to set lifecycle for doc — skipping`)}finally{if(E)try{await E.disconnect()}catch(e){w.warn({err:e,docName:S,restored:D},`[boot] lifecycle restore: disconnect failed after lifecycle write`)}}}}const ConfigSchema=ConfigSchema$1;function detectClaudeDesktopPresence(e={}){let t=e.home??homedir(),S=e.platformName??process.platform,w=e.env??process.env;return S===`darwin`?existsSync(join(t,`Library`,`Application Support`,`Claude`)):S===`win32`?existsSync(join(w.APPDATA??join(t,`AppData`,`Roaming`),`Claude`)):!1}const ANCESTOR_WALK_DEPTH_LIMIT=30,GIT_MARKER=`.git`;function findEnclosingGitRoot(e){let t=resolve(e),S=0;for(;S<ANCESTOR_WALK_DEPTH_LIMIT;){let e=!1;try{e=existsSync(resolve(t,GIT_MARKER))}catch{e=!1}if(e)return{gitRoot:t,distance:S};let w=dirname(t);if(w===t)return null;t=w,S+=1}return null}const execFileAsync=promisify(execFile);var ProjectGitInitError=class extends Error{stderr;constructor(e,t=``,S){super(e,S),this.name=`ProjectGitInitError`,this.stderr=t}};async function isInsideExistingWorkTree(e){try{let{stdout:t}=await execFileAsync(`git`,[`rev-parse`,`--is-inside-work-tree`],{cwd:e});return t.trim()===`true`}catch{return!1}}async function ensureProjectGit(e){let t=resolve(e),S=resolve(t,`.git`),w=resolve(S,`HEAD`),E=!1;if(existsSync(S)){if(!statSync(S).isDirectory()||existsSync(w))return{didInit:!1};console.log(`[project-git] detected partial .git/ — running git init to repair`),E=!0}else if(await isInsideExistingWorkTree(t))return{didInit:!1};let D=``;try{D=(await execFileAsync(`git`,[`init`,`--initial-branch=main`,t])).stderr??``}catch(e){let S=typeof e==`object`&&e&&`stderr`in e?String(e.stderr??``):``;throw new ProjectGitInitError(`git init failed at ${t}: ${e instanceof Error?e.message:String(e)}`,S,{cause:e})}if(!existsSync(w))throw new ProjectGitInitError(`git init reported success but ${S}/HEAD is missing (partial init detected)`,D);return E?(console.log(`[project-git] backfilled missing .git/HEAD at ${t}`),{didInit:!0,repaired:!0}):(console.log(`[project-git] initialized .git/ at ${t} (branch: main)`),{didInit:!0})}async function resolvePackageVersion(e,t){let S;try{S=createRequire(t).resolve(e)}catch(e){if(e?.code===`MODULE_NOT_FOUND`)return;throw e}for(let t=dirname(S),w=0;w<32;w+=1){let S=join(t,`package.json`);if(existsSync(S))try{let t=JSON.parse(await readFile$1(S,`utf-8`));if(t.name===e&&typeof t.version==`string`)return t.version}catch{}let w=dirname(t);if(w===t)return;t=w}}export{assertNeverDiskEvent as $,rewriteWikiLinksForDocumentRename as $n,GitDirAccessError as $r,initShadowRepo as $t,MissingOkConfigError as A,looseObject as Ai,readSkillInstallStateSnapshot as An,tracedWriteFile as Ar,createTestLogger as At,STARTER_PACK_IDS as B,releaseUiLock as Bn,writeTargetVersion as Br,formatContributors as Bt,LOG_MD_TEMPLATE as C,OK_PROJECT_MARKER as Ci,parseHocuspocusAuthToken as Cn,tracedMkdir as Cr,createLiveDerivedIndexExtension as Ct,MCP_SERVER_NAME as D,array as Di,readAllTargets as Dn,tracedRmSync as Dr,createServer$1 as Dt,MCP_CONNECTION_ID_HEADER as E,any$1 as Ei,planSeed as En,tracedRenameSync as Er,createPersistenceExtension as Et,SERVICE_WRITER as F,_coercedNumber as Fi,reconcile as Fn,validateCloneInputs as Fr,evictStaleTrackerEntries as Ft,StateManifestError as G,resolveCursorBinaryDefault as Gn,isInitializedNotification as Gr,getLogger as Gt,STATE_MANIFEST_FILENAME as H,resetMetrics as Hn,McpServer as Hr,gcCheckpointRefs as Ht,SKILL_INSTALL_EVENTS_FILE_REL as I,NEVER as Ii,recordContributor as In,validateSkillZip as Ir,extractWikiLinksFromMarkdown as It,acquireUiLock as J,resolvePack as Jn,atomicWriteFileSync as Jr,getTracer as Jt,TagIndex as K,resolveCursorSpawnInvocation as Kn,isJSONRPCRequest as Kr,getMeter as Kt,STARTER_FOLDERS as L,require_dist$2 as Li,recordSkillInstallEvent as Ln,withSpan as Lr,findEnclosingGitRoot as Lt,PinoLogger as M,object$1 as Mi,readTargetRecordedAt as Mn,updateLastKnownHash as Mr,detectProjectShape as Mt,ProjectGitInitError as N,string$2 as Ni,readTargetVersion as Nn,updateUiLockPort as Nr,ensureProjectGit as Nt,MISSING_OK_CONFIG_MESSAGE as O,boolean$1 as Oi,readBranchFromHead as On,tracedRmdirSync as Or,createServerObserverExtension as Ot,ROLLBACK_ORIGIN as P,url as Pi,readUiLock as Pn,validateAgentId as Pr,errorResponse as Pt,assertCompatibleStateManifest as Q,rewriteMarkdownLinksForDocumentRename as Qn,writeConfigPatch as Qr,incrementServerObserverFire as Qt,STARTER_FOLDER_FRONTMATTER_FILENAME as R,registerAllTools as Rn,withSpanSync as Rr,findEnclosingProjectRoot as Rt,LIVE_DERIVED_INDEX_DEBOUNCE_MS as S,LOCAL_DIR as Si,parseAuthRejectionWire as Sn,tracedLinkSync as Sr,createExternalChangeHandler as St,MAX_AGENT_SESSIONS as T,ZodNumber$1 as Ti,pathToDocName as Tn,tracedRename as Tr,createOsProbe as Tt,SeedPrerequisiteError as U,resolveBundledSkillDir as Un,JSONRPCMessageSchema as Ur,getCurrentMcpLogger as Ut,STARTER_TEMPLATES as V,removeLastKnownHash as Vn,writeTracker as Vr,formatContributorsFrom as Vt,SeedRootDirError as W,resolveContentDir as Wn,LATEST_PROTOCOL_VERSION as Wr,getLocalDir as Wt,applyExternalChange as X,restoreContributors as Xn,resolveConfigPath as Xr,handleSpawnCursor as Xt,applyAgentMarkdownWrite as Y,resolvePackageVersion as Yn,readConfigSafely as Yr,handleCollabSocketError as Yt,applySeed as Z,restoreLifecycleFromConflictsJson as Zn,withFileLockSync as Zr,incrementCollabSocketFilteredError as Zt,GIT_UPSTREAM_WRITER as _,humanFormat as _i,listStarterPacks as _n,startWatcher as _r,contributorCount as _t,AgentPresenceBroadcaster as a,DEFAULT_SERVER_HOST as ai,isAllowedWorkspaceHostHeader as an,safeContentPath as ar,buildSkillZip as at,HocuspocusAuthTokenSchema as b,isOrphanMode as bi,mountMcpAndApi as bn,toBroadcasterKey as br,createContentFilter as bt,BacklinkIndex as c,EXECUTABLE_BLOCKLIST_EXTENSIONS as ci,isKnownPackId as cn,sanitizeClientName as cr,classifyEvents as ct,CURSOR_BUNDLE_PATHS_BY_PLATFORM as d,ProblemDetailsSchema as di,isPathWithinDir as dn,seedBasenameIndex as dr,coercePackId as dt,MalformedGitPointerError as ei,initTelemetry as en,runAuthReposSubprocess as er,attachIdleShutdown as et,ConfigSchema as f,SKILL_STATE_TARGETS as fi,isProjectRoot as fn,setActiveSpanAttributes as fr,commitUpstreamImport as ft,FILE_WATCHER_ORIGIN as g,defaultScheduler as gi,listRescueCheckpoints as gn,splitMarkdownBlocks as gr,contentHash as gt,FILE_SYSTEM_WRITER as h,colorFromSeed as hi,lastKnownHash as hn,spawnDetached as hr,containsConflictMarkers as ht,AgentFocusBroadcaster as i,DEFAULT_GITHUB_OAUTH_CLIENT_ID as ii,isAllowedApiOrigin as in,runWithMcpLogger as ir,buildInstructions as it,OBSERVER_SYNC_ORIGIN as j,number$1 as ji,readStateManifest as jn,tracedWriteFileSync as jr,detectClaudeDesktopPresence as jt,McpLogger as k,literal as ki,readServerPackageVersion as kn,tracedUnlinkSync as kr,createStreamingErrorWriter as kt,CC1Broadcaster as l,INLINE_RENDERABLE_EXTENSIONS as li,isLoopbackAddress as ln,saveInMemoryCheckpoint as lr,classifyFsPath as lt,DEFAULT_PACK_ID as m,SYSTEM_DOC_NAME as mi,isSystemDoc as mn,shutdownTelemetry as mr,commitWipFromTree as mt,AGENT_ID_RE as n,ASSET_EXTENSIONS as ni,installTestLoggers as nn,runCloneSubprocess as nr,buildAndOpenSkill as nt,AgentSessionCapacityError as o,DEFAULT_SIGTERM_GRACE_MS as oi,isConfigDoc as on,safeSubdir as or,buildStarterFolderFrontmatterYaml as ot,DEFAULT_CHECKPOINT_RETENTION as p,SPAWN_ERROR_LOG as pi,isSelfWrite as pn,shadowGit as pr,commitWip as pt,UiLockCollisionError as q,resolveLockDir as qn,isJSONRPCResultResponse as qr,getMetrics as qt,AGENT_WRITE_ORIGIN as r,CC1_CONTRACT_VERSION as ri,installUserSkill as rn,runDeviceFlowSubprocess as rr,buildExecResult as rt,AgentSessionManager as s,EDITOR_LABELS as si,isHocuspocusAuthRejectionReason as sn,safetyCheckpoint as sr,buildWipTree as st,AGENT_ID_MAX_LEN as t,ALL_EDITOR_IDS as ti,installPrettyZodErrors as tn,runAuthStatusSubprocess as tr,bootServer as tt,CONFLICT_MARKER_RE as u,ORPHAN_MODES as ui,isPairedWriteOrigin as un,saveVersion as ur,clearContributors as ut,HOCUSPOCUS_AUTH_REJECTION_REASONS as v,iconFromClientName as vi,loadPrincipal as vn,streamingProblemEvent as vr,createApiExtension as vt,MANAGED_RENAME_ORIGIN as w,locateIssue as wi,parseKeepaliveConnectionId as wn,tracedMkdirSync as wr,createMcpHttpHandler as wt,INSTALLED_AGENTS_SCHEMES as x,CONFIG_SCHEMA_MAJOR_PATH as xi,normalizeFsPath as xn,tracedAppendFileSync as xr,createContentFilterAsync as xt,HocuspocusAuthRejection as y,isBranchNotFoundGitError as yi,loggerFactory as yn,swapContributors as yr,createAssetServeMiddleware as yt,STARTER_PACKS as z,registerWrite as zn,writeStateManifest as zr,formatAuthRejectionWire as zt};
|
|
3303
|
-
//# sourceMappingURL=dist-
|
|
3303
|
+
//# sourceMappingURL=dist-BuMJFmKr.mjs.map
|