@clevertask/scribe 0.0.0

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.
Files changed (41) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +167 -0
  3. package/dist/SlashCommandList-DYKFukY8.js +3734 -0
  4. package/dist/components/Menu/BarMenu.d.ts +7 -0
  5. package/dist/components/Menu/BarMenu.js +119 -0
  6. package/dist/components/Menu/BubbleMenu.d.ts +7 -0
  7. package/dist/components/Menu/BubbleMenu.js +176 -0
  8. package/dist/components/Scribe/extension/extension-link.d.ts +2 -0
  9. package/dist/components/Scribe/extension/extension-link.js +934 -0
  10. package/dist/components/Scribe/extension/extension-selectedText.d.ts +12 -0
  11. package/dist/components/Scribe/extension/extension-selectedText.js +13 -0
  12. package/dist/components/Scribe/extension/index.d.ts +2 -0
  13. package/dist/components/Scribe/extension/index.js +1647 -0
  14. package/dist/components/Scribe/extension/slashCommand/SlashCommandList.d.ts +5 -0
  15. package/dist/components/Scribe/extension/slashCommand/SlashCommandList.js +10 -0
  16. package/dist/components/Scribe/extension/slashCommand/index.d.ts +4 -0
  17. package/dist/components/Scribe/extension/slashCommand/index.js +154 -0
  18. package/dist/components/Scribe/extension/slashCommand/items.d.ts +23 -0
  19. package/dist/components/Scribe/extension/slashCommand/items.js +159 -0
  20. package/dist/components/Scribe/extension/slashCommand/renderItems.d.ts +8 -0
  21. package/dist/components/Scribe/extension/slashCommand/renderItems.js +38 -0
  22. package/dist/components/Scribe/index.d.ts +28 -0
  23. package/dist/components/Scribe/index.js +92 -0
  24. package/dist/index-Cu10LNOZ.js +2505 -0
  25. package/dist/index-CzwFCNeI.js +12114 -0
  26. package/dist/main.css +1134 -0
  27. package/dist/main.d.ts +2 -0
  28. package/dist/main.js +10 -0
  29. package/dist/marked.esm-DIt7dqAB.js +1574 -0
  30. package/dist/purify.es-Bzg5nW_L.js +524 -0
  31. package/dist/turndown.browser.es-DwgPoVx0.js +646 -0
  32. package/dist/utils/html-to-markdown.d.ts +1 -0
  33. package/dist/utils/html-to-markdown.js +11 -0
  34. package/dist/utils/index.d.ts +3 -0
  35. package/dist/utils/index.js +8 -0
  36. package/dist/utils/is-in-viewport.d.ts +1 -0
  37. package/dist/utils/is-in-viewport.js +7 -0
  38. package/dist/utils/markdown-to-html.d.ts +1 -0
  39. package/dist/utils/markdown-to-html.js +6 -0
  40. package/dist/vite-env.d.js +1 -0
  41. package/package.json +95 -0
