@frplm/ui 0.1.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (188) hide show
  1. package/README.md +20 -0
  2. package/dist/index.js +2034 -0
  3. package/dist/style.css +1 -0
  4. package/dist/types/sdk/src/HostSdkBindings.d.ts +45 -0
  5. package/dist/types/sdk/src/HostSdkBindings.d.ts.map +1 -0
  6. package/dist/types/sdk/src/components.d.ts +15 -0
  7. package/dist/types/sdk/src/components.d.ts.map +1 -0
  8. package/dist/types/src/App.vue.d.ts +4 -0
  9. package/dist/types/src/App.vue.d.ts.map +1 -0
  10. package/dist/types/src/app/router.d.ts +4 -0
  11. package/dist/types/src/app/router.d.ts.map +1 -0
  12. package/dist/types/src/components/char/CharacterEditor.vue.d.ts +18 -0
  13. package/dist/types/src/components/char/CharacterEditor.vue.d.ts.map +1 -0
  14. package/dist/types/src/components/char/CharacterLanding.vue.d.ts +4 -0
  15. package/dist/types/src/components/char/CharacterLanding.vue.d.ts.map +1 -0
  16. package/dist/types/src/components/char/StartingLocation.vue.d.ts +12 -0
  17. package/dist/types/src/components/char/StartingLocation.vue.d.ts.map +1 -0
  18. package/dist/types/src/components/chat/Chat.vue.d.ts +15 -0
  19. package/dist/types/src/components/chat/Chat.vue.d.ts.map +1 -0
  20. package/dist/types/src/components/chat/ChatBar.vue.d.ts +12 -0
  21. package/dist/types/src/components/chat/ChatBar.vue.d.ts.map +1 -0
  22. package/dist/types/src/components/chat/ChatMessage.vue.d.ts +15 -0
  23. package/dist/types/src/components/chat/ChatMessage.vue.d.ts.map +1 -0
  24. package/dist/types/src/components/chat/ConfigSidebar.vue.d.ts +12 -0
  25. package/dist/types/src/components/chat/ConfigSidebar.vue.d.ts.map +1 -0
  26. package/dist/types/src/components/chat/PromptDebug.vue.d.ts +8 -0
  27. package/dist/types/src/components/chat/PromptDebug.vue.d.ts.map +1 -0
  28. package/dist/types/src/components/connections/APIKeysPopup.vue.d.ts +8 -0
  29. package/dist/types/src/components/connections/APIKeysPopup.vue.d.ts.map +1 -0
  30. package/dist/types/src/components/connections/ConnectionLanding.vue.d.ts +4 -0
  31. package/dist/types/src/components/connections/ConnectionLanding.vue.d.ts.map +1 -0
  32. package/dist/types/src/components/connections/LLMEditor.vue.d.ts +12 -0
  33. package/dist/types/src/components/connections/LLMEditor.vue.d.ts.map +1 -0
  34. package/dist/types/src/components/errors/GlobalError.vue.d.ts +4 -0
  35. package/dist/types/src/components/errors/GlobalError.vue.d.ts.map +1 -0
  36. package/dist/types/src/components/extension/ExtensionConfigs.vue.d.ts +4 -0
  37. package/dist/types/src/components/extension/ExtensionConfigs.vue.d.ts.map +1 -0
  38. package/dist/types/src/components/layout/EmptyView.vue.d.ts +4 -0
  39. package/dist/types/src/components/layout/EmptyView.vue.d.ts.map +1 -0
  40. package/dist/types/src/components/lorebooks/EntryEditor.vue.d.ts +19 -0
  41. package/dist/types/src/components/lorebooks/EntryEditor.vue.d.ts.map +1 -0
  42. package/dist/types/src/components/lorebooks/LorebookEditor.vue.d.ts +18 -0
  43. package/dist/types/src/components/lorebooks/LorebookEditor.vue.d.ts.map +1 -0
  44. package/dist/types/src/components/lorebooks/LorebookLanding.vue.d.ts +4 -0
  45. package/dist/types/src/components/lorebooks/LorebookLanding.vue.d.ts.map +1 -0
  46. package/dist/types/src/components/primitive-editors/AutoCompleteBox.vue.d.ts +22 -0
  47. package/dist/types/src/components/primitive-editors/AutoCompleteBox.vue.d.ts.map +1 -0
  48. package/dist/types/src/components/primitive-editors/BooleanTickBox.vue.d.ts +22 -0
  49. package/dist/types/src/components/primitive-editors/BooleanTickBox.vue.d.ts.map +1 -0
  50. package/dist/types/src/components/primitive-editors/BooleanToggle.vue.d.ts +22 -0
  51. package/dist/types/src/components/primitive-editors/BooleanToggle.vue.d.ts.map +1 -0
  52. package/dist/types/src/components/primitive-editors/LongTextBox.vue.d.ts +22 -0
  53. package/dist/types/src/components/primitive-editors/LongTextBox.vue.d.ts.map +1 -0
  54. package/dist/types/src/components/primitive-editors/NumberInput.vue.d.ts +36 -0
  55. package/dist/types/src/components/primitive-editors/NumberInput.vue.d.ts.map +1 -0
  56. package/dist/types/src/components/primitive-editors/NumberSlider.vue.d.ts +28 -0
  57. package/dist/types/src/components/primitive-editors/NumberSlider.vue.d.ts.map +1 -0
  58. package/dist/types/src/components/primitive-editors/ShortTextBox.vue.d.ts +20 -0
  59. package/dist/types/src/components/primitive-editors/ShortTextBox.vue.d.ts.map +1 -0
  60. package/dist/types/src/components/primitive-editors/SingleAutoComplete.vue.d.ts +26 -0
  61. package/dist/types/src/components/primitive-editors/SingleAutoComplete.vue.d.ts.map +1 -0
  62. package/dist/types/src/components/primitive-editors/SingleEnumInput.vue.d.ts +26 -0
  63. package/dist/types/src/components/primitive-editors/SingleEnumInput.vue.d.ts.map +1 -0
  64. package/dist/types/src/components/primitive-editors/components.d.ts +10 -0
  65. package/dist/types/src/components/primitive-editors/components.d.ts.map +1 -0
  66. package/dist/types/src/components/primitive-editors/index.d.ts +3 -0
  67. package/dist/types/src/components/primitive-editors/index.d.ts.map +1 -0
  68. package/dist/types/src/components/primitive-editors/plugin.d.ts +3 -0
  69. package/dist/types/src/components/primitive-editors/plugin.d.ts.map +1 -0
  70. package/dist/types/src/components/prompts/PromptSectionEditor.vue.d.ts +17 -0
  71. package/dist/types/src/components/prompts/PromptSectionEditor.vue.d.ts.map +1 -0
  72. package/dist/types/src/components/prompts/PromptTemplateEditor.vue.d.ts +12 -0
  73. package/dist/types/src/components/prompts/PromptTemplateEditor.vue.d.ts.map +1 -0
  74. package/dist/types/src/components/prompts/PromptTemplatePicker.vue.d.ts +8 -0
  75. package/dist/types/src/components/prompts/PromptTemplatePicker.vue.d.ts.map +1 -0
  76. package/dist/types/src/components/session/NewSessionPopUp.vue.d.ts +26 -0
  77. package/dist/types/src/components/session/NewSessionPopUp.vue.d.ts.map +1 -0
  78. package/dist/types/src/components/session/SessionList.vue.d.ts +4 -0
  79. package/dist/types/src/components/session/SessionList.vue.d.ts.map +1 -0
  80. package/dist/types/src/components/session/SessionTease.vue.d.ts +17 -0
  81. package/dist/types/src/components/session/SessionTease.vue.d.ts.map +1 -0
  82. package/dist/types/src/components/settings/Settings.vue.d.ts +4 -0
  83. package/dist/types/src/components/settings/Settings.vue.d.ts.map +1 -0
  84. package/dist/types/src/components/settings/ThemeSettings.vue.d.ts +4 -0
  85. package/dist/types/src/components/settings/ThemeSettings.vue.d.ts.map +1 -0
  86. package/dist/types/src/components/space/ConnectLocationPrompt.vue.d.ts +16 -0
  87. package/dist/types/src/components/space/ConnectLocationPrompt.vue.d.ts.map +1 -0
  88. package/dist/types/src/components/space/EdgeEditor.vue.d.ts +20 -0
  89. package/dist/types/src/components/space/EdgeEditor.vue.d.ts.map +1 -0
  90. package/dist/types/src/components/space/LocationEdgesEditor.vue.d.ts +21 -0
  91. package/dist/types/src/components/space/LocationEdgesEditor.vue.d.ts.map +1 -0
  92. package/dist/types/src/components/space/LocationEditor.vue.d.ts +21 -0
  93. package/dist/types/src/components/space/LocationEditor.vue.d.ts.map +1 -0
  94. package/dist/types/src/components/space/RegionEditor.vue.d.ts +12 -0
  95. package/dist/types/src/components/space/RegionEditor.vue.d.ts.map +1 -0
  96. package/dist/types/src/components/space/WorldEdit.vue.d.ts +12 -0
  97. package/dist/types/src/components/space/WorldEdit.vue.d.ts.map +1 -0
  98. package/dist/types/src/components/space/WorldLanding.vue.d.ts +4 -0
  99. package/dist/types/src/components/space/WorldLanding.vue.d.ts.map +1 -0
  100. package/dist/types/src/components/space/WorldLocationGraph.vue.d.ts +8 -0
  101. package/dist/types/src/components/space/WorldLocationGraph.vue.d.ts.map +1 -0
  102. package/dist/types/src/components/tags/TagAutocomplete.vue.d.ts +19 -0
  103. package/dist/types/src/components/tags/TagAutocomplete.vue.d.ts.map +1 -0
  104. package/dist/types/src/components/utils/FieldEditorWrapper.vue.d.ts +22 -0
  105. package/dist/types/src/components/utils/FieldEditorWrapper.vue.d.ts.map +1 -0
  106. package/dist/types/src/components/utils/PrologValidator.vue.d.ts +11 -0
  107. package/dist/types/src/components/utils/PrologValidator.vue.d.ts.map +1 -0
  108. package/dist/types/src/components/utils/SearchBar.vue.d.ts +19 -0
  109. package/dist/types/src/components/utils/SearchBar.vue.d.ts.map +1 -0
  110. package/dist/types/src/components/utils/buttons/IconButton.vue.d.ts +30 -0
  111. package/dist/types/src/components/utils/buttons/IconButton.vue.d.ts.map +1 -0
  112. package/dist/types/src/components/utils/img/AvatarDisplay.vue.d.ts +4 -0
  113. package/dist/types/src/components/utils/img/AvatarDisplay.vue.d.ts.map +1 -0
  114. package/dist/types/src/components/utils/list/Card.vue.d.ts +36 -0
  115. package/dist/types/src/components/utils/list/Card.vue.d.ts.map +1 -0
  116. package/dist/types/src/components/utils/list/List.vue.d.ts +28 -0
  117. package/dist/types/src/components/utils/list/List.vue.d.ts.map +1 -0
  118. package/dist/types/src/components/utils/list/SimpleList.vue.d.ts +26 -0
  119. package/dist/types/src/components/utils/list/SimpleList.vue.d.ts.map +1 -0
  120. package/dist/types/src/components/utils/panels/Expandable.vue.d.ts +57 -0
  121. package/dist/types/src/components/utils/panels/Expandable.vue.d.ts.map +1 -0
  122. package/dist/types/src/components/utils/panels/ExpandableSplitPanel.vue.d.ts +58 -0
  123. package/dist/types/src/components/utils/panels/ExpandableSplitPanel.vue.d.ts.map +1 -0
  124. package/dist/types/src/components/utils/panels/SplitPanel.vue.d.ts +24 -0
  125. package/dist/types/src/components/utils/panels/SplitPanel.vue.d.ts.map +1 -0
  126. package/dist/types/src/components/utils/prompts/EnumPrompt.vue.d.ts +29 -0
  127. package/dist/types/src/components/utils/prompts/EnumPrompt.vue.d.ts.map +1 -0
  128. package/dist/types/src/components/utils/prompts/InlinePopover.vue.d.ts +50 -0
  129. package/dist/types/src/components/utils/prompts/InlinePopover.vue.d.ts.map +1 -0
  130. package/dist/types/src/components/utils/prompts/WindowPrompt.vue.d.ts +53 -0
  131. package/dist/types/src/components/utils/prompts/WindowPrompt.vue.d.ts.map +1 -0
  132. package/dist/types/src/config.d.ts +2 -0
  133. package/dist/types/src/config.d.ts.map +1 -0
  134. package/dist/types/src/core/ABSEntity.d.ts +63 -0
  135. package/dist/types/src/core/ABSEntity.d.ts.map +1 -0
  136. package/dist/types/src/core/FieldMetadata.d.ts +38 -0
  137. package/dist/types/src/core/FieldMetadata.d.ts.map +1 -0
  138. package/dist/types/src/core/GlobalError.d.ts +10 -0
  139. package/dist/types/src/core/GlobalError.d.ts.map +1 -0
  140. package/dist/types/src/core/interfaces.d.ts +11 -0
  141. package/dist/types/src/core/interfaces.d.ts.map +1 -0
  142. package/dist/types/src/core/queries.d.ts +13 -0
  143. package/dist/types/src/core/queries.d.ts.map +1 -0
  144. package/dist/types/src/core/theme.d.ts +45 -0
  145. package/dist/types/src/core/theme.d.ts.map +1 -0
  146. package/dist/types/src/domain/Characters.d.ts +52 -0
  147. package/dist/types/src/domain/Characters.d.ts.map +1 -0
  148. package/dist/types/src/domain/Connection.d.ts +66 -0
  149. package/dist/types/src/domain/Connection.d.ts.map +1 -0
  150. package/dist/types/src/domain/EntityTypes.d.ts +23 -0
  151. package/dist/types/src/domain/EntityTypes.d.ts.map +1 -0
  152. package/dist/types/src/domain/Lorebook.d.ts +84 -0
  153. package/dist/types/src/domain/Lorebook.d.ts.map +1 -0
  154. package/dist/types/src/domain/Prompts.d.ts +85 -0
  155. package/dist/types/src/domain/Prompts.d.ts.map +1 -0
  156. package/dist/types/src/domain/Session.d.ts +61 -0
  157. package/dist/types/src/domain/Session.d.ts.map +1 -0
  158. package/dist/types/src/domain/Tag.d.ts +18 -0
  159. package/dist/types/src/domain/Tag.d.ts.map +1 -0
  160. package/dist/types/src/domain/World.d.ts +87 -0
  161. package/dist/types/src/domain/World.d.ts.map +1 -0
  162. package/dist/types/src/extensions/HostBindings.d.ts +2 -0
  163. package/dist/types/src/extensions/HostBindings.d.ts.map +1 -0
  164. package/dist/types/src/extensions/extensions.d.ts +18 -0
  165. package/dist/types/src/extensions/extensions.d.ts.map +1 -0
  166. package/dist/types/src/extensions/registerPrimitiveEditors.d.ts +2 -0
  167. package/dist/types/src/extensions/registerPrimitiveEditors.d.ts.map +1 -0
  168. package/dist/types/src/services/apiClient.d.ts +34 -0
  169. package/dist/types/src/services/apiClient.d.ts.map +1 -0
  170. package/dist/types/src/services/tokenizer.d.ts +30 -0
  171. package/dist/types/src/services/tokenizer.d.ts.map +1 -0
  172. package/dist/types/src/types/ChatCompletions.d.ts +14 -0
  173. package/dist/types/src/types/ChatCompletions.d.ts.map +1 -0
  174. package/dist/types/src/types/DTOs.d.ts +19 -0
  175. package/dist/types/src/types/DTOs.d.ts.map +1 -0
  176. package/dist/types/src/types/Equatable.d.ts +9 -0
  177. package/dist/types/src/types/Equatable.d.ts.map +1 -0
  178. package/dist/types/src/utils/CommonFields.d.ts +6 -0
  179. package/dist/types/src/utils/CommonFields.d.ts.map +1 -0
  180. package/dist/types/src/utils/CustomSet.d.ts +12 -0
  181. package/dist/types/src/utils/CustomSet.d.ts.map +1 -0
  182. package/dist/types/src/utils/PromptThings.d.ts +10 -0
  183. package/dist/types/src/utils/PromptThings.d.ts.map +1 -0
  184. package/dist/types/src/utils/ReferenceCodec.d.ts +17 -0
  185. package/dist/types/src/utils/ReferenceCodec.d.ts.map +1 -0
  186. package/dist/types/ui/src/index.d.ts +10 -0
  187. package/dist/types/ui/src/index.d.ts.map +1 -0
  188. package/package.json +44 -0
