@quoreadmin/ui 1.10.27 → 1.10.29

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 (197) hide show
  1. package/dist/index.css +1 -1
  2. package/dist/index103.js +11 -6
  3. package/dist/index147.js +2 -2
  4. package/dist/index149.js +1 -1
  5. package/dist/index151.js +4 -4
  6. package/dist/index157.js +160 -160
  7. package/dist/index165.js +1 -1
  8. package/dist/index169.js +7 -7
  9. package/dist/index197.js +1228 -36
  10. package/dist/index199.js +5816 -1106
  11. package/dist/index200.js +209 -0
  12. package/dist/index201.js +19 -5922
  13. package/dist/index202.js +10 -199
  14. package/dist/index203.js +76 -33
  15. package/dist/index204.js +249 -14
  16. package/dist/index205.js +13678 -72
  17. package/dist/index206.js +27 -253
  18. package/dist/index207.js +48 -13669
  19. package/dist/index208.js +236 -25
  20. package/dist/index209.js +293 -45
  21. package/dist/index210.js +238 -179
  22. package/dist/index211.js +36 -311
  23. package/dist/index212.js +43 -296
  24. package/dist/index216.js +2 -2
  25. package/dist/index217.js +1 -1
  26. package/dist/index219.js +4 -4
  27. package/dist/index221.js +1 -1
  28. package/dist/index222.js +1 -1
  29. package/dist/index223.js +1 -1
  30. package/dist/index224.js +4 -4
  31. package/dist/index226.js +1 -1
  32. package/dist/index227.js +2 -2
  33. package/dist/index228.js +2 -2
  34. package/dist/index229.js +1 -1
  35. package/dist/index23.js +47 -27
  36. package/dist/index230.js +1 -1
  37. package/dist/index231.js +1 -1
  38. package/dist/index232.js +1 -1
  39. package/dist/index233.js +1 -1
  40. package/dist/index234.js +4 -4
  41. package/dist/index235.js +1 -1
  42. package/dist/index236.js +1 -1
  43. package/dist/index237.js +1 -1
  44. package/dist/index238.js +1 -1
  45. package/dist/index240.js +1 -1
  46. package/dist/index241.js +1 -1
  47. package/dist/index242.js +1 -1
  48. package/dist/index243.js +1 -1
  49. package/dist/index244.js +1 -1
  50. package/dist/index249.js +1 -1
  51. package/dist/index250.js +1 -1
  52. package/dist/index251.js +1 -1
  53. package/dist/index252.js +6 -6
  54. package/dist/index253.js +1 -1
  55. package/dist/index254.js +1 -1
  56. package/dist/index255.js +1 -1
  57. package/dist/index256.js +1 -1
  58. package/dist/index257.js +1 -1
  59. package/dist/index259.js +1 -1
  60. package/dist/index260.js +1 -1
  61. package/dist/index261.js +3 -3
  62. package/dist/index262.js +1 -1
  63. package/dist/index263.js +1 -1
  64. package/dist/index264.js +1 -1
  65. package/dist/index265.js +1 -1
  66. package/dist/index266.js +1 -1
  67. package/dist/index267.js +1 -1
  68. package/dist/index270.js +3673 -217
  69. package/dist/index271.js +59 -7
  70. package/dist/index272.js +78 -133
  71. package/dist/index273.js +51 -82
  72. package/dist/index274.js +213 -52
  73. package/dist/index275.js +10 -79
  74. package/dist/index276.js +57 -26
  75. package/dist/index277.js +61 -22
  76. package/dist/index278.js +54 -22
  77. package/dist/index279.js +79 -14
  78. package/dist/index280.js +727 -16
  79. package/dist/index281.js +45 -21
  80. package/dist/index282.js +64 -3
  81. package/dist/index283.js +11 -27
  82. package/dist/index284.js +637 -3641
  83. package/dist/index285.js +819 -59
  84. package/dist/index286.js +242 -72
  85. package/dist/index287.js +7 -51
  86. package/dist/index288.js +132 -209
  87. package/dist/index289.js +83 -10
  88. package/dist/index290.js +51 -54
  89. package/dist/index291.js +77 -59
  90. package/dist/index292.js +26 -54
  91. package/dist/index293.js +22 -81
  92. package/dist/index294.js +21 -727
  93. package/dist/index295.js +14 -45
  94. package/dist/index296.js +15 -62
  95. package/dist/index297.js +22 -10
  96. package/dist/index298.js +3 -705
  97. package/dist/index299.js +21 -814
  98. package/dist/index301.js +1534 -79
  99. package/dist/index302.js +386 -22
  100. package/dist/index303.js +2698 -902
  101. package/dist/index304.js +85 -21
  102. package/dist/index305.js +3798 -20
  103. package/dist/index306.js +59 -19
  104. package/dist/index307.js +77 -67
  105. package/dist/index308.js +21 -18
  106. package/dist/index309.js +934 -18
  107. package/dist/index310.js +16 -16
  108. package/dist/index311.js +11 -13
  109. package/dist/index312.js +19 -62
  110. package/dist/index313.js +67 -263
  111. package/dist/index314.js +19 -6
  112. package/dist/index315.js +18 -149
  113. package/dist/index316.js +21 -68
  114. package/dist/index317.js +20 -89
  115. package/dist/index318.js +63 -29
  116. package/dist/index319.js +15 -16
  117. package/dist/index320.js +74 -65
  118. package/dist/index321.js +201 -3
  119. package/dist/index322.js +246 -2
  120. package/dist/index323.js +227 -76
  121. package/dist/index324.js +5 -57
  122. package/dist/index325.js +133 -5
  123. package/dist/index326.js +67 -4
  124. package/dist/index327.js +79 -178
  125. package/dist/index328.js +26 -60
  126. package/dist/index329.js +8 -74
  127. package/dist/index330.js +73 -35
  128. package/dist/index331.js +3 -8
  129. package/dist/index332.js +2 -13
  130. package/dist/index333.js +78 -50
  131. package/dist/index334.js +53 -11
  132. package/dist/index335.js +4 -12
  133. package/dist/index336.js +4 -57
  134. package/dist/index337.js +175 -48
  135. package/dist/index338.js +60 -28
  136. package/dist/index339.js +75 -2
  137. package/dist/index340.js +37 -5
  138. package/dist/index341.js +9 -2
  139. package/dist/index342.js +13 -23
  140. package/dist/index343.js +52 -38
  141. package/dist/index344.js +12 -2
  142. package/dist/index345.js +14 -11
  143. package/dist/index346.js +54 -16
  144. package/dist/index347.js +52 -10
  145. package/dist/index348.js +31 -10
  146. package/dist/index349.js +2 -17
  147. package/dist/index350.js +5 -2
  148. package/dist/index351.js +2 -9
  149. package/dist/index352.js +23 -10
  150. package/dist/index353.js +39 -12
  151. package/dist/index354.js +2 -1534
  152. package/dist/index355.js +9 -384
  153. package/dist/index356.js +16 -2727
  154. package/dist/index357.js +10 -86
  155. package/dist/index358.js +9 -3797
  156. package/dist/index359.js +15 -58
  157. package/dist/index360.js +2 -15
  158. package/dist/index361.js +9 -84
  159. package/dist/index362.js +9 -201
  160. package/dist/index363.js +13 -245
  161. package/dist/index364.js +1 -1
  162. package/dist/index365.js +1 -1
  163. package/dist/index367.js +1 -1
  164. package/dist/index368.js +14 -12
  165. package/dist/index369.js +1 -2
  166. package/dist/index370.js +22 -18
  167. package/dist/index371.js +2 -2
  168. package/dist/index372.js +3 -6
  169. package/dist/index373.js +3 -4
  170. package/dist/index374.js +2 -2
  171. package/dist/index375.js +2 -2
  172. package/dist/index376.js +1 -1
  173. package/dist/index378.js +20 -32
  174. package/dist/index379.js +45 -58
  175. package/dist/index380.js +1 -1
  176. package/dist/index381.js +98 -28
  177. package/dist/index382.js +90 -10
  178. package/dist/index383.js +98 -4
  179. package/dist/index384.js +30 -3
  180. package/dist/index385.js +11 -13
  181. package/dist/index386.js +4 -7
  182. package/dist/index387.js +3 -13
  183. package/dist/index388.js +13 -5
  184. package/dist/index389.js +7 -36
  185. package/dist/index390.js +11 -36
  186. package/dist/index391.js +5 -30
  187. package/dist/index392.js +33 -64
  188. package/dist/index393.js +29 -99
  189. package/dist/index394.js +28 -91
  190. package/dist/index395.js +59 -96
  191. package/dist/index396.js +1 -1
  192. package/dist/index402.js +1 -1
  193. package/dist/index50.js +1 -1
  194. package/dist/src/components/event/event.d.ts +12 -0
  195. package/dist/src/components/event/event.stories.d.ts +2 -0
  196. package/package.json +2 -2
  197. package/dist/index198.js +0 -46