@@ -0,0 +1,934 @@
1
+ import { M as Ae, m as te, c as be, a as $t, P as Wt, d as Le, g as Oe, f as ve, h as Se, i as Ce } from "../../../index-CzwFCNeI.js";
2
+ const we = "aaa1rp3barth4b0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0faromeo7ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4vianca6w0s2x0a2z0ure5ba0by2idu3namex3narepublic11d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2ntley5rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re2s2c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y0eats7k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0cast4mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking0channel11l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dabur3d1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t0isalat7u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0at2delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d0network8tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntdoor4ier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0ardian6cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5gtv3iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0eles2s3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6logistics9properties14fh2g1h1i0a1ds2m1nder2le4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3ncaster5ia3d0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4de2k2psy3ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0cys3drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7serati6ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic3tual5v1w1x1y1z2na0b1goya4me2tura4vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rthwesternmutual14on4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9dnavy5lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3ssagens7y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0america6xi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cher3ks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0a1b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp2w2ell3ia1ksha5oes2p0ping5uji3w0time7i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ffany5ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0channel7ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lkswagen7vo3te1ing3o2yage5u0elos6wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4finity6ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2", Te = "ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5تصالات6رامكو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", q = (t, e) => {
3
+ for (const n in e)
4
+ t[n] = e[n];
5
+ return t;
6
+ }, Ht = "numeric", It = "ascii", Dt = "alpha", ft = "asciinumeric", ut = "alphanumeric", zt = "domain", ue = "emoji", Pe = "scheme", Re = "slashscheme", ee = "whitespace";
7
+ function xe(t, e) {
8
+ return t in e || (e[t] = []), e[t];
9
+ }
10
+ function z(t, e, n) {
11
+ e[Ht] && (e[ft] = !0, e[ut] = !0), e[It] && (e[ft] = !0, e[Dt] = !0), e[ft] && (e[ut] = !0), e[Dt] && (e[ut] = !0), e[ut] && (e[zt] = !0), e[ue] && (e[zt] = !0);
12
+ for (const s in e) {
13
+ const o = xe(s, n);
14
+ o.indexOf(t) < 0 && o.push(t);
15
+ }
16
+ }
17
+ function Ne(t, e) {
18
+ const n = {};
19
+ for (const s in e)
20
+ e[s].indexOf(t) >= 0 && (n[s] = !0);
21
+ return n;
22
+ }
23
+ function A(t) {
24
+ t === void 0 && (t = null), this.j = {}, this.jr = [], this.jd = null, this.t = t;
25
+ }
26
+ A.groups = {};
27
+ A.prototype = {
28
+ accepts() {
29
+ return !!this.t;
30
+ },
31
+ /**
32
+ * Follow an existing transition from the given input to the next state.
33
+ * Does not mutate.
34
+ * @param {string} input character or token type to transition on
35
+ * @returns {?State<T>} the next state, if any
36
+ */
37
+ go(t) {
38
+ const e = this, n = e.j[t];
39
+ if (n)
40
+ return n;
41
+ for (let s = 0; s < e.jr.length; s++) {
42
+ const o = e.jr[s][0], a = e.jr[s][1];
43
+ if (a && o.test(t))
44
+ return a;
45
+ }
46
+ return e.jd;
47
+ },
48
+ /**
49
+ * Whether the state has a transition for the given input. Set the second
50
+ * argument to true to only look for an exact match (and not a default or
51
+ * regular-expression-based transition)
52
+ * @param {string} input
53
+ * @param {boolean} exactOnly
54
+ */
55
+ has(t, e) {
56
+ return e === void 0 && (e = !1), e ? t in this.j : !!this.go(t);
57
+ },
58
+ /**
59
+ * Short for "transition all"; create a transition from the array of items
60
+ * in the given list to the same final resulting state.
61
+ * @param {string | string[]} inputs Group of inputs to transition on
62
+ * @param {Transition<T> | State<T>} [next] Transition options
63
+ * @param {Flags} [flags] Collections flags to add token to
64
+ * @param {Collections<T>} [groups] Master list of token groups
65
+ */
66
+ ta(t, e, n, s) {
67
+ for (let o = 0; o < t.length; o++)
68
+ this.tt(t[o], e, n, s);
69
+ },
70
+ /**
71
+ * Short for "take regexp transition"; defines a transition for this state
72
+ * when it encounters a token which matches the given regular expression
73
+ * @param {RegExp} regexp Regular expression transition (populate first)
74
+ * @param {T | State<T>} [next] Transition options
75
+ * @param {Flags} [flags] Collections flags to add token to
76
+ * @param {Collections<T>} [groups] Master list of token groups
77
+ * @returns {State<T>} taken after the given input
78
+ */
79
+ tr(t, e, n, s) {
80
+ s = s || A.groups;
81
+ let o;
82
+ return e && e.j ? o = e : (o = new A(e), n && s && z(e, n, s)), this.jr.push([t, o]), o;
83
+ },
84
+ /**
85
+ * Short for "take transitions", will take as many sequential transitions as
86
+ * the length of the given input and returns the
87
+ * resulting final state.
88
+ * @param {string | string[]} input
89
+ * @param {T | State<T>} [next] Transition options
90
+ * @param {Flags} [flags] Collections flags to add token to
91
+ * @param {Collections<T>} [groups] Master list of token groups
92
+ * @returns {State<T>} taken after the given input
93
+ */
94
+ ts(t, e, n, s) {
95
+ let o = this;
96
+ const a = t.length;
97
+ if (!a)
98
+ return o;
99
+ for (let i = 0; i < a - 1; i++)
100
+ o = o.tt(t[i]);
101
+ return o.tt(t[a - 1], e, n, s);
102
+ },
103
+ /**
104
+ * Short for "take transition", this is a method for building/working with
105
+ * state machines.
106
+ *
107
+ * If a state already exists for the given input, returns it.
108
+ *
109
+ * If a token is specified, that state will emit that token when reached by
110
+ * the linkify engine.
111
+ *
112
+ * If no state exists, it will be initialized with some default transitions
113
+ * that resemble existing default transitions.
114
+ *
115
+ * If a state is given for the second argument, that state will be
116
+ * transitioned to on the given input regardless of what that input
117
+ * previously did.
118
+ *
119
+ * Specify a token group flags to define groups that this token belongs to.
120
+ * The token will be added to corresponding entires in the given groups
121
+ * object.
122
+ *
123
+ * @param {string} input character, token type to transition on
124
+ * @param {T | State<T>} [next] Transition options
125
+ * @param {Flags} [flags] Collections flags to add token to
126
+ * @param {Collections<T>} [groups] Master list of groups
127
+ * @returns {State<T>} taken after the given input
128
+ */
129
+ tt(t, e, n, s) {
130
+ s = s || A.groups;
131
+ const o = this;
132
+ if (e && e.j)
133
+ return o.j[t] = e, e;
134
+ const a = e;
135
+ let i, l = o.go(t);
136
+ if (l ? (i = new A(), q(i.j, l.j), i.jr.push.apply(i.jr, l.jr), i.jd = l.jd, i.t = l.t) : i = new A(), a) {
137
+ if (s)
138
+ if (i.t && typeof i.t == "string") {
139
+ const f = q(Ne(i.t, s), n);
140
+ z(a, f, s);
141
+ } else n && z(a, n, s);
142
+ i.t = a;
143
+ }
144
+ return o.j[t] = i, i;
145
+ }
146
+ };
147
+ const c = (t, e, n, s, o) => t.ta(e, n, s, o), L = (t, e, n, s, o) => t.tr(e, n, s, o), ne = (t, e, n, s, o) => t.ts(e, n, s, o), r = (t, e, n, s, o) => t.tt(e, n, s, o), T = "WORD", Bt = "UWORD", et = "LOCALHOST", Kt = "TLD", Qt = "UTLD", pt = "SCHEME", Q = "SLASH_SCHEME", _t = "NUM", de = "WS", qt = "NL", $ = "OPENBRACE", V = "OPENBRACKET", X = "OPENANGLEBRACKET", Z = "OPENPAREN", I = "CLOSEBRACE", W = "CLOSEBRACKET", _ = "CLOSEANGLEBRACKET", D = "CLOSEPAREN", gt = "AMPERSAND", mt = "APOSTROPHE", kt = "ASTERISK", x = "AT", Et = "BACKSLASH", yt = "BACKTICK", At = "CARET", N = "COLON", Ft = "COMMA", bt = "DOLLAR", v = "DOT", Lt = "EQUALS", Gt = "EXCLAMATION", S = "HYPHEN", Ot = "PERCENT", vt = "PIPE", St = "PLUS", Ct = "POUND", wt = "QUERY", Yt = "QUOTE", Jt = "SEMI", C = "SLASH", tt = "TILDE", Tt = "UNDERSCORE", he = "EMOJI", Pt = "SYM";
148
+ var fe = /* @__PURE__ */ Object.freeze({
149
+ __proto__: null,
150
+ WORD: T,
151
+ UWORD: Bt,
152
+ LOCALHOST: et,
153
+ TLD: Kt,
154
+ UTLD: Qt,
155
+ SCHEME: pt,
156
+ SLASH_SCHEME: Q,
157
+ NUM: _t,
158
+ WS: de,
159
+ NL: qt,
160
+ OPENBRACE: $,
161
+ OPENBRACKET: V,
162
+ OPENANGLEBRACKET: X,
163
+ OPENPAREN: Z,
164
+ CLOSEBRACE: I,
165
+ CLOSEBRACKET: W,
166
+ CLOSEANGLEBRACKET: _,
167
+ CLOSEPAREN: D,
168
+ AMPERSAND: gt,
169
+ APOSTROPHE: mt,
170
+ ASTERISK: kt,
171
+ AT: x,
172
+ BACKSLASH: Et,
173
+ BACKTICK: yt,
174
+ CARET: At,
175
+ COLON: N,
176
+ COMMA: Ft,
177
+ DOLLAR: bt,
178
+ DOT: v,
179
+ EQUALS: Lt,
180
+ EXCLAMATION: Gt,
181
+ HYPHEN: S,
182
+ PERCENT: Ot,
183
+ PIPE: vt,
184
+ PLUS: St,
185
+ POUND: Ct,
186
+ QUERY: wt,
187
+ QUOTE: Yt,
188
+ SEMI: Jt,
189
+ SLASH: C,
190
+ TILDE: tt,
191
+ UNDERSCORE: Tt,
192
+ EMOJI: he,
193
+ SYM: Pt
194
+ });
195
+ const K = /[a-z]/, Nt = new RegExp("\\p{L}", "u"), jt = new RegExp("\\p{Emoji}", "u"), Mt = /\d/, se = /\s/, oe = `
196
+ `, je = "️", Me = "‍";
197
+ let dt = null, ht = null;
198
+ function Ue(t) {
199
+ t === void 0 && (t = []);
200
+ const e = {};
201
+ A.groups = e;
202
+ const n = new A();
203
+ dt == null && (dt = re(we)), ht == null && (ht = re(Te)), r(n, "'", mt), r(n, "{", $), r(n, "[", V), r(n, "<", X), r(n, "(", Z), r(n, "}", I), r(n, "]", W), r(n, ">", _), r(n, ")", D), r(n, "&", gt), r(n, "*", kt), r(n, "@", x), r(n, "`", yt), r(n, "^", At), r(n, ":", N), r(n, ",", Ft), r(n, "$", bt), r(n, ".", v), r(n, "=", Lt), r(n, "!", Gt), r(n, "-", S), r(n, "%", Ot), r(n, "|", vt), r(n, "+", St), r(n, "#", Ct), r(n, "?", wt), r(n, '"', Yt), r(n, "/", C), r(n, ";", Jt), r(n, "~", tt), r(n, "_", Tt), r(n, "\\", Et);
204
+ const s = L(n, Mt, _t, {
205
+ [Ht]: !0
206
+ });
207
+ L(s, Mt, s);
208
+ const o = L(n, K, T, {
209
+ [It]: !0
210
+ });
211
+ L(o, K, o);
212
+ const a = L(n, Nt, Bt, {
213
+ [Dt]: !0
214
+ });
215
+ L(a, K), L(a, Nt, a);
216
+ const i = L(n, se, de, {
217
+ [ee]: !0
218
+ });
219
+ r(n, oe, qt, {
220
+ [ee]: !0
221
+ }), r(i, oe), L(i, se, i);
222
+ const l = L(n, jt, he, {
223
+ [ue]: !0
224
+ });
225
+ L(l, jt, l), r(l, je, l);
226
+ const f = r(l, Me);
227
+ L(f, jt, l);
228
+ const u = [[K, o]], g = [[K, null], [Nt, a]];
229
+ for (let d = 0; d < dt.length; d++)
230
+ R(n, dt[d], Kt, T, u);
231
+ for (let d = 0; d < ht.length; d++)
232
+ R(n, ht[d], Qt, Bt, g);
233
+ z(Kt, {
234
+ tld: !0,
235
+ ascii: !0
236
+ }, e), z(Qt, {
237
+ utld: !0,
238
+ alpha: !0
239
+ }, e), R(n, "file", pt, T, u), R(n, "mailto", pt, T, u), R(n, "http", Q, T, u), R(n, "https", Q, T, u), R(n, "ftp", Q, T, u), R(n, "ftps", Q, T, u), z(pt, {
240
+ scheme: !0,
241
+ ascii: !0
242
+ }, e), z(Q, {
243
+ slashscheme: !0,
244
+ ascii: !0
245
+ }, e), t = t.sort((d, h) => d[0] > h[0] ? 1 : -1);
246
+ for (let d = 0; d < t.length; d++) {
247
+ const h = t[d][0], E = t[d][1] ? {
248
+ [Pe]: !0
249
+ } : {
250
+ [Re]: !0
251
+ };
252
+ h.indexOf("-") >= 0 ? E[zt] = !0 : K.test(h) ? Mt.test(h) ? E[ft] = !0 : E[It] = !0 : E[Ht] = !0, ne(n, h, h, E);
253
+ }
254
+ return ne(n, "localhost", et, {
255
+ ascii: !0
256
+ }), n.jd = new A(Pt), {
257
+ start: n,
258
+ tokens: q({
259
+ groups: e
260
+ }, fe)
261
+ };
262
+ }
263
+ function He(t, e) {
264
+ const n = Ie(e.replace(/[A-Z]/g, (l) => l.toLowerCase())), s = n.length, o = [];
265
+ let a = 0, i = 0;
266
+ for (; i < s; ) {
267
+ let l = t, f = null, u = 0, g = null, d = -1, h = -1;
268
+ for (; i < s && (f = l.go(n[i])); )
269
+ l = f, l.accepts() ? (d = 0, h = 0, g = l) : d >= 0 && (d += n[i].length, h++), u += n[i].length, a += n[i].length, i++;
270
+ a -= d, i -= h, u -= d, o.push({
271
+ t: g.t,
272
+ // token type/name
273
+ v: e.slice(a - u, a),
274
+ // string value
275
+ s: a - u,
276
+ // start index
277
+ e: a
278
+ // end index (excluding)
279
+ });
280
+ }
281
+ return o;
282
+ }
283
+ function Ie(t) {
284
+ const e = [], n = t.length;
285
+ let s = 0;
286
+ for (; s < n; ) {
287
+ let o = t.charCodeAt(s), a, i = o < 55296 || o > 56319 || s + 1 === n || (a = t.charCodeAt(s + 1)) < 56320 || a > 57343 ? t[s] : t.slice(s, s + 2);
288
+ e.push(i), s += i.length;
289
+ }
290
+ return e;
291
+ }
292
+ function R(t, e, n, s, o) {
293
+ let a;
294
+ const i = e.length;
295
+ for (let l = 0; l < i - 1; l++) {
296
+ const f = e[l];
297
+ t.j[f] ? a = t.j[f] : (a = new A(s), a.jr = o.slice(), t.j[f] = a), t = a;
298
+ }
299
+ return a = new A(n), a.jr = o.slice(), t.j[e[i - 1]] = a, a;
300
+ }
301
+ function re(t) {
302
+ const e = [], n = [];
303
+ let s = 0, o = "0123456789";
304
+ for (; s < t.length; ) {
305
+ let a = 0;
306
+ for (; o.indexOf(t[s + a]) >= 0; )
307
+ a++;
308
+ if (a > 0) {
309
+ e.push(n.join(""));
310
+ for (let i = parseInt(t.substring(s, s + a), 10); i > 0; i--)
311
+ n.pop();
312
+ s += a;
313
+ } else
314
+ n.push(t[s]), s++;
315
+ }
316
+ return e;
317
+ }
318
+ const nt = {
319
+ defaultProtocol: "http",
320
+ events: null,
321
+ format: ie,
322
+ formatHref: ie,
323
+ nl2br: !1,
324
+ tagName: "a",
325
+ target: null,
326
+ rel: null,
327
+ validate: !0,
328
+ truncate: 1 / 0,
329
+ className: null,
330
+ attributes: null,
331
+ ignoreTags: [],
332
+ render: null
333
+ };
334
+ function Vt(t, e) {
335
+ e === void 0 && (e = null);
336
+ let n = q({}, nt);
337
+ t && (n = q(n, t instanceof Vt ? t.o : t));
338
+ const s = n.ignoreTags, o = [];
339
+ for (let a = 0; a < s.length; a++)
340
+ o.push(s[a].toUpperCase());
341
+ this.o = n, e && (this.defaultRender = e), this.ignoreTags = o;
342
+ }
343
+ Vt.prototype = {
344
+ o: nt,
345
+ /**
346
+ * @type string[]
347
+ */
348
+ ignoreTags: [],
349
+ /**
350
+ * @param {IntermediateRepresentation} ir
351
+ * @returns {any}
352
+ */
353
+ defaultRender(t) {
354
+ return t;
355
+ },
356
+ /**
357
+ * Returns true or false based on whether a token should be displayed as a
358
+ * link based on the user options.
359
+ * @param {MultiToken} token
360
+ * @returns {boolean}
361
+ */
362
+ check(t) {
363
+ return this.get("validate", t.toString(), t);
364
+ },
365
+ // Private methods
366
+ /**
367
+ * Resolve an option's value based on the value of the option and the given
368
+ * params. If operator and token are specified and the target option is
369
+ * callable, automatically calls the function with the given argument.
370
+ * @template {keyof Opts} K
371
+ * @param {K} key Name of option to use
372
+ * @param {string} [operator] will be passed to the target option if it's a
373
+ * function. If not specified, RAW function value gets returned
374
+ * @param {MultiToken} [token] The token from linkify.tokenize
375
+ * @returns {Opts[K] | any}
376
+ */
377
+ get(t, e, n) {
378
+ const s = e != null;
379
+ let o = this.o[t];
380
+ return o && (typeof o == "object" ? (o = n.t in o ? o[n.t] : nt[t], typeof o == "function" && s && (o = o(e, n))) : typeof o == "function" && s && (o = o(e, n.t, n)), o);
381
+ },
382
+ /**
383
+ * @template {keyof Opts} L
384
+ * @param {L} key Name of options object to use
385
+ * @param {string} [operator]
386
+ * @param {MultiToken} [token]
387
+ * @returns {Opts[L] | any}
388
+ */
389
+ getObj(t, e, n) {
390
+ let s = this.o[t];
391
+ return typeof s == "function" && e != null && (s = s(e, n.t, n)), s;
392
+ },
393
+ /**
394
+ * Convert the given token to a rendered element that may be added to the
395
+ * calling-interface's DOM
396
+ * @param {MultiToken} token Token to render to an HTML element
397
+ * @returns {any} Render result; e.g., HTML string, DOM element, React
398
+ * Component, etc.
399
+ */
400
+ render(t) {
401
+ const e = t.render(this);
402
+ return (this.get("render", null, t) || this.defaultRender)(e, t.t, t);
403
+ }
404
+ };
405
+ function ie(t) {
406
+ return t;
407
+ }
408
+ function pe(t, e) {
409
+ this.t = "token", this.v = t, this.tk = e;
410
+ }
411
+ pe.prototype = {
412
+ isLink: !1,
413
+ /**
414
+ * Return the string this token represents.
415
+ * @return {string}
416
+ */
417
+ toString() {
418
+ return this.v;
419
+ },
420
+ /**
421
+ * What should the value for this token be in the `href` HTML attribute?
422
+ * Returns the `.toString` value by default.
423
+ * @param {string} [scheme]
424
+ * @return {string}
425
+ */
426
+ toHref(t) {
427
+ return this.toString();
428
+ },
429
+ /**
430
+ * @param {Options} options Formatting options
431
+ * @returns {string}
432
+ */
433
+ toFormattedString(t) {
434
+ const e = this.toString(), n = t.get("truncate", e, this), s = t.get("format", e, this);
435
+ return n && s.length > n ? s.substring(0, n) + "…" : s;
436
+ },
437
+ /**
438
+ *
439
+ * @param {Options} options
440
+ * @returns {string}
441
+ */
442
+ toFormattedHref(t) {
443
+ return t.get("formatHref", this.toHref(t.get("defaultProtocol")), this);
444
+ },
445
+ /**
446
+ * The start index of this token in the original input string
447
+ * @returns {number}
448
+ */
449
+ startIndex() {
450
+ return this.tk[0].s;
451
+ },
452
+ /**
453
+ * The end index of this token in the original input string (up to this
454
+ * index but not including it)
455
+ * @returns {number}
456
+ */
457
+ endIndex() {
458
+ return this.tk[this.tk.length - 1].e;
459
+ },
460
+ /**
461
+ Returns an object of relevant values for this token, which includes keys
462
+ * type - Kind of token ('url', 'email', etc.)
463
+ * value - Original text
464
+ * href - The value that should be added to the anchor tag's href
465
+ attribute
466
+ @method toObject
467
+ @param {string} [protocol] `'http'` by default
468
+ */
469
+ toObject(t) {
470
+ return t === void 0 && (t = nt.defaultProtocol), {
471
+ type: this.t,
472
+ value: this.toString(),
473
+ isLink: this.isLink,
474
+ href: this.toHref(t),
475
+ start: this.startIndex(),
476
+ end: this.endIndex()
477
+ };
478
+ },
479
+ /**
480
+ *
481
+ * @param {Options} options Formatting option
482
+ */
483
+ toFormattedObject(t) {
484
+ return {
485
+ type: this.t,
486
+ value: this.toFormattedString(t),
487
+ isLink: this.isLink,
488
+ href: this.toFormattedHref(t),
489
+ start: this.startIndex(),
490
+ end: this.endIndex()
491
+ };
492
+ },
493
+ /**
494
+ * Whether this token should be rendered as a link according to the given options
495
+ * @param {Options} options
496
+ * @returns {boolean}
497
+ */
498
+ validate(t) {
499
+ return t.get("validate", this.toString(), this);
500
+ },
501
+ /**
502
+ * Return an object that represents how this link should be rendered.
503
+ * @param {Options} options Formattinng options
504
+ */
505
+ render(t) {
506
+ const e = this, n = this.toHref(t.get("defaultProtocol")), s = t.get("formatHref", n, this), o = t.get("tagName", n, e), a = this.toFormattedString(t), i = {}, l = t.get("className", n, e), f = t.get("target", n, e), u = t.get("rel", n, e), g = t.getObj("attributes", n, e), d = t.getObj("events", n, e);
507
+ return i.href = s, l && (i.class = l), f && (i.target = f), u && (i.rel = u), g && q(i, g), {
508
+ tagName: o,
509
+ attributes: i,
510
+ content: a,
511
+ eventListeners: d
512
+ };
513
+ }
514
+ };
515
+ function Rt(t, e) {
516
+ class n extends pe {
517
+ constructor(o, a) {
518
+ super(o, a), this.t = t;
519
+ }
520
+ }
521
+ for (const s in e)
522
+ n.prototype[s] = e[s];
523
+ return n.t = t, n;
524
+ }
525
+ const ae = Rt("email", {
526
+ isLink: !0,
527
+ toHref() {
528
+ return "mailto:" + this.toString();
529
+ }
530
+ }), le = Rt("text"), De = Rt("nl"), H = Rt("url", {
531
+ isLink: !0,
532
+ /**
533
+ Lowercases relevant parts of the domain and adds the protocol if
534
+ required. Note that this will not escape unsafe HTML characters in the
535
+ URL.
536
+ @param {string} [scheme] default scheme (e.g., 'https')
537
+ @return {string} the full href
538
+ */
539
+ toHref(t) {
540
+ return t === void 0 && (t = nt.defaultProtocol), this.hasProtocol() ? this.v : `${t}://${this.v}`;
541
+ },
542
+ /**
543
+ * Check whether this URL token has a protocol
544
+ * @return {boolean}
545
+ */
546
+ hasProtocol() {
547
+ const t = this.tk;
548
+ return t.length >= 2 && t[0].t !== et && t[1].t === N;
549
+ }
550
+ }), y = (t) => new A(t);
551
+ function ze(t) {
552
+ let {
553
+ groups: e
554
+ } = t;
555
+ const n = e.domain.concat([gt, kt, x, Et, yt, At, bt, Lt, S, _t, Ot, vt, St, Ct, C, Pt, tt, Tt]), s = [mt, _, I, W, D, N, Ft, v, Gt, X, $, V, Z, wt, Yt, Jt], o = [gt, mt, kt, Et, yt, At, I, bt, Lt, S, $, Ot, vt, St, Ct, wt, C, Pt, tt, Tt], a = y(), i = r(a, tt);
556
+ c(i, o, i), c(i, e.domain, i);
557
+ const l = y(), f = y(), u = y();
558
+ c(a, e.domain, l), c(a, e.scheme, f), c(a, e.slashscheme, u), c(l, o, i), c(l, e.domain, l);
559
+ const g = r(l, x);
560
+ r(i, x, g), r(f, x, g), r(u, x, g);
561
+ const d = r(i, v);
562
+ c(d, o, i), c(d, e.domain, i);
563
+ const h = y();
564
+ c(g, e.domain, h), c(h, e.domain, h);
565
+ const b = r(h, v);
566
+ c(b, e.domain, h);
567
+ const E = y(ae);
568
+ c(b, e.tld, E), c(b, e.utld, E), r(g, et, E);
569
+ const F = r(h, S);
570
+ c(F, e.domain, h), c(E, e.domain, h), r(E, v, b), r(E, S, F);
571
+ const st = r(E, N);
572
+ c(st, e.numeric, ae);
573
+ const m = r(l, S), w = r(l, v);
574
+ c(m, e.domain, l), c(w, o, i), c(w, e.domain, l);
575
+ const O = y(H);
576
+ c(w, e.tld, O), c(w, e.utld, O), c(O, e.domain, l), c(O, o, i), r(O, v, w), r(O, S, m), r(O, x, g);
577
+ const ke = r(O, N), Xt = y(H);
578
+ c(ke, e.numeric, Xt);
579
+ const p = y(H), P = y();
580
+ c(p, n, p), c(p, s, P), c(P, n, p), c(P, s, P), r(O, C, p), r(Xt, C, p);
581
+ const Zt = r(f, N), Ee = r(u, N), ye = r(Ee, C), xt = r(ye, C);
582
+ c(f, e.domain, l), r(f, v, w), r(f, S, m), c(u, e.domain, l), r(u, v, w), r(u, S, m), c(Zt, e.domain, p), r(Zt, C, p), c(xt, e.domain, p), c(xt, n, p), r(xt, C, p);
583
+ const G = r(p, $), ot = r(p, V), rt = r(p, X), it = r(p, Z);
584
+ r(P, $, G), r(P, V, ot), r(P, X, rt), r(P, Z, it), r(G, I, p), r(ot, W, p), r(rt, _, p), r(it, D, p), r(G, I, p);
585
+ const B = y(H), j = y(H), M = y(H), U = y(H);
586
+ c(G, n, B), c(ot, n, j), c(rt, n, M), c(it, n, U);
587
+ const Y = y(), at = y(), lt = y(), ct = y();
588
+ return c(G, s), c(ot, s), c(rt, s), c(it, s), c(B, n, B), c(j, n, j), c(M, n, M), c(U, n, U), c(B, s, B), c(j, s, j), c(M, s, M), c(U, s, U), c(Y, n, Y), c(at, n, j), c(lt, n, M), c(ct, n, U), c(Y, s, Y), c(at, s, at), c(lt, s, lt), c(ct, s, ct), r(j, W, p), r(M, _, p), r(U, D, p), r(B, I, p), r(at, W, p), r(lt, _, p), r(ct, D, p), r(Y, D, p), r(a, et, O), r(a, qt, De), {
589
+ start: a,
590
+ tokens: fe
591
+ };
592
+ }
593
+ function Be(t, e, n) {
594
+ let s = n.length, o = 0, a = [], i = [];
595
+ for (; o < s; ) {
596
+ let l = t, f = null, u = null, g = 0, d = null, h = -1;
597
+ for (; o < s && !(f = l.go(n[o].t)); )
598
+ i.push(n[o++]);
599
+ for (; o < s && (u = f || l.go(n[o].t)); )
600
+ f = null, l = u, l.accepts() ? (h = 0, d = l) : h >= 0 && h++, o++, g++;
601
+ if (h < 0)
602
+ o -= g, o < s && (i.push(n[o]), o++);
603
+ else {
604
+ i.length > 0 && (a.push(Ut(le, e, i)), i = []), o -= h, g -= h;
605
+ const b = d.t, E = n.slice(o - g, o);
606
+ a.push(Ut(b, e, E));
607
+ }
608
+ }
609
+ return i.length > 0 && a.push(Ut(le, e, i)), a;
610
+ }
611
+ function Ut(t, e, n) {
612
+ const s = n[0].s, o = n[n.length - 1].e, a = e.slice(s, o);
613
+ return new t(a, n);
614
+ }
615
+ const Ke = typeof console < "u" && console && console.warn || (() => {
616
+ }), Qe = "until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.", k = {
617
+ scanner: null,
618
+ parser: null,
619
+ tokenQueue: [],
620
+ pluginQueue: [],
621
+ customSchemes: [],
622
+ initialized: !1
623
+ };
624
+ function $e() {
625
+ A.groups = {}, k.scanner = null, k.parser = null, k.tokenQueue = [], k.pluginQueue = [], k.customSchemes = [], k.initialized = !1;
626
+ }
627
+ function ce(t, e) {
628
+ if (e === void 0 && (e = !1), k.initialized && Ke(`linkifyjs: already initialized - will not register custom scheme "${t}" ${Qe}`), !/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))
629
+ throw new Error(`linkifyjs: incorrect scheme format.
630
+ 1. Must only contain digits, lowercase ASCII letters or "-"
631
+ 2. Cannot start or end with "-"
632
+ 3. "-" cannot repeat`);
633
+ k.customSchemes.push([t, e]);
634
+ }
635
+ function We() {
636
+ k.scanner = Ue(k.customSchemes);
637
+ for (let t = 0; t < k.tokenQueue.length; t++)
638
+ k.tokenQueue[t][1]({
639
+ scanner: k.scanner
640
+ });
641
+ k.parser = ze(k.scanner.tokens);
642
+ for (let t = 0; t < k.pluginQueue.length; t++)
643
+ k.pluginQueue[t][1]({
644
+ scanner: k.scanner,
645
+ parser: k.parser
646
+ });
647
+ k.initialized = !0;
648
+ }
649
+ function ge(t) {
650
+ return k.initialized || We(), Be(k.parser.start, t, He(k.scanner.start, t));
651
+ }
652
+ function me(t, e, n) {
653
+ if (e === void 0 && (e = null), n === void 0 && (n = null), e && typeof e == "object") {
654
+ if (n)
655
+ throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);
656
+ n = e, e = null;
657
+ }
658
+ const s = new Vt(n), o = ge(t), a = [];
659
+ for (let i = 0; i < o.length; i++) {
660
+ const l = o[i];
661
+ l.isLink && (!e || l.t === e) && s.check(l) && a.push(l.toFormattedObject(s));
662
+ }
663
+ return a;
664
+ }
665
+ function _e(t) {
666
+ return t.length === 1 ? t[0].isLink : t.length === 3 && t[1].isLink ? ["()", "[]"].includes(t[0].value + t[2].value) : !1;
667
+ }
668
+ function qe(t) {
669
+ return new $t({
670
+ key: new Wt("autolink"),
671
+ appendTransaction: (e, n, s) => {
672
+ const o = e.some((u) => u.docChanged) && !n.doc.eq(s.doc), a = e.some((u) => u.getMeta("preventAutolink"));
673
+ if (!o || a)
674
+ return;
675
+ const { tr: i } = s, l = Le(n.doc, [...e]);
676
+ if (Oe(l).forEach(({ newRange: u }) => {
677
+ const g = ve(s.doc, u, (b) => b.isTextblock);
678
+ let d, h;
679
+ if (g.length > 1 ? (d = g[0], h = s.doc.textBetween(d.pos, d.pos + d.node.nodeSize, void 0, " ")) : g.length && s.doc.textBetween(u.from, u.to, " ", " ").endsWith(" ") && (d = g[0], h = s.doc.textBetween(d.pos, u.to, void 0, " ")), d && h) {
680
+ const b = h.split(" ").filter((m) => m !== "");
681
+ if (b.length <= 0)
682
+ return !1;
683
+ const E = b[b.length - 1], F = d.pos + h.lastIndexOf(E);
684
+ if (!E)
685
+ return !1;
686
+ const st = ge(E).map((m) => m.toObject(t.defaultProtocol));
687
+ if (!_e(st))
688
+ return !1;
689
+ st.filter((m) => m.isLink).map((m) => ({
690
+ ...m,
691
+ from: F + m.start + 1,
692
+ to: F + m.end + 1
693
+ })).filter((m) => s.schema.marks.code ? !s.doc.rangeHasMark(m.from, m.to, s.schema.marks.code) : !0).filter((m) => t.validate(m.value)).filter((m) => t.shouldAutoLink(m.value)).forEach((m) => {
694
+ Se(m.from, m.to, s.doc).some((w) => w.mark.type === t.type) || i.addMark(m.from, m.to, t.type.create({
695
+ href: m.href
696
+ }));
697
+ });
698
+ }
699
+ }), !!i.steps.length)
700
+ return i;
701
+ }
702
+ });
703
+ }
704
+ function Fe(t) {
705
+ return new $t({
706
+ key: new Wt("handleClickLink"),
707
+ props: {
708
+ handleClick: (e, n, s) => {
709
+ var o, a;
710
+ if (s.button !== 0 || !e.editable)
711
+ return !1;
712
+ let i = s.target;
713
+ const l = [];
714
+ for (; i.nodeName !== "DIV"; )
715
+ l.push(i), i = i.parentNode;
716
+ if (!l.find((h) => h.nodeName === "A"))
717
+ return !1;
718
+ const f = Ce(e.state, t.type.name), u = s.target, g = (o = u == null ? void 0 : u.href) !== null && o !== void 0 ? o : f.href, d = (a = u == null ? void 0 : u.target) !== null && a !== void 0 ? a : f.target;
719
+ return u && g ? (window.open(g, d), !0) : !1;
720
+ }
721
+ }
722
+ });
723
+ }
724
+ function Ge(t) {
725
+ return new $t({
726
+ key: new Wt("handlePasteLink"),
727
+ props: {
728
+ handlePaste: (e, n, s) => {
729
+ const { state: o } = e, { selection: a } = o, { empty: i } = a;
730
+ if (i)
731
+ return !1;
732
+ let l = "";
733
+ s.content.forEach((u) => {
734
+ l += u.textContent;
735
+ });
736
+ const f = me(l, { defaultProtocol: t.defaultProtocol }).find((u) => u.isLink && u.value === l);
737
+ return !l || !f ? !1 : (t.editor.commands.setMark(t.type, {
738
+ href: f.href
739
+ }), !0);
740
+ }
741
+ }
742
+ });
743
+ }
744
+ const Ye = /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g;
745
+ function J(t, e) {
746
+ const n = [
747
+ "http",
748
+ "https",
749
+ "ftp",
750
+ "ftps",
751
+ "mailto",
752
+ "tel",
753
+ "callto",
754
+ "sms",
755
+ "cid",
756
+ "xmpp"
757
+ ];
758
+ return e && e.forEach((s) => {
759
+ const o = typeof s == "string" ? s : s.scheme;
760
+ o && n.push(o);
761
+ }), !t || t.replace(Ye, "").match(new RegExp(
762
+ // eslint-disable-next-line no-useless-escape
763
+ `^(?:(?:${n.join("|")}):|[^a-z]|[a-z+.-]+(?:[^a-z+.-:]|$))`,
764
+ "i"
765
+ ));
766
+ }
767
+ const Je = Ae.create({
768
+ name: "link",
769
+ priority: 1e3,
770
+ keepOnSplit: !1,
771
+ exitable: !0,
772
+ onCreate() {
773
+ 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) => {
774
+ if (typeof t == "string") {
775
+ ce(t);
776
+ return;
777
+ }
778
+ ce(t.scheme, t.optionalSlashes);
779
+ });
780
+ },
781
+ onDestroy() {
782
+ $e();
783
+ },
784
+ inclusive() {
785
+ return this.options.autolink;
786
+ },
787
+ addOptions() {
788
+ return {
789
+ openOnClick: !0,
790
+ linkOnPaste: !0,
791
+ autolink: !0,
792
+ protocols: [],
793
+ defaultProtocol: "http",
794
+ HTMLAttributes: {
795
+ target: "_blank",
796
+ rel: "noopener noreferrer nofollow",
797
+ class: null
798
+ },
799
+ isAllowedUri: (t, e) => !!J(t, e.protocols),
800
+ validate: (t) => !!t,
801
+ shouldAutoLink: (t) => !!t
802
+ };
803
+ },
804
+ addAttributes() {
805
+ return {
806
+ href: {
807
+ default: null,
808
+ parseHTML(t) {
809
+ return t.getAttribute("href");
810
+ }
811
+ },
812
+ target: {
813
+ default: this.options.HTMLAttributes.target
814
+ },
815
+ rel: {
816
+ default: this.options.HTMLAttributes.rel
817
+ },
818
+ class: {
819
+ default: this.options.HTMLAttributes.class
820
+ }
821
+ };
822
+ },
823
+ parseHTML() {
824
+ return [
825
+ {
826
+ tag: "a[href]",
827
+ getAttrs: (t) => {
828
+ const e = t.getAttribute("href");
829
+ return !e || !this.options.isAllowedUri(e, {
830
+ defaultValidate: (n) => !!J(n, this.options.protocols),
831
+ protocols: this.options.protocols,
832
+ defaultProtocol: this.options.defaultProtocol
833
+ }) ? !1 : null;
834
+ }
835
+ }
836
+ ];
837
+ },
838
+ renderHTML({ HTMLAttributes: t }) {
839
+ return this.options.isAllowedUri(t.href, {
840
+ defaultValidate: (e) => !!J(e, this.options.protocols),
841
+ protocols: this.options.protocols,
842
+ defaultProtocol: this.options.defaultProtocol
843
+ }) ? ["a", te(this.options.HTMLAttributes, t), 0] : [
844
+ "a",
845
+ te(this.options.HTMLAttributes, { ...t, href: "" }),
846
+ 0
847
+ ];
848
+ },
849
+ addCommands() {
850
+ return {
851
+ setLink: (t) => ({ chain: e }) => e().setMark(this.name, t).setMeta("preventAutolink", !0).run(),
852
+ toggleLink: (t) => ({ chain: e }) => e().toggleMark(this.name, t, { extendEmptyMarkRange: !0 }).setMeta("preventAutolink", !0).run(),
853
+ unsetLink: () => ({ chain: t }) => t().unsetMark(this.name, { extendEmptyMarkRange: !0 }).setMeta("preventAutolink", !0).run()
854
+ };
855
+ },
856
+ addPasteRules() {
857
+ return [
858
+ be({
859
+ find: (t) => {
860
+ const e = [];
861
+ if (t) {
862
+ const { protocols: n, defaultProtocol: s } = this.options, o = me(t).filter((a) => a.isLink && this.options.isAllowedUri(a.value, {
863
+ defaultValidate: (i) => !!J(i, n),
864
+ protocols: n,
865
+ defaultProtocol: s
866
+ }));
867
+ o.length && o.forEach((a) => e.push({
868
+ text: a.value,
869
+ data: {
870
+ href: a.href
871
+ },
872
+ index: a.start
873
+ }));
874
+ }
875
+ return e;
876
+ },
877
+ type: this.type,
878
+ getAttributes: (t) => {
879
+ var e;
880
+ return {
881
+ href: (e = t.data) === null || e === void 0 ? void 0 : e.href
882
+ };
883
+ }
884
+ })
885
+ ];
886
+ },
887
+ addProseMirrorPlugins() {
888
+ const t = [], { protocols: e, defaultProtocol: n } = this.options;
889
+ return this.options.autolink && t.push(qe({
890
+ type: this.type,
891
+ defaultProtocol: this.options.defaultProtocol,
892
+ validate: (s) => this.options.isAllowedUri(s, {
893
+ defaultValidate: (o) => !!J(o, e),
894
+ protocols: e,
895
+ defaultProtocol: n
896
+ }),
897
+ shouldAutoLink: this.options.shouldAutoLink
898
+ })), this.options.openOnClick === !0 && t.push(Fe({
899
+ type: this.type
900
+ })), this.options.linkOnPaste && t.push(Ge({
901
+ editor: this.editor,
902
+ defaultProtocol: this.options.defaultProtocol,
903
+ type: this.type
904
+ })), t;
905
+ }
906
+ }), Xe = Je.configure({
907
+ openOnClick: !1,
908
+ autolink: !0,
909
+ defaultProtocol: "https",
910
+ protocols: ["http", "https"],
911
+ isAllowedUri: (t, e) => {
912
+ try {
913
+ const n = t.includes(":") ? new URL(t) : new URL(`${e.defaultProtocol}://${t}`);
914
+ if (!e.defaultValidate(n.href))
915
+ return !1;
916
+ const s = ["ftp", "file", "mailto"], o = n.protocol.replace(":", "");
917
+ return !(s.includes(o) || !e.protocols.map(
918
+ (i) => typeof i == "string" ? i : i.scheme
919
+ ).includes(o));
920
+ } catch {
921
+ return !1;
922
+ }
923
+ },
924
+ shouldAutoLink: (t) => {
925
+ try {
926
+ return !!(t.includes(":") ? new URL(t) : new URL(`https://${t}`));
927
+ } catch {
928
+ return !1;
929
+ }
930
+ }
931
+ });
932
+ export {
933
+ Xe as default
934
+ };