package/dist/index.js ADDED
@@ -0,0 +1,2034 @@
1
+ import { defineComponent as te, ref as $, watch as G, computed as B, nextTick as U, onMounted as ke, onBeforeUnmount as he, openBlock as k, createElementBlock as E, normalizeClass as A, createElementVNode as i, Fragment as ye, renderList as Re, toDisplayString as Q, withModifiers as ee, withDirectives as me, withKeys as pe, vModelText as fe, createCommentVNode as K, createBlock as Me, Teleport as $e, createVNode as Ee, Transition as Te, withCtx as Se, normalizeStyle as Ce, useModel as ge, mergeModels as j, createStaticVNode as Oe, shallowRef as Ke, readonly as Ge, createTextVNode as Ie, unref as je } from "vue";
2
+ const Ye = { class: "tag-autocomplete__chip-label" }, Xe = ["aria-label", "onClick"], Qe = ["placeholder", "aria-label", "aria-expanded", "aria-controls"], Je = {
3
+ key: 0,
4
+ class: "tag-autocomplete__hint"
5
+ }, Ze = { class: "tag-autocomplete__suggestion-text" }, et = /* @__PURE__ */ te({
6
+ __name: "AutoCompleteBox",
7
+ props: {
8
+ suggestions: {},
9
+ modelValue: { default: () => [] },
10
+ placeholder: { default: "Type and press Tab to add…" },
11
+ allowCustom: { type: Boolean, default: !1 }
12
+ },
13
+ emits: ["update:modelValue", "add", "remove"],
14
+ setup(e, { emit: u }) {
15
+ const t = e, n = u, h = $([
16
+ ...t.modelValue
17
+ ]), a = $(""), l = $(!1), d = $(null), g = $(null), m = $(
18
+ "above"
19
+ ), b = $({}), M = `tag-suggestion-${Math.random().toString(36).slice(2, 10)}`;
20
+ let L = null;
21
+ G(
22
+ () => t.modelValue,
23
+ (o) => {
24
+ h.value = [...o ?? []];
25
+ }
26
+ );
27
+ const N = B(() => new Set(
28
+ h.value.map(
29
+ (o) => o.trim().toLocaleLowerCase()
30
+ )
31
+ )), S = B(() => {
32
+ const o = a.value.trim().toLocaleLowerCase();
33
+ if (!o)
34
+ return null;
35
+ const s = t.suggestions.find((T) => T.toLocaleLowerCase().startsWith(o));
36
+ return !s || N.value.has(
37
+ s.trim().toLocaleLowerCase()
38
+ ) ? null : s;
39
+ }), O = B(() => {
40
+ const o = a.value.trim();
41
+ return !t.allowCustom || !o ? !1 : !N.value.has(
42
+ o.toLocaleLowerCase()
43
+ );
44
+ }), I = B(() => l.value && S.value !== null);
45
+ G(
46
+ [S, l],
47
+ async ([o, s]) => {
48
+ !o || !s || (await U(), c());
49
+ }
50
+ );
51
+ function R(o, s, T) {
52
+ return Math.min(
53
+ Math.max(o, s),
54
+ Math.max(s, T)
55
+ );
56
+ }
57
+ function c() {
58
+ const o = d.value;
59
+ if (!o || !I.value)
60
+ return;
61
+ const s = o.getBoundingClientRect(), T = window.visualViewport, D = T?.width ?? window.innerWidth, J = T?.height ?? window.innerHeight, ue = T?.offsetLeft ?? 0, Y = T?.offsetTop ?? 0, v = s.left - ue, x = s.top - Y, C = s.bottom - Y, F = 12, X = 6, Z = 46, r = Math.max(
62
+ 0,
63
+ D - F * 2
64
+ ), p = Math.min(
65
+ Math.max(s.width, 220),
66
+ Math.min(448, r)
67
+ ), _ = R(
68
+ v,
69
+ F,
70
+ D - F - p
71
+ ), V = x - F - X, W = J - C - F - X;
72
+ if (W >= Z || W > V) {
73
+ m.value = "below", b.value = {
74
+ top: `${C + X}px`,
75
+ bottom: "auto",
76
+ left: `${_}px`,
77
+ width: `${p}px`,
78
+ maxWidth: `${r}px`
79
+ };
80
+ return;
81
+ }
82
+ m.value = "above", b.value = {
83
+ top: "auto",
84
+ bottom: `${J - x + X}px`,
85
+ left: `${_}px`,
86
+ width: `${p}px`,
87
+ maxWidth: `${r}px`
88
+ };
89
+ }
90
+ function w(o) {
91
+ h.value = o, n("update:modelValue", o);
92
+ }
93
+ function P(o) {
94
+ const s = o.trim();
95
+ if (!s || N.value.has(
96
+ s.toLocaleLowerCase()
97
+ ))
98
+ return;
99
+ const D = [
100
+ ...h.value,
101
+ s
102
+ ];
103
+ w(D), n("add", s);
104
+ }
105
+ function z(o) {
106
+ const s = h.value[o];
107
+ if (s === void 0)
108
+ return;
109
+ const T = [...h.value];
110
+ T.splice(o, 1), w(T), n("remove", s);
111
+ }
112
+ function y() {
113
+ const o = a.value.trim();
114
+ if (o) {
115
+ if (S.value)
116
+ P(S.value);
117
+ else if (O.value)
118
+ P(o);
119
+ else
120
+ return;
121
+ a.value = "", U(() => {
122
+ g.value?.focus();
123
+ });
124
+ }
125
+ }
126
+ function H(o) {
127
+ a.value === "" && h.value.length > 0 && (o.preventDefault(), z(
128
+ h.value.length - 1
129
+ ));
130
+ }
131
+ function re(o) {
132
+ (S.value || O.value) && (o.preventDefault(), y());
133
+ }
134
+ function oe(o) {
135
+ (S.value || O.value) && (o.preventDefault(), y());
136
+ }
137
+ function q() {
138
+ l.value = !0, U(() => {
139
+ d.value?.scrollIntoView({
140
+ block: "nearest",
141
+ inline: "nearest"
142
+ }), c();
143
+ });
144
+ }
145
+ function f() {
146
+ window.setTimeout(() => {
147
+ l.value = !1;
148
+ }, 100);
149
+ }
150
+ return ke(() => {
151
+ window.addEventListener(
152
+ "resize",
153
+ c
154
+ ), window.addEventListener(
155
+ "scroll",
156
+ c,
157
+ !0
158
+ ), window.visualViewport?.addEventListener(
159
+ "resize",
160
+ c
161
+ ), window.visualViewport?.addEventListener(
162
+ "scroll",
163
+ c
164
+ ), typeof ResizeObserver < "u" && d.value && (L = new ResizeObserver(
165
+ c
166
+ ), L.observe(d.value));
167
+ }), he(() => {
168
+ window.removeEventListener(
169
+ "resize",
170
+ c
171
+ ), window.removeEventListener(
172
+ "scroll",
173
+ c,
174
+ !0
175
+ ), window.visualViewport?.removeEventListener(
176
+ "resize",
177
+ c
178
+ ), window.visualViewport?.removeEventListener(
179
+ "scroll",
180
+ c
181
+ ), L?.disconnect();
182
+ }), (o, s) => (k(), E("div", {
183
+ class: A(["tag-autocomplete", {
184
+ "tag-autocomplete--focused": l.value
185
+ }])
186
+ }, [
187
+ i("div", {
188
+ ref_key: "controlRef",
189
+ ref: d,
190
+ class: "tag-autocomplete__control",
191
+ onClick: s[1] || (s[1] = (T) => g.value?.focus())
192
+ }, [
193
+ (k(!0), E(ye, null, Re(h.value, (T, D) => (k(), E("span", {
194
+ key: T,
195
+ class: "tag-autocomplete__chip"
196
+ }, [
197
+ i("span", Ye, Q(T), 1),
198
+ i("button", {
199
+ type: "button",
200
+ class: "tag-autocomplete__remove",
201
+ "aria-label": `Remove ${T}`,
202
+ onClick: ee((J) => z(D), ["stop"])
203
+ }, [...s[3] || (s[3] = [
204
+ i("svg", {
205
+ viewBox: "0 0 24 24",
206
+ "aria-hidden": "true"
207
+ }, [
208
+ i("path", { d: "M7 7l10 10" }),
209
+ i("path", { d: "M17 7 7 17" })
210
+ ], -1)
211
+ ])], 8, Xe)
212
+ ]))), 128)),
213
+ me(i("input", {
214
+ ref_key: "inputRef",
215
+ ref: g,
216
+ "onUpdate:modelValue": s[0] || (s[0] = (T) => a.value = T),
217
+ class: "tag-autocomplete__input",
218
+ type: "text",
219
+ role: "combobox",
220
+ "aria-autocomplete": "both",
221
+ "aria-haspopup": "listbox",
222
+ placeholder: h.value.length ? "" : e.placeholder,
223
+ "aria-label": e.placeholder,
224
+ "aria-expanded": I.value,
225
+ "aria-controls": I.value ? M : void 0,
226
+ autocomplete: "off",
227
+ spellcheck: "false",
228
+ onKeydown: [
229
+ pe(re, ["tab"]),
230
+ pe(oe, ["enter"]),
231
+ pe(H, ["backspace"])
232
+ ],
233
+ onFocus: q,
234
+ onBlur: f
235
+ }, null, 40, Qe), [
236
+ [fe, a.value]
237
+ ])
238
+ ], 512),
239
+ l.value ? (k(), E("p", Je, " Press Enter or Tab to add. Press Backspace to remove the last tag. ")) : K("", !0),
240
+ (k(), Me($e, { to: "body" }, [
241
+ Ee(Te, { name: "suggestion" }, {
242
+ default: Se(() => [
243
+ I.value ? (k(), E("button", {
244
+ key: 0,
245
+ id: M,
246
+ class: A(["tag-autocomplete__suggestion", {
247
+ "tag-autocomplete__suggestion--above": m.value === "above",
248
+ "tag-autocomplete__suggestion--below": m.value === "below"
249
+ }]),
250
+ style: Ce(b.value),
251
+ type: "button",
252
+ role: "option",
253
+ "aria-selected": "true",
254
+ tabindex: "-1",
255
+ onMousedown: s[2] || (s[2] = ee(() => {
256
+ }, ["prevent"])),
257
+ onClick: y
258
+ }, [
259
+ s[4] || (s[4] = i("svg", {
260
+ class: "tag-autocomplete__suggestion-icon",
261
+ viewBox: "0 0 24 24",
262
+ "aria-hidden": "true"
263
+ }, [
264
+ i("path", { d: "M12 5v14" }),
265
+ i("path", { d: "M5 12h14" })
266
+ ], -1)),
267
+ i("span", Ze, Q(S.value), 1),
268
+ s[5] || (s[5] = i("kbd", null, "Tab", -1))
269
+ ], 38)) : K("", !0)
270
+ ]),
271
+ _: 1
272
+ })
273
+ ]))
274
+ ], 2));
275
+ }
276
+ }), ne = (e, u) => {
277
+ const t = e.__vccOpts || e;
278
+ for (const [n, h] of u)
279
+ t[n] = h;
280
+ return t;
281
+ }, xn = /* @__PURE__ */ ne(et, [["__scopeId", "data-v-55c8bb8c"]]), tt = ["title"], nt = ["checked", "disabled", "aria-label"], ot = /* @__PURE__ */ te({
282
+ __name: "BooleanTickBox",
283
+ props: /* @__PURE__ */ j({
284
+ read_only: { type: Boolean, default: !1 },
285
+ label: { default: "Toggle option" }
286
+ }, {
287
+ modelValue: { type: Boolean, required: !0 },
288
+ modelModifiers: {}
289
+ }),
290
+ emits: /* @__PURE__ */ j(["edit"], ["update:modelValue"]),
291
+ setup(e, { emit: u }) {
292
+ const t = ge(e, "modelValue"), n = e, h = u;
293
+ function a(l) {
294
+ if (n.read_only)
295
+ return;
296
+ const d = l.currentTarget.checked;
297
+ t.value = d, h("edit", d);
298
+ }
299
+ return (l, d) => (k(), E("label", {
300
+ class: A(["boolean-checkbox", {
301
+ "boolean-checkbox--checked": t.value,
302
+ "boolean-checkbox--disabled": n.read_only
303
+ }]),
304
+ title: n.label
305
+ }, [
306
+ i("input", {
307
+ class: "boolean-checkbox__input",
308
+ type: "checkbox",
309
+ checked: t.value,
310
+ disabled: n.read_only,
311
+ "aria-label": n.label,
312
+ onChange: a
313
+ }, null, 40, nt),
314
+ d[0] || (d[0] = i("span", {
315
+ class: "boolean-checkbox__box",
316
+ "aria-hidden": "true"
317
+ }, [
318
+ i("svg", { viewBox: "0 0 12 12" }, [
319
+ i("path", { d: "m2.25 6.1 2.35 2.35 5.15-5.15" })
320
+ ])
321
+ ], -1))
322
+ ], 10, tt));
323
+ }
324
+ }), _n = /* @__PURE__ */ ne(ot, [["__scopeId", "data-v-a8a5d530"]]), at = ["title"], lt = ["checked", "disabled", "aria-label"], it = /* @__PURE__ */ te({
325
+ __name: "BooleanToggle",
326
+ props: /* @__PURE__ */ j({
327
+ read_only: { type: Boolean, default: !1 },
328
+ label: { default: "Toggle option" }
329
+ }, {
330
+ modelValue: { type: Boolean, required: !0 },
331
+ modelModifiers: {}
332
+ }),
333
+ emits: /* @__PURE__ */ j(["edit"], ["update:modelValue"]),
334
+ setup(e, { emit: u }) {
335
+ const t = ge(e, "modelValue"), n = e, h = u;
336
+ function a(l) {
337
+ if (n.read_only)
338
+ return;
339
+ const d = l.currentTarget;
340
+ t.value = d.checked, h("edit", d.checked);
341
+ }
342
+ return (l, d) => (k(), E("label", {
343
+ class: A(["toggle", {
344
+ "toggle--checked": t.value,
345
+ "toggle--disabled": n.read_only
346
+ }]),
347
+ title: n.label
348
+ }, [
349
+ i("input", {
350
+ class: "toggle__input",
351
+ type: "checkbox",
352
+ checked: t.value,
353
+ disabled: n.read_only,
354
+ "aria-label": n.label,
355
+ onChange: a
356
+ }, null, 40, lt),
357
+ d[0] || (d[0] = Oe('<span class="toggle__track" aria-hidden="true" data-v-e36e4258><span class="toggle__thumb" data-v-e36e4258><svg class="toggle__state-icon toggle__state-icon--off" viewBox="0 0 12 12" data-v-e36e4258><path d="M3 3l6 6" data-v-e36e4258></path><path d="M9 3 3 9" data-v-e36e4258></path></svg><svg class="toggle__state-icon toggle__state-icon--on" viewBox="0 0 12 12" data-v-e36e4258><path d="m2.5 6 2.2 2.2L9.5 3.5" data-v-e36e4258></path></svg></span></span>', 1))
358
+ ], 10, at));
359
+ }
360
+ }), yn = /* @__PURE__ */ ne(it, [["__scopeId", "data-v-e36e4258"]]), _e = Ke([]);
361
+ B(
362
+ () => _e.value[0] ?? null
363
+ );
364
+ function rt() {
365
+ return typeof crypto < "u" && "randomUUID" in crypto ? crypto.randomUUID() : `${Date.now()}-${Math.random().toString(36).slice(2)}`;
366
+ }
367
+ function Pe(e) {
368
+ const u = {
369
+ ...e,
370
+ id: rt(),
371
+ timestamp: Date.now()
372
+ };
373
+ _e.value.length > 5 || (_e.value = [..._e.value, u]);
374
+ }
375
+ class ze extends Error {
376
+ details;
377
+ response;
378
+ constructor(u, t, n) {
379
+ super(u.message, n), this.name = "ApiRequestError", this.details = u, this.response = t;
380
+ }
381
+ }
382
+ const ut = /* @__PURE__ */ new Set([
383
+ "GET",
384
+ "HEAD",
385
+ "OPTIONS",
386
+ "TRACE"
387
+ ]);
388
+ let Le = null, xe = null;
389
+ function He(e, u) {
390
+ if (u == null) {
391
+ console.error(
392
+ `Empty error response while handling error. Prefix: ${e}`
393
+ );
394
+ return;
395
+ }
396
+ const t = `${e}${u.message}`;
397
+ switch (u.severity) {
398
+ case "EXPECTED":
399
+ console.trace(t, u);
400
+ break;
401
+ case "USER":
402
+ console.info(t, u);
403
+ break;
404
+ case "SYSTEM":
405
+ console.error(t, u);
406
+ break;
407
+ default: {
408
+ const n = u.severity;
409
+ console.error(
410
+ `Unknown error severity: ${String(n)}`,
411
+ u
412
+ );
413
+ }
414
+ }
415
+ }
416
+ function Ue(e) {
417
+ return typeof e == "object" && e !== null;
418
+ }
419
+ function ve(e, u) {
420
+ const t = e[u];
421
+ return typeof t == "string" && t.length > 0 ? t : void 0;
422
+ }
423
+ function st(e, u) {
424
+ const t = e[u];
425
+ return typeof t == "number" && Number.isFinite(t) ? t : void 0;
426
+ }
427
+ function dt(e) {
428
+ return e === "EXPECTED" || e === "USER" || e === "SYSTEM";
429
+ }
430
+ function ct(e, u) {
431
+ const t = e[u];
432
+ return dt(t) ? t : void 0;
433
+ }
434
+ function vt(e) {
435
+ return e >= 400 && e < 500 ? "USER" : "SYSTEM";
436
+ }
437
+ function pt(e) {
438
+ return Ue(e) ? typeof e.headerName == "string" && e.headerName.length > 0 && typeof e.token == "string" && e.token.length > 0 : !1;
439
+ }
440
+ async function mt() {
441
+ const e = await fetch("/api/security/csrf", {
442
+ method: "GET",
443
+ credentials: "same-origin",
444
+ headers: {
445
+ Accept: "application/json"
446
+ }
447
+ });
448
+ if (!e.ok)
449
+ throw new Error(
450
+ `Failed to obtain CSRF token: HTTP ${e.status}`
451
+ );
452
+ const u = await e.json();
453
+ if (!pt(u))
454
+ throw new Error(
455
+ "Backend returned an invalid CSRF response"
456
+ );
457
+ return Le = u, u;
458
+ }
459
+ async function ft() {
460
+ return Le !== null ? Le : (xe === null && (xe = mt().finally(() => {
461
+ xe = null;
462
+ })), xe);
463
+ }
464
+ function ht(e, u) {
465
+ return u.method ? u.method.toUpperCase() : e instanceof Request ? e.method.toUpperCase() : "GET";
466
+ }
467
+ function gt(e, u) {
468
+ const t = new Headers(
469
+ e instanceof Request ? e.headers : void 0
470
+ );
471
+ return new Headers(u.headers).forEach((h, a) => {
472
+ t.set(a, h);
473
+ }), t;
474
+ }
475
+ async function bt(e, u = {}) {
476
+ const t = ht(e, u), n = gt(e, u);
477
+ if (!ut.has(t)) {
478
+ const h = await ft();
479
+ n.set(h.headerName, h.token);
480
+ }
481
+ return fetch(e, {
482
+ ...u,
483
+ method: t,
484
+ headers: n,
485
+ credentials: "same-origin"
486
+ });
487
+ }
488
+ function wt(e) {
489
+ return typeof e == "string" ? e : e instanceof URL ? e.toString() : e.url;
490
+ }
491
+ function xt(e) {
492
+ return e.includes("json");
493
+ }
494
+ async function _t(e, u) {
495
+ const t = e.clone(), n = t.headers.get("content-type")?.toLowerCase() ?? "";
496
+ let h;
497
+ try {
498
+ if (xt(n))
499
+ h = await t.json();
500
+ else {
501
+ const g = await t.text();
502
+ g.trim() && (h = {
503
+ message: g
504
+ });
505
+ }
506
+ } catch (g) {
507
+ console.warn(
508
+ "Failed to parse backend error response:",
509
+ g
510
+ );
511
+ }
512
+ const a = Ue(h) ? h : {}, l = st(a, "status") ?? e.status, d = e.statusText.trim() || void 0;
513
+ return {
514
+ status: l,
515
+ type: ve(a, "type") ?? ve(a, "error") ?? d ?? "HttpError",
516
+ message: ve(a, "message") ?? ve(a, "detail") ?? d ?? `Request failed with HTTP status ${l}`,
517
+ severity: ct(a, "severity") ?? vt(l),
518
+ path: ve(a, "path") ?? ve(a, "instance") ?? u
519
+ };
520
+ }
521
+ function yt(e) {
522
+ return e instanceof DOMException && e.name === "AbortError";
523
+ }
524
+ function De(e, u) {
525
+ return u && e.severity !== "EXPECTED";
526
+ }
527
+ async function kt(e, u = {}) {
528
+ const {
529
+ showGlobalError: t = !0,
530
+ ...n
531
+ } = u, h = Mt(e), a = wt(h);
532
+ let l;
533
+ try {
534
+ l = await bt(
535
+ e,
536
+ n
537
+ );
538
+ } catch (g) {
539
+ const m = yt(g), b = {
540
+ status: 0,
541
+ type: m ? "AbortError" : "NetworkError",
542
+ severity: m ? "EXPECTED" : "SYSTEM",
543
+ message: g instanceof Error ? g.message : "The backend could not be reached.",
544
+ path: a
545
+ };
546
+ throw He(
547
+ "Frontend request transport failure: ",
548
+ b
549
+ ), De(
550
+ b,
551
+ t
552
+ ) && Pe(b), new ze(
553
+ b,
554
+ void 0,
555
+ { cause: g }
556
+ );
557
+ }
558
+ if (l.ok)
559
+ return l;
560
+ const d = await _t(
561
+ l,
562
+ a
563
+ );
564
+ throw He(
565
+ "Backend request failed: ",
566
+ d
567
+ ), De(
568
+ d,
569
+ t
570
+ ) && Pe(d), new ze(
571
+ d,
572
+ l
573
+ );
574
+ }
575
+ function Be(e) {
576
+ return e === "/api" || e.startsWith("/api/") ? e : e === "api" || e.startsWith("api/") ? `/${e}` : `/api/${e.replace(/^\/+/, "")}`;
577
+ }
578
+ function Mt(e) {
579
+ if (typeof e == "string")
580
+ return Be(e);
581
+ if (e instanceof URL) {
582
+ const t = new URL(e);
583
+ return t.pathname = Be(
584
+ t.pathname
585
+ ), t;
586
+ }
587
+ const u = new URL(e.url);
588
+ return u.pathname = Be(
589
+ u.pathname
590
+ ), new Request(u, e);
591
+ }
592
+ const Ne = "frplm.tokenizer.connectionId";
593
+ function $t() {
594
+ if (typeof window > "u")
595
+ return null;
596
+ const e = window.localStorage.getItem(Ne);
597
+ if (e == null)
598
+ return null;
599
+ const u = Number(e);
600
+ return !Number.isSafeInteger(u) || u < 0 ? (window.localStorage.removeItem(Ne), null) : u;
601
+ }
602
+ const Ae = $(
603
+ $t()
604
+ );
605
+ Ge(Ae);
606
+ async function Et(e) {
607
+ const u = Ae.value;
608
+ if (u == null)
609
+ throw new Error(
610
+ "No tokenizer connection has been selected"
611
+ );
612
+ const t = `api/tokenizer/tokenize?connectionId=${encodeURIComponent(String(u))}`;
613
+ return await (await kt(
614
+ t,
615
+ {
616
+ method: "POST",
617
+ headers: new Headers({
618
+ "Content-Type": "text/plain;charset=UTF-8",
619
+ Accept: "application/json"
620
+ }),
621
+ body: e
622
+ }
623
+ )).json();
624
+ }
625
+ const Tt = { class: "long-text-editor" }, St = {
626
+ key: 0,
627
+ class: "long-text-editor__token-count long-text-editor__token-count--inline",
628
+ role: "status",
629
+ "aria-live": "polite"
630
+ }, Ct = { class: "long-text-editor__inline" }, Vt = ["onKeydown"], Bt = {
631
+ class: "modal-window edit-box edit-box--accent",
632
+ role: "dialog",
633
+ "aria-modal": "true",
634
+ "aria-labelledby": "expanded-text-editor-title"
635
+ }, It = { class: "edit-box__header modal-toolbar" }, Lt = {
636
+ key: 0,
637
+ class: "long-text-editor__token-count long-text-editor__token-count--modal",
638
+ role: "status",
639
+ "aria-live": "polite"
640
+ }, Rt = { class: "edit-box__body modal-window__body" }, Pt = ["onKeydown"], zt = 250, Ht = 400, Dt = /* @__PURE__ */ te({
641
+ __name: "LongTextBox",
642
+ props: /* @__PURE__ */ j({
643
+ tokenize: { type: Boolean, default: !1 },
644
+ tokenizationStarted: { type: Boolean, default: !0 }
645
+ }, {
646
+ modelValue: {
647
+ required: !0
648
+ },
649
+ modelModifiers: {}
650
+ }),
651
+ emits: /* @__PURE__ */ j(["edit"], ["update:modelValue"]),
652
+ setup(e, { emit: u }) {
653
+ const t = ge(e, "modelValue"), n = e, h = u, a = $(t.value ?? ""), l = $(a.value), d = $(!1), g = $(null), m = $(!1);
654
+ let b = null, M = 0;
655
+ const L = $(null), N = $(null);
656
+ let S = null;
657
+ function O() {
658
+ return n.tokenize && n.tokenizationStarted && a.value.length > 0;
659
+ }
660
+ function I() {
661
+ t.value = a.value, w(), S !== null && window.clearTimeout(S), S = window.setTimeout(() => {
662
+ S = null, a.value !== l.value && (h("edit", a.value), l.value = a.value);
663
+ }, zt);
664
+ }
665
+ function R() {
666
+ d.value = !0, U(() => {
667
+ N.value?.focus();
668
+ });
669
+ }
670
+ function c() {
671
+ d.value = !1, U(() => {
672
+ L.value?.focus();
673
+ });
674
+ }
675
+ function w() {
676
+ if (!O()) {
677
+ g.value = null, m.value = !1;
678
+ return;
679
+ }
680
+ b !== null && window.clearTimeout(b), b = window.setTimeout(() => {
681
+ b = null, P();
682
+ }, Ht);
683
+ }
684
+ async function P() {
685
+ if (!O()) {
686
+ g.value = null, m.value = !1;
687
+ return;
688
+ }
689
+ const z = ++M, y = a.value;
690
+ m.value = !0;
691
+ try {
692
+ const H = await Et(y);
693
+ z === M && (g.value = H);
694
+ } catch (H) {
695
+ z === M && (g.value = null), console.warn("Could not count text tokens", H);
696
+ } finally {
697
+ z === M && (m.value = !1);
698
+ }
699
+ }
700
+ return G(
701
+ () => [n.tokenize, n.tokenizationStarted],
702
+ ([z, y]) => {
703
+ if (z && y) {
704
+ w();
705
+ return;
706
+ }
707
+ M++, g.value = null, m.value = !1, b !== null && (window.clearTimeout(b), b = null);
708
+ }
709
+ ), ke(() => {
710
+ O() && P();
711
+ }), he(() => {
712
+ S !== null && window.clearTimeout(S), b !== null && window.clearTimeout(b), M++;
713
+ }), (z, y) => (k(), E("div", Tt, [
714
+ n.tokenize ? (k(), E("div", St, [
715
+ y[2] || (y[2] = Ie(" token count: ", -1)),
716
+ i("span", null, Q(m.value ? "…" : g.value ?? "—"), 1)
717
+ ])) : K("", !0),
718
+ i("div", Ct, [
719
+ me(i("textarea", {
720
+ ref_key: "inlineRef",
721
+ ref: L,
722
+ "onUpdate:modelValue": y[0] || (y[0] = (H) => a.value = H),
723
+ class: "long-text-editor__textarea long-text-editor__textarea--inline",
724
+ "aria-label": "Text editor",
725
+ onInput: I
726
+ }, null, 544), [
727
+ [fe, a.value]
728
+ ]),
729
+ i("button", {
730
+ class: "edit-box__action long-text-editor__icon-button long-text-editor__expand-button",
731
+ type: "button",
732
+ title: "Open expanded editor",
733
+ "aria-label": "Open expanded editor",
734
+ onClick: R
735
+ }, [...y[3] || (y[3] = [
736
+ Oe('<svg viewBox="0 0 24 24" aria-hidden="true" data-v-c37d41e9><path d="M8 3H3v5" data-v-c37d41e9></path><path d="m3 3 6 6" data-v-c37d41e9></path><path d="M16 3h5v5" data-v-c37d41e9></path><path d="m21 3-6 6" data-v-c37d41e9></path><path d="M8 21H3v-5" data-v-c37d41e9></path><path d="m3 21 6-6" data-v-c37d41e9></path><path d="M16 21h5v-5" data-v-c37d41e9></path><path d="m21 21-6-6" data-v-c37d41e9></path></svg>', 1)
737
+ ])])
738
+ ]),
739
+ (k(), Me($e, { to: "body" }, [
740
+ Ee(Te, { name: "text-editor-modal" }, {
741
+ default: Se(() => [
742
+ d.value ? (k(), E("div", {
743
+ key: 0,
744
+ class: "modal-backdrop",
745
+ role: "presentation",
746
+ onClick: ee(c, ["self"]),
747
+ onKeydown: pe(ee(c, ["stop", "prevent"]), ["esc"])
748
+ }, [
749
+ i("section", Bt, [
750
+ i("header", It, [
751
+ y[6] || (y[6] = i("div", { class: "edit-box__header-main" }, [
752
+ i("span", { class: "edit-box__eyebrow" }, " Text editor "),
753
+ i("h2", {
754
+ id: "expanded-text-editor-title",
755
+ class: "edit-box__title"
756
+ }, " Expanded editor ")
757
+ ], -1)),
758
+ n.tokenize ? (k(), E("div", Lt, [
759
+ y[4] || (y[4] = Ie(" Tokens: ", -1)),
760
+ i("span", null, Q(m.value ? "…" : g.value ?? "—"), 1)
761
+ ])) : K("", !0),
762
+ i("div", { class: "edit-box__actions" }, [
763
+ i("button", {
764
+ class: "edit-box__action long-text-editor__icon-button modal-toolbar__close",
765
+ type: "button",
766
+ title: "Close expanded editor",
767
+ "aria-label": "Close expanded editor",
768
+ onClick: c
769
+ }, [...y[5] || (y[5] = [
770
+ i("svg", {
771
+ viewBox: "0 0 24 24",
772
+ "aria-hidden": "true"
773
+ }, [
774
+ i("path", { d: "M6 6l12 12" }),
775
+ i("path", { d: "M18 6 6 18" })
776
+ ], -1)
777
+ ])])
778
+ ])
779
+ ]),
780
+ i("div", Rt, [
781
+ me(i("textarea", {
782
+ ref_key: "expandedRef",
783
+ ref: N,
784
+ "onUpdate:modelValue": y[1] || (y[1] = (H) => a.value = H),
785
+ class: "long-text-editor__textarea long-text-editor__textarea--expanded",
786
+ "aria-label": "Expanded text editor",
787
+ onInput: I,
788
+ onKeydown: pe(ee(c, ["stop", "prevent"]), ["esc"])
789
+ }, null, 40, Pt), [
790
+ [fe, a.value]
791
+ ])
792
+ ])
793
+ ])
794
+ ], 40, Vt)) : K("", !0)
795
+ ]),
796
+ _: 1
797
+ })
798
+ ]))
799
+ ]));
800
+ }
801
+ }), kn = /* @__PURE__ */ ne(Dt, [["__scopeId", "data-v-c37d41e9"]]), Nt = ["disabled", "aria-label"], Ot = ["value", "placeholder", "min", "max", "step", "disabled", "aria-label", "aria-invalid"], Ut = ["disabled", "aria-label"], At = 250, Ft = /* @__PURE__ */ te({
802
+ __name: "NumberInput",
803
+ props: /* @__PURE__ */ j({
804
+ nullable: { type: Boolean, default: !1 },
805
+ placeholder: { default: "" },
806
+ min: {},
807
+ max: {},
808
+ step: { default: 1 },
809
+ disabled: { type: Boolean, default: !1 },
810
+ showControls: { type: Boolean, default: !1 },
811
+ ariaLabel: { default: "Number input" }
812
+ }, {
813
+ modelValue: {
814
+ required: !0
815
+ },
816
+ modelModifiers: {}
817
+ }),
818
+ emits: /* @__PURE__ */ j(["edit"], ["update:modelValue"]),
819
+ setup(e, { emit: u }) {
820
+ const t = ge(e, "modelValue"), n = e, h = u, a = $(
821
+ t.value
822
+ ), l = $(
823
+ S(t.value)
824
+ ), d = $(!1), g = $(
825
+ t.value
826
+ );
827
+ let m = null;
828
+ const b = B(() => n.step > 0 ? n.step : 1), M = B(() => {
829
+ const f = l.value.trim();
830
+ if (!f)
831
+ return !n.nullable;
832
+ const o = Number(f);
833
+ return !Number.isFinite(o) || n.min !== void 0 && o < n.min || n.max !== void 0 && o > n.max;
834
+ }), L = B(() => n.disabled ? !0 : a.value !== null && n.min !== void 0 && a.value <= n.min), N = B(() => n.disabled ? !0 : a.value !== null && n.max !== void 0 && a.value >= n.max);
835
+ function S(f) {
836
+ return f === null ? "" : String(f);
837
+ }
838
+ function O(f) {
839
+ const o = String(f);
840
+ if (/e-/i.test(o)) {
841
+ const T = Number(
842
+ o.split(/e-/i)[1]
843
+ );
844
+ return Number.isFinite(T) ? T : 0;
845
+ }
846
+ const s = o.indexOf(".");
847
+ return s === -1 ? 0 : o.length - s - 1;
848
+ }
849
+ function I(f) {
850
+ let o = f;
851
+ n.min !== void 0 && (o = Math.max(
852
+ n.min,
853
+ o
854
+ )), n.max !== void 0 && (o = Math.min(
855
+ n.max,
856
+ o
857
+ ));
858
+ const s = b.value, T = n.min ?? 0;
859
+ o = T + Math.round(
860
+ (o - T) / s
861
+ ) * s, n.min !== void 0 && (o = Math.max(
862
+ n.min,
863
+ o
864
+ )), n.max !== void 0 && (o = Math.min(
865
+ n.max,
866
+ o
867
+ ));
868
+ const D = Math.max(
869
+ O(s),
870
+ O(T),
871
+ O(o)
872
+ );
873
+ return Number(
874
+ o.toFixed(
875
+ Math.min(D, 12)
876
+ )
877
+ );
878
+ }
879
+ function R() {
880
+ m !== null && (clearTimeout(m), m = null);
881
+ }
882
+ function c(f) {
883
+ R(), f !== g.value && (g.value = f, h("edit", f));
884
+ }
885
+ function w(f) {
886
+ R(), m = setTimeout(() => {
887
+ m = null, f !== g.value && (g.value = f, h("edit", f));
888
+ }, At);
889
+ }
890
+ function P(f, o = !1) {
891
+ a.value = f, t.value = f, o ? c(f) : w(f);
892
+ }
893
+ function z(f) {
894
+ const o = f.currentTarget;
895
+ l.value = o.value;
896
+ const s = l.value.trim();
897
+ if (!s) {
898
+ n.nullable && P(null);
899
+ return;
900
+ }
901
+ const T = Number(s);
902
+ Number.isFinite(T) && P(T);
903
+ }
904
+ function y() {
905
+ const f = l.value.trim();
906
+ if (!f) {
907
+ if (n.nullable) {
908
+ l.value = "", P(null, !0);
909
+ return;
910
+ }
911
+ const T = a.value ?? n.min ?? 0, D = I(T);
912
+ l.value = S(D), P(D, !0);
913
+ return;
914
+ }
915
+ const o = Number(f);
916
+ if (!Number.isFinite(o)) {
917
+ l.value = S(a.value);
918
+ return;
919
+ }
920
+ const s = I(o);
921
+ l.value = S(s), P(s, !0);
922
+ }
923
+ function H(f) {
924
+ if (n.disabled)
925
+ return;
926
+ const o = a.value ?? n.min ?? 0, s = I(
927
+ o + b.value * f
928
+ );
929
+ l.value = S(s), P(s, !0);
930
+ }
931
+ function re() {
932
+ d.value = !0;
933
+ }
934
+ function oe() {
935
+ d.value = !1, y();
936
+ }
937
+ function q(f) {
938
+ if (f.key === "Enter") {
939
+ f.preventDefault(), y(), f.currentTarget.blur();
940
+ return;
941
+ }
942
+ f.key === "Escape" && (f.preventDefault(), R(), l.value = S(a.value), f.currentTarget.blur());
943
+ }
944
+ return G(
945
+ () => t.value,
946
+ (f) => {
947
+ f !== a.value && (R(), a.value = f, g.value = f, l.value = S(f));
948
+ }
949
+ ), he(() => {
950
+ R();
951
+ }), (f, o) => (k(), E("div", {
952
+ class: A(["number-input", {
953
+ "number-input--focused": d.value,
954
+ "number-input--invalid": M.value,
955
+ "number-input--disabled": n.disabled,
956
+ "number-input--with-controls": n.showControls
957
+ }])
958
+ }, [
959
+ n.showControls ? (k(), E("button", {
960
+ key: 0,
961
+ type: "button",
962
+ class: "number-input__step number-input__step--decrement",
963
+ disabled: L.value,
964
+ "aria-label": `Decrease ${n.ariaLabel}`,
965
+ tabindex: "-1",
966
+ onClick: o[0] || (o[0] = (s) => H(-1))
967
+ }, [...o[2] || (o[2] = [
968
+ i("svg", {
969
+ viewBox: "0 0 16 16",
970
+ "aria-hidden": "true"
971
+ }, [
972
+ i("path", { d: "M3 8h10" })
973
+ ], -1)
974
+ ])], 8, Nt)) : K("", !0),
975
+ i("input", {
976
+ class: "number-input__control",
977
+ type: "number",
978
+ inputmode: "decimal",
979
+ value: l.value,
980
+ placeholder: n.placeholder,
981
+ min: n.min,
982
+ max: n.max,
983
+ step: b.value,
984
+ disabled: n.disabled,
985
+ "aria-label": n.ariaLabel,
986
+ "aria-invalid": M.value,
987
+ onInput: z,
988
+ onFocus: re,
989
+ onBlur: oe,
990
+ onKeydown: q
991
+ }, null, 40, Ot),
992
+ n.showControls ? (k(), E("button", {
993
+ key: 1,
994
+ type: "button",
995
+ class: "number-input__step number-input__step--increment",
996
+ disabled: N.value,
997
+ "aria-label": `Increase ${n.ariaLabel}`,
998
+ tabindex: "-1",
999
+ onClick: o[1] || (o[1] = (s) => H(1))
1000
+ }, [...o[3] || (o[3] = [
1001
+ i("svg", {
1002
+ viewBox: "0 0 16 16",
1003
+ "aria-hidden": "true"
1004
+ }, [
1005
+ i("path", { d: "M3 8h10" }),
1006
+ i("path", { d: "M8 3v10" })
1007
+ ], -1)
1008
+ ])], 8, Ut)) : K("", !0)
1009
+ ], 2));
1010
+ }
1011
+ }), Mn = /* @__PURE__ */ ne(Ft, [["__scopeId", "data-v-391d27a7"]]), qt = { class: "slider__range-container" }, Wt = ["min", "max", "step", "value", "disabled", "aria-label"], Kt = { class: "slider__number-container" }, Gt = ["min", "max", "step", "value", "disabled", "aria-label"], jt = /* @__PURE__ */ te({
1012
+ __name: "NumberSlider",
1013
+ props: /* @__PURE__ */ j({
1014
+ min: { default: 0 },
1015
+ max: { default: 100 },
1016
+ step: { default: 1 },
1017
+ read_only: { type: Boolean, default: !1 },
1018
+ label: { default: "Numeric value" }
1019
+ }, {
1020
+ modelValue: {
1021
+ required: !0,
1022
+ type: Number
1023
+ },
1024
+ modelModifiers: {}
1025
+ }),
1026
+ emits: /* @__PURE__ */ j(["edit"], ["update:modelValue"]),
1027
+ setup(e, { emit: u }) {
1028
+ const t = ge(e, "modelValue"), n = e, h = u, a = $(
1029
+ String(t.value)
1030
+ ), l = B(
1031
+ () => Math.min(n.min, n.max)
1032
+ ), d = B(
1033
+ () => Math.max(n.min, n.max)
1034
+ ), g = B(
1035
+ () => n.step > 0 ? n.step : 1
1036
+ ), m = B(() => {
1037
+ const c = d.value - l.value;
1038
+ return c <= 0 ? 0 : (Math.min(
1039
+ d.value,
1040
+ Math.max(l.value, t.value)
1041
+ ) - l.value) / c * 100;
1042
+ }), b = B(
1043
+ () => ({
1044
+ "--slider-progress": `${m.value}%`
1045
+ })
1046
+ );
1047
+ G(
1048
+ () => t.value,
1049
+ (c) => {
1050
+ a.value = String(c);
1051
+ }
1052
+ );
1053
+ function M(c) {
1054
+ const w = String(c);
1055
+ if (w.includes("e-") || w.includes("E-")) {
1056
+ const P = Number(
1057
+ w.split(/e-/i)[1]
1058
+ );
1059
+ return Number.isFinite(P) ? P : 0;
1060
+ }
1061
+ return w.includes(".") ? w.split(".")[1].length : 0;
1062
+ }
1063
+ function L(c) {
1064
+ const w = Math.min(
1065
+ d.value,
1066
+ Math.max(l.value, c)
1067
+ ), P = Math.round(
1068
+ (w - l.value) / g.value
1069
+ ), z = l.value + P * g.value, y = Math.max(
1070
+ M(l.value),
1071
+ M(d.value),
1072
+ M(g.value)
1073
+ );
1074
+ return Number(
1075
+ Math.min(
1076
+ d.value,
1077
+ Math.max(l.value, z)
1078
+ ).toFixed(y)
1079
+ );
1080
+ }
1081
+ function N(c) {
1082
+ if (n.read_only || !Number.isFinite(c))
1083
+ return;
1084
+ const w = L(c);
1085
+ a.value = String(w), w !== t.value && (t.value = w, h("edit", w));
1086
+ }
1087
+ function S(c) {
1088
+ const w = c.currentTarget;
1089
+ N(Number(w.value));
1090
+ }
1091
+ function O(c) {
1092
+ const w = c.currentTarget;
1093
+ a.value = w.value;
1094
+ }
1095
+ function I() {
1096
+ const c = Number(
1097
+ a.value
1098
+ );
1099
+ if (!a.value.trim() || !Number.isFinite(c)) {
1100
+ a.value = String(t.value);
1101
+ return;
1102
+ }
1103
+ N(c);
1104
+ }
1105
+ function R(c) {
1106
+ const w = c.currentTarget;
1107
+ c.key === "Enter" && (c.preventDefault(), I(), w.blur()), c.key === "Escape" && (c.preventDefault(), a.value = String(t.value), w.blur());
1108
+ }
1109
+ return (c, w) => (k(), E("div", {
1110
+ class: A(["slider", {
1111
+ "slider--disabled": n.read_only
1112
+ }])
1113
+ }, [
1114
+ i("div", qt, [
1115
+ i("input", {
1116
+ class: "slider__range",
1117
+ type: "range",
1118
+ min: l.value,
1119
+ max: d.value,
1120
+ step: g.value,
1121
+ value: t.value,
1122
+ style: Ce(b.value),
1123
+ disabled: n.read_only,
1124
+ "aria-label": n.label,
1125
+ onInput: S
1126
+ }, null, 44, Wt)
1127
+ ]),
1128
+ i("div", Kt, [
1129
+ i("input", {
1130
+ class: "slider__number",
1131
+ type: "number",
1132
+ inputmode: "decimal",
1133
+ min: l.value,
1134
+ max: d.value,
1135
+ step: g.value,
1136
+ value: a.value,
1137
+ disabled: n.read_only,
1138
+ "aria-label": `${n.label}, direct input`,
1139
+ onInput: O,
1140
+ onChange: I,
1141
+ onBlur: I,
1142
+ onKeydown: R
1143
+ }, null, 40, Gt)
1144
+ ])
1145
+ ], 2));
1146
+ }
1147
+ }), $n = /* @__PURE__ */ ne(jt, [["__scopeId", "data-v-0987f85e"]]), Yt = ["disabled"], Xt = 250, Qt = /* @__PURE__ */ te({
1148
+ __name: "ShortTextBox",
1149
+ props: /* @__PURE__ */ j({
1150
+ disabled: { type: Boolean, default: !1 }
1151
+ }, {
1152
+ modelValue: {
1153
+ required: !0
1154
+ },
1155
+ modelModifiers: {}
1156
+ }),
1157
+ emits: /* @__PURE__ */ j(["edit"], ["update:modelValue"]),
1158
+ setup(e, { emit: u }) {
1159
+ const t = ge(e, "modelValue"), n = e, h = u, a = $(t.value ?? ""), l = $(a.value);
1160
+ let d = null;
1161
+ function g() {
1162
+ t.value = a.value, d !== null && window.clearTimeout(d), d = window.setTimeout(() => {
1163
+ d = null, a.value !== l.value && (h("edit", a.value), l.value = a.value);
1164
+ }, Xt);
1165
+ }
1166
+ return G(
1167
+ () => t.value,
1168
+ (m) => {
1169
+ const b = m ?? "";
1170
+ b !== a.value && (a.value = b, l.value = b);
1171
+ }
1172
+ ), he(() => {
1173
+ d !== null && (window.clearTimeout(d), d = null);
1174
+ }), (m, b) => me((k(), E("input", {
1175
+ "onUpdate:modelValue": b[0] || (b[0] = (M) => a.value = M),
1176
+ class: "short-text-box",
1177
+ type: "text",
1178
+ disabled: n.disabled,
1179
+ onInput: g
1180
+ }, null, 40, Yt)), [
1181
+ [fe, a.value]
1182
+ ]);
1183
+ }
1184
+ }), En = /* @__PURE__ */ ne(Qt, [["__scopeId", "data-v-de481be8"]]), Jt = ["title"], Zt = { class: "single-autocomplete__chip-text" }, en = ["disabled"], tn = ["placeholder", "disabled", "aria-label", "aria-expanded", "aria-controls", "aria-activedescendant"], nn = ["aria-label"], on = ["id", "data-option-index", "aria-selected", "onMouseenter", "onMousedown"], an = {
1185
+ class: "single-autocomplete__option-icon",
1186
+ viewBox: "0 0 24 24",
1187
+ "aria-hidden": "true"
1188
+ }, ln = {
1189
+ key: 1,
1190
+ d: "M20 6 9 17l-5-5"
1191
+ }, rn = {
1192
+ key: 0,
1193
+ class: "single-autocomplete__option-text"
1194
+ }, un = {
1195
+ key: 1,
1196
+ class: "single-autocomplete__option-text"
1197
+ }, sn = /* @__PURE__ */ te({
1198
+ __name: "SingleAutoComplete",
1199
+ props: {
1200
+ suggestions: {},
1201
+ modelValue: { default: null },
1202
+ placeholder: { default: "Type to select…" },
1203
+ allowCustom: { type: Boolean, default: !1 },
1204
+ disabled: { type: Boolean, default: !1 },
1205
+ clearable: { type: Boolean, default: !0 }
1206
+ },
1207
+ emits: ["update:modelValue", "select", "clear"],
1208
+ setup(e, { emit: u }) {
1209
+ const t = e, n = u, h = $(""), a = $(!1), l = $(0), d = $(null), g = $(null), m = $(null), b = $("below"), M = $({}), L = `autocomplete-${Math.random().toString(36).slice(2, 10)}`, N = `${L}-listbox`, S = B(
1210
+ () => h.value.trim().toLocaleLowerCase()
1211
+ ), O = B(() => {
1212
+ const v = S.value, x = t.suggestions.filter(
1213
+ (C) => C !== t.modelValue
1214
+ );
1215
+ return v ? x.filter(
1216
+ (C) => C.toLocaleLowerCase().includes(v)
1217
+ ).slice(0, 8) : x.slice(0, 8);
1218
+ }), I = B(() => {
1219
+ const v = S.value;
1220
+ return v ? t.suggestions.find(
1221
+ (x) => x.toLocaleLowerCase() === v
1222
+ ) ?? null : null;
1223
+ }), R = B(() => {
1224
+ const v = h.value.trim();
1225
+ return t.allowCustom && v.length > 0 && I.value === null;
1226
+ }), c = B(() => {
1227
+ const v = O.value.map(
1228
+ (x) => ({
1229
+ type: "suggestion",
1230
+ value: x
1231
+ })
1232
+ );
1233
+ return R.value && v.push({
1234
+ type: "custom",
1235
+ value: h.value.trim()
1236
+ }), v;
1237
+ }), w = B(() => t.disabled || !a.value || t.modelValue ? !1 : c.value.length > 0), P = B(() => {
1238
+ if (!(!w.value || !c.value[l.value]))
1239
+ return `${L}-option-${l.value}`;
1240
+ });
1241
+ G(
1242
+ () => t.modelValue,
1243
+ (v) => {
1244
+ v != null && (h.value = "");
1245
+ }
1246
+ ), G(c, (v) => {
1247
+ if (v.length === 0) {
1248
+ l.value = 0;
1249
+ return;
1250
+ }
1251
+ l.value >= v.length && (l.value = v.length - 1), w.value && U(() => {
1252
+ y(), H();
1253
+ });
1254
+ }), G(w, async (v) => {
1255
+ v && (await U(), y(), H());
1256
+ });
1257
+ function z(v, x, C) {
1258
+ return Math.min(
1259
+ Math.max(v, x),
1260
+ Math.max(x, C)
1261
+ );
1262
+ }
1263
+ function y() {
1264
+ const v = d.value;
1265
+ if (!v || !w.value)
1266
+ return;
1267
+ const x = window.visualViewport, C = x?.width ?? window.innerWidth, F = x?.height ?? window.innerHeight, X = x?.offsetLeft ?? 0, Z = x?.offsetTop ?? 0, r = X + C, p = Z + F, _ = v.getBoundingClientRect(), V = 12, W = 6, de = 320, se = 96, ce = Math.max(
1268
+ 0,
1269
+ C - V * 2
1270
+ ), ae = Math.min(
1271
+ Math.max(_.width, 240),
1272
+ ce
1273
+ ), le = z(
1274
+ _.left,
1275
+ X + V,
1276
+ r - V - ae
1277
+ ), ie = p - _.bottom - W - V, be = _.top - Z - W - V;
1278
+ if (ie < se && be < se) {
1279
+ b.value = "overlay", M.value = {
1280
+ top: `${Z + V}px`,
1281
+ right: "auto",
1282
+ bottom: "auto",
1283
+ left: `${le}px`,
1284
+ width: `${ae}px`,
1285
+ maxHeight: `${Math.max(
1286
+ 0,
1287
+ F - V * 2
1288
+ )}px`
1289
+ };
1290
+ return;
1291
+ }
1292
+ if (ie >= se || ie >= be) {
1293
+ b.value = "below", M.value = {
1294
+ top: `${Math.max(
1295
+ Z + V,
1296
+ _.bottom + W
1297
+ )}px`,
1298
+ right: "auto",
1299
+ bottom: "auto",
1300
+ left: `${le}px`,
1301
+ width: `${ae}px`,
1302
+ maxHeight: `${Math.max(
1303
+ se,
1304
+ Math.min(
1305
+ de,
1306
+ ie
1307
+ )
1308
+ )}px`
1309
+ };
1310
+ return;
1311
+ }
1312
+ const we = Math.max(
1313
+ se,
1314
+ Math.min(
1315
+ de,
1316
+ be
1317
+ )
1318
+ );
1319
+ b.value = "above", M.value = {
1320
+ top: "auto",
1321
+ right: "auto",
1322
+ bottom: `${Math.max(
1323
+ V,
1324
+ p - _.top + W
1325
+ )}px`,
1326
+ left: `${le}px`,
1327
+ width: `${ae}px`,
1328
+ maxHeight: `${we}px`
1329
+ };
1330
+ }
1331
+ function H() {
1332
+ U(() => {
1333
+ m.value?.querySelector(
1334
+ `[data-option-index="${l.value}"]`
1335
+ )?.scrollIntoView({
1336
+ block: "nearest"
1337
+ });
1338
+ });
1339
+ }
1340
+ function re() {
1341
+ d.value?.scrollIntoView({
1342
+ block: "nearest",
1343
+ inline: "nearest"
1344
+ });
1345
+ }
1346
+ function oe() {
1347
+ t.disabled || g.value?.focus();
1348
+ }
1349
+ function q(v, x = !0) {
1350
+ const C = v.trim();
1351
+ !C || t.disabled || (n("update:modelValue", C), n("select", C), h.value = "", l.value = 0, x && U(() => {
1352
+ g.value?.blur();
1353
+ }));
1354
+ }
1355
+ function f() {
1356
+ t.disabled || (n("update:modelValue", null), n("clear"), h.value = "", l.value = 0, U(() => {
1357
+ g.value?.focus();
1358
+ }));
1359
+ }
1360
+ function o(v = !0) {
1361
+ if (t.disabled)
1362
+ return;
1363
+ const x = c.value[l.value];
1364
+ x && q(x.value, v);
1365
+ }
1366
+ function s(v) {
1367
+ if (!w.value)
1368
+ return;
1369
+ const x = c.value.length;
1370
+ x !== 0 && (l.value = (l.value + v + x) % x, H());
1371
+ }
1372
+ function T() {
1373
+ a.value = !0, U(() => {
1374
+ re(), y();
1375
+ });
1376
+ }
1377
+ function D() {
1378
+ window.setTimeout(() => {
1379
+ a.value = !1, l.value = 0;
1380
+ }, 120);
1381
+ }
1382
+ function J() {
1383
+ l.value = 0, U(y);
1384
+ }
1385
+ function ue(v) {
1386
+ if (v.key === "ArrowDown") {
1387
+ v.preventDefault(), s(1);
1388
+ return;
1389
+ }
1390
+ if (v.key === "ArrowUp") {
1391
+ v.preventDefault(), s(-1);
1392
+ return;
1393
+ }
1394
+ if (v.key === "Home" && w.value) {
1395
+ v.preventDefault(), l.value = 0, H();
1396
+ return;
1397
+ }
1398
+ if (v.key === "End" && w.value) {
1399
+ v.preventDefault(), l.value = Math.max(
1400
+ 0,
1401
+ c.value.length - 1
1402
+ ), H();
1403
+ return;
1404
+ }
1405
+ if (v.key === "Enter") {
1406
+ w.value && (v.preventDefault(), o());
1407
+ return;
1408
+ }
1409
+ if (v.key === "Tab") {
1410
+ w.value && o(!1);
1411
+ return;
1412
+ }
1413
+ if (v.key === "Escape") {
1414
+ v.preventDefault(), v.stopPropagation(), a.value = !1, g.value?.blur();
1415
+ return;
1416
+ }
1417
+ v.key === "Backspace" && t.modelValue && t.clearable && (v.preventDefault(), f());
1418
+ }
1419
+ let Y = null;
1420
+ return ke(() => {
1421
+ window.addEventListener(
1422
+ "resize",
1423
+ y
1424
+ ), window.addEventListener(
1425
+ "scroll",
1426
+ y,
1427
+ !0
1428
+ ), window.visualViewport?.addEventListener(
1429
+ "resize",
1430
+ y
1431
+ ), window.visualViewport?.addEventListener(
1432
+ "scroll",
1433
+ y
1434
+ ), typeof ResizeObserver < "u" && d.value && (Y = new ResizeObserver(
1435
+ y
1436
+ ), Y.observe(d.value));
1437
+ }), he(() => {
1438
+ window.removeEventListener(
1439
+ "resize",
1440
+ y
1441
+ ), window.removeEventListener(
1442
+ "scroll",
1443
+ y,
1444
+ !0
1445
+ ), window.visualViewport?.removeEventListener(
1446
+ "resize",
1447
+ y
1448
+ ), window.visualViewport?.removeEventListener(
1449
+ "scroll",
1450
+ y
1451
+ ), Y?.disconnect();
1452
+ }), (v, x) => (k(), E("div", {
1453
+ class: A(["single-autocomplete", {
1454
+ "single-autocomplete--open": w.value,
1455
+ "single-autocomplete--disabled": e.disabled
1456
+ }])
1457
+ }, [
1458
+ i("div", {
1459
+ ref_key: "controlRef",
1460
+ ref: d,
1461
+ class: A(["single-autocomplete__control", {
1462
+ "single-autocomplete__control--focused": a.value,
1463
+ "single-autocomplete__control--selected": !!e.modelValue
1464
+ }]),
1465
+ onClick: oe
1466
+ }, [
1467
+ x[4] || (x[4] = i("svg", {
1468
+ class: "single-autocomplete__icon",
1469
+ viewBox: "0 0 24 24",
1470
+ "aria-hidden": "true"
1471
+ }, [
1472
+ i("circle", {
1473
+ cx: "11",
1474
+ cy: "11",
1475
+ r: "7"
1476
+ }),
1477
+ i("path", { d: "m20 20-4-4" })
1478
+ ], -1)),
1479
+ e.modelValue ? (k(), E("span", {
1480
+ key: 0,
1481
+ class: "single-autocomplete__chip",
1482
+ title: e.modelValue
1483
+ }, [
1484
+ i("span", Zt, Q(e.modelValue), 1),
1485
+ e.clearable ? (k(), E("button", {
1486
+ key: 0,
1487
+ type: "button",
1488
+ class: "single-autocomplete__clear",
1489
+ "aria-label": "Clear selected value",
1490
+ disabled: e.disabled,
1491
+ onClick: ee(f, ["stop"])
1492
+ }, [...x[2] || (x[2] = [
1493
+ i("svg", {
1494
+ viewBox: "0 0 24 24",
1495
+ "aria-hidden": "true"
1496
+ }, [
1497
+ i("path", { d: "M7 7l10 10" }),
1498
+ i("path", { d: "M17 7 7 17" })
1499
+ ], -1)
1500
+ ])], 8, en)) : K("", !0)
1501
+ ], 8, Jt)) : K("", !0),
1502
+ me(i("input", {
1503
+ ref_key: "inputRef",
1504
+ ref: g,
1505
+ "onUpdate:modelValue": x[0] || (x[0] = (C) => h.value = C),
1506
+ type: "text",
1507
+ class: A(["single-autocomplete__input", {
1508
+ "single-autocomplete__input--selected": !!e.modelValue
1509
+ }]),
1510
+ placeholder: e.modelValue ? "" : e.placeholder,
1511
+ disabled: e.disabled,
1512
+ "aria-label": e.modelValue ? `Selected value: ${e.modelValue}` : e.placeholder,
1513
+ role: "combobox",
1514
+ "aria-autocomplete": "list",
1515
+ "aria-haspopup": "listbox",
1516
+ "aria-expanded": w.value,
1517
+ "aria-controls": w.value ? N : void 0,
1518
+ "aria-activedescendant": P.value,
1519
+ autocomplete: "off",
1520
+ spellcheck: "false",
1521
+ onFocus: T,
1522
+ onBlur: D,
1523
+ onInput: J,
1524
+ onKeydown: ue
1525
+ }, null, 42, tn), [
1526
+ [fe, h.value]
1527
+ ]),
1528
+ (k(), E("svg", {
1529
+ class: A(["single-autocomplete__chevron", {
1530
+ "single-autocomplete__chevron--open": w.value
1531
+ }]),
1532
+ viewBox: "0 0 24 24",
1533
+ "aria-hidden": "true"
1534
+ }, [...x[3] || (x[3] = [
1535
+ i("path", { d: "m7 10 5 5 5-5" }, null, -1)
1536
+ ])], 2))
1537
+ ], 2),
1538
+ (k(), Me($e, { to: "body" }, [
1539
+ Ee(Te, { name: "autocomplete-menu" }, {
1540
+ default: Se(() => [
1541
+ w.value ? (k(), E("div", {
1542
+ key: 0,
1543
+ id: N,
1544
+ ref_key: "menuRef",
1545
+ ref: m,
1546
+ class: A(["single-autocomplete__menu", {
1547
+ "single-autocomplete__menu--above": b.value === "above",
1548
+ "single-autocomplete__menu--below": b.value === "below",
1549
+ "single-autocomplete__menu--overlay": b.value === "overlay"
1550
+ }]),
1551
+ style: Ce(M.value),
1552
+ role: "listbox",
1553
+ "aria-label": e.placeholder,
1554
+ onKeydown: x[1] || (x[1] = pe(ee(() => {
1555
+ }, ["stop", "prevent"]), ["esc"]))
1556
+ }, [
1557
+ (k(!0), E(ye, null, Re(c.value, (C, F) => (k(), E("button", {
1558
+ id: `${L}-option-${F}`,
1559
+ key: `${C.type}:${C.value}`,
1560
+ "data-option-index": F,
1561
+ type: "button",
1562
+ class: A(["single-autocomplete__option", {
1563
+ "single-autocomplete__option--active": F === l.value,
1564
+ "single-autocomplete__option--custom": C.type === "custom"
1565
+ }]),
1566
+ role: "option",
1567
+ "aria-selected": F === l.value,
1568
+ onMouseenter: (X) => l.value = F,
1569
+ onMousedown: ee((X) => q(C.value), ["prevent"])
1570
+ }, [
1571
+ (k(), E("svg", an, [
1572
+ C.type === "custom" ? (k(), E(ye, { key: 0 }, [
1573
+ x[5] || (x[5] = i("path", { d: "M12 5v14" }, null, -1)),
1574
+ x[6] || (x[6] = i("path", { d: "M5 12h14" }, null, -1))
1575
+ ], 64)) : (k(), E("path", ln))
1576
+ ])),
1577
+ C.type === "custom" ? (k(), E("span", rn, [
1578
+ x[7] || (x[7] = Ie(" Create ", -1)),
1579
+ i("strong", null, "“" + Q(C.value) + "”", 1)
1580
+ ])) : (k(), E("span", un, Q(C.value), 1))
1581
+ ], 42, on))), 128))
1582
+ ], 46, nn)) : K("", !0)
1583
+ ]),
1584
+ _: 1
1585
+ })
1586
+ ]))
1587
+ ], 2));
1588
+ }
1589
+ }), Tn = /* @__PURE__ */ ne(sn, [["__scopeId", "data-v-d82cb509"]]), dn = ["aria-expanded", "aria-controls", "aria-activedescendant", "placeholder"], cn = ["aria-label"], vn = ["id", "data-option-index", "aria-selected", "onMouseenter", "onClick"], pn = { class: "enum-input__option-indicator" }, mn = {
1590
+ key: 0,
1591
+ viewBox: "0 0 24 24",
1592
+ "aria-hidden": "true"
1593
+ }, fn = { class: "enum-input__option-label" }, hn = {
1594
+ key: 0,
1595
+ class: "enum-input__option-value"
1596
+ }, gn = {
1597
+ key: 0,
1598
+ class: "enum-input__empty",
1599
+ role: "status"
1600
+ }, bn = /* @__PURE__ */ te({
1601
+ __name: "SingleEnumInput",
1602
+ props: {
1603
+ value: {},
1604
+ possible_values: {},
1605
+ labels: {},
1606
+ placeholder: {}
1607
+ },
1608
+ emits: ["edit"],
1609
+ setup(e, { emit: u }) {
1610
+ const t = {
1611
+ viewportMarginPx: 12,
1612
+ controlGapPx: 6,
1613
+ preferredMaxHeightPx: 320,
1614
+ minimumUsefulHeightPx: 100,
1615
+ minimumWidthPx: 220,
1616
+ estimatedOptionHeightPx: 42,
1617
+ estimatedVerticalPaddingPx: 8
1618
+ }, n = e, h = u, a = $(null), l = $(null), d = $(null), g = $(null), m = $(!1), b = $(""), M = $(0), L = $("below"), N = $({}), S = w(), O = `${S}-listbox`;
1619
+ let I = null, R = null, c = null;
1620
+ function w() {
1621
+ return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? `enum-input-${crypto.randomUUID()}` : `enum-input-${Math.random().toString(36).slice(2, 10)}`;
1622
+ }
1623
+ function P(r) {
1624
+ return r instanceof Map;
1625
+ }
1626
+ function z(r) {
1627
+ return n.labels ? P(n.labels) ? n.labels.get(r) ?? String(r) : n.labels[r] ?? String(r) : String(r);
1628
+ }
1629
+ function y(r) {
1630
+ return r.normalize("NFD").replace(new RegExp("\\p{Diacritic}", "gu"), "").toLocaleLowerCase().trim();
1631
+ }
1632
+ function H(r, p, _) {
1633
+ return Math.min(
1634
+ Math.max(r, p),
1635
+ Math.max(p, _)
1636
+ );
1637
+ }
1638
+ function re() {
1639
+ const r = window.visualViewport, p = r?.offsetLeft ?? 0, _ = r?.offsetTop ?? 0, V = r?.width ?? window.innerWidth, W = r?.height ?? window.innerHeight;
1640
+ return {
1641
+ left: p,
1642
+ top: _,
1643
+ width: V,
1644
+ height: W,
1645
+ right: p + V,
1646
+ bottom: _ + W
1647
+ };
1648
+ }
1649
+ const oe = B(() => n.value === null ? "" : z(n.value)), q = B(() => {
1650
+ const r = y(b.value).split(/\s+/).filter(Boolean);
1651
+ return r.length === 0 ? n.possible_values : n.possible_values.filter((p) => {
1652
+ const _ = y(
1653
+ `${z(p)} ${String(p)}`
1654
+ );
1655
+ return r.every(
1656
+ (V) => _.includes(V)
1657
+ );
1658
+ });
1659
+ }), f = B(() => {
1660
+ if (!(!m.value || q.value.length === 0))
1661
+ return `${S}-option-${M.value}`;
1662
+ });
1663
+ G(
1664
+ oe,
1665
+ (r) => {
1666
+ m.value || (b.value = r);
1667
+ },
1668
+ {
1669
+ immediate: !0
1670
+ }
1671
+ ), G(
1672
+ q,
1673
+ (r) => {
1674
+ r.length === 0 ? M.value = 0 : M.value >= r.length && (M.value = r.length - 1), m.value && U(() => {
1675
+ s(), D();
1676
+ });
1677
+ }
1678
+ ), G(m, async (r) => {
1679
+ r && (await U(), s(), D());
1680
+ });
1681
+ function o() {
1682
+ const r = g.value?.scrollHeight;
1683
+ if (r !== void 0 && r > 0)
1684
+ return r;
1685
+ const p = q.value.length * t.estimatedOptionHeightPx;
1686
+ return Math.max(
1687
+ t.minimumUsefulHeightPx,
1688
+ p + t.estimatedVerticalPaddingPx
1689
+ );
1690
+ }
1691
+ function s() {
1692
+ m.value && (R !== null && cancelAnimationFrame(R), R = requestAnimationFrame(() => {
1693
+ R = null, T();
1694
+ }));
1695
+ }
1696
+ function T() {
1697
+ const r = l.value;
1698
+ if (!r || !m.value)
1699
+ return;
1700
+ const p = r.getBoundingClientRect(), _ = re(), V = p.left + _.left, W = p.top + _.top, de = p.bottom + _.top, se = Math.max(
1701
+ 0,
1702
+ _.width - t.viewportMarginPx * 2
1703
+ ), ce = Math.min(
1704
+ Math.max(
1705
+ p.width,
1706
+ t.minimumWidthPx
1707
+ ),
1708
+ se
1709
+ ), ae = H(
1710
+ V,
1711
+ _.left + t.viewportMarginPx,
1712
+ _.right - t.viewportMarginPx - ce
1713
+ ), le = _.bottom - de - t.controlGapPx - t.viewportMarginPx, ie = W - _.top - t.controlGapPx - t.viewportMarginPx;
1714
+ if (le < t.minimumUsefulHeightPx && ie < t.minimumUsefulHeightPx) {
1715
+ const Ve = Math.max(
1716
+ 0,
1717
+ _.height - t.viewportMarginPx * 2
1718
+ );
1719
+ L.value = "overlay", N.value = {
1720
+ top: `${_.top + t.viewportMarginPx}px`,
1721
+ left: `${ae}px`,
1722
+ width: `${ce}px`,
1723
+ maxHeight: `${Ve}px`
1724
+ };
1725
+ return;
1726
+ }
1727
+ if (le >= t.minimumUsefulHeightPx || le >= ie) {
1728
+ const Ve = Math.max(
1729
+ 0,
1730
+ Math.min(
1731
+ t.preferredMaxHeightPx,
1732
+ le
1733
+ )
1734
+ );
1735
+ L.value = "below", N.value = {
1736
+ top: `${de + t.controlGapPx}px`,
1737
+ left: `${ae}px`,
1738
+ width: `${ce}px`,
1739
+ maxHeight: `${Ve}px`
1740
+ };
1741
+ return;
1742
+ }
1743
+ const we = Math.max(
1744
+ 0,
1745
+ Math.min(
1746
+ t.preferredMaxHeightPx,
1747
+ ie
1748
+ )
1749
+ ), qe = Math.min(
1750
+ o(),
1751
+ we
1752
+ ), We = W - t.controlGapPx - qe;
1753
+ L.value = "above", N.value = {
1754
+ top: `${Math.max(
1755
+ _.top + t.viewportMarginPx,
1756
+ We
1757
+ )}px`,
1758
+ left: `${ae}px`,
1759
+ width: `${ce}px`,
1760
+ maxHeight: `${we}px`
1761
+ };
1762
+ }
1763
+ function D() {
1764
+ U(() => {
1765
+ const r = `[data-option-index="${M.value}"]`;
1766
+ g.value?.querySelector(r)?.scrollIntoView({
1767
+ block: "nearest",
1768
+ inline: "nearest"
1769
+ });
1770
+ });
1771
+ }
1772
+ function J() {
1773
+ I !== null && (window.clearTimeout(I), I = null);
1774
+ }
1775
+ function ue() {
1776
+ J(), m.value = !0, b.value = "";
1777
+ const r = n.value === null ? -1 : n.possible_values.findIndex(
1778
+ (p) => Object.is(p, n.value)
1779
+ );
1780
+ M.value = r >= 0 ? r : 0, U(() => {
1781
+ l.value?.scrollIntoView({
1782
+ block: "nearest",
1783
+ inline: "nearest"
1784
+ }), s(), D();
1785
+ });
1786
+ }
1787
+ function Y() {
1788
+ m.value = !1, b.value = oe.value, M.value = 0;
1789
+ }
1790
+ function v(r) {
1791
+ h("edit", r), m.value = !1, b.value = z(r), M.value = 0, U(() => {
1792
+ d.value?.focus(), d.value?.select();
1793
+ });
1794
+ }
1795
+ function x(r) {
1796
+ const p = q.value.length;
1797
+ p !== 0 && (M.value = (M.value + r + p) % p, D());
1798
+ }
1799
+ function C() {
1800
+ const r = q.value[M.value];
1801
+ r !== void 0 && v(r);
1802
+ }
1803
+ function F() {
1804
+ J(), I = window.setTimeout(() => {
1805
+ I = null;
1806
+ const r = document.activeElement, p = r !== null && a.value?.contains(r), _ = r !== null && g.value?.contains(r);
1807
+ !p && !_ && Y();
1808
+ }, 100);
1809
+ }
1810
+ function X(r) {
1811
+ switch (r.key) {
1812
+ case "ArrowDown": {
1813
+ r.preventDefault(), m.value ? x(1) : ue();
1814
+ break;
1815
+ }
1816
+ case "ArrowUp": {
1817
+ r.preventDefault(), m.value ? x(-1) : ue();
1818
+ break;
1819
+ }
1820
+ case "Home": {
1821
+ if (!m.value)
1822
+ break;
1823
+ r.preventDefault(), M.value = 0, D();
1824
+ break;
1825
+ }
1826
+ case "End": {
1827
+ if (!m.value)
1828
+ break;
1829
+ r.preventDefault(), M.value = Math.max(
1830
+ 0,
1831
+ q.value.length - 1
1832
+ ), D();
1833
+ break;
1834
+ }
1835
+ case "Enter": {
1836
+ if (!m.value)
1837
+ break;
1838
+ r.preventDefault(), r.stopPropagation(), C();
1839
+ break;
1840
+ }
1841
+ case "Escape": {
1842
+ if (!m.value)
1843
+ break;
1844
+ r.preventDefault(), r.stopPropagation(), Y(), d.value?.focus();
1845
+ break;
1846
+ }
1847
+ case "Tab": {
1848
+ Y();
1849
+ break;
1850
+ }
1851
+ }
1852
+ }
1853
+ function Z(r) {
1854
+ const p = r.target;
1855
+ if (!(p instanceof Node))
1856
+ return;
1857
+ const _ = a.value?.contains(p) ?? !1, V = g.value?.contains(p) ?? !1;
1858
+ _ || V || Y();
1859
+ }
1860
+ return ke(() => {
1861
+ document.addEventListener(
1862
+ "pointerdown",
1863
+ Z,
1864
+ !0
1865
+ ), window.addEventListener(
1866
+ "resize",
1867
+ s
1868
+ ), window.addEventListener(
1869
+ "scroll",
1870
+ s,
1871
+ !0
1872
+ ), window.visualViewport?.addEventListener(
1873
+ "resize",
1874
+ s
1875
+ ), window.visualViewport?.addEventListener(
1876
+ "scroll",
1877
+ s
1878
+ ), typeof ResizeObserver < "u" && l.value && (c = new ResizeObserver(
1879
+ s
1880
+ ), c.observe(l.value));
1881
+ }), he(() => {
1882
+ J(), R !== null && (cancelAnimationFrame(R), R = null), document.removeEventListener(
1883
+ "pointerdown",
1884
+ Z,
1885
+ !0
1886
+ ), window.removeEventListener(
1887
+ "resize",
1888
+ s
1889
+ ), window.removeEventListener(
1890
+ "scroll",
1891
+ s,
1892
+ !0
1893
+ ), window.visualViewport?.removeEventListener(
1894
+ "resize",
1895
+ s
1896
+ ), window.visualViewport?.removeEventListener(
1897
+ "scroll",
1898
+ s
1899
+ ), c?.disconnect(), c = null;
1900
+ }), (r, p) => (k(), E("div", {
1901
+ ref_key: "rootRef",
1902
+ ref: a,
1903
+ class: A(["enum-input", {
1904
+ "enum-input--open": m.value
1905
+ }])
1906
+ }, [
1907
+ i("div", {
1908
+ ref_key: "controlRef",
1909
+ ref: l,
1910
+ class: A(["enum-input__control", {
1911
+ "enum-input__control--open": m.value
1912
+ }]),
1913
+ onClick: p[1] || (p[1] = (_) => d.value?.focus())
1914
+ }, [
1915
+ p[4] || (p[4] = i("svg", {
1916
+ class: "enum-input__search-icon",
1917
+ viewBox: "0 0 24 24",
1918
+ "aria-hidden": "true"
1919
+ }, [
1920
+ i("circle", {
1921
+ cx: "11",
1922
+ cy: "11",
1923
+ r: "7"
1924
+ }),
1925
+ i("path", { d: "m20 20-4-4" })
1926
+ ], -1)),
1927
+ me(i("input", {
1928
+ ref_key: "inputRef",
1929
+ ref: d,
1930
+ "onUpdate:modelValue": p[0] || (p[0] = (_) => b.value = _),
1931
+ class: "enum-input__field",
1932
+ type: "text",
1933
+ role: "combobox",
1934
+ "aria-autocomplete": "list",
1935
+ "aria-haspopup": "listbox",
1936
+ "aria-expanded": m.value,
1937
+ "aria-controls": m.value ? O : void 0,
1938
+ "aria-activedescendant": f.value,
1939
+ autocomplete: "off",
1940
+ spellcheck: "false",
1941
+ placeholder: e.placeholder ?? "Select…",
1942
+ onFocus: ue,
1943
+ onBlur: F,
1944
+ onKeydown: X
1945
+ }, null, 40, dn), [
1946
+ [fe, b.value]
1947
+ ]),
1948
+ (k(), E("svg", {
1949
+ class: A(["enum-input__chevron", {
1950
+ "enum-input__chevron--open": m.value
1951
+ }]),
1952
+ viewBox: "0 0 24 24",
1953
+ "aria-hidden": "true"
1954
+ }, [...p[3] || (p[3] = [
1955
+ i("path", { d: "m7 10 5 5 5-5" }, null, -1)
1956
+ ])], 2))
1957
+ ], 2),
1958
+ (k(), Me($e, { to: "body" }, [
1959
+ Ee(Te, { name: "enum-menu" }, {
1960
+ default: Se(() => [
1961
+ m.value ? (k(), E("div", {
1962
+ key: 0,
1963
+ id: O,
1964
+ ref_key: "menuRef",
1965
+ ref: g,
1966
+ class: A(["enum-input__options", {
1967
+ "enum-input__options--above": L.value === "above",
1968
+ "enum-input__options--below": L.value === "below",
1969
+ "enum-input__options--overlay": L.value === "overlay"
1970
+ }]),
1971
+ style: Ce(N.value),
1972
+ role: "listbox",
1973
+ "aria-label": e.placeholder ?? "Select a value"
1974
+ }, [
1975
+ (k(!0), E(ye, null, Re(q.value, (_, V) => (k(), E("button", {
1976
+ id: `${je(S)}-option-${V}`,
1977
+ key: `${typeof _}:${String(_)}:${V}`,
1978
+ "data-option-index": V,
1979
+ type: "button",
1980
+ class: A(["enum-input__option", {
1981
+ "enum-input__option--selected": Object.is(_, e.value),
1982
+ "enum-input__option--highlighted": V === M.value
1983
+ }]),
1984
+ role: "option",
1985
+ "aria-selected": Object.is(_, e.value),
1986
+ onMouseenter: (W) => M.value = V,
1987
+ onMousedown: p[2] || (p[2] = ee(() => {
1988
+ }, ["prevent"])),
1989
+ onClick: (W) => v(_)
1990
+ }, [
1991
+ i("span", pn, [
1992
+ Object.is(_, e.value) ? (k(), E("svg", mn, [...p[5] || (p[5] = [
1993
+ i("path", { d: "M20 6 9 17l-5-5" }, null, -1)
1994
+ ])])) : K("", !0)
1995
+ ]),
1996
+ i("span", fn, Q(z(_)), 1),
1997
+ String(_) !== z(_) ? (k(), E("span", hn, Q(String(_)), 1)) : K("", !0)
1998
+ ], 42, vn))), 128)),
1999
+ q.value.length === 0 ? (k(), E("div", gn, [
2000
+ p[7] || (p[7] = i("svg", {
2001
+ viewBox: "0 0 24 24",
2002
+ "aria-hidden": "true"
2003
+ }, [
2004
+ i("circle", {
2005
+ cx: "11",
2006
+ cy: "11",
2007
+ r: "7"
2008
+ }),
2009
+ i("path", { d: "m20 20-4-4" })
2010
+ ], -1)),
2011
+ i("div", null, [
2012
+ p[6] || (p[6] = i("strong", null, "No matches", -1)),
2013
+ i("span", null, " No available value matches “" + Q(b.value.trim()) + "”. ", 1)
2014
+ ])
2015
+ ])) : K("", !0)
2016
+ ], 14, cn)) : K("", !0)
2017
+ ]),
2018
+ _: 1
2019
+ })
2020
+ ]))
2021
+ ], 2));
2022
+ }
2023
+ }), Sn = /* @__PURE__ */ ne(bn, [["__scopeId", "data-v-5c57fbed"]]);
2024
+ export {
2025
+ xn as AutoCompleteBox,
2026
+ _n as BooleanTickBox,
2027
+ yn as BooleanToggle,
2028
+ kn as LongTextBox,
2029
+ Mn as NumberInput,
2030
+ $n as NumberSlider,
2031
+ En as ShortTextBox,
2032
+ Tn as SingleAutoComplete,
2033
+ Sn as SingleEnumInput
2034
+ };