@burdenoff/microfe-support 2026.1031.2 → 2026.1114.1

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 (147) hide show
  1. package/dist/_virtual/_rolldown/runtime.js +6 -0
  2. package/dist/dev/main.d.ts +0 -0
  3. package/dist/generated/global-operations.d.ts +60 -60
  4. package/dist/node_modules/@tiptap/core/dist/index.js +949 -674
  5. package/dist/node_modules/@tiptap/core/dist/index.js.map +1 -1
  6. package/dist/node_modules/@tiptap/extension-blockquote/dist/index.js.map +1 -1
  7. package/dist/node_modules/@tiptap/extension-bold/dist/index.js.map +1 -1
  8. package/dist/node_modules/@tiptap/extension-code/dist/index.js +14 -3
  9. package/dist/node_modules/@tiptap/extension-code/dist/index.js.map +1 -1
  10. package/dist/node_modules/@tiptap/extension-code-block/dist/index.js +1 -3
  11. package/dist/node_modules/@tiptap/extension-code-block/dist/index.js.map +1 -1
  12. package/dist/node_modules/@tiptap/extension-document/dist/index.js.map +1 -1
  13. package/dist/node_modules/@tiptap/extension-hard-break/dist/index.js.map +1 -1
  14. package/dist/node_modules/@tiptap/extension-heading/dist/index.js +4 -1
  15. package/dist/node_modules/@tiptap/extension-heading/dist/index.js.map +1 -1
  16. package/dist/node_modules/@tiptap/extension-horizontal-rule/dist/index.js.map +1 -1
  17. package/dist/node_modules/@tiptap/extension-italic/dist/index.js.map +1 -1
  18. package/dist/node_modules/@tiptap/extension-link/dist/index.js +76 -51
  19. package/dist/node_modules/@tiptap/extension-link/dist/index.js.map +1 -1
  20. package/dist/node_modules/@tiptap/extension-list/dist/index.js +143 -127
  21. package/dist/node_modules/@tiptap/extension-list/dist/index.js.map +1 -1
  22. package/dist/node_modules/@tiptap/extension-paragraph/dist/index.js +3 -2
  23. package/dist/node_modules/@tiptap/extension-paragraph/dist/index.js.map +1 -1
  24. package/dist/node_modules/@tiptap/extension-placeholder/dist/index.js.map +1 -1
  25. package/dist/node_modules/@tiptap/extension-strike/dist/index.js.map +1 -1
  26. package/dist/node_modules/@tiptap/extension-text/dist/index.js.map +1 -1
  27. package/dist/node_modules/@tiptap/extension-underline/dist/index.js +21 -11
  28. package/dist/node_modules/@tiptap/extension-underline/dist/index.js.map +1 -1
  29. package/dist/node_modules/@tiptap/extensions/dist/index.js +8 -9
  30. package/dist/node_modules/@tiptap/extensions/dist/index.js.map +1 -1
  31. package/dist/node_modules/@tiptap/react/dist/index.js +70 -49
  32. package/dist/node_modules/@tiptap/react/dist/index.js.map +1 -1
  33. package/dist/node_modules/@tiptap/starter-kit/dist/index.js.map +1 -1
  34. package/dist/node_modules/fast-equals/dist/es/index.js +108 -76
  35. package/dist/node_modules/fast-equals/dist/es/index.js.map +1 -1
  36. package/dist/node_modules/linkifyjs/dist/linkify.js +127 -113
  37. package/dist/node_modules/linkifyjs/dist/linkify.js.map +1 -1
  38. package/dist/node_modules/prosemirror-dropcursor/dist/index.js +1 -1
  39. package/dist/node_modules/prosemirror-dropcursor/dist/index.js.map +1 -1
  40. package/dist/node_modules/prosemirror-history/dist/index.js +21 -14
  41. package/dist/node_modules/prosemirror-history/dist/index.js.map +1 -1
  42. package/dist/node_modules/prosemirror-model/dist/index.js +98 -105
  43. package/dist/node_modules/prosemirror-model/dist/index.js.map +1 -1
  44. package/dist/node_modules/prosemirror-schema-list/dist/index.js +37 -34
  45. package/dist/node_modules/prosemirror-schema-list/dist/index.js.map +1 -1
  46. package/dist/node_modules/prosemirror-transform/dist/index.js +153 -101
  47. package/dist/node_modules/prosemirror-transform/dist/index.js.map +1 -1
  48. package/dist/node_modules/prosemirror-view/dist/index.js +742 -693
  49. package/dist/node_modules/prosemirror-view/dist/index.js.map +1 -1
  50. package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js +96 -17
  51. package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js.map +1 -1
  52. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js +55 -0
  53. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js.map +1 -0
  54. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.js +53 -0
  55. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.js.map +1 -0
  56. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +53 -0
  57. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js.map +1 -0
  58. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js +45 -0
  59. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js.map +1 -0
  60. package/dist/node_modules/use-sync-external-store/shim/index.js +11 -0
  61. package/dist/node_modules/use-sync-external-store/shim/index.js.map +1 -0
  62. package/dist/node_modules/use-sync-external-store/shim/with-selector.js +11 -0
  63. package/dist/node_modules/use-sync-external-store/shim/with-selector.js.map +1 -0
  64. package/dist/support/SupportAdminRoot.d.ts +2 -2
  65. package/dist/support/SupportAdminRoutes.d.ts +1 -1
  66. package/dist/support/SupportUserRoot.d.ts +2 -2
  67. package/dist/support/SupportUserRoutes.d.ts +1 -1
  68. package/dist/support/components/NotificationToast.d.ts +2 -2
  69. package/dist/support/components/PageLayout.d.ts +4 -4
  70. package/dist/support/components/RouteHelpers.d.ts +1 -1
  71. package/dist/support/components/analytics/CategoryBreakdown.d.ts +1 -1
  72. package/dist/support/components/analytics/MetricCard.d.ts +1 -1
  73. package/dist/support/components/analytics/PriorityBreakdown.d.ts +1 -1
  74. package/dist/support/components/analytics/SLAReport.d.ts +1 -1
  75. package/dist/support/components/analytics/SatisfactionDistribution.d.ts +1 -1
  76. package/dist/support/components/analytics/TopAgents.d.ts +1 -1
  77. package/dist/support/components/analytics/TrendChart.d.ts +1 -1
  78. package/dist/support/components/careers/BulkCandidateActionGuidance.d.ts +1 -1
  79. package/dist/support/components/careers/BulkCandidateDialogs.d.ts +7 -7
  80. package/dist/support/components/careers/BulkOperationFeedback.d.ts +8 -8
  81. package/dist/support/components/careers/BulkSelectionSummary.d.ts +2 -2
  82. package/dist/support/components/careers/RichTextEditor.d.ts +1 -2
  83. package/dist/support/components/careers/RichTextEditor.js.map +1 -1
  84. package/dist/support/components/kb/ArticleForm.d.ts +1 -1
  85. package/dist/support/components/settings/CannedResponsesSettings.d.ts +1 -1
  86. package/dist/support/components/settings/SLAPoliciesSettings.d.ts +1 -1
  87. package/dist/support/components/settings/TicketCategoriesSettings.d.ts +1 -1
  88. package/dist/support/components/tickets/AttachmentList.d.ts +1 -1
  89. package/dist/support/components/tickets/MarkdownContent.d.ts +1 -1
  90. package/dist/support/components/tickets/MessageComposer.d.ts +1 -1
  91. package/dist/support/components/tickets/MessageThread.d.ts +2 -2
  92. package/dist/support/components/tickets/TicketDetailHeader.d.ts +2 -2
  93. package/dist/support/components/tickets/TicketHeader.d.ts +2 -2
  94. package/dist/support/components/tickets/TicketSidebar.d.ts +2 -2
  95. package/dist/support/components/tickets/TriagePanel.d.ts +2 -2
  96. package/dist/support/constants/pipeline.d.ts +0 -6
  97. package/dist/support/events/rybbit.d.ts +1 -1
  98. package/dist/support/hooks/useAnalyticsOperations.d.ts +10 -25
  99. package/dist/support/hooks/useAnalyticsOperations.js +40 -39
  100. package/dist/support/hooks/useAnalyticsOperations.js.map +1 -1
  101. package/dist/support/hooks/useAttachmentsFailedToast.d.ts +1 -1
  102. package/dist/support/hooks/useChatOperations.d.ts +2 -2
  103. package/dist/support/hooks/useKnowledgeBaseOperations.d.ts +7 -13
  104. package/dist/support/hooks/useKnowledgeBaseOperations.js +84 -83
  105. package/dist/support/hooks/useKnowledgeBaseOperations.js.map +1 -1
  106. package/dist/support/hooks/useRegisterFooter.d.ts +1 -1
  107. package/dist/support/hooks/useSettingsOperations.d.ts +7 -16
  108. package/dist/support/hooks/useSupportAttachments.d.ts +1 -1
  109. package/dist/support/hooks/useTicketListOperations.d.ts +3 -6
  110. package/dist/support/hooks/useTicketOperations.d.ts +5 -11
  111. package/dist/support/hooks/useTicketOperations.js +80 -79
  112. package/dist/support/hooks/useTicketOperations.js.map +1 -1
  113. package/dist/support/pages/AnalyticsPage.d.ts +1 -1
  114. package/dist/support/pages/ArticleDetailAdminPage.d.ts +1 -1
  115. package/dist/support/pages/ArticleDetailUserPage.d.ts +1 -1
  116. package/dist/support/pages/ContactInquiriesPage.d.ts +1 -1
  117. package/dist/support/pages/ContactInquiryDetailPage.d.ts +1 -1
  118. package/dist/support/pages/CreateArticlePage.d.ts +1 -1
  119. package/dist/support/pages/CreateTicketPage.d.ts +1 -1
  120. package/dist/support/pages/EditArticlePage.d.ts +1 -1
  121. package/dist/support/pages/InterviewersPage.d.ts +1 -1
  122. package/dist/support/pages/JobApplicationDetailPage.d.ts +1 -2
  123. package/dist/support/pages/JobApplicationsPage.d.ts +1 -1
  124. package/dist/support/pages/JobPostingDetailPage.d.ts +1 -1
  125. package/dist/support/pages/JobPostingsPage.d.ts +1 -1
  126. package/dist/support/pages/KnowledgeBaseAdminPage.d.ts +1 -1
  127. package/dist/support/pages/KnowledgeBaseUserPage.d.ts +1 -1
  128. package/dist/support/pages/SettingsPage.d.ts +1 -1
  129. package/dist/support/pages/SettingsPage.js.map +1 -1
  130. package/dist/support/pages/TicketDetailAdminPage.d.ts +1 -1
  131. package/dist/support/pages/TicketDetailUserPage.d.ts +1 -1
  132. package/dist/support/pages/TicketDetailUserPage.js.map +1 -1
  133. package/dist/support/pages/TicketListPage.d.ts +1 -1
  134. package/dist/support/providers/SupportProvider.d.ts +2 -2
  135. package/dist/support/store/supportStore.d.ts +2 -2
  136. package/dist/support/utils/bulkCandidateTargetQuery.d.ts +1 -1
  137. package/dist/support/utils/cn.d.ts +1 -1
  138. package/dist/support/utils/index.d.ts +1 -1
  139. package/dist/support/utils/markdown.d.ts +0 -1
  140. package/dist/support/utils/refetch.d.ts +12 -0
  141. package/dist/support/utils/refetch.js +7 -0
  142. package/dist/support/utils/refetch.js.map +1 -0
  143. package/dist/support/utils/ticketFilters.d.ts +2 -2
  144. package/dist/support/utils/uiTokens.d.ts +1 -1
  145. package/dist/test/dom.d.ts +1 -0
  146. package/dist/test/setup.d.ts +1 -0
  147. package/package.json +65 -54
