@metamorph-labs/polymorph-vue-ui 1.0.16 → 1.0.17

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 (143) hide show
  1. package/CHANGELOG.md +134 -0
  2. package/dist/ai/ArtifactPane.js.map +1 -1
  3. package/dist/ai/ArtifactPane.vue_vue_type_script_setup_true_lang.js.map +1 -1
  4. package/dist/archetypes/MasterDetailPage.js.map +1 -1
  5. package/dist/archetypes/MasterDetailPage.vue_vue_type_script_setup_true_lang.js +1 -1
  6. package/dist/archetypes/MasterDetailPage.vue_vue_type_script_setup_true_lang.js.map +1 -1
  7. package/dist/archetypes/app-shell.css +1 -1
  8. package/dist/archetypes/app-shell.module.js +2 -2
  9. package/dist/archetypes/app-shell.module.js.map +1 -1
  10. package/dist/controls/RichTextInput.js +7 -0
  11. package/dist/controls/RichTextInput.js.map +1 -0
  12. package/dist/controls/RichTextInput.vue_vue_type_script_setup_true_lang.js +1123 -0
  13. package/dist/controls/RichTextInput.vue_vue_type_script_setup_true_lang.js.map +1 -0
  14. package/dist/controls/rich-text-input.css +1 -0
  15. package/dist/controls/rich-text-input.module.js +47 -0
  16. package/dist/controls/rich-text-input.module.js.map +1 -0
  17. package/dist/controls/selection-bar.css +1 -0
  18. package/dist/controls/selection-bar.module.js +11 -0
  19. package/dist/controls/selection-bar.module.js.map +1 -0
  20. package/dist/index.js +41 -39
  21. package/dist/index.js.map +1 -1
  22. package/dist/node/ai/ArtifactPane.js.map +1 -1
  23. package/dist/node/ai/ArtifactPane.vue_vue_type_script_setup_true_lang.js.map +1 -1
  24. package/dist/node/archetypes/MasterDetailPage.js.map +1 -1
  25. package/dist/node/archetypes/MasterDetailPage.vue_vue_type_script_setup_true_lang.js +1 -1
  26. package/dist/node/archetypes/MasterDetailPage.vue_vue_type_script_setup_true_lang.js.map +1 -1
  27. package/dist/node/archetypes/app-shell.module.js +2 -2
  28. package/dist/node/archetypes/app-shell.module.js.map +1 -1
  29. package/dist/node/controls/RichTextInput.js +7 -0
  30. package/dist/node/controls/RichTextInput.js.map +1 -0
  31. package/dist/node/controls/RichTextInput.vue_vue_type_script_setup_true_lang.js +1123 -0
  32. package/dist/node/controls/RichTextInput.vue_vue_type_script_setup_true_lang.js.map +1 -0
  33. package/dist/node/controls/rich-text-input.module.js +46 -0
  34. package/dist/node/controls/rich-text-input.module.js.map +1 -0
  35. package/dist/node/controls/selection-bar.module.js +10 -0
  36. package/dist/node/controls/selection-bar.module.js.map +1 -0
  37. package/dist/node/index.js +41 -39
  38. package/dist/node/index.js.map +1 -1
  39. package/dist/node/overlays/Toast.js.map +1 -1
  40. package/dist/node/overlays/Toast.vue_vue_type_script_setup_true_lang.js +27 -27
  41. package/dist/node/overlays/Toast.vue_vue_type_script_setup_true_lang.js.map +1 -1
  42. package/dist/node/structure/Accordion.js.map +1 -1
  43. package/dist/node/structure/Accordion.vue_vue_type_script_setup_true_lang.js +4 -0
  44. package/dist/node/structure/Accordion.vue_vue_type_script_setup_true_lang.js.map +1 -1
  45. package/dist/node/structure/Collapsible.js.map +1 -1
  46. package/dist/node/structure/Collapsible.vue_vue_type_script_setup_true_lang.js +4 -0
  47. package/dist/node/structure/Collapsible.vue_vue_type_script_setup_true_lang.js.map +1 -1
  48. package/dist/node/structure/CursorPagination.js.map +1 -1
  49. package/dist/node/structure/CursorPagination.vue_vue_type_script_setup_true_lang.js +140 -93
  50. package/dist/node/structure/CursorPagination.vue_vue_type_script_setup_true_lang.js.map +1 -1
  51. package/dist/node/structure/Image.js.map +1 -1
  52. package/dist/node/structure/Image.vue_vue_type_script_setup_true_lang.js +30 -18
  53. package/dist/node/structure/Image.vue_vue_type_script_setup_true_lang.js.map +1 -1
  54. package/dist/node/structure/Pagination.js.map +1 -1
  55. package/dist/node/structure/Pagination.vue_vue_type_script_setup_true_lang.js +124 -71
  56. package/dist/node/structure/Pagination.vue_vue_type_script_setup_true_lang.js.map +1 -1
  57. package/dist/node/structure/RichTextContent.js +7 -0
  58. package/dist/node/structure/RichTextContent.js.map +1 -0
  59. package/dist/node/structure/RichTextContent.vue_vue_type_script_setup_true_lang.js +298 -0
  60. package/dist/node/structure/RichTextContent.vue_vue_type_script_setup_true_lang.js.map +1 -0
  61. package/dist/node/structure/RichTextContentBlocks.js +7 -0
  62. package/dist/node/structure/RichTextContentBlocks.js.map +1 -0
  63. package/dist/node/structure/RichTextContentBlocks.vue_vue_type_script_setup_true_lang.js +94 -0
  64. package/dist/node/structure/RichTextContentBlocks.vue_vue_type_script_setup_true_lang.js.map +1 -0
  65. package/dist/node/structure/RichTextContentInlines.js +7 -0
  66. package/dist/node/structure/RichTextContentInlines.js.map +1 -0
  67. package/dist/node/structure/RichTextContentInlines.vue_vue_type_script_setup_true_lang.js +69 -0
  68. package/dist/node/structure/RichTextContentInlines.vue_vue_type_script_setup_true_lang.js.map +1 -0
  69. package/dist/node/structure/RichTextContentItem.js +7 -0
  70. package/dist/node/structure/RichTextContentItem.js.map +1 -0
  71. package/dist/node/structure/RichTextContentItem.vue_vue_type_script_setup_true_lang.js +94 -0
  72. package/dist/node/structure/RichTextContentItem.vue_vue_type_script_setup_true_lang.js.map +1 -0
  73. package/dist/node/structure/code-block.module.js +2 -2
  74. package/dist/node/structure/code-block.module.js.map +1 -1
  75. package/dist/node/structure/cursor-pagination.module.js +6 -3
  76. package/dist/node/structure/cursor-pagination.module.js.map +1 -1
  77. package/dist/node/structure/pagination.module.js +6 -3
  78. package/dist/node/structure/pagination.module.js.map +1 -1
  79. package/dist/node/structure/rich-text-content.module.js +18 -0
  80. package/dist/node/structure/rich-text-content.module.js.map +1 -0
  81. package/dist/overlays/Toast.js.map +1 -1
  82. package/dist/overlays/Toast.vue_vue_type_script_setup_true_lang.js +27 -27
  83. package/dist/overlays/Toast.vue_vue_type_script_setup_true_lang.js.map +1 -1
  84. package/dist/structure/Accordion.js.map +1 -1
  85. package/dist/structure/Accordion.vue_vue_type_script_setup_true_lang.js +4 -0
  86. package/dist/structure/Accordion.vue_vue_type_script_setup_true_lang.js.map +1 -1
  87. package/dist/structure/Collapsible.js.map +1 -1
  88. package/dist/structure/Collapsible.vue_vue_type_script_setup_true_lang.js +4 -0
  89. package/dist/structure/Collapsible.vue_vue_type_script_setup_true_lang.js.map +1 -1
  90. package/dist/structure/CursorPagination.js.map +1 -1
  91. package/dist/structure/CursorPagination.vue_vue_type_script_setup_true_lang.js +140 -93
  92. package/dist/structure/CursorPagination.vue_vue_type_script_setup_true_lang.js.map +1 -1
  93. package/dist/structure/Image.js.map +1 -1
  94. package/dist/structure/Image.vue_vue_type_script_setup_true_lang.js +30 -18
  95. package/dist/structure/Image.vue_vue_type_script_setup_true_lang.js.map +1 -1
  96. package/dist/structure/Pagination.js.map +1 -1
  97. package/dist/structure/Pagination.vue_vue_type_script_setup_true_lang.js +124 -71
  98. package/dist/structure/Pagination.vue_vue_type_script_setup_true_lang.js.map +1 -1
  99. package/dist/structure/RichTextContent.js +7 -0
  100. package/dist/structure/RichTextContent.js.map +1 -0
  101. package/dist/structure/RichTextContent.vue_vue_type_script_setup_true_lang.js +298 -0
  102. package/dist/structure/RichTextContent.vue_vue_type_script_setup_true_lang.js.map +1 -0
  103. package/dist/structure/RichTextContentBlocks.js +7 -0
  104. package/dist/structure/RichTextContentBlocks.js.map +1 -0
  105. package/dist/structure/RichTextContentBlocks.vue_vue_type_script_setup_true_lang.js +94 -0
  106. package/dist/structure/RichTextContentBlocks.vue_vue_type_script_setup_true_lang.js.map +1 -0
  107. package/dist/structure/RichTextContentInlines.js +7 -0
  108. package/dist/structure/RichTextContentInlines.js.map +1 -0
  109. package/dist/structure/RichTextContentInlines.vue_vue_type_script_setup_true_lang.js +69 -0
  110. package/dist/structure/RichTextContentInlines.vue_vue_type_script_setup_true_lang.js.map +1 -0
  111. package/dist/structure/RichTextContentItem.js +7 -0
  112. package/dist/structure/RichTextContentItem.js.map +1 -0
  113. package/dist/structure/RichTextContentItem.vue_vue_type_script_setup_true_lang.js +94 -0
  114. package/dist/structure/RichTextContentItem.vue_vue_type_script_setup_true_lang.js.map +1 -0
  115. package/dist/structure/code-block.css +1 -1
  116. package/dist/structure/code-block.module.js +2 -2
  117. package/dist/structure/code-block.module.js.map +1 -1
  118. package/dist/structure/cursor-pagination.css +1 -1
  119. package/dist/structure/cursor-pagination.module.js +6 -3
  120. package/dist/structure/cursor-pagination.module.js.map +1 -1
  121. package/dist/structure/pagination.css +1 -1
  122. package/dist/structure/pagination.module.js +6 -3
  123. package/dist/structure/pagination.module.js.map +1 -1
  124. package/dist/structure/rich-text-content.css +1 -0
  125. package/dist/structure/rich-text-content.module.js +19 -0
  126. package/dist/structure/rich-text-content.module.js.map +1 -0
  127. package/dist/types/ai/ArtifactPane.vue.d.ts +1 -1
  128. package/dist/types/ai/AttachmentChip.vue.d.ts +1 -1
  129. package/dist/types/ai/ToolCall.vue.d.ts +1 -1
  130. package/dist/types/controls/RichTextInput.vue.d.ts +210 -0
  131. package/dist/types/index.d.ts +4 -0
  132. package/dist/types/overlays/CommandPanel.vue.d.ts +2 -2
  133. package/dist/types/structure/Accordion.vue.d.ts +7 -0
  134. package/dist/types/structure/Collapsible.vue.d.ts +7 -0
  135. package/dist/types/structure/CursorPagination.vue.d.ts +13 -0
  136. package/dist/types/structure/EmptyState.vue.d.ts +1 -1
  137. package/dist/types/structure/Image.vue.d.ts +13 -0
  138. package/dist/types/structure/Pagination.vue.d.ts +8 -0
  139. package/dist/types/structure/RichTextContent.vue.d.ts +59 -0
  140. package/dist/types/structure/RichTextContentBlocks.vue.d.ts +7 -0
  141. package/dist/types/structure/RichTextContentInlines.vue.d.ts +7 -0
  142. package/dist/types/structure/RichTextContentItem.vue.d.ts +7 -0
  143. package/package.json +17 -4