package/dist/index284.js CHANGED
@@ -1,3711 +1,707 @@
1
- import { findWrapping as he, canJoin as gt, Transform as ge, RemoveMarkStep as ve, liftTarget as be, joinPoint as Dt, canSplit as G, ReplaceStep as ye, ReplaceAroundStep as ke } from "./index354.js";
2
- import { createParagraphNear as we, deleteSelection as Me, exitCode as xe, joinUp as Se, joinDown as Ee, joinBackward as Te, joinForward as Ae, joinTextblockBackward as Ce, joinTextblockForward as Pe, lift as $e, liftEmptyBlock as Ne, newlineInCode as Ie, selectNodeBackward as Re, selectNodeForward as Be, selectParentNode as Oe, selectTextblockEnd as je, selectTextblockStart as De, setBlockType as Tt, wrapIn as _e } from "./index355.js";
3
- import { EditorState as ze, NodeSelection as nt, Selection as z, TextSelection as P, Plugin as $, PluginKey as j, AllSelection as Le } from "./index299.js";
4
- import { DOMSerializer as Fe, Schema as _t, Fragment as O, Node as Ve, DOMParser as ut, Slice as He } from "./index356.js";
5
- import { liftListItem as Ue, sinkListItem as We, wrapInList as qe } from "./index357.js";
6
- import { EditorView as Ke } from "./index358.js";
7
- import { keymap as Je } from "./index359.js";
8
- var Qe = Object.defineProperty, vt = (e, t) => {
9
- for (var n in t)
10
- Qe(e, n, { get: t[n], enumerable: !0 });
11
- };
12
- function rt(e) {
13
- const { state: t, transaction: n } = e;
14
- let { selection: r } = n, { doc: o } = n, { storedMarks: s } = n;
15
- return {
16
- ...t,
17
- apply: t.apply.bind(t),
18
- applyTransaction: t.applyTransaction.bind(t),
19
- plugins: t.plugins,
20
- schema: t.schema,
21
- reconfigure: t.reconfigure.bind(t),
22
- toJSON: t.toJSON.bind(t),
23
- get storedMarks() {
24
- return s;
25
- },
26
- get selection() {
27
- return r;
28
- },
29
- get doc() {
30
- return o;
31
- },
32
- get tr() {
33
- return r = n.selection, o = n.doc, s = n.storedMarks, n;
34
- }
35
- };
1
+ const Ce = "aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2", pe = "ελ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", zt = "numeric", Bt = "ascii", Ft = "alpha", K = "asciinumeric", F = "alphanumeric", Kt = "domain", le = "emoji", Se = "scheme", Oe = "slashscheme", Pt = "whitespace";
2
+ function ye(t, n) {
3
+ return t in n || (n[t] = []), n[t];
36
4
  }
37
- var ot = class {
38
- constructor(e) {
39
- this.editor = e.editor, this.rawCommands = this.editor.extensionManager.commands, this.customState = e.state;
40
- }
41
- get hasCustomState() {
42
- return !!this.customState;
43
- }
44
- get state() {
45
- return this.customState || this.editor.state;
46
- }
47
- get commands() {
48
- const { rawCommands: e, editor: t, state: n } = this, { view: r } = t, { tr: o } = n, s = this.buildProps(o);
49
- return Object.fromEntries(
50
- Object.entries(e).map(([i, a]) => [i, (...l) => {
51
- const f = a(...l)(s);
52
- return !o.getMeta("preventDispatch") && !this.hasCustomState && r.dispatch(o), f;
53
- }])
54
- );
55
- }
56
- get chain() {
57
- return () => this.createChain();
58
- }
59
- get can() {
60
- return () => this.createCan();
5
+ function j(t, n, e) {
6
+ n[zt] && (n[K] = !0, n[F] = !0), n[Bt] && (n[K] = !0, n[Ft] = !0), n[K] && (n[F] = !0), n[Ft] && (n[F] = !0), n[F] && (n[Kt] = !0), n[le] && (n[Kt] = !0);
7
+ for (const s in n) {
8
+ const i = ye(s, e);
9
+ i.indexOf(t) < 0 && i.push(t);
61
10
  }
62
- createChain(e, t = !0) {
63
- const { rawCommands: n, editor: r, state: o } = this, { view: s } = r, i = [], a = !!e, c = e || o.tr, l = () => (!a && t && !c.getMeta("preventDispatch") && !this.hasCustomState && s.dispatch(c), i.every((d) => d === !0)), f = {
64
- ...Object.fromEntries(
65
- Object.entries(n).map(([d, p]) => [d, (...m) => {
66
- const h = this.buildProps(c, t), g = p(...m)(h);
67
- return i.push(g), f;
68
- }])
69
- ),
70
- run: l
71
- };
72
- return f;
73
- }
74
- createCan(e) {
75
- const { rawCommands: t, state: n } = this, r = !1, o = e || n.tr, s = this.buildProps(o, r);
76
- return {
77
- ...Object.fromEntries(
78
- Object.entries(t).map(([a, c]) => [a, (...l) => c(...l)({ ...s, dispatch: void 0 })])
79
- ),
80
- chain: () => this.createChain(o, r)
81
- };
82
- }
83
- buildProps(e, t = !0) {
84
- const { rawCommands: n, editor: r, state: o } = this, { view: s } = r, i = {
85
- tr: e,
86
- editor: r,
87
- view: s,
88
- state: rt({
89
- state: o,
90
- transaction: e
91
- }),
92
- dispatch: t ? () => {
93
- } : void 0,
94
- chain: () => this.createChain(e, t),
95
- can: () => this.createCan(e),
96
- get commands() {
97
- return Object.fromEntries(
98
- Object.entries(n).map(([a, c]) => [a, (...l) => c(...l)(i)])
99
- );
100
- }
101
- };
102
- return i;
103
- }
104
- }, zt = {};
105
- vt(zt, {
106
- blur: () => Ze,
107
- clearContent: () => Ge,
108
- clearNodes: () => Ye,
109
- command: () => Xe,
110
- createParagraphNear: () => tn,
111
- cut: () => en,
112
- deleteCurrentNode: () => nn,
113
- deleteNode: () => rn,
114
- deleteRange: () => on,
115
- deleteSelection: () => sn,
116
- enter: () => an,
117
- exitCode: () => cn,
118
- extendMarkRange: () => ln,
119
- first: () => dn,
120
- focus: () => fn,
121
- forEach: () => pn,
122
- insertContent: () => mn,
123
- insertContentAt: () => vn,
124
- joinBackward: () => kn,
125
- joinDown: () => yn,
126
- joinForward: () => wn,
127
- joinItemBackward: () => Mn,
128
- joinItemForward: () => xn,
129
- joinTextblockBackward: () => Sn,
130
- joinTextblockForward: () => En,
131
- joinUp: () => bn,
132
- keyboardShortcut: () => An,
133
- lift: () => Cn,
134
- liftEmptyBlock: () => Pn,
135
- liftListItem: () => $n,
136
- newlineInCode: () => Nn,
137
- resetAttributes: () => In,
138
- scrollIntoView: () => Rn,
139
- selectAll: () => Bn,
140
- selectNodeBackward: () => On,
141
- selectNodeForward: () => jn,
142
- selectParentNode: () => Dn,
143
- selectTextblockEnd: () => _n,
144
- selectTextblockStart: () => zn,
145
- setContent: () => Ln,
146
- setMark: () => ar,
147
- setMeta: () => cr,
148
- setNode: () => lr,
149
- setNodeSelection: () => dr,
150
- setTextDirection: () => ur,
151
- setTextSelection: () => fr,
152
- sinkListItem: () => pr,
153
- splitBlock: () => mr,
154
- splitListItem: () => hr,
155
- toggleList: () => gr,
156
- toggleMark: () => vr,
157
- toggleNode: () => br,
158
- toggleWrap: () => yr,
159
- undoInputRule: () => kr,
160
- unsetAllMarks: () => wr,
161
- unsetMark: () => Mr,
162
- unsetTextDirection: () => xr,
163
- updateAttributes: () => Sr,
164
- wrapIn: () => Er,
165
- wrapInList: () => Tr
166
- });
167
- var Ze = () => ({ editor: e, view: t }) => (requestAnimationFrame(() => {
168
- var n;
169
- e.isDestroyed || (t.dom.blur(), (n = window?.getSelection()) == null || n.removeAllRanges());
170
- }), !0), Ge = (e = !0) => ({ commands: t }) => t.setContent("", { emitUpdate: e }), Ye = () => ({ state: e, tr: t, dispatch: n }) => {
171
- const { selection: r } = t, { ranges: o } = r;
172
- return n && o.forEach(({ $from: s, $to: i }) => {
173
- e.doc.nodesBetween(s.pos, i.pos, (a, c) => {
174
- if (a.type.isText)
175
- return;
176
- const { doc: l, mapping: f } = t, d = l.resolve(f.map(c)), p = l.resolve(f.map(c + a.nodeSize)), u = d.blockRange(p);
177
- if (!u)
178
- return;
179
- const m = be(u);
180
- if (a.type.isTextblock) {
181
- const { defaultType: h } = d.parent.contentMatchAt(d.index());
182
- t.setNodeMarkup(u.start, h);
183
- }
184
- (m || m === 0) && t.lift(u, m);
185
- });
186
- }), !0;
187
- }, Xe = (e) => (t) => e(t), tn = () => ({ state: e, dispatch: t }) => we(e, t), en = (e, t) => ({ editor: n, tr: r }) => {
188
- const { state: o } = n, s = o.doc.slice(e.from, e.to);
189
- r.deleteRange(e.from, e.to);
190
- const i = r.mapping.map(t);
191
- return r.insert(i, s.content), r.setSelection(new P(r.doc.resolve(Math.max(i - 1, 0)))), !0;
192
- }, nn = () => ({ tr: e, dispatch: t }) => {
193
- const { selection: n } = e, r = n.$anchor.node();
194
- if (r.content.size > 0)
195
- return !1;
196
- const o = e.selection.$anchor;
197
- for (let s = o.depth; s > 0; s -= 1)
198
- if (o.node(s).type === r.type) {
199
- if (t) {
200
- const a = o.before(s), c = o.after(s);
201
- e.delete(a, c).scrollIntoView();
202
- }
203
- return !0;
204
- }
205
- return !1;
206
- };
207
- function T(e, t) {
208
- if (typeof e == "string") {
209
- if (!t.nodes[e])
210
- throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);
211
- return t.nodes[e];
212
- }
213
- return e;
214
- }
215
- var rn = (e) => ({ tr: t, state: n, dispatch: r }) => {
216
- const o = T(e, n.schema), s = t.selection.$anchor;
217
- for (let i = s.depth; i > 0; i -= 1)
218
- if (s.node(i).type === o) {
219
- if (r) {
220
- const c = s.before(i), l = s.after(i);
221
- t.delete(c, l).scrollIntoView();
222
- }
223
- return !0;
224
- }
225
- return !1;
226
- }, on = (e) => ({ tr: t, dispatch: n }) => {
227
- const { from: r, to: o } = e;
228
- return n && t.delete(r, o), !0;
229
- }, sn = () => ({ state: e, dispatch: t }) => Me(e, t), an = () => ({ commands: e }) => e.keyboardShortcut("Enter"), cn = () => ({ state: e, dispatch: t }) => xe(e, t);
230
- function bt(e) {
231
- return Object.prototype.toString.call(e) === "[object RegExp]";
232
- }
233
- function X(e, t, n = { strict: !0 }) {
234
- const r = Object.keys(t);
235
- return r.length ? r.every((o) => n.strict ? t[o] === e[o] : bt(t[o]) ? t[o].test(e[o]) : t[o] === e[o]) : !0;
236
11
  }
237
- function Lt(e, t, n = {}) {
238
- return e.find((r) => r.type === t && X(
239
- // Only check equality for the attributes that are provided
240
- Object.fromEntries(Object.keys(n).map((o) => [o, r.attrs[o]])),
241
- n
242
- ));
243
- }
244
- function At(e, t, n = {}) {
245
- return !!Lt(e, t, n);
246
- }
247
- function yt(e, t, n) {
248
- var r;
249
- if (!e || !t)
250
- return;
251
- let o = e.parent.childAfter(e.parentOffset);
252
- if ((!o.node || !o.node.marks.some((f) => f.type === t)) && (o = e.parent.childBefore(e.parentOffset)), !o.node || !o.node.marks.some((f) => f.type === t) || (n = n || ((r = o.node.marks[0]) == null ? void 0 : r.attrs), !Lt([...o.node.marks], t, n)))
253
- return;
254
- let i = o.index, a = e.start() + o.offset, c = i + 1, l = a + o.node.nodeSize;
255
- for (; i > 0 && At([...e.parent.child(i - 1).marks], t, n); )
256
- i -= 1, a -= e.parent.child(i).nodeSize;
257
- for (; c < e.parent.childCount && At([...e.parent.child(c).marks], t, n); )
258
- l += e.parent.child(c).nodeSize, c += 1;
259
- return {
260
- from: a,
261
- to: l
262
- };
263
- }
264
- function R(e, t) {
265
- if (typeof e == "string") {
266
- if (!t.marks[e])
267
- throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);
268
- return t.marks[e];
269
- }
12
+ function ke(t, n) {
13
+ const e = {};
14
+ for (const s in n)
15
+ n[s].indexOf(t) >= 0 && (e[s] = !0);
270
16
  return e;
271
17
  }
272
- var ln = (e, t = {}) => ({ tr: n, state: r, dispatch: o }) => {
273
- const s = R(e, r.schema), { doc: i, selection: a } = n, { $from: c, from: l, to: f } = a;
274
- if (o) {
275
- const d = yt(c, s, t);
276
- if (d && d.from <= l && d.to >= f) {
277
- const p = P.create(i, d.from, d.to);
278
- n.setSelection(p);
279
- }
280
- }
281
- return !0;
282
- }, dn = (e) => (t) => {
283
- const n = typeof e == "function" ? e(t) : e;
284
- for (let r = 0; r < n.length; r += 1)
285
- if (n[r](t))
286
- return !0;
287
- return !1;
288
- };
289
- function Ft(e) {
290
- return e instanceof P;
291
- }
292
- function _(e = 0, t = 0, n = 0) {
293
- return Math.min(Math.max(e, t), n);
294
- }
295
- function Vt(e, t = null) {
296
- if (!t)
297
- return null;
298
- const n = z.atStart(e), r = z.atEnd(e);
299
- if (t === "start" || t === !0)
300
- return n;
301
- if (t === "end")
302
- return r;
303
- const o = n.from, s = r.to;
304
- return t === "all" ? P.create(e, _(0, o, s), _(e.content.size, o, s)) : P.create(e, _(t, o, s), _(t, o, s));
305
- }
306
- function Ct() {
307
- return navigator.platform === "Android" || /android/i.test(navigator.userAgent);
18
+ function p(t = null) {
19
+ this.j = {}, this.jr = [], this.jd = null, this.t = t;
308
20
  }
309
- function tt() {
310
- return ["iPad Simulator", "iPhone Simulator", "iPod Simulator", "iPad", "iPhone", "iPod"].includes(navigator.platform) || // iPad on iOS 13 detection
311
- navigator.userAgent.includes("Mac") && "ontouchend" in document;
312
- }
313
- function un() {
314
- return typeof navigator < "u" ? /^((?!chrome|android).)*safari/i.test(navigator.userAgent) : !1;
315
- }
316
- var fn = (e = null, t = {}) => ({ editor: n, view: r, tr: o, dispatch: s }) => {
317
- t = {
318
- scrollIntoView: !0,
319
- ...t
320
- };
321
- const i = () => {
322
- (tt() || Ct()) && r.dom.focus(), un() && !tt() && !Ct() && r.dom.focus({ preventScroll: !0 }), requestAnimationFrame(() => {
323
- n.isDestroyed || (r.focus(), t?.scrollIntoView && n.commands.scrollIntoView());
324
- });
325
- };
326
- try {
327
- if (r.hasFocus() && e === null || e === !1)
328
- return !0;
329
- } catch {
330
- return !1;
331
- }
332
- if (s && e === null && !Ft(n.state.selection))
333
- return i(), !0;
334
- const a = Vt(o.doc, e) || n.state.selection, c = n.state.selection.eq(a);
335
- return s && (c || o.setSelection(a), c && o.storedMarks && o.setStoredMarks(o.storedMarks), i()), !0;
336
- }, pn = (e, t) => (n) => e.every((r, o) => t(r, { ...n, index: o })), mn = (e, t) => ({ tr: n, commands: r }) => r.insertContentAt({ from: n.selection.from, to: n.selection.to }, e, t), Ht = (e) => {
337
- const t = e.childNodes;
338
- for (let n = t.length - 1; n >= 0; n -= 1) {
339
- const r = t[n];
340
- r.nodeType === 3 && r.nodeValue && /^(\n\s\s|\n)$/.test(r.nodeValue) ? e.removeChild(r) : r.nodeType === 1 && Ht(r);
21
+ p.groups = {};
22
+ p.prototype = {
23
+ accepts() {
24
+ return !!this.t;
25
+ },
26
+ /**
27
+ * Follow an existing transition from the given input to the next state.
28
+ * Does not mutate.
29
+ * @param {string} input character or token type to transition on
30
+ * @returns {?State<T>} the next state, if any
31
+ */
32
+ go(t) {
33
+ const n = this, e = n.j[t];
34
+ if (e)
35
+ return e;
36
+ for (let s = 0; s < n.jr.length; s++) {
37
+ const i = n.jr[s][0], r = n.jr[s][1];
38
+ if (r && i.test(t))
39
+ return r;
40
+ }
41
+ return n.jd;
42
+ },
43
+ /**
44
+ * Whether the state has a transition for the given input. Set the second
45
+ * argument to true to only look for an exact match (and not a default or
46
+ * regular-expression-based transition)
47
+ * @param {string} input
48
+ * @param {boolean} exactOnly
49
+ */
50
+ has(t, n = !1) {
51
+ return n ? t in this.j : !!this.go(t);
52
+ },
53
+ /**
54
+ * Short for "transition all"; create a transition from the array of items
55
+ * in the given list to the same final resulting state.
56
+ * @param {string | string[]} inputs Group of inputs to transition on
57
+ * @param {Transition<T> | State<T>} [next] Transition options
58
+ * @param {Flags} [flags] Collections flags to add token to
59
+ * @param {Collections<T>} [groups] Master list of token groups
60
+ */
61
+ ta(t, n, e, s) {
62
+ for (let i = 0; i < t.length; i++)
63
+ this.tt(t[i], n, e, s);
64
+ },
65
+ /**
66
+ * Short for "take regexp transition"; defines a transition for this state
67
+ * when it encounters a token which matches the given regular expression
68
+ * @param {RegExp} regexp Regular expression transition (populate first)
69
+ * @param {T | State<T>} [next] Transition options
70
+ * @param {Flags} [flags] Collections flags to add token to
71
+ * @param {Collections<T>} [groups] Master list of token groups
72
+ * @returns {State<T>} taken after the given input
73
+ */
74
+ tr(t, n, e, s) {
75
+ s = s || p.groups;
76
+ let i;
77
+ return n && n.j ? i = n : (i = new p(n), e && s && j(n, e, s)), this.jr.push([t, i]), i;
78
+ },
79
+ /**
80
+ * Short for "take transitions", will take as many sequential transitions as
81
+ * the length of the given input and returns the
82
+ * resulting final state.
83
+ * @param {string | string[]} input
84
+ * @param {T | State<T>} [next] Transition options
85
+ * @param {Flags} [flags] Collections flags to add token to
86
+ * @param {Collections<T>} [groups] Master list of token groups
87
+ * @returns {State<T>} taken after the given input
88
+ */
89
+ ts(t, n, e, s) {
90
+ let i = this;
91
+ const r = t.length;
92
+ if (!r)
93
+ return i;
94
+ for (let a = 0; a < r - 1; a++)
95
+ i = i.tt(t[a]);
96
+ return i.tt(t[r - 1], n, e, s);
97
+ },
98
+ /**
99
+ * Short for "take transition", this is a method for building/working with
100
+ * state machines.
101
+ *
102
+ * If a state already exists for the given input, returns it.
103
+ *
104
+ * If a token is specified, that state will emit that token when reached by
105
+ * the linkify engine.
106
+ *
107
+ * If no state exists, it will be initialized with some default transitions
108
+ * that resemble existing default transitions.
109
+ *
110
+ * If a state is given for the second argument, that state will be
111
+ * transitioned to on the given input regardless of what that input
112
+ * previously did.
113
+ *
114
+ * Specify a token group flags to define groups that this token belongs to.
115
+ * The token will be added to corresponding entires in the given groups
116
+ * object.
117
+ *
118
+ * @param {string} input character, token type to transition on
119
+ * @param {T | State<T>} [next] Transition options
120
+ * @param {Flags} [flags] Collections flags to add token to
121
+ * @param {Collections<T>} [groups] Master list of groups
122
+ * @returns {State<T>} taken after the given input
123
+ */
124
+ tt(t, n, e, s) {
125
+ s = s || p.groups;
126
+ const i = this;
127
+ if (n && n.j)
128
+ return i.j[t] = n, n;
129
+ const r = n;
130
+ let a, c = i.go(t);
131
+ if (c ? (a = new p(), Object.assign(a.j, c.j), a.jr.push.apply(a.jr, c.jr), a.jd = c.jd, a.t = c.t) : a = new p(), r) {
132
+ if (s)
133
+ if (a.t && typeof a.t == "string") {
134
+ const d = Object.assign(ke(a.t, s), e);
135
+ j(r, d, s);
136
+ } else e && j(r, e, s);
137
+ a.t = r;
138
+ }
139
+ return i.j[t] = a, a;
341
140
  }
342
- return e;
343
141
  };
344
- function K(e) {
345
- if (typeof window > "u")
346
- throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");
347
- const t = `<body>${e}</body>`, n = new window.DOMParser().parseFromString(t, "text/html").body;
348
- return Ht(n);
349
- }
350
- function U(e, t, n) {
351
- if (e instanceof Ve || e instanceof O)
352
- return e;
353
- n = {
354
- slice: !0,
355
- parseOptions: {},
356
- ...n
357
- };
358
- const r = typeof e == "object" && e !== null, o = typeof e == "string";
359
- if (r)
360
- try {
361
- if (Array.isArray(e) && e.length > 0)
362
- return O.fromArray(e.map((a) => t.nodeFromJSON(a)));
363
- const i = t.nodeFromJSON(e);
364
- return n.errorOnInvalidContent && i.check(), i;
365
- } catch (s) {
366
- if (n.errorOnInvalidContent)
367
- throw new Error("[tiptap error]: Invalid JSON content", { cause: s });
368
- return console.warn("[tiptap warn]: Invalid content.", "Passed value:", e, "Error:", s), U("", t, n);
369
- }
370
- if (o) {
371
- if (n.errorOnInvalidContent) {
372
- let i = !1, a = "";
373
- const c = new _t({
374
- topNode: t.spec.topNode,
375
- marks: t.spec.marks,
376
- // Prosemirror's schemas are executed such that: the last to execute, matches last
377
- // This means that we can add a catch-all node at the end of the schema to catch any content that we don't know how to handle
378
- nodes: t.spec.nodes.append({
379
- __tiptap__private__unknown__catch__all__node: {
380
- content: "inline*",
381
- group: "block",
382
- parseDOM: [
383
- {
384
- tag: "*",
385
- getAttrs: (l) => (i = !0, a = typeof l == "string" ? l : l.outerHTML, null)
386
- }
387
- ]
388
- }
389
- })
390
- });
391
- if (n.slice ? ut.fromSchema(c).parseSlice(K(e), n.parseOptions) : ut.fromSchema(c).parse(K(e), n.parseOptions), n.errorOnInvalidContent && i)
392
- throw new Error("[tiptap error]: Invalid HTML content", {
393
- cause: new Error(`Invalid element found: ${a}`)
394
- });
395
- }
396
- const s = ut.fromSchema(t);
397
- return n.slice ? s.parseSlice(K(e), n.parseOptions).content : s.parse(K(e), n.parseOptions);
398
- }
399
- return U("", t, n);
400
- }
401
- function hn(e, t, n) {
402
- const r = e.steps.length - 1;
403
- if (r < t)
404
- return;
405
- const o = e.steps[r];
406
- if (!(o instanceof ye || o instanceof ke))
407
- return;
408
- const s = e.mapping.maps[r];
409
- let i = 0;
410
- s.forEach((a, c, l, f) => {
411
- i === 0 && (i = f);
412
- }), e.setSelection(z.near(e.doc.resolve(i), n));
413
- }
414
- var gn = (e) => !("type" in e), vn = (e, t, n) => ({ tr: r, dispatch: o, editor: s }) => {
415
- var i;
416
- if (o) {
417
- n = {
418
- parseOptions: s.options.parseOptions,
419
- updateSelection: !0,
420
- applyInputRules: !1,
421
- applyPasteRules: !1,
422
- ...n
423
- };
424
- let a;
425
- const c = (g) => {
426
- s.emit("contentError", {
427
- editor: s,
428
- error: g,
429
- disableCollaboration: () => {
430
- "collaboration" in s.storage && typeof s.storage.collaboration == "object" && s.storage.collaboration && (s.storage.collaboration.isDisabled = !0);
431
- }
432
- });
433
- }, l = {
434
- preserveWhitespace: "full",
435
- ...n.parseOptions
436
- };
437
- if (!n.errorOnInvalidContent && !s.options.enableContentCheck && s.options.emitContentError)
438
- try {
439
- U(t, s.schema, {
440
- parseOptions: l,
441
- errorOnInvalidContent: !0
442
- });
443
- } catch (g) {
444
- c(g);
445
- }
446
- try {
447
- a = U(t, s.schema, {
448
- parseOptions: l,
449
- errorOnInvalidContent: (i = n.errorOnInvalidContent) != null ? i : s.options.enableContentCheck
450
- });
451
- } catch (g) {
452
- return c(g), !1;
453
- }
454
- let { from: f, to: d } = typeof e == "number" ? { from: e, to: e } : { from: e.from, to: e.to }, p = !0, u = !0;
455
- if ((gn(a) ? a : [a]).forEach((g) => {
456
- g.check(), p = p ? g.isText && g.marks.length === 0 : !1, u = u ? g.isBlock : !1;
457
- }), f === d && u) {
458
- const { parent: g } = r.doc.resolve(f);
459
- g.isTextblock && !g.type.spec.code && !g.childCount && (f -= 1, d += 1);
460
- }
461
- let h;
462
- if (p) {
463
- if (Array.isArray(t))
464
- h = t.map((g) => g.text || "").join("");
465
- else if (t instanceof O) {
466
- let g = "";
467
- t.forEach((v) => {
468
- v.text && (g += v.text);
469
- }), h = g;
470
- } else typeof t == "object" && t && t.text ? h = t.text : h = t;
471
- r.insertText(h, f, d);
472
- } else {
473
- h = a;
474
- const g = r.doc.resolve(f), v = g.node(), y = g.parentOffset === 0, w = v.isText || v.isTextblock, M = v.content.size > 0;
475
- y && w && M && (f = Math.max(0, f - 1)), r.replaceWith(f, d, h);
476
- }
477
- n.updateSelection && hn(r, r.steps.length - 1, -1), n.applyInputRules && r.setMeta("applyInputRules", { from: f, text: h }), n.applyPasteRules && r.setMeta("applyPasteRules", { from: f, text: h });
478
- }
479
- return !0;
480
- }, bn = () => ({ state: e, dispatch: t }) => Se(e, t), yn = () => ({ state: e, dispatch: t }) => Ee(e, t), kn = () => ({ state: e, dispatch: t }) => Te(e, t), wn = () => ({ state: e, dispatch: t }) => Ae(e, t), Mn = () => ({ state: e, dispatch: t, tr: n }) => {
481
- try {
482
- const r = Dt(e.doc, e.selection.$from.pos, -1);
483
- return r == null ? !1 : (n.join(r, 2), t && t(n), !0);
484
- } catch {
485
- return !1;
486
- }
487
- }, xn = () => ({ state: e, dispatch: t, tr: n }) => {
488
- try {
489
- const r = Dt(e.doc, e.selection.$from.pos, 1);
490
- return r == null ? !1 : (n.join(r, 2), t && t(n), !0);
491
- } catch {
492
- return !1;
493
- }
494
- }, Sn = () => ({ state: e, dispatch: t }) => Ce(e, t), En = () => ({ state: e, dispatch: t }) => Pe(e, t);
495
- function Ut() {
496
- return typeof navigator < "u" ? /Mac/.test(navigator.platform) : !1;
497
- }
498
- function Tn(e) {
499
- const t = e.split(/-(?!$)/);
500
- let n = t[t.length - 1];
501
- n === "Space" && (n = " ");
502
- let r, o, s, i;
503
- for (let a = 0; a < t.length - 1; a += 1) {
504
- const c = t[a];
505
- if (/^(cmd|meta|m)$/i.test(c))
506
- i = !0;
507
- else if (/^a(lt)?$/i.test(c))
508
- r = !0;
509
- else if (/^(c|ctrl|control)$/i.test(c))
510
- o = !0;
511
- else if (/^s(hift)?$/i.test(c))
512
- s = !0;
513
- else if (/^mod$/i.test(c))
514
- tt() || Ut() ? i = !0 : o = !0;
515
- else
516
- throw new Error(`Unrecognized modifier name: ${c}`);
517
- }
518
- return r && (n = `Alt-${n}`), o && (n = `Ctrl-${n}`), i && (n = `Meta-${n}`), s && (n = `Shift-${n}`), n;
519
- }
520
- var An = (e) => ({ editor: t, view: n, tr: r, dispatch: o }) => {
521
- const s = Tn(e).split(/-(?!$)/), i = s.find((l) => !["Alt", "Ctrl", "Meta", "Shift"].includes(l)), a = new KeyboardEvent("keydown", {
522
- key: i === "Space" ? " " : i,
523
- altKey: s.includes("Alt"),
524
- ctrlKey: s.includes("Ctrl"),
525
- metaKey: s.includes("Meta"),
526
- shiftKey: s.includes("Shift"),
527
- bubbles: !0,
528
- cancelable: !0
529
- }), c = t.captureTransaction(() => {
530
- n.someProp("handleKeyDown", (l) => l(n, a));
142
+ const l = (t, n, e, s, i) => t.ta(n, e, s, i), f = (t, n, e, s, i) => t.tr(n, e, s, i), se = (t, n, e, s, i) => t.ts(n, e, s, i), o = (t, n, e, s, i) => t.tt(n, e, s, i), I = "WORD", Wt = "UWORD", ue = "ASCIINUMERICAL", he = "ALPHANUMERICAL", _ = "LOCALHOST", Gt = "TLD", Qt = "UTLD", tt = "SCHEME", U = "SLASH_SCHEME", qt = "NUM", $t = "WS", _t = "NL", W = "OPENBRACE", G = "CLOSEBRACE", et = "OPENBRACKET", nt = "CLOSEBRACKET", st = "OPENPAREN", it = "CLOSEPAREN", ot = "OPENANGLEBRACKET", rt = "CLOSEANGLEBRACKET", at = "FULLWIDTHLEFTPAREN", ct = "FULLWIDTHRIGHTPAREN", lt = "LEFTCORNERBRACKET", ut = "RIGHTCORNERBRACKET", ht = "LEFTWHITECORNERBRACKET", dt = "RIGHTWHITECORNERBRACKET", Et = "FULLWIDTHLESSTHAN", ft = "FULLWIDTHGREATERTHAN", mt = "AMPERSAND", gt = "APOSTROPHE", At = "ASTERISK", P = "AT", Tt = "BACKSLASH", Lt = "BACKTICK", Rt = "CARET", v = "COLON", Jt = "COMMA", Ct = "DOLLAR", y = "DOT", pt = "EQUALS", Yt = "EXCLAMATION", O = "HYPHEN", Q = "PERCENT", St = "PIPE", Ot = "PLUS", yt = "POUND", $ = "QUERY", Xt = "QUOTE", de = "FULLWIDTHMIDDLEDOT", Vt = "SEMI", k = "SLASH", q = "TILDE", kt = "UNDERSCORE", Ee = "EMOJI", bt = "SYM";
143
+ var fe = /* @__PURE__ */ Object.freeze({
144
+ __proto__: null,
145
+ ALPHANUMERICAL: he,
146
+ AMPERSAND: mt,
147
+ APOSTROPHE: gt,
148
+ ASCIINUMERICAL: ue,
149
+ ASTERISK: At,
150
+ AT: P,
151
+ BACKSLASH: Tt,
152
+ BACKTICK: Lt,
153
+ CARET: Rt,
154
+ CLOSEANGLEBRACKET: rt,
155
+ CLOSEBRACE: G,
156
+ CLOSEBRACKET: nt,
157
+ CLOSEPAREN: it,
158
+ COLON: v,
159
+ COMMA: Jt,
160
+ DOLLAR: Ct,
161
+ DOT: y,
162
+ EMOJI: Ee,
163
+ EQUALS: pt,
164
+ EXCLAMATION: Yt,
165
+ FULLWIDTHGREATERTHAN: ft,
166
+ FULLWIDTHLEFTPAREN: at,
167
+ FULLWIDTHLESSTHAN: Et,
168
+ FULLWIDTHMIDDLEDOT: de,
169
+ FULLWIDTHRIGHTPAREN: ct,
170
+ HYPHEN: O,
171
+ LEFTCORNERBRACKET: lt,
172
+ LEFTWHITECORNERBRACKET: ht,
173
+ LOCALHOST: _,
174
+ NL: _t,
175
+ NUM: qt,
176
+ OPENANGLEBRACKET: ot,
177
+ OPENBRACE: W,
178
+ OPENBRACKET: et,
179
+ OPENPAREN: st,
180
+ PERCENT: Q,
181
+ PIPE: St,
182
+ PLUS: Ot,
183
+ POUND: yt,
184
+ QUERY: $,
185
+ QUOTE: Xt,
186
+ RIGHTCORNERBRACKET: ut,
187
+ RIGHTWHITECORNERBRACKET: dt,
188
+ SCHEME: tt,
189
+ SEMI: Vt,
190
+ SLASH: k,
191
+ SLASH_SCHEME: U,
192
+ SYM: bt,
193
+ TILDE: q,
194
+ TLD: Gt,
195
+ UNDERSCORE: kt,
196
+ UTLD: Qt,
197
+ UWORD: Wt,
198
+ WORD: I,
199
+ WS: $t
200
+ });
201
+ const b = /[a-z]/, B = new RegExp("\\p{L}", "u"), vt = new RegExp("\\p{Emoji}", "u"), N = /\d/, jt = /\s/, ie = "\r", xt = `
202
+ `, be = "️", Ne = "‍", Ut = "";
203
+ let X = null, V = null;
204
+ function Ie(t = []) {
205
+ const n = {};
206
+ p.groups = n;
207
+ const e = new p();
208
+ X == null && (X = oe(Ce)), V == null && (V = oe(pe)), o(e, "'", gt), o(e, "{", W), o(e, "}", G), o(e, "[", et), o(e, "]", nt), o(e, "(", st), o(e, ")", it), o(e, "<", ot), o(e, ">", rt), o(e, "(", at), o(e, ")", ct), o(e, "「", lt), o(e, "」", ut), o(e, "『", ht), o(e, "』", dt), o(e, "<", Et), o(e, ">", ft), o(e, "&", mt), o(e, "*", At), o(e, "@", P), o(e, "`", Lt), o(e, "^", Rt), o(e, ":", v), o(e, ",", Jt), o(e, "$", Ct), o(e, ".", y), o(e, "=", pt), o(e, "!", Yt), o(e, "-", O), o(e, "%", Q), o(e, "|", St), o(e, "+", Ot), o(e, "#", yt), o(e, "?", $), o(e, '"', Xt), o(e, "/", k), o(e, ";", Vt), o(e, "~", q), o(e, "_", kt), o(e, "\\", Tt), o(e, "・", de);
209
+ const s = f(e, N, qt, {
210
+ [zt]: !0
531
211
  });
532
- return c?.steps.forEach((l) => {
533
- const f = l.map(r.mapping);
534
- f && o && r.maybeStep(f);
535
- }), !0;
536
- };
537
- function W(e, t, n = {}) {
538
- const { from: r, to: o, empty: s } = e.selection, i = t ? T(t, e.schema) : null, a = [];
539
- e.doc.nodesBetween(r, o, (d, p) => {
540
- if (d.isText)
541
- return;
542
- const u = Math.max(r, p), m = Math.min(o, p + d.nodeSize);
543
- a.push({
544
- node: d,
545
- from: u,
546
- to: m
547
- });
212
+ f(s, N, s);
213
+ const i = f(s, b, ue, {
214
+ [K]: !0
215
+ }), r = f(s, B, he, {
216
+ [F]: !0
217
+ }), a = f(e, b, I, {
218
+ [Bt]: !0
548
219
  });
549
- const c = o - r, l = a.filter((d) => i ? i.name === d.node.type.name : !0).filter((d) => X(d.node.attrs, n, { strict: !1 }));
550
- return s ? !!l.length : l.reduce((d, p) => d + p.to - p.from, 0) >= c;
551
- }
552
- var Cn = (e, t = {}) => ({ state: n, dispatch: r }) => {
553
- const o = T(e, n.schema);
554
- return W(n, o, t) ? $e(n, r) : !1;
555
- }, Pn = () => ({ state: e, dispatch: t }) => Ne(e, t), $n = (e) => ({ state: t, dispatch: n }) => {
556
- const r = T(e, t.schema);
557
- return Ue(r)(t, n);
558
- }, Nn = () => ({ state: e, dispatch: t }) => Ie(e, t);
559
- function st(e, t) {
560
- return t.nodes[e] ? "node" : t.marks[e] ? "mark" : null;
561
- }
562
- function Pt(e, t) {
563
- const n = typeof t == "string" ? [t] : t;
564
- return Object.keys(e).reduce((r, o) => (n.includes(o) || (r[o] = e[o]), r), {});
565
- }
566
- var In = (e, t) => ({ tr: n, state: r, dispatch: o }) => {
567
- let s = null, i = null;
568
- const a = st(
569
- typeof e == "string" ? e : e.name,
570
- r.schema
571
- );
572
- if (!a)
573
- return !1;
574
- a === "node" && (s = T(e, r.schema)), a === "mark" && (i = R(e, r.schema));
575
- let c = !1;
576
- return n.selection.ranges.forEach((l) => {
577
- r.doc.nodesBetween(l.$from.pos, l.$to.pos, (f, d) => {
578
- s && s === f.type && (c = !0, o && n.setNodeMarkup(d, void 0, Pt(f.attrs, t))), i && f.marks.length && f.marks.forEach((p) => {
579
- i === p.type && (c = !0, o && n.addMark(d, d + f.nodeSize, i.create(Pt(p.attrs, t))));
580
- });
581
- });
582
- }), c;
583
- }, Rn = () => ({ tr: e, dispatch: t }) => (t && e.scrollIntoView(), !0), Bn = () => ({ tr: e, dispatch: t }) => {
584
- if (t) {
585
- const n = new Le(e.doc);
586
- e.setSelection(n);
587
- }
588
- return !0;
589
- }, On = () => ({ state: e, dispatch: t }) => Re(e, t), jn = () => ({ state: e, dispatch: t }) => Be(e, t), Dn = () => ({ state: e, dispatch: t }) => Oe(e, t), _n = () => ({ state: e, dispatch: t }) => je(e, t), zn = () => ({ state: e, dispatch: t }) => De(e, t);
590
- function mt(e, t, n = {}, r = {}) {
591
- return U(e, t, {
592
- slice: !1,
593
- parseOptions: n,
594
- errorOnInvalidContent: r.errorOnInvalidContent
220
+ f(a, N, i), f(a, b, a), f(i, N, i), f(i, b, i);
221
+ const c = f(e, B, Wt, {
222
+ [Ft]: !0
595
223
  });
596
- }
597
- var Ln = (e, { errorOnInvalidContent: t, emitUpdate: n = !0, parseOptions: r = {} } = {}) => ({ editor: o, tr: s, dispatch: i, commands: a }) => {
598
- const { doc: c } = s;
599
- if (r.preserveWhitespace !== "full") {
600
- const l = mt(e, o.schema, r, {
601
- errorOnInvalidContent: t ?? o.options.enableContentCheck
602
- });
603
- return i && s.replaceWith(0, c.content.size, l).setMeta("preventUpdate", !n), !0;
604
- }
605
- return i && s.setMeta("preventUpdate", !n), a.insertContentAt({ from: 0, to: c.content.size }, e, {
606
- parseOptions: r,
607
- errorOnInvalidContent: t ?? o.options.enableContentCheck
224
+ f(c, b), f(c, N, r), f(c, B, c), f(r, N, r), f(r, b), f(r, B, r);
225
+ const d = o(e, xt, _t, {
226
+ [Pt]: !0
227
+ }), m = o(e, ie, $t, {
228
+ [Pt]: !0
229
+ }), E = f(e, jt, $t, {
230
+ [Pt]: !0
608
231
  });
609
- };
610
- function Wt(e, t) {
611
- const n = R(t, e.schema), { from: r, to: o, empty: s } = e.selection, i = [];
612
- s ? (e.storedMarks && i.push(...e.storedMarks), i.push(...e.selection.$head.marks())) : e.doc.nodesBetween(r, o, (c) => {
613
- i.push(...c.marks);
232
+ o(e, Ut, E), o(m, xt, d), o(m, Ut, E), f(m, jt, E), o(E, ie), o(E, xt), f(E, jt, E), o(E, Ut, E);
233
+ const u = f(e, vt, Ee, {
234
+ [le]: !0
614
235
  });
615
- const a = i.find((c) => c.type.name === n.name);
616
- return a ? { ...a.attrs } : {};
617
- }
618
- function Fn(e, t) {
619
- const n = new ge(e);
620
- return t.forEach((r) => {
621
- r.steps.forEach((o) => {
622
- n.step(o);
623
- });
624
- }), n;
625
- }
626
- function Vn(e) {
627
- for (let t = 0; t < e.edgeCount; t += 1) {
628
- const { type: n } = e.edge(t);
629
- if (n.isTextblock && !n.hasRequiredAttrs())
630
- return n;
631
- }
632
- return null;
633
- }
634
- function oo(e, t, n) {
635
- const r = [];
636
- return e.nodesBetween(t.from, t.to, (o, s) => {
637
- n(o) && r.push({
638
- node: o,
639
- pos: s
640
- });
641
- }), r;
642
- }
643
- function Hn(e, t) {
644
- for (let n = e.depth; n > 0; n -= 1) {
645
- const r = e.node(n);
646
- if (t(r))
647
- return {
648
- pos: n > 0 ? e.before(n) : 0,
649
- start: e.start(n),
650
- depth: n,
651
- node: r
652
- };
653
- }
654
- }
655
- function it(e) {
656
- return (t) => Hn(t.$from, e);
657
- }
658
- function b(e, t, n) {
659
- return e.config[t] === void 0 && e.parent ? b(e.parent, t, n) : typeof e.config[t] == "function" ? e.config[t].bind({
660
- ...n,
661
- parent: e.parent ? b(e.parent, t, n) : null
662
- }) : e.config[t];
663
- }
664
- function kt(e) {
665
- return e.map((t) => {
666
- const n = {
667
- name: t.name,
668
- options: t.options,
669
- storage: t.storage
670
- }, r = b(t, "addExtensions", n);
671
- return r ? [t, ...kt(r())] : t;
672
- }).flat(10);
673
- }
674
- function wt(e, t) {
675
- const n = Fe.fromSchema(t).serializeFragment(e), o = document.implementation.createHTMLDocument().createElement("div");
676
- return o.appendChild(n), o.innerHTML;
677
- }
678
- function qt(e) {
679
- return typeof e == "function";
680
- }
681
- function x(e, t = void 0, ...n) {
682
- return qt(e) ? t ? e.bind(t)(...n) : e(...n) : e;
683
- }
684
- function Un(e = {}) {
685
- return Object.keys(e).length === 0 && e.constructor === Object;
686
- }
687
- function L(e) {
688
- const t = e.filter((o) => o.type === "extension"), n = e.filter((o) => o.type === "node"), r = e.filter((o) => o.type === "mark");
689
- return {
690
- baseExtensions: t,
691
- nodeExtensions: n,
692
- markExtensions: r
693
- };
694
- }
695
- function Kt(e) {
696
- const t = [], { nodeExtensions: n, markExtensions: r } = L(e), o = [...n, ...r], s = {
697
- default: null,
698
- validate: void 0,
699
- rendered: !0,
700
- renderHTML: null,
701
- parseHTML: null,
702
- keepOnSplit: !0,
703
- isRequired: !1
704
- }, i = n.filter((l) => l.name !== "text").map((l) => l.name), a = r.map((l) => l.name), c = [...i, ...a];
705
- return e.forEach((l) => {
706
- const f = {
707
- name: l.name,
708
- options: l.options,
709
- storage: l.storage,
710
- extensions: o
711
- }, d = b(
712
- l,
713
- "addGlobalAttributes",
714
- f
715
- );
716
- if (!d)
717
- return;
718
- d().forEach((u) => {
719
- let m;
720
- Array.isArray(u.types) ? m = u.types : u.types === "*" ? m = c : u.types === "nodes" ? m = i : u.types === "marks" ? m = a : m = [], m.forEach((h) => {
721
- Object.entries(u.attributes).forEach(([g, v]) => {
722
- t.push({
723
- type: h,
724
- name: g,
725
- attribute: {
726
- ...s,
727
- ...v
728
- }
729
- });
730
- });
731
- });
732
- });
733
- }), o.forEach((l) => {
734
- const f = {
735
- name: l.name,
736
- options: l.options,
737
- storage: l.storage
738
- }, d = b(
739
- l,
740
- "addAttributes",
741
- f
742
- );
743
- if (!d)
744
- return;
745
- const p = d();
746
- Object.entries(p).forEach(([u, m]) => {
747
- const h = {
748
- ...s,
749
- ...m
750
- };
751
- typeof h?.default == "function" && (h.default = h.default()), h?.isRequired && h?.default === void 0 && delete h.default, t.push({
752
- type: l.name,
753
- name: u,
754
- attribute: h
755
- });
756
- });
757
- }), t;
758
- }
759
- function Wn(e) {
760
- const t = [];
761
- let n = "", r = !1, o = !1, s = 0;
762
- const i = e.length;
763
- for (let a = 0; a < i; a += 1) {
764
- const c = e[a];
765
- if (c === "'" && !o) {
766
- r = !r, n += c;
767
- continue;
768
- }
769
- if (c === '"' && !r) {
770
- o = !o, n += c;
771
- continue;
772
- }
773
- if (!r && !o) {
774
- if (c === "(") {
775
- s += 1, n += c;
776
- continue;
777
- }
778
- if (c === ")" && s > 0) {
779
- s -= 1, n += c;
780
- continue;
781
- }
782
- if (c === ";" && s === 0) {
783
- t.push(n), n = "";
784
- continue;
785
- }
786
- }
787
- n += c;
788
- }
789
- return n && t.push(n), t;
790
- }
791
- function $t(e) {
792
- const t = [], n = Wn(e || ""), r = n.length;
793
- for (let o = 0; o < r; o += 1) {
794
- const s = n[o], i = s.indexOf(":");
795
- if (i === -1)
796
- continue;
797
- const a = s.slice(0, i).trim(), c = s.slice(i + 1).trim();
798
- a && c && t.push([a, c]);
799
- }
800
- return t;
801
- }
802
- function qn(...e) {
803
- return e.filter((t) => !!t).reduce((t, n) => {
804
- const r = { ...t };
805
- return Object.entries(n).forEach(([o, s]) => {
806
- if (!r[o]) {
807
- r[o] = s;
808
- return;
809
- }
810
- if (o === "class") {
811
- const a = s ? String(s).split(" ") : [], c = r[o] ? r[o].split(" ") : [], l = a.filter((f) => !c.includes(f));
812
- r[o] = [...c, ...l].join(" ");
813
- } else if (o === "style") {
814
- const a = new Map([...$t(r[o]), ...$t(s)]);
815
- r[o] = Array.from(a.entries()).map(([c, l]) => `${c}: ${l}`).join("; ");
816
- } else
817
- r[o] = s;
818
- }), r;
819
- }, {});
820
- }
821
- function et(e, t) {
822
- return t.filter((n) => n.type === e.type.name).filter((n) => n.attribute.rendered).map((n) => n.attribute.renderHTML ? n.attribute.renderHTML(e.attrs) || {} : {
823
- [n.name]: e.attrs[n.name]
824
- }).reduce((n, r) => qn(n, r), {});
825
- }
826
- function Kn(e) {
827
- return typeof e != "string" ? e : e.match(/^[+-]?(?:\d*\.)?\d+$/) ? Number(e) : e === "true" ? !0 : e === "false" ? !1 : e;
828
- }
829
- function Nt(e, t) {
830
- return "style" in e ? e : {
831
- ...e,
832
- getAttrs: (n) => {
833
- const r = e.getAttrs ? e.getAttrs(n) : e.attrs;
834
- if (r === !1)
835
- return !1;
836
- const o = t.reduce((s, i) => {
837
- const a = i.attribute.parseHTML ? i.attribute.parseHTML(n) : Kn(n.getAttribute(i.name));
838
- return a == null ? s : {
839
- ...s,
840
- [i.name]: a
841
- };
842
- }, {});
843
- return { ...r, ...o };
844
- }
845
- };
846
- }
847
- function It(e) {
848
- return Object.fromEntries(
849
- // @ts-ignore
850
- Object.entries(e).filter(([t, n]) => t === "attrs" && Un(n) ? !1 : n != null)
851
- );
852
- }
853
- function Rt(e) {
854
- var t, n;
855
- const r = {};
856
- return !((t = e?.attribute) != null && t.isRequired) && "default" in (e?.attribute || {}) && (r.default = e.attribute.default), ((n = e?.attribute) == null ? void 0 : n.validate) !== void 0 && (r.validate = e.attribute.validate), [e.name, r];
857
- }
858
- function Jn(e, t) {
859
- var n;
860
- const r = Kt(e), { nodeExtensions: o, markExtensions: s } = L(e), i = (n = o.find((l) => b(l, "topNode"))) == null ? void 0 : n.name, a = Object.fromEntries(
861
- o.map((l) => {
862
- const f = r.filter((v) => v.type === l.name), d = {
863
- name: l.name,
864
- options: l.options,
865
- storage: l.storage,
866
- editor: t
867
- }, p = e.reduce((v, y) => {
868
- const w = b(y, "extendNodeSchema", d);
869
- return {
870
- ...v,
871
- ...w ? w(l) : {}
872
- };
873
- }, {}), u = It({
874
- ...p,
875
- content: x(b(l, "content", d)),
876
- marks: x(b(l, "marks", d)),
877
- group: x(b(l, "group", d)),
878
- inline: x(b(l, "inline", d)),
879
- atom: x(b(l, "atom", d)),
880
- selectable: x(b(l, "selectable", d)),
881
- draggable: x(b(l, "draggable", d)),
882
- code: x(b(l, "code", d)),
883
- whitespace: x(b(l, "whitespace", d)),
884
- linebreakReplacement: x(
885
- b(l, "linebreakReplacement", d)
886
- ),
887
- defining: x(b(l, "defining", d)),
888
- isolating: x(b(l, "isolating", d)),
889
- attrs: Object.fromEntries(f.map(Rt))
890
- }), m = x(b(l, "parseHTML", d));
891
- m && (u.parseDOM = m.map(
892
- (v) => Nt(v, f)
893
- ));
894
- const h = b(l, "renderHTML", d);
895
- h && (u.toDOM = (v) => h({
896
- node: v,
897
- HTMLAttributes: et(v, f)
898
- }));
899
- const g = b(l, "renderText", d);
900
- return g && (u.toText = g), [l.name, u];
901
- })
902
- ), c = Object.fromEntries(
903
- s.map((l) => {
904
- const f = r.filter((g) => g.type === l.name), d = {
905
- name: l.name,
906
- options: l.options,
907
- storage: l.storage,
908
- editor: t
909
- }, p = e.reduce((g, v) => {
910
- const y = b(v, "extendMarkSchema", d);
911
- return {
912
- ...g,
913
- ...y ? y(l) : {}
914
- };
915
- }, {}), u = It({
916
- ...p,
917
- inclusive: x(b(l, "inclusive", d)),
918
- excludes: x(b(l, "excludes", d)),
919
- group: x(b(l, "group", d)),
920
- spanning: x(b(l, "spanning", d)),
921
- code: x(b(l, "code", d)),
922
- attrs: Object.fromEntries(f.map(Rt))
923
- }), m = x(b(l, "parseHTML", d));
924
- m && (u.parseDOM = m.map(
925
- (g) => Nt(g, f)
926
- ));
927
- const h = b(l, "renderHTML", d);
928
- return h && (u.toDOM = (g) => h({
929
- mark: g,
930
- HTMLAttributes: et(g, f)
931
- })), [l.name, u];
932
- })
933
- );
934
- return new _t({
935
- topNode: i,
936
- nodes: a,
937
- marks: c
938
- });
939
- }
940
- function Qn(e) {
941
- const t = e.filter((n, r) => e.indexOf(n) !== r);
942
- return Array.from(new Set(t));
943
- }
944
- function H(e) {
945
- return e.sort((n, r) => {
946
- const o = b(n, "priority") || 100, s = b(r, "priority") || 100;
947
- return o > s ? -1 : o < s ? 1 : 0;
948
- });
949
- }
950
- function Jt(e) {
951
- const t = H(kt(e)), n = Qn(t.map((r) => r.name));
952
- return n.length && console.warn(
953
- `[tiptap warn]: Duplicate extension names found: [${n.map((r) => `'${r}'`).join(", ")}]. This can lead to issues.`
954
- ), t;
955
- }
956
- function Qt(e, t, n) {
957
- const { from: r, to: o } = t, { blockSeparator: s = `
958
-
959
- `, textSerializers: i = {} } = n || {};
960
- let a = "";
961
- return e.nodesBetween(r, o, (c, l, f, d) => {
962
- var p;
963
- c.isBlock && l > r && (a += s);
964
- const u = i?.[c.type.name];
965
- if (u)
966
- return f && (a += u({
967
- node: c,
968
- pos: l,
969
- parent: f,
970
- index: d,
971
- range: t
972
- })), !1;
973
- c.isText && (a += (p = c?.text) == null ? void 0 : p.slice(Math.max(r, l) - l, o - l));
974
- }), a;
975
- }
976
- function Zn(e, t) {
977
- const n = {
978
- from: 0,
979
- to: e.content.size
980
- };
981
- return Qt(e, n, t);
982
- }
983
- function Zt(e) {
984
- return Object.fromEntries(
985
- Object.entries(e.nodes).filter(([, t]) => t.spec.toText).map(([t, n]) => [t, n.spec.toText])
986
- );
987
- }
988
- function Gn(e, t) {
989
- const n = T(t, e.schema), { from: r, to: o } = e.selection, s = [];
990
- e.doc.nodesBetween(r, o, (a) => {
991
- s.push(a);
992
- });
993
- const i = s.reverse().find((a) => a.type.name === n.name);
994
- return i ? { ...i.attrs } : {};
995
- }
996
- function Yn(e, t) {
997
- const n = st(
998
- typeof t == "string" ? t : t.name,
999
- e.schema
1000
- );
1001
- return n === "node" ? Gn(e, t) : n === "mark" ? Wt(e, t) : {};
1002
- }
1003
- function Xn(e, t = JSON.stringify) {
1004
- const n = {};
1005
- return e.filter((r) => {
1006
- const o = t(r);
1007
- return Object.prototype.hasOwnProperty.call(n, o) ? !1 : n[o] = !0;
1008
- });
1009
- }
1010
- function tr(e) {
1011
- const t = Xn(e);
1012
- return t.length === 1 ? t : t.filter((n, r) => !t.filter((s, i) => i !== r).some((s) => n.oldRange.from >= s.oldRange.from && n.oldRange.to <= s.oldRange.to && n.newRange.from >= s.newRange.from && n.newRange.to <= s.newRange.to));
1013
- }
1014
- function er(e) {
1015
- const { mapping: t, steps: n } = e, r = [];
1016
- return t.maps.forEach((o, s) => {
1017
- const i = [];
1018
- if (o.ranges.length)
1019
- o.forEach((a, c) => {
1020
- i.push({ from: a, to: c });
1021
- });
1022
- else {
1023
- const { from: a, to: c } = n[s];
1024
- if (a === void 0 || c === void 0)
1025
- return;
1026
- i.push({ from: a, to: c });
1027
- }
1028
- i.forEach(({ from: a, to: c }) => {
1029
- const l = t.slice(s).map(a, -1), f = t.slice(s).map(c), d = t.invert().map(l, -1), p = t.invert().map(f);
1030
- r.push({
1031
- oldRange: {
1032
- from: d,
1033
- to: p
1034
- },
1035
- newRange: {
1036
- from: l,
1037
- to: f
1038
- }
1039
- });
1040
- });
1041
- }), tr(r);
1042
- }
1043
- function Gt(e, t, n) {
1044
- const r = [];
1045
- return e === t ? n.resolve(e).marks().forEach((o) => {
1046
- const s = n.resolve(e), i = yt(s, o.type);
1047
- i && r.push({
1048
- mark: o,
1049
- ...i
1050
- });
1051
- }) : n.nodesBetween(e, t, (o, s) => {
1052
- !o || o?.nodeSize === void 0 || r.push(
1053
- ...o.marks.map((i) => ({
1054
- from: s,
1055
- to: s + o.nodeSize,
1056
- mark: i
1057
- }))
1058
- );
1059
- }), r;
1060
- }
1061
- var so = (e, t, n, r = 20) => {
1062
- const o = e.doc.resolve(n);
1063
- let s = r, i = null;
1064
- for (; s > 0 && i === null; ) {
1065
- const a = o.node(s);
1066
- a?.type.name === t ? i = a : s -= 1;
1067
- }
1068
- return [i, s];
1069
- };
1070
- function F(e, t) {
1071
- return t.nodes[e] || t.marks[e] || null;
1072
- }
1073
- function Y(e, t, n) {
1074
- return Object.fromEntries(
1075
- Object.entries(n).filter(([r]) => {
1076
- const o = e.find((s) => s.type === t && s.name === r);
1077
- return o ? o.attribute.keepOnSplit : !1;
1078
- })
1079
- );
1080
- }
1081
- var nr = (e, t = 500) => {
1082
- let n = "";
1083
- const r = e.parentOffset;
1084
- return e.parent.nodesBetween(Math.max(0, r - t), r, (o, s, i, a) => {
1085
- var c, l;
1086
- const f = ((l = (c = o.type.spec).toText) == null ? void 0 : l.call(c, {
1087
- node: o,
1088
- pos: s,
1089
- parent: i,
1090
- index: a
1091
- })) || o.textContent || "%leaf%";
1092
- n += o.isAtom && !o.isText ? f : f.slice(0, Math.max(0, r - s));
1093
- }), n;
1094
- };
1095
- function ht(e, t, n = {}) {
1096
- const { empty: r, ranges: o } = e.selection, s = t ? R(t, e.schema) : null;
1097
- if (r)
1098
- return !!(e.storedMarks || e.selection.$from.marks()).filter((d) => s ? s.name === d.type.name : !0).find((d) => X(d.attrs, n, { strict: !1 }));
1099
- let i = 0;
1100
- const a = [];
1101
- if (o.forEach(({ $from: d, $to: p }) => {
1102
- const u = d.pos, m = p.pos;
1103
- e.doc.nodesBetween(u, m, (h, g) => {
1104
- if (s && h.inlineContent && !h.type.allowsMarkType(s))
1105
- return !1;
1106
- if (!h.isText && !h.marks.length)
1107
- return;
1108
- const v = Math.max(u, g), y = Math.min(m, g + h.nodeSize), w = y - v;
1109
- i += w, a.push(
1110
- ...h.marks.map((M) => ({
1111
- mark: M,
1112
- from: v,
1113
- to: y
1114
- }))
1115
- );
1116
- });
1117
- }), i === 0)
1118
- return !1;
1119
- const c = a.filter((d) => s ? s.name === d.mark.type.name : !0).filter((d) => X(d.mark.attrs, n, { strict: !1 })).reduce((d, p) => d + p.to - p.from, 0), l = a.filter((d) => s ? d.mark.type !== s && d.mark.type.excludes(s) : !0).reduce((d, p) => d + p.to - p.from, 0);
1120
- return (c > 0 ? c + l : c) >= i;
1121
- }
1122
- function rr(e, t, n = {}) {
1123
- if (!t)
1124
- return W(e, null, n) || ht(e, null, n);
1125
- const r = st(t, e.schema);
1126
- return r === "node" ? W(e, t, n) : r === "mark" ? ht(e, t, n) : !1;
1127
- }
1128
- var io = (e, t) => {
1129
- const { $from: n, $to: r, $anchor: o } = e.selection;
1130
- if (t) {
1131
- const s = it((a) => a.type.name === t)(e.selection);
1132
- if (!s)
1133
- return !1;
1134
- const i = e.doc.resolve(s.pos + 1);
1135
- return o.pos + 1 === i.end();
1136
- }
1137
- return !(r.parentOffset < r.parent.nodeSize - 2 || n.pos !== r.pos);
1138
- }, ao = (e) => {
1139
- const { $from: t, $to: n } = e.selection;
1140
- return !(t.parentOffset > 0 || t.pos !== n.pos);
1141
- };
1142
- function Bt(e, t) {
1143
- return Array.isArray(t) ? t.some((n) => (typeof n == "string" ? n : n.name) === e.name) : t;
1144
- }
1145
- function Ot(e, t) {
1146
- const { nodeExtensions: n } = L(t), r = n.find((i) => i.name === e);
1147
- if (!r)
1148
- return !1;
1149
- const o = {
1150
- name: r.name,
1151
- options: r.options,
1152
- storage: r.storage
1153
- }, s = x(b(r, "group", o));
1154
- return typeof s != "string" ? !1 : s.split(" ").includes("list");
1155
- }
1156
- function Mt(e, {
1157
- checkChildren: t = !0,
1158
- ignoreWhitespace: n = !1
1159
- } = {}) {
1160
- var r;
1161
- if (n) {
1162
- if (e.type.name === "hardBreak")
1163
- return !0;
1164
- if (e.isText)
1165
- return !/\S/.test((r = e.text) != null ? r : "");
1166
- }
1167
- if (e.isText)
1168
- return !e.text;
1169
- if (e.isAtom || e.isLeaf)
1170
- return !1;
1171
- if (e.content.childCount === 0)
1172
- return !0;
1173
- if (t) {
1174
- let o = !0;
1175
- return e.content.forEach((s) => {
1176
- o !== !1 && (Mt(s, { ignoreWhitespace: n, checkChildren: t }) || (o = !1));
1177
- }), o;
1178
- }
1179
- return !1;
1180
- }
1181
- function co(e) {
1182
- return e instanceof nt;
1183
- }
1184
- var Yt = class Xt {
1185
- constructor(t) {
1186
- this.position = t;
1187
- }
1188
- /**
1189
- * Creates a MappablePosition from a JSON object.
1190
- */
1191
- static fromJSON(t) {
1192
- return new Xt(t.position);
1193
- }
1194
- /**
1195
- * Converts the MappablePosition to a JSON object.
1196
- */
1197
- toJSON() {
1198
- return {
1199
- position: this.position
236
+ o(u, "#"), f(u, vt, u), o(u, be, u);
237
+ const g = o(u, Ne);
238
+ o(g, "#"), f(g, vt, u);
239
+ const A = [[b, a], [N, i]], H = [[b, null], [B, c], [N, r]];
240
+ for (let T = 0; T < X.length; T++)
241
+ D(e, X[T], Gt, I, A);
242
+ for (let T = 0; T < V.length; T++)
243
+ D(e, V[T], Qt, Wt, H);
244
+ j(Gt, {
245
+ tld: !0,
246
+ ascii: !0
247
+ }, n), j(Qt, {
248
+ utld: !0,
249
+ alpha: !0
250
+ }, n), D(e, "file", tt, I, A), D(e, "mailto", tt, I, A), D(e, "http", U, I, A), D(e, "https", U, I, A), D(e, "ftp", U, I, A), D(e, "ftps", U, I, A), j(tt, {
251
+ scheme: !0,
252
+ ascii: !0
253
+ }, n), j(U, {
254
+ slashscheme: !0,
255
+ ascii: !0
256
+ }, n), t = t.sort((T, C) => T[0] > C[0] ? 1 : -1);
257
+ for (let T = 0; T < t.length; T++) {
258
+ const C = t[T][0], L = t[T][1] ? {
259
+ [Se]: !0
260
+ } : {
261
+ [Oe]: !0
1200
262
  };
1201
- }
1202
- };
1203
- function or(e, t) {
1204
- const n = t.mapping.mapResult(e.position);
1205
- return {
1206
- position: new Yt(n.pos),
1207
- mapResult: n
263
+ C.indexOf("-") >= 0 ? L[Kt] = !0 : b.test(C) ? N.test(C) ? L[K] = !0 : L[Bt] = !0 : L[zt] = !0, se(e, C, C, L);
264
+ }
265
+ return se(e, "localhost", _, {
266
+ ascii: !0
267
+ }), e.jd = new p(bt), {
268
+ start: e,
269
+ tokens: Object.assign({
270
+ groups: n
271
+ }, fe)
1208
272
  };
1209
273
  }
1210
- function sr(e) {
1211
- return new Yt(e);
1212
- }
1213
- function ir(e, t, n) {
1214
- var r;
1215
- const { selection: o } = t;
1216
- let s = null;
1217
- if (Ft(o) && (s = o.$cursor), s) {
1218
- const a = (r = e.storedMarks) != null ? r : s.marks();
1219
- return s.parent.type.allowsMarkType(n) && (!!n.isInSet(a) || !a.some((l) => l.type.excludes(n)));
1220
- }
1221
- const { ranges: i } = o;
1222
- return i.some(({ $from: a, $to: c }) => {
1223
- let l = a.depth === 0 ? e.doc.inlineContent && e.doc.type.allowsMarkType(n) : !1;
1224
- return e.doc.nodesBetween(a.pos, c.pos, (f, d, p) => {
1225
- if (l)
1226
- return !1;
1227
- if (f.isInline) {
1228
- const u = !p || p.type.allowsMarkType(n), m = !!n.isInSet(f.marks) || !f.marks.some((h) => h.type.excludes(n));
1229
- l = u && m;
1230
- }
1231
- return !l;
1232
- }), l;
1233
- });
1234
- }
1235
- var ar = (e, t = {}) => ({ tr: n, state: r, dispatch: o }) => {
1236
- const { selection: s } = n, { empty: i, ranges: a } = s, c = R(e, r.schema);
1237
- if (o)
1238
- if (i) {
1239
- const l = Wt(r, c);
1240
- n.addStoredMark(
1241
- c.create({
1242
- ...l,
1243
- ...t
1244
- })
1245
- );
1246
- } else
1247
- a.forEach((l) => {
1248
- const f = l.$from.pos, d = l.$to.pos;
1249
- r.doc.nodesBetween(f, d, (p, u) => {
1250
- const m = Math.max(u, f), h = Math.min(u + p.nodeSize, d);
1251
- p.marks.find((v) => v.type === c) ? p.marks.forEach((v) => {
1252
- c === v.type && n.addMark(
1253
- m,
1254
- h,
1255
- c.create({
1256
- ...v.attrs,
1257
- ...t
1258
- })
1259
- );
1260
- }) : n.addMark(m, h, c.create(t));
1261
- });
1262
- });
1263
- return ir(r, n, c);
1264
- }, cr = (e, t) => ({ tr: n }) => (n.setMeta(e, t), !0), lr = (e, t = {}) => ({ state: n, dispatch: r, chain: o }) => {
1265
- const s = T(e, n.schema);
1266
- let i;
1267
- return n.selection.$anchor.sameParent(n.selection.$head) && (i = n.selection.$anchor.parent.attrs), s.isTextblock ? o().command(({ commands: a }) => Tt(s, { ...i, ...t })(n) ? !0 : a.clearNodes()).command(({ state: a }) => Tt(s, { ...i, ...t })(a, r)).run() : (console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'), !1);
1268
- }, dr = (e) => ({ tr: t, dispatch: n }) => {
1269
- if (n) {
1270
- const { doc: r } = t, o = _(e, 0, r.content.size), s = nt.create(r, o);
1271
- t.setSelection(s);
1272
- }
1273
- return !0;
1274
- }, ur = (e, t) => ({ tr: n, state: r, dispatch: o }) => {
1275
- const { selection: s } = r;
1276
- let i, a;
1277
- return typeof t == "number" ? (i = t, a = t) : t && "from" in t && "to" in t ? (i = t.from, a = t.to) : (i = s.from, a = s.to), o && n.doc.nodesBetween(i, a, (c, l) => {
1278
- c.isText || n.setNodeMarkup(l, void 0, {
1279
- ...c.attrs,
1280
- dir: e
1281
- });
1282
- }), !0;
1283
- }, fr = (e) => ({ tr: t, dispatch: n }) => {
1284
- if (n) {
1285
- const { doc: r } = t, { from: o, to: s } = typeof e == "number" ? { from: e, to: e } : e, i = P.atStart(r).from, a = P.atEnd(r).to, c = _(o, i, a), l = _(s, i, a), f = P.create(r, c, l);
1286
- t.setSelection(f);
1287
- }
1288
- return !0;
1289
- }, pr = (e) => ({ state: t, dispatch: n }) => {
1290
- const r = T(e, t.schema);
1291
- return We(r)(t, n);
1292
- };
1293
- function jt(e, t) {
1294
- const n = e.storedMarks || e.selection.$to.parentOffset && e.selection.$from.marks();
1295
- if (n) {
1296
- const r = n.filter((o) => t?.includes(o.type.name));
1297
- e.tr.ensureMarks(r);
1298
- }
1299
- }
1300
- var mr = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, editor: o }) => {
1301
- const { selection: s, doc: i } = t, { $from: a, $to: c } = s, l = o.extensionManager.attributes, f = Y(l, a.node().type.name, a.node().attrs);
1302
- if (s instanceof nt && s.node.isBlock)
1303
- return !a.parentOffset || !G(i, a.pos) ? !1 : (r && (e && jt(n, o.extensionManager.splittableMarks), t.split(a.pos).scrollIntoView()), !0);
1304
- if (!a.parent.isBlock)
1305
- return !1;
1306
- const d = c.parentOffset === c.parent.content.size, p = a.depth === 0 ? void 0 : Vn(a.node(-1).contentMatchAt(a.indexAfter(-1)));
1307
- let u = d && p ? [
1308
- {
1309
- type: p,
1310
- attrs: f
1311
- }
1312
- ] : void 0, m = G(t.doc, t.mapping.map(a.pos), 1, u);
1313
- if (!u && !m && G(t.doc, t.mapping.map(a.pos), 1, p ? [{ type: p }] : void 0) && (m = !0, u = p ? [
1314
- {
1315
- type: p,
1316
- attrs: f
1317
- }
1318
- ] : void 0), r) {
1319
- if (m && (s instanceof P && t.deleteSelection(), t.split(t.mapping.map(a.pos), 1, u), p && !d && !a.parentOffset && a.parent.type !== p)) {
1320
- const h = t.mapping.map(a.before()), g = t.doc.resolve(h);
1321
- a.node(-1).canReplaceWith(g.index(), g.index() + 1, p) && t.setNodeMarkup(t.mapping.map(a.before()), p);
1322
- }
1323
- e && jt(n, o.extensionManager.splittableMarks), t.scrollIntoView();
1324
- }
1325
- return m;
1326
- }, hr = (e, t = {}) => ({ tr: n, state: r, dispatch: o, editor: s }) => {
1327
- var i;
1328
- const a = T(e, r.schema), { $from: c, $to: l } = r.selection, f = r.selection.node;
1329
- if (f && f.isBlock || c.depth < 2 || !c.sameParent(l))
1330
- return !1;
1331
- const d = c.node(-1);
1332
- if (d.type !== a)
1333
- return !1;
1334
- const p = s.extensionManager.attributes;
1335
- if (c.parent.content.size === 0 && c.node(-1).childCount === c.indexAfter(-1)) {
1336
- if (c.depth === 2 || c.node(-3).type !== a || c.index(-2) !== c.node(-2).childCount - 1)
1337
- return !1;
1338
- if (o) {
1339
- let v = O.empty;
1340
- const y = c.index(-1) ? 1 : c.index(-2) ? 2 : 3;
1341
- for (let A = c.depth - y; A >= c.depth - 3; A -= 1)
1342
- v = O.from(c.node(A).copy(v));
1343
- const w = (
1344
- // eslint-disable-next-line no-nested-ternary
1345
- c.indexAfter(-1) < c.node(-2).childCount ? 1 : c.indexAfter(-2) < c.node(-3).childCount ? 2 : 3
1346
- ), M = {
1347
- ...Y(p, c.node().type.name, c.node().attrs),
1348
- ...t
1349
- }, k = ((i = a.contentMatch.defaultType) == null ? void 0 : i.createAndFill(M)) || void 0;
1350
- v = v.append(O.from(a.createAndFill(null, k) || void 0));
1351
- const S = c.before(c.depth - (y - 1));
1352
- n.replace(S, c.after(-w), new He(v, 4 - y, 0));
1353
- let E = -1;
1354
- n.doc.nodesBetween(S, n.doc.content.size, (A, C) => {
1355
- if (E > -1)
1356
- return !1;
1357
- A.isTextblock && A.content.size === 0 && (E = C + 1);
1358
- }), E > -1 && n.setSelection(P.near(n.doc.resolve(E))), n.scrollIntoView();
1359
- }
1360
- return !0;
1361
- }
1362
- const u = l.pos === c.end() ? d.contentMatchAt(0).defaultType : null, m = {
1363
- ...Y(p, d.type.name, d.attrs),
1364
- ...t
1365
- }, h = {
1366
- ...Y(p, c.node().type.name, c.node().attrs),
1367
- ...t
1368
- };
1369
- n.delete(c.pos, l.pos);
1370
- const g = u ? [
1371
- { type: a, attrs: m },
1372
- { type: u, attrs: h }
1373
- ] : [{ type: a, attrs: m }];
1374
- if (!G(n.doc, c.pos, 2))
1375
- return !1;
1376
- if (o) {
1377
- const { selection: v, storedMarks: y } = r, { splittableMarks: w } = s.extensionManager, M = y || v.$to.parentOffset && v.$from.marks();
1378
- if (n.split(c.pos, 2, g).scrollIntoView(), !M || !o)
1379
- return !0;
1380
- const k = M.filter((S) => w.includes(S.type.name));
1381
- n.ensureMarks(k);
1382
- }
1383
- return !0;
1384
- }, ft = (e, t) => {
1385
- const n = it((i) => i.type === t)(e.selection);
1386
- if (!n)
1387
- return !0;
1388
- const r = e.doc.resolve(Math.max(0, n.pos - 1)).before(n.depth);
1389
- if (r === void 0)
1390
- return !0;
1391
- const o = e.doc.nodeAt(r);
1392
- return n.node.type === o?.type && gt(e.doc, n.pos) && e.join(n.pos), !0;
1393
- }, pt = (e, t) => {
1394
- const n = it((i) => i.type === t)(e.selection);
1395
- if (!n)
1396
- return !0;
1397
- const r = e.doc.resolve(n.start).after(n.depth);
1398
- if (r === void 0)
1399
- return !0;
1400
- const o = e.doc.nodeAt(r);
1401
- return n.node.type === o?.type && gt(e.doc, r) && e.join(r), !0;
1402
- }, gr = (e, t, n, r = {}) => ({ editor: o, tr: s, state: i, dispatch: a, chain: c, commands: l, can: f }) => {
1403
- const { extensions: d, splittableMarks: p } = o.extensionManager, u = T(e, i.schema), m = T(t, i.schema), { selection: h, storedMarks: g } = i, { $from: v, $to: y } = h, w = v.blockRange(y), M = g || h.$to.parentOffset && h.$from.marks();
1404
- if (!w)
1405
- return !1;
1406
- const k = it((S) => Ot(S.type.name, d))(h);
1407
- if (w.depth >= 1 && k && w.depth - k.depth <= 1) {
1408
- if (k.node.type === u)
1409
- return l.liftListItem(m);
1410
- if (Ot(k.node.type.name, d) && u.validContent(k.node.content) && a)
1411
- return c().command(() => (s.setNodeMarkup(k.pos, u), !0)).command(() => ft(s, u)).command(() => pt(s, u)).run();
1412
- }
1413
- return !n || !M || !a ? c().command(() => f().wrapInList(u, r) ? !0 : l.clearNodes()).wrapInList(u, r).command(() => ft(s, u)).command(() => pt(s, u)).run() : c().command(() => {
1414
- const S = f().wrapInList(u, r), E = M.filter((A) => p.includes(A.type.name));
1415
- return s.ensureMarks(E), S ? !0 : l.clearNodes();
1416
- }).wrapInList(u, r).command(() => ft(s, u)).command(() => pt(s, u)).run();
1417
- }, vr = (e, t = {}, n = {}) => ({ state: r, commands: o }) => {
1418
- const { extendEmptyMarkRange: s = !1 } = n, i = R(e, r.schema);
1419
- return ht(r, i, t) ? o.unsetMark(i, { extendEmptyMarkRange: s }) : o.setMark(i, t);
1420
- }, br = (e, t, n = {}) => ({ state: r, commands: o }) => {
1421
- const s = T(e, r.schema), i = T(t, r.schema), a = W(r, s, n);
1422
- let c;
1423
- return r.selection.$anchor.sameParent(r.selection.$head) && (c = r.selection.$anchor.parent.attrs), a ? o.setNode(i, c) : o.setNode(s, { ...c, ...n });
1424
- }, yr = (e, t = {}) => ({ state: n, commands: r }) => {
1425
- const o = T(e, n.schema);
1426
- return W(n, o, t) ? r.lift(o) : r.wrapIn(o, t);
1427
- }, kr = () => ({ state: e, dispatch: t }) => {
1428
- const n = e.plugins;
1429
- for (let r = 0; r < n.length; r += 1) {
1430
- const o = n[r];
1431
- let s;
1432
- if (o.spec.isInputRules && (s = o.getState(e))) {
1433
- if (t) {
1434
- const i = e.tr, a = s.transform;
1435
- for (let c = a.steps.length - 1; c >= 0; c -= 1)
1436
- i.step(a.steps[c].invert(a.docs[c]));
1437
- if (s.text) {
1438
- const c = i.doc.resolve(s.from).marks();
1439
- i.replaceWith(s.from, s.to, e.schema.text(s.text, c));
1440
- } else
1441
- i.delete(s.from, s.to);
1442
- }
1443
- return !0;
1444
- }
1445
- }
1446
- return !1;
1447
- }, wr = () => ({ tr: e, dispatch: t }) => {
1448
- const { selection: n } = e, { empty: r, ranges: o } = n;
1449
- return r || t && o.forEach((s) => {
1450
- e.removeMark(s.$from.pos, s.$to.pos);
1451
- }), !0;
1452
- }, Mr = (e, t = {}) => ({ tr: n, state: r, dispatch: o }) => {
1453
- var s;
1454
- const { extendEmptyMarkRange: i = !1 } = t, { selection: a } = n, c = R(e, r.schema), { $from: l, empty: f, ranges: d } = a;
1455
- if (!o)
1456
- return !0;
1457
- if (f && i) {
1458
- let { from: p, to: u } = a;
1459
- const m = (s = l.marks().find((g) => g.type === c)) == null ? void 0 : s.attrs, h = yt(l, c, m);
1460
- h && (p = h.from, u = h.to), n.removeMark(p, u, c);
1461
- } else
1462
- d.forEach((p) => {
1463
- n.removeMark(p.$from.pos, p.$to.pos, c);
1464
- });
1465
- return n.removeStoredMark(c), !0;
1466
- }, xr = (e) => ({ tr: t, state: n, dispatch: r }) => {
1467
- const { selection: o } = n;
1468
- let s, i;
1469
- return typeof e == "number" ? (s = e, i = e) : e && "from" in e && "to" in e ? (s = e.from, i = e.to) : (s = o.from, i = o.to), r && t.doc.nodesBetween(s, i, (a, c) => {
1470
- if (a.isText)
1471
- return;
1472
- const l = { ...a.attrs };
1473
- delete l.dir, t.setNodeMarkup(c, void 0, l);
1474
- }), !0;
1475
- }, Sr = (e, t = {}) => ({ tr: n, state: r, dispatch: o }) => {
1476
- let s = null, i = null;
1477
- const a = st(
1478
- typeof e == "string" ? e : e.name,
1479
- r.schema
1480
- );
1481
- if (!a)
1482
- return !1;
1483
- a === "node" && (s = T(e, r.schema)), a === "mark" && (i = R(e, r.schema));
1484
- let c = !1;
1485
- return n.selection.ranges.forEach((l) => {
1486
- const f = l.$from.pos, d = l.$to.pos;
1487
- let p, u, m, h;
1488
- n.selection.empty ? r.doc.nodesBetween(f, d, (g, v) => {
1489
- s && s === g.type && (c = !0, m = Math.max(v, f), h = Math.min(v + g.nodeSize, d), p = v, u = g);
1490
- }) : r.doc.nodesBetween(f, d, (g, v) => {
1491
- v < f && s && s === g.type && (c = !0, m = Math.max(v, f), h = Math.min(v + g.nodeSize, d), p = v, u = g), v >= f && v <= d && (s && s === g.type && (c = !0, o && n.setNodeMarkup(v, void 0, {
1492
- ...g.attrs,
1493
- ...t
1494
- })), i && g.marks.length && g.marks.forEach((y) => {
1495
- if (i === y.type && (c = !0, o)) {
1496
- const w = Math.max(v, f), M = Math.min(v + g.nodeSize, d);
1497
- n.addMark(
1498
- w,
1499
- M,
1500
- i.create({
1501
- ...y.attrs,
1502
- ...t
1503
- })
1504
- );
1505
- }
1506
- }));
1507
- }), u && (p !== void 0 && o && n.setNodeMarkup(p, void 0, {
1508
- ...u.attrs,
1509
- ...t
1510
- }), i && u.marks.length && u.marks.forEach((g) => {
1511
- i === g.type && o && n.addMark(
1512
- m,
1513
- h,
1514
- i.create({
1515
- ...g.attrs,
1516
- ...t
1517
- })
1518
- );
1519
- }));
1520
- }), c;
1521
- }, Er = (e, t = {}) => ({ state: n, dispatch: r }) => {
1522
- const o = T(e, n.schema);
1523
- return _e(o, t)(n, r);
1524
- }, Tr = (e, t = {}) => ({ state: n, dispatch: r }) => {
1525
- const o = T(e, n.schema);
1526
- return qe(o, t)(n, r);
1527
- }, Ar = class {
1528
- constructor() {
1529
- this.callbacks = {};
1530
- }
1531
- on(e, t) {
1532
- return this.callbacks[e] || (this.callbacks[e] = []), this.callbacks[e].push(t), this;
1533
- }
1534
- emit(e, ...t) {
1535
- const n = this.callbacks[e];
1536
- return n && n.forEach((r) => r.apply(this, t)), this;
1537
- }
1538
- off(e, t) {
1539
- const n = this.callbacks[e];
1540
- return n && (t ? this.callbacks[e] = n.filter((r) => r !== t) : delete this.callbacks[e]), this;
1541
- }
1542
- once(e, t) {
1543
- const n = (...r) => {
1544
- this.off(e, n), t.apply(this, r);
1545
- };
1546
- return this.on(e, n);
1547
- }
1548
- removeAllListeners() {
1549
- this.callbacks = {};
1550
- }
1551
- }, at = class {
1552
- constructor(e) {
1553
- var t;
1554
- this.find = e.find, this.handler = e.handler, this.undoable = (t = e.undoable) != null ? t : !0;
1555
- }
1556
- }, Cr = (e, t) => {
1557
- if (bt(t))
1558
- return t.exec(e);
1559
- const n = t(e);
1560
- if (!n)
1561
- return null;
1562
- const r = [n.text];
1563
- return r.index = n.index, r.input = e, r.data = n.data, n.replaceWith && (n.text.includes(n.replaceWith) || console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'), r.push(n.replaceWith)), r;
1564
- };
1565
- function J(e) {
1566
- var t;
1567
- const { editor: n, from: r, to: o, text: s, rules: i, plugin: a } = e, { view: c } = n;
1568
- if (c.composing)
1569
- return !1;
1570
- const l = c.state.doc.resolve(r);
1571
- if (
1572
- // check for code node
1573
- l.parent.type.spec.code || (t = l.nodeBefore || l.nodeAfter) != null && t.marks.find((p) => p.type.spec.code)
1574
- )
1575
- return !1;
1576
- let f = !1;
1577
- const d = nr(l) + s;
1578
- return i.forEach((p) => {
1579
- if (f)
1580
- return;
1581
- const u = Cr(d, p.find);
1582
- if (!u)
1583
- return;
1584
- const m = c.state.tr, h = rt({
1585
- state: c.state,
1586
- transaction: m
1587
- }), g = {
1588
- from: r - (u[0].length - s.length),
1589
- to: o
1590
- }, { commands: v, chain: y, can: w } = new ot({
1591
- editor: n,
1592
- state: h
1593
- });
1594
- p.handler({
1595
- state: h,
1596
- range: g,
1597
- match: u,
1598
- commands: v,
1599
- chain: y,
1600
- can: w
1601
- }) === null || !m.steps.length || (p.undoable && m.setMeta(a, {
1602
- transform: m,
1603
- from: r,
1604
- to: o,
1605
- text: s
1606
- }), c.dispatch(m), f = !0);
1607
- }), f;
1608
- }
1609
- function Pr(e) {
1610
- const { editor: t, rules: n } = e, r = new $({
1611
- state: {
1612
- init() {
1613
- return null;
1614
- },
1615
- apply(o, s, i) {
1616
- const a = o.getMeta(r);
1617
- if (a)
1618
- return a;
1619
- const c = o.getMeta("applyInputRules");
1620
- return c && setTimeout(() => {
1621
- let { text: f } = c;
1622
- typeof f == "string" ? f = f : f = wt(O.from(f), i.schema);
1623
- const { from: d } = c, p = d + f.length;
1624
- J({
1625
- editor: t,
1626
- from: d,
1627
- to: p,
1628
- text: f,
1629
- rules: n,
1630
- plugin: r
1631
- });
1632
- }), o.selectionSet || o.docChanged ? null : s;
1633
- }
1634
- },
1635
- props: {
1636
- handleTextInput(o, s, i, a) {
1637
- return J({
1638
- editor: t,
1639
- from: s,
1640
- to: i,
1641
- text: a,
1642
- rules: n,
1643
- plugin: r
1644
- });
1645
- },
1646
- handleDOMEvents: {
1647
- compositionend: (o) => (setTimeout(() => {
1648
- const { $cursor: s } = o.state.selection;
1649
- s && J({
1650
- editor: t,
1651
- from: s.pos,
1652
- to: s.pos,
1653
- text: "",
1654
- rules: n,
1655
- plugin: r
1656
- });
1657
- }), !1)
1658
- },
1659
- // add support for input rules to trigger on enter
1660
- // this is useful for example for code blocks
1661
- handleKeyDown(o, s) {
1662
- if (s.key !== "Enter")
1663
- return !1;
1664
- const { $cursor: i } = o.state.selection;
1665
- return i ? J({
1666
- editor: t,
1667
- from: i.pos,
1668
- to: i.pos,
1669
- text: `
1670
- `,
1671
- rules: n,
1672
- plugin: r
1673
- }) : !1;
1674
- }
1675
- },
1676
- // @ts-ignore
1677
- isInputRules: !0
1678
- });
1679
- return r;
1680
- }
1681
- function $r(e) {
1682
- return Object.prototype.toString.call(e).slice(8, -1);
1683
- }
1684
- function Q(e) {
1685
- return $r(e) !== "Object" ? !1 : e.constructor === Object && Object.getPrototypeOf(e) === Object.prototype;
1686
- }
1687
- function te(e, t) {
1688
- const n = { ...e };
1689
- return Q(e) && Q(t) && Object.keys(t).forEach((r) => {
1690
- Q(t[r]) && Q(e[r]) ? n[r] = te(e[r], t[r]) : n[r] = t[r];
1691
- }), n;
1692
- }
1693
- var xt = class {
1694
- constructor(e = {}) {
1695
- this.type = "extendable", this.parent = null, this.child = null, this.name = "", this.config = {
1696
- name: this.name
1697
- }, this.config = {
1698
- ...this.config,
1699
- ...e
1700
- }, this.name = this.config.name;
1701
- }
1702
- get options() {
1703
- return {
1704
- ...x(
1705
- b(this, "addOptions", {
1706
- name: this.name
1707
- })
1708
- ) || {}
1709
- };
1710
- }
1711
- get storage() {
1712
- return {
1713
- ...x(
1714
- b(this, "addStorage", {
1715
- name: this.name,
1716
- options: this.options
1717
- })
1718
- ) || {}
1719
- };
1720
- }
1721
- configure(e = {}) {
1722
- const t = this.extend({
1723
- ...this.config,
1724
- addOptions: () => te(this.options, e)
274
+ function me(t, n) {
275
+ const e = He(n.replace(/[A-Z]/g, (c) => c.toLowerCase())), s = e.length, i = [];
276
+ let r = 0, a = 0;
277
+ for (; a < s; ) {
278
+ let c = t, d = null, m = 0, E = null, u = -1, g = -1;
279
+ for (; a < s && (d = c.go(e[a])); )
280
+ c = d, c.accepts() ? (u = 0, g = 0, E = c) : u >= 0 && (u += e[a].length, g++), m += e[a].length, r += e[a].length, a++;
281
+ r -= u, a -= g, m -= u, i.push({
282
+ t: E.t,
283
+ // token type/name
284
+ v: n.slice(r - m, r),
285
+ // string value
286
+ s: r - m,
287
+ // start index
288
+ e: r
289
+ // end index (excluding)
1725
290
  });
1726
- return t.name = this.name, t.parent = this.parent, t;
1727
- }
1728
- extend(e = {}) {
1729
- const t = new this.constructor({ ...this.config, ...e });
1730
- return t.parent = this, this.child = t, t.name = "name" in e ? e.name : t.parent.name, t;
1731
- }
1732
- }, Nr = class ee extends xt {
1733
- constructor() {
1734
- super(...arguments), this.type = "mark";
1735
- }
1736
- /**
1737
- * Create a new Mark instance
1738
- * @param config - Mark configuration object or a function that returns a configuration object
1739
- */
1740
- static create(t = {}) {
1741
- const n = typeof t == "function" ? t() : t;
1742
- return new ee(n);
1743
- }
1744
- static handleExit({ editor: t, mark: n }) {
1745
- const { tr: r } = t.state, o = t.state.selection.$from;
1746
- if (o.pos === o.end()) {
1747
- const i = o.marks();
1748
- if (!!!i.find((l) => l?.type.name === n.name))
1749
- return !1;
1750
- const c = i.find((l) => l?.type.name === n.name);
1751
- return c && r.removeStoredMark(c), r.insertText(" ", o.pos), t.view.dispatch(r), !0;
1752
- }
1753
- return !1;
1754
291
  }
1755
- configure(t) {
1756
- return super.configure(t);
1757
- }
1758
- extend(t) {
1759
- const n = typeof t == "function" ? t() : t;
1760
- return super.extend(n);
1761
- }
1762
- };
1763
- function Ir(e) {
1764
- return typeof e == "number";
1765
- }
1766
- var Rr = class {
1767
- constructor(e) {
1768
- this.find = e.find, this.handler = e.handler;
1769
- }
1770
- }, Br = (e, t, n) => {
1771
- if (bt(t))
1772
- return [...e.matchAll(t)];
1773
- const r = t(e, n);
1774
- return r ? r.map((o) => {
1775
- const s = [o.text];
1776
- return s.index = o.index, s.input = e, s.data = o.data, o.replaceWith && (o.text.includes(o.replaceWith) || console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'), s.push(o.replaceWith)), s;
1777
- }) : [];
1778
- };
1779
- function Or(e) {
1780
- const { editor: t, state: n, from: r, to: o, rule: s, pasteEvent: i, dropEvent: a } = e, { commands: c, chain: l, can: f } = new ot({
1781
- editor: t,
1782
- state: n
1783
- }), d = [];
1784
- return n.doc.nodesBetween(r, o, (u, m) => {
1785
- var h, g, v, y, w;
1786
- if ((g = (h = u.type) == null ? void 0 : h.spec) != null && g.code || !(u.isText || u.isTextblock || u.isInline))
1787
- return;
1788
- const M = (w = (y = (v = u.content) == null ? void 0 : v.size) != null ? y : u.nodeSize) != null ? w : 0, k = Math.max(r, m), S = Math.min(o, m + M);
1789
- if (k >= S)
1790
- return;
1791
- const E = u.isText ? u.text || "" : u.textBetween(k - m, S - m, void 0, "");
1792
- Br(E, s.find, i).forEach((C) => {
1793
- if (C.index === void 0)
1794
- return;
1795
- const D = k + C.index + 1, lt = D + C[0].length, q = {
1796
- from: n.tr.mapping.map(D),
1797
- to: n.tr.mapping.map(lt)
1798
- }, dt = s.handler({
1799
- state: n,
1800
- range: q,
1801
- match: C,
1802
- commands: c,
1803
- chain: l,
1804
- can: f,
1805
- pasteEvent: i,
1806
- dropEvent: a
1807
- });
1808
- d.push(dt);
1809
- });
1810
- }), d.every((u) => u !== null);
1811
- }
1812
- var Z = null, jr = (e) => {
1813
- var t;
1814
- const n = new ClipboardEvent("paste", {
1815
- clipboardData: new DataTransfer()
1816
- });
1817
- return (t = n.clipboardData) == null || t.setData("text/html", e), n;
292
+ return i;
293
+ }
294
+ function He(t) {
295
+ const n = [], e = t.length;
296
+ let s = 0;
297
+ for (; s < e; ) {
298
+ let i = t.charCodeAt(s), r, a = i < 55296 || i > 56319 || s + 1 === e || (r = t.charCodeAt(s + 1)) < 56320 || r > 57343 ? t[s] : t.slice(s, s + 2);
299
+ n.push(a), s += a.length;
300
+ }
301
+ return n;
302
+ }
303
+ function D(t, n, e, s, i) {
304
+ let r;
305
+ const a = n.length;
306
+ for (let c = 0; c < a - 1; c++) {
307
+ const d = n[c];
308
+ t.j[d] ? r = t.j[d] : (r = new p(s), r.jr = i.slice(), t.j[d] = r), t = r;
309
+ }
310
+ return r = new p(e), r.jr = i.slice(), t.j[n[a - 1]] = r, r;
311
+ }
312
+ function oe(t) {
313
+ const n = [], e = [];
314
+ let s = 0, i = "0123456789";
315
+ for (; s < t.length; ) {
316
+ let r = 0;
317
+ for (; i.indexOf(t[s + r]) >= 0; )
318
+ r++;
319
+ if (r > 0) {
320
+ n.push(e.join(""));
321
+ for (let a = parseInt(t.substring(s, s + r), 10); a > 0; a--)
322
+ e.pop();
323
+ s += r;
324
+ } else
325
+ e.push(t[s]), s++;
326
+ }
327
+ return n;
328
+ }
329
+ const J = {
330
+ defaultProtocol: "http",
331
+ events: null,
332
+ format: re,
333
+ formatHref: re,
334
+ nl2br: !1,
335
+ tagName: "a",
336
+ target: null,
337
+ rel: null,
338
+ validate: !0,
339
+ truncate: 1 / 0,
340
+ className: null,
341
+ attributes: null,
342
+ ignoreTags: [],
343
+ render: null
1818
344
  };
1819
- function Dr(e) {
1820
- const { editor: t, rules: n } = e;
1821
- let r = null, o = !1, s = !1, i = typeof ClipboardEvent < "u" ? new ClipboardEvent("paste") : null, a;
1822
- try {
1823
- a = typeof DragEvent < "u" ? new DragEvent("drop") : null;
1824
- } catch {
1825
- a = null;
1826
- }
1827
- const c = ({
1828
- state: f,
1829
- from: d,
1830
- to: p,
1831
- rule: u,
1832
- pasteEvt: m
1833
- }) => {
1834
- const h = f.tr, g = rt({
1835
- state: f,
1836
- transaction: h
1837
- });
1838
- if (!(!Or({
1839
- editor: t,
1840
- state: g,
1841
- from: Math.max(d - 1, 0),
1842
- to: p.b - 1,
1843
- rule: u,
1844
- pasteEvent: m,
1845
- dropEvent: a
1846
- }) || !h.steps.length)) {
1847
- try {
1848
- a = typeof DragEvent < "u" ? new DragEvent("drop") : null;
1849
- } catch {
1850
- a = null;
1851
- }
1852
- return i = typeof ClipboardEvent < "u" ? new ClipboardEvent("paste") : null, h;
1853
- }
1854
- };
1855
- return n.map((f) => new $({
1856
- // we register a global drag handler to track the current drag source element
1857
- view(d) {
1858
- const p = (m) => {
1859
- var h;
1860
- r = (h = d.dom.parentElement) != null && h.contains(m.target) ? d.dom.parentElement : null, r && (Z = t);
1861
- }, u = () => {
1862
- Z && (Z = null);
1863
- };
1864
- return window.addEventListener("dragstart", p), window.addEventListener("dragend", u), {
1865
- destroy() {
1866
- window.removeEventListener("dragstart", p), window.removeEventListener("dragend", u);
1867
- }
1868
- };
1869
- },
1870
- props: {
1871
- handleDOMEvents: {
1872
- drop: (d, p) => {
1873
- if (s = r === d.dom.parentElement, a = p, !s) {
1874
- const u = Z;
1875
- u?.isEditable && setTimeout(() => {
1876
- const m = u.state.selection;
1877
- m && u.commands.deleteRange({ from: m.from, to: m.to });
1878
- }, 10);
1879
- }
1880
- return !1;
1881
- },
1882
- paste: (d, p) => {
1883
- var u;
1884
- const m = (u = p.clipboardData) == null ? void 0 : u.getData("text/html");
1885
- return i = p, o = !!m?.includes("data-pm-slice"), !1;
1886
- }
1887
- }
1888
- },
1889
- appendTransaction: (d, p, u) => {
1890
- const m = d[0], h = m.getMeta("uiEvent") === "paste" && !o, g = m.getMeta("uiEvent") === "drop" && !s, v = m.getMeta("applyPasteRules"), y = !!v;
1891
- if (!h && !g && !y)
1892
- return;
1893
- if (y) {
1894
- let { text: k } = v;
1895
- typeof k == "string" ? k = k : k = wt(O.from(k), u.schema);
1896
- const { from: S } = v, E = S + k.length, A = jr(k);
1897
- return c({
1898
- rule: f,
1899
- state: u,
1900
- from: S,
1901
- to: { b: E },
1902
- pasteEvt: A
1903
- });
1904
- }
1905
- const w = p.doc.content.findDiffStart(u.doc.content), M = p.doc.content.findDiffEnd(u.doc.content);
1906
- if (!(!Ir(w) || !M || w === M.b))
1907
- return c({
1908
- rule: f,
1909
- state: u,
1910
- from: w,
1911
- to: M,
1912
- pasteEvt: i
1913
- });
1914
- }
1915
- }));
345
+ function Zt(t, n = null) {
346
+ let e = Object.assign({}, J);
347
+ t && (e = Object.assign(e, t instanceof Zt ? t.o : t));
348
+ const s = e.ignoreTags, i = [];
349
+ for (let r = 0; r < s.length; r++)
350
+ i.push(s[r].toUpperCase());
351
+ this.o = e, n && (this.defaultRender = n), this.ignoreTags = i;
1916
352
  }
1917
- var ct = class {
1918
- constructor(e, t) {
1919
- this.splittableMarks = [], this.editor = t, this.baseExtensions = e, this.extensions = Jt(e), this.schema = Jn(this.extensions, t), this.setupExtensions();
1920
- }
1921
- /**
1922
- * Get all commands from the extensions.
1923
- * @returns An object with all commands where the key is the command name and the value is the command function
1924
- */
1925
- get commands() {
1926
- return this.extensions.reduce((e, t) => {
1927
- const n = {
1928
- name: t.name,
1929
- options: t.options,
1930
- storage: this.editor.extensionStorage[t.name],
1931
- editor: this.editor,
1932
- type: F(t.name, this.schema)
1933
- }, r = b(t, "addCommands", n);
1934
- return r ? {
1935
- ...e,
1936
- ...r()
1937
- } : e;
1938
- }, {});
1939
- }
353
+ Zt.prototype = {
354
+ o: J,
1940
355
  /**
1941
- * Get all registered Prosemirror plugins from the extensions.
1942
- * @returns An array of Prosemirror plugins
356
+ * @type string[]
1943
357
  */
1944
- get plugins() {
1945
- const { editor: e } = this;
1946
- return H([...this.extensions].reverse()).flatMap((r) => {
1947
- const o = {
1948
- name: r.name,
1949
- options: r.options,
1950
- storage: this.editor.extensionStorage[r.name],
1951
- editor: e,
1952
- type: F(r.name, this.schema)
1953
- }, s = [], i = b(
1954
- r,
1955
- "addKeyboardShortcuts",
1956
- o
1957
- );
1958
- let a = {};
1959
- if (r.type === "mark" && b(r, "exitable", o) && (a.ArrowRight = () => Nr.handleExit({ editor: e, mark: r })), i) {
1960
- const p = Object.fromEntries(
1961
- Object.entries(i()).map(([u, m]) => [u, () => m({ editor: e })])
1962
- );
1963
- a = { ...a, ...p };
1964
- }
1965
- const c = Je(a);
1966
- s.push(c);
1967
- const l = b(r, "addInputRules", o);
1968
- if (Bt(r, e.options.enableInputRules) && l) {
1969
- const p = l();
1970
- if (p && p.length) {
1971
- const u = Pr({
1972
- editor: e,
1973
- rules: p
1974
- }), m = Array.isArray(u) ? u : [u];
1975
- s.push(...m);
1976
- }
1977
- }
1978
- const f = b(r, "addPasteRules", o);
1979
- if (Bt(r, e.options.enablePasteRules) && f) {
1980
- const p = f();
1981
- if (p && p.length) {
1982
- const u = Dr({ editor: e, rules: p });
1983
- s.push(...u);
1984
- }
1985
- }
1986
- const d = b(
1987
- r,
1988
- "addProseMirrorPlugins",
1989
- o
1990
- );
1991
- if (d) {
1992
- const p = d();
1993
- s.push(...p);
1994
- }
1995
- return s;
1996
- });
1997
- }
1998
- /**
1999
- * Get all attributes from the extensions.
2000
- * @returns An array of attributes
2001
- */
2002
- get attributes() {
2003
- return Kt(this.extensions);
2004
- }
358
+ ignoreTags: [],
2005
359
  /**
2006
- * Get all node views from the extensions.
2007
- * @returns An object with all node views where the key is the node name and the value is the node view function
360
+ * @param {IntermediateRepresentation} ir
361
+ * @returns {any}
2008
362
  */
2009
- get nodeViews() {
2010
- const { editor: e } = this, { nodeExtensions: t } = L(this.extensions);
2011
- return Object.fromEntries(
2012
- t.filter((n) => !!b(n, "addNodeView")).map((n) => {
2013
- const r = this.attributes.filter((c) => c.type === n.name), o = {
2014
- name: n.name,
2015
- options: n.options,
2016
- storage: this.editor.extensionStorage[n.name],
2017
- editor: e,
2018
- type: T(n.name, this.schema)
2019
- }, s = b(n, "addNodeView", o);
2020
- if (!s)
2021
- return [];
2022
- const i = s();
2023
- if (!i)
2024
- return [];
2025
- const a = (c, l, f, d, p) => {
2026
- const u = et(c, r);
2027
- return i({
2028
- // pass-through
2029
- node: c,
2030
- view: l,
2031
- getPos: f,
2032
- decorations: d,
2033
- innerDecorations: p,
2034
- // tiptap-specific
2035
- editor: e,
2036
- extension: n,
2037
- HTMLAttributes: u
2038
- });
2039
- };
2040
- return [n.name, a];
2041
- })
2042
- );
2043
- }
363
+ defaultRender(t) {
364
+ return t;
365
+ },
2044
366
  /**
2045
- * Get the composed dispatchTransaction function from all extensions.
2046
- * @param baseDispatch The base dispatch function (e.g. from the editor or user props)
2047
- * @returns A composed dispatch function
367
+ * Returns true or false based on whether a token should be displayed as a
368
+ * link based on the user options.
369
+ * @param {MultiToken} token
370
+ * @returns {boolean}
2048
371
  */
2049
- dispatchTransaction(e) {
2050
- const { editor: t } = this;
2051
- return H([...this.extensions].reverse()).reduceRight((r, o) => {
2052
- const s = {
2053
- name: o.name,
2054
- options: o.options,
2055
- storage: this.editor.extensionStorage[o.name],
2056
- editor: t,
2057
- type: F(o.name, this.schema)
2058
- }, i = b(
2059
- o,
2060
- "dispatchTransaction",
2061
- s
2062
- );
2063
- return i ? (a) => {
2064
- i.call(s, { transaction: a, next: r });
2065
- } : r;
2066
- }, e);
2067
- }
372
+ check(t) {
373
+ return this.get("validate", t.toString(), t);
374
+ },
375
+ // Private methods
376
+ /**
377
+ * Resolve an option's value based on the value of the option and the given
378
+ * params. If operator and token are specified and the target option is
379
+ * callable, automatically calls the function with the given argument.
380
+ * @template {keyof Opts} K
381
+ * @param {K} key Name of option to use
382
+ * @param {string} [operator] will be passed to the target option if it's a
383
+ * function. If not specified, RAW function value gets returned
384
+ * @param {MultiToken} [token] The token from linkify.tokenize
385
+ * @returns {Opts[K] | any}
386
+ */
387
+ get(t, n, e) {
388
+ const s = n != null;
389
+ let i = this.o[t];
390
+ return i && (typeof i == "object" ? (i = e.t in i ? i[e.t] : J[t], typeof i == "function" && s && (i = i(n, e))) : typeof i == "function" && s && (i = i(n, e.t, e)), i);
391
+ },
2068
392
  /**
2069
- * Get the composed transformPastedHTML function from all extensions.
2070
- * @param baseTransform The base transform function (e.g. from the editor props)
2071
- * @returns A composed transform function that chains all extension transforms
393
+ * @template {keyof Opts} L
394
+ * @param {L} key Name of options object to use
395
+ * @param {string} [operator]
396
+ * @param {MultiToken} [token]
397
+ * @returns {Opts[L] | any}
2072
398
  */
2073
- transformPastedHTML(e) {
2074
- const { editor: t } = this;
2075
- return H([...this.extensions]).reduce(
2076
- (r, o) => {
2077
- const s = {
2078
- name: o.name,
2079
- options: o.options,
2080
- storage: this.editor.extensionStorage[o.name],
2081
- editor: t,
2082
- type: F(o.name, this.schema)
2083
- }, i = b(
2084
- o,
2085
- "transformPastedHTML",
2086
- s
2087
- );
2088
- return i ? (a, c) => {
2089
- const l = r(a, c);
2090
- return i.call(s, l);
2091
- } : r;
2092
- },
2093
- e || ((r) => r)
2094
- );
2095
- }
2096
- get markViews() {
2097
- const { editor: e } = this, { markExtensions: t } = L(this.extensions);
2098
- return Object.fromEntries(
2099
- t.filter((n) => !!b(n, "addMarkView")).map((n) => {
2100
- const r = this.attributes.filter((a) => a.type === n.name), o = {
2101
- name: n.name,
2102
- options: n.options,
2103
- storage: this.editor.extensionStorage[n.name],
2104
- editor: e,
2105
- type: R(n.name, this.schema)
2106
- }, s = b(n, "addMarkView", o);
2107
- if (!s)
2108
- return [];
2109
- const i = (a, c, l) => {
2110
- const f = et(a, r);
2111
- return s()({
2112
- // pass-through
2113
- mark: a,
2114
- view: c,
2115
- inline: l,
2116
- // tiptap-specific
2117
- editor: e,
2118
- extension: n,
2119
- HTMLAttributes: f,
2120
- updateAttributes: (d) => {
2121
- Zr(a, e, d);
2122
- }
2123
- });
2124
- };
2125
- return [n.name, i];
2126
- })
2127
- );
2128
- }
399
+ getObj(t, n, e) {
400
+ let s = this.o[t];
401
+ return typeof s == "function" && n != null && (s = s(n, e.t, e)), s;
402
+ },
2129
403
  /**
2130
- * Go through all extensions, create extension storages & setup marks
2131
- * & bind editor event listener.
404
+ * Convert the given token to a rendered element that may be added to the
405
+ * calling-interface's DOM
406
+ * @param {MultiToken} token Token to render to an HTML element
407
+ * @returns {any} Render result; e.g., HTML string, DOM element, React
408
+ * Component, etc.
2132
409
  */
2133
- setupExtensions() {
2134
- const e = this.extensions;
2135
- this.editor.extensionStorage = Object.fromEntries(
2136
- e.map((t) => [t.name, t.storage])
2137
- ), e.forEach((t) => {
2138
- var n;
2139
- const r = {
2140
- name: t.name,
2141
- options: t.options,
2142
- storage: this.editor.extensionStorage[t.name],
2143
- editor: this.editor,
2144
- type: F(t.name, this.schema)
2145
- };
2146
- t.type === "mark" && ((n = x(b(t, "keepOnSplit", r))) == null || n) && this.splittableMarks.push(t.name);
2147
- const o = b(t, "onBeforeCreate", r), s = b(t, "onCreate", r), i = b(t, "onUpdate", r), a = b(
2148
- t,
2149
- "onSelectionUpdate",
2150
- r
2151
- ), c = b(t, "onTransaction", r), l = b(t, "onFocus", r), f = b(t, "onBlur", r), d = b(t, "onDestroy", r);
2152
- o && this.editor.on("beforeCreate", o), s && this.editor.on("create", s), i && this.editor.on("update", i), a && this.editor.on("selectionUpdate", a), c && this.editor.on("transaction", c), l && this.editor.on("focus", l), f && this.editor.on("blur", f), d && this.editor.on("destroy", d);
2153
- });
410
+ render(t) {
411
+ const n = t.render(this);
412
+ return (this.get("render", null, t) || this.defaultRender)(n, t.t, t);
2154
413
  }
2155
414
  };
2156
- ct.resolve = Jt;
2157
- ct.sort = H;
2158
- ct.flatten = kt;
2159
- var _r = {};
2160
- vt(_r, {
2161
- ClipboardTextSerializer: () => re,
2162
- Commands: () => oe,
2163
- Delete: () => se,
2164
- Drop: () => ie,
2165
- Editable: () => ae,
2166
- FocusEvents: () => le,
2167
- Keymap: () => de,
2168
- Paste: () => ue,
2169
- Tabindex: () => fe,
2170
- TextDirection: () => pe,
2171
- focusEventsPluginKey: () => ce
2172
- });
2173
- var N = class ne extends xt {
2174
- constructor() {
2175
- super(...arguments), this.type = "extension";
2176
- }
2177
- /**
2178
- * Create a new Extension instance
2179
- * @param config - Extension configuration object or a function that returns a configuration object
2180
- */
2181
- static create(t = {}) {
2182
- const n = typeof t == "function" ? t() : t;
2183
- return new ne(n);
2184
- }
2185
- configure(t) {
2186
- return super.configure(t);
2187
- }
2188
- extend(t) {
2189
- const n = typeof t == "function" ? t() : t;
2190
- return super.extend(n);
2191
- }
2192
- }, re = N.create({
2193
- name: "clipboardTextSerializer",
2194
- addOptions() {
2195
- return {
2196
- blockSeparator: void 0
2197
- };
2198
- },
2199
- addProseMirrorPlugins() {
2200
- return [
2201
- new $({
2202
- key: new j("clipboardTextSerializer"),
2203
- props: {
2204
- clipboardTextSerializer: () => {
2205
- const { editor: e } = this, { state: t, schema: n } = e, { doc: r, selection: o } = t, { ranges: s } = o, i = Math.min(...s.map((f) => f.$from.pos)), a = Math.max(...s.map((f) => f.$to.pos)), c = Zt(n);
2206
- return Qt(r, { from: i, to: a }, {
2207
- ...this.options.blockSeparator !== void 0 ? { blockSeparator: this.options.blockSeparator } : {},
2208
- textSerializers: c
2209
- });
2210
- }
2211
- }
2212
- })
2213
- ];
2214
- }
2215
- }), oe = N.create({
2216
- name: "commands",
2217
- addCommands() {
2218
- return {
2219
- ...zt
2220
- };
2221
- }
2222
- }), se = N.create({
2223
- name: "delete",
2224
- onUpdate({ transaction: e, appendedTransactions: t }) {
2225
- var n, r, o;
2226
- const s = () => {
2227
- var i, a, c, l;
2228
- if ((l = (c = (a = (i = this.editor.options.coreExtensionOptions) == null ? void 0 : i.delete) == null ? void 0 : a.filterTransaction) == null ? void 0 : c.call(a, e)) != null ? l : e.getMeta("y-sync$"))
2229
- return;
2230
- const f = Fn(e.before, [e, ...t]);
2231
- er(f).forEach((u) => {
2232
- f.mapping.mapResult(u.oldRange.from).deletedAfter && f.mapping.mapResult(u.oldRange.to).deletedBefore && f.before.nodesBetween(u.oldRange.from, u.oldRange.to, (m, h) => {
2233
- const g = h + m.nodeSize - 2, v = u.oldRange.from <= h && g <= u.oldRange.to;
2234
- this.editor.emit("delete", {
2235
- type: "node",
2236
- node: m,
2237
- from: h,
2238
- to: g,
2239
- newFrom: f.mapping.map(h),
2240
- newTo: f.mapping.map(g),
2241
- deletedRange: u.oldRange,
2242
- newRange: u.newRange,
2243
- partial: !v,
2244
- editor: this.editor,
2245
- transaction: e,
2246
- combinedTransform: f
2247
- });
2248
- });
2249
- });
2250
- const p = f.mapping;
2251
- f.steps.forEach((u, m) => {
2252
- var h, g;
2253
- if (u instanceof ve) {
2254
- const v = p.slice(m).map(u.from, -1), y = p.slice(m).map(u.to), w = p.invert().map(v, -1), M = p.invert().map(y), k = (h = f.doc.nodeAt(v - 1)) == null ? void 0 : h.marks.some((E) => E.eq(u.mark)), S = (g = f.doc.nodeAt(y)) == null ? void 0 : g.marks.some((E) => E.eq(u.mark));
2255
- this.editor.emit("delete", {
2256
- type: "mark",
2257
- mark: u.mark,
2258
- from: u.from,
2259
- to: u.to,
2260
- deletedRange: {
2261
- from: w,
2262
- to: M
2263
- },
2264
- newRange: {
2265
- from: v,
2266
- to: y
2267
- },
2268
- partial: !!(S || k),
2269
- editor: this.editor,
2270
- transaction: e,
2271
- combinedTransform: f
2272
- });
2273
- }
2274
- });
2275
- };
2276
- (o = (r = (n = this.editor.options.coreExtensionOptions) == null ? void 0 : n.delete) == null ? void 0 : r.async) == null || o ? setTimeout(s, 0) : s();
2277
- }
2278
- }), ie = N.create({
2279
- name: "drop",
2280
- addProseMirrorPlugins() {
2281
- return [
2282
- new $({
2283
- key: new j("tiptapDrop"),
2284
- props: {
2285
- handleDrop: (e, t, n, r) => {
2286
- this.editor.emit("drop", {
2287
- editor: this.editor,
2288
- event: t,
2289
- slice: n,
2290
- moved: r
2291
- });
2292
- }
2293
- }
2294
- })
2295
- ];
2296
- }
2297
- }), ae = N.create({
2298
- name: "editable",
2299
- addProseMirrorPlugins() {
2300
- return [
2301
- new $({
2302
- key: new j("editable"),
2303
- props: {
2304
- editable: () => this.editor.options.editable
2305
- }
2306
- })
2307
- ];
2308
- }
2309
- }), ce = new j("focusEvents"), le = N.create({
2310
- name: "focusEvents",
2311
- addProseMirrorPlugins() {
2312
- const { editor: e } = this;
2313
- return [
2314
- new $({
2315
- key: ce,
2316
- props: {
2317
- handleDOMEvents: {
2318
- focus: (t, n) => {
2319
- e.isFocused = !0;
2320
- const r = e.state.tr.setMeta("focus", { event: n }).setMeta("addToHistory", !1);
2321
- return t.dispatch(r), !1;
2322
- },
2323
- blur: (t, n) => {
2324
- e.isFocused = !1;
2325
- const r = e.state.tr.setMeta("blur", { event: n }).setMeta("addToHistory", !1);
2326
- return t.dispatch(r), !1;
2327
- }
2328
- }
2329
- }
2330
- })
2331
- ];
2332
- }
2333
- }), de = N.create({
2334
- name: "keymap",
2335
- addKeyboardShortcuts() {
2336
- const e = () => this.editor.commands.first(({ commands: i }) => [
2337
- () => i.undoInputRule(),
2338
- // maybe convert first text block node to default node
2339
- () => i.command(({ tr: a }) => {
2340
- const { selection: c, doc: l } = a, { empty: f, $anchor: d } = c, { pos: p, parent: u } = d, m = d.parent.isTextblock && p > 0 ? a.doc.resolve(p - 1) : d, h = m.parent.type.spec.isolating, g = d.pos - d.parentOffset, v = h && m.parent.childCount === 1 ? g === d.pos : z.atStart(l).from === p;
2341
- return !f || !u.type.isTextblock || u.textContent.length || !v || v && d.parent.type.name === "paragraph" ? !1 : i.clearNodes();
2342
- }),
2343
- () => i.deleteSelection(),
2344
- () => i.joinBackward(),
2345
- () => i.selectNodeBackward()
2346
- ]), t = () => this.editor.commands.first(({ commands: i }) => [
2347
- () => i.deleteSelection(),
2348
- () => i.deleteCurrentNode(),
2349
- () => i.joinForward(),
2350
- () => i.selectNodeForward()
2351
- ]), r = {
2352
- Enter: () => this.editor.commands.first(({ commands: i }) => [
2353
- () => i.newlineInCode(),
2354
- () => i.createParagraphNear(),
2355
- () => i.liftEmptyBlock(),
2356
- () => i.splitBlock()
2357
- ]),
2358
- "Mod-Enter": () => this.editor.commands.exitCode(),
2359
- Backspace: e,
2360
- "Mod-Backspace": e,
2361
- "Shift-Backspace": e,
2362
- Delete: t,
2363
- "Mod-Delete": t,
2364
- "Mod-a": () => this.editor.commands.selectAll()
2365
- }, o = {
2366
- ...r
2367
- }, s = {
2368
- ...r,
2369
- "Ctrl-h": e,
2370
- "Alt-Backspace": e,
2371
- "Ctrl-d": t,
2372
- "Ctrl-Alt-Backspace": t,
2373
- "Alt-Delete": t,
2374
- "Alt-d": t,
2375
- "Ctrl-a": () => this.editor.commands.selectTextblockStart(),
2376
- "Ctrl-e": () => this.editor.commands.selectTextblockEnd()
2377
- };
2378
- return tt() || Ut() ? s : o;
2379
- },
2380
- addProseMirrorPlugins() {
2381
- return [
2382
- // With this plugin we check if the whole document was selected and deleted.
2383
- // In this case we will additionally call `clearNodes()` to convert e.g. a heading
2384
- // to a paragraph if necessary.
2385
- // This is an alternative to ProseMirror's `AllSelection`, which doesn’t work well
2386
- // with many other commands.
2387
- new $({
2388
- key: new j("clearDocument"),
2389
- appendTransaction: (e, t, n) => {
2390
- if (e.some((h) => h.getMeta("composition")))
2391
- return;
2392
- const r = e.some((h) => h.docChanged) && !t.doc.eq(n.doc), o = e.some((h) => h.getMeta("preventClearDocument"));
2393
- if (!r || o)
2394
- return;
2395
- const { empty: s, from: i, to: a } = t.selection, c = z.atStart(t.doc).from, l = z.atEnd(t.doc).to;
2396
- if (s || !(i === c && a === l) || !Mt(n.doc))
2397
- return;
2398
- const p = n.tr, u = rt({
2399
- state: n,
2400
- transaction: p
2401
- }), { commands: m } = new ot({
2402
- editor: this.editor,
2403
- state: u
2404
- });
2405
- if (m.clearNodes(), !!p.steps.length)
2406
- return p;
2407
- }
2408
- })
2409
- ];
2410
- }
2411
- }), ue = N.create({
2412
- name: "paste",
2413
- addProseMirrorPlugins() {
2414
- return [
2415
- new $({
2416
- key: new j("tiptapPaste"),
2417
- props: {
2418
- handlePaste: (e, t, n) => {
2419
- this.editor.emit("paste", {
2420
- editor: this.editor,
2421
- event: t,
2422
- slice: n
2423
- });
2424
- }
2425
- }
2426
- })
2427
- ];
2428
- }
2429
- }), fe = N.create({
2430
- name: "tabindex",
2431
- addProseMirrorPlugins() {
2432
- return [
2433
- new $({
2434
- key: new j("tabindex"),
2435
- props: {
2436
- attributes: () => this.editor.isEditable ? { tabindex: "0" } : {}
2437
- }
2438
- })
2439
- ];
2440
- }
2441
- }), pe = N.create({
2442
- name: "textDirection",
2443
- addOptions() {
2444
- return {
2445
- direction: void 0
2446
- };
2447
- },
2448
- addGlobalAttributes() {
2449
- if (!this.options.direction)
2450
- return [];
2451
- const { nodeExtensions: e } = L(this.extensions);
2452
- return [
2453
- {
2454
- types: e.filter((t) => t.name !== "text").map((t) => t.name),
2455
- attributes: {
2456
- dir: {
2457
- default: this.options.direction,
2458
- parseHTML: (t) => {
2459
- const n = t.getAttribute("dir");
2460
- return n && (n === "ltr" || n === "rtl" || n === "auto") ? n : this.options.direction;
2461
- },
2462
- renderHTML: (t) => t.dir ? {
2463
- dir: t.dir
2464
- } : {}
2465
- }
2466
- }
2467
- }
2468
- ];
2469
- },
2470
- addProseMirrorPlugins() {
2471
- return [
2472
- new $({
2473
- key: new j("textDirection"),
2474
- props: {
2475
- attributes: () => {
2476
- const e = this.options.direction;
2477
- return e ? {
2478
- dir: e
2479
- } : {};
2480
- }
2481
- }
2482
- })
2483
- ];
2484
- }
2485
- }), zr = class V {
2486
- constructor(t, n, r = !1, o = null) {
2487
- this.currentNode = null, this.actualDepth = null, this.isBlock = r, this.resolvedPos = t, this.editor = n, this.currentNode = o;
2488
- }
2489
- get name() {
2490
- return this.node.type.name;
2491
- }
2492
- get node() {
2493
- return this.currentNode || this.resolvedPos.node();
2494
- }
2495
- get element() {
2496
- return this.editor.view.domAtPos(this.pos).node;
2497
- }
2498
- get depth() {
2499
- var t;
2500
- return (t = this.actualDepth) != null ? t : this.resolvedPos.depth;
2501
- }
2502
- get pos() {
2503
- return this.resolvedPos.pos;
2504
- }
2505
- get content() {
2506
- return this.node.content;
2507
- }
2508
- set content(t) {
2509
- let n = this.from, r = this.to;
2510
- if (this.isBlock) {
2511
- if (this.content.size === 0) {
2512
- console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);
2513
- return;
2514
- }
2515
- n = this.from + 1, r = this.to - 1;
2516
- }
2517
- this.editor.commands.insertContentAt({ from: n, to: r }, t);
2518
- }
2519
- get attributes() {
2520
- return this.node.attrs;
2521
- }
2522
- get textContent() {
2523
- return this.node.textContent;
2524
- }
2525
- get size() {
2526
- return this.node.nodeSize;
2527
- }
2528
- get from() {
2529
- return this.isBlock ? this.pos : this.resolvedPos.start(this.resolvedPos.depth);
2530
- }
2531
- get range() {
2532
- return {
2533
- from: this.from,
2534
- to: this.to
2535
- };
2536
- }
2537
- get to() {
2538
- return this.isBlock ? this.pos + this.size : this.resolvedPos.end(this.resolvedPos.depth) + (this.node.isText ? 0 : 1);
2539
- }
2540
- get parent() {
2541
- if (this.depth === 0)
2542
- return null;
2543
- const t = this.resolvedPos.start(this.resolvedPos.depth - 1), n = this.resolvedPos.doc.resolve(t);
2544
- return new V(n, this.editor);
2545
- }
2546
- get before() {
2547
- let t = this.resolvedPos.doc.resolve(this.from - (this.isBlock ? 1 : 2));
2548
- return t.depth !== this.depth && (t = this.resolvedPos.doc.resolve(this.from - 3)), new V(t, this.editor);
2549
- }
2550
- get after() {
2551
- let t = this.resolvedPos.doc.resolve(this.to + (this.isBlock ? 2 : 1));
2552
- return t.depth !== this.depth && (t = this.resolvedPos.doc.resolve(this.to + 3)), new V(t, this.editor);
2553
- }
2554
- get children() {
2555
- const t = [];
2556
- return this.node.content.forEach((n, r) => {
2557
- const o = n.isBlock && !n.isTextblock, s = n.isAtom && !n.isText, i = n.isInline, a = this.pos + r + (s ? 0 : 1);
2558
- if (a < 0 || a > this.resolvedPos.doc.nodeSize - 2)
2559
- return;
2560
- const c = this.resolvedPos.doc.resolve(a);
2561
- if (!o && !i && c.depth <= this.depth)
2562
- return;
2563
- const l = new V(c, this.editor, o, o || i ? n : null);
2564
- o && (l.actualDepth = this.depth + 1), t.push(l);
2565
- }), t;
2566
- }
2567
- get firstChild() {
2568
- return this.children[0] || null;
2569
- }
2570
- get lastChild() {
2571
- const t = this.children;
2572
- return t[t.length - 1] || null;
2573
- }
2574
- closest(t, n = {}) {
2575
- let r = null, o = this.parent;
2576
- for (; o && !r; ) {
2577
- if (o.node.type.name === t)
2578
- if (Object.keys(n).length > 0) {
2579
- const s = o.node.attrs, i = Object.keys(n);
2580
- for (let a = 0; a < i.length; a += 1) {
2581
- const c = i[a];
2582
- if (s[c] !== n[c])
2583
- break;
2584
- }
2585
- } else
2586
- r = o;
2587
- o = o.parent;
2588
- }
2589
- return r;
2590
- }
2591
- querySelector(t, n = {}) {
2592
- return this.querySelectorAll(t, n, !0)[0] || null;
2593
- }
2594
- querySelectorAll(t, n = {}, r = !1) {
2595
- let o = [];
2596
- if (!this.children || this.children.length === 0)
2597
- return o;
2598
- const s = Object.keys(n);
2599
- return this.children.forEach((i) => {
2600
- r && o.length > 0 || (i.node.type.name === t && s.every((c) => n[c] === i.node.attrs[c]) && o.push(i), !(r && o.length > 0) && (o = o.concat(i.querySelectorAll(t, n, r))));
2601
- }), o;
2602
- }
2603
- setAttribute(t) {
2604
- const { tr: n } = this.editor.state;
2605
- n.setNodeMarkup(this.from, void 0, {
2606
- ...this.node.attrs,
2607
- ...t
2608
- }), this.editor.view.dispatch(n);
2609
- }
2610
- }, Lr = `.ProseMirror {
2611
- position: relative;
2612
- }
2613
-
2614
- .ProseMirror {
2615
- word-wrap: break-word;
2616
- white-space: pre-wrap;
2617
- white-space: break-spaces;
2618
- -webkit-font-variant-ligatures: none;
2619
- font-variant-ligatures: none;
2620
- font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
2621
- }
2622
-
2623
- .ProseMirror [contenteditable="false"] {
2624
- white-space: normal;
2625
- }
2626
-
2627
- .ProseMirror [contenteditable="false"] [contenteditable="true"] {
2628
- white-space: pre-wrap;
2629
- }
2630
-
2631
- .ProseMirror pre {
2632
- white-space: pre-wrap;
2633
- }
2634
-
2635
- img.ProseMirror-separator {
2636
- display: inline !important;
2637
- border: none !important;
2638
- margin: 0 !important;
2639
- width: 0 !important;
2640
- height: 0 !important;
2641
- }
2642
-
2643
- .ProseMirror-gapcursor {
2644
- display: none;
2645
- pointer-events: none;
2646
- position: absolute;
2647
- margin: 0;
2648
- }
2649
-
2650
- .ProseMirror-gapcursor:after {
2651
- content: "";
2652
- display: block;
2653
- position: absolute;
2654
- top: -2px;
2655
- width: 20px;
2656
- border-top: 1px solid black;
2657
- animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
2658
- }
2659
-
2660
- @keyframes ProseMirror-cursor-blink {
2661
- to {
2662
- visibility: hidden;
2663
- }
2664
- }
2665
-
2666
- .ProseMirror-hideselection *::selection {
2667
- background: transparent;
2668
- }
2669
-
2670
- .ProseMirror-hideselection *::-moz-selection {
2671
- background: transparent;
2672
- }
2673
-
2674
- .ProseMirror-hideselection * {
2675
- caret-color: transparent;
415
+ function re(t) {
416
+ return t;
2676
417
  }
2677
-
2678
- .ProseMirror-focused .ProseMirror-gapcursor {
2679
- display: block;
2680
- }`;
2681
- function Fr(e, t, n) {
2682
- const r = document.querySelector("style[data-tiptap-style]");
2683
- if (r !== null)
2684
- return r;
2685
- const o = document.createElement("style");
2686
- return t && o.setAttribute("nonce", t), o.setAttribute("data-tiptap-style", ""), o.innerHTML = e, document.getElementsByTagName("head")[0].appendChild(o), o;
418
+ function ge(t, n) {
419
+ this.t = "token", this.v = t, this.tk = n;
2687
420
  }
2688
- var lo = class extends Ar {
2689
- constructor(t = {}) {
2690
- super(), this.css = null, this.className = "tiptap", this.editorView = null, this.isFocused = !1, this.isInitialized = !1, this.extensionStorage = {}, this.instanceId = Math.random().toString(36).slice(2, 9), this.options = {
2691
- element: typeof document < "u" ? document.createElement("div") : null,
2692
- content: "",
2693
- injectCSS: !0,
2694
- injectNonce: void 0,
2695
- extensions: [],
2696
- autofocus: !1,
2697
- editable: !0,
2698
- textDirection: void 0,
2699
- editorProps: {},
2700
- parseOptions: {},
2701
- coreExtensionOptions: {},
2702
- enableInputRules: !0,
2703
- enablePasteRules: !0,
2704
- enableCoreExtensions: !0,
2705
- enableContentCheck: !1,
2706
- emitContentError: !1,
2707
- onBeforeCreate: () => null,
2708
- onCreate: () => null,
2709
- onMount: () => null,
2710
- onUnmount: () => null,
2711
- onUpdate: () => null,
2712
- onSelectionUpdate: () => null,
2713
- onTransaction: () => null,
2714
- onFocus: () => null,
2715
- onBlur: () => null,
2716
- onDestroy: () => null,
2717
- onContentError: ({ error: o }) => {
2718
- throw o;
2719
- },
2720
- onPaste: () => null,
2721
- onDrop: () => null,
2722
- onDelete: () => null,
2723
- enableExtensionDispatchTransaction: !0
2724
- }, this.isCapturingTransaction = !1, this.capturedTransaction = null, this.utils = {
2725
- getUpdatedPosition: or,
2726
- createMappablePosition: sr
2727
- }, this.setOptions(t), this.createExtensionManager(), this.createCommandManager(), this.createSchema(), this.on("beforeCreate", this.options.onBeforeCreate), this.emit("beforeCreate", { editor: this }), this.on("mount", this.options.onMount), this.on("unmount", this.options.onUnmount), this.on("contentError", this.options.onContentError), this.on("create", this.options.onCreate), this.on("update", this.options.onUpdate), this.on("selectionUpdate", this.options.onSelectionUpdate), this.on("transaction", this.options.onTransaction), this.on("focus", this.options.onFocus), this.on("blur", this.options.onBlur), this.on("destroy", this.options.onDestroy), this.on("drop", ({ event: o, slice: s, moved: i }) => this.options.onDrop(o, s, i)), this.on("paste", ({ event: o, slice: s }) => this.options.onPaste(o, s)), this.on("delete", this.options.onDelete);
2728
- const n = this.createDoc(), r = Vt(n, this.options.autofocus);
2729
- this.editorState = ze.create({
2730
- doc: n,
2731
- schema: this.schema,
2732
- selection: r || void 0
2733
- }), this.options.element && this.mount(this.options.element);
2734
- }
2735
- /**
2736
- * Attach the editor to the DOM, creating a new editor view.
2737
- */
2738
- mount(t) {
2739
- if (typeof document > "u")
2740
- throw new Error(
2741
- "[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment."
2742
- );
2743
- this.createView(t), this.emit("mount", { editor: this }), this.css && !document.head.contains(this.css) && document.head.appendChild(this.css), window.setTimeout(() => {
2744
- this.isDestroyed || (this.options.autofocus !== !1 && this.options.autofocus !== null && this.commands.focus(this.options.autofocus), this.emit("create", { editor: this }), this.isInitialized = !0);
2745
- }, 0);
2746
- }
2747
- /**
2748
- * Remove the editor from the DOM, but still allow remounting at a different point in time
2749
- */
2750
- unmount() {
2751
- if (this.editorView) {
2752
- const t = this.editorView.dom;
2753
- t?.editor && delete t.editor, this.editorView.destroy();
2754
- }
2755
- if (this.editorView = null, this.isInitialized = !1, this.css && !document.querySelectorAll(`.${this.className}`).length)
2756
- try {
2757
- typeof this.css.remove == "function" ? this.css.remove() : this.css.parentNode && this.css.parentNode.removeChild(this.css);
2758
- } catch (t) {
2759
- console.warn("Failed to remove CSS element:", t);
2760
- }
2761
- this.css = null, this.emit("unmount", { editor: this });
2762
- }
2763
- /**
2764
- * Returns the editor storage.
2765
- */
2766
- get storage() {
2767
- return this.extensionStorage;
2768
- }
2769
- /**
2770
- * An object of all registered commands.
2771
- */
2772
- get commands() {
2773
- return this.commandManager.commands;
2774
- }
421
+ ge.prototype = {
422
+ isLink: !1,
2775
423
  /**
2776
- * Create a command chain to call multiple commands at once.
424
+ * Return the string this token represents.
425
+ * @return {string}
2777
426
  */
2778
- chain() {
2779
- return this.commandManager.chain();
2780
- }
2781
- /**
2782
- * Check if a command or a command chain can be executed. Without executing it.
2783
- */
2784
- can() {
2785
- return this.commandManager.can();
2786
- }
2787
- /**
2788
- * Inject CSS styles.
2789
- */
2790
- injectCSS() {
2791
- this.options.injectCSS && typeof document < "u" && (this.css = Fr(Lr, this.options.injectNonce));
2792
- }
2793
- /**
2794
- * Update editor options.
2795
- *
2796
- * @param options A list of options
2797
- */
2798
- setOptions(t = {}) {
2799
- this.options = {
2800
- ...this.options,
2801
- ...t
2802
- }, !(!this.editorView || !this.state || this.isDestroyed) && (this.options.editorProps && this.view.setProps(this.options.editorProps), this.view.updateState(this.state));
2803
- }
2804
- /**
2805
- * Update editable state of the editor.
2806
- */
2807
- setEditable(t, n = !0) {
2808
- this.setOptions({ editable: t }), n && this.emit("update", { editor: this, transaction: this.state.tr, appendedTransactions: [] });
2809
- }
2810
- /**
2811
- * Returns whether the editor is editable.
2812
- */
2813
- get isEditable() {
2814
- return this.options.editable && this.view && this.view.editable;
2815
- }
2816
- /**
2817
- * Returns the editor view.
2818
- */
2819
- get view() {
2820
- return this.editorView ? this.editorView : new Proxy(
2821
- {
2822
- state: this.editorState,
2823
- updateState: (t) => {
2824
- this.editorState = t;
2825
- },
2826
- dispatch: (t) => {
2827
- this.dispatchTransaction(t);
2828
- },
2829
- // Stub some commonly accessed properties to prevent errors
2830
- composing: !1,
2831
- dragging: null,
2832
- editable: !0,
2833
- isDestroyed: !1
2834
- },
2835
- {
2836
- get: (t, n) => {
2837
- if (this.editorView)
2838
- return this.editorView[n];
2839
- if (n === "state")
2840
- return this.editorState;
2841
- if (n in t)
2842
- return Reflect.get(t, n);
2843
- throw new Error(
2844
- `[tiptap error]: The editor view is not available. Cannot access view['${n}']. The editor may not be mounted yet.`
2845
- );
2846
- }
2847
- }
2848
- );
2849
- }
427
+ toString() {
428
+ return this.v;
429
+ },
2850
430
  /**
2851
- * Returns the editor state.
431
+ * What should the value for this token be in the `href` HTML attribute?
432
+ * Returns the `.toString` value by default.
433
+ * @param {string} [scheme]
434
+ * @return {string}
2852
435
  */
2853
- get state() {
2854
- return this.editorView && (this.editorState = this.view.state), this.editorState;
2855
- }
436
+ toHref(t) {
437
+ return this.toString();
438
+ },
2856
439
  /**
2857
- * Register a ProseMirror plugin.
2858
- *
2859
- * @param plugin A ProseMirror plugin
2860
- * @param handlePlugins Control how to merge the plugin into the existing plugins.
2861
- * @returns The new editor state
440
+ * @param {Options} options Formatting options
441
+ * @returns {string}
2862
442
  */
2863
- registerPlugin(t, n) {
2864
- const r = qt(n) ? n(t, [...this.state.plugins]) : [...this.state.plugins, t], o = this.state.reconfigure({ plugins: r });
2865
- return this.view.updateState(o), o;
2866
- }
443
+ toFormattedString(t) {
444
+ const n = this.toString(), e = t.get("truncate", n, this), s = t.get("format", n, this);
445
+ return e && s.length > e ? s.substring(0, e) + "…" : s;
446
+ },
2867
447
  /**
2868
- * Unregister a ProseMirror plugin.
2869
448
  *
2870
- * @param nameOrPluginKeyToRemove The plugins name
2871
- * @returns The new editor state or undefined if the editor is destroyed
2872
- */
2873
- unregisterPlugin(t) {
2874
- if (this.isDestroyed)
2875
- return;
2876
- const n = this.state.plugins;
2877
- let r = n;
2878
- if ([].concat(t).forEach((s) => {
2879
- const i = typeof s == "string" ? `${s}$` : s.key;
2880
- r = r.filter((a) => !a.key.startsWith(i));
2881
- }), n.length === r.length)
2882
- return;
2883
- const o = this.state.reconfigure({
2884
- plugins: r
2885
- });
2886
- return this.view.updateState(o), o;
2887
- }
2888
- /**
2889
- * Creates an extension manager.
449
+ * @param {Options} options
450
+ * @returns {string}
2890
451
  */
2891
- createExtensionManager() {
2892
- var t, n;
2893
- const o = [...this.options.enableCoreExtensions ? [
2894
- ae,
2895
- re.configure({
2896
- blockSeparator: (n = (t = this.options.coreExtensionOptions) == null ? void 0 : t.clipboardTextSerializer) == null ? void 0 : n.blockSeparator
2897
- }),
2898
- oe,
2899
- le,
2900
- de,
2901
- fe,
2902
- ie,
2903
- ue,
2904
- se,
2905
- pe.configure({
2906
- direction: this.options.textDirection
2907
- })
2908
- ].filter((s) => typeof this.options.enableCoreExtensions == "object" ? this.options.enableCoreExtensions[s.name] !== !1 : !0) : [], ...this.options.extensions].filter((s) => ["extension", "node", "mark"].includes(s?.type));
2909
- this.extensionManager = new ct(o, this);
2910
- }
2911
- /**
2912
- * Creates an command manager.
2913
- */
2914
- createCommandManager() {
2915
- this.commandManager = new ot({
2916
- editor: this
2917
- });
2918
- }
2919
- /**
2920
- * Creates a ProseMirror schema.
2921
- */
2922
- createSchema() {
2923
- this.schema = this.extensionManager.schema;
2924
- }
2925
- /**
2926
- * Creates the initial document.
2927
- */
2928
- createDoc() {
2929
- let t;
2930
- try {
2931
- t = mt(this.options.content, this.schema, this.options.parseOptions, {
2932
- errorOnInvalidContent: this.options.enableContentCheck
2933
- });
2934
- } catch (n) {
2935
- if (!(n instanceof Error) || !["[tiptap error]: Invalid JSON content", "[tiptap error]: Invalid HTML content"].includes(n.message))
2936
- throw n;
2937
- this.emit("contentError", {
2938
- editor: this,
2939
- error: n,
2940
- disableCollaboration: () => {
2941
- "collaboration" in this.storage && typeof this.storage.collaboration == "object" && this.storage.collaboration && (this.storage.collaboration.isDisabled = !0), this.options.extensions = this.options.extensions.filter((r) => r.name !== "collaboration"), this.createExtensionManager();
2942
- }
2943
- }), t = mt(this.options.content, this.schema, this.options.parseOptions, {
2944
- errorOnInvalidContent: !1
2945
- });
2946
- }
2947
- return t;
2948
- }
452
+ toFormattedHref(t) {
453
+ return t.get("formatHref", this.toHref(t.get("defaultProtocol")), this);
454
+ },
2949
455
  /**
2950
- * Creates a ProseMirror view.
456
+ * The start index of this token in the original input string
457
+ * @returns {number}
2951
458
  */
2952
- createView(t) {
2953
- const { editorProps: n, enableExtensionDispatchTransaction: r } = this.options, o = n.dispatchTransaction || this.dispatchTransaction.bind(this), s = r ? this.extensionManager.dispatchTransaction(o) : o, i = n.transformPastedHTML, a = this.extensionManager.transformPastedHTML(i);
2954
- this.editorView = new Ke(t, {
2955
- ...n,
2956
- attributes: {
2957
- // add `role="textbox"` to the editor element
2958
- role: "textbox",
2959
- ...n?.attributes
2960
- },
2961
- dispatchTransaction: s,
2962
- transformPastedHTML: a,
2963
- state: this.editorState,
2964
- markViews: this.extensionManager.markViews,
2965
- nodeViews: this.extensionManager.nodeViews
2966
- });
2967
- const c = this.state.reconfigure({
2968
- plugins: this.extensionManager.plugins
2969
- });
2970
- this.view.updateState(c), this.prependClass(), this.injectCSS();
2971
- const l = this.view.dom;
2972
- l.editor = this;
2973
- }
459
+ startIndex() {
460
+ return this.tk[0].s;
461
+ },
2974
462
  /**
2975
- * Creates all node and mark views.
463
+ * The end index of this token in the original input string (up to this
464
+ * index but not including it)
465
+ * @returns {number}
2976
466
  */
2977
- createNodeViews() {
2978
- this.view.isDestroyed || this.view.setProps({
2979
- markViews: this.extensionManager.markViews,
2980
- nodeViews: this.extensionManager.nodeViews
2981
- });
2982
- }
467
+ endIndex() {
468
+ return this.tk[this.tk.length - 1].e;
469
+ },
2983
470
  /**
2984
- * Prepend class name to element.
2985
- */
2986
- prependClass() {
2987
- this.view.dom.className = `${this.className} ${this.view.dom.className}`;
2988
- }
2989
- captureTransaction(t) {
2990
- this.isCapturingTransaction = !0, t(), this.isCapturingTransaction = !1;
2991
- const n = this.capturedTransaction;
2992
- return this.capturedTransaction = null, n;
2993
- }
471
+ Returns an object of relevant values for this token, which includes keys
472
+ * type - Kind of token ('url', 'email', etc.)
473
+ * value - Original text
474
+ * href - The value that should be added to the anchor tag's href
475
+ attribute
476
+ @method toObject
477
+ @param {string} [protocol] `'http'` by default
478
+ */
479
+ toObject(t = J.defaultProtocol) {
480
+ return {
481
+ type: this.t,
482
+ value: this.toString(),
483
+ isLink: this.isLink,
484
+ href: this.toHref(t),
485
+ start: this.startIndex(),
486
+ end: this.endIndex()
487
+ };
488
+ },
2994
489
  /**
2995
- * The callback over which to send transactions (state updates) produced by the view.
2996
490
  *
2997
- * @param transaction An editor state transaction
2998
- */
2999
- dispatchTransaction(t) {
3000
- if (this.view.isDestroyed)
3001
- return;
3002
- if (this.isCapturingTransaction) {
3003
- if (!this.capturedTransaction) {
3004
- this.capturedTransaction = t;
3005
- return;
3006
- }
3007
- t.steps.forEach((f) => {
3008
- var d;
3009
- return (d = this.capturedTransaction) == null ? void 0 : d.step(f);
3010
- });
3011
- return;
3012
- }
3013
- const { state: n, transactions: r } = this.state.applyTransaction(t), o = !this.state.selection.eq(n.selection), s = r.includes(t), i = this.state;
3014
- if (this.emit("beforeTransaction", {
3015
- editor: this,
3016
- transaction: t,
3017
- nextState: n
3018
- }), !s)
3019
- return;
3020
- this.view.updateState(n), this.emit("transaction", {
3021
- editor: this,
3022
- transaction: t,
3023
- appendedTransactions: r.slice(1)
3024
- }), o && this.emit("selectionUpdate", {
3025
- editor: this,
3026
- transaction: t
3027
- });
3028
- const a = r.findLast((f) => f.getMeta("focus") || f.getMeta("blur")), c = a?.getMeta("focus"), l = a?.getMeta("blur");
3029
- c && this.emit("focus", {
3030
- editor: this,
3031
- event: c.event,
3032
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
3033
- transaction: a
3034
- }), l && this.emit("blur", {
3035
- editor: this,
3036
- event: l.event,
3037
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
3038
- transaction: a
3039
- }), !(t.getMeta("preventUpdate") || !r.some((f) => f.docChanged) || i.doc.eq(n.doc)) && this.emit("update", {
3040
- editor: this,
3041
- transaction: t,
3042
- appendedTransactions: r.slice(1)
3043
- });
3044
- }
3045
- /**
3046
- * Get attributes of the currently selected node or mark.
3047
- */
3048
- getAttributes(t) {
3049
- return Yn(this.state, t);
3050
- }
3051
- isActive(t, n) {
3052
- const r = typeof t == "string" ? t : null, o = typeof t == "string" ? n : t;
3053
- return rr(this.state, r, o);
3054
- }
3055
- /**
3056
- * Get the document as JSON.
491
+ * @param {Options} options Formatting option
3057
492
  */
3058
- getJSON() {
3059
- return this.state.doc.toJSON();
3060
- }
3061
- /**
3062
- * Get the document as HTML.
3063
- */
3064
- getHTML() {
3065
- return wt(this.state.doc.content, this.schema);
3066
- }
3067
- /**
3068
- * Get the document as text.
3069
- */
3070
- getText(t) {
3071
- const { blockSeparator: n = `
3072
-
3073
- `, textSerializers: r = {} } = t || {};
3074
- return Zn(this.state.doc, {
3075
- blockSeparator: n,
3076
- textSerializers: {
3077
- ...Zt(this.schema),
3078
- ...r
3079
- }
3080
- });
3081
- }
3082
- /**
3083
- * Check if there is no content.
3084
- */
3085
- get isEmpty() {
3086
- return Mt(this.state.doc);
3087
- }
493
+ toFormattedObject(t) {
494
+ return {
495
+ type: this.t,
496
+ value: this.toFormattedString(t),
497
+ isLink: this.isLink,
498
+ href: this.toFormattedHref(t),
499
+ start: this.startIndex(),
500
+ end: this.endIndex()
501
+ };
502
+ },
3088
503
  /**
3089
- * Destroy the editor.
504
+ * Whether this token should be rendered as a link according to the given options
505
+ * @param {Options} options
506
+ * @returns {boolean}
3090
507
  */
3091
- destroy() {
3092
- this.emit("destroy"), this.unmount(), this.removeAllListeners();
3093
- }
508
+ validate(t) {
509
+ return t.get("validate", this.toString(), this);
510
+ },
3094
511
  /**
3095
- * Check if the editor is already destroyed.
512
+ * Return an object that represents how this link should be rendered.
513
+ * @param {Options} options Formattinng options
3096
514
  */
3097
- get isDestroyed() {
3098
- var t, n;
3099
- return (n = (t = this.editorView) == null ? void 0 : t.isDestroyed) != null ? n : !0;
3100
- }
3101
- $node(t, n) {
3102
- var r;
3103
- return ((r = this.$doc) == null ? void 0 : r.querySelector(t, n)) || null;
3104
- }
3105
- $nodes(t, n) {
3106
- var r;
3107
- return ((r = this.$doc) == null ? void 0 : r.querySelectorAll(t, n)) || null;
3108
- }
3109
- $pos(t) {
3110
- const n = this.state.doc.resolve(t);
3111
- return new zr(n, this);
3112
- }
3113
- get $doc() {
3114
- return this.$pos(0);
515
+ render(t) {
516
+ const n = this, e = this.toHref(t.get("defaultProtocol")), s = t.get("formatHref", e, this), i = t.get("tagName", e, n), r = this.toFormattedString(t), a = {}, c = t.get("className", e, n), d = t.get("target", e, n), m = t.get("rel", e, n), E = t.getObj("attributes", e, n), u = t.getObj("events", e, n);
517
+ return a.href = s, c && (a.class = c), d && (a.target = d), m && (a.rel = m), E && Object.assign(a, E), {
518
+ tagName: i,
519
+ attributes: a,
520
+ content: r,
521
+ eventListeners: u
522
+ };
3115
523
  }
3116
524
  };
3117
- function fo(e) {
3118
- return new at({
3119
- find: e.find,
3120
- handler: ({ state: t, range: n, match: r }) => {
3121
- const o = x(e.getAttributes, void 0, r);
3122
- if (o === !1 || o === null)
3123
- return null;
3124
- const { tr: s } = t, i = r[r.length - 1], a = r[0];
3125
- if (i) {
3126
- const c = a.search(/\S/), l = n.from + a.indexOf(i), f = l + i.length;
3127
- if (Gt(n.from, n.to, t.doc).filter((u) => u.mark.type.excluded.find((h) => h === e.type && h !== u.mark.type)).filter((u) => u.to > l).length)
3128
- return null;
3129
- f < n.to && s.delete(f, n.to), l > n.from && s.delete(n.from + c, l);
3130
- const p = n.from + c + i.length;
3131
- s.addMark(n.from + c, p, e.type.create(o || {})), s.removeStoredMark(e.type);
3132
- }
3133
- },
3134
- undoable: e.undoable
3135
- });
3136
- }
3137
- function po(e) {
3138
- return new at({
3139
- find: e.find,
3140
- handler: ({ state: t, range: n, match: r }) => {
3141
- const o = x(e.getAttributes, void 0, r) || {}, { tr: s } = t, i = n.from;
3142
- let a = n.to;
3143
- const c = e.type.create(o);
3144
- if (r[1]) {
3145
- const l = r[0].lastIndexOf(r[1]);
3146
- let f = i + l;
3147
- f > a ? f = a : a = f + r[1].length;
3148
- const d = r[0][r[0].length - 1];
3149
- s.insertText(d, i + r[0].length - 1), s.replaceWith(f, a, c);
3150
- } else if (r[0]) {
3151
- const l = e.type.isInline ? i : i - 1;
3152
- s.insert(l, e.type.create(o)).delete(s.mapping.map(i), s.mapping.map(a));
3153
- }
3154
- s.scrollIntoView();
3155
- },
3156
- undoable: e.undoable
3157
- });
3158
- }
3159
- function mo(e) {
3160
- return new at({
3161
- find: e.find,
3162
- handler: ({ state: t, range: n, match: r }) => {
3163
- const o = t.doc.resolve(n.from), s = x(e.getAttributes, void 0, r) || {};
3164
- if (!o.node(-1).canReplaceWith(o.index(-1), o.indexAfter(-1), e.type))
3165
- return null;
3166
- t.tr.delete(n.from, n.to).setBlockType(n.from, n.from, e.type, s);
3167
- },
3168
- undoable: e.undoable
3169
- });
3170
- }
3171
- function ho(e) {
3172
- return new at({
3173
- find: e.find,
3174
- handler: ({ state: t, range: n, match: r, chain: o }) => {
3175
- const s = x(e.getAttributes, void 0, r) || {}, i = t.tr.delete(n.from, n.to), c = i.doc.resolve(n.from).blockRange(), l = c && he(c, e.type, s);
3176
- if (!l)
3177
- return null;
3178
- if (i.wrap(c, l), e.keepMarks && e.editor) {
3179
- const { selection: d, storedMarks: p } = t, { splittableMarks: u } = e.editor.extensionManager, m = p || d.$to.parentOffset && d.$from.marks();
3180
- if (m) {
3181
- const h = m.filter((g) => u.includes(g.type.name));
3182
- i.ensureMarks(h);
3183
- }
3184
- }
3185
- if (e.keepAttributes) {
3186
- const d = e.type.name === "bulletList" || e.type.name === "orderedList" ? "listItem" : "taskList";
3187
- o().updateAttributes(d, s).run();
3188
- }
3189
- const f = i.doc.resolve(n.from - 1).nodeBefore;
3190
- f && f.type === e.type && gt(i.doc, n.from - 1) && (!e.joinPredicate || e.joinPredicate(r, f)) && i.join(n.from - 1);
3191
- },
3192
- undoable: e.undoable
3193
- });
3194
- }
3195
- function go(e, t) {
3196
- const { selection: n } = e, { $from: r } = n;
3197
- if (n instanceof nt) {
3198
- const s = r.index();
3199
- return r.parent.canReplaceWith(s, s + 1, t);
3200
- }
3201
- let o = r.depth;
3202
- for (; o >= 0; ) {
3203
- const s = r.index(o);
3204
- if (r.node(o).contentMatchAt(s).matchType(t))
3205
- return !0;
3206
- o -= 1;
3207
- }
3208
- return !1;
3209
- }
3210
- var Vr = {};
3211
- vt(Vr, {
3212
- createAtomBlockMarkdownSpec: () => Hr,
3213
- createBlockMarkdownSpec: () => Ur,
3214
- createInlineMarkdownSpec: () => Kr,
3215
- parseAttributes: () => St,
3216
- parseIndentedBlocks: () => Jr,
3217
- renderNestedMarkdownContent: () => Qr,
3218
- serializeAttributes: () => Et
3219
- });
3220
- function St(e) {
3221
- if (!e?.trim())
3222
- return {};
3223
- const t = {}, n = [], r = e.replace(/["']([^"']*)["']/g, (l) => (n.push(l), `__QUOTED_${n.length - 1}__`)), o = r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);
3224
- if (o) {
3225
- const l = o.map((f) => f.trim().slice(1));
3226
- t.class = l.join(" ");
3227
- }
3228
- const s = r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);
3229
- s && (t.id = s[1]);
3230
- const i = /([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;
3231
- Array.from(r.matchAll(i)).forEach(([, l, f]) => {
3232
- var d;
3233
- const p = parseInt(((d = f.match(/__QUOTED_(\d+)__/)) == null ? void 0 : d[1]) || "0", 10), u = n[p];
3234
- u && (t[l] = u.slice(1, -1));
3235
- });
3236
- const c = r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g, "").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g, "").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g, "").trim();
3237
- return c && c.split(/\s+/).filter(Boolean).forEach((f) => {
3238
- f.match(/^[a-zA-Z][\w-]*$/) && (t[f] = !0);
3239
- }), t;
3240
- }
3241
- function Et(e) {
3242
- if (!e || Object.keys(e).length === 0)
3243
- return "";
3244
- const t = [];
3245
- return e.class && String(e.class).split(/\s+/).filter(Boolean).forEach((r) => t.push(`.${r}`)), e.id && t.push(`#${e.id}`), Object.entries(e).forEach(([n, r]) => {
3246
- n === "class" || n === "id" || (r === !0 ? t.push(n) : r !== !1 && r != null && t.push(`${n}="${String(r)}"`));
3247
- }), t.join(" ");
3248
- }
3249
- function Hr(e) {
3250
- const {
3251
- nodeName: t,
3252
- name: n,
3253
- parseAttributes: r = St,
3254
- serializeAttributes: o = Et,
3255
- defaultAttributes: s = {},
3256
- requiredAttributes: i = [],
3257
- allowedAttributes: a
3258
- } = e, c = n || t, l = (f) => {
3259
- if (!a)
3260
- return f;
3261
- const d = {};
3262
- return a.forEach((p) => {
3263
- p in f && (d[p] = f[p]);
3264
- }), d;
3265
- };
3266
- return {
3267
- parseMarkdown: (f, d) => {
3268
- const p = { ...s, ...f.attributes };
3269
- return d.createNode(t, p, []);
3270
- },
3271
- markdownTokenizer: {
3272
- name: t,
3273
- level: "block",
3274
- start(f) {
3275
- var d;
3276
- const p = new RegExp(`^:::${c}(?:\\s|$)`, "m"), u = (d = f.match(p)) == null ? void 0 : d.index;
3277
- return u !== void 0 ? u : -1;
3278
- },
3279
- tokenize(f, d, p) {
3280
- const u = new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`), m = f.match(u);
3281
- if (!m)
3282
- return;
3283
- const h = m[1] || "", g = r(h);
3284
- if (!i.find((y) => !(y in g)))
3285
- return {
3286
- type: t,
3287
- raw: m[0],
3288
- attributes: g
3289
- };
3290
- }
3291
- },
3292
- renderMarkdown: (f) => {
3293
- const d = l(f.attrs || {}), p = o(d), u = p ? ` {${p}}` : "";
3294
- return `:::${c}${u} :::`;
3295
- }
525
+ function Nt(t, n) {
526
+ class e extends ge {
527
+ constructor(i, r) {
528
+ super(i, r), this.t = t;
529
+ }
530
+ }
531
+ for (const s in n)
532
+ e.prototype[s] = n[s];
533
+ return e.t = t, e;
534
+ }
535
+ const ae = Nt("email", {
536
+ isLink: !0,
537
+ toHref() {
538
+ return "mailto:" + this.toString();
539
+ }
540
+ }), ce = Nt("text"), we = Nt("nl"), Z = Nt("url", {
541
+ isLink: !0,
542
+ /**
543
+ Lowercases relevant parts of the domain and adds the protocol if
544
+ required. Note that this will not escape unsafe HTML characters in the
545
+ URL.
546
+ @param {string} [scheme] default scheme (e.g., 'https')
547
+ @return {string} the full href
548
+ */
549
+ toHref(t = J.defaultProtocol) {
550
+ return this.hasProtocol() ? this.v : `${t}://${this.v}`;
551
+ },
552
+ /**
553
+ * Check whether this URL token has a protocol
554
+ * @return {boolean}
555
+ */
556
+ hasProtocol() {
557
+ const t = this.tk;
558
+ return t.length >= 2 && t[0].t !== _ && t[1].t === v;
559
+ }
560
+ }), S = (t) => new p(t);
561
+ function De({
562
+ groups: t
563
+ }) {
564
+ const n = t.domain.concat([mt, At, P, Tt, Lt, Rt, Ct, pt, O, qt, Q, St, Ot, yt, k, bt, q, kt]), e = [gt, v, Jt, y, Yt, Q, $, Xt, Vt, ot, rt, W, G, nt, et, st, it, at, ct, lt, ut, ht, dt, Et, ft], s = [mt, gt, At, Tt, Lt, Rt, Ct, pt, O, W, G, Q, St, Ot, yt, $, k, bt, q, kt], i = S(), r = o(i, q);
565
+ l(r, s, r), l(r, t.domain, r);
566
+ const a = S(), c = S(), d = S();
567
+ l(i, t.domain, a), l(i, t.scheme, c), l(i, t.slashscheme, d), l(a, s, r), l(a, t.domain, a);
568
+ const m = o(a, P);
569
+ o(r, P, m), o(c, P, m), o(d, P, m);
570
+ const E = o(r, y);
571
+ l(E, s, r), l(E, t.domain, r);
572
+ const u = S();
573
+ l(m, t.domain, u), l(u, t.domain, u);
574
+ const g = o(u, y);
575
+ l(g, t.domain, u);
576
+ const A = S(ae);
577
+ l(g, t.tld, A), l(g, t.utld, A), o(m, _, A);
578
+ const H = o(u, O);
579
+ o(H, O, H), l(H, t.domain, u), l(A, t.domain, u), o(A, y, g), o(A, O, H);
580
+ const T = o(A, v);
581
+ l(T, t.numeric, ae);
582
+ const C = o(a, O), w = o(a, y);
583
+ o(C, O, C), l(C, t.domain, a), l(w, s, r), l(w, t.domain, a);
584
+ const L = S(Z);
585
+ l(w, t.tld, L), l(w, t.utld, L), l(L, t.domain, a), l(L, s, r), o(L, y, w), o(L, O, C), o(L, P, m);
586
+ const Te = o(L, v), te = S(Z);
587
+ l(Te, t.numeric, te);
588
+ const R = S(Z), M = S();
589
+ l(R, n, R), l(R, e, M), l(M, n, R), l(M, e, M), o(L, k, R), o(te, k, R);
590
+ const It = o(c, v), Le = o(d, v), Re = o(Le, k), Ht = o(Re, k);
591
+ l(c, t.domain, a), o(c, y, w), o(c, O, C), l(d, t.domain, a), o(d, y, w), o(d, O, C), l(It, t.domain, R), o(It, k, R), o(It, $, R), l(Ht, t.domain, R), l(Ht, n, R), o(Ht, k, R);
592
+ const ee = [
593
+ [W, G],
594
+ // {}
595
+ [et, nt],
596
+ // []
597
+ [st, it],
598
+ // ()
599
+ [ot, rt],
600
+ // <>
601
+ [at, ct],
602
+ // ()
603
+ [lt, ut],
604
+ // 「」
605
+ [ht, dt],
606
+ // 『』
607
+ [Et, ft]
608
+ // <>
609
+ ];
610
+ for (let wt = 0; wt < ee.length; wt++) {
611
+ const [ne, Dt] = ee[wt], Y = o(R, ne);
612
+ o(M, ne, Y), o(Y, Dt, R);
613
+ const x = S(Z);
614
+ l(Y, n, x);
615
+ const z = S();
616
+ l(Y, e), l(x, n, x), l(x, e, z), l(z, n, x), l(z, e, z), o(x, Dt, R), o(z, Dt, R);
617
+ }
618
+ return o(i, _, L), o(i, _t, we), {
619
+ start: i,
620
+ tokens: fe
3296
621
  };
3297
622
  }
3298
- function Ur(e) {
3299
- const {
3300
- nodeName: t,
3301
- name: n,
3302
- getContent: r,
3303
- parseAttributes: o = St,
3304
- serializeAttributes: s = Et,
3305
- defaultAttributes: i = {},
3306
- content: a = "block",
3307
- allowedAttributes: c
3308
- } = e, l = n || t, f = (d) => {
3309
- if (!c)
3310
- return d;
3311
- const p = {};
3312
- return c.forEach((u) => {
3313
- u in d && (p[u] = d[u]);
3314
- }), p;
3315
- };
3316
- return {
3317
- parseMarkdown: (d, p) => {
3318
- let u;
3319
- if (r) {
3320
- const h = r(d);
3321
- u = typeof h == "string" ? [{ type: "text", text: h }] : h;
3322
- } else a === "block" ? u = p.parseChildren(d.tokens || []) : u = p.parseInline(d.tokens || []);
3323
- const m = { ...i, ...d.attributes };
3324
- return p.createNode(t, m, u);
3325
- },
3326
- markdownTokenizer: {
3327
- name: t,
3328
- level: "block",
3329
- start(d) {
3330
- var p;
3331
- const u = new RegExp(`^:::${l}`, "m"), m = (p = d.match(u)) == null ? void 0 : p.index;
3332
- return m !== void 0 ? m : -1;
3333
- },
3334
- tokenize(d, p, u) {
3335
- var m;
3336
- const h = new RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*\\n`), g = d.match(h);
3337
- if (!g)
3338
- return;
3339
- const [v, y = ""] = g, w = o(y);
3340
- let M = 1;
3341
- const k = v.length;
3342
- let S = "";
3343
- const E = /^:::([\w-]*)(\s.*)?/gm, A = d.slice(k);
3344
- for (E.lastIndex = 0; ; ) {
3345
- const C = E.exec(A);
3346
- if (C === null)
3347
- break;
3348
- const D = C.index, lt = C[1];
3349
- if (!((m = C[2]) != null && m.endsWith(":::"))) {
3350
- if (lt)
3351
- M += 1;
3352
- else if (M -= 1, M === 0) {
3353
- const q = A.slice(0, D);
3354
- S = q.trim();
3355
- const dt = d.slice(0, k + D + C[0].length);
3356
- let B = [];
3357
- if (S)
3358
- if (a === "block")
3359
- for (B = u.blockTokens(q), B.forEach((I) => {
3360
- I.text && (!I.tokens || I.tokens.length === 0) && (I.tokens = u.inlineTokens(I.text));
3361
- }); B.length > 0; ) {
3362
- const I = B[B.length - 1];
3363
- if (I.type === "paragraph" && (!I.text || I.text.trim() === ""))
3364
- B.pop();
3365
- else
3366
- break;
3367
- }
3368
- else
3369
- B = u.inlineTokens(S);
3370
- return {
3371
- type: t,
3372
- raw: dt,
3373
- attributes: w,
3374
- content: S,
3375
- tokens: B
3376
- };
3377
- }
3378
- }
3379
- }
3380
- }
3381
- },
3382
- renderMarkdown: (d, p) => {
3383
- const u = f(d.attrs || {}), m = s(u), h = m ? ` {${m}}` : "", g = p.renderChildren(d.content || [], `
3384
-
3385
- `);
3386
- return `:::${l}${h}
3387
-
3388
- ${g}
3389
-
3390
- :::`;
623
+ function Pe(t, n, e) {
624
+ let s = e.length, i = 0, r = [], a = [];
625
+ for (; i < s; ) {
626
+ let c = t, d = null, m = null, E = 0, u = null, g = -1;
627
+ for (; i < s && !(d = c.go(e[i].t)); )
628
+ a.push(e[i++]);
629
+ for (; i < s && (m = d || c.go(e[i].t)); )
630
+ d = null, c = m, c.accepts() ? (g = 0, u = c) : g >= 0 && g++, i++, E++;
631
+ if (g < 0)
632
+ i -= E, i < s && (a.push(e[i]), i++);
633
+ else {
634
+ a.length > 0 && (r.push(Mt(ce, n, a)), a = []), i -= g, E -= g;
635
+ const A = u.t, H = e.slice(i - E, i);
636
+ r.push(Mt(A, n, H));
3391
637
  }
3392
- };
3393
- }
3394
- function Wr(e) {
3395
- if (!e.trim())
3396
- return {};
3397
- const t = {}, n = /(\w+)=(?:"([^"]*)"|'([^']*)')/g;
3398
- let r = n.exec(e);
3399
- for (; r !== null; ) {
3400
- const [, o, s, i] = r;
3401
- t[o] = s || i, r = n.exec(e);
3402
638
  }
3403
- return t;
3404
- }
3405
- function qr(e) {
3406
- return Object.entries(e).filter(([, t]) => t != null).map(([t, n]) => `${t}="${n}"`).join(" ");
639
+ return a.length > 0 && r.push(Mt(ce, n, a)), r;
3407
640
  }
3408
- function Kr(e) {
3409
- const {
3410
- nodeName: t,
3411
- name: n,
3412
- getContent: r,
3413
- parseAttributes: o = Wr,
3414
- serializeAttributes: s = qr,
3415
- defaultAttributes: i = {},
3416
- selfClosing: a = !1,
3417
- allowedAttributes: c
3418
- } = e, l = n || t, f = (p) => {
3419
- if (!c)
3420
- return p;
3421
- const u = {};
3422
- return c.forEach((m) => {
3423
- const h = typeof m == "string" ? m : m.name, g = typeof m == "string" ? void 0 : m.skipIfDefault;
3424
- if (h in p) {
3425
- const v = p[h];
3426
- if (g !== void 0 && v === g)
3427
- return;
3428
- u[h] = v;
3429
- }
3430
- }), u;
3431
- }, d = l.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
3432
- return {
3433
- parseMarkdown: (p, u) => {
3434
- const m = { ...i, ...p.attributes };
3435
- if (a)
3436
- return u.createNode(t, m);
3437
- const h = r ? r(p) : p.content || "";
3438
- return h ? u.createNode(t, m, [u.createTextNode(h)]) : u.createNode(t, m, []);
3439
- },
3440
- markdownTokenizer: {
3441
- name: t,
3442
- level: "inline",
3443
- start(p) {
3444
- const u = a ? new RegExp(`\\[${d}\\s*[^\\]]*\\]`) : new RegExp(`\\[${d}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${d}\\]`), m = p.match(u), h = m?.index;
3445
- return h !== void 0 ? h : -1;
3446
- },
3447
- tokenize(p, u, m) {
3448
- const h = a ? new RegExp(`^\\[${d}\\s*([^\\]]*)\\]`) : new RegExp(`^\\[${d}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${d}\\]`), g = p.match(h);
3449
- if (!g)
3450
- return;
3451
- let v = "", y = "";
3452
- if (a) {
3453
- const [, M] = g;
3454
- y = M;
3455
- } else {
3456
- const [, M, k] = g;
3457
- y = M, v = k || "";
3458
- }
3459
- const w = o(y.trim());
3460
- return {
3461
- type: t,
3462
- raw: g[0],
3463
- content: v.trim(),
3464
- attributes: w
3465
- };
3466
- }
3467
- },
3468
- renderMarkdown: (p) => {
3469
- let u = "";
3470
- r ? u = r(p) : p.content && p.content.length > 0 && (u = p.content.filter((v) => v.type === "text").map((v) => v.text).join(""));
3471
- const m = f(p.attrs || {}), h = s(m), g = h ? ` ${h}` : "";
3472
- return a ? `[${l}${g}]` : `[${l}${g}]${u}[/${l}]`;
3473
- }
3474
- };
3475
- }
3476
- function Jr(e, t, n) {
3477
- var r, o, s, i;
3478
- const a = e.split(`
3479
- `), c = [];
3480
- let l = "", f = 0;
3481
- const d = t.baseIndentSize || 2;
3482
- for (; f < a.length; ) {
3483
- const p = a[f], u = p.match(t.itemPattern);
3484
- if (!u) {
3485
- if (c.length > 0)
3486
- break;
3487
- if (p.trim() === "") {
3488
- f += 1, l = `${l}${p}
3489
- `;
3490
- continue;
3491
- } else
3492
- return;
3493
- }
3494
- const m = t.extractItemData(u), { indentLevel: h, mainContent: g } = m;
3495
- l = `${l}${p}
3496
- `;
3497
- const v = [g];
3498
- for (f += 1; f < a.length; ) {
3499
- const k = a[f];
3500
- if (k.trim() === "") {
3501
- const E = a.slice(f + 1).findIndex((D) => D.trim() !== "");
3502
- if (E === -1)
3503
- break;
3504
- if ((((o = (r = a[f + 1 + E].match(/^(\s*)/)) == null ? void 0 : r[1]) == null ? void 0 : o.length) || 0) > h) {
3505
- v.push(k), l = `${l}${k}
3506
- `, f += 1;
3507
- continue;
3508
- } else
3509
- break;
3510
- }
3511
- if ((((i = (s = k.match(/^(\s*)/)) == null ? void 0 : s[1]) == null ? void 0 : i.length) || 0) > h)
3512
- v.push(k), l = `${l}${k}
3513
- `, f += 1;
3514
- else
3515
- break;
3516
- }
3517
- let y;
3518
- const w = v.slice(1);
3519
- if (w.length > 0) {
3520
- const k = w.map((S) => S.slice(h + d)).join(`
3521
- `);
3522
- k.trim() && (t.customNestedParser ? y = t.customNestedParser(k) : y = n.blockTokens(k));
3523
- }
3524
- const M = t.createToken(m, y);
3525
- c.push(M);
3526
- }
3527
- if (c.length !== 0)
3528
- return {
3529
- items: c,
3530
- raw: l
3531
- };
641
+ function Mt(t, n, e) {
642
+ const s = e[0].s, i = e[e.length - 1].e, r = n.slice(s, i);
643
+ return new t(r, e);
3532
644
  }
3533
- function Qr(e, t, n, r) {
3534
- if (!e || !Array.isArray(e.content))
3535
- return "";
3536
- const o = typeof n == "function" ? n(r) : n, [s, ...i] = e.content, a = t.renderChildren([s]);
3537
- let c = `${o}${a}`;
3538
- return i && i.length > 0 && i.forEach((l, f) => {
3539
- var d, p;
3540
- const u = (p = (d = t.renderChild) == null ? void 0 : d.call(t, l, f + 1)) != null ? p : t.renderChildren([l]);
3541
- if (u != null) {
3542
- const m = u.split(`
3543
- `).map((h) => h ? t.indent(h) : t.indent("")).join(`
3544
- `);
3545
- c += l.type === "paragraph" ? `
3546
-
3547
- ${m}` : `
3548
- ${m}`;
3549
- }
3550
- }), c;
645
+ const ve = typeof console < "u" && console && console.warn || (() => {
646
+ }), je = "until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.", h = {
647
+ scanner: null,
648
+ parser: null,
649
+ tokenQueue: [],
650
+ pluginQueue: [],
651
+ customSchemes: [],
652
+ initialized: !1
653
+ };
654
+ function Ue() {
655
+ return p.groups = {}, h.scanner = null, h.parser = null, h.tokenQueue = [], h.pluginQueue = [], h.customSchemes = [], h.initialized = !1, h;
656
+ }
657
+ function Me(t, n = !1) {
658
+ if (h.initialized && ve(`linkifyjs: already initialized - will not register custom scheme "${t}" ${je}`), !/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))
659
+ throw new Error(`linkifyjs: incorrect scheme format.
660
+ 1. Must only contain digits, lowercase ASCII letters or "-"
661
+ 2. Cannot start or end with "-"
662
+ 3. "-" cannot repeat`);
663
+ h.customSchemes.push([t, n]);
664
+ }
665
+ function xe() {
666
+ h.scanner = Ie(h.customSchemes);
667
+ for (let t = 0; t < h.tokenQueue.length; t++)
668
+ h.tokenQueue[t][1]({
669
+ scanner: h.scanner
670
+ });
671
+ h.parser = De(h.scanner.tokens);
672
+ for (let t = 0; t < h.pluginQueue.length; t++)
673
+ h.pluginQueue[t][1]({
674
+ scanner: h.scanner,
675
+ parser: h.parser
676
+ });
677
+ return h.initialized = !0, h;
3551
678
  }
3552
- function Zr(e, t, n = {}) {
3553
- const { state: r } = t, { doc: o, tr: s } = r, i = e;
3554
- o.descendants((a, c) => {
3555
- const l = s.mapping.map(c), f = s.mapping.map(c) + a.nodeSize;
3556
- let d = null;
3557
- if (a.marks.forEach((u) => {
3558
- if (u !== i)
3559
- return !1;
3560
- d = u;
3561
- }), !d)
3562
- return;
3563
- let p = !1;
3564
- if (Object.keys(n).forEach((u) => {
3565
- n[u] !== d.attrs[u] && (p = !0);
3566
- }), p) {
3567
- const u = e.type.create({
3568
- ...e.attrs,
3569
- ...n
3570
- });
3571
- s.removeMark(l, f, e.type), s.addMark(l, f, u);
3572
- }
3573
- }), s.docChanged && t.view.dispatch(s);
679
+ function Ae(t) {
680
+ return h.initialized || xe(), Pe(h.parser.start, t, me(h.scanner.start, t));
3574
681
  }
3575
- var vo = class me extends xt {
3576
- constructor() {
3577
- super(...arguments), this.type = "node";
682
+ Ae.scan = me;
683
+ function ze(t, n = null, e = null) {
684
+ if (n && typeof n == "object") {
685
+ if (e)
686
+ throw Error(`linkifyjs: Invalid link type ${n}; must be a string`);
687
+ e = n, n = null;
3578
688
  }
3579
- /**
3580
- * Create a new Node instance
3581
- * @param config - Node configuration object or a function that returns a configuration object
3582
- */
3583
- static create(t = {}) {
3584
- const n = typeof t == "function" ? t() : t;
3585
- return new me(n);
3586
- }
3587
- configure(t) {
3588
- return super.configure(t);
689
+ const s = new Zt(e), i = Ae(t), r = [];
690
+ for (let a = 0; a < i.length; a++) {
691
+ const c = i[a];
692
+ c.isLink && (!n || c.t === n) && s.check(c) && r.push(c.toFormattedObject(s));
3589
693
  }
3590
- extend(t) {
3591
- const n = typeof t == "function" ? t() : t;
3592
- return super.extend(n);
3593
- }
3594
- };
3595
- function bo(e) {
3596
- return new Rr({
3597
- find: e.find,
3598
- handler: ({ state: t, range: n, match: r, pasteEvent: o }) => {
3599
- const s = x(e.getAttributes, void 0, r, o);
3600
- if (s === !1 || s === null)
3601
- return null;
3602
- const { tr: i } = t, a = r[r.length - 1], c = r[0];
3603
- let l = n.to;
3604
- if (a) {
3605
- const f = c.search(/\S/), d = n.from + c.indexOf(a), p = d + a.length;
3606
- if (Gt(n.from, n.to, t.doc).filter((m) => m.mark.type.excluded.find((g) => g === e.type && g !== m.mark.type)).filter((m) => m.to > d).length)
3607
- return null;
3608
- p < n.to && i.delete(p, n.to), d > n.from && i.delete(n.from + f, d), l = n.from + f + a.length, i.addMark(n.from + f, l, e.type.create(s || {})), i.removeStoredMark(e.type);
3609
- }
3610
- }
3611
- });
694
+ return r;
3612
695
  }
3613
696
  export {
3614
- ot as CommandManager,
3615
- lo as Editor,
3616
- xt as Extendable,
3617
- N as Extension,
3618
- at as InputRule,
3619
- Yt as MappablePosition,
3620
- Nr as Mark,
3621
- vo as Node,
3622
- zr as NodePos,
3623
- Rr as PasteRule,
3624
- x as callOrReturn,
3625
- go as canInsertNode,
3626
- Fn as combineTransactionSteps,
3627
- zt as commands,
3628
- Hr as createAtomBlockMarkdownSpec,
3629
- Ur as createBlockMarkdownSpec,
3630
- rt as createChainableState,
3631
- mt as createDocument,
3632
- Kr as createInlineMarkdownSpec,
3633
- sr as createMappablePosition,
3634
- U as createNodeFromContent,
3635
- Fr as createStyleTag,
3636
- Vn as defaultBlockAt,
3637
- Pt as deleteProps,
3638
- K as elementFromString,
3639
- _r as extensions,
3640
- oo as findChildrenInRange,
3641
- Qn as findDuplicates,
3642
- it as findParentNode,
3643
- Hn as findParentNodeClosestToPos,
3644
- kt as flattenExtensions,
3645
- Kn as fromString,
3646
- Yn as getAttributes,
3647
- Kt as getAttributesFromExtensions,
3648
- er as getChangedRanges,
3649
- b as getExtensionField,
3650
- wt as getHTMLFromFragment,
3651
- Wt as getMarkAttributes,
3652
- yt as getMarkRange,
3653
- R as getMarkType,
3654
- Gt as getMarksBetween,
3655
- so as getNodeAtPosition,
3656
- Gn as getNodeAttributes,
3657
- T as getNodeType,
3658
- et as getRenderedAttributes,
3659
- Jn as getSchemaByResolvedExtensions,
3660
- F as getSchemaTypeByName,
3661
- st as getSchemaTypeNameByName,
3662
- Y as getSplittedAttributes,
3663
- Zn as getText,
3664
- Qt as getTextBetween,
3665
- nr as getTextContentFromNodes,
3666
- Zt as getTextSerializersFromSchema,
3667
- or as getUpdatedPosition,
3668
- Nt as injectExtensionAttributesToParseRule,
3669
- Pr as inputRulesPlugin,
3670
- rr as isActive,
3671
- Ct as isAndroid,
3672
- io as isAtEndOfNode,
3673
- ao as isAtStartOfNode,
3674
- Un as isEmptyObject,
3675
- Bt as isExtensionRulesEnabled,
3676
- qt as isFunction,
3677
- Ot as isList,
3678
- Ut as isMacOS,
3679
- ht as isMarkActive,
3680
- W as isNodeActive,
3681
- Mt as isNodeEmpty,
3682
- co as isNodeSelection,
3683
- Ir as isNumber,
3684
- Q as isPlainObject,
3685
- bt as isRegExp,
3686
- un as isSafari,
3687
- Ft as isTextSelection,
3688
- tt as isiOS,
3689
- fo as markInputRule,
3690
- bo as markPasteRule,
3691
- Vr as markdown,
3692
- qn as mergeAttributes,
3693
- te as mergeDeep,
3694
- _ as minMax,
3695
- po as nodeInputRule,
3696
- X as objectIncludes,
3697
- St as parseAttributes,
3698
- Jr as parseIndentedBlocks,
3699
- Dr as pasteRulesPlugin,
3700
- Xn as removeDuplicates,
3701
- Qr as renderNestedMarkdownContent,
3702
- Jt as resolveExtensions,
3703
- Vt as resolveFocusPosition,
3704
- hn as selectionToInsertionEnd,
3705
- Et as serializeAttributes,
3706
- H as sortExtensions,
3707
- L as splitExtensions,
3708
- mo as textblockTypeInputRule,
3709
- Zr as updateMarkViewAttributes,
3710
- ho as wrappingInputRule
697
+ ge as MultiToken,
698
+ Zt as Options,
699
+ p as State,
700
+ Nt as createTokenClass,
701
+ ze as find,
702
+ xe as init,
703
+ Me as registerCustomProtocol,
704
+ Ue as reset,
705
+ He as stringToArray,
706
+ Ae as tokenize
3711
707
  };