@@ -1,15 +1,15 @@
1
1
  import { ReplaceAroundStep as e, canJoin as t, canSplit as n, findWrapping as r, liftTarget as i } from "../../prosemirror-transform/dist/index.js";
2
- import { Fragment as a, NodeRange as o, Slice as s } from "../../prosemirror-model/dist/index.js";
2
+ import { Fragment as a, NodeRange as o, NodeType as s, Slice as c } from "../../prosemirror-model/dist/index.js";
3
3
  // node_modules/prosemirror-schema-list/dist/index.js
4
- function c(e, t = null) {
4
+ function l(e, t = null) {
5
5
  return function(n, r) {
6
6
  let { $from: i, $to: a } = n.selection, o = i.blockRange(a);
7
7
  if (!o) return !1;
8
8
  let s = r ? n.tr : null;
9
- return l(s, o, e, t) ? (r && r(s.scrollIntoView()), !0) : !1;
9
+ return u(s, o, e, t) ? (r && r(s.scrollIntoView()), !0) : !1;
10
10
  };
11
11
  }
12
- function l(e, t, n, i = null) {
12
+ function u(e, t, n, i = null) {
13
13
  let a = !1, s = t, c = t.$from.doc;
14
14
  if (t.depth >= 2 && t.$from.node(t.depth - 1).type.compatibleContent(n) && t.startIndex == 0) {
15
15
  if (t.$from.index(t.depth - 1) == 0) return !1;
@@ -17,58 +17,61 @@ function l(e, t, n, i = null) {
17
17
  s = new o(e, e, t.depth), t.endIndex < t.parent.childCount && (t = new o(t.$from, c.resolve(t.$to.end(t.depth)), t.depth)), a = !0;
18
18
  }
19
19
  let l = r(s, n, i, t);
20
- return l ? (e && u(e, t, l, a, n), !0) : !1;
20
+ return l ? (e && d(e, t, l, a, n), !0) : !1;
21
21
  }
22
- function u(t, r, i, o, c) {
22
+ function d(t, r, i, o, s) {
23
23
  let l = a.empty;
24
24
  for (let e = i.length - 1; e >= 0; e--) l = a.from(i[e].type.create(i[e].attrs, l));
25
- t.step(new e(r.start - (o ? 2 : 0), r.end, r.start, r.end, new s(l, 0, 0), i.length, !0));
25
+ t.step(new e(r.start - (o ? 2 : 0), r.end, r.start, r.end, new c(l, 0, 0), i.length, !0));
26
26
  let u = 0;
27
- for (let e = 0; e < i.length; e++) i[e].type == c && (u = e + 1);
27
+ for (let e = 0; e < i.length; e++) i[e].type == s && (u = e + 1);
28
28
  let d = i.length - u, f = r.start + i.length - (o ? 2 : 0), p = r.parent;
29
- for (let e = r.startIndex, i = r.endIndex, a = !0; e < i; e++, a = !1) !a && n(t.doc, f, d) && (t.split(f, d), f += 2 * d), f += p.child(e).nodeSize;
29
+ for (let e = r.startIndex, i = r.endIndex, a = !0; e < i; e++, a = !1) !a && d && n(t.doc, f, d) && (t.split(f, d), f += 2 * d), f += p.child(e).nodeSize;
30
30
  return t;
31
31
  }
32
- function d(e) {
32
+ function f(e, t) {
33
+ return e instanceof s ? t == e : e.indexOf(t) > -1;
34
+ }
35
+ function p(e) {
33
36
  return function(t, n) {
34
- let { $from: r, $to: i } = t.selection, a = r.blockRange(i, (t) => t.childCount > 0 && t.firstChild.type == e);
35
- return a ? n ? r.node(a.depth - 1).type == e ? f(t, n, e, a) : p(t, n, a) : !0 : !1;
37
+ let { $from: r, $to: i } = t.selection, a = r.blockRange(i, (t) => t.childCount > 0 && f(e, t.firstChild.type));
38
+ return a ? n ? f(e, r.node(a.depth - 1).type) ? m(t, n, a) : h(t, n, a) : !0 : !1;
36
39
  };
37
40
  }
38
- function f(n, r, c, l) {
39
- let u = n.tr, d = l.end, f = l.$to.end(l.depth);
40
- d < f && (u.step(new e(d - 1, f, d, f, new s(a.from(c.create(null, l.parent.copy())), 1, 0), 1, !0)), l = new o(u.doc.resolve(l.$from.pos), u.doc.resolve(f), l.depth));
41
- let p = i(l);
41
+ function m(n, r, s) {
42
+ let l = n.tr, u = s.end, d = s.$to.end(s.depth), f = s.parent.child(s.endIndex - 1).type;
43
+ u < d && (l.step(new e(u - 1, d, u, d, new c(a.from(f.create(null, s.parent.copy())), 1, 0), 1, !0)), s = new o(l.doc.resolve(s.$from.pos), l.doc.resolve(d), s.depth));
44
+ let p = i(s);
42
45
  if (p == null) return !1;
43
- u.lift(l, p);
44
- let m = u.doc.resolve(u.mapping.map(d, -1) - 1);
45
- return t(u.doc, m.pos) && m.nodeBefore.type == m.nodeAfter.type && u.join(m.pos), r(u.scrollIntoView()), !0;
46
+ l.lift(s, p);
47
+ let m = l.doc.resolve(l.mapping.map(u, -1) - 1);
48
+ return t(l.doc, m.pos) && m.nodeBefore.type == m.nodeAfter.type && l.join(m.pos), r(l.scrollIntoView()), !0;
46
49
  }
47
- function p(t, n, r) {
50
+ function h(t, n, r) {
48
51
  let i = t.tr, o = r.parent;
49
52
  for (let e = r.end, t = r.endIndex - 1, n = r.startIndex; t > n; t--) e -= o.child(t).nodeSize, i.delete(e - 1, e + 1);
50
- let c = i.doc.resolve(r.start), l = c.nodeAfter;
51
- if (i.mapping.map(r.end) != r.start + c.nodeAfter.nodeSize) return !1;
52
- let u = r.startIndex == 0, d = r.endIndex == o.childCount, f = c.node(-1), p = c.index(-1);
53
+ let s = i.doc.resolve(r.start), l = s.nodeAfter;
54
+ if (i.mapping.map(r.end) != r.start + s.nodeAfter.nodeSize) return !1;
55
+ let u = r.startIndex == 0, d = r.endIndex == o.childCount, f = s.node(-1), p = s.index(-1);
53
56
  if (!f.canReplace(p + +!u, p + 1, l.content.append(d ? a.empty : a.from(o)))) return !1;
54
- let m = c.pos, h = m + l.nodeSize;
55
- return i.step(new e(m - +!!u, h + +!!d, m + 1, h - 1, new s((u ? a.empty : a.from(o.copy(a.empty))).append(d ? a.empty : a.from(o.copy(a.empty))), +!u, +!d), +!u)), n(i.scrollIntoView()), !0;
57
+ let m = s.pos, h = m + l.nodeSize;
58
+ return i.step(new e(m - +!!u, h + +!!d, m + 1, h - 1, new c((u ? a.empty : a.from(o.copy(a.empty))).append(d ? a.empty : a.from(o.copy(a.empty))), +!u, +!d), +!u)), n(i.scrollIntoView()), !0;
56
59
  }
57
- function m(t) {
60
+ function g(t) {
58
61
  return function(n, r) {
59
- let { $from: i, $to: o } = n.selection, c = i.blockRange(o, (e) => e.childCount > 0 && e.firstChild.type == t);
60
- if (!c) return !1;
61
- let l = c.startIndex;
62
+ let { $from: i, $to: o } = n.selection, s = i.blockRange(o, (e) => e.childCount > 0 && f(t, e.firstChild.type));
63
+ if (!s) return !1;
64
+ let l = s.startIndex;
62
65
  if (l == 0) return !1;
63
- let u = c.parent, d = u.child(l - 1);
64
- if (d.type != t) return !1;
66
+ let u = s.parent, d = u.child(l - 1);
67
+ if (!f(t, d.type)) return !1;
65
68
  if (r) {
66
- let i = d.lastChild && d.lastChild.type == u.type, o = a.from(i ? t.create() : null), l = new s(a.from(t.create(null, a.from(u.type.create(null, o)))), i ? 3 : 1, 0), f = c.start, p = c.end;
67
- r(n.tr.step(new e(f - (i ? 3 : 1), p, f, p, l, 1, !0)).scrollIntoView());
69
+ let t = d.lastChild && d.lastChild.type == u.type, i = a.from(t ? d.lastChild.lastChild.type.create() : null), o = new c(a.from(d.type.create(null, a.from(u.type.create(null, i)))), t ? 3 : 1, 0), l = s.start, f = s.end;
70
+ r(n.tr.step(new e(l - (t ? 3 : 1), f, l, f, o, 1, !0)).scrollIntoView());
68
71
  }
69
72
  return !0;
70
73
  };
71
74
  }
72
- export { d as liftListItem, m as sinkListItem, c as wrapInList, l as wrapRangeInList };
75
+ export { p as liftListItem, g as sinkListItem, l as wrapInList, u as wrapRangeInList };
73
76
 
74
77
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["wrapInList","state","range","$from","$to","tr","dispatch","wrapRangeInList","listType","attrs","doJoin","outerRange","doc","$insert","NodeRange","wrap","findWrapping","doWrapInList","content","Fragment","i","wrappers","ReplaceAroundStep","joinBefore","Slice","found","splitDepth","splitPos","parent","e","first","canSplit","liftListItem","node","itemType","liftToOuterList","liftOutOfList","end","endOfList","target","liftTarget","$after","canJoin","list","pos","$start","item","atStart","atEnd","indexBefore","start","sinkListItem","startIndex","nodeBefore","nestedBefore","inner","slice","before","after"],"sources":["../../../../node_modules/prosemirror-schema-list/dist/index.js"],"sourcesContent":["import { findWrapping, ReplaceAroundStep, canSplit, liftTarget, canJoin } from 'prosemirror-transform';\nimport { NodeRange, Fragment, Slice } from 'prosemirror-model';\nimport { Selection } from 'prosemirror-state';\n\nconst olDOM = [\"ol\", 0], ulDOM = [\"ul\", 0], liDOM = [\"li\", 0];\n/**\nAn ordered list [node spec](https://prosemirror.net/docs/ref/#model.NodeSpec). Has a single\nattribute, `order`, which determines the number at which the list\nstarts counting, and defaults to 1. Represented as an `<ol>`\nelement.\n*/\nconst orderedList = {\n attrs: { order: { default: 1, validate: \"number\" } },\n parseDOM: [{ tag: \"ol\", getAttrs(dom) {\n return { order: dom.hasAttribute(\"start\") ? +dom.getAttribute(\"start\") : 1 };\n } }],\n toDOM(node) {\n return node.attrs.order == 1 ? olDOM : [\"ol\", { start: node.attrs.order }, 0];\n }\n};\n/**\nA bullet list node spec, represented in the DOM as `<ul>`.\n*/\nconst bulletList = {\n parseDOM: [{ tag: \"ul\" }],\n toDOM() { return ulDOM; }\n};\n/**\nA list item (`<li>`) spec.\n*/\nconst listItem = {\n parseDOM: [{ tag: \"li\" }],\n toDOM() { return liDOM; },\n defining: true\n};\nfunction add(obj, props) {\n let copy = {};\n for (let prop in obj)\n copy[prop] = obj[prop];\n for (let prop in props)\n copy[prop] = props[prop];\n return copy;\n}\n/**\nConvenience function for adding list-related node types to a map\nspecifying the nodes for a schema. Adds\n[`orderedList`](https://prosemirror.net/docs/ref/#schema-list.orderedList) as `\"ordered_list\"`,\n[`bulletList`](https://prosemirror.net/docs/ref/#schema-list.bulletList) as `\"bullet_list\"`, and\n[`listItem`](https://prosemirror.net/docs/ref/#schema-list.listItem) as `\"list_item\"`.\n\n`itemContent` determines the content expression for the list items.\nIf you want the commands defined in this module to apply to your\nlist structure, it should have a shape like `\"paragraph block*\"` or\n`\"paragraph (ordered_list | bullet_list)*\"`. `listGroup` can be\ngiven to assign a group name to the list node types, for example\n`\"block\"`.\n*/\nfunction addListNodes(nodes, itemContent, listGroup) {\n return nodes.append({\n ordered_list: add(orderedList, { content: \"list_item+\", group: listGroup }),\n bullet_list: add(bulletList, { content: \"list_item+\", group: listGroup }),\n list_item: add(listItem, { content: itemContent })\n });\n}\n/**\nReturns a command function that wraps the selection in a list with\nthe given type an attributes. If `dispatch` is null, only return a\nvalue to indicate whether this is possible, but don't actually\nperform the change.\n*/\nfunction wrapInList(listType, attrs = null) {\n return function (state, dispatch) {\n let { $from, $to } = state.selection;\n let range = $from.blockRange($to);\n if (!range)\n return false;\n let tr = dispatch ? state.tr : null;\n if (!wrapRangeInList(tr, range, listType, attrs))\n return false;\n if (dispatch)\n dispatch(tr.scrollIntoView());\n return true;\n };\n}\n/**\nTry to wrap the given node range in a list of the given type.\nReturn `true` when this is possible, `false` otherwise. When `tr`\nis non-null, the wrapping is added to that transaction. When it is\n`null`, the function only queries whether the wrapping is\npossible.\n*/\nfunction wrapRangeInList(tr, range, listType, attrs = null) {\n let doJoin = false, outerRange = range, doc = range.$from.doc;\n // This is at the top of an existing list item\n if (range.depth >= 2 && range.$from.node(range.depth - 1).type.compatibleContent(listType) && range.startIndex == 0) {\n // Don't do anything if this is the top of the list\n if (range.$from.index(range.depth - 1) == 0)\n return false;\n let $insert = doc.resolve(range.start - 2);\n outerRange = new NodeRange($insert, $insert, range.depth);\n if (range.endIndex < range.parent.childCount)\n range = new NodeRange(range.$from, doc.resolve(range.$to.end(range.depth)), range.depth);\n doJoin = true;\n }\n let wrap = findWrapping(outerRange, listType, attrs, range);\n if (!wrap)\n return false;\n if (tr)\n doWrapInList(tr, range, wrap, doJoin, listType);\n return true;\n}\nfunction doWrapInList(tr, range, wrappers, joinBefore, listType) {\n let content = Fragment.empty;\n for (let i = wrappers.length - 1; i >= 0; i--)\n content = Fragment.from(wrappers[i].type.create(wrappers[i].attrs, content));\n tr.step(new ReplaceAroundStep(range.start - (joinBefore ? 2 : 0), range.end, range.start, range.end, new Slice(content, 0, 0), wrappers.length, true));\n let found = 0;\n for (let i = 0; i < wrappers.length; i++)\n if (wrappers[i].type == listType)\n found = i + 1;\n let splitDepth = wrappers.length - found;\n let splitPos = range.start + wrappers.length - (joinBefore ? 2 : 0), parent = range.parent;\n for (let i = range.startIndex, e = range.endIndex, first = true; i < e; i++, first = false) {\n if (!first && canSplit(tr.doc, splitPos, splitDepth)) {\n tr.split(splitPos, splitDepth);\n splitPos += 2 * splitDepth;\n }\n splitPos += parent.child(i).nodeSize;\n }\n return tr;\n}\n/**\nBuild a command that splits a non-empty textblock at the top level\nof a list item by also splitting that list item.\n*/\nfunction splitListItem(itemType, itemAttrs) {\n return function (state, dispatch) {\n let { $from, $to, node } = state.selection;\n if ((node && node.isBlock) || $from.depth < 2 || !$from.sameParent($to))\n return false;\n let grandParent = $from.node(-1);\n if (grandParent.type != itemType)\n return false;\n if ($from.parent.content.size == 0 && $from.node(-1).childCount == $from.indexAfter(-1)) {\n // In an empty block. If this is a nested list, the wrapping\n // list item should be split. Otherwise, bail out and let next\n // command handle lifting.\n if ($from.depth == 3 || $from.node(-3).type != itemType ||\n $from.index(-2) != $from.node(-2).childCount - 1)\n return false;\n if (dispatch) {\n let wrap = Fragment.empty;\n let depthBefore = $from.index(-1) ? 1 : $from.index(-2) ? 2 : 3;\n // Build a fragment containing empty versions of the structure\n // from the outer list item to the parent node of the cursor\n for (let d = $from.depth - depthBefore; d >= $from.depth - 3; d--)\n wrap = Fragment.from($from.node(d).copy(wrap));\n let depthAfter = $from.indexAfter(-1) < $from.node(-2).childCount ? 1\n : $from.indexAfter(-2) < $from.node(-3).childCount ? 2 : 3;\n // Add a second list item with an empty default start node\n wrap = wrap.append(Fragment.from(itemType.createAndFill()));\n let start = $from.before($from.depth - (depthBefore - 1));\n let tr = state.tr.replace(start, $from.after(-depthAfter), new Slice(wrap, 4 - depthBefore, 0));\n let sel = -1;\n tr.doc.nodesBetween(start, tr.doc.content.size, (node, pos) => {\n if (sel > -1)\n return false;\n if (node.isTextblock && node.content.size == 0)\n sel = pos + 1;\n });\n if (sel > -1)\n tr.setSelection(Selection.near(tr.doc.resolve(sel)));\n dispatch(tr.scrollIntoView());\n }\n return true;\n }\n let nextType = $to.pos == $from.end() ? grandParent.contentMatchAt(0).defaultType : null;\n let tr = state.tr.delete($from.pos, $to.pos);\n let types = nextType ? [itemAttrs ? { type: itemType, attrs: itemAttrs } : null, { type: nextType }] : undefined;\n if (!canSplit(tr.doc, $from.pos, 2, types))\n return false;\n if (dispatch)\n dispatch(tr.split($from.pos, 2, types).scrollIntoView());\n return true;\n };\n}\n/**\nActs like [`splitListItem`](https://prosemirror.net/docs/ref/#schema-list.splitListItem), but\nwithout resetting the set of active marks at the cursor.\n*/\nfunction splitListItemKeepMarks(itemType, itemAttrs) {\n let split = splitListItem(itemType, itemAttrs);\n return (state, dispatch) => {\n return split(state, dispatch && (tr => {\n let marks = state.storedMarks || (state.selection.$to.parentOffset && state.selection.$from.marks());\n if (marks)\n tr.ensureMarks(marks);\n dispatch(tr);\n }));\n };\n}\n/**\nCreate a command to lift the list item around the selection up into\na wrapping list.\n*/\nfunction liftListItem(itemType) {\n return function (state, dispatch) {\n let { $from, $to } = state.selection;\n let range = $from.blockRange($to, node => node.childCount > 0 && node.firstChild.type == itemType);\n if (!range)\n return false;\n if (!dispatch)\n return true;\n if ($from.node(range.depth - 1).type == itemType) // Inside a parent list\n return liftToOuterList(state, dispatch, itemType, range);\n else // Outer list node\n return liftOutOfList(state, dispatch, range);\n };\n}\nfunction liftToOuterList(state, dispatch, itemType, range) {\n let tr = state.tr, end = range.end, endOfList = range.$to.end(range.depth);\n if (end < endOfList) {\n // There are siblings after the lifted items, which must become\n // children of the last item\n tr.step(new ReplaceAroundStep(end - 1, endOfList, end, endOfList, new Slice(Fragment.from(itemType.create(null, range.parent.copy())), 1, 0), 1, true));\n range = new NodeRange(tr.doc.resolve(range.$from.pos), tr.doc.resolve(endOfList), range.depth);\n }\n const target = liftTarget(range);\n if (target == null)\n return false;\n tr.lift(range, target);\n let $after = tr.doc.resolve(tr.mapping.map(end, -1) - 1);\n if (canJoin(tr.doc, $after.pos) && $after.nodeBefore.type == $after.nodeAfter.type)\n tr.join($after.pos);\n dispatch(tr.scrollIntoView());\n return true;\n}\nfunction liftOutOfList(state, dispatch, range) {\n let tr = state.tr, list = range.parent;\n // Merge the list items into a single big item\n for (let pos = range.end, i = range.endIndex - 1, e = range.startIndex; i > e; i--) {\n pos -= list.child(i).nodeSize;\n tr.delete(pos - 1, pos + 1);\n }\n let $start = tr.doc.resolve(range.start), item = $start.nodeAfter;\n if (tr.mapping.map(range.end) != range.start + $start.nodeAfter.nodeSize)\n return false;\n let atStart = range.startIndex == 0, atEnd = range.endIndex == list.childCount;\n let parent = $start.node(-1), indexBefore = $start.index(-1);\n if (!parent.canReplace(indexBefore + (atStart ? 0 : 1), indexBefore + 1, item.content.append(atEnd ? Fragment.empty : Fragment.from(list))))\n return false;\n let start = $start.pos, end = start + item.nodeSize;\n // Strip off the surrounding list. At the sides where we're not at\n // the end of the list, the existing list is closed. At sides where\n // this is the end, it is overwritten to its end.\n tr.step(new ReplaceAroundStep(start - (atStart ? 1 : 0), end + (atEnd ? 1 : 0), start + 1, end - 1, new Slice((atStart ? Fragment.empty : Fragment.from(list.copy(Fragment.empty)))\n .append(atEnd ? Fragment.empty : Fragment.from(list.copy(Fragment.empty))), atStart ? 0 : 1, atEnd ? 0 : 1), atStart ? 0 : 1));\n dispatch(tr.scrollIntoView());\n return true;\n}\n/**\nCreate a command to sink the list item around the selection down\ninto an inner list.\n*/\nfunction sinkListItem(itemType) {\n return function (state, dispatch) {\n let { $from, $to } = state.selection;\n let range = $from.blockRange($to, node => node.childCount > 0 && node.firstChild.type == itemType);\n if (!range)\n return false;\n let startIndex = range.startIndex;\n if (startIndex == 0)\n return false;\n let parent = range.parent, nodeBefore = parent.child(startIndex - 1);\n if (nodeBefore.type != itemType)\n return false;\n if (dispatch) {\n let nestedBefore = nodeBefore.lastChild && nodeBefore.lastChild.type == parent.type;\n let inner = Fragment.from(nestedBefore ? itemType.create() : null);\n let slice = new Slice(Fragment.from(itemType.create(null, Fragment.from(parent.type.create(null, inner)))), nestedBefore ? 3 : 1, 0);\n let before = range.start, after = range.end;\n dispatch(state.tr.step(new ReplaceAroundStep(before - (nestedBefore ? 3 : 1), after, before, after, slice, 1, true))\n .scrollIntoView());\n }\n return true;\n };\n}\n\nexport { addListNodes, bulletList, liftListItem, listItem, orderedList, sinkListItem, splitListItem, splitListItemKeepMarks, wrapInList, wrapRangeInList };\n"],"ignoreList":[0],"mappings":";;;AAsEA,SAASA,EAAW,GAAU,IAAQ,MAAM;CACxC,OAAO,SAAU,GAAO,GAAU;EAC9B,IAAI,EAAE,UAAO,WAAQC,EAAM,WACvBC,IAAQC,EAAM,WAAWC,CAAG;EAChC,IAAI,CAACF,GACD,OAAO;EACX,IAAIG,IAAKC,IAAWL,EAAM,KAAK;EAK/B,OAJKM,EAAgBF,GAAIH,GAAOM,GAAUC,CAAK,KAE3CH,KACAA,EAASD,EAAG,eAAe,CAAC,GACzB,MAHI;CAIf;AACJ;AAQA,SAASE,EAAgB,GAAI,GAAO,GAAU,IAAQ,MAAM;CACxD,IAAIG,IAAS,IAAOC,IAAaT,GAAOU,IAAMV,EAAM,MAAM;CAE1D,IAAIA,EAAM,SAAS,KAAKA,EAAM,MAAM,KAAKA,EAAM,QAAQ,CAAC,CAAC,CAAC,KAAK,kBAAkBM,CAAQ,KAAKN,EAAM,cAAc,GAAG;EAEjH,IAAIA,EAAM,MAAM,MAAMA,EAAM,QAAQ,CAAC,KAAK,GACtC,OAAO;EACX,IAAIW,IAAUD,EAAI,QAAQV,EAAM,QAAQ,CAAC;EAIzC,AAHA,IAAa,IAAIY,EAAUD,GAASA,GAASX,EAAM,KAAK,GACpDA,EAAM,WAAWA,EAAM,OAAO,eAC9B,IAAQ,IAAIY,EAAUZ,EAAM,OAAOU,EAAI,QAAQV,EAAM,IAAI,IAAIA,EAAM,KA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;EACjG,IAAI,CAAChC,GACD,OAAO;EACX,IAAIkD,IAAalD,EAAM;EACvB,IAAIkD,KAAc,GACd,OAAO;EACX,IAAIxB,IAAS1B,EAAM,QAAQmD,IAAazB,EAAO,MAAMwB,IAAa,CAAC;EACnE,IAAIC,EAAW,QAAQnB,GACnB,OAAO;EACX,IAAI5B,GAAU;GACV,IAAIgD,IAAeD,EAAW,aAAaA,EAAW,UAAU,QAAQzB,EAAO,MAC3E2B,IAAQpC,EAAS,KAAKmC,IAAepB,EAAS,OAAO,IAAI,IAAI,GAC7DsB,IAAQ,IAAIhC,EAAML,EAAS,KAAKe,EAAS,OAAO,MAAMf,EAAS,KAAKS,EAAO,KAAK,OAAO,MAAM2B,CAAK,CAAC,CAAC,CAAC,GAAGD,IAAe,IAAI,GAAG,CAAC,GAC/HG,IAASvD,EAAM,OAAOwD,IAAQxD,EAAM;GACxC,EAASD,EAAM,GAAG,KAAK,IAAIqB,EAAkBmC,KAAUH,IAAe,IAAI,IAAII,GAAOD,GAAQC,GAAOF,GAAO,GAAG,EAAI,CAAC,CAAC,CAC/G,eAAe,CAAC;EACzB;EACA,OAAO;CACX;AACJ"}
1
+ {"version":3,"file":"index.js","names":["wrapInList","state","range","$from","$to","tr","dispatch","wrapRangeInList","listType","attrs","doJoin","outerRange","doc","$insert","NodeRange","wrap","findWrapping","doWrapInList","content","Fragment","i","wrappers","ReplaceAroundStep","joinBefore","Slice","found","splitDepth","splitPos","parent","e","first","canSplit","isItem","itemType","NodeType","type","liftListItem","node","liftToOuterList","liftOutOfList","end","endOfList","target","liftTarget","$after","canJoin","list","pos","$start","item","atStart","atEnd","indexBefore","start","sinkListItem","startIndex","nodeBefore","nestedBefore","inner","slice","before","after"],"sources":["../../../../node_modules/prosemirror-schema-list/dist/index.js"],"sourcesContent":["import { findWrapping, ReplaceAroundStep, canSplit, liftTarget, canJoin } from 'prosemirror-transform';\nimport { NodeRange, Fragment, Slice, NodeType } from 'prosemirror-model';\nimport { Selection } from 'prosemirror-state';\n\nconst olDOM = [\"ol\", 0], ulDOM = [\"ul\", 0], liDOM = [\"li\", 0];\n/**\nAn ordered list [node spec](https://prosemirror.net/docs/ref/#model.NodeSpec). Has a single\nattribute, `order`, which determines the number at which the list\nstarts counting, and defaults to 1. Represented as an `<ol>`\nelement.\n*/\nconst orderedList = {\n attrs: { order: { default: 1, validate: \"number\" } },\n parseDOM: [{ tag: \"ol\", getAttrs(dom) {\n return { order: dom.hasAttribute(\"start\") ? +dom.getAttribute(\"start\") : 1 };\n } }],\n toDOM(node) {\n return node.attrs.order == 1 ? olDOM : [\"ol\", { start: node.attrs.order }, 0];\n }\n};\n/**\nA bullet list node spec, represented in the DOM as `<ul>`.\n*/\nconst bulletList = {\n parseDOM: [{ tag: \"ul\" }],\n toDOM() { return ulDOM; }\n};\n/**\nA list item (`<li>`) spec.\n*/\nconst listItem = {\n parseDOM: [{ tag: \"li\" }],\n toDOM() { return liDOM; },\n defining: true\n};\nfunction add(obj, props) {\n let copy = {};\n for (let prop in obj)\n copy[prop] = obj[prop];\n for (let prop in props)\n copy[prop] = props[prop];\n return copy;\n}\n/**\nConvenience function for adding list-related node types to a map\nspecifying the nodes for a schema. Adds\n[`orderedList`](https://prosemirror.net/docs/ref/#schema-list.orderedList) as `\"ordered_list\"`,\n[`bulletList`](https://prosemirror.net/docs/ref/#schema-list.bulletList) as `\"bullet_list\"`, and\n[`listItem`](https://prosemirror.net/docs/ref/#schema-list.listItem) as `\"list_item\"`.\n\n`itemContent` determines the content expression for the list items.\nIf you want the commands defined in this module to apply to your\nlist structure, it should have a shape like `\"paragraph block*\"` or\n`\"paragraph (ordered_list | bullet_list)*\"`. `listGroup` can be\ngiven to assign a group name to the list node types, for example\n`\"block\"`.\n*/\nfunction addListNodes(nodes, itemContent, listGroup) {\n return nodes.append({\n ordered_list: add(orderedList, { content: \"list_item+\", group: listGroup }),\n bullet_list: add(bulletList, { content: \"list_item+\", group: listGroup }),\n list_item: add(listItem, { content: itemContent })\n });\n}\n/**\nReturns a command function that wraps the selection in a list with\nthe given type an attributes. If `dispatch` is null, only return a\nvalue to indicate whether this is possible, but don't actually\nperform the change.\n*/\nfunction wrapInList(listType, attrs = null) {\n return function (state, dispatch) {\n let { $from, $to } = state.selection;\n let range = $from.blockRange($to);\n if (!range)\n return false;\n let tr = dispatch ? state.tr : null;\n if (!wrapRangeInList(tr, range, listType, attrs))\n return false;\n if (dispatch)\n dispatch(tr.scrollIntoView());\n return true;\n };\n}\n/**\nTry to wrap the given node range in a list of the given type.\nReturn `true` when this is possible, `false` otherwise. When `tr`\nis non-null, the wrapping is added to that transaction. When it is\n`null`, the function only queries whether the wrapping is\npossible.\n*/\nfunction wrapRangeInList(tr, range, listType, attrs = null) {\n let doJoin = false, outerRange = range, doc = range.$from.doc;\n // This is at the top of an existing list item\n if (range.depth >= 2 && range.$from.node(range.depth - 1).type.compatibleContent(listType) && range.startIndex == 0) {\n // Don't do anything if this is the top of the list\n if (range.$from.index(range.depth - 1) == 0)\n return false;\n let $insert = doc.resolve(range.start - 2);\n outerRange = new NodeRange($insert, $insert, range.depth);\n if (range.endIndex < range.parent.childCount)\n range = new NodeRange(range.$from, doc.resolve(range.$to.end(range.depth)), range.depth);\n doJoin = true;\n }\n let wrap = findWrapping(outerRange, listType, attrs, range);\n if (!wrap)\n return false;\n if (tr)\n doWrapInList(tr, range, wrap, doJoin, listType);\n return true;\n}\nfunction doWrapInList(tr, range, wrappers, joinBefore, listType) {\n let content = Fragment.empty;\n for (let i = wrappers.length - 1; i >= 0; i--)\n content = Fragment.from(wrappers[i].type.create(wrappers[i].attrs, content));\n tr.step(new ReplaceAroundStep(range.start - (joinBefore ? 2 : 0), range.end, range.start, range.end, new Slice(content, 0, 0), wrappers.length, true));\n let found = 0;\n for (let i = 0; i < wrappers.length; i++)\n if (wrappers[i].type == listType)\n found = i + 1;\n let splitDepth = wrappers.length - found;\n let splitPos = range.start + wrappers.length - (joinBefore ? 2 : 0), parent = range.parent;\n for (let i = range.startIndex, e = range.endIndex, first = true; i < e; i++, first = false) {\n if (!first && splitDepth && canSplit(tr.doc, splitPos, splitDepth)) {\n tr.split(splitPos, splitDepth);\n splitPos += 2 * splitDepth;\n }\n splitPos += parent.child(i).nodeSize;\n }\n return tr;\n}\nfunction isItem(itemType, type) {\n return itemType instanceof NodeType ? type == itemType : itemType.indexOf(type) > -1;\n}\n/**\nBuild a command that splits a non-empty textblock at the top level\nof a list item by also splitting that list item. `itemType` may be\nan array, when there are multiple node types that act as list\nitems. The new item gets the same type as the item that was split.\n*/\nfunction splitListItem(itemType, itemAttrs) {\n return function (state, dispatch) {\n let { $from, $to, node } = state.selection;\n if ((node && node.isBlock) || $from.depth < 2 || !$from.sameParent($to))\n return false;\n let grandParent = $from.node(-1);\n if (!isItem(itemType, grandParent.type))\n return false;\n if ($from.parent.content.size == 0 && $from.node(-1).childCount == $from.indexAfter(-1)) {\n // In an empty block. If this is a nested list, the wrapping\n // list item should be split. Otherwise, bail out and let next\n // command handle lifting.\n if ($from.depth == 3 || !isItem(itemType, $from.node(-3).type) ||\n $from.index(-2) != $from.node(-2).childCount - 1)\n return false;\n if (dispatch) {\n let wrap = Fragment.empty;\n let depthBefore = $from.index(-1) ? 1 : $from.index(-2) ? 2 : 3;\n // Build a fragment containing empty versions of the structure\n // from the outer list item to the parent node of the cursor\n for (let d = $from.depth - depthBefore; d >= $from.depth - 3; d--)\n wrap = Fragment.from($from.node(d).copy(wrap));\n let depthAfter = $from.indexAfter(-1) < $from.node(-2).childCount ? 1\n : $from.indexAfter(-2) < $from.node(-3).childCount ? 2 : 3;\n // Add a second list item with an empty default start node\n wrap = wrap.append(Fragment.from($from.node(-3).type.createAndFill()));\n let start = $from.before($from.depth - (depthBefore - 1));\n let tr = state.tr.replace(start, $from.after(-depthAfter), new Slice(wrap, 4 - depthBefore, 0));\n let sel = -1;\n tr.doc.nodesBetween(start, tr.doc.content.size, (node, pos) => {\n if (sel > -1)\n return false;\n if (node.isTextblock && node.content.size == 0)\n sel = pos + 1;\n });\n if (sel > -1)\n tr.setSelection(Selection.near(tr.doc.resolve(sel)));\n dispatch(tr.scrollIntoView());\n }\n return true;\n }\n let nextType = $to.pos == $from.end() ? grandParent.contentMatchAt(0).defaultType : null;\n let tr = state.tr.delete($from.pos, $to.pos);\n let types = nextType ? [itemAttrs ? { type: grandParent.type, attrs: itemAttrs } : null, { type: nextType }] : undefined;\n if (!canSplit(tr.doc, $from.pos, 2, types))\n return false;\n if (dispatch)\n dispatch(tr.split($from.pos, 2, types).scrollIntoView());\n return true;\n };\n}\n/**\nActs like [`splitListItem`](https://prosemirror.net/docs/ref/#schema-list.splitListItem), but\nwithout resetting the set of active marks at the cursor.\n*/\nfunction splitListItemKeepMarks(itemType, itemAttrs) {\n let split = splitListItem(itemType, itemAttrs);\n return (state, dispatch) => {\n return split(state, dispatch && (tr => {\n let marks = state.storedMarks || (state.selection.$to.parentOffset && state.selection.$from.marks());\n if (marks)\n tr.ensureMarks(marks);\n dispatch(tr);\n }));\n };\n}\n/**\nCreate a command to lift the list item around the selection up into\na wrapping list. `itemType` may be an array of list item types.\n*/\nfunction liftListItem(itemType) {\n return function (state, dispatch) {\n let { $from, $to } = state.selection;\n let range = $from.blockRange($to, node => node.childCount > 0 && isItem(itemType, node.firstChild.type));\n if (!range)\n return false;\n if (!dispatch)\n return true;\n if (isItem(itemType, $from.node(range.depth - 1).type)) // Inside a parent list\n return liftToOuterList(state, dispatch, range);\n else // Outer list node\n return liftOutOfList(state, dispatch, range);\n };\n}\nfunction liftToOuterList(state, dispatch, range) {\n let tr = state.tr, end = range.end, endOfList = range.$to.end(range.depth);\n let itemType = range.parent.child(range.endIndex - 1).type;\n if (end < endOfList) {\n // There are siblings after the lifted items, which must become\n // children of the last item\n tr.step(new ReplaceAroundStep(end - 1, endOfList, end, endOfList, new Slice(Fragment.from(itemType.create(null, range.parent.copy())), 1, 0), 1, true));\n range = new NodeRange(tr.doc.resolve(range.$from.pos), tr.doc.resolve(endOfList), range.depth);\n }\n const target = liftTarget(range);\n if (target == null)\n return false;\n tr.lift(range, target);\n let $after = tr.doc.resolve(tr.mapping.map(end, -1) - 1);\n if (canJoin(tr.doc, $after.pos) && $after.nodeBefore.type == $after.nodeAfter.type)\n tr.join($after.pos);\n dispatch(tr.scrollIntoView());\n return true;\n}\nfunction liftOutOfList(state, dispatch, range) {\n let tr = state.tr, list = range.parent;\n // Merge the list items into a single big item\n for (let pos = range.end, i = range.endIndex - 1, e = range.startIndex; i > e; i--) {\n pos -= list.child(i).nodeSize;\n tr.delete(pos - 1, pos + 1);\n }\n let $start = tr.doc.resolve(range.start), item = $start.nodeAfter;\n if (tr.mapping.map(range.end) != range.start + $start.nodeAfter.nodeSize)\n return false;\n let atStart = range.startIndex == 0, atEnd = range.endIndex == list.childCount;\n let parent = $start.node(-1), indexBefore = $start.index(-1);\n if (!parent.canReplace(indexBefore + (atStart ? 0 : 1), indexBefore + 1, item.content.append(atEnd ? Fragment.empty : Fragment.from(list))))\n return false;\n let start = $start.pos, end = start + item.nodeSize;\n // Strip off the surrounding list. At the sides where we're not at\n // the end of the list, the existing list is closed. At sides where\n // this is the end, it is overwritten to its end.\n tr.step(new ReplaceAroundStep(start - (atStart ? 1 : 0), end + (atEnd ? 1 : 0), start + 1, end - 1, new Slice((atStart ? Fragment.empty : Fragment.from(list.copy(Fragment.empty)))\n .append(atEnd ? Fragment.empty : Fragment.from(list.copy(Fragment.empty))), atStart ? 0 : 1, atEnd ? 0 : 1), atStart ? 0 : 1));\n dispatch(tr.scrollIntoView());\n return true;\n}\n/**\nCreate a command to sink the list item around the selection down\ninto an inner list. `itemType` may be an array of list item types.\n*/\nfunction sinkListItem(itemType) {\n return function (state, dispatch) {\n let { $from, $to } = state.selection;\n let range = $from.blockRange($to, node => node.childCount > 0 && isItem(itemType, node.firstChild.type));\n if (!range)\n return false;\n let startIndex = range.startIndex;\n if (startIndex == 0)\n return false;\n let parent = range.parent, nodeBefore = parent.child(startIndex - 1);\n if (!isItem(itemType, nodeBefore.type))\n return false;\n if (dispatch) {\n let nestedBefore = nodeBefore.lastChild && nodeBefore.lastChild.type == parent.type;\n let inner = Fragment.from(nestedBefore ? nodeBefore.lastChild.lastChild.type.create() : null);\n let slice = new Slice(Fragment.from(nodeBefore.type.create(null, Fragment.from(parent.type.create(null, inner)))), nestedBefore ? 3 : 1, 0);\n let before = range.start, after = range.end;\n dispatch(state.tr.step(new ReplaceAroundStep(before - (nestedBefore ? 3 : 1), after, before, after, slice, 1, true))\n .scrollIntoView());\n }\n return true;\n };\n}\n\nexport { addListNodes, bulletList, liftListItem, listItem, orderedList, sinkListItem, splitListItem, splitListItemKeepMarks, wrapInList, wrapRangeInList };\n"],"ignoreList":[0],"mappings":";;;AAsEA,SAASA,EAAW,GAAU,IAAQ,MAAM;CACxC,OAAO,SAAU,GAAO,GAAU;EAC9B,IAAI,EAAE,UAAO,WAAQC,EAAM,WACvBC,IAAQC,EAAM,WAAWC,CAAG;EAChC,IAAI,CAACF,GACD,OAAO;EACX,IAAIG,IAAKC,IAAWL,EAAM,KAAK;EAK/B,OAJKM,EAAgBF,GAAIH,GAAOM,GAAUC,CAAK,KAE3CH,KACAA,EAASD,EAAG,eAAe,CAAC,GACzB,MAHI;CAIf;AACJ;AAQA,SAASE,EAAgB,GAAI,GAAO,GAAU,IAAQ,MAAM;CACxD,IAAIG,IAAS,IAAOC,IAAaT,GAAOU,IAAMV,EAAM,MAAM;CAE1D,IAAIA,EAAM,SAAS,KAAKA,EAAM,MAAM,KAAKA,EAAM,QAAQ,CAAC,CAAC,CAAC,KAAK,kBAAkBM,CAAQ,KAAKN,EAAM,cAAc,GAAG;EAEjH,IAAIA,EAAM,MAAM,MAAMA,EAAM,QAAQ,CAAC,KAAK,GACtC,OAAO;EACX,IAAIW,IAAUD,EAAI,QAAQV,EAAM,QAAQ,CAAC;EAIzC,AAHA,IAAa,IAAIY,EAAUD,GAASA,GAASX,EAAM,KAAK,GACpDA,EAAM,WAAWA,EAAM,OAAO,eAC9B,IAAQ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