ablok-components 0.3.34 → 0.3.35

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