@@ -0,0 +1,1123 @@
1
+ import e from "./Button.js";
2
+ import t from "../overlays/Menu.js";
3
+ import n from "./Input.js";
4
+ import r from "../overlays/Popover.js";
5
+ import ee from "../structure/Skeleton.js";
6
+ import te from "./FormField.js";
7
+ import ne from "../structure/Separator.js";
8
+ import re from "./selection-bar.module.js";
9
+ import i from "./rich-text-input.module.js";
10
+ import { Icon as ie, RICH_TEXT_FORMATS as a, agentMember as o, createRichTextEditor as ae, emptyRichText as oe, enterToolbar as se, focusOnLabelPress as ce, followFieldFocus as le, followFormReset as ue, followSelectionBar as de, holdToolbarEscape as fe, idPart as pe, isRichTextEmpty as me, isRichTextNewer as he, placeSelectionBar as ge, placeTokenList as _e, richTextFromText as ve, richTextHref as ye, richTextLength as be, richTextPlainText as xe, serializeRichText as Se, syncToolbarStop as Ce, toolbarFocusIn as we, toolbarFocusOut as Te, toolbarKeydown as Ee, toolbarLosesFocus as De, toolbarPress as Oe, toolbarStop as ke, useControlRef as Ae, useListening as je, useTrackedSlots as Me } from "@polymorph/vue";
11
+ import { Fragment as s, computed as c, createBlock as l, createCommentVNode as u, createElementBlock as d, createElementVNode as f, createVNode as p, defineComponent as m, normalizeClass as h, onBeforeUnmount as g, onMounted as _, openBlock as v, ref as y, renderList as Ne, renderSlot as Pe, resolveDynamicComponent as Fe, toDisplayString as b, unref as x, useId as Ie, useSlots as Le, useTemplateRef as S, watch as C, withCtx as w } from "vue";
12
+ import { usePresence as Re } from "@polymorph/vue/motion";
13
+ //#region src/controls/RichTextInput.vue?vue&type=script&setup=true&lang.ts
14
+ var ze = [
15
+ "data-min-rows",
16
+ "data-max-rows",
17
+ "data-empty",
18
+ "data-disabled",
19
+ "data-readonly",
20
+ "data-invalid"
21
+ ], Be = ["aria-label", "aria-controls"], Ve = [
22
+ "id",
23
+ "aria-label",
24
+ "aria-labelledby",
25
+ "aria-describedby",
26
+ "aria-required",
27
+ "aria-invalid",
28
+ "aria-disabled",
29
+ "aria-readonly",
30
+ "tabindex",
31
+ "aria-autocomplete",
32
+ "aria-haspopup",
33
+ "aria-controls",
34
+ "aria-activedescendant"
35
+ ], He = [
36
+ "aria-label",
37
+ "data-state",
38
+ "inert"
39
+ ], Ue = ["id", "data-state"], We = ["id", "data-state"], Ge = ["id", "aria-label"], Ke = [
40
+ "id",
41
+ "aria-selected",
42
+ "data-highlighted",
43
+ "onPointermove",
44
+ "onClick"
45
+ ], qe = [
46
+ "name",
47
+ "value",
48
+ "disabled"
49
+ ], Je = /*@__PURE__*/ m({
50
+ name: "RichTextInput",
51
+ inheritAttrs: !1,
52
+ controlKind: "group",
53
+ __name: "RichTextInput",
54
+ props: {
55
+ activeAnnotation: {},
56
+ annotations: {},
57
+ ariaDescribedby: {},
58
+ ariaLabel: {},
59
+ ariaLabelledby: {},
60
+ ariaRequired: {
61
+ type: Boolean,
62
+ default: void 0
63
+ },
64
+ autoFocus: {
65
+ type: Boolean,
66
+ default: !1
67
+ },
68
+ cancelLabel: {},
69
+ controlRef: {},
70
+ defaultValue: {},
71
+ disabled: {
72
+ type: Boolean,
73
+ default: !1
74
+ },
75
+ entities: { default: () => [] },
76
+ formats: {},
77
+ id: {},
78
+ invalid: {
79
+ type: Boolean,
80
+ default: !1
81
+ },
82
+ maxLength: {},
83
+ maxRows: { default: 12 },
84
+ messages: {},
85
+ minRows: { default: 3 },
86
+ name: {},
87
+ pending: {
88
+ type: Boolean,
89
+ default: !1
90
+ },
91
+ placeholder: {},
92
+ readOnly: {
93
+ type: Boolean,
94
+ default: !1
95
+ },
96
+ submitLabel: {},
97
+ toolbarPlacement: { default: "fixed" },
98
+ value: {}
99
+ },
100
+ emits: [
101
+ "annotationSelect",
102
+ "blur",
103
+ "cancel",
104
+ "change",
105
+ "files",
106
+ "focus",
107
+ "submit"
108
+ ],
109
+ setup(m, { emit: Je }) {
110
+ let T = m, E = Je, Ye = Me(Le()), Xe = Ie(), D = je(), Ze = y(T.defaultValue ?? oe()), Qe = y(T.defaultValue ?? oe()), O = y(null), $e = y({
111
+ text: "",
112
+ at: 0
113
+ }), et = y({
114
+ key: "",
115
+ index: 0
116
+ }), tt = y(null), nt = y(null), rt = y(null), k = y(!1), it = y(""), at = y(void 0), ot = y(null), A = y(!1), st = y(!1), ct = y(!1), lt = y(!1), ut = y(!1), dt = y(!1), ft = y(null), pt = y(!1), mt = S("actions"), j = S("bar"), ht = S("controls"), gt = S("linkForm"), _t = S("panel"), M = S("root"), N = S("toolbarRow"), [P, vt] = Ae(() => T.controlRef), F = c(() => ({
117
+ editor: null,
118
+ handle: null,
119
+ lastValue: void 0,
120
+ saidNow: !1
121
+ })), I = c(() => ({
122
+ toolbar: "Formatting",
123
+ selectionBar: "Selection",
124
+ selectionBarReady: "Controls for the selection are available: Alt+F10",
125
+ bold: "Bold",
126
+ italic: "Italic",
127
+ strike: "Strikethrough",
128
+ code: "Code",
129
+ link: "Link",
130
+ textStyle: "Text style",
131
+ paragraph: "Paragraph",
132
+ heading: (e) => `Heading ${e}`,
133
+ bulletList: "Bulleted list",
134
+ orderedList: "Numbered list",
135
+ blockquote: "Quote",
136
+ codeBlock: "Code block",
137
+ undo: "Undo",
138
+ redo: "Redo",
139
+ linkForm: "Link",
140
+ linkAddress: "Address",
141
+ linkApply: "Apply",
142
+ linkRemove: "Remove link",
143
+ linkInvalid: "Enter a web address, an email address or a phone number.",
144
+ formatOn: (e) => `${e} on`,
145
+ formatOff: (e) => `${e} off`,
146
+ linkAdded: "Link added",
147
+ linkRemoved: "Link removed",
148
+ inserted: (e) => `${e} inserted`,
149
+ undone: "Undone",
150
+ redone: "Redone",
151
+ count: (e, t) => `${e} / ${t}`,
152
+ overLimit: (e) => `${e} ${e === 1 ? "character" : "characters"} over the limit`,
153
+ withinLimit: "Within the limit",
154
+ submitEmpty: "There is nothing to submit yet.",
155
+ submitOverLimit: (e) => `Remove ${e} ${e === 1 ? "character" : "characters"} to submit.`,
156
+ submitPending: "Still saving.",
157
+ suggestions: (e) => e === 1 ? "1 suggestion" : `${e} suggestions`,
158
+ loadingSuggestions: "Loading suggestions…",
159
+ noSuggestions: "No results",
160
+ ...T.messages === void 0 ? {} : Object.fromEntries(Object.entries(T.messages).filter(([, e]) => e !== void 0))
161
+ })), L = c(() => T.value ?? Ze.value), yt = c(() => me(L.value)), bt = c(() => be(L.value)), xt = c(() => T.maxLength === void 0 ? 0 : Math.max(0, bt.value - T.maxLength)), R = c(() => xt.value > 0), St = c(() => he(L.value)), z = c(() => T.readOnly || T.pending || St.value), B = c(() => T.disabled || z.value), Ct = c(() => !B.value), wt = c(() => a.filter((e) => (T.formats ?? a).includes(e))), V = c(() => (e) => wt.value.includes(e)), Tt = c(() => T.entities.map((e) => ({
162
+ kind: e.kind,
163
+ trigger: e.trigger
164
+ }))), H = c(() => [
165
+ ["bold", "bold"],
166
+ ["italic", "italic"],
167
+ ["strike", "strikethrough"],
168
+ ["code", "code"]
169
+ ].filter(([e]) => V.value(e)).map(([e, t]) => ({
170
+ format: e,
171
+ icon: t
172
+ }))), Et = c(() => [
173
+ ["bulletList", "list-bulleted"],
174
+ ["orderedList", "list-numbered"],
175
+ ["blockquote", "quote"],
176
+ ["codeBlock", "code-block"]
177
+ ].filter(([e]) => V.value(e)).map(([e, t]) => ({
178
+ format: e,
179
+ icon: t
180
+ }))), Dt = c(() => T.id ?? `${Xe}-surface`), Ot = c(() => `${Xe}-suggestions`), kt = c(() => `${Xe}-count`), U = c(() => O.value?.active), W = c(() => O.value?.can), At = c(() => ({
181
+ empty: O.value?.collapsed ?? !0,
182
+ text: O.value?.selectedText ?? "",
183
+ range: O.value?.range ?? {
184
+ start: 0,
185
+ end: 0
186
+ }
187
+ })), jt = c(() => () => F.value.editor?.focus()), G = c(() => (e) => {
188
+ $e.value = {
189
+ text: e,
190
+ at: $e.value.at + 1
191
+ }, F.value.saidNow = !0, queueMicrotask(() => {
192
+ F.value.saidNow = !1;
193
+ });
194
+ }), Mt = c(() => (e) => e === "heading" ? I.value.textStyle : I.value[e]), Nt = c(() => (e) => {
195
+ e.type === "format" ? G.value((e.active ? I.value.formatOn : I.value.formatOff)(Mt.value(e.format))) : e.type === "heading" ? G.value(e.level === 0 ? I.value.paragraph : I.value.heading(e.level)) : e.type === "link" ? G.value(e.active ? I.value.linkAdded : I.value.linkRemoved) : e.type === "entity" ? G.value(I.value.inserted(e.entity.label)) : e.type === "undo" ? G.value(I.value.undone) : G.value(I.value.redone);
196
+ }), Pt = c(() => (e) => {
197
+ if (!St.value) {
198
+ if (T.maxLength !== void 0) {
199
+ let t = be(L.value) > T.maxLength, n = Math.max(0, be(e) - T.maxLength);
200
+ !t && n > 0 ? G.value(I.value.overLimit(n)) : t && n === 0 && G.value(I.value.withinLimit);
201
+ }
202
+ Ze.value = e, E("change", e);
203
+ }
204
+ }), Ft = c(() => (e, t) => {
205
+ e.setValue(t), Pt.value(e.getValue());
206
+ }), It = c(() => () => {
207
+ let e = F.value.editor;
208
+ e === null || Se(e.getValue()) === Se(Qe.value) || Ft.value(e, Qe.value);
209
+ }), Lt = c(() => () => {
210
+ T.value === void 0 && F.value.lastValue !== void 0 && (Ze.value = F.value.lastValue), F.value.lastValue = T.value;
211
+ }), Rt = c(() => new Intl.Collator(void 0, {
212
+ usage: "search",
213
+ sensitivity: "base"
214
+ })), K = c(() => Ct.value ? O.value?.suggestion ?? null : null), q = c(() => ((e) => e === null ? void 0 : T.entities.find((t) => t.kind === e.kind))(K.value)), J = c(() => K.value !== null && q.value !== void 0), zt = c(() => K.value?.query ?? ""), Bt = c(() => zt.value.normalize("NFC")), Vt = c(() => (e) => ((e) => Bt.value === "" || (q.value?.filter === "startsWith" ? Rt.value.compare(e.slice(0, Bt.value.length), Bt.value) === 0 : Array.from({ length: Math.max(0, e.length - Bt.value.length + 1) }, (t, n) => e.slice(n, n + Bt.value.length)).some((e) => Rt.value.compare(e, Bt.value) === 0)))(e.normalize("NFC"))), Ht = c(() => J.value && q.value?.loading === !0), Ut = c(() => J.value && !Ht.value && q.value?.error !== void 0 && q.value.error !== ""), Y = c(() => !J.value || Ut.value || q.value === void 0 ? [] : q.value.filter === !1 ? q.value.options : q.value.options.filter((e) => Vt.value(e.label))), Wt = c(() => J.value && K.value !== null ? `${K.value.key}:${zt.value}` : ""), X = c(() => Y.value.length === 0 ? -1 : et.value.key === Wt.value ? Math.min(et.value.index, Y.value.length - 1) : 0), Gt = c(() => J.value ? Ht.value ? I.value.loadingSuggestions : Ut.value ? q.value?.error ?? "" : Y.value.length === 0 ? I.value.noSuggestions : I.value.suggestions(Y.value.length) : null), Kt = c(() => (e) => {
215
+ let t = Y.value[e], n = F.value.editor, r = q.value;
216
+ t === void 0 || r === void 0 || n === null || (tt.value = null, n.insertEntity({
217
+ kind: r.kind,
218
+ id: t.id,
219
+ label: t.entityLabel ?? r.trigger + t.label
220
+ }));
221
+ }), qt = c(() => (e) => J.value ? e === "ArrowDown" || e === "ArrowUp" ? Y.value.length === 0 ? !1 : (et.value = {
222
+ key: Wt.value,
223
+ index: e === "ArrowDown" ? Math.min(X.value + 1, Y.value.length - 1) : Math.max(X.value - 1, 0)
224
+ }, !0) : e === "Enter" ? X.value === -1 ? Ht.value : (Kt.value(X.value), !0) : e === "Tab" ? X.value === -1 ? !1 : (Kt.value(X.value), !0) : (F.value.editor?.dismissSuggestion(), !0) : !1), Jt = c(() => (e) => T.annotations === void 0 || T.annotations.includes(e)), Yt = c(() => (e) => {
225
+ O.value = e;
226
+ let t = e.suggestion, n = t === null ? void 0 : T.entities.find((e) => e.kind === t.kind), r = t === null || n === void 0 ? null : t.key + ":" + t.query;
227
+ r !== tt.value && (tt.value = r, t !== null && r !== null && n?.onQueryChange?.(t.query));
228
+ let ee = e.collapsed ? e.annotations.find((e) => Jt.value(e)) ?? null : null;
229
+ ee !== null && ee !== nt.value && (rt.value !== null && (rt.value = { entered: ee }), E("annotationSelect", ee)), nt.value = ee;
230
+ }), Z = c(() => ((e) => {
231
+ let t = F.value.handle;
232
+ return t !== null && t.value === e.value && t.empty === e.empty && t.length === e.length && t.overLimit === e.overLimit && t.disabled === e.disabled && t.selection.empty === e.selection.empty && t.selection.text === e.selection.text && t.selection.range.start === e.selection.range.start && t.selection.range.end === e.selection.range.end ? t : (F.value.handle = e, e);
233
+ })({
234
+ focus: () => F.value.editor?.focus(),
235
+ clear: () => F.value.editor?.clear(),
236
+ insertText: (e) => F.value.editor?.insertText(e),
237
+ insertEntity: (e) => F.value.editor?.insertEntity(e),
238
+ annotate: (e) => F.value.editor?.annotate(e) ?? !1,
239
+ removeAnnotation: (e) => F.value.editor?.removeAnnotation(e) ?? !1,
240
+ value: L.value,
241
+ empty: yt.value,
242
+ length: bt.value,
243
+ overLimit: R.value,
244
+ disabled: B.value,
245
+ selection: At.value
246
+ })), Xt = c(() => () => {
247
+ if (!(!D.submit || T.disabled)) {
248
+ if (T.pending) return G.value(I.value.submitPending);
249
+ if (yt.value) return G.value(I.value.submitEmpty);
250
+ if (R.value) return G.value(I.value.submitOverLimit(xt.value));
251
+ E("submit", F.value.editor?.getValue() ?? L.value, Z.value);
252
+ }
253
+ }), Zt = c(() => (e) => {
254
+ if (e) {
255
+ let e = F.value.editor?.getState().active.link ?? null;
256
+ it.value = e ?? "", at.value = void 0, ot.value = e;
257
+ }
258
+ k.value = e;
259
+ }), Qt = c(() => (e) => {
260
+ e.preventDefault(), e.stopPropagation();
261
+ let t = it.value.trim(), n = F.value.editor;
262
+ if (t === "" || ye(t, { typed: !0 }) === null || n === null || !n.setLink(t)) {
263
+ at.value = I.value.linkInvalid;
264
+ return;
265
+ }
266
+ k.value = !1;
267
+ }), $t = c(() => () => {
268
+ F.value.editor?.setLink(null), k.value = !1;
269
+ }), en = c(() => () => {
270
+ let e = F.value.editor, t = T.toolbarPlacement === "fixed" || $.value;
271
+ e === null || !Ct.value || !e.getState().can.link || !t || Zt.value(!0);
272
+ }), tn = c(() => U.value === void 0 ? 0 : U.value.codeBlock ? -1 : U.value.heading), nn = c(() => [
273
+ 0,
274
+ 1,
275
+ 2,
276
+ 3
277
+ ].map((e) => ({
278
+ kind: "checkbox",
279
+ label: e === 0 ? I.value.paragraph : I.value.heading(e),
280
+ checked: tn.value === e,
281
+ onCheckedChange: () => an.value(e)
282
+ }))), rn = c(() => (e) => {
283
+ e && (st.value = ct.value), A.value = e;
284
+ }), an = c(() => (e) => {
285
+ F.value.editor?.setHeading(e), A.value = !1;
286
+ }), on = c(() => (e) => {
287
+ let t = M.value?.ownerDocument.defaultView;
288
+ t?.requestAnimationFrame(() => t.requestAnimationFrame(e));
289
+ }), sn = c(() => () => {
290
+ let e = gt.value?.closest("[data-member=\"popover\"]") ?? null;
291
+ on.value(() => {
292
+ let t = M.value?.ownerDocument, n = t?.activeElement ?? null;
293
+ (n === null || n === t?.body || M.value?.contains(n) === !0 || e?.contains(n) === !0) && F.value.editor?.focus();
294
+ });
295
+ }), cn = c(() => () => {
296
+ st.value && on.value(() => F.value.editor?.focus());
297
+ }), Q = c(() => T.toolbarPlacement === "selection" && Ct.value && wt.value.length > 0), ln = c(() => !!Ye.selectionActions && !T.disabled), un = c(() => `${At.value.range.start}:${At.value.range.end}`), dn = c(() => Q.value && (k.value || A.value)), $ = c(() => (Q.value || ln.value) && O.value !== null && !O.value.collapsed && (lt.value || ut.value || dn.value) && !dt.value && ft.value !== un.value), fn = c(() => () => J.value ? (F.value.editor?.dismissSuggestion(), !0) : $.value ? (ft.value = un.value, !0) : !1), pn = c(() => (e) => {
298
+ let t = e.ownerDocument.defaultView, n = (t) => {
299
+ t.key !== "Escape" || t.isComposing || t.target !== e || fn.value() && t.preventDefault();
300
+ };
301
+ return t?.addEventListener("keydown", n, !0), () => t?.removeEventListener("keydown", n, !0);
302
+ }), mn = c(() => (e, t) => {
303
+ let n = e.ownerDocument.defaultView;
304
+ return n === null ? () => {} : fe(n, t);
305
+ }), hn = c(() => (e) => {
306
+ let t = e.ownerDocument.defaultView, n = () => {
307
+ dt.value = !1;
308
+ };
309
+ return t?.addEventListener("pointerup", n, !0), t?.addEventListener("pointercancel", n, !0), () => {
310
+ t?.removeEventListener("pointerup", n, !0), t?.removeEventListener("pointercancel", n, !0);
311
+ };
312
+ }), gn = c(() => J.value || $.value), _n = c(() => ke()), vn = c(() => ke()), yn = c(() => () => ge(j.value, F.value.editor?.selectionRect(), P.value)), bn = c(() => () => {
313
+ De(j.value, vn.value) && F.value.editor?.focus();
314
+ }), xn = c(() => () => _e(_t.value, M.value, F.value.editor?.tokenRect() ?? K.value?.rect)), Sn = c(() => (e) => `${Xe}-suggestion-${pe(e.id)}`), Cn = c(() => [T.ariaDescribedby, T.maxLength === void 0 ? void 0 : kt.value].filter((e) => e !== void 0).join(" ") || void 0), wn = c(() => T.entities.length > 0), Tn = c(() => ({
315
+ id: Dt.value,
316
+ role: "textbox",
317
+ "aria-multiline": "true",
318
+ "aria-label": T.ariaLabel,
319
+ "aria-labelledby": T.ariaLabelledby,
320
+ "aria-describedby": Cn.value,
321
+ "aria-required": T.ariaRequired === !0 ? "true" : void 0,
322
+ "aria-invalid": T.invalid || R.value ? "true" : void 0,
323
+ "aria-disabled": T.disabled ? "true" : void 0,
324
+ "aria-readonly": !T.disabled && z.value ? "true" : void 0,
325
+ tabindex: T.disabled ? void 0 : "0",
326
+ "aria-autocomplete": wn.value ? "list" : void 0,
327
+ "aria-haspopup": wn.value ? "listbox" : void 0,
328
+ "aria-controls": J.value && Y.value.length > 0 ? Ot.value : void 0,
329
+ "aria-activedescendant": ((e) => J.value && e !== void 0 ? Sn.value(e) : void 0)(X.value === -1 ? void 0 : Y.value[X.value])
330
+ })), En = c(() => JSON.stringify([
331
+ wt.value,
332
+ Tt.value,
333
+ Ct.value,
334
+ !T.disabled && z.value,
335
+ Tn.value,
336
+ T.placeholder ?? null,
337
+ T.annotations ?? null,
338
+ T.activeAnnotation ?? null,
339
+ D.submit,
340
+ D.files
341
+ ])), Dn = c(() => () => ({
342
+ formats: wt.value,
343
+ entities: Tt.value,
344
+ editable: Ct.value,
345
+ readOnly: !T.disabled && z.value,
346
+ attributes: Tn.value,
347
+ placeholder: T.placeholder,
348
+ annotations: T.annotations,
349
+ activeAnnotation: T.activeAnnotation,
350
+ onSubmit: D.submit ? () => Xt.value() : void 0,
351
+ onFiles: D.files ? (e) => E("files", e) : void 0
352
+ })), On = c(() => (e) => {
353
+ let t = ae({
354
+ element: e,
355
+ value: L.value,
356
+ formats: wt.value,
357
+ entities: Tt.value,
358
+ classes: {
359
+ paragraph: i.paragraph ?? "",
360
+ heading: [
361
+ i.heading1 ?? "",
362
+ i.heading2 ?? "",
363
+ i.heading3 ?? ""
364
+ ],
365
+ bulletList: i.list ?? "",
366
+ orderedList: i.list ?? "",
367
+ listItem: i.item ?? "",
368
+ blockquote: i.quote ?? "",
369
+ codeBlock: i.codeBlock ?? "",
370
+ codeBlockText: "",
371
+ bold: "",
372
+ italic: "",
373
+ strike: "",
374
+ code: i.code ?? "",
375
+ link: i.link ?? "",
376
+ entity: i.entity ?? "",
377
+ annotation: i.annotation ?? "",
378
+ unknown: i.unknown ?? ""
379
+ },
380
+ editable: Ct.value,
381
+ readOnly: !T.disabled && z.value,
382
+ attributes: Tn.value,
383
+ placeholder: T.placeholder,
384
+ annotations: T.annotations,
385
+ activeAnnotation: T.activeAnnotation,
386
+ onChange: (e) => Pt.value(e),
387
+ onState: (e) => Yt.value(e),
388
+ onEvent: (e) => Nt.value(e),
389
+ onSubmit: D.submit ? () => Xt.value() : void 0,
390
+ onLinkRequest: () => en.value(),
391
+ onSuggestionKey: (e) => qt.value(e),
392
+ onFiles: D.files ? (e) => E("files", e) : void 0
393
+ });
394
+ return F.value.editor = t, Yt.value(t.getState()), T.autoFocus && t.focus("end"), () => {
395
+ t.destroy(), F.value.editor = null;
396
+ };
397
+ }), kn = c(() => (e, t) => {
398
+ let n = F.value.editor;
399
+ n !== null && (t(n), e.detail > 0 && n.focus());
400
+ }), An = c(() => (e) => {
401
+ !e.altKey || e.key !== "F10" || (e.preventDefault(), $.value ? se(j.value, vn.value) : Ln.value && se(N.value, _n.value));
402
+ }), jn = c(() => () => {
403
+ rt.value = { entered: null }, (Ye.selectionActions || Q.value) && (dt.value = !0);
404
+ }), Mn = c(() => (e) => {
405
+ let t = rt.value;
406
+ rt.value = null;
407
+ let n = (e.target instanceof Element ? e.target : null)?.closest("[data-annotation-id]")?.getAttribute("data-annotation-id");
408
+ n == null || !Jt.value(n) || F.value.editor?.getState().collapsed === !1 || T.disabled || (nt.value = n, t?.entered !== n && E("annotationSelect", n));
409
+ }), Nn = c(() => (e) => {
410
+ let t = e.relatedTarget;
411
+ t instanceof Node && j.value?.contains(t) === !0 && (ut.value = !0), lt.value = !1;
412
+ }), Pn = c(() => (e) => {
413
+ let t = e.relatedTarget;
414
+ t instanceof Node && P.value?.contains(t) === !0 && (lt.value = !0), (!(t instanceof Node) || !e.currentTarget.contains(t)) && (ut.value = !1), t === null && !$.value && bn.value();
415
+ }), Fn = c(() => (e) => le(e, {
416
+ panels: () => [gt.value?.closest("[data-member=\"popover\"]") ?? null],
417
+ entered: () => {
418
+ pt.value = !1, E("focus");
419
+ },
420
+ left: () => E("blur")
421
+ })), In = c(() => T.toolbarPlacement === "fixed"), Ln = c(() => In.value || !!Ye.toolbar), Rn = c(() => !Ye.footer && T.submitLabel !== void 0 && D.submit), zn = c(() => !!Ye.footer || Rn.value), Bn = Re(() => $.value, j), Vn;
422
+ _(() => {
423
+ Vn?.();
424
+ let e = M.value ? Fn.value(M.value) : () => {};
425
+ Vn = () => {
426
+ e();
427
+ };
428
+ }), g(() => Vn?.());
429
+ let Hn;
430
+ _(() => {
431
+ Hn?.();
432
+ let e = P.value ? On.value(P.value) : () => {};
433
+ Hn = () => {
434
+ e();
435
+ };
436
+ }), g(() => Hn?.());
437
+ let Un;
438
+ _(() => {
439
+ Un?.();
440
+ let e = M.value ? ue(M.value, () => It.value()) : () => {};
441
+ Un = () => {
442
+ e();
443
+ };
444
+ }), g(() => Un?.());
445
+ let Wn, Gn = () => {
446
+ Wn?.();
447
+ let e = P.value ? ce(P.value, () => F.value.editor?.focus(), () => !T.disabled) : () => {};
448
+ Wn = () => {
449
+ e();
450
+ };
451
+ };
452
+ _(Gn), C(() => T.ariaLabelledby, Gn, { flush: "post" }), g(() => Wn?.());
453
+ let Kn = () => {
454
+ Lt.value();
455
+ };
456
+ _(Kn), C(() => T.value, Kn, { flush: "post" }), C(() => En.value, () => {
457
+ F.value.editor?.update(Dn.value());
458
+ }, { flush: "post" }), C(() => [T.value, Ze.value], () => {
459
+ T.value === void 0 || F.value.editor?.setValue(T.value);
460
+ }, { flush: "post" });
461
+ let qn = () => {
462
+ Gt.value === null || G.value(Gt.value);
463
+ };
464
+ _(qn), C(() => Gt.value, qn, { flush: "post" });
465
+ let Jn = () => {
466
+ xn.value();
467
+ };
468
+ _(Jn), C(() => [
469
+ K.value,
470
+ Y.value.length,
471
+ Ht.value,
472
+ Ut.value
473
+ ], Jn, { flush: "post" });
474
+ let Yn, Xn = () => {
475
+ Yn?.();
476
+ let e = J.value && _t.value ? de(_t.value, xn.value) : () => {};
477
+ Yn = () => {
478
+ e();
479
+ };
480
+ };
481
+ _(Xn), C(() => J.value, Xn, { flush: "post" }), g(() => Yn?.());
482
+ let Zn, Qn = () => {
483
+ Zn?.();
484
+ let e = gn.value && P.value ? pn.value(P.value) : () => {};
485
+ Zn = () => {
486
+ e();
487
+ };
488
+ };
489
+ _(Qn), C(() => gn.value, Qn, { flush: "post" }), g(() => Zn?.());
490
+ let $n, er = () => {
491
+ $n?.();
492
+ let e = dt.value && M.value ? hn.value(M.value) : () => {};
493
+ $n = () => {
494
+ e();
495
+ };
496
+ };
497
+ _(er), C(() => dt.value, er, { flush: "post" }), g(() => $n?.());
498
+ let tr, nr = () => {
499
+ tr?.();
500
+ let e = () => {
501
+ Ce(N.value, _n.value);
502
+ }, t = typeof MutationObserver > "u" ? void 0 : new MutationObserver(e);
503
+ for (let e of [N.value]) e && t?.observe(e, {
504
+ childList: !0,
505
+ characterData: !0,
506
+ subtree: !0,
507
+ attributeFilter: [
508
+ "disabled",
509
+ "aria-disabled",
510
+ "hidden",
511
+ "inert"
512
+ ]
513
+ });
514
+ tr = () => {
515
+ t?.disconnect();
516
+ }, e();
517
+ };
518
+ _(nr), C(() => Ln.value, nr, { flush: "post" }), g(() => tr?.());
519
+ let rr, ir = () => {
520
+ rr?.();
521
+ let e = Ln.value && N.value ? mn.value(N.value, () => N.value) : () => {};
522
+ rr = () => {
523
+ e();
524
+ };
525
+ };
526
+ _(ir), C(() => Ln.value, ir, { flush: "post" }), g(() => rr?.());
527
+ let ar, or = () => {
528
+ ar?.();
529
+ let e = () => {
530
+ Ce(j.value, vn.value);
531
+ }, t = typeof MutationObserver > "u" ? void 0 : new MutationObserver(e);
532
+ for (let e of [j.value]) e && t?.observe(e, {
533
+ childList: !0,
534
+ characterData: !0,
535
+ subtree: !0,
536
+ attributeFilter: [
537
+ "disabled",
538
+ "aria-disabled",
539
+ "hidden",
540
+ "inert"
541
+ ]
542
+ });
543
+ ar = () => {
544
+ t?.disconnect();
545
+ }, e();
546
+ };
547
+ _(or), C(() => Bn.value, or, { flush: "post" }), g(() => ar?.());
548
+ let sr, cr = () => {
549
+ sr?.();
550
+ let e = Bn.value && j.value ? mn.value(j.value, () => j.value) : () => {};
551
+ sr = () => {
552
+ e();
553
+ };
554
+ };
555
+ _(cr), C(() => Bn.value, cr, { flush: "post" }), g(() => sr?.());
556
+ let lr = () => {
557
+ $.value && yn.value();
558
+ };
559
+ _(lr), C(() => [$.value, O.value], lr, { flush: "post" });
560
+ let ur, dr = () => {
561
+ ur?.();
562
+ let e = $.value && j.value ? de(j.value, yn.value) : () => {};
563
+ ur = () => {
564
+ e();
565
+ };
566
+ };
567
+ _(dr), C(() => $.value, dr, { flush: "post" }), g(() => ur?.()), C(() => $.value, () => {
568
+ $.value || bn.value();
569
+ }, { flush: "post" });
570
+ let fr = () => {
571
+ $.value && !pt.value && (pt.value = !0, F.value.saidNow || G.value(I.value.selectionBarReady));
572
+ };
573
+ _(fr), C(() => $.value, fr, { flush: "post" }), C(() => [un.value, At.value.empty], () => {
574
+ ft.value !== null && (At.value.empty || ft.value !== un.value) && (ft.value = null);
575
+ }, { flush: "post" }), C(() => k.value, () => {
576
+ k.value || sn.value();
577
+ }, { flush: "post" }), C(() => A.value, () => {
578
+ A.value || cn.value();
579
+ }, { flush: "post" });
580
+ let pr;
581
+ return _(() => {
582
+ pr?.();
583
+ let e = o({
584
+ member: "RichTextInput",
585
+ element: () => P.value,
586
+ state: () => ({
587
+ value: xe(L.value),
588
+ disabled: T.disabled,
589
+ invalid: T.invalid || R.value,
590
+ readonly: z.value,
591
+ empty: yt.value
592
+ }),
593
+ actions: {
594
+ fill: {
595
+ argument: "text",
596
+ run: (e) => (() => {
597
+ if (St.value) throw Error("The document is of a later format than this field writes.");
598
+ if (z.value) throw Error("The field is read-only.");
599
+ let t = F.value.editor;
600
+ if (t === null) throw Error("The field is not ready.");
601
+ Ft.value(t, ve(e));
602
+ })()
603
+ },
604
+ clear: () => (() => {
605
+ if (St.value) throw Error("The document is of a later format than this field writes.");
606
+ if (z.value) throw Error("The field is read-only.");
607
+ let e = F.value.editor;
608
+ if (e === null) throw Error("The field is not ready.");
609
+ e.clear();
610
+ })(),
611
+ submit: () => (() => {
612
+ if (!D.submit) throw Error("The field has no submit.");
613
+ if (T.pending) throw Error("The app is saving; wait for it to finish.");
614
+ if (yt.value) throw Error("The field is empty, and an empty field is not submitted.");
615
+ if (R.value) throw Error(`The text is ${xt.value} characters over the limit.`);
616
+ E("submit", F.value.editor?.getValue() ?? L.value, Z.value);
617
+ })()
618
+ },
619
+ withholds: () => [
620
+ ht.value,
621
+ mt.value,
622
+ j.value,
623
+ gt.value?.closest("[data-member=\"popover\"]") ?? null
624
+ ]
625
+ });
626
+ pr = () => {
627
+ e();
628
+ };
629
+ }), g(() => pr?.()), (a, o) => (v(), d("div", {
630
+ ref_key: "root",
631
+ ref: M,
632
+ class: h(x(i).root),
633
+ "data-min-rows": String(m.minRows),
634
+ "data-max-rows": String(m.maxRows),
635
+ "data-empty": yt.value ? "" : void 0,
636
+ "data-disabled": m.disabled ? "" : void 0,
637
+ "data-readonly": !m.disabled && z.value ? "" : void 0,
638
+ "data-invalid": m.invalid || R.value ? "" : void 0,
639
+ "data-member": "rich-text-input"
640
+ }, [
641
+ f("div", { class: h(x(i).frame) }, [
642
+ Ln.value ? (v(), d("div", {
643
+ key: 0,
644
+ ref_key: "toolbarRow",
645
+ ref: N,
646
+ class: h(x(i).toolbar),
647
+ role: "toolbar",
648
+ "aria-label": I.value.toolbar,
649
+ "aria-controls": Dt.value,
650
+ "data-rich-text-input-part": "toolbar",
651
+ onKeydown: o[7] ||= (e) => x(Ee)(e.currentTarget, e, _n.value, jt.value),
652
+ onFocusin: o[8] ||= (e) => x(we)(e.currentTarget, e, _n.value),
653
+ onFocusout: o[9] ||= (e) => x(Te)(e.currentTarget, e, _n.value),
654
+ onMousedown: o[10] ||= (e) => x(Oe)(e.currentTarget, e),
655
+ onClickCapture: o[11] ||= (e) => ct.value = e.detail > 0,
656
+ onKeydownCapture: o[12] ||= (e) => ct.value = !1
657
+ }, [In.value ? (v(), d("div", {
658
+ key: 0,
659
+ ref_key: "controls",
660
+ ref: ht,
661
+ class: h(x(i).controls)
662
+ }, [
663
+ H.value.length > 0 || V.value("link") ? (v(), d("div", {
664
+ key: 0,
665
+ class: h(x(i).group)
666
+ }, [(v(!0), d(s, null, Ne(H.value, (t) => (v(), l(e, {
667
+ key: t.format,
668
+ variant: "ghost",
669
+ tone: "neutral",
670
+ size: "sm",
671
+ iconOnly: !0,
672
+ icon: t.icon,
673
+ label: I.value[t.format],
674
+ pressed: U.value?.[t.format] ?? !1,
675
+ disabled: B.value || W.value?.[t.format] === !1,
676
+ onClick: (e) => kn.value(e, (e) => e.toggle(t.format))
677
+ }, null, 8, [
678
+ "icon",
679
+ "label",
680
+ "pressed",
681
+ "disabled",
682
+ "onClick"
683
+ ]))), 128)), V.value("link") ? (v(), l(r, {
684
+ key: 0,
685
+ label: I.value.linkForm,
686
+ open: k.value,
687
+ onOpenChange: o[3] ||= (e) => Zt.value(e)
688
+ }, {
689
+ trigger: w(() => [p(e, {
690
+ variant: "ghost",
691
+ tone: "neutral",
692
+ size: "sm",
693
+ iconOnly: !0,
694
+ icon: "link",
695
+ label: I.value.link,
696
+ pressed: (U.value?.link ?? null) !== null,
697
+ disabled: B.value || W.value?.link === !1
698
+ }, null, 8, [
699
+ "label",
700
+ "pressed",
701
+ "disabled"
702
+ ])]),
703
+ default: w(() => [f("form", {
704
+ ref_key: "linkForm",
705
+ ref: gt,
706
+ class: h(x(i).linkForm),
707
+ novalidate: !0,
708
+ onSubmit: o[2] ||= (e) => Qt.value(e)
709
+ }, [p(te, {
710
+ label: I.value.linkAddress,
711
+ error: at.value
712
+ }, {
713
+ default: w(() => [p(n, {
714
+ value: it.value,
715
+ autoComplete: "off",
716
+ onChange: o[0] ||= (e) => (it.value = e, at.value = void 0)
717
+ }, null, 8, ["value"])]),
718
+ _: 1
719
+ }, 8, ["label", "error"]), f("div", { class: h(x(i).linkActions) }, [ot.value === null ? u("", !0) : (v(), l(e, {
720
+ key: 0,
721
+ variant: "ghost",
722
+ tone: "neutral",
723
+ size: "sm",
724
+ label: I.value.linkRemove,
725
+ onClick: o[1] ||= (e) => $t.value()
726
+ }, null, 8, ["label"])), p(e, {
727
+ type: "submit",
728
+ variant: "solid",
729
+ tone: "accent",
730
+ size: "sm",
731
+ label: I.value.linkApply
732
+ }, null, 8, ["label"])], 2)], 34)]),
733
+ _: 1
734
+ }, 8, ["label", "open"])) : u("", !0)], 2)) : u("", !0),
735
+ V.value("heading") ? (v(), d(s, { key: 1 }, [H.value.length > 0 || V.value("link") ? (v(), l(ne, {
736
+ key: 0,
737
+ orientation: "vertical"
738
+ })) : u("", !0), f("div", { class: h(x(i).group) }, [p(t, {
739
+ open: A.value,
740
+ items: nn.value,
741
+ onOpenChange: o[4] ||= (e) => rn.value(e)
742
+ }, {
743
+ trigger: w(() => [p(e, {
744
+ variant: "ghost",
745
+ tone: "neutral",
746
+ size: "sm",
747
+ iconOnly: !0,
748
+ icon: "heading",
749
+ label: I.value.textStyle,
750
+ disabled: B.value || W.value?.heading === !1
751
+ }, null, 8, ["label", "disabled"])]),
752
+ _: 1
753
+ }, 8, ["open", "items"])], 2)], 64)) : u("", !0),
754
+ Et.value.length > 0 ? (v(), d(s, { key: 2 }, [H.value.length > 0 || V.value("link") || V.value("heading") ? (v(), l(ne, {
755
+ key: 0,
756
+ orientation: "vertical"
757
+ })) : u("", !0), f("div", { class: h(x(i).group) }, [(v(!0), d(s, null, Ne(Et.value, (t) => (v(), l(e, {
758
+ key: t.format,
759
+ variant: "ghost",
760
+ tone: "neutral",
761
+ size: "sm",
762
+ iconOnly: !0,
763
+ icon: t.icon,
764
+ label: I.value[t.format],
765
+ pressed: U.value?.[t.format] ?? !1,
766
+ disabled: B.value || W.value?.[t.format] === !1,
767
+ onClick: (e) => kn.value(e, (e) => e.toggle(t.format))
768
+ }, null, 8, [
769
+ "icon",
770
+ "label",
771
+ "pressed",
772
+ "disabled",
773
+ "onClick"
774
+ ]))), 128))], 2)], 64)) : u("", !0),
775
+ H.value.length > 0 || V.value("link") || V.value("heading") || Et.value.length > 0 ? (v(), l(ne, {
776
+ key: 3,
777
+ orientation: "vertical"
778
+ })) : u("", !0),
779
+ f("div", { class: h(x(i).group) }, [p(e, {
780
+ variant: "ghost",
781
+ tone: "neutral",
782
+ size: "sm",
783
+ iconOnly: !0,
784
+ icon: "undo",
785
+ label: I.value.undo,
786
+ disabled: B.value || W.value?.undo !== !0,
787
+ onClick: o[5] ||= (e) => kn.value(e, (e) => e.undo())
788
+ }, null, 8, ["label", "disabled"]), p(e, {
789
+ variant: "ghost",
790
+ tone: "neutral",
791
+ size: "sm",
792
+ iconOnly: !0,
793
+ icon: "redo",
794
+ label: I.value.redo,
795
+ disabled: B.value || W.value?.redo !== !0,
796
+ onClick: o[6] ||= (e) => kn.value(e, (e) => e.redo())
797
+ }, null, 8, ["label", "disabled"])], 2)
798
+ ], 2)) : u("", !0), a.$slots.toolbar ? (v(), d("div", {
799
+ key: 1,
800
+ class: h(x(i).slot)
801
+ }, [Pe(a.$slots, "toolbar", {
802
+ focus: Z.value.focus,
803
+ clear: Z.value.clear,
804
+ insertText: Z.value.insertText,
805
+ insertEntity: Z.value.insertEntity,
806
+ annotate: Z.value.annotate,
807
+ removeAnnotation: Z.value.removeAnnotation,
808
+ value: Z.value.value,
809
+ empty: Z.value.empty,
810
+ length: Z.value.length,
811
+ overLimit: Z.value.overLimit,
812
+ disabled: Z.value.disabled,
813
+ selection: Z.value.selection
814
+ })], 2)) : u("", !0)], 42, Be)) : u("", !0),
815
+ f("div", { class: h(x(i).viewport) }, [f("div", {
816
+ ref: x(vt),
817
+ class: h(x(i).surface),
818
+ "data-rich-text-input-part": "surface",
819
+ id: Dt.value,
820
+ role: "textbox",
821
+ "aria-multiline": "true",
822
+ "aria-label": m.ariaLabel,
823
+ "aria-labelledby": m.ariaLabelledby,
824
+ "aria-describedby": Cn.value,
825
+ "aria-required": m.ariaRequired === !0 ? "true" : void 0,
826
+ "aria-invalid": m.invalid || R.value ? "true" : void 0,
827
+ "aria-disabled": m.disabled ? "true" : void 0,
828
+ "aria-readonly": !m.disabled && z.value ? "true" : void 0,
829
+ tabindex: m.disabled ? void 0 : "0",
830
+ "aria-autocomplete": wn.value ? "list" : void 0,
831
+ "aria-haspopup": wn.value ? "listbox" : void 0,
832
+ "aria-controls": Tn.value["aria-controls"],
833
+ "aria-activedescendant": Tn.value["aria-activedescendant"],
834
+ onKeydown: o[13] ||= (e) => An.value(e),
835
+ onPointerdown: o[14] ||= (e) => jn.value(),
836
+ onClick: o[15] ||= (e) => Mn.value(e),
837
+ onFocusin: o[16] ||= (e) => lt.value = !0,
838
+ onFocusout: o[17] ||= (e) => Nn.value(e)
839
+ }, null, 42, Ve)], 2),
840
+ x(Bn) ? (v(), d("div", {
841
+ key: 1,
842
+ ref_key: "bar",
843
+ ref: j,
844
+ class: h(x(re).bar),
845
+ role: "toolbar",
846
+ "aria-label": I.value.selectionBar,
847
+ "data-state": $.value ? void 0 : "closed",
848
+ inert: !$.value || void 0,
849
+ onKeydown: o[25] ||= (e) => x(Ee)(e.currentTarget, e, vn.value, jt.value),
850
+ onFocusin: o[26] ||= (e) => (x(we)(e.currentTarget, e, vn.value), ut.value = !0),
851
+ onFocusout: o[27] ||= (e) => (x(Te)(e.currentTarget, e, vn.value), Pn.value(e)),
852
+ onMousedown: o[28] ||= (e) => x(Oe)(e.currentTarget, e)
853
+ }, [f("div", {
854
+ class: h(x(i).controls),
855
+ onClickCapture: o[23] ||= (e) => ct.value = e.detail > 0,
856
+ onKeydownCapture: o[24] ||= (e) => ct.value = !1
857
+ }, [
858
+ ln.value ? (v(), d("div", {
859
+ key: 0,
860
+ class: h(x(i).group)
861
+ }, [Pe(a.$slots, "selectionActions", {
862
+ focus: Z.value.focus,
863
+ clear: Z.value.clear,
864
+ insertText: Z.value.insertText,
865
+ insertEntity: Z.value.insertEntity,
866
+ annotate: Z.value.annotate,
867
+ removeAnnotation: Z.value.removeAnnotation,
868
+ value: Z.value.value,
869
+ empty: Z.value.empty,
870
+ length: Z.value.length,
871
+ overLimit: Z.value.overLimit,
872
+ disabled: Z.value.disabled,
873
+ selection: Z.value.selection
874
+ })], 2)) : u("", !0),
875
+ Q.value && (H.value.length > 0 || V.value("link")) ? (v(), d(s, { key: 1 }, [ln.value ? (v(), l(ne, {
876
+ key: 0,
877
+ orientation: "vertical"
878
+ })) : u("", !0), f("div", { class: h(x(i).group) }, [(v(!0), d(s, null, Ne(H.value, (t) => (v(), l(e, {
879
+ key: t.format,
880
+ variant: "ghost",
881
+ tone: "neutral",
882
+ size: "sm",
883
+ iconOnly: !0,
884
+ icon: t.icon,
885
+ label: I.value[t.format],
886
+ pressed: U.value?.[t.format] ?? !1,
887
+ disabled: B.value || W.value?.[t.format] === !1,
888
+ onClick: (e) => kn.value(e, (e) => e.toggle(t.format))
889
+ }, null, 8, [
890
+ "icon",
891
+ "label",
892
+ "pressed",
893
+ "disabled",
894
+ "onClick"
895
+ ]))), 128)), V.value("link") ? (v(), l(r, {
896
+ key: 0,
897
+ label: I.value.linkForm,
898
+ open: k.value,
899
+ onOpenChange: o[21] ||= (e) => Zt.value(e)
900
+ }, {
901
+ trigger: w(() => [p(e, {
902
+ variant: "ghost",
903
+ tone: "neutral",
904
+ size: "sm",
905
+ iconOnly: !0,
906
+ icon: "link",
907
+ label: I.value.link,
908
+ pressed: (U.value?.link ?? null) !== null,
909
+ disabled: B.value || W.value?.link === !1
910
+ }, null, 8, [
911
+ "label",
912
+ "pressed",
913
+ "disabled"
914
+ ])]),
915
+ default: w(() => [f("form", {
916
+ ref_key: "linkForm",
917
+ ref: gt,
918
+ class: h(x(i).linkForm),
919
+ novalidate: !0,
920
+ onSubmit: o[20] ||= (e) => Qt.value(e)
921
+ }, [p(te, {
922
+ label: I.value.linkAddress,
923
+ error: at.value
924
+ }, {
925
+ default: w(() => [p(n, {
926
+ value: it.value,
927
+ autoComplete: "off",
928
+ onChange: o[18] ||= (e) => (it.value = e, at.value = void 0)
929
+ }, null, 8, ["value"])]),
930
+ _: 1
931
+ }, 8, ["label", "error"]), f("div", { class: h(x(i).linkActions) }, [ot.value === null ? u("", !0) : (v(), l(e, {
932
+ key: 0,
933
+ variant: "ghost",
934
+ tone: "neutral",
935
+ size: "sm",
936
+ label: I.value.linkRemove,
937
+ onClick: o[19] ||= (e) => $t.value()
938
+ }, null, 8, ["label"])), p(e, {
939
+ type: "submit",
940
+ variant: "solid",
941
+ tone: "accent",
942
+ size: "sm",
943
+ label: I.value.linkApply
944
+ }, null, 8, ["label"])], 2)], 34)]),
945
+ _: 1
946
+ }, 8, ["label", "open"])) : u("", !0)], 2)], 64)) : u("", !0),
947
+ Q.value && V.value("heading") ? (v(), d(s, { key: 2 }, [ln.value || Q.value && (H.value.length > 0 || V.value("link")) ? (v(), l(ne, {
948
+ key: 0,
949
+ orientation: "vertical"
950
+ })) : u("", !0), f("div", { class: h(x(i).group) }, [p(t, {
951
+ open: A.value,
952
+ items: nn.value,
953
+ onOpenChange: o[22] ||= (e) => rn.value(e)
954
+ }, {
955
+ trigger: w(() => [p(e, {
956
+ variant: "ghost",
957
+ tone: "neutral",
958
+ size: "sm",
959
+ iconOnly: !0,
960
+ icon: "heading",
961
+ label: I.value.textStyle,
962
+ disabled: B.value || W.value?.heading === !1
963
+ }, null, 8, ["label", "disabled"])]),
964
+ _: 1
965
+ }, 8, ["open", "items"])], 2)], 64)) : u("", !0),
966
+ Q.value && Et.value.length > 0 ? (v(), d(s, { key: 3 }, [ln.value || Q.value && (H.value.length > 0 || V.value("link")) || Q.value && V.value("heading") ? (v(), l(ne, {
967
+ key: 0,
968
+ orientation: "vertical"
969
+ })) : u("", !0), f("div", { class: h(x(i).group) }, [(v(!0), d(s, null, Ne(Et.value, (t) => (v(), l(e, {
970
+ key: t.format,
971
+ variant: "ghost",
972
+ tone: "neutral",
973
+ size: "sm",
974
+ iconOnly: !0,
975
+ icon: t.icon,
976
+ label: I.value[t.format],
977
+ pressed: U.value?.[t.format] ?? !1,
978
+ disabled: B.value || W.value?.[t.format] === !1,
979
+ onClick: (e) => kn.value(e, (e) => e.toggle(t.format))
980
+ }, null, 8, [
981
+ "icon",
982
+ "label",
983
+ "pressed",
984
+ "disabled",
985
+ "onClick"
986
+ ]))), 128))], 2)], 64)) : u("", !0)
987
+ ], 34)], 42, He)) : u("", !0),
988
+ zn.value ? (v(), d("div", {
989
+ key: 2,
990
+ class: h(x(i).footer)
991
+ }, [m.maxLength === void 0 ? u("", !0) : (v(), d("p", {
992
+ key: 0,
993
+ class: h(x(i).count),
994
+ id: kt.value,
995
+ "data-state": R.value ? "over" : void 0
996
+ }, b(R.value ? I.value.overLimit(xt.value) : I.value.count(bt.value, m.maxLength)), 11, Ue)), a.$slots.footer ? Pe(a.$slots, "footer", {
997
+ focus: Z.value.focus,
998
+ clear: Z.value.clear,
999
+ insertText: Z.value.insertText,
1000
+ insertEntity: Z.value.insertEntity,
1001
+ annotate: Z.value.annotate,
1002
+ removeAnnotation: Z.value.removeAnnotation,
1003
+ value: Z.value.value,
1004
+ empty: Z.value.empty,
1005
+ length: Z.value.length,
1006
+ overLimit: Z.value.overLimit,
1007
+ disabled: Z.value.disabled,
1008
+ selection: Z.value.selection
1009
+ }, void 0, void 0, 1) : (v(), d("div", {
1010
+ key: 2,
1011
+ ref_key: "actions",
1012
+ ref: mt,
1013
+ class: h(x(i).actions)
1014
+ }, [m.cancelLabel !== void 0 && x(D).cancel ? (v(), l(e, {
1015
+ key: 0,
1016
+ variant: "ghost",
1017
+ tone: "neutral",
1018
+ size: "sm",
1019
+ label: m.cancelLabel,
1020
+ disabled: m.disabled,
1021
+ onClick: o[29] ||= (e) => E("cancel")
1022
+ }, null, 8, ["label", "disabled"])) : u("", !0), p(e, {
1023
+ variant: "solid",
1024
+ tone: "accent",
1025
+ size: "sm",
1026
+ label: m.submitLabel ?? "",
1027
+ disabled: m.disabled || yt.value || R.value,
1028
+ loading: m.pending,
1029
+ onClick: o[30] ||= (e) => Xt.value()
1030
+ }, null, 8, [
1031
+ "label",
1032
+ "disabled",
1033
+ "loading"
1034
+ ])], 2))], 2)) : u("", !0)
1035
+ ], 2),
1036
+ zn.value ? u("", !0) : (v(), d(s, { key: 0 }, [m.maxLength === void 0 ? u("", !0) : (v(), d("p", {
1037
+ key: 0,
1038
+ class: h(x(i).count),
1039
+ id: kt.value,
1040
+ "data-state": R.value ? "over" : void 0
1041
+ }, b(R.value ? I.value.overLimit(xt.value) : I.value.count(bt.value, m.maxLength)), 11, We))], 64)),
1042
+ J.value && q.value !== void 0 ? (v(), d("div", {
1043
+ key: 1,
1044
+ ref_key: "panel",
1045
+ ref: _t,
1046
+ class: h(x(i).suggestions),
1047
+ "data-rich-text-input-part": "suggestions",
1048
+ onMousedown: o[31] ||= (e) => e.preventDefault()
1049
+ }, [
1050
+ Y.value.length > 0 ? (v(), d("ul", {
1051
+ key: 0,
1052
+ class: h(x(i).listbox),
1053
+ id: Ot.value,
1054
+ role: "listbox",
1055
+ "aria-label": q.value?.label
1056
+ }, [(v(!0), d(s, null, Ne(Y.value, (e, t) => (v(), d("li", {
1057
+ key: e.id,
1058
+ class: h(x(i).option),
1059
+ id: Sn.value(e),
1060
+ role: "option",
1061
+ "aria-selected": t === X.value ? "true" : "false",
1062
+ "data-highlighted": t === X.value ? "" : void 0,
1063
+ onPointermove: (e) => t !== X.value && (et.value = {
1064
+ key: Wt.value,
1065
+ index: t
1066
+ }),
1067
+ onClick: (e) => Kt.value(t)
1068
+ }, [e.leading === void 0 ? e.icon === void 0 ? u("", !0) : (v(), d("span", {
1069
+ key: 1,
1070
+ class: h(x(i).glyph)
1071
+ }, [p(x(ie), {
1072
+ name: e.icon,
1073
+ size: "sm"
1074
+ }, null, 8, ["name"])], 2)) : (v(), d("span", {
1075
+ key: 0,
1076
+ class: h(x(i).leading),
1077
+ "aria-hidden": "true"
1078
+ }, [(v(), l(Fe(e.leading)))], 2)), f("span", { class: h(x(i).text) }, [f("span", { class: h(x(i).label) }, b(e.label), 3), e.description === void 0 ? u("", !0) : (v(), d("span", {
1079
+ key: 0,
1080
+ class: h(x(i).description)
1081
+ }, b(e.description), 3))], 2)], 42, Ke))), 128))], 10, Ge)) : u("", !0),
1082
+ Ht.value ? (v(), d("div", {
1083
+ key: 1,
1084
+ class: h(x(i).rows),
1085
+ "aria-hidden": "true"
1086
+ }, [(v(), d(s, null, Ne([
1087
+ 0,
1088
+ 1,
1089
+ 2
1090
+ ], (e) => f("div", {
1091
+ key: e,
1092
+ class: h(x(i).row)
1093
+ }, [p(ee, { textStep: "sm" })], 2)), 64))], 2)) : u("", !0),
1094
+ Ut.value ? (v(), d("div", {
1095
+ key: 2,
1096
+ class: h(x(i).error),
1097
+ "aria-hidden": "true"
1098
+ }, b(q.value?.error), 3)) : u("", !0),
1099
+ !Ht.value && !Ut.value && Y.value.length === 0 ? (v(), d("div", {
1100
+ key: 3,
1101
+ class: h(x(i).empty),
1102
+ "aria-hidden": "true"
1103
+ }, b(I.value.noSuggestions), 3)) : u("", !0)
1104
+ ], 34)) : u("", !0),
1105
+ f("div", {
1106
+ class: h(x(i).status),
1107
+ role: "status",
1108
+ "aria-live": "polite"
1109
+ }, [$e.value.text === "" ? u("", !0) : (v(), d("span", { key: $e.value.at }, b($e.value.text), 1))], 2),
1110
+ m.name === void 0 ? u("", !0) : (v(), d("input", {
1111
+ key: 2,
1112
+ type: "hidden",
1113
+ name: m.name,
1114
+ value: x(Se)(L.value),
1115
+ disabled: m.disabled
1116
+ }, null, 8, qe))
1117
+ ], 10, ze));
1118
+ }
1119
+ });
1120
+ //#endregion
1121
+ export { Je as default };
1122
+
1123
+ //# sourceMappingURL=RichTextInput.vue_vue_type_script_setup_true_lang.js.map