@kidlat-dakila/flightplan 0.1.8 → 0.1.9
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/backend/main.js +118 -980
- package/frontend/assets/_branchId-7x6qWn3I.js +1 -0
- package/frontend/assets/_branchId-OMHvVhfT.js +1 -0
- package/frontend/assets/_id-1eTNGJK9.js +1 -0
- package/frontend/assets/_id-CHxZrl-p.js +1 -0
- package/frontend/assets/agents-C9xHqVQD.js +1 -0
- package/frontend/assets/agents-KKXkUQ27.js +1 -0
- package/frontend/assets/create-B3JUVzoL.js +1 -0
- package/frontend/assets/create-CriuRRQV.js +1 -0
- package/frontend/assets/create-CsL8aMCo.js +1 -0
- package/frontend/assets/create-DhWyrgF0.js +1 -0
- package/frontend/assets/download-B00Se_e0.js +1 -0
- package/frontend/assets/forges-BMb9Pcn1.js +1 -0
- package/frontend/assets/forges-BOVWBO1B.js +1 -0
- package/frontend/assets/index-4USZJYGF.js +1 -0
- package/frontend/assets/index-B4xFHIrG.js +1 -0
- package/frontend/assets/index-BA8Qwprc.js +6 -0
- package/frontend/assets/index-BUcr0tJt.js +1 -0
- package/frontend/assets/index-Ba3RqmDE.js +1 -0
- package/frontend/assets/index-CFZ7PaJE.js +1 -0
- package/frontend/assets/index-COS3U9jZ.js +1 -0
- package/frontend/assets/index-COdzqD_M.js +1 -0
- package/frontend/assets/index-CZ3Rr8-h.js +1 -0
- package/frontend/assets/index-CikPFj0e.js +1 -0
- package/frontend/assets/index-Cl1Gcfks.js +1 -0
- package/frontend/assets/index-CmrDaRXW.js +1 -0
- package/frontend/assets/index-CrCss1qG.js +1 -0
- package/frontend/assets/index-D8-ze-TP.js +1 -0
- package/frontend/assets/index-DB42uFFk.js +1 -0
- package/frontend/assets/index-DGsH5lbQ.js +170 -0
- package/frontend/assets/index-DQyWuir1.js +1 -0
- package/frontend/assets/index-DRndyOxR.js +463 -0
- package/frontend/assets/index-DaFaImds.js +1 -0
- package/frontend/assets/index-DbJECumi.js +1 -0
- package/frontend/assets/index-DpY8OPAr.js +1 -0
- package/frontend/assets/index-DvuJKeYS.js +1 -0
- package/frontend/assets/index-paF1osGm.js +1 -0
- package/frontend/assets/repositories-AJnxH9f7.js +1 -0
- package/frontend/assets/repositories-Dy8KRYwV.js +1 -0
- package/frontend/assets/review-B9u6XA77.js +1 -0
- package/frontend/assets/review-M5J-BQx7.js +1 -0
- package/frontend/assets/route-BLz_XVsx.js +1 -0
- package/frontend/index.html +1 -1
- package/package.json +1 -1
- package/published-review/app.js +106 -98
- package/frontend/assets/_branchId-Caxyy__g.js +0 -1
- package/frontend/assets/_branchId-IJ4VEzEl.js +0 -1
- package/frontend/assets/_id-3L9ONe4W.js +0 -1
- package/frontend/assets/_id-CvORsoNj.js +0 -1
- package/frontend/assets/agents-DnjhKMUc.js +0 -1
- package/frontend/assets/agents-bla75JmI.js +0 -1
- package/frontend/assets/create-B82q7ZMu.js +0 -1
- package/frontend/assets/create-C9yw-thL.js +0 -1
- package/frontend/assets/create-CEpA1s8S.js +0 -1
- package/frontend/assets/create-D0h6PRxn.js +0 -1
- package/frontend/assets/download-CwWMZwNG.js +0 -1
- package/frontend/assets/forges-BH3uXIQL.js +0 -1
- package/frontend/assets/forges-uSh1-w20.js +0 -1
- package/frontend/assets/index--nj01XKS.js +0 -1
- package/frontend/assets/index-0VAWT0gs.js +0 -1
- package/frontend/assets/index-B0zuYONu.js +0 -1
- package/frontend/assets/index-BQaZ5gZR.js +0 -1
- package/frontend/assets/index-BZ6iL63Z.js +0 -1
- package/frontend/assets/index-Bar8NyIm.js +0 -1
- package/frontend/assets/index-BlTfCkr5.js +0 -1
- package/frontend/assets/index-BvuPClj3.js +0 -1
- package/frontend/assets/index-C9xsdcXo.js +0 -1
- package/frontend/assets/index-CJDNq1TA.js +0 -1
- package/frontend/assets/index-CJslcuJ0.js +0 -1
- package/frontend/assets/index-CXyB0ld0.js +0 -1
- package/frontend/assets/index-CcORd1N6.js +0 -1
- package/frontend/assets/index-CrAQ5_e4.js +0 -1
- package/frontend/assets/index-DG0FDX8u.js +0 -1
- package/frontend/assets/index-DKnoo-kT.js +0 -455
- package/frontend/assets/index-DKzDkR6v.js +0 -1
- package/frontend/assets/index-DfKNJbUM.js +0 -170
- package/frontend/assets/index-DlUHisPA.js +0 -1
- package/frontend/assets/index-Dv5cF6qF.js +0 -1
- package/frontend/assets/index-JPWJ3IiN.js +0 -1
- package/frontend/assets/index-V1avMli5.js +0 -6
- package/frontend/assets/index-iRAoFOv3.js +0 -1
- package/frontend/assets/repositories-DqGU7W63.js +0 -1
- package/frontend/assets/repositories-DuObN8PJ.js +0 -1
- package/frontend/assets/review-BbbMUFsk.js +0 -1
- package/frontend/assets/review-C3k0h5Vl.js +0 -1
- package/frontend/assets/route-D8s8AylJ.js +0 -1
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
var Qi=Object.defineProperty;var Xi=(t,e,n)=>e in t?Qi(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var P=(t,e,n)=>Xi(t,typeof e!="symbol"?e+"":e,n);import{a3 as ee,ai as Z,aj as ue,ak as Zi,al as Yi,am as cs,an as Se,ao as mr,ap as Ji,aq as eo,ar as gr,as as to,at,r as _,au as us,av as no,aw as ro,ax as se,ay as Ie,j as T,az as X,aA as so,aB as io,aC as oo,aD as ao,aE as ds,K as lo,aF as co,aG as V,aH as He,aI as W,aJ as Hn,aK as me,aL as je,aM as we,aN as Ne,aO as Tn,aP as lt,aQ as uo,aR as ho,aS as hs,aT as Bn,aU as po,aV as fo,aW as mo,aX as ps,aY as go,aZ as fs,a_ as ko,a$ as bo,b0 as yo,b1 as ms,b2 as kr,b3 as At,b4 as xo,b5 as ct,b6 as wo,b7 as vo,b8 as To,b9 as Eo,ba as Ao,bb as So,bc as ge,bd as pt,be as Co,bf as Lo,bg as Mo,bh as gs,c as Te,bi as ks,B as ut,bj as Ro,bk as bs,bl as Io,bm as No,bn as _o,E as ys,bo as Oo,Z as $o,bp as Po}from"./index-DRndyOxR.js";/**
|
|
2
|
+
* @license lucide-react v1.49.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const xs={name:"bold",size:24,node:[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]]};xs.node;const Do=ee(xs);/**
|
|
7
|
+
* @license lucide-react v1.49.0 - ISC
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the ISC license.
|
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/const ws={name:"code",size:24,node:[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]};ws.node;const zo=ee(ws);/**
|
|
12
|
+
* @license lucide-react v1.49.0 - ISC
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the ISC license.
|
|
15
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
+
*/const vs={name:"file-code",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]]};vs.node;const Ho=ee(vs);/**
|
|
17
|
+
* @license lucide-react v1.49.0 - ISC
|
|
18
|
+
*
|
|
19
|
+
* This source code is licensed under the ISC license.
|
|
20
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
+
*/const Ts={name:"heading",size:24,node:[["path",{d:"M6 12h12",key:"8npq4p"}],["path",{d:"M6 20V4",key:"1w1bmo"}],["path",{d:"M18 20V4",key:"o2hl4u"}]]};Ts.node;const Bo=ee(Ts);/**
|
|
22
|
+
* @license lucide-react v1.49.0 - ISC
|
|
23
|
+
*
|
|
24
|
+
* This source code is licensed under the ISC license.
|
|
25
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
+
*/const Es={name:"italic",size:24,node:[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]]};Es.node;const jo=ee(Es);/**
|
|
27
|
+
* @license lucide-react v1.49.0 - ISC
|
|
28
|
+
*
|
|
29
|
+
* This source code is licensed under the ISC license.
|
|
30
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
31
|
+
*/const As={name:"link",size:24,node:[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]};As.node;const Uo=ee(As);/**
|
|
32
|
+
* @license lucide-react v1.49.0 - ISC
|
|
33
|
+
*
|
|
34
|
+
* This source code is licensed under the ISC license.
|
|
35
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
36
|
+
*/const Ss={name:"list-collapse",size:24,node:[["path",{d:"M10 5h11",key:"1hkqpe"}],["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 19h11",key:"14g2nv"}],["path",{d:"m3 10 3-3-3-3",key:"i7pm08"}],["path",{d:"m3 20 3-3-3-3",key:"20gx1n"}]]};Ss.node;const qo=ee(Ss);/**
|
|
37
|
+
* @license lucide-react v1.49.0 - ISC
|
|
38
|
+
*
|
|
39
|
+
* This source code is licensed under the ISC license.
|
|
40
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
41
|
+
*/const Cs={name:"list-ordered",size:24,node:[["path",{d:"M11 5h10",key:"1cz7ny"}],["path",{d:"M11 12h10",key:"1438ji"}],["path",{d:"M11 19h10",key:"11t30w"}],["path",{d:"M4 4h1v5",key:"10yrso"}],["path",{d:"M4 9h2",key:"r1h2o0"}],["path",{d:"M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02",key:"xtkcd5"}]]};Cs.node;const Fo=ee(Cs);/**
|
|
42
|
+
* @license lucide-react v1.49.0 - ISC
|
|
43
|
+
*
|
|
44
|
+
* This source code is licensed under the ISC license.
|
|
45
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
46
|
+
*/const Ls={name:"list",size:24,node:[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]]};Ls.node;const Wo=ee(Ls);/**
|
|
47
|
+
* @license lucide-react v1.49.0 - ISC
|
|
48
|
+
*
|
|
49
|
+
* This source code is licensed under the ISC license.
|
|
50
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
51
|
+
*/const Ms={name:"panels-top-left",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M9 21V9",key:"1oto5p"}]],aliases:["layout"]};Ms.node;const Ko=ee(Ms);/**
|
|
52
|
+
* @license lucide-react v1.49.0 - ISC
|
|
53
|
+
*
|
|
54
|
+
* This source code is licensed under the ISC license.
|
|
55
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
56
|
+
*/const Rs={name:"square-code",size:24,node:[["path",{d:"m10 9-3 3 3 3",key:"1oro0q"}],["path",{d:"m14 15 3-3-3-3",key:"bz13h7"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]],aliases:["code-square"]};Rs.node;const Vo=ee(Rs);/**
|
|
57
|
+
* @license lucide-react v1.49.0 - ISC
|
|
58
|
+
*
|
|
59
|
+
* This source code is licensed under the ISC license.
|
|
60
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
61
|
+
*/const Is={name:"text-quote",size:24,node:[["path",{d:"M17 5H3",key:"1cn7zz"}],["path",{d:"M21 12H8",key:"scolzb"}],["path",{d:"M21 19H8",key:"13qgcb"}],["path",{d:"M3 12v7",key:"1ri8j3"}]]};Is.node;const Go=ee(Is);function jn(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Oe=jn();function Ns(t){Oe=t}var Ce={exec:()=>null};function I(t,e=""){let n=typeof t=="string"?t:t.source,r={replace:(s,i)=>{let o=typeof i=="string"?i:i.source;return o=o.replace(G.caret,"$1"),n=n.replace(s,o),r},getRegex:()=>new RegExp(n,e)};return r}var Qo=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),G={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}>`)},Xo=/^(?:[ \t]*(?:\n|$))+/,Zo=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Yo=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,ft=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Jo=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Un=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,_s=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Os=I(_s).replace(/bull/g,Un).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),ea=I(_s).replace(/bull/g,Un).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),qn=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,ta=/^[^\n]+/,Fn=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,na=I(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Fn).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),ra=I(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Un).getRegex(),an="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Wn=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,sa=I("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Wn).replace("tag",an).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),$s=I(qn).replace("hr",ft).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",an).getRegex(),ia=I(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",$s).getRegex(),Kn={blockquote:ia,code:Zo,def:na,fences:Yo,heading:Jo,hr:ft,html:sa,lheading:Os,list:ra,newline:Xo,paragraph:$s,table:Ce,text:ta},br=I("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",ft).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",an).getRegex(),oa={...Kn,lheading:ea,table:br,paragraph:I(qn).replace("hr",ft).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",br).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",an).getRegex()},aa={...Kn,html:I(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Wn).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Ce,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:I(qn).replace("hr",ft).replace("heading",` *#{1,6} *[^
|
|
62
|
+
]`).replace("lheading",Os).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},la=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,ca=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Ps=/^( {2,}|\\)\n(?!\s*$)/,ua=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Ue=/[\p{P}\p{S}]/u,ln=/[\s\p{P}\p{S}]/u,Vn=/[^\s\p{P}\p{S}]/u,da=I(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,ln).getRegex(),Ds=/(?!~)[\p{P}\p{S}]/u,ha=/(?!~)[\s\p{P}\p{S}]/u,pa=/(?:[^\s\p{P}\p{S}]|~)/u,fa=I(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Qo?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),zs=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,ma=I(zs,"u").replace(/punct/g,Ue).getRegex(),ga=I(zs,"u").replace(/punct/g,Ds).getRegex(),Hs="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",ka=I(Hs,"gu").replace(/notPunctSpace/g,Vn).replace(/punctSpace/g,ln).replace(/punct/g,Ue).getRegex(),ba=I(Hs,"gu").replace(/notPunctSpace/g,pa).replace(/punctSpace/g,ha).replace(/punct/g,Ds).getRegex(),ya=I("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Vn).replace(/punctSpace/g,ln).replace(/punct/g,Ue).getRegex(),xa=I(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,Ue).getRegex(),wa="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",va=I(wa,"gu").replace(/notPunctSpace/g,Vn).replace(/punctSpace/g,ln).replace(/punct/g,Ue).getRegex(),Ta=I(/\\(punct)/,"gu").replace(/punct/g,Ue).getRegex(),Ea=I(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Aa=I(Wn).replace("(?:-->|$)","-->").getRegex(),Sa=I("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Aa).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),St=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,Ca=I(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",St).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Bs=I(/^!?\[(label)\]\[(ref)\]/).replace("label",St).replace("ref",Fn).getRegex(),js=I(/^!?\[(ref)\](?:\[\])?/).replace("ref",Fn).getRegex(),La=I("reflink|nolink(?!\\()","g").replace("reflink",Bs).replace("nolink",js).getRegex(),yr=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Gn={_backpedal:Ce,anyPunctuation:Ta,autolink:Ea,blockSkip:fa,br:Ps,code:ca,del:Ce,delLDelim:Ce,delRDelim:Ce,emStrongLDelim:ma,emStrongRDelimAst:ka,emStrongRDelimUnd:ya,escape:la,link:Ca,nolink:js,punctuation:da,reflink:Bs,reflinkSearch:La,tag:Sa,text:ua,url:Ce},Ma={...Gn,link:I(/^!?\[(label)\]\((.*?)\)/).replace("label",St).getRegex(),reflink:I(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",St).getRegex()},En={...Gn,emStrongRDelimAst:ba,emStrongLDelim:ga,delLDelim:xa,delRDelim:va,url:I(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",yr).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:I(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",yr).getRegex()},Ra={...En,br:I(Ps).replace("{2,}","*").getRegex(),text:I(En.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},mt={normal:Kn,gfm:oa,pedantic:aa},qe={normal:Gn,gfm:En,breaks:Ra,pedantic:Ma},Ia={"&":"&","<":"<",">":">",'"':""","'":"'"},xr=t=>Ia[t];function ie(t,e){if(e){if(G.escapeTest.test(t))return t.replace(G.escapeReplace,xr)}else if(G.escapeTestNoEncode.test(t))return t.replace(G.escapeReplaceNoEncode,xr);return t}function wr(t){try{t=encodeURI(t).replace(G.percentDecode,"%")}catch{return null}return t}function vr(t,e){var i;let n=t.replace(G.findPipe,(o,a,l)=>{let c=!1,u=a;for(;--u>=0&&l[u]==="\\";)c=!c;return c?"|":" |"}),r=n.split(G.splitPipe),s=0;if(r[0].trim()||r.shift(),r.length>0&&!((i=r.at(-1))!=null&&i.trim())&&r.pop(),e)if(r.length>e)r.splice(e);else for(;r.length<e;)r.push("");for(;s<r.length;s++)r[s]=r[s].trim().replace(G.slashPipe,"|");return r}function Fe(t,e,n){let r=t.length;if(r===0)return"";let s=0;for(;s<r&&t.charAt(r-s-1)===e;)s++;return t.slice(0,r-s)}function Na(t,e){if(t.indexOf(e[1])===-1)return-1;let n=0;for(let r=0;r<t.length;r++)if(t[r]==="\\")r++;else if(t[r]===e[0])n++;else if(t[r]===e[1]&&(n--,n<0))return r;return n>0?-2:-1}function _a(t,e=0){let n=e,r="";for(let s of t)if(s===" "){let i=4-n%4;r+=" ".repeat(i),n+=i}else r+=s,n++;return r}function Tr(t,e,n,r,s){let i=e.href,o=e.title||null,a=t[1].replace(s.other.outputLinkReplace,"$1");r.state.inLink=!0;let l={type:t[0].charAt(0)==="!"?"image":"link",raw:n,href:i,title:o,text:a,tokens:r.inlineTokens(a)};return r.state.inLink=!1,l}function Oa(t,e,n){let r=t.match(n.other.indentCodeCompensation);if(r===null)return e;let s=r[1];return e.split(`
|
|
63
|
+
`).map(i=>{let o=i.match(n.other.beginningSpace);if(o===null)return i;let[a]=o;return a.length>=s.length?i.slice(s.length):i}).join(`
|
|
64
|
+
`)}var Ct=class{constructor(t){P(this,"options");P(this,"rules");P(this,"lexer");this.options=t||Oe}space(t){let e=this.rules.block.newline.exec(t);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(t){let e=this.rules.block.code.exec(t);if(e){let n=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?n:Fe(n,`
|
|
65
|
+
`)}}}fences(t){let e=this.rules.block.fences.exec(t);if(e){let n=e[0],r=Oa(n,e[3]||"",this.rules);return{type:"code",raw:n,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:r}}}heading(t){let e=this.rules.block.heading.exec(t);if(e){let n=e[2].trim();if(this.rules.other.endingHash.test(n)){let r=Fe(n,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(n=r.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(t){let e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:Fe(e[0],`
|
|
66
|
+
`)}}blockquote(t){let e=this.rules.block.blockquote.exec(t);if(e){let n=Fe(e[0],`
|
|
67
|
+
`).split(`
|
|
68
|
+
`),r="",s="",i=[];for(;n.length>0;){let o=!1,a=[],l;for(l=0;l<n.length;l++)if(this.rules.other.blockquoteStart.test(n[l]))a.push(n[l]),o=!0;else if(!o)a.push(n[l]);else break;n=n.slice(l);let c=a.join(`
|
|
69
|
+
`),u=c.replace(this.rules.other.blockquoteSetextReplace,`
|
|
70
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");r=r?`${r}
|
|
71
|
+
${c}`:c,s=s?`${s}
|
|
72
|
+
${u}`:u;let d=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(u,i,!0),this.lexer.state.top=d,n.length===0)break;let h=i.at(-1);if((h==null?void 0:h.type)==="code")break;if((h==null?void 0:h.type)==="blockquote"){let p=h,g=p.raw+`
|
|
73
|
+
`+n.join(`
|
|
74
|
+
`),m=this.blockquote(g);i[i.length-1]=m,r=r.substring(0,r.length-p.raw.length)+m.raw,s=s.substring(0,s.length-p.text.length)+m.text;break}else if((h==null?void 0:h.type)==="list"){let p=h,g=p.raw+`
|
|
75
|
+
`+n.join(`
|
|
76
|
+
`),m=this.list(g);i[i.length-1]=m,r=r.substring(0,r.length-h.raw.length)+m.raw,s=s.substring(0,s.length-p.raw.length)+m.raw,n=g.substring(i.at(-1).raw.length).split(`
|
|
77
|
+
`);continue}}return{type:"blockquote",raw:r,tokens:i,text:s}}}list(t){var n,r;let e=this.rules.block.list.exec(t);if(e){let s=e[1].trim(),i=s.length>1,o={type:"list",raw:"",ordered:i,start:i?+s.slice(0,-1):"",loose:!1,items:[]};s=i?`\\d{1,9}\\${s.slice(-1)}`:`\\${s}`,this.options.pedantic&&(s=i?s:"[*+-]");let a=this.rules.other.listItemRegex(s),l=!1;for(;t;){let u=!1,d="",h="";if(!(e=a.exec(t))||this.rules.block.hr.test(t))break;d=e[0],t=t.substring(d.length);let p=_a(e[2].split(`
|
|
78
|
+
`,1)[0],e[1].length),g=t.split(`
|
|
79
|
+
`,1)[0],m=!p.trim(),f=0;if(this.options.pedantic?(f=2,h=p.trimStart()):m?f=e[1].length+1:(f=p.search(this.rules.other.nonSpaceChar),f=f>4?1:f,h=p.slice(f),f+=e[1].length),m&&this.rules.other.blankLine.test(g)&&(d+=g+`
|
|
80
|
+
`,t=t.substring(g.length+1),u=!0),!u){let b=this.rules.other.nextBulletRegex(f),k=this.rules.other.hrRegex(f),v=this.rules.other.fencesBeginRegex(f),w=this.rules.other.headingBeginRegex(f),A=this.rules.other.htmlBeginRegex(f),x=this.rules.other.blockquoteBeginRegex(f);for(;t;){let E=t.split(`
|
|
81
|
+
`,1)[0],S;if(g=E,this.options.pedantic?(g=g.replace(this.rules.other.listReplaceNesting," "),S=g):S=g.replace(this.rules.other.tabCharGlobal," "),v.test(g)||w.test(g)||A.test(g)||x.test(g)||b.test(g)||k.test(g))break;if(S.search(this.rules.other.nonSpaceChar)>=f||!g.trim())h+=`
|
|
82
|
+
`+S.slice(f);else{if(m||p.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||v.test(p)||w.test(p)||k.test(p))break;h+=`
|
|
83
|
+
`+g}m=!g.trim(),d+=E+`
|
|
84
|
+
`,t=t.substring(E.length+1),p=S.slice(f)}}o.loose||(l?o.loose=!0:this.rules.other.doubleBlankLine.test(d)&&(l=!0)),o.items.push({type:"list_item",raw:d,task:!!this.options.gfm&&this.rules.other.listIsTask.test(h),loose:!1,text:h,tokens:[]}),o.raw+=d}let c=o.items.at(-1);if(c)c.raw=c.raw.trimEnd(),c.text=c.text.trimEnd();else return;o.raw=o.raw.trimEnd();for(let u of o.items){if(this.lexer.state.top=!1,u.tokens=this.lexer.blockTokens(u.text,[]),u.task){if(u.text=u.text.replace(this.rules.other.listReplaceTask,""),((n=u.tokens[0])==null?void 0:n.type)==="text"||((r=u.tokens[0])==null?void 0:r.type)==="paragraph"){u.tokens[0].raw=u.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),u.tokens[0].text=u.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let h=this.lexer.inlineQueue.length-1;h>=0;h--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[h].src)){this.lexer.inlineQueue[h].src=this.lexer.inlineQueue[h].src.replace(this.rules.other.listReplaceTask,"");break}}let d=this.rules.other.listTaskCheckbox.exec(u.raw);if(d){let h={type:"checkbox",raw:d[0]+" ",checked:d[0]!=="[ ]"};u.checked=h.checked,o.loose?u.tokens[0]&&["paragraph","text"].includes(u.tokens[0].type)&&"tokens"in u.tokens[0]&&u.tokens[0].tokens?(u.tokens[0].raw=h.raw+u.tokens[0].raw,u.tokens[0].text=h.raw+u.tokens[0].text,u.tokens[0].tokens.unshift(h)):u.tokens.unshift({type:"paragraph",raw:h.raw,text:h.raw,tokens:[h]}):u.tokens.unshift(h)}}if(!o.loose){let d=u.tokens.filter(p=>p.type==="space"),h=d.length>0&&d.some(p=>this.rules.other.anyLine.test(p.raw));o.loose=h}}if(o.loose)for(let u of o.items){u.loose=!0;for(let d of u.tokens)d.type==="text"&&(d.type="paragraph")}return o}}html(t){let e=this.rules.block.html.exec(t);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(t){let e=this.rules.block.def.exec(t);if(e){let n=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",s=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:n,raw:e[0],href:r,title:s}}}table(t){var o;let e=this.rules.block.table.exec(t);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let n=vr(e[1]),r=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),s=(o=e[3])!=null&&o.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
85
|
+
`):[],i={type:"table",raw:e[0],header:[],align:[],rows:[]};if(n.length===r.length){for(let a of r)this.rules.other.tableAlignRight.test(a)?i.align.push("right"):this.rules.other.tableAlignCenter.test(a)?i.align.push("center"):this.rules.other.tableAlignLeft.test(a)?i.align.push("left"):i.align.push(null);for(let a=0;a<n.length;a++)i.header.push({text:n[a],tokens:this.lexer.inline(n[a]),header:!0,align:i.align[a]});for(let a of s)i.rows.push(vr(a,i.header.length).map((l,c)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:i.align[c]})));return i}}lheading(t){let e=this.rules.block.lheading.exec(t);if(e){let n=e[1].trim();return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:n,tokens:this.lexer.inline(n)}}}paragraph(t){let e=this.rules.block.paragraph.exec(t);if(e){let n=e[1].charAt(e[1].length-1)===`
|
|
86
|
+
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:n,tokens:this.lexer.inline(n)}}}text(t){let e=this.rules.block.text.exec(t);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(t){let e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(t){let e=this.rules.inline.tag.exec(t);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(t){let e=this.rules.inline.link.exec(t);if(e){let n=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let i=Fe(n.slice(0,-1),"\\");if((n.length-i.length)%2===0)return}else{let i=Na(e[2],"()");if(i===-2)return;if(i>-1){let o=(e[0].indexOf("!")===0?5:4)+e[1].length+i;e[2]=e[2].substring(0,i),e[0]=e[0].substring(0,o).trim(),e[3]=""}}let r=e[2],s="";if(this.options.pedantic){let i=this.rules.other.pedanticHrefTitle.exec(r);i&&(r=i[1],s=i[3])}else s=e[3]?e[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?r=r.slice(1):r=r.slice(1,-1)),Tr(e,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:s&&s.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(t,e){let n;if((n=this.rules.inline.reflink.exec(t))||(n=this.rules.inline.nolink.exec(t))){let r=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),s=e[r.toLowerCase()];if(!s){let i=n[0].charAt(0);return{type:"text",raw:i,text:i}}return Tr(n,s,n[0],this.lexer,this.rules)}}emStrong(t,e,n=""){let r=this.rules.inline.emStrongLDelim.exec(t);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let s=[...r[0]].length-1,i,o,a=s,l=0,c=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,e=e.slice(-1*t.length+s);(r=c.exec(e))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(o=[...i].length,r[3]||r[4]){a+=o;continue}else if((r[5]||r[6])&&s%3&&!((s+o)%3)){l+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a+l);let u=[...r[0]][0].length,d=t.slice(0,s+r.index+u+o);if(Math.min(s,o)%2){let p=d.slice(1,-1);return{type:"em",raw:d,text:p,tokens:this.lexer.inlineTokens(p)}}let h=d.slice(2,-2);return{type:"strong",raw:d,text:h,tokens:this.lexer.inlineTokens(h)}}}}codespan(t){let e=this.rules.inline.code.exec(t);if(e){let n=e[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(n),s=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return r&&s&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:e[0],text:n}}}br(t){let e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}}del(t,e,n=""){let r=this.rules.inline.delLDelim.exec(t);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let s=[...r[0]].length-1,i,o,a=s,l=this.rules.inline.delRDelim;for(l.lastIndex=0,e=e.slice(-1*t.length+s);(r=l.exec(e))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(o=[...i].length,o!==s))continue;if(r[3]||r[4]){a+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a);let c=[...r[0]][0].length,u=t.slice(0,s+r.index+c+o),d=u.slice(s,-s);return{type:"del",raw:u,text:d,tokens:this.lexer.inlineTokens(d)}}}}autolink(t){let e=this.rules.inline.autolink.exec(t);if(e){let n,r;return e[2]==="@"?(n=e[1],r="mailto:"+n):(n=e[1],r=n),{type:"link",raw:e[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}url(t){var n;let e;if(e=this.rules.inline.url.exec(t)){let r,s;if(e[2]==="@")r=e[0],s="mailto:"+r;else{let i;do i=e[0],e[0]=((n=this.rules.inline._backpedal.exec(e[0]))==null?void 0:n[0])??"";while(i!==e[0]);r=e[0],e[1]==="www."?s="http://"+e[0]:s=e[0]}return{type:"link",raw:e[0],text:r,href:s,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(t){let e=this.rules.inline.text.exec(t);if(e){let n=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:n}}}},te=class An{constructor(e){P(this,"tokens");P(this,"options");P(this,"state");P(this,"inlineQueue");P(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Oe,this.options.tokenizer=this.options.tokenizer||new Ct,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let n={other:G,block:mt.normal,inline:qe.normal};this.options.pedantic?(n.block=mt.pedantic,n.inline=qe.pedantic):this.options.gfm&&(n.block=mt.gfm,this.options.breaks?n.inline=qe.breaks:n.inline=qe.gfm),this.tokenizer.rules=n}static get rules(){return{block:mt,inline:qe}}static lex(e,n){return new An(n).lex(e)}static lexInline(e,n){return new An(n).inlineTokens(e)}lex(e){e=e.replace(G.carriageReturn,`
|
|
87
|
+
`),this.blockTokens(e,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){let r=this.inlineQueue[n];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,n=[],r=!1){var s,i,o;for(this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(G.tabCharGlobal," ").replace(G.spaceLine,""));e;){let a;if((i=(s=this.options.extensions)==null?void 0:s.block)!=null&&i.some(c=>(a=c.call({lexer:this},e,n))?(e=e.substring(a.raw.length),n.push(a),!0):!1))continue;if(a=this.tokenizer.space(e)){e=e.substring(a.raw.length);let c=n.at(-1);a.raw.length===1&&c!==void 0?c.raw+=`
|
|
88
|
+
`:n.push(a);continue}if(a=this.tokenizer.code(e)){e=e.substring(a.raw.length);let c=n.at(-1);(c==null?void 0:c.type)==="paragraph"||(c==null?void 0:c.type)==="text"?(c.raw+=(c.raw.endsWith(`
|
|
89
|
+
`)?"":`
|
|
90
|
+
`)+a.raw,c.text+=`
|
|
91
|
+
`+a.text,this.inlineQueue.at(-1).src=c.text):n.push(a);continue}if(a=this.tokenizer.fences(e)){e=e.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.heading(e)){e=e.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.hr(e)){e=e.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.blockquote(e)){e=e.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.list(e)){e=e.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.html(e)){e=e.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.def(e)){e=e.substring(a.raw.length);let c=n.at(-1);(c==null?void 0:c.type)==="paragraph"||(c==null?void 0:c.type)==="text"?(c.raw+=(c.raw.endsWith(`
|
|
92
|
+
`)?"":`
|
|
93
|
+
`)+a.raw,c.text+=`
|
|
94
|
+
`+a.raw,this.inlineQueue.at(-1).src=c.text):this.tokens.links[a.tag]||(this.tokens.links[a.tag]={href:a.href,title:a.title},n.push(a));continue}if(a=this.tokenizer.table(e)){e=e.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.lheading(e)){e=e.substring(a.raw.length),n.push(a);continue}let l=e;if((o=this.options.extensions)!=null&&o.startBlock){let c=1/0,u=e.slice(1),d;this.options.extensions.startBlock.forEach(h=>{d=h.call({lexer:this},u),typeof d=="number"&&d>=0&&(c=Math.min(c,d))}),c<1/0&&c>=0&&(l=e.substring(0,c+1))}if(this.state.top&&(a=this.tokenizer.paragraph(l))){let c=n.at(-1);r&&(c==null?void 0:c.type)==="paragraph"?(c.raw+=(c.raw.endsWith(`
|
|
95
|
+
`)?"":`
|
|
96
|
+
`)+a.raw,c.text+=`
|
|
97
|
+
`+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):n.push(a),r=l.length!==e.length,e=e.substring(a.raw.length);continue}if(a=this.tokenizer.text(e)){e=e.substring(a.raw.length);let c=n.at(-1);(c==null?void 0:c.type)==="text"?(c.raw+=(c.raw.endsWith(`
|
|
98
|
+
`)?"":`
|
|
99
|
+
`)+a.raw,c.text+=`
|
|
100
|
+
`+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):n.push(a);continue}if(e){let c="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(c);break}else throw new Error(c)}}return this.state.top=!0,n}inline(e,n=[]){return this.inlineQueue.push({src:e,tokens:n}),n}inlineTokens(e,n=[]){var l,c,u,d,h;this.tokenizer.lexer=this;let r=e,s=null;if(this.tokens.links){let p=Object.keys(this.tokens.links);if(p.length>0)for(;(s=this.tokenizer.rules.inline.reflinkSearch.exec(r))!==null;)p.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(s=this.tokenizer.rules.inline.anyPunctuation.exec(r))!==null;)r=r.slice(0,s.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let i;for(;(s=this.tokenizer.rules.inline.blockSkip.exec(r))!==null;)i=s[2]?s[2].length:0,r=r.slice(0,s.index+i)+"["+"a".repeat(s[0].length-i-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);r=((c=(l=this.options.hooks)==null?void 0:l.emStrongMask)==null?void 0:c.call({lexer:this},r))??r;let o=!1,a="";for(;e;){o||(a=""),o=!1;let p;if((d=(u=this.options.extensions)==null?void 0:u.inline)!=null&&d.some(m=>(p=m.call({lexer:this},e,n))?(e=e.substring(p.raw.length),n.push(p),!0):!1))continue;if(p=this.tokenizer.escape(e)){e=e.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.tag(e)){e=e.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.link(e)){e=e.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(p.raw.length);let m=n.at(-1);p.type==="text"&&(m==null?void 0:m.type)==="text"?(m.raw+=p.raw,m.text+=p.text):n.push(p);continue}if(p=this.tokenizer.emStrong(e,r,a)){e=e.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.codespan(e)){e=e.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.br(e)){e=e.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.del(e,r,a)){e=e.substring(p.raw.length),n.push(p);continue}if(p=this.tokenizer.autolink(e)){e=e.substring(p.raw.length),n.push(p);continue}if(!this.state.inLink&&(p=this.tokenizer.url(e))){e=e.substring(p.raw.length),n.push(p);continue}let g=e;if((h=this.options.extensions)!=null&&h.startInline){let m=1/0,f=e.slice(1),b;this.options.extensions.startInline.forEach(k=>{b=k.call({lexer:this},f),typeof b=="number"&&b>=0&&(m=Math.min(m,b))}),m<1/0&&m>=0&&(g=e.substring(0,m+1))}if(p=this.tokenizer.inlineText(g)){e=e.substring(p.raw.length),p.raw.slice(-1)!=="_"&&(a=p.raw.slice(-1)),o=!0;let m=n.at(-1);(m==null?void 0:m.type)==="text"?(m.raw+=p.raw,m.text+=p.text):n.push(p);continue}if(e){let m="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(m);break}else throw new Error(m)}}return n}},Lt=class{constructor(t){P(this,"options");P(this,"parser");this.options=t||Oe}space(t){return""}code({text:t,lang:e,escaped:n}){var i;let r=(i=(e||"").match(G.notSpaceStart))==null?void 0:i[0],s=t.replace(G.endingNewline,"")+`
|
|
101
|
+
`;return r?'<pre><code class="language-'+ie(r)+'">'+(n?s:ie(s,!0))+`</code></pre>
|
|
102
|
+
`:"<pre><code>"+(n?s:ie(s,!0))+`</code></pre>
|
|
103
|
+
`}blockquote({tokens:t}){return`<blockquote>
|
|
104
|
+
${this.parser.parse(t)}</blockquote>
|
|
105
|
+
`}html({text:t}){return t}def(t){return""}heading({tokens:t,depth:e}){return`<h${e}>${this.parser.parseInline(t)}</h${e}>
|
|
106
|
+
`}hr(t){return`<hr>
|
|
107
|
+
`}list(t){let e=t.ordered,n=t.start,r="";for(let o=0;o<t.items.length;o++){let a=t.items[o];r+=this.listitem(a)}let s=e?"ol":"ul",i=e&&n!==1?' start="'+n+'"':"";return"<"+s+i+`>
|
|
108
|
+
`+r+"</"+s+`>
|
|
109
|
+
`}listitem(t){return`<li>${this.parser.parse(t.tokens)}</li>
|
|
110
|
+
`}checkbox({checked:t}){return"<input "+(t?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:t}){return`<p>${this.parser.parseInline(t)}</p>
|
|
111
|
+
`}table(t){let e="",n="";for(let s=0;s<t.header.length;s++)n+=this.tablecell(t.header[s]);e+=this.tablerow({text:n});let r="";for(let s=0;s<t.rows.length;s++){let i=t.rows[s];n="";for(let o=0;o<i.length;o++)n+=this.tablecell(i[o]);r+=this.tablerow({text:n})}return r&&(r=`<tbody>${r}</tbody>`),`<table>
|
|
112
|
+
<thead>
|
|
113
|
+
`+e+`</thead>
|
|
114
|
+
`+r+`</table>
|
|
115
|
+
`}tablerow({text:t}){return`<tr>
|
|
116
|
+
${t}</tr>
|
|
117
|
+
`}tablecell(t){let e=this.parser.parseInline(t.tokens),n=t.header?"th":"td";return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+e+`</${n}>
|
|
118
|
+
`}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${ie(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:e,tokens:n}){let r=this.parser.parseInline(n),s=wr(t);if(s===null)return r;t=s;let i='<a href="'+t+'"';return e&&(i+=' title="'+ie(e)+'"'),i+=">"+r+"</a>",i}image({href:t,title:e,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let s=wr(t);if(s===null)return ie(n);t=s;let i=`<img src="${t}" alt="${ie(n)}"`;return e&&(i+=` title="${ie(e)}"`),i+=">",i}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:ie(t.text)}},Qn=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}checkbox({raw:t}){return t}},ne=class Sn{constructor(e){P(this,"options");P(this,"renderer");P(this,"textRenderer");this.options=e||Oe,this.options.renderer=this.options.renderer||new Lt,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Qn}static parse(e,n){return new Sn(n).parse(e)}static parseInline(e,n){return new Sn(n).parseInline(e)}parse(e){var r,s;this.renderer.parser=this;let n="";for(let i=0;i<e.length;i++){let o=e[i];if((s=(r=this.options.extensions)==null?void 0:r.renderers)!=null&&s[o.type]){let l=o,c=this.options.extensions.renderers[l.type].call({parser:this},l);if(c!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(l.type)){n+=c||"";continue}}let a=o;switch(a.type){case"space":{n+=this.renderer.space(a);break}case"hr":{n+=this.renderer.hr(a);break}case"heading":{n+=this.renderer.heading(a);break}case"code":{n+=this.renderer.code(a);break}case"table":{n+=this.renderer.table(a);break}case"blockquote":{n+=this.renderer.blockquote(a);break}case"list":{n+=this.renderer.list(a);break}case"checkbox":{n+=this.renderer.checkbox(a);break}case"html":{n+=this.renderer.html(a);break}case"def":{n+=this.renderer.def(a);break}case"paragraph":{n+=this.renderer.paragraph(a);break}case"text":{n+=this.renderer.text(a);break}default:{let l='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return n}parseInline(e,n=this.renderer){var s,i;this.renderer.parser=this;let r="";for(let o=0;o<e.length;o++){let a=e[o];if((i=(s=this.options.extensions)==null?void 0:s.renderers)!=null&&i[a.type]){let c=this.options.extensions.renderers[a.type].call({parser:this},a);if(c!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(a.type)){r+=c||"";continue}}let l=a;switch(l.type){case"escape":{r+=n.text(l);break}case"html":{r+=n.html(l);break}case"link":{r+=n.link(l);break}case"image":{r+=n.image(l);break}case"checkbox":{r+=n.checkbox(l);break}case"strong":{r+=n.strong(l);break}case"em":{r+=n.em(l);break}case"codespan":{r+=n.codespan(l);break}case"br":{r+=n.br(l);break}case"del":{r+=n.del(l);break}case"text":{r+=n.text(l);break}default:{let c='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return r}},Tt,Xe=(Tt=class{constructor(t){P(this,"options");P(this,"block");this.options=t||Oe}preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}emStrongMask(t){return t}provideLexer(t=this.block){return t?te.lex:te.lexInline}provideParser(t=this.block){return t?ne.parse:ne.parseInline}},P(Tt,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),P(Tt,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),Tt),Us=class{constructor(...t){P(this,"defaults",jn());P(this,"options",this.setOptions);P(this,"parse",this.parseMarkdown(!0));P(this,"parseInline",this.parseMarkdown(!1));P(this,"Parser",ne);P(this,"Renderer",Lt);P(this,"TextRenderer",Qn);P(this,"Lexer",te);P(this,"Tokenizer",Ct);P(this,"Hooks",Xe);this.use(...t)}walkTokens(t,e){var r,s;let n=[];for(let i of t)switch(n=n.concat(e.call(this,i)),i.type){case"table":{let o=i;for(let a of o.header)n=n.concat(this.walkTokens(a.tokens,e));for(let a of o.rows)for(let l of a)n=n.concat(this.walkTokens(l.tokens,e));break}case"list":{let o=i;n=n.concat(this.walkTokens(o.items,e));break}default:{let o=i;(s=(r=this.defaults.extensions)==null?void 0:r.childTokens)!=null&&s[o.type]?this.defaults.extensions.childTokens[o.type].forEach(a=>{let l=o[a].flat(1/0);n=n.concat(this.walkTokens(l,e))}):o.tokens&&(n=n.concat(this.walkTokens(o.tokens,e)))}}return n}use(...t){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(n=>{let r={...n};if(r.async=this.defaults.async||r.async||!1,n.extensions&&(n.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if("renderer"in s){let i=e.renderers[s.name];i?e.renderers[s.name]=function(...o){let a=s.renderer.apply(this,o);return a===!1&&(a=i.apply(this,o)),a}:e.renderers[s.name]=s.renderer}if("tokenizer"in s){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let i=e[s.level];i?i.unshift(s.tokenizer):e[s.level]=[s.tokenizer],s.start&&(s.level==="block"?e.startBlock?e.startBlock.push(s.start):e.startBlock=[s.start]:s.level==="inline"&&(e.startInline?e.startInline.push(s.start):e.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(e.childTokens[s.name]=s.childTokens)}),r.extensions=e),n.renderer){let s=this.defaults.renderer||new Lt(this.defaults);for(let i in n.renderer){if(!(i in s))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;let o=i,a=n.renderer[o],l=s[o];s[o]=(...c)=>{let u=a.apply(s,c);return u===!1&&(u=l.apply(s,c)),u||""}}r.renderer=s}if(n.tokenizer){let s=this.defaults.tokenizer||new Ct(this.defaults);for(let i in n.tokenizer){if(!(i in s))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;let o=i,a=n.tokenizer[o],l=s[o];s[o]=(...c)=>{let u=a.apply(s,c);return u===!1&&(u=l.apply(s,c)),u}}r.tokenizer=s}if(n.hooks){let s=this.defaults.hooks||new Xe;for(let i in n.hooks){if(!(i in s))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;let o=i,a=n.hooks[o],l=s[o];Xe.passThroughHooks.has(i)?s[o]=c=>{if(this.defaults.async&&Xe.passThroughHooksRespectAsync.has(i))return(async()=>{let d=await a.call(s,c);return l.call(s,d)})();let u=a.call(s,c);return l.call(s,u)}:s[o]=(...c)=>{if(this.defaults.async)return(async()=>{let d=await a.apply(s,c);return d===!1&&(d=await l.apply(s,c)),d})();let u=a.apply(s,c);return u===!1&&(u=l.apply(s,c)),u}}r.hooks=s}if(n.walkTokens){let s=this.defaults.walkTokens,i=n.walkTokens;r.walkTokens=function(o){let a=[];return a.push(i.call(this,o)),s&&(a=a.concat(s.call(this,o))),a}}this.defaults={...this.defaults,...r}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return te.lex(t,e??this.defaults)}parser(t,e){return ne.parse(t,e??this.defaults)}parseMarkdown(t){return(e,n)=>{let r={...n},s={...this.defaults,...r},i=this.onError(!!s.silent,!!s.async);if(this.defaults.async===!0&&r.async===!1)return i(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return i(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return i(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(s.hooks&&(s.hooks.options=s,s.hooks.block=t),s.async)return(async()=>{let o=s.hooks?await s.hooks.preprocess(e):e,a=await(s.hooks?await s.hooks.provideLexer(t):t?te.lex:te.lexInline)(o,s),l=s.hooks?await s.hooks.processAllTokens(a):a;s.walkTokens&&await Promise.all(this.walkTokens(l,s.walkTokens));let c=await(s.hooks?await s.hooks.provideParser(t):t?ne.parse:ne.parseInline)(l,s);return s.hooks?await s.hooks.postprocess(c):c})().catch(i);try{s.hooks&&(e=s.hooks.preprocess(e));let o=(s.hooks?s.hooks.provideLexer(t):t?te.lex:te.lexInline)(e,s);s.hooks&&(o=s.hooks.processAllTokens(o)),s.walkTokens&&this.walkTokens(o,s.walkTokens);let a=(s.hooks?s.hooks.provideParser(t):t?ne.parse:ne.parseInline)(o,s);return s.hooks&&(a=s.hooks.postprocess(a)),a}catch(o){return i(o)}}}onError(t,e){return n=>{if(n.message+=`
|
|
119
|
+
Please report this to https://github.com/markedjs/marked.`,t){let r="<p>An error occurred:</p><pre>"+ie(n.message+"",!0)+"</pre>";return e?Promise.resolve(r):r}if(e)return Promise.reject(n);throw n}}},_e=new Us;function $(t,e){return _e.parse(t,e)}$.options=$.setOptions=function(t){return _e.setOptions(t),$.defaults=_e.defaults,Ns($.defaults),$};$.getDefaults=jn;$.defaults=Oe;$.use=function(...t){return _e.use(...t),$.defaults=_e.defaults,Ns($.defaults),$};$.walkTokens=function(t,e){return _e.walkTokens(t,e)};$.parseInline=_e.parseInline;$.Parser=ne;$.parser=ne.parse;$.Renderer=Lt;$.TextRenderer=Qn;$.Lexer=te;$.lexer=te.lex;$.Tokenizer=Ct;$.Hooks=Xe;$.parse=$;$.options;$.setOptions;$.use;$.walkTokens;$.parseInline;ne.parse;te.lex;const $a=/\n[^\S\n]*(?:\n[^\S\n]*)+$/;function Pa(t){return t.flatMap((e,n)=>{var r;if(e.type==="space"||((r=t[n+1])===null||r===void 0?void 0:r.type)==="space")return[e];const s=(e.raw||"").match($a);return s?[{...e,raw:(e.raw||"").slice(0,-s[0].length)},{type:"space",raw:s[0]}]:[e]})}function Da(t,e){const n=e.split(`
|
|
120
|
+
`).flatMap(r=>[r,""]).map(r=>`${t}${r}`).join(`
|
|
121
|
+
`);return n.slice(0,n.length-1)}function Er(t,e){const n=[];return Array.from(t.entries()).forEach(([r,s])=>{if(!e){n.push(r);return}(e.marks||[]).find(i=>i.type===r&&at(i.attrs,s.attrs))||n.push(r)}),n}function za(t,e){const n=[];return Array.from(e.entries()).forEach(([r,s])=>{const i=t.get(r);(!i||!at(i.attrs,s.attrs))&&n.push({type:r,mark:s})}),n}function Ha(t,e,n,r){const s=!n,i=n&&(!n.marks||n.marks.length===0),o=n&&n.marks&&!r(e,new Map(n.marks.map(l=>[l.type,l]))),a=[];return(s||i||o)&&(n&&n.marks?Array.from(t.entries()).reverse().forEach(([l,c])=>{n.marks.find(u=>u.type===l&&at(u.attrs,c.attrs))||a.push(l)}):(s||i)&&a.push(...Array.from(t.keys()).reverse())),a}function Ba(t,e){let n="";return Array.from(t.keys()).reverse().forEach(r=>{const s=e(r,t.get(r));s&&(n=s+n)}),t.clear(),n}function ja(t,e,n){let r="";return Array.from(t.entries()).forEach(([s,i])=>{const o=n(s,i);o&&(r+=o),e.set(s,i)}),r}function fn(t){const e=(t.raw||t.text||"").match(/^(\s*)[-+*]\s+\[([ xX])\]\s+/);return e?{isTask:!0,checked:e[2].toLowerCase()==="x",indentLevel:e[1].length}:{isTask:!1,indentLevel:0}}function gt(t,e){return typeof t!="string"?"json":e}function Ua(t){const e=t.map(()=>new Map),n=new Map,r=s=>{const i=n.get(s);i&&(i.indexes.forEach(o=>e[o].set(s,i.text)),n.delete(s))};return t.forEach((s,i)=>{if(s.type!=="text"){Array.from(n.keys()).forEach(r);return}const o=new Set((s.marks||[]).map(a=>a.type));Array.from(n.keys()).filter(a=>!o.has(a)).forEach(r),o.forEach(a=>{const l=n.get(a)||{indexes:[],text:""};l.indexes.push(i),l.text+=s.text||"",n.set(a,l)})}),Array.from(n.keys()).forEach(r),e}const qa=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","circle","clippath","defs","ellipse","foreignobject","g","image","line","lineargradient","mask","path","polygon","polyline","radialgradient","rect","stop","switch","symbol","textpath","tspan","use","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"]),Fa=/<\/?([a-zA-Z][\w-]*)/g;function Wa(t){const e=[];let n;for(;(n=Fa.exec(t))!==null;)e.push(n[1].toLowerCase());return e}function Ka(t){const e=t.toLowerCase();return e.includes("-")?!1:!qa.has(e)}function Va(t,e){return Wa(t).some(n=>Ka(n)?!e.has(n):!1)}var Ar=class{constructor(t){var e,n,r,s,i;this.activeParseLexer=null,this.extensionRanks=new Map,this.baseExtensions=[],this.extensions=[],this.codeTypes=new Set,this.schemaParseDomTagsCache=null,this.inlineNodeTypesCache=null,this.lastParseResult=null,this.markedInstance=(e=t==null?void 0:t.marked)!==null&&e!==void 0?e:$,this.indentStyle=(n=t==null||(r=t.indentation)===null||r===void 0?void 0:r.style)!==null&&n!==void 0?n:"space",this.indentSize=(s=t==null||(i=t.indentation)===null||i===void 0?void 0:i.size)!==null&&s!==void 0?s:2,this.baseExtensions=(t==null?void 0:t.extensions)||[],t!=null&&t.markedOptions&&typeof this.markedInstance.setOptions=="function"&&this.markedInstance.setOptions(t.markedOptions),this.registry=new Map,this.nodeTypeRegistry=new Map,t!=null&&t.extensions&&(this.baseExtensions=t.extensions,Zi(Yi(t.extensions)).forEach(o=>this.registerExtension(o)))}get instance(){return this.markedInstance}get indentCharacter(){return this.indentStyle==="space"?" ":" "}get indentString(){return this.indentCharacter.repeat(this.indentSize)}hasMarked(){return!!this.markedInstance}registerExtension(t){var e,n;this.extensions.push(t);const r=cs(Se(t,"code")),s=t.name,i={name:s,options:t.options,storage:t.storage};r&&this.codeTypes.add(s),this.extensionRanks.has(s)||this.extensionRanks.set(s,this.extensionRanks.size);const o=Se(t,"markdownTokenName",i)||s,a=Se(t,"parseMarkdown",i),l=Se(t,"renderMarkdown",i),c=Se(t,"markdownTokenizer",i),u=(e=Se(t,"markdownOptions",i))!==null&&e!==void 0?e:null,d={tokenName:o,nodeName:s,parseMarkdown:a,renderMarkdown:l,isIndenting:(n=u==null?void 0:u.indentsContent)!==null&&n!==void 0?n:!1,htmlReopen:u==null?void 0:u.htmlReopen,tokenizer:c};if(o&&a){const h=this.registry.get(o)||[];h.push(d),this.registry.set(o,h)}if(l){const h=this.nodeTypeRegistry.get(s)||[];h.push(d),this.nodeTypeRegistry.set(s,h)}c&&this.hasMarked()&&this.registerTokenizer(c)}createLexer(){return new this.markedInstance.Lexer(this.markedInstance.defaults)}createTokenizerHelpers(t){return{inlineTokens:e=>t.inlineTokens(e),blockTokens:e=>t.blockTokens(e)}}tokenizeInline(t){var e;return((e=this.activeParseLexer)!==null&&e!==void 0?e:this.createLexer()).inlineTokens(t)}registerTokenizer(t){if(!this.hasMarked())return;const{name:e,start:n,level:r="inline",tokenize:s}=t,i=this.createTokenizerHelpers.bind(this),o=this.createLexer.bind(this);let a;n?a=typeof n=="function"?n:c=>c.indexOf(n):a=c=>{const u=s(c,[],this.createTokenizerHelpers(this.createLexer()));return u&&u.raw?c.indexOf(u.raw):-1};const l={name:e,level:r,start:a,tokenizer(c,u){const d=this.lexer?i(this.lexer):i(o()),h=s(c,u,d);if(h&&h.type)return{...h,type:h.type||e,raw:h.raw||"",tokens:h.tokens||[]}},childTokens:[]};this.markedInstance.use({extensions:[l]})}getHandlersForToken(t){try{return this.registry.get(t)||[]}catch{return[]}}getHandlerForToken(t){const e=this.getHandlersForToken(t);if(e.length>0)return e[0];const n=this.getHandlersForNodeType(t);return n.length>0?n[0]:void 0}getHandlersForNodeType(t){try{return this.nodeTypeRegistry.get(t)||[]}catch{return[]}}serialize(t){if(!t)return"";const e=this.renderNodes(t,t);return this.isEmptyOutput(e)?"":e}isEmptyOutput(t){return!t||t.trim()===""?!0:t.replace(/ /g,"").replace(/\u00A0/g,"").trim()===""}parse(t){if(!this.hasMarked())throw new Error("No marked instance available for parsing");const e=this.activeParseLexer,n=this.createLexer();this.activeParseLexer=n;try{const r=n.lex(t);return{type:"doc",content:this.parseTokens(r,!0)}}finally{this.activeParseLexer=e}}parseTokens(t,e=!1){const n=e?Pa(t):t,r=n.reduce((o,a,l)=>(a.type!=="space"&&o.push(l),o),[]);let s=-1,i=0;return n.flatMap((o,a)=>{for(;i<r.length&&r[i]<a;)s=r[i],i+=1;if(e&&o.type==="space"){var l;const u=(l=r[i])!==null&&l!==void 0?l:-1;return this.createImplicitEmptyParagraphsFromSpace(o,s,u)}const c=this.parseToken(o,e);return c===null?[]:Array.isArray(c)?c:[c]})}createImplicitEmptyParagraphsFromSpace(t,e,n){const r=this.countParagraphSeparators(t.raw||"");if(r===0)return[];const s=Math.max(r-(e===-1||n===-1?0:1),0);return Array.from({length:s},()=>({type:"paragraph",content:[]}))}countParagraphSeparators(t){return(t.replace(/\r\n/g,`
|
|
122
|
+
`).match(/\n\n/g)||[]).length}parseToken(t,e=!1){if(!t.type)return null;if(t.type==="list")return this.parseListToken(t);const n=this.getHandlersForToken(t.type),r=this.createParseHelpers();if(n.find(s=>{if(!s.parseMarkdown)return!1;const i=s.parseMarkdown(t,r),o=this.normalizeParseResult(i);return o&&(!Array.isArray(o)||o.length>0)?(this.lastParseResult=o,!0):!1})&&this.lastParseResult){const s=this.lastParseResult;return this.lastParseResult=null,s}return this.parseFallbackToken(t,e)}parseListToken(t){if(!t.items||t.items.length===0)return this.parseTokenWithHandlers(t);const e=t.items.some(a=>fn(a).isTask),n=t.items.some(a=>!fn(a).isTask);if(!e||!n||this.getHandlersForToken("taskList").length===0)return this.parseTokenWithHandlers(t);const r=[];let s=[],i=null;for(let a=0;a<t.items.length;a+=1){const l=t.items[a],{isTask:c,checked:u,indentLevel:d}=fn(l);let h=l;if(c){const g=(l.raw||l.text||"").split(`
|
|
123
|
+
`),m=g[0].match(/^\s*[-+*]\s+\[([ xX])\]\s+(.*)$/),f=m?m[2]:"";let b=[];if(g.length>1&&g.slice(1).join(`
|
|
124
|
+
`).trim()){const k=g.slice(1),v=k.filter(w=>w.trim());if(v.length>0){const w=Math.min(...v.map(x=>x.length-x.trimStart().length)),A=k.map(x=>x.trim()?x.slice(w):"").join(`
|
|
125
|
+
`).trim();A&&(b=this.markedInstance.lexer(`${A}
|
|
126
|
+
`))}}h={type:"taskItem",raw:"",mainContent:f,indentLevel:d,checked:u??!1,text:f,tokens:this.tokenizeInline(f),nestedTokens:b}}const p=c?"taskList":"list";i!==p?(s.length>0&&r.push({type:i,items:s}),s=[h],i=p):s.push(h)}s.length>0&&r.push({type:i,items:s});const o=[];for(let a=0;a<r.length;a+=1){const l=r[a],c={...t,type:l.type,items:l.items},u=this.parseToken(c);u&&(Array.isArray(u)?o.push(...u):o.push(u))}return o.length>0?o:null}parseTokenWithHandlers(t){if(!t.type)return null;const e=this.getHandlersForToken(t.type),n=this.createParseHelpers();if(e.find(r=>{if(!r.parseMarkdown)return!1;const s=r.parseMarkdown(t,n),i=this.normalizeParseResult(s);return i&&(!Array.isArray(i)||i.length>0)?(this.lastParseResult=i,!0):!1})&&this.lastParseResult){const r=this.lastParseResult;return this.lastParseResult=null,r}return this.parseFallbackToken(t)}createParseHelpers(){return{parseInline:t=>this.parseInlineTokens(t),tokenizeInline:t=>this.tokenizeInline(t),parseChildren:t=>this.parseTokens(t),parseBlockChildren:t=>this.parseTokens(t,!0),createTextNode:(t,e)=>({type:"text",text:t,marks:e||void 0}),createNode:(t,e,n)=>{const r={type:t,attrs:e||void 0,content:n||void 0};return(!e||Object.keys(e).length===0)&&delete r.attrs,r},applyMark:(t,e,n)=>({mark:t,content:e,attrs:n&&Object.keys(n).length>0?n:void 0})}}escapeRegex(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}parseInlineTokens(t){const e=[];for(let o=0;o<t.length;o+=1){const a=t[o];if(a.type==="text")e.push({type:"text",text:mr(a.text||"")});else if(a.type==="escape")e.push({type:"text",text:a.text||""});else if(a.type==="html"){var n,r;const l=((n=(r=a.raw)!==null&&r!==void 0?r:a.text)!==null&&n!==void 0?n:"").toString(),c=/^<\/[\s]*[\w-]+/i.test(l),u=l.match(/^<[\s]*([\w-]+)(\s|>|\/|$)/i);if(!c&&u&&!/\/>$/.test(l)){const h=u[1],p=this.escapeRegex(h),g=new RegExp(`^<\\/\\s*${p}\\b`,"i");let m=-1;const f=[l];for(let b=o+1;b<t.length;b+=1){var s,i;const k=t[b],v=((s=(i=k.raw)!==null&&i!==void 0?i:k.text)!==null&&s!==void 0?s:"").toString();if(f.push(v),k.type==="html"&&g.test(v)){m=b;break}}if(m!==-1){const b=f.join(""),k={type:"html",raw:b,text:b,block:!1},v=this.parseHTMLToken(k);if(v){const w=this.normalizeParseResult(v);Array.isArray(w)?e.push(...w):w&&e.push(w)}o=m;continue}}const d=this.parseHTMLToken(a);if(d){const h=this.normalizeParseResult(d);Array.isArray(h)?e.push(...h):h&&e.push(h)}}else if(a.type){const l=this.getHandlerForToken(a.type);if(l&&l.parseMarkdown){const c=this.createParseHelpers(),u=l.parseMarkdown(a,c);if(this.isMarkResult(u)){const d=this.applyMarkToContent(u.mark,u.content,u.attrs);e.push(...d)}else{const d=this.normalizeParseResult(u);Array.isArray(d)?e.push(...d):d&&e.push(d)}}else a.tokens&&e.push(...this.parseInlineTokens(a.tokens))}}for(let o=e.length-1;o>0;o-=1){const a=e[o],l=e[o-1];if(a.type==="text"&&l.type==="text"){const c=a.marks||[],u=l.marks||[];Ji(c,u)&&(l.text=(l.text||"")+(a.text||""),e.splice(o,1))}}return e}applyMarkToContent(t,e,n){return e.map(r=>{if(r.type==="text"){const s=r.marks||[],i=n?{type:t,attrs:n}:{type:t};return{...r,marks:[...s,i]}}return{...r,content:r.content?this.applyMarkToContent(t,r.content,n):void 0}})}isMarkResult(t){return t&&typeof t=="object"&&"mark"in t}normalizeParseResult(t){return t?this.isMarkResult(t)?t.content:t:null}parseFallbackToken(t,e=!1){switch(t.type){case"paragraph":return{type:"paragraph",content:t.tokens?this.parseInlineTokens(t.tokens):[]};case"heading":return{type:"heading",attrs:{level:t.depth||1},content:t.tokens?this.parseInlineTokens(t.tokens):[]};case"text":return{type:"text",text:mr(t.text||"")};case"html":return this.parseHTMLToken(t);case"escape":return{type:"text",text:t.text||""};case"space":return null;default:return t.tokens?this.parseTokens(t.tokens,e):null}}parseHTMLToken(t){const e=t.text||t.raw||"";if(!e.trim())return null;if(this.isUnrecognizedHtml(e))return this.htmlAsLiteralText(e,!!t.block);if(typeof window>"u"||typeof window.DOMParser>"u")return this.htmlAsLiteralText(e,!!t.block);try{const n=eo(e,this.baseExtensions);if(n.type==="doc"&&n.content){if(t.block)return n.content;const r=this.toInlineContent(n.content);return r.length>0?r:null}return n}catch(n){throw new Error(`Failed to parse HTML in markdown: ${n}`)}}toInlineContent(t){const e=this.getInlineNodeTypes();return t.flatMap(n=>n.type&&e.has(n.type)?[n]:n.content?this.toInlineContent(n.content):[])}getInlineNodeTypes(){if(this.inlineNodeTypesCache)return this.inlineNodeTypesCache;const t=new Set(["text"]);try{const e=gr(this.baseExtensions);Object.values(e.nodes).forEach(n=>{n.isInline&&t.add(n.name)})}catch{}return this.inlineNodeTypesCache=t,t}isUnrecognizedHtml(t){return Va(t,this.getSchemaParseDomTags())}getSchemaParseDomTags(){if(this.schemaParseDomTagsCache)return this.schemaParseDomTagsCache;const t=new Set;try{const e=gr(this.baseExtensions),n=r=>{const s=r==null?void 0:r.parseDOM;Array.isArray(s)&&s.forEach(i=>{if(typeof(i==null?void 0:i.tag)=="string"){const o=i.tag.match(/^[a-zA-Z][\w-]*/);o&&t.add(o[0].toLowerCase())}})};Object.values(e.nodes).forEach(r=>n(r.spec)),Object.values(e.marks).forEach(r=>n(r.spec))}catch{}return this.schemaParseDomTagsCache=t,t}htmlAsLiteralText(t,e){const n=t.replace(/\s+$/,"");return n?e?{type:"paragraph",content:[{type:"text",text:n}]}:{type:"text",text:n}:null}encodeTextForMarkdown(t,e,n){return(n==null?void 0:n.type)!=null&&this.codeTypes.has(n.type)||(e.marks||[]).some(r=>this.codeTypes.has(typeof r=="string"?r:r.type))?t:this.escapeMarkdownSyntax(to(t))}escapeMarkdownSyntax(t){return t.replace(/([\\`*_[\]~])/g,"\\$1")}renderNodeToMarkdown(t,e,n=0,r=0,s={}){var i;if(t.type==="text")return this.encodeTextForMarkdown(t.text||"",t,e);if(!t.type)return"";const o=this.getHandlerForToken(t.type);if(!o)return"";const a=Array.isArray(e==null?void 0:e.content)&&n>0?e.content[n-1]:void 0,l={renderChildren:(u,d)=>{const h=o.isIndenting?r+1:r;return!Array.isArray(u)&&u.content?this.renderNodes(u.content,t,d||"",n,h):this.renderNodes(u,t,d||"",n,h)},renderChild:(u,d)=>{const h=o.isIndenting?r+1:r;return this.renderNodeToMarkdown(u,t,d,h)},indent:u=>this.indentString+u,wrapInBlock:Da},c={index:n,level:r,parentType:e==null?void 0:e.type,previousNode:a,meta:{parentAttrs:e==null?void 0:e.attrs,...s}};return((i=o.renderMarkdown)===null||i===void 0?void 0:i.call(o,t,l,c))||""}renderNodes(t,e,n="",r=0,s=0){return Array.isArray(t)?this.renderNodesWithMarkBoundaries(t,e,n,s):t.type?this.renderNodeToMarkdown(t,e,r,s):""}renderNodesWithMarkBoundaries(t,e,n="",r=0){const s=[],i=new Map,o=new Set,a=new Map,l=Ua(t);return t.forEach((c,u)=>{const d=u<t.length-1?t[u+1]:null;if(c.type)if(c.type==="text"){let h=this.encodeTextForMarkdown(c.text||"",c,e),p=new Map((c.marks||[]).map(x=>[x.type,x])),g=this.getMarksToOpenForSerialization(i,p,d),m=Er(p,d);if(h.length>0&&h.trim().length===0&&p.size>0){const x=new Set(m.filter(E=>!i.has(E)));x.size>0&&(p=new Map(Array.from(p).filter(([E])=>!x.has(E))),g=this.getMarksToOpenForSerialization(i,p,d),m=Er(p,d))}const f=m.filter(x=>i.has(x)),b=f.length>0&&g.length>0;let k="";if(m.length>0&&!b){const x=h.match(/(\s+)$/);x&&(k=x[1],h=h.slice(0,-k.length))}b||m.slice().reverse().forEach(x=>{var E;if(!i.has(x))return;const S=p.get(x),M=this.getMarkClosing(x,S,a.get(x),(E=l[u])===null||E===void 0?void 0:E.get(x));M&&(h+=M),i.has(x)&&(i.delete(x),a.delete(x))});let v="";if(g.length>0){const x=h.match(/^(\s+)/);x&&(v=x[1],h=h.slice(v.length))}g.forEach(({type:x,mark:E})=>{var S;const M=o.has(x)?"html":"markdown",H=this.getMarkOpening(x,E,M,(S=l[u])===null||S===void 0?void 0:S.get(x));H&&(h=H+h),a.set(x,M),o.delete(x)}),b||g.slice().reverse().forEach(({type:x,mark:E})=>{i.set(x,E)}),h=v+h;let w;if(b){const x=new Set(((d==null?void 0:d.marks)||[]).map(M=>M.type));g.forEach(({type:M})=>{x.has(M)&&this.getHtmlReopenTags(M)&&o.add(M)});const E=Array.from(i.keys()),S=f.slice().sort((M,H)=>E.indexOf(H)-E.indexOf(M));w=[...g.map(M=>M.type),...S]}else w=Ha(i,p,d,this.markSetsEqual.bind(this));let A="";if(w.length>0){const x=h.match(/(\s+)$/);x&&(A=x[1],h=h.slice(0,-A.length))}w.forEach(x=>{var E,S;const M=(E=i.get(x))!==null&&E!==void 0?E:p.get(x),H=this.getMarkClosing(x,M,a.get(x),(S=l[u])===null||S===void 0?void 0:S.get(x));H&&(h+=H),i.delete(x),a.delete(x)}),h+=A,h+=k,s.push(h)}else{const h=new Set((c.marks||[]).map(k=>k.type)),p=new Map,g=new Map;i.forEach((k,v)=>{if(h.has(v)){var w;p.set(v,k),g.set(v,(w=a.get(v))!==null&&w!==void 0?w:"markdown")}});const m=Ba(i,(k,v)=>{var w;return this.getMarkClosing(k,v,a.get(k),(w=l[u-1])===null||w===void 0?void 0:w.get(k))});a.clear();const f=this.renderNodeToMarkdown(c,e,u,r),b=c.type==="hardBreak"?"":ja(p,i,(k,v)=>{var w,A;const x=(w=g.get(k))!==null&&w!==void 0?w:"markdown";return a.set(k,x),this.getMarkOpening(k,v,x,(A=l[u+1])===null||A===void 0?void 0:A.get(k))});s.push(m+f+b)}}),s.join(n)}getMarkOpening(t,e,n="markdown",r){if(n==="html"){var s;return((s=this.getHtmlReopenTags(t))===null||s===void 0?void 0:s.open)||""}const i=this.getHandlersForNodeType(t),o=i.length>0?i[0]:void 0;if(!o||!o.renderMarkdown)return"";const a="__TIPTAP_MARKDOWN_PLACEHOLDER__",l={type:t,attrs:e.attrs||{},content:[{type:"text",text:a}]};try{const c=o.renderMarkdown(l,{renderChildren:()=>a,renderChild:()=>a,indent:d=>d,wrapInBlock:(d,h)=>d+h},{index:0,level:0,parentType:"text",meta:{markText:r}}),u=c.indexOf(a);return u>=0?c.substring(0,u):""}catch(c){throw new Error(`Failed to get mark opening for ${t}: ${c}`)}}getMarkClosing(t,e,n="markdown",r){if(n==="html"){var s;return((s=this.getHtmlReopenTags(t))===null||s===void 0?void 0:s.close)||""}const i=this.getHandlersForNodeType(t),o=i.length>0?i[0]:void 0;if(!o||!o.renderMarkdown)return"";const a="__TIPTAP_MARKDOWN_PLACEHOLDER__",l={type:t,attrs:e.attrs||{},content:[{type:"text",text:a}]};try{const c=o.renderMarkdown(l,{renderChildren:()=>a,renderChild:()=>a,indent:h=>h,wrapInBlock:(h,p)=>h+p},{index:0,level:0,parentType:"text",meta:{markText:r}}),u=c.indexOf(a),d=u+33;return u>=0?c.substring(d):""}catch(c){throw new Error(`Failed to get mark closing for ${t}: ${c}`)}}getHtmlReopenTags(t){const e=this.getHandlersForNodeType(t),n=e.length>0?e[0]:void 0;return n==null?void 0:n.htmlReopen}markSetsEqual(t,e){return t.size!==e.size?!1:Array.from(t.entries()).every(([n,r])=>{const s=e.get(n);return s&&at(r.attrs,s.attrs)})}getMarksToOpenForSerialization(t,e,n){const r=za(t,e);if(r.length<=1)return r;const s=(n==null?void 0:n.marks)||[],i=(c,u)=>s.some(d=>d.type===c&&at(d.attrs,u)),o=(c,u)=>{var d,h;const p=(d=this.extensionRanks.get(c.type))!==null&&d!==void 0?d:Number.MAX_SAFE_INTEGER,g=(h=this.extensionRanks.get(u.type))!==null&&h!==void 0?h:Number.MAX_SAFE_INTEGER;return p!==g?g-p:c.type.localeCompare(u.type)},a=r.filter(c=>!i(c.type,c.mark.attrs)).sort(o),l=r.filter(c=>i(c.type,c.mark.attrs)).sort(o);return[...a,...l]}};const Ga=Z.create({name:"markdown",addOptions(){return{indentation:{style:"space",size:2},marked:void 0,markedOptions:{}}},addCommands(){return{setContent:(t,e)=>{if(!(e!=null&&e.contentType))return ue.setContent(t,e);if(gt(t,e==null?void 0:e.contentType)!=="markdown"||!this.editor.markdown)return ue.setContent(t,e);const n=this.editor.markdown.parse(t);return ue.setContent(n,e)},insertContent:(t,e)=>{if(!(e!=null&&e.contentType))return ue.insertContent(t,e);if(gt(t,e==null?void 0:e.contentType)!=="markdown"||!this.editor.markdown)return ue.insertContent(t,e);const n=this.editor.markdown.parse(t);return ue.insertContent(n,e)},insertContentAt:(t,e,n)=>{if(!(n!=null&&n.contentType))return ue.insertContentAt(t,e,n);if(gt(e,n==null?void 0:n.contentType)!=="markdown"||!this.editor.markdown)return ue.insertContentAt(t,e,n);const r=this.editor.markdown.parse(e);return ue.insertContentAt(t,r,n)}}},addStorage(){return{manager:new Ar({indentation:this.options.indentation,marked:this.options.marked,markedOptions:this.options.markedOptions,extensions:[]})}},onBeforeCreate(){var t;if(this.editor.markdown){console.error("[tiptap][markdown]: There is already a `markdown` property on the editor instance. This might lead to unexpected behavior.");return}if(this.storage.manager=new Ar({indentation:this.options.indentation,marked:this.options.marked,markedOptions:this.options.markedOptions,extensions:this.editor.extensionManager.baseExtensions}),this.editor.markdown=this.storage.manager,this.editor.getMarkdown=()=>this.storage.manager.serialize(this.editor.getJSON()),!this.editor.options.contentType||gt(this.editor.options.content,this.editor.options.contentType)!=="markdown")return;if(!this.editor.markdown)throw new Error('[tiptap][markdown]: The `contentType` option is set to "markdown", but the Markdown extension is not added to the editor. Please add the Markdown extension to use this feature.');if(this.editor.options.content===void 0||typeof this.editor.options.content!="string")throw new Error('[tiptap][markdown]: The `contentType` option is set to "markdown", but the initial content is not a string. Please provide the initial content as a markdown string.');const e=this.editor.markdown.parse(this.editor.options.content);!((t=e.content)===null||t===void 0)&&t.length&&(this.editor.options.content=e)}}),{getOwnPropertyNames:Qa,getOwnPropertySymbols:Xa}=Object,{hasOwnProperty:Za}=Object.prototype;function We(t,e){return function(r,s,i){return t(r,s,i)&&e(r,s,i)}}function Ke(t){return function(n,r,s){if(!n||!r||typeof n!="object"||typeof r!="object")return t(n,r,s);const{cache:i}=s,o=i.get(n),a=i.get(r);if(o&&a)return o===r&&a===n;i.set(n,r),i.set(r,n);const l=t(n,r,s);return i.delete(n),i.delete(r),l}}function Ya(t){return t!=null?t[Symbol.toStringTag]:void 0}function Sr(t){return Qa(t).concat(Xa(t))}const Ja=Object.hasOwn||((t,e)=>Za.call(t,e));function $e(t,e){return t===e||!t&&!e&&t!==t&&e!==e}const el="__v",tl="__o",nl="_owner",{getOwnPropertyDescriptor:Cn,keys:Cr}=Object,rl=Cn(Object.getPrototypeOf(Int8Array.prototype),Symbol.toStringTag).get;function sl(t,e){return t.byteLength===e.byteLength&&Mt(new Uint8Array(t),new Uint8Array(e))}function il(t,e,n){let r=t.length;if(e.length!==r)return!1;for(;r-- >0;)if(!n.equals(t[r],e[r],r,r,t,e,n))return!1;return!0}function ol(t,e){return t.byteLength===e.byteLength&&Mt(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function al(t,e){return $e(t.getTime(),e.getTime())}function Lr(t,e,n){return t.name===e.name&&t.message===e.message&&t.stack===e.stack&&n.equals(t.cause,e.cause,"cause","cause",t,e,n)}function ll(t,e){return t===e}function Mr(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const s=new Array(r),i=t.entries();let o,a,l=0;for(;(o=i.next())&&!o.done;){const c=e.entries();let u=!1,d=0;for(;(a=c.next())&&!a.done;){if(s[d]){d++;continue}const h=o.value,p=a.value;if(n.equals(h[0],p[0],l,d,t,e,n)&&n.equals(h[1],p[1],h[0],p[0],t,e,n)){u=s[d]=!0;break}d++}if(!u)return!1;l++}return!0}const cl=$e;function Rr(t,e,n){const r=Cr(t);let s=r.length;if(Cr(e).length!==s)return!1;for(;s-- >0;)if(!qs(t,e,n,r[s]))return!1;return!0}function Pe(t,e,n){const r=Sr(t);let s=r.length;if(Sr(e).length!==s)return!1;let i,o,a;for(;s-- >0;)if(i=r[s],!qs(t,e,n,i)||(o=Cn(t,i),a=Cn(e,i),(o||a)&&(!o||!a||o.configurable!==a.configurable||o.enumerable!==a.enumerable||o.writable!==a.writable)))return!1;return!0}function ul(t,e){return $e(t.valueOf(),e.valueOf())}function dl(t,e){return t.source===e.source&&t.flags===e.flags}function Ir(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const s=new Array(r),i=t.values();let o,a;for(;(o=i.next())&&!o.done;){const l=e.values();let c=!1,u=0;for(;(a=l.next())&&!a.done;){if(!s[u]&&n.equals(o.value,a.value,o.value,a.value,t,e,n)){c=s[u]=!0;break}u++}if(!c)return!1}return!0}function Mt(t,e){let n=t.length;if(e.length!==n||t.byteOffset!==e.byteOffset)return!1;const r=rl.call(t);if(r==="Float64Array"||r==="Float32Array"||r==="Float16Array"){for(;n-- >0;)if(t[n]!==e[n]&&(t[n]===t[n]||e[n]===e[n]))return!1;return!0}for(;n-- >0;)if(t[n]!==e[n])return!1;return!0}function hl(t,e){return t.href===e.href?!0:t.protocol===e.protocol&&t.username===e.username&&t.password===e.password&&t.host===e.host&&t.pathname===e.pathname&&t.hash===e.hash&&pl(t.searchParams,e.searchParams)}function pl(t,e){const n=t.toString(),r=e.toString();return n===r||Nr(n)===Nr(r)}function Nr(t){return t.split("&").sort().join("&")}function qs(t,e,n,r){return(r===nl||r===tl||r===el)&&(t.$$typeof||e.$$typeof)?!0:Ja(e,r)&&n.equals(t[r],e[r],r,r,t,e,n)}const fl="[object ArrayBuffer]",ml="[object Arguments]",gl="[object Boolean]",kl="[object DataView]",bl="[object Date]",yl="[object Error]",xl="[object Map]",wl="[object Number]",vl="[object Object]",Tl="[object RegExp]",El="[object Set]",Al="[object String]",Sl={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},Cl="[object URL]",Ll=Object.prototype.toString;function Ml({areArrayBuffersEqual:t,areArraysEqual:e,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:s,areFunctionsEqual:i,areMapsEqual:o,areNumbersEqual:a,areObjectsEqual:l,arePrimitiveWrappersEqual:c,areRegExpsEqual:u,areSetsEqual:d,areTypedArraysEqual:h,areUrlsEqual:p,unknownTagComparators:g}){return function(f,b,k){if(f===b)return!0;if(f==null||b==null)return!1;const v=typeof f;if(v!==typeof b)return!1;if(v!=="object")return v==="number"?a(f,b,k):v==="function"?i(f,b,k):!1;const w=f.constructor;if(w!==b.constructor)return!1;if(w===Object)return l(f,b,k);if(Array.isArray(f))return e(f,b,k);if(w===Date)return r(f,b,k);if(w===RegExp)return u(f,b,k);if(w===Map)return o(f,b,k);if(w===Set)return d(f,b,k);if(w==null)return l(f,b,k);const A=Ll.call(f);if(A===bl)return r(f,b,k);if(A===Tl)return u(f,b,k);if(A===xl)return o(f,b,k);if(A===El)return d(f,b,k);if(A===vl)return typeof f.then!="function"&&typeof b.then!="function"&&l(f,b,k);if(A===Cl)return p(f,b,k);if(A===yl)return s(f,b,k);if(A===ml)return l(f,b,k);if(Sl[A])return h(f,b,k);if(A===fl)return t(f,b,k);if(A===kl)return n(f,b,k);if(A===gl||A===wl||A===Al)return c(f,b,k);if(g){let x=g[A];if(!x){const E=Ya(f);E&&(x=g[E])}if(x)return x(f,b,k)}return!1}}function Rl({circular:t,createCustomConfig:e,strict:n}){let r={areArrayBuffersEqual:sl,areArraysEqual:n?Pe:il,areDataViewsEqual:ol,areDatesEqual:al,areErrorsEqual:n?We(Lr,Pe):We(Lr,Rr),areFunctionsEqual:ll,areMapsEqual:n?We(Mr,Pe):Mr,areNumbersEqual:cl,areObjectsEqual:n?Pe:Rr,arePrimitiveWrappersEqual:ul,areRegExpsEqual:dl,areSetsEqual:n?We(Ir,Pe):Ir,areTypedArraysEqual:n?We(Mt,Pe):Mt,areUrlsEqual:hl,unknownTagComparators:void 0};if(e&&(r=Object.assign({},r,e(r))),t){const s=Ke(r.areArraysEqual),i=Ke(r.areErrorsEqual),o=Ke(r.areMapsEqual),a=Ke(r.areObjectsEqual),l=Ke(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:s,areErrorsEqual:i,areMapsEqual:o,areObjectsEqual:a,areSetsEqual:l})}return r}function Il(t){return function(e,n,r,s,i,o,a){return t(e,n,a)}}function Nl({circular:t,comparator:e,createState:n,equals:r,strict:s}){if(n)return function(a,l){const{cache:c=t?new WeakMap:void 0,meta:u}=n();return e(a,l,{cache:c,equals:r,meta:u,strict:s})};if(t)return function(a,l){return e(a,l,{cache:new WeakMap,equals:r,meta:void 0,strict:s})};const i={cache:void 0,equals:r,meta:void 0,strict:s};return function(a,l){return e(a,l,i)}}const _l=Ee();Ee({strict:!0});Ee({circular:!0});Ee({circular:!0,strict:!0});Ee({createInternalComparator:()=>$e});Ee({strict:!0,createInternalComparator:()=>$e});Ee({circular:!0,createInternalComparator:()=>$e});Ee({circular:!0,createInternalComparator:()=>$e,strict:!0});function Ee(t={}){const{circular:e=!1,createInternalComparator:n,createState:r,strict:s=!1}=t,i=Rl(t),o=Ml(i),a=n?n(o):Il(o);return Nl({circular:e,comparator:o,createState:r,equals:a,strict:s})}function Ol(t,e){var n,r;if(t.isDestroyed||e.defaultPrevented||!e.cancelable||!t.isEditable||e.inputType!=="insertParagraph"&&e.inputType!=="insertLineBreak"||!io()&&!oo())return;const s=t.view,i=s.root,o=(n=(r=i.getSelection)===null||r===void 0?void 0:r.call(i))!==null&&n!==void 0?n:s.dom.ownerDocument.getSelection(),a=o==null?void 0:o.anchorNode,l=(a==null?void 0:a.nodeType)===1?a:a==null?void 0:a.parentElement,c=l==null?void 0:l.closest("[data-node-view-content-react]");if(!c||!s.dom.contains(c))return;const u=s.input.lastKeyCode;u===13&&(s.input.lastKeyCode=null),s.domObserver.forceFlush(),s.domObserver.flush();const d=new KeyboardEvent("keydown",{key:"Enter",code:"Enter",keyCode:13,shiftKey:e.inputType==="insertLineBreak",bubbles:!0,cancelable:!0});s.someProp("handleKeyDown",h=>h(s,d))?(e.preventDefault(),s.input.lastIOSEnter=0,clearTimeout(s.input.lastIOSEnterFallbackTimeout)):u===13&&(s.input.lastKeyCode=u)}const _r=new se("reactMobileEnter"),$l=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},Pl=({contentComponent:t})=>{const e=us.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return T.jsx(T.Fragment,{children:Object.values(e)})};function Dl(){const t=new Set;let e={},n=!1;const r=()=>{n||!t.size||(n=!0,queueMicrotask(()=>{n=!1,t.forEach(s=>s())}))};return{subscribe(s){return t.add(s),()=>{t.delete(s)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(s,i){e={...e,[s]:so.createPortal(i.reactElement,i.element,s)},r()},removeRenderer(s){const i={...e};delete i[s],e=i,r()}}}var zl=class extends Ie.Component{constructor(t){super(t),this.editorContentRef=Ie.createRef()}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var t;const e=this.props.editor;if(e&&!e.isDestroyed&&(!((t=e.view.dom)===null||t===void 0)&&t.parentNode)){if(e.contentComponent)return;const n=this.editorContentRef.current;n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n}),e.contentComponent=Dl(),e.createNodeViews(),e.registerPlugin(new X({key:_r,props:{handleDOMEvents:{beforeinput:(r,s)=>Ol(e,s)}}})),e.isEditorContentInitialized=!0,this.forceUpdate()}}componentWillUnmount(){const t=this.props.editor;if(t){t.isEditorContentInitialized=!1,t.isDestroyed||(t.unregisterPlugin(_r),t.view.setProps({nodeViews:{}})),t.contentComponent=null;try{var e;if(!(!((e=t.view.dom)===null||e===void 0)&&e.parentNode))return;const n=document.createElement("div");n.append(...t.view.dom.parentNode.childNodes),t.setOptions({element:n})}catch{}}}render(){const{editor:t,innerRef:e,...n}=this.props;return T.jsxs(T.Fragment,{children:[T.jsx("div",{ref:$l(e,this.editorContentRef),...n}),(t==null?void 0:t.contentComponent)&&T.jsx(Pl,{contentComponent:t.contentComponent})]})}};const Hl=_.forwardRef((t,e)=>{const n=Ie.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return Ie.createElement(zl,{key:n,innerRef:e,...t})}),Fs=Ie.memo(Hl),Bl=typeof window<"u"?_.useLayoutEffect:_.useEffect;var jl=class{constructor(t){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=t,this.lastSnapshot={editor:t,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}watch(t){if(this.editor=t,this.editor){let e;const n=s=>{(s==null?void 0:s.transaction)!==void 0&&s.transaction===e||(e=s==null?void 0:s.transaction,this.transactionNumber+=1,this.subscribers.forEach(i=>i()))},r=this.editor;return r.on("transaction",n),r.on("update",n),()=>{r.off("transaction",n),r.off("update",n)}}}};function Ws(t){var e;const[n]=_.useState(()=>new jl(t.editor)),r=ro.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!==null&&e!==void 0?e:_l);return Bl(()=>n.watch(t.editor),[t.editor,n]),_.useDebugValue(r),r}const Ul=!1,Ks=typeof window>"u",ql=Ks||!!(typeof window<"u"&&window.next);var Fl=class Vs{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(n=>n())}getInitialEditor(){const e=this.options.current.immediatelyRender;let n=e??!0;return Ks?(n&&Ul&&console.warn("SSR detected. `immediatelyRender` has been set to false to avoid hydration mismatches"),n=!1):ql&&e===void 0&&(n=!1),n?this.createEditor():null}createEditor(){const e={...this.options.current,onBeforeCreate:(...n)=>{var r,s;return(r=(s=this.options.current).onBeforeCreate)===null||r===void 0?void 0:r.call(s,...n)},onBlur:(...n)=>{var r,s;return(r=(s=this.options.current).onBlur)===null||r===void 0?void 0:r.call(s,...n)},onCreate:(...n)=>{var r,s;return(r=(s=this.options.current).onCreate)===null||r===void 0?void 0:r.call(s,...n)},onDestroy:(...n)=>{var r,s;return(r=(s=this.options.current).onDestroy)===null||r===void 0?void 0:r.call(s,...n)},onFocus:(...n)=>{var r,s;return(r=(s=this.options.current).onFocus)===null||r===void 0?void 0:r.call(s,...n)},onSelectionUpdate:(...n)=>{var r,s;return(r=(s=this.options.current).onSelectionUpdate)===null||r===void 0?void 0:r.call(s,...n)},onTransaction:(...n)=>{var r,s;return(r=(s=this.options.current).onTransaction)===null||r===void 0?void 0:r.call(s,...n)},onUpdate:(...n)=>{var r,s;return(r=(s=this.options.current).onUpdate)===null||r===void 0?void 0:r.call(s,...n)},onContentError:(...n)=>{var r,s;return(r=(s=this.options.current).onContentError)===null||r===void 0?void 0:r.call(s,...n)},onDrop:(...n)=>{var r,s;return(r=(s=this.options.current).onDrop)===null||r===void 0?void 0:r.call(s,...n)},onPaste:(...n)=>{var r,s;return(r=(s=this.options.current).onPaste)===null||r===void 0?void 0:r.call(s,...n)},onDelete:(...n)=>{var r,s;return(r=(s=this.options.current).onDelete)===null||r===void 0?void 0:r.call(s,...n)},onMount:(...n)=>{var r,s;return(r=(s=this.options.current).onMount)===null||r===void 0?void 0:r.call(s,...n)},onUnmount:(...n)=>{var r,s;return(r=(s=this.options.current).onUnmount)===null||r===void 0?void 0:r.call(s,...n)}};return new no(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,n){return Object.keys(e).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&e.extensions&&n.extensions?e.extensions.length!==n.extensions.length?!1:e.extensions.every((s,i)=>{var o;return s===((o=n.extensions)===null||o===void 0?void 0:o[i])}):e[r]===n[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?Vs.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((n,r)=>n===e[r]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,n=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){n&&n.setOptions(this.options.current);return}n&&!n.isDestroyed&&(n.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function Wl(t={},e=[]){const n=_.useRef(t);n.current=t;const[r]=_.useState(()=>new Fl(n)),s=us.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return _.useDebugValue(s),_.useEffect(r.onRender(e)),Ws({editor:s,selector:({transactionNumber:i})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&i===0?0:i+1}),s}const Gs=_.createContext({editor:null});Gs.Consumer;const Qs=_.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),Xs=()=>_.useContext(Qs);function Xn({as:t="div",...e}){const{nodeViewContentRef:n,nodeViewContentChildren:r}=Xs();return T.jsx(t,{...e,ref:n,"data-node-view-content":"",style:{whiteSpace:"pre-wrap",...e.style},children:r})}const Zn=Ie.forwardRef((t,e)=>{const{onDragStart:n}=Xs(),r=t.as||"div";return T.jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});function Or(t){return!!(typeof t=="function"&&t.prototype&&t.prototype.isReactComponent)}function $r(t){return!!(typeof t=="object"&&t.$$typeof&&(t.$$typeof.toString()==="Symbol(react.forward_ref)"||t.$$typeof.description==="react.forward_ref"))}function Kl(t){return!!(typeof t=="object"&&t.$$typeof&&(t.$$typeof.toString()==="Symbol(react.memo)"||t.$$typeof.description==="react.memo"))}function Vl(t){if(Or(t)||$r(t))return!0;if(Kl(t)){const e=t.type;if(e)return Or(e)||$r(e)}return!1}function Gl(){try{if(_.version)return parseInt(_.version.split(".")[0],10)>=19}catch{}return!1}var Ql=class{constructor(t,{editor:e,props:n={},as:r="div",className:s=""}){this.ref=null,this.destroyed=!1,this.id=Math.floor(Math.random()*4294967295).toString(),this.component=t,this.editor=e,this.props=n,this.element=document.createElement(r),this.element.classList.add("react-renderer"),s&&this.element.classList.add(...s.split(" ")),this.editor.isEditorContentInitialized?lo.flushSync(()=>{this.render()}):queueMicrotask(()=>{this.destroyed||this.render()})}render(){var t;if(this.destroyed)return;const e=this.component,n=this.props,r=this.editor,s=Gl(),i=Vl(e),o={...n};o.ref&&!(s||i)&&delete o.ref,!o.ref&&(s||i)&&(o.ref=a=>{this.ref=a}),this.reactElement=T.jsx(e,{...o}),r==null||(t=r.contentComponent)===null||t===void 0||t.setRenderer(this.id,this)}updateProps(t={}){if(this.destroyed)return;let e=!1;const n=Object.keys(t);for(let r=0;r<n.length;r+=1){const s=n[r];if(t[s]!==this.props[s]){e=!0;break}}e&&(this.props={...this.props,...t},this.render())}destroy(){var t;this.destroyed=!0;const e=this.editor;e==null||(t=e.contentComponent)===null||t===void 0||t.removeRenderer(this.id);try{this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}catch{}}updateAttributes(t){Object.keys(t).forEach(e=>{this.element.setAttribute(e,t[e])})}};Ie.createContext({markViewContentRef:()=>{}});function Xl(t){var e;const n=t.getRootNode(),r=typeof n.getSelection=="function"?n.getSelection():(e=t.ownerDocument)===null||e===void 0||(e=e.defaultView)===null||e===void 0?void 0:e.getSelection();if(!r||r.rangeCount===0)return null;const{anchorNode:s,anchorOffset:i,focusNode:o,focusOffset:a}=r;return!s||!o||!t.contains(s)||!t.contains(o)?null:()=>{try{r.setBaseAndExtent(s,i,o,a)}catch{}}}function Zl(t,e,n){return t.node(n)===e.node(n)&&t.before(n)===e.before(n)}function Zs(t){if(!co(t))return[];const{$from:e,$to:n}=t,r=[],s=Math.min(e.depth,n.depth);for(let i=1;i<=s&&Zl(e,n,i);i+=1)r.push(e.before(i));return r}var Yl=class{constructor(t){this.views=new WeakMap,this.viewCount=0,this.insideViews=new Set,this.syncQueued=!1,this.scheduleSync=()=>{this.syncQueued||(this.syncQueued=!0,queueMicrotask(()=>{this.syncQueued=!1,this.sync()}))},this.handleTransaction=()=>this.scheduleSync(),this.editor=t}register(t){this.viewCount===0&&this.editor.on("transaction",this.handleTransaction),this.views.set(t.dom,t),this.viewCount+=1,this.scheduleSync()}unregister(t){this.views.delete(t.dom),this.viewCount-=1,this.insideViews.delete(t),this.viewCount===0&&this.editor.off("transaction",this.handleTransaction)}sync(){if(this.viewCount===0||this.editor.isDestroyed)return;const t=this.findInsideViews();this.updateViews(this.insideViews,t,!1),this.updateViews(t,this.insideViews,!0),this.insideViews=t}updateViews(t,e,n){for(const r of t)e.has(r)||r.setSelectionInside(n)}findInsideViews(){const t=new Set;for(const e of Zs(this.editor.state.selection)){const n=this.editor.view.nodeDOM(e),r=n?this.views.get(n):void 0;r&&t.add(r)}return t}};const Pr=new WeakMap;function Dr(t){let e=Pr.get(t);return e||(e=new Yl(t),Pr.set(t,e)),e}var Jl=class extends ao{constructor(t,e,n){if(super(t,e,n),this.nodeSelected=!1,this.handlePositionUpdate=()=>{const r=this.getPos();typeof r!="number"||r===this.currentPos||(this.currentPos=r,this.renderer.updateProps({getPos:()=>this.getPos()}),typeof this.options.attrs=="function"&&this.updateElementAttributes())},this.cachedExtensionWithSyncedStorage=null,!this.node.isLeaf){this.options.contentDOMElementTag?this.contentDOMElement=document.createElement(this.options.contentDOMElementTag):this.contentDOMElement=document.createElement(this.node.isInline?"span":"div"),this.contentDOMElement.dataset.nodeViewContentReact="",this.contentDOMElement.dataset.nodeViewWrapper="",this.contentDOMElement.style.whiteSpace="inherit";const r=this.dom.querySelector("[data-node-view-content]");r?r.appendChild(this.contentDOMElement):this.dom.appendChild(this.contentDOMElement)}this.options.trackNodeViewPosition&&this.editor.on("update",this.handlePositionUpdate)}get extensionWithSyncedStorage(){if(!this.cachedExtensionWithSyncedStorage){const t=this.editor,e=this.extension;this.cachedExtensionWithSyncedStorage=new Proxy(e,{get(n,r,s){if(r==="storage"){var i;return(i=t.storage[e.name])!==null&&i!==void 0?i:{}}return Reflect.get(n,r,s)}})}return this.cachedExtensionWithSyncedStorage}mount(){const t={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,selectionInside:!1,extension:this.extensionWithSyncedStorage,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(l={})=>this.updateAttributes(l),deleteNode:()=>this.deleteNode(),ref:_.createRef()};if(!this.component.displayName){const l=c=>c.charAt(0).toUpperCase()+c.substring(1);this.component.displayName=l(this.extension.name)}const r={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:l=>{if(l&&this.contentDOMElement&&l.firstChild!==this.contentDOMElement){l.hasAttribute("data-node-view-wrapper")&&l.removeAttribute("data-node-view-wrapper");const c=Xl(this.contentDOMElement);l.appendChild(this.contentDOMElement),c==null||c()}}},s=this.component,i=_.memo(l=>T.jsx(Qs.Provider,{value:r,children:_.createElement(s,l)}));i.displayName="ReactNodeView";let o=this.node.isInline?"span":"div";this.options.as&&(o=this.options.as);const{className:a=""}=this.options;this.renderer=new Ql(i,{editor:this.editor,props:t,as:o,className:`node-${this.node.type.name} ${a}`.trim()}),Dr(this.editor).register(this),this.updateElementAttributes(),this.currentPos=this.getPos()}get dom(){var t;if(this.renderer.element.firstElementChild&&!(!((t=this.renderer.element.firstElementChild)===null||t===void 0)&&t.hasAttribute("data-node-view-wrapper")))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}update(t,e,n){const r=o=>{this.renderer.updateProps(o),typeof this.options.attrs=="function"&&this.updateElementAttributes()};if(t.type!==this.node.type)return!1;if(typeof this.options.update=="function"){const o=this.node,a=this.decorations,l=this.innerDecorations;return this.node=t,this.decorations=e,this.innerDecorations=n,this.currentPos=this.getPos(),this.options.update({oldNode:o,oldDecorations:a,newNode:t,newDecorations:e,oldInnerDecorations:l,innerDecorations:n,updateProps:()=>r({node:t,decorations:e,innerDecorations:n,extension:this.extensionWithSyncedStorage})})}if(t===this.node)return this.node=t,this.decorations=e,this.innerDecorations=n,!0;const s=this.getPos();this.node=t,this.decorations=e,this.innerDecorations=n,this.currentPos=s;const i={node:t,decorations:e,innerDecorations:n,extension:this.extensionWithSyncedStorage};return this.options.trackNodeViewPosition&&(i.getPos=()=>this.getPos()),r(i),!0}selectNode(){this.nodeSelected=!0,this.updateSelectedState(!0)}deselectNode(){this.nodeSelected=!1,this.updateSelectedState(this.options.selectedOnTextSelection===!0&&this.isTextSelectionInside())}setSelectionInside(t){const e=this.nodeSelected||this.options.selectedOnTextSelection===!0&&t;this.renderer.updateProps({selectionInside:t,selected:e}),this.renderer.element.classList.toggle("ProseMirror-selectednode",e)}updateSelectedState(t){this.renderer.updateProps({selected:t}),this.renderer.element.classList.toggle("ProseMirror-selectednode",t)}isTextSelectionInside(){const t=this.getPos();return typeof t=="number"&&Zs(this.editor.state.selection).includes(t)}destroy(){this.renderer.destroy(),Dr(this.editor).unregister(this),this.options.trackNodeViewPosition&&this.editor.off("update",this.handlePositionUpdate),this.contentDOMElement=null}updateElementAttributes(){if(this.options.attrs){let t={};if(typeof this.options.attrs=="function"){const e=this.editor.extensionManager.attributes,n=ds(this.node,e);t=this.options.attrs({node:this.node,HTMLAttributes:n})}else t=this.options.attrs;this.renderer.updateAttributes(t)}}};function Yn(t,e){return n=>n.editor.contentComponent?new Jl(t,n,e):{dom:document.createElement("span"),contentDOM:null,update:()=>!1,destroy:()=>{},selectNode:()=>{},deselectNode:()=>{},stopEvent:()=>!1,ignoreMutation:()=>!0}}const Jn=_.createContext({get editor(){throw new Error("useTiptap must be used within a <Tiptap> provider")}});Jn.displayName="TiptapContext";const ec=()=>_.useContext(Jn);function Ys({children:t,...e}){const n="editor"in e?e.editor:e.instance;if(!n)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const r=_.useMemo(()=>({editor:n}),[n]),s=_.useMemo(()=>({editor:n}),[n]);return T.jsx(Gs.Provider,{value:s,children:T.jsx(Jn.Provider,{value:r,children:t})})}Ys.displayName="Tiptap";function Js({...t}){const{editor:e}=ec();return T.jsx(Fs,{editor:e,...t})}Js.displayName="Tiptap.Content";Object.assign(Ys,{Content:Js});const ei=new WeakSet,ti=new WeakSet;function Ae(t){const e=t;return ei.add(e),e}function Ln(t){return Array.isArray(t)&&ei.has(t)}function ni(t){return t.flatMap(e=>e==null?[]:Array.isArray(e)&&ti.has(e)&&!Ln(e)?ni(e):[e])}function tc(t,e){if(t==="slot")return 0;if(t instanceof Function){const s=t(e);return Array.isArray(s)&&!Ln(s)&&!ti.has(s)?Ae(s):s}const{children:n,...r}=e??{};if(t==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");if(Array.isArray(n)){if(Ln(n))return Ae([t,r,n]);if(n.length===0)return Ae([t,r]);const s=ni(n);return s.length===0?Ae([t,r]):Ae([t,r,...s])}return n!=null?Ae([t,r,n]):Ae([t,r])}const Rt=(t,e)=>tc(t,e),nc=(t,e)=>{var n;const{state:r}=t,{selection:s}=r;if(!s.empty)return!1;const{$from:i}=s;if(i.parentOffset!==0)return!1;const o=i.depth-1;if(o<0)return!1;const a=i.node(o),l=i.index(o);if(l===0)return!1;if(a.type===e)return t.commands.lift(e.name);const c=a.child(l-1);if(c.type!==e||!(!((n=c.lastChild)===null||n===void 0)&&n.isTextblock))return!1;const u=i.before()-1-1;return t.commands.command(({tr:d,dispatch:h})=>{if(!h)return!0;const p=i.parent.content,g=new Hn(p,0,0);return d.replace(u,i.after(),g),d.setSelection(me.create(d.doc,u+p.size)),d.scrollIntoView(),h(d),!0})},rc=/^\s*>\s$/,sc=V.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return Rt("blockquote",{...W(this.options.HTMLAttributes,t),children:Rt("slot",{})})},parseMarkdown:(t,e)=>{var n;const r=(n=e.parseBlockChildren)!==null&&n!==void 0?n:e.parseChildren;return e.createNode("blockquote",void 0,r(t.tokens||[]))},renderMarkdown:(t,e)=>{if(!t.content)return"";const n=">",r=[];return t.content.forEach((s,i)=>{var o,a;const l=((o=(a=e.renderChild)===null||a===void 0?void 0:a.call(e,s,i))!==null&&o!==void 0?o:e.renderChildren([s])).split(`
|
|
127
|
+
`).map(c=>c.trim()===""?n:`${n} ${c}`);r.push(l.join(`
|
|
128
|
+
`))}),r.join(`
|
|
129
|
+
${n}
|
|
130
|
+
`)},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote(),Backspace:()=>nc(this.editor,this.type)}},addInputRules(){return[He({find:rc,type:this.type})]}}),ic=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,oc=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,ac=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,lc=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,cc=je.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return Rt("strong",{...W(this.options.HTMLAttributes,t),children:Rt("slot",{})})},markdownTokenName:"strong",parseMarkdown:(t,e)=>e.applyMark("bold",e.parseInline(t.tokens||[])),markdownOptions:{htmlReopen:{open:"<strong>",close:"</strong>"}},renderMarkdown:(t,e)=>`**${e.renderChildren(t)}**`,addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Ne({find:ic,type:this.type}),Ne({find:ac,type:this.type})]},addPasteRules(){return[we({find:oc,type:this.type}),we({find:lc,type:this.type})]}}),uc=t=>{const e=/`([^`]+)`(?!`)$/.exec(t);return!e||e.index>0&&t[e.index-1]==="`"?null:{index:e.index,text:e[0],replaceWith:e[1]}},dc=t=>{const e=/`([^`]+)`(?!`)/g,n=[];let r;for(;(r=e.exec(t))!==null;)r.index>0&&t[r.index-1]==="`"||n.push({index:r.index,text:r[0],replaceWith:r[1]});return n};function hc(t){const e=new Set((t.match(/`+/g)||[]).map(r=>r.length));let n=1;for(;e.has(n);)n+=1;return n}const pc=je.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",W(this.options.HTMLAttributes,t),0]},markdownTokenName:"codespan",parseMarkdown:(t,e)=>e.applyMark("code",[{type:"text",text:t.text||""}]),renderMarkdown:(t,e,n)=>{var r;if(!t.content)return"";const s=typeof(n==null||(r=n.meta)===null||r===void 0?void 0:r.markText)=="string"?n.meta.markText:"",i="`".repeat(hc(s)),o=s.startsWith("`")||s.endsWith("`")?" ":"";return`${i}${o}${e.renderChildren(t.content)}${o}${i}`},addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Ne({find:uc,type:this.type})]},addPasteRules(){return[we({find:dc,type:this.type})]}}),mn=4,fc=/^```([a-z]+)?[\s\n]$/,mc=/^~~~([a-z]+)?[\s\n]$/,gc=V.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,exitOnArrowUp:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:mn,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;const{languageClassPrefix:n}=this.options;if(!n)return null;const r=[...((e=t.firstElementChild)===null||e===void 0?void 0:e.classList)||[]].filter(s=>s.startsWith(n)).map(s=>s.replace(n,""))[0];return r||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",W(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(t,e)=>{var n,r;return((n=t.raw)===null||n===void 0?void 0:n.startsWith("```"))===!1&&((r=t.raw)===null||r===void 0?void 0:r.startsWith("~~~"))===!1&&t.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:t.lang||null},t.text?[e.createTextNode(t.text)]:[])},renderMarkdown:(t,e)=>{var n;let r="";const s=((n=t.attrs)===null||n===void 0?void 0:n.language)||"";return t.content?r=[`\`\`\`${s}`,e.renderChildren(t.content),"```"].join(`
|
|
131
|
+
`):r=`\`\`\`${s}
|
|
132
|
+
|
|
133
|
+
\`\`\``,r},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!==null&&e!==void 0?e:mn,{state:r}=t,{selection:s}=r,{$from:i,empty:o}=s;if(i.parent.type!==this.type)return!1;const a=" ".repeat(n);return o?t.commands.insertContent(a):t.commands.command(({tr:l})=>{const{from:c,to:u}=s,d=r.doc.textBetween(c,u,`
|
|
134
|
+
`,`
|
|
135
|
+
`).split(`
|
|
136
|
+
`).map(h=>a+h).join(`
|
|
137
|
+
`);return l.replaceWith(c,u,r.schema.text(d)),!0})},"Shift-Tab":({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!==null&&e!==void 0?e:mn,{state:r}=t,{selection:s}=r,{$from:i,empty:o}=s;return i.parent.type!==this.type?!1:o?t.commands.command(({tr:a})=>{var l;const{pos:c}=i,u=i.start(),d=i.end(),h=r.doc.textBetween(u,d,`
|
|
138
|
+
`,`
|
|
139
|
+
`).split(`
|
|
140
|
+
`);let p=0,g=0;const m=c-u;for(let v=0;v<h.length;v+=1){if(g+h[v].length>=m){p=v;break}g+=h[v].length+1}const f=((l=h[p].match(/^ */))===null||l===void 0?void 0:l[0])||"",b=Math.min(f.length,n);if(b===0)return!0;let k=u;for(let v=0;v<p;v+=1)k+=h[v].length+1;return a.delete(k,k+b),c-k<=b&&a.setSelection(me.create(a.doc,k)),!0}):t.commands.command(({tr:a})=>{const{from:l,to:c}=s,u=r.doc.textBetween(l,c,`
|
|
141
|
+
`,`
|
|
142
|
+
`).split(`
|
|
143
|
+
`).map(d=>{var h;const p=((h=d.match(/^ */))===null||h===void 0?void 0:h[0])||"",g=Math.min(p.length,n);return d.slice(g)}).join(`
|
|
144
|
+
`);return a.replaceWith(l,c,r.schema.text(u)),!0})},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:s}=n;if(!s||r.parent.type!==this.type)return!1;const i=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(`
|
|
145
|
+
|
|
146
|
+
`);return!i||!o?!1:t.chain().command(({tr:a})=>(a.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowUp:({editor:t})=>{if(!this.options.exitOnArrowUp)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:s}=n;if(!s||r.parent.type!==this.type||r.parentOffset!==0)return!1;const i=r.before();return i>0?!1:t.commands.insertDefaultBlock({pos:i})},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:r}=e,{$from:s,empty:i}=n;if(!i||s.parent.type!==this.type||s.parentOffset!==s.parent.nodeSize-2)return!1;const o=s.after();return o===void 0?!1:r.nodeAt(o)?t.commands.command(({tr:a})=>(a.setSelection(lt.near(r.resolve(o))),!0)):t.commands.exitCode()}}},addInputRules(){return[Tn({find:fc,type:this.type,getAttributes:t=>({language:t[1]})}),Tn({find:mc,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new X({key:new se("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),s=r?JSON.parse(r):void 0,i=s==null?void 0:s.mode;if(!n||!i)return!1;const{tr:o,schema:a}=t.state,l=a.text(n.replace(/\r\n?/g,`
|
|
147
|
+
`));return o.replaceSelectionWith(this.type.create({language:i},l)),o.selection.$from.parent.type!==this.type&&o.setSelection(me.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),t.dispatch(o),!0}}})]}}),kc=V.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
|
|
148
|
+
|
|
149
|
+
`):""}),bc=V.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",W(this.options.HTMLAttributes,t)]},renderText(){return`
|
|
150
|
+
`},renderMarkdown:()=>`
|
|
151
|
+
`,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:s,storedMarks:i}=n;if(s.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:a}=r.extensionManager,l=i||s.$to.parentOffset&&s.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:u})=>{if(u&&l&&o){const d=l.filter(h=>a.includes(h.type.name));c.ensureMarks(d)}return!0}).scrollIntoView().run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),yc=V.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(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,W(this.options.HTMLAttributes,e),0]},parseMarkdown:(t,e)=>e.createNode("heading",{level:t.depth||1},e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>{var n;const r=!((n=t.attrs)===null||n===void 0)&&n.level?parseInt(t.attrs.level,10):1,s="#".repeat(r);return t.content?`${s} ${e.renderChildren(t.content)}`:""},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>Tn({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),xc=V.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",W(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!ho(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$to:r}=n,s=t();return hs(n)?s.insertContentAt(r.pos,{type:this.name}):s.insertContent({type:this.name}),s.command(({state:i,tr:o,dispatch:a})=>{if(a){const{$to:l}=o.selection,c=l.end();if(l.nodeAfter)l.nodeAfter.isTextblock?o.setSelection(me.create(o.doc,l.pos+1)):l.nodeAfter.isBlock?o.setSelection(Bn.create(o.doc,l.pos)):o.setSelection(me.create(o.doc,l.pos));else{const u=i.schema.nodes[this.options.nextNodeType]||l.parent.type.contentMatch.defaultType,d=u==null?void 0:u.create();d&&(o.insert(c,d),o.setSelection(me.create(o.doc,c+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[uo({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),wc=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,vc=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,Tc=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Ec=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Ac=je.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",W(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(t,e)=>e.applyMark("italic",e.parseInline(t.tokens||[])),markdownOptions:{htmlReopen:{open:"<em>",close:"</em>"}},renderMarkdown:(t,e)=>`*${e.renderChildren(t)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Ne({find:wc,type:this.type}),Ne({find:Tc,type:this.type})]},addPasteRules(){return[we({find:vc,type:this.type}),we({find:Ec,type:this.type})]}}),Sc="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",Cc="ελ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",Mn="numeric",Rn="ascii",In="alpha",Ye="asciinumeric",Ze="alphanumeric",Nn="domain",ri="emoji",Lc="scheme",Mc="slashscheme",gn="whitespace";function Rc(t,e){return t in e||(e[t]=[]),e[t]}function Le(t,e,n){e[Mn]&&(e[Ye]=!0,e[Ze]=!0),e[Rn]&&(e[Ye]=!0,e[In]=!0),e[Ye]&&(e[Ze]=!0),e[In]&&(e[Ze]=!0),e[Ze]&&(e[Nn]=!0),e[ri]&&(e[Nn]=!0);for(const r in e){const s=Rc(r,n);s.indexOf(t)<0&&s.push(t)}}function Ic(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function Q(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}Q.groups={};Q.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let r=0;r<e.jr.length;r++){const s=e.jr[r][0],i=e.jr[r][1];if(i&&s.test(t))return i}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,n,r){for(let s=0;s<t.length;s++)this.tt(t[s],e,n,r)},tr(t,e,n,r){r=r||Q.groups;let s;return e&&e.j?s=e:(s=new Q(e),n&&r&&Le(e,n,r)),this.jr.push([t,s]),s},ts(t,e,n,r){let s=this;const i=t.length;if(!i)return s;for(let o=0;o<i-1;o++)s=s.tt(t[o]);return s.tt(t[i-1],e,n,r)},tt(t,e,n,r){r=r||Q.groups;const s=this;if(e&&e.j)return s.j[t]=e,e;const i=e;let o,a=s.go(t);if(a?(o=new Q,Object.assign(o.j,a.j),o.jr.push.apply(o.jr,a.jr),o.jd=a.jd,o.t=a.t):o=new Q,i){if(r)if(o.t&&typeof o.t=="string"){const l=Object.assign(Ic(o.t,r),n);Le(i,l,r)}else n&&Le(i,n,r);o.t=i}return s.j[t]=o,o}};const C=(t,e,n,r,s)=>t.ta(e,n,r,s),j=(t,e,n,r,s)=>t.tr(e,n,r,s),zr=(t,e,n,r,s)=>t.ts(e,n,r,s),y=(t,e,n,r,s)=>t.tt(e,n,r,s),fe="WORD",_n="UWORD",si="ASCIINUMERICAL",ii="ALPHANUMERICAL",dt="LOCALHOST",On="TLD",$n="UTLD",Et="SCHEME",De="SLASH_SCHEME",er="NUM",Pn="WS",tr="NL",Je="OPENBRACE",et="CLOSEBRACE",It="OPENBRACKET",Nt="CLOSEBRACKET",_t="OPENPAREN",Ot="CLOSEPAREN",$t="OPENANGLEBRACKET",Pt="CLOSEANGLEBRACKET",Dt="FULLWIDTHLEFTPAREN",zt="FULLWIDTHRIGHTPAREN",Ht="LEFTCORNERBRACKET",Bt="RIGHTCORNERBRACKET",jt="LEFTWHITECORNERBRACKET",Ut="RIGHTWHITECORNERBRACKET",qt="FULLWIDTHLESSTHAN",Ft="FULLWIDTHGREATERTHAN",Wt="AMPERSAND",Kt="APOSTROPHE",Vt="ASTERISK",ye="AT",Gt="BACKSLASH",Qt="BACKTICK",Xt="CARET",Me="COLON",nr="COMMA",Zt="DOLLAR",oe="DOT",Yt="EQUALS",rr="EXCLAMATION",J="HYPHEN",tt="PERCENT",Jt="PIPE",en="PLUS",tn="POUND",nt="QUERY",sr="QUOTE",oi="FULLWIDTHMIDDLEDOT",ir="SEMI",ae="SLASH",rt="TILDE",nn="UNDERSCORE",ai="EMOJI",rn="SYM";var li=Object.freeze({__proto__:null,ALPHANUMERICAL:ii,AMPERSAND:Wt,APOSTROPHE:Kt,ASCIINUMERICAL:si,ASTERISK:Vt,AT:ye,BACKSLASH:Gt,BACKTICK:Qt,CARET:Xt,CLOSEANGLEBRACKET:Pt,CLOSEBRACE:et,CLOSEBRACKET:Nt,CLOSEPAREN:Ot,COLON:Me,COMMA:nr,DOLLAR:Zt,DOT:oe,EMOJI:ai,EQUALS:Yt,EXCLAMATION:rr,FULLWIDTHGREATERTHAN:Ft,FULLWIDTHLEFTPAREN:Dt,FULLWIDTHLESSTHAN:qt,FULLWIDTHMIDDLEDOT:oi,FULLWIDTHRIGHTPAREN:zt,HYPHEN:J,LEFTCORNERBRACKET:Ht,LEFTWHITECORNERBRACKET:jt,LOCALHOST:dt,NL:tr,NUM:er,OPENANGLEBRACKET:$t,OPENBRACE:Je,OPENBRACKET:It,OPENPAREN:_t,PERCENT:tt,PIPE:Jt,PLUS:en,POUND:tn,QUERY:nt,QUOTE:sr,RIGHTCORNERBRACKET:Bt,RIGHTWHITECORNERBRACKET:Ut,SCHEME:Et,SEMI:ir,SLASH:ae,SLASH_SCHEME:De,SYM:rn,TILDE:rt,TLD:On,UNDERSCORE:nn,UTLD:$n,UWORD:_n,WORD:fe,WS:Pn});const de=/[a-z]/,Ve=new RegExp("\\p{L}","u"),kn=new RegExp("\\p{Emoji}","u"),he=/\d/,bn=/\s/,Hr="\r",yn=`
|
|
152
|
+
`,Nc="️",_c="",xn="";let kt=null,bt=null;function Oc(t=[]){const e={};Q.groups=e;const n=new Q;kt==null&&(kt=Br(Sc)),bt==null&&(bt=Br(Cc)),y(n,"'",Kt),y(n,"{",Je),y(n,"}",et),y(n,"[",It),y(n,"]",Nt),y(n,"(",_t),y(n,")",Ot),y(n,"<",$t),y(n,">",Pt),y(n,"(",Dt),y(n,")",zt),y(n,"「",Ht),y(n,"」",Bt),y(n,"『",jt),y(n,"』",Ut),y(n,"<",qt),y(n,">",Ft),y(n,"&",Wt),y(n,"*",Vt),y(n,"@",ye),y(n,"`",Qt),y(n,"^",Xt),y(n,":",Me),y(n,",",nr),y(n,"$",Zt),y(n,".",oe),y(n,"=",Yt),y(n,"!",rr),y(n,"-",J),y(n,"%",tt),y(n,"|",Jt),y(n,"+",en),y(n,"#",tn),y(n,"?",nt),y(n,'"',sr),y(n,"/",ae),y(n,";",ir),y(n,"~",rt),y(n,"_",nn),y(n,"\\",Gt),y(n,"・",oi);const r=j(n,he,er,{[Mn]:!0});j(r,he,r);const s=j(r,de,si,{[Ye]:!0}),i=j(r,Ve,ii,{[Ze]:!0}),o=j(n,de,fe,{[Rn]:!0});j(o,he,s),j(o,de,o),j(s,he,s),j(s,de,s);const a=j(n,Ve,_n,{[In]:!0});j(a,de),j(a,he,i),j(a,Ve,a),j(i,he,i),j(i,de),j(i,Ve,i);const l=y(n,yn,tr,{[gn]:!0}),c=y(n,Hr,Pn,{[gn]:!0}),u=j(n,bn,Pn,{[gn]:!0});y(n,xn,u),y(c,yn,l),y(c,xn,u),j(c,bn,u),y(u,Hr),y(u,yn),j(u,bn,u),y(u,xn,u);const d=j(n,kn,ai,{[ri]:!0});y(d,"#"),j(d,kn,d),y(d,Nc,d);const h=y(d,_c);y(h,"#"),j(h,kn,d);const p=[[de,o],[he,s]],g=[[de,null],[Ve,a],[he,i]];for(let m=0;m<kt.length;m++)be(n,kt[m],On,fe,p);for(let m=0;m<bt.length;m++)be(n,bt[m],$n,_n,g);Le(On,{tld:!0,ascii:!0},e),Le($n,{utld:!0,alpha:!0},e),be(n,"file",Et,fe,p),be(n,"mailto",Et,fe,p),be(n,"http",De,fe,p),be(n,"https",De,fe,p),be(n,"ftp",De,fe,p),be(n,"ftps",De,fe,p),Le(Et,{scheme:!0,ascii:!0},e),Le(De,{slashscheme:!0,ascii:!0},e),t=t.sort((m,f)=>m[0]>f[0]?1:-1);for(let m=0;m<t.length;m++){const f=t[m][0],k=t[m][1]?{[Lc]:!0}:{[Mc]:!0};f.indexOf("-")>=0?k[Nn]=!0:de.test(f)?he.test(f)?k[Ye]=!0:k[Rn]=!0:k[Mn]=!0,zr(n,f,f,k)}return zr(n,"localhost",dt,{ascii:!0}),n.jd=new Q(rn),{start:n,tokens:Object.assign({groups:e},li)}}function ci(t,e){const n=$c(e.replace(/[A-Z]/g,a=>a.toLowerCase())),r=n.length,s=[];let i=0,o=0;for(;o<r;){let a=t,l=null,c=0,u=null,d=-1,h=-1;for(;o<r&&(l=a.go(n[o]));)a=l,a.accepts()?(d=0,h=0,u=a):d>=0&&(d+=n[o].length,h++),c+=n[o].length,i+=n[o].length,o++;i-=d,o-=h,c-=d,s.push({t:u.t,v:e.slice(i-c,i),s:i-c,e:i})}return s}function $c(t){const e=[],n=t.length;let r=0;for(;r<n;){let s=t.charCodeAt(r),i,o=s<55296||s>56319||r+1===n||(i=t.charCodeAt(r+1))<56320||i>57343?t[r]:t.slice(r,r+2);e.push(o),r+=o.length}return e}function be(t,e,n,r,s){let i;const o=e.length;for(let a=0;a<o-1;a++){const l=e[a];t.j[l]?i=t.j[l]:(i=new Q(r),i.jr=s.slice(),t.j[l]=i),t=i}return i=new Q(n),i.jr=s.slice(),t.j[e[o-1]]=i,i}function Br(t){const e=[],n=[];let r=0,s="0123456789";for(;r<t.length;){let i=0;for(;s.indexOf(t[r+i])>=0;)i++;if(i>0){e.push(n.join(""));for(let o=parseInt(t.substring(r,r+i),10);o>0;o--)n.pop();r+=i}else n.push(t[r]),r++}return e}const ht={defaultProtocol:"http",events:null,format:jr,formatHref:jr,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function or(t,e=null){let n=Object.assign({},ht);t&&(n=Object.assign(n,t instanceof or?t.o:t));const r=n.ignoreTags,s=[];for(let i=0;i<r.length;i++)s.push(r[i].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=s}or.prototype={o:ht,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const r=e!=null;let s=this.o[t];return s&&(typeof s=="object"?(s=n.t in s?s[n.t]:ht[t],typeof s=="function"&&r&&(s=s(e,n))):typeof s=="function"&&r&&(s=s(e,n.t,n)),s)},getObj(t,e,n){let r=this.o[t];return typeof r=="function"&&e!=null&&(r=r(e,n.t,n)),r},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function jr(t){return t}function ui(t,e){this.t="token",this.v=t,this.tk=e}ui.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),n=t.get("truncate",e,this),r=t.get("format",e,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=ht.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),s=t.get("tagName",n,e),i=this.toFormattedString(t),o={},a=t.get("className",n,e),l=t.get("target",n,e),c=t.get("rel",n,e),u=t.getObj("attributes",n,e),d=t.getObj("events",n,e);return o.href=r,a&&(o.class=a),l&&(o.target=l),c&&(o.rel=c),u&&Object.assign(o,u),{tagName:s,attributes:o,content:i,eventListeners:d}}};function cn(t,e){class n extends ui{constructor(s,i){super(s,i),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const Pc=cn("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Ur=cn("text"),Dc=cn("nl"),yt=cn("url",{isLink:!0,toHref(t=ht.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==dt&&t[1].t===Me}}),Y=t=>new Q(t);function zc({groups:t}){const e=t.domain.concat([Wt,Vt,ye,Gt,Qt,Xt,Zt,Yt,J,er,tt,Jt,en,tn,ae,rn,rt,nn]),n=[Kt,Me,nr,oe,rr,tt,nt,sr,ir,$t,Pt,Je,et,Nt,It,_t,Ot,Dt,zt,Ht,Bt,jt,Ut,qt,Ft],r=[Wt,Kt,Vt,Gt,Qt,Xt,Zt,Yt,J,Je,et,tt,Jt,en,tn,nt,ae,rn,rt,nn],s=Y(),i=y(s,rt);C(i,r,i),C(i,t.domain,i);const o=Y(),a=Y(),l=Y();C(s,t.domain,o),C(s,t.scheme,a),C(s,t.slashscheme,l),C(o,r,i),C(o,t.domain,o);const c=y(o,ye);y(i,ye,c),y(a,ye,c),y(l,ye,c);const u=y(i,oe);C(u,r,i),C(u,t.domain,i);const d=Y();C(c,t.domain,d),C(d,t.domain,d);const h=y(d,oe);C(h,t.domain,d);const p=Y(Pc);C(h,t.tld,p),C(h,t.utld,p),y(c,dt,p);const g=y(d,J);y(g,J,g),C(g,t.domain,d),C(p,t.domain,d),y(p,oe,h),y(p,J,g);const m=y(o,J),f=y(o,oe);y(m,J,m),C(m,t.domain,o),C(f,r,i),C(f,t.domain,o);const b=Y(yt);C(f,t.tld,b),C(f,t.utld,b),C(b,t.domain,o),C(b,r,i),y(b,oe,f),y(b,J,m),y(b,ye,c);const k=y(b,Me),v=Y(yt);C(k,t.numeric,v);const w=Y(yt),A=Y();C(w,e,w),C(w,n,A),C(A,e,w),C(A,n,A),y(b,ae,w),y(v,ae,w);const x=y(a,Me),E=y(l,Me),S=y(E,ae),M=y(S,ae);C(a,t.domain,o),y(a,oe,f),y(a,J,m),C(l,t.domain,o),y(l,oe,f),y(l,J,m),C(x,t.domain,w),y(x,ae,w),y(x,nt,w),C(M,t.domain,w),C(M,e,w),y(M,ae,w);const H=[[Je,et],[It,Nt],[_t,Ot],[$t,Pt],[Dt,zt],[Ht,Bt],[jt,Ut],[qt,Ft]];for(let N=0;N<H.length;N++){const[R,B]=H[N],D=y(w,R);y(A,R,D);const K=Y(yt);C(D,e,K);const F=Y();C(D,n,F),y(D,B,w),C(K,e,K),C(K,n,F),C(F,e,K),C(F,n,F),y(K,B,w),y(F,B,w)}return y(s,dt,b),y(s,tr,Dc),{start:s,tokens:li}}function Hc(t,e,n){let r=n.length,s=0,i=[],o=[];for(;s<r;){let a=t,l=null,c=null,u=0,d=null,h=-1;for(;s<r&&!(l=a.go(n[s].t));)o.push(n[s++]);for(;s<r&&(c=l||a.go(n[s].t));)l=null,a=c,a.accepts()?(h=0,d=a):h>=0&&h++,s++,u++;if(h<0)s-=u,s<r&&(o.push(n[s]),s++);else{o.length>0&&(i.push(wn(Ur,e,o)),o=[]),s-=h,u-=h;const p=d.t,g=n.slice(s-u,s);i.push(wn(p,e,g))}}return o.length>0&&i.push(wn(Ur,e,o)),i}function wn(t,e,n){const r=n[0].s,s=n[n.length-1].e,i=e.slice(r,s);return new t(i,n)}const Bc=typeof console<"u"&&console&&console.warn||(()=>{}),jc="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",z={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function Uc(){return Q.groups={},z.scanner=null,z.parser=null,z.tokenQueue=[],z.pluginQueue=[],z.customSchemes=[],z.initialized=!1,z}function qr(t,e=!1){if(z.initialized&&Bc(`linkifyjs: already initialized - will not register custom scheme "${t}" ${jc}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
|
|
153
|
+
1. Must only contain digits, lowercase ASCII letters or "-"
|
|
154
|
+
2. Cannot start or end with "-"
|
|
155
|
+
3. "-" cannot repeat`);z.customSchemes.push([t,e])}function qc(){z.scanner=Oc(z.customSchemes);for(let t=0;t<z.tokenQueue.length;t++)z.tokenQueue[t][1]({scanner:z.scanner});z.parser=zc(z.scanner.tokens);for(let t=0;t<z.pluginQueue.length;t++)z.pluginQueue[t][1]({scanner:z.scanner,parser:z.parser});return z.initialized=!0,z}function ar(t){return z.initialized||qc(),Hc(z.parser.start,t,ci(z.scanner.start,t))}ar.scan=ci;function di(t,e=null,n=null){if(e&&typeof e=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}const r=new or(n),s=ar(t),i=[];for(let o=0;o<s.length;o++){const a=s[o];a.isLink&&(!e||a.t===e)&&r.check(a)&&i.push(a.toFormattedObject(r))}return i}const un="[\0- -\u2029 ]",Fc=new RegExp(un),Wc=new RegExp(`${un}$`),Kc=new RegExp(`${un}+$`),Vc=new RegExp(un,"g");function Gc(t,e,n){var r,s;const i=t.doc.resolve(e.to);if(!(!((r=i.nodeBefore)===null||r===void 0)&&r.isText))return;const o=(s=t.doc.textBetween(e.from,e.to,"","").match(Kc))===null||s===void 0?void 0:s[0];if(!o)return;const a=e.to-o.length,l=fs(a,e.to,t.doc).filter(d=>d.mark.type===n);if(!l.length)return;const{nodeAfter:c}=i;if(c&&l.some(d=>d.mark.isInSet(c.marks)))return;const u=t.storedMarks;t.removeMark(a,e.to,n),t.setStoredMarks(u),t.selection.empty&&t.selection.from===e.to&&t.removeStoredMark(n)}function Qc(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function Xc(t){return new X({key:new se("autolink"),appendTransaction:(e,n,r)=>{const s=e.some(l=>l.docChanged)&&!n.doc.eq(r.doc),i=e.some(l=>l.getMeta("preventAutolink"));if(!s||i)return;const{tr:o}=r,a=po(n.doc,[...e]);if(!e.some(fo)){const l=[];a.steps.forEach((c,u)=>{if(!(c instanceof mo)||!c.slice.size)return;const d=a.mapping.slice(u+1),h=d.map(c.from,1),p=d.map(c.from+c.slice.size,-1);h<p&&l.push({from:h,to:p})}),l.sort((c,u)=>u.to-c.to),l.forEach(c=>Gc(o,c,t.type))}if(ps(a).forEach(({newRange:l})=>{const c=go(r.doc,l,h=>h.isTextblock);let u,d;if(c.length>1)u=c[0],d=r.doc.textBetween(u.pos,u.pos+u.node.nodeSize,void 0," ");else if(c.length){const h=r.doc.textBetween(l.from,l.to," "," ");if(!Wc.test(h))return;u=c[0],d=r.doc.textBetween(u.pos,l.to,void 0," ")}if(u&&d){const h=d.split(Fc).filter(Boolean);if(h.length<=0)return!1;const p=h[h.length-1],g=u.pos+d.lastIndexOf(p);if(!p)return!1;const m=ar(p).map(f=>f.toObject(t.defaultProtocol));if(!Qc(m))return!1;m.filter(f=>f.isLink).map(f=>({...f,from:g+f.start+1,to:g+f.end+1})).filter(f=>r.schema.marks.code?!r.doc.rangeHasMark(f.from,f.to,r.schema.marks.code):!0).filter(f=>t.validate(f.value)).filter(f=>t.shouldAutoLink(f.value)).forEach(f=>{fs(f.from,f.to,r.doc).some(b=>b.mark.type===t.type)||o.addMark(f.from,f.to,t.type.create({href:f.href}))})}}),!!o.steps.length)return o}})}function Zc(t){return new X({key:new se("handleClickLink"),props:{handleClick:(e,n,r)=>{if(r.button!==0||!e.editable)return!1;let s=null;if(r.target instanceof HTMLAnchorElement)s=r.target;else{const l=r.target;if(!l)return!1;const c=t.editor.view.dom;s=l.closest("a"),s&&!c.contains(s)&&(s=null)}if(!s)return!1;let i=!1;if(t.enableClickSelection&&(i=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){var o,a;const l=ko(e.state,t.type.name),c=(o=s.href)!==null&&o!==void 0?o:l.href,u=(a=s.target)!==null&&a!==void 0?a:l.target;c&&(window.open(c,u),i=!0)}return i}}})}const Yc=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)$/,Jc=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)/g;function hi(t,e){let n=0;for(let r=e-1;r>=0&&t[r]==="\\";r-=1)n+=1;return n%2===1}function eu(t,e){let n=0,r=0;for(;r<e;){if(t[r]!=="`"){r+=1;continue}if(n===0&&hi(t,r)){r+=1;continue}let s=0;for(;r<e&&t[r]==="`";)s+=1,r+=1;n===0?n=s:s===n&&(n=0)}return n>0}function pi(t,e,n){var r,s;const[,i,o]=e;return(e.index?t[e.index-1]:void 0)==="!"||hi(t,(r=e.index)!==null&&r!==void 0?r:0)||eu(t,(s=e.index)!==null&&s!==void 0?s:0)?!1:!!i.trim()&&n(o)}function fi(t){var e,n;const[r,s,i,,o,a,l]=t,c=(e=o??a)!==null&&e!==void 0?e:l;return{index:(n=t.index)!==null&&n!==void 0?n:0,text:r,replaceWith:s,data:{href:i,title:c||null,markdown:!0}}}function tu(t,e){return t.index<e.index+e.text.length&&e.index<t.index+t.text.length}function mi(t){var e,n,r;return{href:(e=t.data)===null||e===void 0?void 0:e.href,title:(n=(r=t.data)===null||r===void 0?void 0:r.title)!==null&&n!==void 0?n:null}}function nu(t){const e=Ne({find:n=>{const r=Yc.exec(n);return!r||!pi(n,r,t.isAllowedHref)?null:fi(r)},type:t.type,getAttributes:mi});return new yo({find:e.find,handler:n=>{const r=e.handler(n);return r!==null&&n.state.tr.steps.length&&n.state.tr.setMeta("preventAutolink",!0),r}})}function ru(t){const e=we({find:n=>{var r,s;const i=[];for(const a of n.matchAll(Jc))pi(n,a,t.isAllowedHref)&&i.push(fi(a));const o=((r=(s=t.findPlainUrls)===null||s===void 0?void 0:s.call(t,n))!==null&&r!==void 0?r:[]).filter(a=>!i.some(l=>tu(l,a)));return[...i,...o]},type:t.type,getAttributes:mi});return new bo({find:e.find,handler:n=>{var r;const s=e.handler(n);return s!==null&&n.state.tr.steps.length&&(!((r=n.match.data)===null||r===void 0)&&r.markdown)&&n.state.tr.setMeta("preventAutolink",!0),s}})}function su(t){return new X({key:new se("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{shouldAutoLink:s}=t,{state:i}=e,{selection:o}=i,{empty:a}=o;if(a)return!1;let l="";r.content.forEach(u=>{l+=u.textContent});const c=di(l,{defaultProtocol:t.defaultProtocol}).find(u=>u.isLink&&u.value===l);return!l||!c||s!==void 0&&!s(c.value)?!1:t.editor.commands.setMark(t.type,{href:c.href})}}})}function pe(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const s=typeof r=="string"?r:r.scheme;s&&n.push(s)}),!t||t.replace(Vc,"").match(new RegExp(`^(?:(?:${n.map(r=>r.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")).join("|")}):|[^a-z]|[a-z0-9+.\\-]+(?:[^a-z+.\\-:]|$))`,"i"))}const iu=je.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(t=>{if(typeof t=="string"){qr(t);return}qr(t.scheme,t.optionalSlashes)})},onDestroy(){Uc()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,markdownLinks:!1,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!pe(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>{const e=/^[a-z][a-z0-9+.-]*:\/\//i.test(t),n=/^[a-z][a-z0-9+.-]*:/i.test(t);if(e||n&&!t.includes("@"))return!0;const r=(t.includes("@")?t.split("@").pop():t).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(r)||!/\./.test(r))}}},addAttributes(){var t,e,n;return{href:{default:null,parseHTML(r){return r.getAttribute("href")}},target:{default:(t=this.options.HTMLAttributes.target)!==null&&t!==void 0?t:null},rel:{default:(e=this.options.HTMLAttributes.rel)!==null&&e!==void 0?e:null},class:{default:(n=this.options.HTMLAttributes.class)!==null&&n!==void 0?n:null},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!pe(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!pe(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",W(this.options.HTMLAttributes,t),0]:["a",W(this.options.HTMLAttributes,{...t,href:""}),0]},markdownTokenName:"link",parseMarkdown:(t,e)=>e.applyMark("link",e.parseInline(t.tokens||[]),{href:t.href,title:t.title||null}),renderMarkdown:(t,e)=>{var n,r,s,i;const o=(n=(r=t.attrs)===null||r===void 0?void 0:r.href)!==null&&n!==void 0?n:"",a=(s=(i=t.attrs)===null||i===void 0?void 0:i.title)!==null&&s!==void 0?s:"",l=e.renderChildren(t);return a?`[${l}](${o} "${a}")`:`[${l}](${o})`},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!pe(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:r=>!!pe(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addInputRules(){return this.options.markdownLinks?[nu({type:this.type,isAllowedHref:t=>this.options.isAllowedUri(t,{defaultValidate:e=>!!pe(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})})]:[]},addPasteRules(){const t=e=>{const n=[];if(e){const{protocols:r,defaultProtocol:s}=this.options;di(e).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:o=>!!pe(o,r),protocols:r,defaultProtocol:s})).forEach(i=>{this.options.shouldAutoLink(i.value)&&n.push({text:i.value,data:{href:i.href},index:i.start})})}return n};return this.options.markdownLinks?[ru({type:this.type,isAllowedHref:e=>this.options.isAllowedUri(e,{defaultValidate:n=>!!pe(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}),findPlainUrls:t})]:[we({find:t,type:this.type,getAttributes:e=>{var n;return{href:(n=e.data)===null||n===void 0?void 0:n.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(Xc({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:s=>!!pe(s,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),t.push(Zc({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(su({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),ou="listItem",Fr="textStyle",Wr=/^\s*([-+*])\s$/,gi=V.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:t}){return["ul",W(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>t.type!=="list"||t.ordered?[]:{type:"bulletList",content:t.items?e.parseChildren(t.items):[]},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
|
|
156
|
+
`):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(ou,this.editor.getAttributes(Fr)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=He({find:Wr,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=He({find:Wr,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Fr),editor:this.editor})),[t]}}),au=(t,e,n)=>{const{selection:r}=t;if(!r.empty)return null;const{$from:s}=r;if(!s.parent.isTextblock||s.parentOffset!==s.parent.content.size)return null;let i=-1;for(let p=s.depth;p>0;p-=1)if(s.node(p).type.name===e){i=p;break}if(i<0)return null;const o=s.node(i),a=s.index(i);if(a+1>=o.childCount)return null;const l=o.child(a+1);if(!n.includes(l.type.name))return null;const c=t.schema.nodes[e];let u=!1;if(l.forEach(p=>{p.type===c&&p.childCount>1&&(u=!0)}),!u)return null;const d=t.doc.resolve(s.after()).nodeAfter;if(!d||!n.includes(d.type.name))return null;const h=[];return d.forEach(p=>{h.push(p)}),h.length===0?null:{listItemDepth:i,nestedList:d,nestedListPos:s.after(),insertPos:s.after(i),items:h}},lu=(t,e,n,r)=>{const s=au(t,n,r);if(!s)return!1;const{selection:i}=t,{nestedList:o,nestedListPos:a,insertPos:l,items:c}=s,u=t.tr;u.delete(a,a+o.nodeSize);const d=u.mapping.map(l);return u.insert(d,ct.from(c)),u.setSelection(i.map(u.doc,u.mapping)),e&&e(u),!0},cu=(t,e,n)=>lu(t.state,t.view.dispatch,e,n),ki=(t,e)=>Z.create({name:`${t}BranchingDeleteKeymap`,priority:101,addKeyboardShortcuts(){const n=()=>cu(this.editor,t,e);return{Delete:n,"Mod-Delete":n}}}),bi=[[1e3,"m"],[900,"cm"],[500,"d"],[400,"cd"],[100,"c"],[90,"xc"],[50,"l"],[40,"xl"],[10,"x"],[9,"ix"],[5,"v"],[4,"iv"],[1,"i"]],xt="abcdefghijklmnopqrstuvwxyz",yi=String.raw`\d+|[ivxlcdmIVXLCDM]+|${"[a-zA-Z]{1,2}"}`;function dn(t){let e=t,n="";for(const[r,s]of bi)for(;e>=r;)n+=s,e-=r;return n}function lr(t){return dn(t).toUpperCase()}function xi(t){const e=t.toLowerCase();let n=0,r=0;for(;n<e.length;){let s=!1;for(const[i,o]of bi)if(e.startsWith(o,n)){r+=i,n+=o.length,s=!0;break}if(!s)return 0}return r}function uu(t){if(!/^[ivxlcdmIVXLCDM]+$/.test(t))return!1;const e=xi(t);return e<=0?!1:(t===t.toLowerCase()?dn(e):lr(e))===t}function du(t){const e=t.toLowerCase();if(e.length===1)return e.charCodeAt(0)-97+1;if(e.length===2){const n=e.charCodeAt(0)-97,r=e.charCodeAt(1)-97;return(n+1)*26+r+1}return 0}function sn(t){if(t<=26)return xt[t-1];const e=Math.floor((t-1)/26)-1,n=(t-1)%26;return e<0?xt[n]:xt[e]+xt[n]}function hn(t){if(!(!t||/^\d+$/.test(t))){if(uu(t))return t===t.toLowerCase()?"i":"I";if(/^[a-z]{1,2}$/.test(t))return"a";if(/^[A-Z]{1,2}$/.test(t))return"A"}}function cr(t){if(/^\d+$/.test(t))return parseInt(t,10);const e=hn(t);if(e==="i"||e==="I")return xi(t);if(e==="a"||e==="A"){const r=du(t);return r>0?r:1}const n=parseInt(t,10);return Number.isNaN(n)?1:n}function hu(t,e){if(t==="numeric")return String(e);switch(t){case"a":return sn(e);case"A":return sn(e).toUpperCase();case"i":return dn(e);case"I":return lr(e);default:return String(e)}}function pu(t){var e;if(t.length===0)return!1;const n=(e=hn(t[0]))!==null&&e!==void 0?e:"numeric",r=cr(t[0]);if(r<1)return!1;for(let s=0;s<t.length;s++){const i=hu(n,r+s);if(t[s]!==i)return!1}return!0}function fu(t){return{type:hn(t),start:cr(t)}}function mu(t){const{type:e,start:n}=fu(t),r={};return e&&(r.type=e),n!==1&&(r.start=n),r}function gu(t,e,n=". "){const r=e+1;if(!t||t==="1")return`${r}${n}`;switch(t){case"a":return`${sn(r)}${n}`;case"A":return`${sn(r).toUpperCase()}${n}`;case"i":return`${dn(r)}${n}`;case"I":return`${lr(r)}${n}`;default:return`${r}${n}`}}function ku(t){var e,n;const r=(e=t.tokens)===null||e===void 0?void 0:e[0];return!!(t.text&&((n=t.tokens)===null||n===void 0?void 0:n.length)===1&&(r==null?void 0:r.type)==="list"&&r.ordered&&r.raw===t.text)}function bu(t,e){return e.tokenizeInline?e.parseInline(e.tokenizeInline(t)):e.parseInline([{type:"text",raw:t,text:t}])}const wi=V.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",W(this.options.HTMLAttributes,t),0]},markdownTokenName:"list_item",parseMarkdown:(t,e)=>{var n;if(t.type!=="list_item")return[];const r=(n=e.parseBlockChildren)!==null&&n!==void 0?n:e.parseChildren;let s=[];if(t.tokens&&t.tokens.length>0){if(ku(t))return{type:"listItem",content:[{type:"paragraph",content:bu(t.text||"",e)}]};if(t.tokens.some(i=>i.type==="paragraph"))s=r(t.tokens);else{const i=t.tokens[0];if(i&&i.type==="text"&&i.tokens&&i.tokens.length>0){if(s=[{type:"paragraph",content:e.parseInline(i.tokens)}],t.tokens.length>1){const o=r(t.tokens.slice(1));s.push(...o)}}else s=r(t.tokens)}}return s.length===0&&(s=[{type:"paragraph",content:[]}]),{type:"listItem",content:s}},renderMarkdown:(t,e,n)=>ms(t,e,r=>{if(r.parentType==="bulletList")return"- ";if(r.parentType==="orderedList"){var s,i;const o=((s=r.meta)===null||s===void 0||(s=s.parentAttrs)===null||s===void 0?void 0:s.start)||1;return gu((i=r.meta)===null||i===void 0||(i=i.parentAttrs)===null||i===void 0?void 0:i.type,o-1+(r.index||0),". ")}return"- "},n,{alignNestedToPrefix:(n==null?void 0:n.parentType)==="orderedList"}),addExtensions(){return[ki(this.name,[this.options.bulletListTypeName,this.options.orderedListTypeName])]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),ur=(t,e)=>{const{$from:n}=e.selection,r=Eo(t,e.schema);let s=null,i=n.depth,o=n.pos,a=null;for(;i>0&&a===null;)s=n.node(i),s.type===r?a=i:(i-=1,o-=1);return a===null?null:{$pos:e.doc.resolve(o),depth:a}},vi=(t,e)=>{const n=ur(t,e);if(!n)return!1;const[,r]=To(e,t,n.$pos.pos+4);return r},yu=(t,e,n)=>{const{$anchor:r}=t.selection,s=Math.max(0,r.pos-2),i=t.doc.resolve(s).node();return!(!i||!n.includes(i.type.name))},Kr=(t,e,n)=>{if(t.commands.undoInputRule())return!0;if(t.state.selection.from!==t.state.selection.to)return!1;if(!At(t.state,e)&&yu(t.state,e,n)){const{$anchor:i}=t.state.selection,o=t.state.doc.resolve(i.before()-1),a=[];o.node().descendants((u,d)=>{u.type.name===e&&a.push({node:u,pos:d})});const l=a.at(-1);if(!l)return!1;const c=t.state.doc.resolve(o.start()+l.pos+1);return t.chain().cut({from:i.start()-1,to:i.end()+1},c.end()).joinForward().run()}if(!At(t.state,e)||!wo(t.state))return!1;const{$from:r}=t.state.selection,s=r.depth-1;return r.node(s).type!==t.schema.nodes[e]||r.index(s)!==0?!1:t.chain().liftListItem(e).run()},xu=(t,e)=>{const n=vi(t,e),r=ur(t,e);return!r||!n?!1:n>r.depth},wu=(t,e)=>{const n=vi(t,e),r=ur(t,e);return!r||!n?!1:n<r.depth},Vr=(t,e)=>{if(!At(t.state,e)||!vo(t.state,e))return!1;const{selection:n}=t.state,{$from:r,$to:s}=n;return!n.empty&&r.sameParent(s)?!1:xu(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():wu(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},vu=(t,e,n)=>{const{state:r}=t,{selection:s}=r;if(!s.empty)return!1;const{$from:i}=s;if(i.parentOffset!==0||!i.parent.isTextblock||At(r,e))return!1;const o=xo(i);if(!o||!n.includes(o.type.name))return!1;const a=o.lastChild;if(!a||a.type.name!==e)return!1;const l=i.parent;if(!a.canReplace(a.childCount,a.childCount,ct.from(l)))return!1;const c=i.before(),u=i.after(),d=c-2;return t.commands.command(({tr:h,dispatch:p})=>(p&&(h.delete(c,u).insert(d,ct.from(l)),h.setSelection(me.create(h.doc,d+1)),h.scrollIntoView()),!0))},Ti=Z.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&Vr(t,n)&&(e=!0)}),e},"Mod-Delete":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&Vr(t,n)&&(e=!0)}),e},Backspace:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&Kr(t,n,r)&&(e=!0)}),e},"Mod-Backspace":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&Kr(t,n,r)&&(e=!0)}),e},Tab:({editor:t})=>{for(const{itemName:e,wrapperNames:n}of this.options.listTypes)if(t.state.schema.nodes[e]!==void 0&&vu(t,e,n))return!0;return!1}}}}),on=new RegExp(`^(\\s*)(${yi})([.)])\\s+(.*)$`),Tu=/^\s/,ze={heading:/^#{1,6}(?:\s|$)/,bulletItem:/^[-+*]\s+/,codeFence:/^(?:```|~~~)/,blockMath:/^\$\$/,thematicBreak:/^(?:(?:-[ \t]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})$/};function Eu(t){return on.test(t.trimStart())}function Au(t){const e=t.trimStart();return ze.bulletItem.test(e)||Eu(e)||ze.heading.test(e)||ze.thematicBreak.test(e)&&!e.startsWith("-")||/^>\s?/.test(e)||ze.codeFence.test(e)||ze.blockMath.test(e)}function Su(t){return Object.values(ze).some(e=>e.test(t))}function Cu(t){const e=[],n=[];let r=!1;return t.forEach(s=>{if(r){n.push(s);return}if(s.trim()===""){r=!0,n.push(s);return}if(e.length>0&&Au(s)){r=!0,n.push(s);return}e.push(s)}),{paragraphLines:e,blockLines:n}}function Gr(t){const e=[];let n=0,r=0;for(;n<t.length;){const s=t[n],i=s.match(on);if(!i)break;const[,o,a,l,c]=i,u=o.length,d=parseInt(a,10),h=isNaN(d)?hn(a):void 0,p=isNaN(d)?cr(a):d,g=[c];let m=n+1;const f=[s];let b=!1;for(;m<t.length;){const k=t[m];if(k.match(on))break;if(k.trim()==="")f.push(k),g.push(""),b=!0,m+=1;else if(k.match(Tu)){const v=k.length-k.trimStart().length,w=u+a.length+1;f.push(k),g.push(k.slice(Math.min(v,w))),m+=1}else{if(b||Su(k))break;f.push(k),g.push(k),m+=1}}e.push({indent:u,number:p,type:h,content:g.join(`
|
|
157
|
+
`).trim(),contentLines:g,raw:f.join(`
|
|
158
|
+
`)}),r=m,n=m}return[e,r]}const Lu=new RegExp(`^(${yi})([.)])\\s+(.+)$`);function Mu(t){const e=t.split(`
|
|
159
|
+
`).filter(r=>r.trim().length>0);if(e.length===0)return null;const n=[];for(const r of e){const s=r.trim().match(Lu);if(!s)return null;n.push({marker:s[1],content:s[3]})}return pu(n.map(r=>r.marker))?{type:"orderedList",attrs:mu(n[0].marker),content:n.map(r=>({type:"listItem",content:[{type:"paragraph",content:[{type:"text",text:r.content}]}]}))}:null}function Ei(t,e,n){const r=[];let s=0;for(;s<t.length;){const i=t[s];if(i.indent===e){const{paragraphLines:o,blockLines:a}=Cu(i.contentLines),l=o.join(`
|
|
160
|
+
`).trim(),c=[];l&&c.push({type:"paragraph",raw:l,tokens:n.inlineTokens(l)});const u=a.join(`
|
|
161
|
+
`).trim();if(u){const p=n.blockTokens(u);c.push(...p)}let d=s+1;const h=[];for(;d<t.length&&t[d].indent>e;)h.push(t[d]),d+=1;if(h.length>0){const p=Ei(h,Math.min(...h.map(g=>g.indent)),n);c.push({type:"list",ordered:!0,start:h[0].number,typeMarker:h[0].type,items:p,raw:h.map(g=>g.raw).join(`
|
|
162
|
+
`)})}r.push({type:"list_item",raw:i.raw,tokens:c}),s=d}else s+=1}return r}function Ru(t,e){return t.map(n=>{if(n.type!=="list_item")return e.parseChildren([n])[0];const r=[];return n.tokens&&n.tokens.length>0&&n.tokens.forEach(s=>{if(s.type==="paragraph"||s.type==="list"||s.type==="blockquote"||s.type==="code")r.push(...e.parseChildren([s]));else if(s.type==="text"&&s.tokens){const i=e.parseChildren([s]);r.push({type:"paragraph",content:i})}else{const i=e.parseChildren([s]);i.length>0&&r.push(...i)}}),{type:"listItem",content:r}})}const Iu=64;function Qr(t,e){const n=[];let r=0;for(;n.length<e;){const s=t.indexOf(`
|
|
163
|
+
`,r);if(s===-1)return n.push(t.slice(r)),n;n.push(t.slice(r,s)),r=s+1}return n}function Nu(t){const e=t.indexOf(`
|
|
164
|
+
`),n=e===-1?t:t.slice(0,e);if(!on.test(n))return[[],0,[]];let r=Iu,s=Qr(t,r),i=Gr(s);for(;i[1]===s.length&&s.length===r;)r*=2,s=Qr(t,r),i=Gr(s);return[i[0],i[1],s]}const _u="listItem",Xr="textStyle",Zr=/^(\d+)\.\s$/;function Yr(t){const e=t.match(/list-style-type\s*:\s*([^;]+)/i);if(!e)return null;switch(e[1].trim().toLowerCase()){case"upper-roman":return"I";case"lower-roman":return"i";case"upper-alpha":case"upper-latin":return"A";case"lower-alpha":case"lower-latin":return"a";default:return null}}const Ai=V.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:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>{const e=t.getAttribute("type");if(e)return e;const n=t.getAttribute("style");if(n){const s=Yr(n);if(s)return s}const r=t.querySelector("li");if(r){const s=r.getAttribute("style");if(s){const i=Yr(s);if(i)return i}}return null}}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,type:n,...r}=t,s=W(this.options.HTMLAttributes,r);return e!==1&&(s.start=e),n&&n!=="1"&&(s.type=n),["ol",s,0]},markdownTokenName:"list",parseMarkdown:(t,e)=>{if(t.type!=="list"||!t.ordered)return[];const n=t.start||1,r=t.typeMarker,s=t.items?Ru(t.items,e):[],i={};return n!==1&&(i.start=n),r&&(i.type=r),Object.keys(i).length>0?{type:"orderedList",attrs:i,content:s}:{type:"orderedList",content:s}},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
|
|
165
|
+
`):"",markdownTokenizer:{name:"orderedList",level:"block",start:()=>-1,tokenize:(t,e,n)=>{var r,s;const[i,o,a]=Nu(t);if(i.length===0)return;const l=Ei(i,i[0].indent,n);if(l.length!==0)return{type:"list",ordered:!0,start:((r=i[0])===null||r===void 0?void 0:r.number)||1,typeMarker:(s=i[0])===null||s===void 0?void 0:s.type,items:l,raw:a.slice(0,o).join(`
|
|
166
|
+
`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(_u,this.editor.getAttributes(Xr)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addProseMirrorPlugins(){return[new X({props:{handlePaste:(t,e)=>{var n,r;const s=(n=e.clipboardData)===null||n===void 0?void 0:n.getData("text/html");if(s!=null&&s.trim())return!1;const i=(r=e.clipboardData)===null||r===void 0?void 0:r.getData("text/plain");if(!i)return!1;const o=Mu(i);if(!o)return!1;try{const a=t.state.schema.nodeFromJSON(o),l=t.state.tr.replaceSelectionWith(a);return t.dispatch(l),!0}catch{return!1}}}})]},addInputRules(){const t=(n,r)=>(!r.attrs.type||r.attrs.type==="1")&&r.childCount+r.attrs.start===+n[1];let e=He({find:Zr,type:this.type,getAttributes:n=>({start:+n[1]}),joinPredicate:t});return(this.options.keepMarks||this.options.keepAttributes)&&(e=He({find:Zr,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:n=>({start:+n[1],...this.editor.getAttributes(Xr)}),joinPredicate:t,editor:this.editor})),[e]}}),Ou=/^\s*(\[([( |x])?\])\s$/,$u="position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0",Pu=(t,e,n)=>{var r;return(n==null||(r=n.checkboxLabel)===null||r===void 0?void 0:r.call(n,t,e))||`Task item checkbox for ${t.textContent||"empty task item"}`},Du=V.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:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51,contentElement:t=>{var e;return(e=t.querySelector("div"))!==null&&e!==void 0?e:t}}]},renderHTML({node:t,HTMLAttributes:e}){return["li",W(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(t,e)=>{const n=[];if(t.tokens&&t.tokens.length>0?n.push(e.createNode("paragraph",{},e.parseInline(t.tokens))):t.text?n.push(e.createNode("paragraph",{},[e.createNode("text",{text:t.text})])):n.push(e.createNode("paragraph",{},[])),t.nestedTokens&&t.nestedTokens.length>0){const r=e.parseChildren(t.nestedTokens);n.push(...r)}return e.createNode("taskItem",{checked:t.checked||!1},n)},renderMarkdown:(t,e)=>{var n;const r=`- [${!((n=t.attrs)===null||n===void 0)&&n.checked?"x":" "}] `;return ms(t,e,r)},addExtensions(){return this.options.nested?[ki(this.name,[this.options.taskListTypeName])]:[]},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{const s=document.createElement("li"),i=document.createElement("label"),o=document.createElement("span"),a=document.createElement("input"),l=document.createElement("div");o.style.cssText=$u;const c=d=>{const h=Pu(d,d.attrs.checked,this.options.a11y);a.setAttribute("aria-label",h),o.textContent=h};c(t),i.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",d=>d.preventDefault()),a.addEventListener("change",d=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:h}=d.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:p})=>{const g=n();if(typeof g!="number")return!1;const m=p.doc.nodeAt(g);return p.setNodeMarkup(g,void 0,{...m==null?void 0:m.attrs,checked:h}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,h)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([d,h])=>{s.setAttribute(d,h)}),s.dataset.checked=t.attrs.checked,a.checked=t.attrs.checked,i.append(a,o),s.append(i,l),Object.entries(e).forEach(([d,h])=>{s.setAttribute(d,h)});let u=new Set(Object.keys(e));return{dom:s,contentDOM:l,update:d=>{if(d.type!==this.type)return!1;s.dataset.checked=d.attrs.checked,a.checked=d.attrs.checked,c(d);const h=r.extensionManager.attributes,p=ds(d,h),g=new Set(Object.keys(p)),m=this.options.HTMLAttributes;return u.forEach(f=>{g.has(f)||(f in m?s.setAttribute(f,m[f]):s.removeAttribute(f))}),Object.entries(p).forEach(([f,b])=>{b==null?f in m?s.setAttribute(f,m[f]):s.removeAttribute(f):s.setAttribute(f,b)}),u=g,!0}}}},addInputRules(){return[He({find:Ou,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),zu=V.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:t}){return["ul",W(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},parseMarkdown:(t,e)=>e.createNode("taskList",{},e.parseChildren(t.items||[])),renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
|
|
167
|
+
`):"",markdownTokenizer:{name:"taskList",level:"block",start(t){var e;const n=(e=t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))===null||e===void 0?void 0:e.index;return n!==void 0?n:-1},tokenize(t,e,n){const r=i=>{const o=kr(i,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:a=>({indentLevel:a[1].length,mainContent:a[4],checked:a[3].toLowerCase()==="x"}),createToken:(a,l)=>({type:"taskItem",raw:"",mainContent:a.mainContent,indentLevel:a.indentLevel,checked:a.checked,text:a.mainContent,tokens:n.inlineTokens(a.mainContent),nestedTokens:l}),customNestedParser:r},n);if(o){const a={type:"taskList",raw:o.raw,items:o.items},l=i.slice(o.raw.length);return l.trim()?[a,...n.blockTokens(l)]:[a]}return n.blockTokens(i)},s=kr(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:i=>({indentLevel:i[1].length,mainContent:i[4],checked:i[3].toLowerCase()==="x"}),createToken:(i,o)=>({type:"taskItem",raw:"",mainContent:i.mainContent,indentLevel:i.indentLevel,checked:i.checked,text:i.mainContent,tokens:n.inlineTokens(i.mainContent),nestedTokens:o}),customNestedParser:r},n);if(s)return{type:"taskList",raw:s.raw,items:s.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});Z.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(gi.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(wi.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(Ti.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(Ai.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(Du.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(zu.configure(this.options.taskList)),t}});const wt=" ",vn=" ",Hu=V.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",W(this.options.HTMLAttributes,t),0]},parseMarkdown:(t,e)=>{const n=t.tokens||[];if(n.length===1&&n[0].type==="image")return e.parseChildren([n[0]]);const r=e.parseInline(n);return n.length===1&&n[0].type==="text"&&(n[0].raw===wt||n[0].text===wt||n[0].raw===vn||n[0].text===vn)&&r.length===1&&r[0].type==="text"&&(r[0].text===wt||r[0].text===vn)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,r)},renderMarkdown:(t,e,n)=>{if(!t)return"";const r=Array.isArray(t.content)?t.content:[];if(r.length===0){var s,i;const o=Array.isArray(n==null||(s=n.previousNode)===null||s===void 0?void 0:s.content)?n.previousNode.content:[];return(n==null||(i=n.previousNode)===null||i===void 0?void 0:i.type)==="paragraph"&&o.length===0?wt:""}return e.renderChildren(r)},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Bu=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,ju=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Uu=je.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",W(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Ne({find:Bu,type:this.type})]},addPasteRules(){return[we({find:ju,type:this.type})]}}),qu=V.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),Fu=je.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",W(this.options.HTMLAttributes,t),0]},parseMarkdown(t,e){return e.applyMark(this.name||"underline",e.parseInline(t.tokens||[]))},renderMarkdown(t,e){return`++${e.renderChildren(t)}++`},markdownTokenizer:{name:"underline",level:"inline",start(t){return t.indexOf("++")},tokenize(t,e,n){const r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!r)return;const s=r[2].trim();return{type:"underline",raw:r[0],text:s,tokens:n.inlineTokens(s)}}},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function Wu(t={}){return new X({view(e){return new Ku(e,t)}})}class Ku{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.lastDragEvent=null,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(s=>{let i=o=>{this[s](o)};return e.dom.addEventListener(s,i),{name:s,handler:i}})}destroy(){this.setCursor(null),this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){if(this.cursorPos!=null&&n.doc!=e.state.doc)if(this.lastDragEvent){let r=this.computeTarget(this.lastDragEvent);r==this.cursorPos?this.updateOverlay():this.setCursor(r)}else 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),n=!e.parent.inlineContent,r,s=this.editorView.dom,i=s.getBoundingClientRect(),o=i.width/s.offsetWidth,a=i.height/s.offsetHeight;if(n){let d=e.nodeBefore,h=e.nodeAfter;if(d||h){let p=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(p){let g=p.getBoundingClientRect(),m=d?g.bottom:g.top;d&&h&&(m=(m+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let f=this.width/2*a;r={left:g.left,right:g.right,top:m-f,bottom:m+f}}}}if(!r){let d=this.editorView.coordsAtPos(this.cursorPos),h=this.width/2*o;r={left:d.left-h,right:d.left+h,top:d.top,bottom:d.bottom}}let l=this.editorView.dom.offsetParent;this.element||(this.element=l.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",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let c,u;if(!l||l==document.body&&getComputedStyle(l).position=="static")c=-pageXOffset,u=-pageYOffset;else{let d=l.getBoundingClientRect(),h=d.width/l.offsetWidth,p=d.height/l.offsetHeight;c=d.left-l.scrollLeft*h,u=d.top-l.scrollTop*p}this.element.style.left=(r.left-c)/o+"px",this.element.style.top=(r.top-u)/a+"px",this.element.style.width=(r.right-r.left)/o+"px",this.element.style.height=(r.bottom-r.top)/a+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}computeTarget(e){let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),s=r&&r.type.spec.disableDropCursor,i=typeof s=="function"?s(this.editorView,n,e):s;if(!n||i)return null;let o=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=Ao(this.editorView.state.doc,o,this.editorView.dragging.slice);a!=null&&(o=a)}return o}dragover(e){if(!this.editorView.editable)return;this.lastDragEvent=e;let n=this.computeTarget(e);n!=null&&(this.setCursor(n),this.scheduleRemoval(5e3))}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class U extends lt{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return U.valid(r)?new U(r):lt.near(r)}content(){return Hn.empty}eq(e){return e instanceof U&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new U(e.resolve(n.pos))}getBookmark(){return new dr(this.anchor)}static valid(e){let n=e.parent;if(n.inlineContent||!Vu(e)||!Gu(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let s=n.contentMatchAt(e.index()).defaultType;return s&&s.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&U.valid(e))return e;let s=e.pos,i=null;for(let o=e.depth;;o--){let a=e.node(o);if(n>0?e.indexAfter(o)<a.childCount:e.index(o)>0){i=a.child(n>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;s+=n;let l=e.doc.resolve(s);if(U.valid(l))return l}for(;;){let o=n>0?i.firstChild:i.lastChild;if(!o){if(i.isAtom&&!i.isText&&!Bn.isSelectable(i)){e=e.doc.resolve(s+i.nodeSize*n),r=!1;continue e}break}i=o,s+=n;let a=e.doc.resolve(s);if(U.valid(a))return a}return null}}}U.prototype.visible=!1;U.findFrom=U.findGapCursorFrom;lt.jsonID("gapcursor",U);class dr{constructor(e){this.pos=e}map(e){return new dr(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return U.valid(n)?new U(n):lt.near(n)}}function Si(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function Vu(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(n-1);;s=s.lastChild){if(s.childCount==0&&!s.inlineContent||Si(s.type))return!0;if(s.inlineContent)return!1}}return!0}function Gu(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(n);;s=s.firstChild){if(s.childCount==0&&!s.inlineContent||Si(s.type))return!0;if(s.inlineContent)return!1}}return!0}function Qu(){return new X({props:{decorations:Ju,createSelectionBetween(t,e,n){return e.pos==n.pos&&U.valid(n)?new U(n):null},handleClick:Zu,handleKeyDown:Xu,handleDOMEvents:{beforeinput:Yu}}})}const Xu=So({ArrowLeft:vt("horiz",-1),ArrowRight:vt("horiz",1),ArrowUp:vt("vert",-1),ArrowDown:vt("vert",1)});function vt(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,s,i){let o=r.selection,a=e>0?o.$to:o.$from,l=o.empty;if(o instanceof me){if(!i.endOfTextblock(n)||a.depth==0)return!1;l=!1,a=r.doc.resolve(e>0?a.after():a.before())}let c=U.findGapCursorFrom(a,e,l);return c?(s&&s(r.tr.setSelection(new U(c))),!0):!1}}function Zu(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!U.valid(r))return!1;let s=t.posAtCoords({left:n.clientX,top:n.clientY});return s&&s.inside>-1&&Bn.isSelectable(t.state.doc.nodeAt(s.inside))?!1:(t.dispatch(t.state.tr.setSelection(new U(r))),!0)}function Yu(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof U))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let s=ct.empty;for(let o=r.length-1;o>=0;o--)s=ct.from(r[o].createAndFill(null,s));let i=t.state.tr.replace(n.pos,n.pos,new Hn(s,0,0));return i.setSelection(me.near(i.doc.resolve(n.pos+1))),t.dispatch(i),!1}function Ju(t){if(!(t.selection instanceof U))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",ge.create(t.doc,[pt.widget(t.selection.head,e,{key:"gapcursor"})])}Z.create({name:"characterCount",addOptions(){return{limit:null,autoTrim:!0,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc;if(((t==null?void 0:t.mode)||this.options.mode)==="textSize"){const n=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(n)}return e.nodeSize},this.storage.words=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let t=!1;return[new X({key:new se("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;const s=this.options.limit,i=this.options.autoTrim;if(s==null||s===0||i===!1){t=!0;return}const o=this.storage.characters({node:r.doc});if(o>s){const a=o-s,l=0,c=a;console.warn(`[CharacterCount] Initial content exceeded limit of ${s} characters. Content was automatically trimmed.`);const u=r.tr.deleteRange(l,c);return t=!0,u}t=!0},filterTransaction:(e,n)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const s=this.storage.characters({node:n.doc}),i=this.storage.characters({node:e.doc});if(i<=r||s>r&&i>r&&i<=s)return!0;if(s>r&&i>r&&i>s||!e.getMeta("paste"))return!1;const o=e.selection.$head.pos,a=o-(i-r),l=o;return e.deleteRange(a,l),!(this.storage.characters({node:e.doc})>r)}})]}});const ed=Z.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[Wu(this.options)]}});Z.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new X({key:new se("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:s}=e,i=[];if(!n||!r)return ge.create(t,[]);let o=0;this.options.mode==="deepest"&&t.descendants((l,c)=>{if(!l.isText){if(!(s>=c&&s<=c+l.nodeSize-1))return!1;o+=1}});let a=0;return t.descendants((l,c)=>{if(l.isText||!(s>=c&&s<=c+l.nodeSize-1))return!1;if(a+=1,this.options.mode==="deepest"&&o-a>0||this.options.mode==="shallowest"&&a>1)return this.options.mode==="deepest";i.push(pt.node(c,c+l.nodeSize,{class:this.options.className}))}),ge.create(t,i)}}})]}});const td=Z.create({name:"gapCursor",addProseMirrorPlugins(){return[Qu()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=cs(Se(t,"allowGapCursor",n)))!==null&&e!==void 0?e:null}}}),Ci="placeholder",Jr=new se("tiptap__placeholder");function Li(t){const{editor:e,placeholder:n,dataAttribute:r,pos:s,node:i,isEmptyDoc:o,hasAnchor:a,classes:{emptyNode:l,emptyEditor:c}}=t,u=[l];return o&&u.push(c),pt.node(s,s+i.nodeSize,{class:u.join(" "),[r]:typeof n=="function"?n({editor:e,node:i,pos:s,hasAnchor:a}):n})}function Mi(t,e){return typeof t=="function"?t(e):t}function Ri({editor:t,options:e,dataAttribute:n,doc:r,selection:s,from:i,to:o}){const{anchor:a}=s,l=[],c=t.isEmpty;return r.nodesBetween(i,o,(u,d)=>{const h=a>=d&&a<=d+u.nodeSize,p=!u.isLeaf&&gs(u);return u.type.isTextblock&&(h||!e.showOnlyCurrent)&&p&&l.push(Li({editor:t,isEmptyDoc:c,dataAttribute:n,hasAnchor:h,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:Mi(e.emptyNodeClass,{editor:t,node:u,pos:d,hasAnchor:h})},node:u,pos:d})),e.includeChildren}),l}function Ii({editor:t,options:e,dataAttribute:n,doc:r,selection:s}){if(!(t.isEditable||!e.showOnlyWhenEditable))return null;const{anchor:i}=s,o=[],a=t.isEmpty;if(e.showOnlyCurrent&&!e.includeChildren){const l=r.resolve(i),c=l.depth>0?l.node(1):l.nodeAfter,u=l.depth>0?l.before(1):i;if(c&&c.type.isTextblock&&gs(c)){const d=i>=u&&i<=u+c.nodeSize;o.push(Li({editor:t,isEmptyDoc:a,dataAttribute:n,hasAnchor:d,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:Mi(e.emptyNodeClass,{editor:t,node:c,pos:u,hasAnchor:d})},node:c,pos:u}))}}else o.push(...Ri({editor:t,options:e,dataAttribute:n,doc:r,selection:s,from:0,to:r.content.size}));return ge.create(r,o)}function st(t,e){const n=t.resolve(e);if(n.depth===0){var r;const i=(r=n.nodeAfter)!==null&&r!==void 0?r:n.nodeBefore;if(!i)return{from:e,to:e};const o=n.nodeAfter?e:e-i.nodeSize;return{from:o,to:o+i.nodeSize}}const s=n.before(1);return{from:s,to:s+n.node(1).nodeSize}}function it(t,e){return{from:Math.max(0,e.from-1),to:Math.min(t.content.size,e.to-1)}}function nd(t,e,n){const r=[];return t.forEach((s,i)=>{const o=i,a=o+s.nodeSize,l=o+1,c=a+1;l<n&&c>e&&r.push({from:o,to:a})}),r}function rd(t){if(t.length===0)return[];const e=[...t].sort((r,s)=>r.from-s.from),n=[{...e[0]}];for(let r=1;r<e.length;r+=1){const s=n[n.length-1],i=e[r];i.from<=s.to?s.to=Math.max(s.to,i.to):n.push({...i})}return n}function sd(t,e){const n=nd(t,e.from,e.to);return n.push(it(t,st(t,e.from))),e.to>e.from?n.push(it(t,st(t,Math.min(e.to,t.content.size+1)-1))):e.from<t.content.size+1&&n.push(it(t,st(t,Math.min(e.from+1,t.content.size)))),n}function id(t,e,n){const r=[];if(t.docChanged){const s=ps(t);for(const i of s)r.push(...sd(n.doc,i.newRange))}return t.selectionSet&&(r.push(it(n.doc,st(n.doc,t.mapping.map(e.selection.anchor)))),r.push(it(n.doc,st(n.doc,n.selection.anchor)))),rd(r)}function od(t,e,n){const r=Math.max(0,Math.min(t,n.content.size));return{from:r,to:Math.max(r,Math.min(e,n.content.size))}}function ad({decorations:t,ranges:e,editor:n,options:r,dataAttribute:s,doc:i,selection:o}){let a=t;for(const l of e){const{from:c,to:u}=od(l.from,l.to,i),d=a.find(c,u).filter(p=>p.from>=c&&p.to<=u);d.length&&(a=a.remove(d));const h=Ri({editor:n,options:r,dataAttribute:s,doc:i,selection:o,from:c,to:u});h.length&&(a=a.add(i,h))}return a}function ld({editor:t,options:e,dataAttribute:n}){return{init(r,s){const i=Ii({editor:t,options:e,dataAttribute:n,doc:s.doc,selection:s.selection});return i??ge.empty},apply(r,s,i,o){return!r.docChanged&&!r.selectionSet?s:ad({decorations:s.map(r.mapping,r.doc),ranges:id(r,i,o),editor:t,options:e,dataAttribute:n,doc:o.doc,selection:o.selection})}}}function cd(t){return t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}function ud({editor:t,options:e}){const n=e.dataAttribute?`data-${cd(e.dataAttribute)}`:`data-${Ci}`,r=e.showOnlyCurrent&&!e.includeChildren;return new X({key:Jr,...r?{}:{state:ld({editor:t,options:e,dataAttribute:n})},props:{decorations:r?({doc:s,selection:i})=>Ii({editor:t,options:e,dataAttribute:n,doc:s,selection:i}):s=>{var i;return e.showOnlyWhenEditable&&!t.isEditable?ge.empty:(i=Jr.getState(s))!==null&&i!==void 0?i:ge.empty}}})}Z.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:Ci,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[ud({editor:this.editor,options:this.options})]}});function Dn(t,e){return!t.selection.empty&&!hs(t.selection)&&e.isEditable}function dd(t,e){return Dn(t,e)&&!e.isFocused&&!e.view.dragging}function hd(){var t;(t=window.getSelection())===null||t===void 0||t.removeAllRanges()}function pd(t){t.focus()}Z.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new X({key:new se("selection"),props:{decorations(n){return dd(n,t)?ge.create(n.doc,[pt.inline(n.selection.from,n.selection.to,{class:e.className})]):null},handleDOMEvents:{blur(n){return Dn(n.state,t)&&hd(),!1},focus(n){return Dn(n.state,t)&&requestAnimationFrame(()=>{!t.isDestroyed&&n.hasFocus()&&pd(n)}),!1}}}})]}});function es({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||(e==null?void 0:e.type)===t}const fd=Z.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new se(this.name),n=this.options.node||((t=this.editor.schema.topNodeType.contentMatch.defaultType)===null||t===void 0?void 0:t.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,s])=>s).filter(s=>(this.options.notAfter||[]).concat(n).includes(s.name));return[new X({key:e,appendTransaction:(s,i,o)=>{const{doc:a,tr:l,schema:c}=o,u=e.getState(o),d=a.content.size,h=c.nodes[n];if(!s.some(p=>p.getMeta("skipTrailingNode"))&&u)return l.insert(d,h.create())},state:{init:(s,i)=>{const o=i.tr.doc.lastChild;return!es({node:o,types:r})},apply:(s,i)=>{if(!s.docChanged||s.getMeta("__uniqueIDTransaction"))return i;const o=s.doc.lastChild;return!es({node:o,types:r})}}})]}}),md=Z.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>Mo(t,e),redo:()=>({state:t,dispatch:e})=>Lo(t,e)}},addProseMirrorPlugins(){return[Co(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()}}}),gd=Z.create({name:"starterKit",addExtensions(){const t=[];if(this.options.bold!==!1&&t.push(cc.configure(this.options.bold)),this.options.blockquote!==!1&&t.push(sc.configure(this.options.blockquote)),this.options.bulletList!==!1&&t.push(gi.configure(this.options.bulletList)),this.options.code!==!1&&t.push(pc.configure(this.options.code)),this.options.codeBlock!==!1&&t.push(gc.configure(this.options.codeBlock)),this.options.document!==!1&&t.push(kc.configure(this.options.document)),this.options.dropcursor!==!1&&t.push(ed.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&t.push(td.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&t.push(bc.configure(this.options.hardBreak)),this.options.heading!==!1&&t.push(yc.configure(this.options.heading)),this.options.undoRedo!==!1&&t.push(md.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&t.push(xc.configure(this.options.horizontalRule)),this.options.italic!==!1&&t.push(Ac.configure(this.options.italic)),this.options.listItem!==!1&&t.push(wi.configure(this.options.listItem)),this.options.listKeymap!==!1){var e;t.push(Ti.configure((e=this.options)===null||e===void 0?void 0:e.listKeymap))}if(this.options.link!==!1){var n;t.push(iu.configure((n=this.options)===null||n===void 0?void 0:n.link))}if(this.options.orderedList!==!1&&t.push(Ai.configure(this.options.orderedList)),this.options.paragraph!==!1&&t.push(Hu.configure(this.options.paragraph)),this.options.strike!==!1&&t.push(Uu.configure(this.options.strike)),this.options.text!==!1&&t.push(qu.configure(this.options.text)),this.options.underline!==!1){var r;t.push(Fu.configure((r=this.options)===null||r===void 0?void 0:r.underline))}if(this.options.trailingNode!==!1){var s;t.push(fd.configure((s=this.options)===null||s===void 0?void 0:s.trailingNode))}return t}});var kd=gd;const re={name:"tabs",itemName:"tab",newItemLabel:"New tab"},xe={name:"accordion",itemName:"section",newItemLabel:"New section"},Be={},bd=3,ve=t=>Array.from({length:t.childCount},(e,n)=>t.child(n)),Ni=t=>typeof t.attrs.label=="string"?t.attrs.label:"",pn=(t,e,n)=>t.type.create({...t.attrs,...n},e),_i=(t,e,n=Be)=>{const{nodes:r}=t.type.schema;return r[e.itemName].create({label:e.newItemLabel,...n},r.paragraph.create())},Oi=(t,e,n=Be)=>pn(t,[...ve(t),e],n),$i=(t,e,n,r=Be,s=Be)=>{const i=n.trim(),o=ve(t).map((a,l)=>l===e?a.type.create({...a.attrs,...r,...i===""?{}:{label:i}},a.content):a);return pn(t,o,s)},Pi=(t,e,n=Be)=>{const r=ve(t).filter((s,i)=>i!==e);return r.length===0?null:pn(t,r,n)},Di=(t,e,n,r=Be)=>{const s=ve(t);if(n<0||n>=s.length||e===n)return t;const i=s.filter((o,a)=>a!==e);return pn(t,[...i.slice(0,n),s[e],...i.slice(n)],r)},zi=t=>{const{schema:e}=t.type;return ve(t).flatMap(n=>[e.nodes.heading.create({level:bd},e.text(Ni(n))),...ve(n)])},Hi="data-accordion-controls",yd="Add a section",xd="Remove accordion",wd=t=>{const e=Te.c(18),{node:n,getPos:r,editor:s}=t;let i;e[0]!==s||e[1]!==r||e[2]!==n?(i=g=>{const m=r();typeof m=="number"&&s.view.dispatch(s.state.tr.replaceWith(m,m+n.nodeSize,g))},e[0]=s,e[1]=r,e[2]=n,e[3]=i):i=e[3];const o=i;let a,l;e[4]===Symbol.for("react.memo_cache_sentinel")?(a=T.jsx(Xn,{className:"flex flex-col divide-y divide-border"}),l={[Hi]:""},e[4]=a,e[5]=l):(a=e[4],l=e[5]);let c;e[6]!==n||e[7]!==o?(c=()=>{o(Oi(n,_i(n,xe,{isNaming:!0})))},e[6]=n,e[7]=o,e[8]=c):c=e[8];let u;e[9]===Symbol.for("react.memo_cache_sentinel")?(u=T.jsx(ks,{"aria-hidden":"true"}),e[9]=u):u=e[9];let d;e[10]!==c?(d=T.jsxs(ut,{type:"button",variant:"ghost",size:"sm",onClick:c,children:[u,yd]}),e[10]=c,e[11]=d):d=e[11];let h;e[12]!==n||e[13]!==o?(h=T.jsx(ut,{type:"button",variant:"ghost",size:"sm",onClick:()=>{o(zi(n))},children:xd}),e[12]=n,e[13]=o,e[14]=h):h=e[14];let p;return e[15]!==d||e[16]!==h?(p=T.jsxs(Zn,{className:"flex flex-col border-y border-border",children:[a,T.jsxs("div",{...l,contentEditable:!1,className:"flex items-center gap-2 border-t border-border py-2",children:[d,h]})]}),e[15]=d,e[16]=h,e[17]=p):p=e[17],p},vd={openLine:":::tabs",itemPrefix:"::tab ",startPattern:/^:::tabs[ \t]*$/m,itemPattern:/^::tab[ \t]+(\S.*?)$/},Td={openLine:":::accordion",itemPrefix:"::section ",startPattern:/^:::accordion[ \t]*$/m,itemPattern:/^::section[ \t]+(\S.*?)$/},Bi=":::",ot=`
|
|
168
|
+
`,ji=(t,e)=>{var n;return((n=t.itemPattern.exec(e))==null?void 0:n[1])??null},Ed=(t,e,n)=>n.map((r,s)=>({label:ji(t,e[r])??"",body:e.slice(r+1,n.at(s+1)??e.length).join(ot).trim()})),Ad=(t,e)=>{const n=t.split(ot),r=n.map(c=>c.trimEnd());if(r[0]!==e.openLine)return null;const s=r.findIndex((c,u)=>u>0&&c===Bi);if(s<0)return null;const i=r.slice(1,s),o=i.findIndex(c=>c!==""),a=i.flatMap((c,u)=>ji(e,c)===null?[]:[u]);if(o<0||a.at(0)!==o)return null;const l=n.length>s+1;return{raw:`${n.slice(0,s+1).join(ot)}${l?ot:""}`,items:Ed(e,i,a)}},Sd=(t,e)=>[e.openLine,...t.flatMap(({label:n,body:r})=>[`${e.itemPrefix}${n}`,...r===""?[]:[r]]),Bi].join(ot),Cd=`
|
|
169
|
+
|
|
170
|
+
`,Ld=t=>typeof t=="string"?t:"",Md=t=>typeof t=="object"&&t!==null&&"label"in t&&typeof t.label=="string"&&"tokens"in t&&Array.isArray(t.tokens),Rd=t=>{const e=t.items;return Array.isArray(e)?e.filter(Md):[]},Id=t=>t.length===0?[{type:"paragraph"}]:t,Ui=(t,e)=>({markdownTokenizer:{name:t.name,level:"block",start:i=>i.search(e.startPattern),tokenize:(i,o,a)=>{const l=Ad(i,e);return l===null?void 0:{type:t.name,raw:l.raw,items:l.items.map(c=>({label:c.label,tokens:a.blockTokens(c.body)}))}}},parseMarkdown:(i,o)=>({type:t.name,content:Rd(i).map(a=>({type:t.itemName,attrs:{label:a.label},content:Id(o.parseChildren(a.tokens))}))}),renderMarkdown:(i,o)=>Sd((i.content??[]).map(a=>{var l;return{label:Ld((l=a.attrs)==null?void 0:l.label),body:o.renderChildren(a.content??[],Cd).trim()}}),e)}),ts=["dragenter","dragover","dragleave","drop","dragend"],ns=t=>{t.stopPropagation()},qi=t=>{if(t!==null)return ts.forEach(e=>{t.addEventListener(e,ns)}),()=>{ts.forEach(e=>{t.removeEventListener(e,ns)})}},hr=(t,e)=>t instanceof Element&&t.closest(e)!==null,Fi="(paragraph | heading | bulletList | orderedList | blockquote | codeBlock)+",Wi=t=>{const e=Te.c(16),{fieldLabel:n,label:r,className:s,onCommit:i,onCancel:o}=t,[a,l]=_.useState(r),c=_.useRef(null);let u,d;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=()=>{var f,b;(f=c.current)==null||f.focus(),(b=c.current)==null||b.select()},d=[],e[0]=u,e[1]=d):(u=e[0],d=e[1]),_.useEffect(u,d);let h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h=f=>{l(f.target.value)},e[2]=h):h=e[2];let p;e[3]!==a||e[4]!==i?(p=()=>{i(a)},e[3]=a,e[4]=i,e[5]=p):p=e[5];let g;e[6]!==a||e[7]!==o||e[8]!==i?(g=f=>{f.key==="Enter"&&(f.preventDefault(),i(a)),f.key==="Escape"&&(f.preventDefault(),o())},e[6]=a,e[7]=o,e[8]=i,e[9]=g):g=e[9];let m;return e[10]!==s||e[11]!==a||e[12]!==n||e[13]!==p||e[14]!==g?(m=T.jsx("input",{ref:c,value:a,"aria-label":n,className:s,onChange:h,onBlur:p,onKeyDown:g}),e[10]=s,e[11]=a,e[12]=n,e[13]=p,e[14]=g,e[15]=m):m=e[15],m},Ki="data-tab-bar",Nd="Tab name",rs="Add a tab",_d="Remove tabs",Od="-mb-px w-36 border-b-2 border-ring bg-transparent pb-2 text-sm font-bold text-foreground outline-none",zn="flex size-6 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring",ss={ArrowLeft:-1,ArrowRight:1},is=t=>`Delete the tab ${t}`,pr=t=>({openIndex:typeof t.attrs.openIndex=="number"?t.attrs.openIndex:0,namingIndex:typeof t.attrs.namingIndex=="number"?t.attrs.namingIndex:null}),$d=(t,e,n)=>t>e?t-1:Math.min(t,n-1),Pd=t=>{const e=Te.c(52),{node:n,getPos:r,editor:s}=t,[i,o]=_.useState(null);let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=[],e[0]=a):a=e[0];const l=_.useRef(a);let c,u,d,h,p,g,m,f,b,k,v;if(e[1]!==i||e[2]!==s||e[3]!==r||e[4]!==n){u=ve(n).map(Ni);const{openIndex:R,namingIndex:B}=pr(n);let D;e[16]!==s||e[17]!==r||e[18]!==n?(D=O=>{const L=r();if(typeof L!="number")return;const q={from:L,to:L+n.nodeSize},Gi=O===null?s.state.tr.delete(q.from,q.to):s.state.tr.replaceWith(q.from,q.to,O);s.view.dispatch(Gi)},e[16]=s,e[17]=r,e[18]=n,e[19]=D):D=e[19],d=D;let K;e[20]!==s||e[21]!==r||e[22]!==n?(K=O=>{const L=r();typeof L=="number"&&s.view.dispatch(s.state.tr.setNodeMarkup(L,void 0,{...n.attrs,...O}).setMeta("addToHistory",!1))},e[20]=s,e[21]=r,e[22]=n,e[23]=K):K=e[23];const F=K,le=O=>{requestAnimationFrame(()=>{var L;(L=l.current[O])==null||L.focus()})},ce=(O,L)=>{d(Di(n,O,L,{openIndex:L})),le(L)},ke=(O,L)=>{if(O.key==="Enter"){O.preventDefault(),F({namingIndex:L});return}if(O.altKey&&Object.hasOwn(ss,O.key)){O.preventDefault(),ce(L,L+ss[O.key]);return}const q=Io(O.key,L,u.length);q!==null&&(O.preventDefault(),F({openIndex:q}),le(q))};c=Zn,v="flex flex-col gap-4",m=qi,e[24]===Symbol.for("react.memo_cache_sentinel")?(f={[Ki]:""},e[24]=f):f=e[24],b=!1,k="flex items-end gap-3",h="tablist",p=No,g=u.map((O,L)=>T.jsxs("div",{role:"presentation",className:"flex items-end gap-1",children:[L===B?T.jsx(Wi,{fieldLabel:Nd,label:O,className:Od,onCommit:q=>{d($i(n,L,q,{},{namingIndex:null}))},onCancel:()=>{F({namingIndex:null})}}):T.jsx("button",{ref:q=>{l.current[L]=q},type:"button",role:"tab","aria-selected":L===R,tabIndex:L===R?0:-1,draggable:!0,className:Ro,onClick:()=>{F({openIndex:L})},onDoubleClick:()=>{F({namingIndex:L})},onKeyDown:q=>{ke(q,L)},onDragStart:q=>{q.dataTransfer.setData("text/plain",O),o(L)},onDragOverCapture:Dd,onDropCapture:q=>{q.preventDefault(),i!==null&&ce(i,L),o(null)},onDragEndCapture:()=>{o(null)},children:O}),T.jsx("button",{type:"button","aria-label":is(O),title:is(O),className:`${zn} mb-1.5`,onClick:()=>{d(Pi(n,L,{openIndex:$d(R,L,u.length-1),namingIndex:null}))},children:T.jsx(bs,{"aria-hidden":"true",className:"size-3.5"})})]},`${String(L)}-${O}`)),e[1]=i,e[2]=s,e[3]=r,e[4]=n,e[5]=c,e[6]=u,e[7]=d,e[8]=h,e[9]=p,e[10]=g,e[11]=m,e[12]=f,e[13]=b,e[14]=k,e[15]=v}else c=e[5],u=e[6],d=e[7],h=e[8],p=e[9],g=e[10],m=e[11],f=e[12],b=e[13],k=e[14],v=e[15];let w;e[25]!==u.length||e[26]!==n||e[27]!==d?(w=()=>{d(Oi(n,_i(n,re),{openIndex:u.length,namingIndex:u.length}))},e[25]=u.length,e[26]=n,e[27]=d,e[28]=w):w=e[28];let A;e[29]===Symbol.for("react.memo_cache_sentinel")?(A=T.jsx(ks,{"aria-hidden":"true",className:"size-4"}),e[29]=A):A=e[29];let x;e[30]!==w?(x=T.jsx("button",{type:"button","aria-label":rs,title:rs,className:`${zn} mb-1.5`,onClick:w,children:A}),e[30]=w,e[31]=x):x=e[31];let E;e[32]!==x||e[33]!==h||e[34]!==p||e[35]!==g?(E=T.jsxs("div",{role:h,className:p,children:[g,x]}),e[32]=x,e[33]=h,e[34]=p,e[35]=g,e[36]=E):E=e[36];let S;e[37]!==n||e[38]!==d?(S=T.jsx(ut,{type:"button",variant:"ghost",size:"sm",className:"mb-1",onClick:()=>{d(zi(n))},children:_d}),e[37]=n,e[38]=d,e[39]=S):S=e[39];let M;e[40]!==E||e[41]!==S||e[42]!==m||e[43]!==f||e[44]!==b||e[45]!==k?(M=T.jsxs("div",{ref:m,...f,contentEditable:b,className:k,children:[E,S]}),e[40]=E,e[41]=S,e[42]=m,e[43]=f,e[44]=b,e[45]=k,e[46]=M):M=e[46];let H;e[47]===Symbol.for("react.memo_cache_sentinel")?(H=T.jsx(Xn,{className:"flex flex-col gap-4"}),e[47]=H):H=e[47];let N;return e[48]!==c||e[49]!==M||e[50]!==v?(N=T.jsxs(c,{className:v,children:[M,H]}),e[48]=c,e[49]=M,e[50]=v,e[51]=N):N=e[51],N};function Dd(t){t.preventDefault()}const fr="data-section-header",zd="Section name",os="application/x-flight-plan-section",Hd="w-64 border-b-2 border-ring bg-transparent text-sm font-bold text-foreground outline-none",Bd="cursor-grab rounded-sm text-left text-sm font-bold text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring",as={ArrowUp:-1,ArrowDown:1},jd=10,ls=t=>`Delete the section ${t}`,Ge=({editor:t,getPos:e})=>{const n=e();if(typeof n!="number")return null;const r=t.state.doc.resolve(n);return{accordion:r.parent,accordionPosition:r.before(),index:r.index()}},Ud=(t,e,n)=>{requestAnimationFrame(()=>{var s;const r=t.view.nodeDOM(e);r instanceof HTMLElement&&((s=Array.from(r.querySelectorAll(`[${fr}] button[data-section-name]`)).at(n))==null||s.focus())})},qd=t=>{const e=Te.c(47),{node:n,getPos:r,editor:s}=t,i=typeof n.attrs.label=="string"?n.attrs.label:"",o=n.attrs.isNaming===!0;let a;e[0]!==s||e[1]!==r?(a=N=>{const R=Ge({editor:s,getPos:r});if(R===null)return;const B=N(R),D={from:R.accordionPosition,to:R.accordionPosition+R.accordion.nodeSize};s.view.dispatch(B===null?s.state.tr.delete(D.from,D.to):s.state.tr.replaceWith(D.from,D.to,B))},e[0]=s,e[1]=r,e[2]=a):a=e[2];const l=a;let c;e[3]!==s||e[4]!==r||e[5]!==n.attrs?(c=N=>{const R=r();typeof R=="number"&&s.view.dispatch(s.state.tr.setNodeMarkup(R,void 0,{...n.attrs,isNaming:N}).setMeta("addToHistory",!1))},e[3]=s,e[4]=r,e[5]=n.attrs,e[6]=c):c=e[6];const u=c;let d;e[7]!==s||e[8]!==r||e[9]!==l?(d=(N,R)=>{const B=Ge({editor:s,getPos:r});B!==null&&(l(D=>{const{accordion:K}=D;return Di(K,N,R)}),Ud(s,B.accordionPosition,R))},e[7]=s,e[8]=r,e[9]=l,e[10]=d):d=e[10];const h=d;let p;e[11]!==s||e[12]!==r||e[13]!==h||e[14]!==u?(p=N=>{const R=Ge({editor:s,getPos:r});if(R!==null){if(N.key==="Enter"){N.preventDefault(),u(!0);return}N.altKey&&Object.hasOwn(as,N.key)&&(N.preventDefault(),h(R.index,R.index+as[N.key]))}},e[11]=s,e[12]=r,e[13]=h,e[14]=u,e[15]=p):p=e[15];const g=p;let m;e[16]!==s||e[17]!==r||e[18]!==h?(m=N=>{N.preventDefault();const R=Ge({editor:s,getPos:r}),B=Number.parseInt(N.dataTransfer.getData(os),jd);R!==null&&Number.isInteger(B)&&h(B,R.index)},e[16]=s,e[17]=r,e[18]=h,e[19]=m):m=e[19];const f=m;let b;e[20]===Symbol.for("react.memo_cache_sentinel")?(b={[fr]:""},e[20]=b):b=e[20];let k;e[21]!==s||e[22]!==r||e[23]!==f||e[24]!==g||e[25]!==o||e[26]!==i||e[27]!==l||e[28]!==u?(k=o?T.jsx(Wi,{fieldLabel:zd,label:i,className:Hd,onCommit:N=>{l(R=>{const{accordion:B,index:D}=R;return $i(B,D,N,{isNaming:!1})})},onCancel:()=>{u(!1)}}):T.jsx("button",{type:"button","data-section-name":"",draggable:!0,className:Bd,onDoubleClick:()=>{u(!0)},onKeyDown:g,onDragStart:N=>{var R;N.dataTransfer.setData(os,String(((R=Ge({editor:s,getPos:r}))==null?void 0:R.index)??""))},onDragOverCapture:Fd,onDropCapture:f,children:i}),e[21]=s,e[22]=r,e[23]=f,e[24]=g,e[25]=o,e[26]=i,e[27]=l,e[28]=u,e[29]=k):k=e[29];let v;e[30]!==i?(v=ls(i),e[30]=i,e[31]=v):v=e[31];let w;e[32]!==i?(w=ls(i),e[32]=i,e[33]=w):w=e[33];let A;e[34]!==l?(A=()=>{l(Wd)},e[34]=l,e[35]=A):A=e[35];let x;e[36]===Symbol.for("react.memo_cache_sentinel")?(x=T.jsx(bs,{"aria-hidden":"true",className:"size-3.5"}),e[36]=x):x=e[36];let E;e[37]!==A||e[38]!==v||e[39]!==w?(E=T.jsx("button",{type:"button","aria-label":v,title:w,className:zn,onClick:A,children:x}),e[37]=A,e[38]=v,e[39]=w,e[40]=E):E=e[40];let S;e[41]!==E||e[42]!==k?(S=T.jsxs("div",{ref:qi,...b,contentEditable:!1,className:"flex items-center gap-2",children:[k,E]}),e[41]=E,e[42]=k,e[43]=S):S=e[43];let M;e[44]===Symbol.for("react.memo_cache_sentinel")?(M=T.jsx(Xn,{className:"flex flex-col gap-4"}),e[44]=M):M=e[44];let H;return e[45]!==S?(H=T.jsxs(Zn,{className:"flex flex-col gap-2 py-3",children:[S,M]}),e[45]=S,e[46]=H):H=e[46],H};function Fd(t){t.preventDefault()}function Wd(t){const{accordion:e,index:n}=t;return Pi(e,n)}const Kd=V.create({name:xe.itemName,content:Fi,defining:!0,isolating:!0,addAttributes:()=>({label:{default:xe.newItemLabel,rendered:!1},isNaming:{default:!1,rendered:!1}}),parseHTML:()=>[{tag:"section[data-accordion-section]"}],renderHTML:()=>["section",{"data-accordion-section":""},0],addNodeView:()=>Yn(qd,{stopEvent:({event:t})=>hr(t.target,`[${fr}]`)})}),Vd=V.create({name:xe.name,group:"block",content:`${xe.itemName}+`,defining:!0,isolating:!0,selectable:!1,draggable:!1,parseHTML:()=>[{tag:"div[data-accordion]"}],renderHTML:()=>["div",{"data-accordion":""},0],addNodeView:()=>Yn(wd,{stopEvent:({event:t})=>hr(t.target,`[${Hi}]`)}),...Ui(xe,Td)}),Gd=[Vd,Kd],Qd={hidden:"hidden"},Xd=(t,e)=>ve(t).reduce((n,r)=>{var i;const s=((i=n.at(-1))==null?void 0:i.to)??e+1;return[...n,{from:s,to:s+r.nodeSize}]},[]),Zd=t=>ge.create(t,_o(t,e=>e.type.name===re.name).flatMap(({node:e,pos:n})=>Xd(e,n).filter((r,s)=>s!==pr(e).openIndex).map(({from:r,to:s})=>pt.node(r,s,Qd)))),Yd=t=>{const{$from:e}=t.selection,n=Array.from({length:e.depth},(o,a)=>e.depth-a).find(o=>e.node(o).type.name===re.itemName);if(n===void 0)return null;const r=n-1,s=e.index(r),i=e.node(r);return pr(i).openIndex===s?null:t.tr.setNodeMarkup(e.before(r),void 0,{...i.attrs,openIndex:s}).setMeta("addToHistory",!1)},Jd=new X({key:new se(re.name),props:{decorations:t=>Zd(t.doc)},appendTransaction:(t,e,n)=>t.some(r=>r.selectionSet)?Yd(n):null}),eh=V.create({name:re.itemName,content:Fi,defining:!0,isolating:!0,addAttributes:()=>({label:{default:re.newItemLabel,rendered:!1}}),parseHTML:()=>[{tag:"section[data-tab]"}],renderHTML:()=>["section",{"data-tab":"",class:"flex flex-col gap-4"},0]}),th=V.create({name:re.name,group:"block",content:`${re.itemName}+`,defining:!0,isolating:!0,selectable:!1,draggable:!1,addAttributes:()=>({openIndex:{default:0,rendered:!1},namingIndex:{default:null,rendered:!1}}),parseHTML:()=>[{tag:"div[data-tabs]"}],renderHTML:()=>["div",{"data-tabs":""},0],addNodeView:()=>Yn(Pd,{stopEvent:({event:t})=>hr(t.target,`[${Ki}]`)}),addProseMirrorPlugins:()=>[Jd],...Ui(re,vd)}),nh=[th,eh],rh=[...nh,...Gd],sh=3,Re="link",ih="Link",oh="Link address",ah="https://",lh="Apply",ch="Remove link",uh="Code link",dh="Tabs",hh="Accordion",ph=" ",fh=[{name:"bold",label:"Bold",icon:Do,toggle:t=>{t.chain().focus().toggleBold().run()}},{name:"italic",label:"Italic",icon:jo,toggle:t=>{t.chain().focus().toggleItalic().run()}},{name:"code",label:"Code",icon:zo,toggle:t=>{t.chain().focus().toggleCode().run()}},{name:"heading",label:"Heading",icon:Bo,toggle:t=>{t.chain().focus().toggleHeading({level:sh}).run()}},{name:"bulletList",label:"Bulleted list",icon:Wo,toggle:t=>{t.chain().focus().toggleBulletList().run()}},{name:"orderedList",label:"Numbered list",icon:Fo,toggle:t=>{t.chain().focus().toggleOrderedList().run()}},{name:"blockquote",label:"Quote",icon:Go,toggle:t=>{t.chain().focus().toggleBlockquote().run()}},{name:"codeBlock",label:"Code block",icon:Vo,toggle:t=>{t.chain().focus().toggleCodeBlock().run()}}],mh=kd.configure({strike:!1,underline:!1,horizontalRule:!1,link:{openOnClick:!1,autolink:!1}}),gh=()=>new Us,kh=t=>[mh,Po,...t?rh:[],Ga.configure({marked:gh()})],bh=ys("flex min-h-32 flex-col gap-4 px-3 py-2.5 text-base leading-[1.7] text-pretty outline-none","[&_:is(h1,h2,h3,h4,h5,h6)]:text-[1.1875rem] [&_:is(h1,h2,h3,h4,h5,h6)]:leading-7 [&_:is(h1,h2,h3,h4,h5,h6)]:font-semibold [&_:is(h1,h2,h3,h4,h5,h6)]:tracking-[-0.01em]","[&_ol]:flex [&_ol]:list-decimal [&_ol]:flex-col [&_ol]:gap-2 [&_ol]:pl-5 [&_ul]:flex [&_ul]:list-disc [&_ul]:flex-col [&_ul]:gap-2 [&_ul]:pl-5","[&_ol_ol]:mt-2 [&_ol_ul]:mt-2 [&_ul_ol]:mt-2 [&_ul_ul]:mt-2","[&_code]:rounded-sm [&_code]:bg-muted [&_code]:px-1.5 [&_code]:py-0.5 [&_code]:font-mono [&_code]:text-[0.875em] [&_strong]:font-bold","[&_a]:underline [&_a]:decoration-1 [&_a]:underline-offset-[0.3em]","[&_blockquote]:flex [&_blockquote]:flex-col [&_blockquote]:gap-4 [&_blockquote]:border-l-2 [&_blockquote]:border-border [&_blockquote]:pl-4 [&_blockquote]:text-muted-foreground","[&_pre]:overflow-x-auto [&_pre]:rounded-md [&_pre]:bg-code [&_pre]:px-4 [&_pre]:py-3 [&_pre]:font-mono [&_pre]:text-sm [&_pre]:leading-6 [&_pre_code]:bg-transparent [&_pre_code]:p-0 [&_pre_code]:text-[1em]","[&_.ProseMirror-selectednode]:outline-2 [&_.ProseMirror-selectednode]:outline-ring"),yh="rounded-lg border border-input bg-card focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/40 aria-invalid:border-destructive",xh="flex size-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 aria-pressed:bg-foreground aria-pressed:text-background",wh=t=>t.isActive(re.itemName)||t.isActive(xe.itemName),vh=(t,e)=>({bold:t.isActive("bold"),italic:t.isActive("italic"),code:t.isActive("code"),heading:t.isActive("heading"),bulletList:t.isActive("bulletList"),orderedList:t.isActive("orderedList"),blockquote:t.isActive("blockquote"),codeBlock:t.isActive("codeBlock"),link:t.isActive(Re),insideContainer:e&&wh(t)}),Th=t=>{const{href:e}=t.getAttributes(Re);return typeof e=="string"?e:""},Eh=t=>{const{from:e,to:n}=t.state.selection;return t.state.doc.textBetween(e,n,ph)},Ah=(t,e)=>{if(t.state.selection.empty&&!t.isActive(Re)){t.chain().focus().insertContent({type:"text",text:e,marks:[{type:Re,attrs:{href:e}}]}).run();return}t.chain().focus().extendMarkRange(Re).setLink({href:e}).run()},Sh=t=>{t.chain().focus().extendMarkRange(Re).unsetLink().run()},Ch=(t,e)=>{t.chain().focus().insertContent({type:Oo,attrs:e}).run()},Vi=(t,e,n,r)=>{t.chain().insertContent({type:e.name,attrs:n,content:[{type:e.itemName,attrs:{label:e.newItemLabel,...r},content:[{type:"paragraph"}]}]}).run()},Lh=t=>{Vi(t,re,{openIndex:0,namingIndex:0},{})},Mh=t=>{Vi(t,xe,{},{isNaming:!0})},Qe=t=>{const e=Te.c(8);let n;e[0]!==t.icon?(n=T.jsx(t.icon,{"aria-hidden":"true",className:"size-4"}),e[0]=t.icon,e[1]=n):n=e[1];let r;return e[2]!==t.isDisabled||e[3]!==t.isPressed||e[4]!==t.label||e[5]!==t.onClick||e[6]!==n?(r=T.jsx("button",{type:"button","aria-label":t.label,title:t.label,"aria-pressed":t.isPressed,disabled:t.isDisabled,className:xh,onMouseDown:Nh,onClick:t.onClick,children:n}),e[2]=t.isDisabled,e[3]=t.isPressed,e[4]=t.label,e[5]=t.onClick,e[6]=n,e[7]=r):r=e[7],r},Rh=t=>{const e=Te.c(22),{address:n,canRemove:r,onApply:s,onRemove:i}=t,[o,a]=_.useState(n);let l;e[0]!==o?(l=o.trim(),e[0]=o,e[1]=l):l=e[1];const c=l;let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=k=>{a(k.target.value)},e[2]=u):u=e[2];let d;e[3]!==s||e[4]!==c?(d=k=>{k.key==="Enter"&&(k.preventDefault(),c!==""&&s(c))},e[3]=s,e[4]=c,e[5]=d):d=e[5];let h;e[6]!==o||e[7]!==d?(h=T.jsx($o,{type:"url",value:o,placeholder:ah,"aria-label":oh,className:"h-7 flex-1",onChange:u,onKeyDown:d}),e[6]=o,e[7]=d,e[8]=h):h=e[8];let p;e[9]!==r||e[10]!==i?(p=r?T.jsx(ut,{type:"button",variant:"ghost",size:"sm",onClick:i,children:ch}):null,e[9]=r,e[10]=i,e[11]=p):p=e[11];const g=c==="";let m;e[12]!==s||e[13]!==c?(m=()=>{s(c)},e[12]=s,e[13]=c,e[14]=m):m=e[14];let f;e[15]!==g||e[16]!==m?(f=T.jsx(ut,{type:"button",size:"sm",disabled:g,onClick:m,children:lh}),e[15]=g,e[16]=m,e[17]=f):f=e[17];let b;return e[18]!==h||e[19]!==p||e[20]!==f?(b=T.jsxs("div",{className:"flex items-center gap-2 border-b border-input px-2 py-1.5",children:[h,p,f]}),e[18]=h,e[19]=p,e[20]=f,e[21]=b):b=e[21],b},Ih=t=>{const e=Te.c(24),{editor:n,label:r,isLinking:s,canLinkCode:i,canUseSections:o,onToggleLinking:a,onLinkCode:l}=t;let c;e[0]!==o?(c=k=>vh(k.editor,o),e[0]=o,e[1]=c):c=e[1];let u;e[2]!==n||e[3]!==c?(u={editor:n,selector:c},e[2]=n,e[3]=c,e[4]=u):u=e[4];const d=Ws(u);let h;e[5]!==d||e[6]!==n?(h=fh.map(k=>T.jsx(Qe,{label:k.label,icon:k.icon,isPressed:d[k.name],onClick:()=>{k.toggle(n)}},k.name)),e[5]=d,e[6]=n,e[7]=h):h=e[7];const p=d.link||s;let g;e[8]!==a||e[9]!==p?(g=T.jsx(Qe,{label:ih,icon:Uo,isPressed:p,onClick:a}),e[8]=a,e[9]=p,e[10]=g):g=e[10];let m;e[11]!==i||e[12]!==l?(m=i?T.jsx(Qe,{label:uh,icon:Ho,isPressed:!1,onClick:l}):null,e[11]=i,e[12]=l,e[13]=m):m=e[13];let f;e[14]!==d.insideContainer||e[15]!==o||e[16]!==n?(f=o?T.jsxs(T.Fragment,{children:[T.jsx(Qe,{label:dh,icon:Ko,isPressed:!1,isDisabled:d.insideContainer,onClick:()=>{Lh(n)}}),T.jsx(Qe,{label:hh,icon:qo,isPressed:!1,isDisabled:d.insideContainer,onClick:()=>{Mh(n)}})]}):null,e[14]=d.insideContainer,e[15]=o,e[16]=n,e[17]=f):f=e[17];let b;return e[18]!==r||e[19]!==h||e[20]!==g||e[21]!==m||e[22]!==f?(b=T.jsxs("div",{role:"toolbar","aria-label":r,className:"flex flex-wrap items-center gap-1 border-b border-input px-2 py-1.5",children:[h,g,m,f]}),e[18]=r,e[19]=h,e[20]=g,e[21]=m,e[22]=f,e[23]=b):b=e[23],b},Ph=t=>{const e=Te.c(46),{label:n,value:r,errorMessage:s,className:i,shouldFocus:o,canUseSections:a,renderCodeLinkDialog:l,onChange:c}=t,u=o===void 0?!1:o,d=a===void 0?!1:a,h=_.useId(),[p,g]=_.useState(!1),[m,f]=_.useState(!1),b=s!==null;let k;e[0]!==d?(k=()=>kh(d),e[0]=d,e[1]=k):k=e[1];const[v]=_.useState(k);let w;e[2]!==n?(w={attributes:{role:"textbox","aria-multiline":"true","aria-label":n,class:bh}},e[2]=n,e[3]=w):w=e[3];let A;e[4]!==c?(A=L=>{const{editor:q}=L;c(q.getMarkdown())},e[4]=c,e[5]=A):A=e[5];let x;e[6]!==v||e[7]!==u||e[8]!==w||e[9]!==A||e[10]!==r?(x={extensions:v,content:r,contentType:"markdown",autofocus:u,editorProps:w,onUpdate:A},e[6]=v,e[7]=u,e[8]=w,e[9]=A,e[10]=r,e[11]=x):x=e[11];const E=Wl(x);let S;e[12]!==i?(S=ys("grid gap-1.5",i),e[12]=i,e[13]=S):S=e[13];const M=`${n} formatting`,H=l!==void 0;let N,R;e[14]===Symbol.for("react.memo_cache_sentinel")?(N=()=>{g(_h)},R=()=>{f(!0)},e[14]=N,e[15]=R):(N=e[14],R=e[15]);let B;e[16]!==d||e[17]!==E||e[18]!==p||e[19]!==M||e[20]!==H?(B=T.jsx(Ih,{editor:E,label:M,isLinking:p,canLinkCode:H,canUseSections:d,onToggleLinking:N,onLinkCode:R}),e[16]=d,e[17]=E,e[18]=p,e[19]=M,e[20]=H,e[21]=B):B=e[21];let D;e[22]!==E||e[23]!==p?(D=p?T.jsx(Rh,{address:Th(E),canRemove:E.isActive(Re),onApply:L=>{Ah(E,L),g(!1)},onRemove:()=>{Sh(E),g(!1)}}):null,e[22]=E,e[23]=p,e[24]=D):D=e[24];const K=b?h:void 0;let F;e[25]!==E||e[26]!==K?(F=T.jsx(Fs,{editor:E,"aria-describedby":K}),e[25]=E,e[26]=K,e[27]=F):F=e[27];let le;e[28]!==b||e[29]!==B||e[30]!==D||e[31]!==F?(le=T.jsxs("div",{"aria-invalid":b,className:yh,children:[B,D,F]}),e[28]=b,e[29]=B,e[30]=D,e[31]=F,e[32]=le):le=e[32];let ce;e[33]!==h||e[34]!==s||e[35]!==b?(ce=b?T.jsx("p",{id:h,role:"alert",className:"text-sm text-destructive",children:s}):null,e[33]=h,e[34]=s,e[35]=b,e[36]=ce):ce=e[36];let ke;e[37]!==E||e[38]!==m||e[39]!==l?(ke=m&&l!==void 0?l({selectedText:Eh(E),onInsert:L=>{Ch(E,L),f(!1)},onClose:()=>{f(!1)}}):null,e[37]=E,e[38]=m,e[39]=l,e[40]=ke):ke=e[40];let O;return e[41]!==le||e[42]!==ce||e[43]!==ke||e[44]!==S?(O=T.jsxs("div",{className:S,children:[le,ce,ke]}),e[41]=le,e[42]=ce,e[43]=ke,e[44]=S,e[45]=O):O=e[45],O};function Nh(t){t.preventDefault()}function _h(t){return!t}export{Ph as T};
|