@opentiny/tiny-robot 0.5.2-beta.0 → 1.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/extension-manager/index.js +176 -178
- package/dist/index.d.ts +70 -73
- package/dist/index3.js +95 -92
- package/dist/model-selector/index.js +483 -477
- package/dist/sender/index.js +111 -111
- package/dist/style.css +1 -1
- package/package.json +3 -3
|
@@ -1,128 +1,128 @@
|
|
|
1
|
-
import { shallowRef as V, computed as g, watch as Y, nextTick as Z, defineComponent as J, openBlock as p, createElementBlock as
|
|
2
|
-
import { IconCheck as
|
|
3
|
-
import { a as
|
|
4
|
-
import { u as
|
|
5
|
-
function
|
|
6
|
-
const a = V(""),
|
|
7
|
-
const
|
|
1
|
+
import { shallowRef as V, computed as g, watch as Y, nextTick as Z, defineComponent as J, openBlock as p, createElementBlock as b, createElementVNode as I, toDisplayString as F, Fragment as ae, renderList as re, normalizeClass as W, withModifiers as pe, renderSlot as D, createBlock as _, resolveDynamicComponent as se, createCommentVNode as z, createVNode as N, unref as P, createSlots as te, withCtx as H, mergeProps as ue, onMounted as ce, onBeforeUnmount as ye, normalizeStyle as be, normalizeProps as U, guardReactiveProps as j, onScopeDispose as we, toRaw as ke, getCurrentInstance as $e, Teleport as Ee } from "vue";
|
|
2
|
+
import { IconCheck as Oe, IconSearch as Se, IconNoData as xe, IconArrowDown as Me } from "@opentiny/tiny-robot-svgs";
|
|
3
|
+
import { a as Pe, c as Ve, o as Te, f as Ce, s as De, b as Ie } from "../floating-ui.dom.js";
|
|
4
|
+
import { u as ze } from "../useTeleportTarget.js";
|
|
5
|
+
function Be(e) {
|
|
6
|
+
const a = V(""), n = g(() => a.value.trim()), l = g(() => {
|
|
7
|
+
const d = e.options(), i = n.value;
|
|
8
8
|
if (!e.searchable() || !i)
|
|
9
|
-
return
|
|
9
|
+
return d;
|
|
10
10
|
const r = e.filterMethod();
|
|
11
11
|
if (r)
|
|
12
|
-
return
|
|
13
|
-
const
|
|
14
|
-
return
|
|
15
|
-
}),
|
|
16
|
-
const
|
|
17
|
-
return
|
|
18
|
-
var
|
|
19
|
-
const r =
|
|
12
|
+
return d.filter((m) => r(i, m.raw));
|
|
13
|
+
const u = i.toLocaleLowerCase();
|
|
14
|
+
return d.filter((m) => m.searchText.includes(u));
|
|
15
|
+
}), s = g(() => {
|
|
16
|
+
const d = /* @__PURE__ */ new Map();
|
|
17
|
+
return l.value.forEach((i) => {
|
|
18
|
+
var u, m;
|
|
19
|
+
const r = d.get(i.groupKey);
|
|
20
20
|
if (r) {
|
|
21
21
|
r.items.push(i);
|
|
22
22
|
return;
|
|
23
23
|
}
|
|
24
|
-
|
|
24
|
+
d.set(i.groupKey, {
|
|
25
25
|
key: i.groupKey,
|
|
26
|
-
index:
|
|
27
|
-
group: ((
|
|
28
|
-
label: ((
|
|
26
|
+
index: d.size,
|
|
27
|
+
group: ((u = i.raw.group) == null ? void 0 : u.trim()) ?? "",
|
|
28
|
+
label: ((m = i.raw.group) == null ? void 0 : m.trim()) ?? "",
|
|
29
29
|
items: [i]
|
|
30
30
|
});
|
|
31
|
-
}), [...
|
|
32
|
-
}),
|
|
33
|
-
function c(
|
|
34
|
-
a.value =
|
|
31
|
+
}), [...d.values()];
|
|
32
|
+
}), f = g(() => l.value.length === 0);
|
|
33
|
+
function c(d) {
|
|
34
|
+
a.value = d;
|
|
35
35
|
}
|
|
36
|
-
function
|
|
36
|
+
function h() {
|
|
37
37
|
a.value = "";
|
|
38
38
|
}
|
|
39
39
|
return {
|
|
40
40
|
query: a,
|
|
41
|
-
visibleOptions:
|
|
42
|
-
groups:
|
|
43
|
-
isEmpty:
|
|
41
|
+
visibleOptions: l,
|
|
42
|
+
groups: s,
|
|
43
|
+
isEmpty: f,
|
|
44
44
|
setQuery: c,
|
|
45
|
-
clearQuery:
|
|
45
|
+
clearQuery: h
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
|
-
function
|
|
49
|
-
const a = V(null),
|
|
50
|
-
function
|
|
48
|
+
function Le(e) {
|
|
49
|
+
const a = V(null), n = g(() => e.options().find((i) => i.key === a.value) ?? null);
|
|
50
|
+
function l() {
|
|
51
51
|
return e.options().filter((i) => !i.disabled);
|
|
52
52
|
}
|
|
53
|
-
function
|
|
53
|
+
function s(i) {
|
|
54
54
|
if (i === null) {
|
|
55
55
|
a.value = null;
|
|
56
56
|
return;
|
|
57
57
|
}
|
|
58
|
-
const r = e.options().find((
|
|
58
|
+
const r = e.options().find((u) => u.key === i);
|
|
59
59
|
r && !r.disabled && (a.value = r.key);
|
|
60
60
|
}
|
|
61
|
-
function
|
|
61
|
+
function f() {
|
|
62
62
|
a.value = null;
|
|
63
63
|
}
|
|
64
64
|
function c(i) {
|
|
65
|
-
const r =
|
|
66
|
-
a.value = (
|
|
65
|
+
const r = l(), u = i === "first" ? r[0] : r[r.length - 1];
|
|
66
|
+
a.value = (u == null ? void 0 : u.key) ?? null;
|
|
67
67
|
}
|
|
68
|
-
function
|
|
69
|
-
const r = e.selectedValue(),
|
|
70
|
-
if (
|
|
71
|
-
a.value =
|
|
68
|
+
function h(i = "first") {
|
|
69
|
+
const r = e.selectedValue(), u = e.options().find((m) => m.value === r && !m.disabled);
|
|
70
|
+
if (u) {
|
|
71
|
+
a.value = u.key;
|
|
72
72
|
return;
|
|
73
73
|
}
|
|
74
74
|
c(i);
|
|
75
75
|
}
|
|
76
|
-
function
|
|
77
|
-
var y,
|
|
78
|
-
const r =
|
|
76
|
+
function d(i) {
|
|
77
|
+
var y, x;
|
|
78
|
+
const r = l();
|
|
79
79
|
if (r.length === 0) {
|
|
80
|
-
|
|
80
|
+
f();
|
|
81
81
|
return;
|
|
82
82
|
}
|
|
83
|
-
const
|
|
84
|
-
if (
|
|
85
|
-
const
|
|
86
|
-
a.value = ((y = r[
|
|
83
|
+
const u = r.findIndex((k) => k.key === a.value);
|
|
84
|
+
if (u < 0) {
|
|
85
|
+
const k = i === 1 ? 0 : r.length - 1;
|
|
86
|
+
a.value = ((y = r[k]) == null ? void 0 : y.key) ?? null;
|
|
87
87
|
return;
|
|
88
88
|
}
|
|
89
|
-
const
|
|
90
|
-
a.value = ((
|
|
89
|
+
const m = (u + i + r.length) % r.length;
|
|
90
|
+
a.value = ((x = r[m]) == null ? void 0 : x.key) ?? null;
|
|
91
91
|
}
|
|
92
92
|
return Y(
|
|
93
93
|
() => [e.enabled(), e.options(), e.selectedValue()],
|
|
94
|
-
([i, r,
|
|
94
|
+
([i, r, u], m) => {
|
|
95
95
|
if (!i) {
|
|
96
|
-
|
|
96
|
+
f();
|
|
97
97
|
return;
|
|
98
98
|
}
|
|
99
|
-
const y =
|
|
100
|
-
if (
|
|
101
|
-
a.value =
|
|
99
|
+
const y = m == null ? void 0 : m[2], x = r.find(($) => $.value === u && !$.disabled);
|
|
100
|
+
if (u !== y && x) {
|
|
101
|
+
a.value = x.key;
|
|
102
102
|
return;
|
|
103
103
|
}
|
|
104
|
-
(a.value ? r.some((
|
|
104
|
+
(a.value ? r.some(($) => $.key === a.value && !$.disabled) : !1) || h("first");
|
|
105
105
|
},
|
|
106
106
|
{ immediate: !0 }
|
|
107
107
|
), Y(a, async (i) => {
|
|
108
108
|
if (!i || !e.enabled())
|
|
109
109
|
return;
|
|
110
110
|
await Z();
|
|
111
|
-
const r = e.containerEl.value,
|
|
111
|
+
const r = e.containerEl.value, u = Array.from(
|
|
112
112
|
(r == null ? void 0 : r.querySelectorAll("[data-model-selector-option-key]")) ?? []
|
|
113
|
-
).find((
|
|
114
|
-
|
|
113
|
+
).find((m) => m.dataset.modelSelectorOptionKey === i);
|
|
114
|
+
u == null || u.scrollIntoView({ block: "nearest" });
|
|
115
115
|
}), {
|
|
116
116
|
highlightedKey: a,
|
|
117
|
-
highlightedOption:
|
|
118
|
-
setHighlightedKey:
|
|
119
|
-
resetHighlight:
|
|
117
|
+
highlightedOption: n,
|
|
118
|
+
setHighlightedKey: s,
|
|
119
|
+
resetHighlight: f,
|
|
120
120
|
highlightBoundary: c,
|
|
121
|
-
highlightSelectedOrBoundary:
|
|
122
|
-
moveHighlight:
|
|
121
|
+
highlightSelectedOrBoundary: h,
|
|
122
|
+
moveHighlight: d
|
|
123
123
|
};
|
|
124
124
|
}
|
|
125
|
-
const
|
|
125
|
+
const Re = { class: "tr-model-selector__effort" }, Ke = { class: "tr-model-selector__effort-label" }, qe = ["aria-label"], Fe = ["disabled", "aria-pressed", "data-model-selector-effort-value", "onClick"], Ae = /* @__PURE__ */ J({
|
|
126
126
|
name: "TrModelSelectorEffort",
|
|
127
127
|
__name: "ModelSelectorEffort",
|
|
128
128
|
props: {
|
|
@@ -133,26 +133,26 @@ const Le = { class: "tr-model-selector__effort" }, Re = { class: "tr-model-selec
|
|
|
133
133
|
},
|
|
134
134
|
emits: ["select"],
|
|
135
135
|
setup(e) {
|
|
136
|
-
return (a,
|
|
137
|
-
|
|
138
|
-
|
|
136
|
+
return (a, n) => (p(), b("div", Re, [
|
|
137
|
+
I("span", Ke, F(e.label), 1),
|
|
138
|
+
I("div", {
|
|
139
139
|
class: "tr-model-selector__effort-options",
|
|
140
140
|
role: "group",
|
|
141
141
|
"aria-label": e.label
|
|
142
142
|
}, [
|
|
143
|
-
(p(!0),
|
|
144
|
-
key:
|
|
143
|
+
(p(!0), b(ae, null, re(e.options, (l) => (p(), b("button", {
|
|
144
|
+
key: l.value,
|
|
145
145
|
type: "button",
|
|
146
|
-
class:
|
|
147
|
-
disabled: e.disabled ||
|
|
148
|
-
"aria-pressed":
|
|
149
|
-
"data-model-selector-effort-value":
|
|
150
|
-
onClick: (
|
|
151
|
-
},
|
|
152
|
-
], 8,
|
|
146
|
+
class: W(["tr-model-selector__effort-option", { "is-active": l.value === e.value }]),
|
|
147
|
+
disabled: e.disabled || l.disabled,
|
|
148
|
+
"aria-pressed": l.value === e.value,
|
|
149
|
+
"data-model-selector-effort-value": l.value,
|
|
150
|
+
onClick: (s) => a.$emit("select", l.value)
|
|
151
|
+
}, F(l.label), 11, Fe))), 128))
|
|
152
|
+
], 8, qe)
|
|
153
153
|
]));
|
|
154
154
|
}
|
|
155
|
-
}),
|
|
155
|
+
}), He = ["id", "data-model-selector-option-key", "aria-selected", "aria-disabled", "aria-describedby"], Ue = { class: "tr-model-selector__option-main" }, je = ["src"], Ne = { class: "tr-model-selector__option-text" }, We = ["title"], Qe = ["id", "title"], Ge = /* @__PURE__ */ J({
|
|
156
156
|
name: "TrModelSelectorItem",
|
|
157
157
|
__name: "ModelSelectorItem",
|
|
158
158
|
props: {
|
|
@@ -164,16 +164,16 @@ const Le = { class: "tr-model-selector__effort" }, Re = { class: "tr-model-selec
|
|
|
164
164
|
},
|
|
165
165
|
emits: ["hover", "select"],
|
|
166
166
|
setup(e, { emit: a }) {
|
|
167
|
-
const
|
|
168
|
-
function
|
|
169
|
-
|
|
167
|
+
const n = e, l = a;
|
|
168
|
+
function s() {
|
|
169
|
+
n.option.disabled || l("hover", n.option.key);
|
|
170
170
|
}
|
|
171
|
-
function
|
|
172
|
-
|
|
171
|
+
function f() {
|
|
172
|
+
n.option.disabled || l("select", n.option.raw);
|
|
173
173
|
}
|
|
174
|
-
return (c,
|
|
174
|
+
return (c, h) => (p(), b("div", {
|
|
175
175
|
id: e.optionId,
|
|
176
|
-
class:
|
|
176
|
+
class: W(["tr-model-selector__option", {
|
|
177
177
|
"is-selected": e.selected,
|
|
178
178
|
"is-highlighted": e.highlighted,
|
|
179
179
|
"is-disabled": e.option.disabled
|
|
@@ -183,51 +183,51 @@ const Le = { class: "tr-model-selector__effort" }, Re = { class: "tr-model-selec
|
|
|
183
183
|
"aria-selected": e.selected,
|
|
184
184
|
"aria-disabled": e.option.disabled || void 0,
|
|
185
185
|
"aria-describedby": e.option.description && !c.$slots.item ? e.descriptionId : void 0,
|
|
186
|
-
onMouseenter:
|
|
187
|
-
onMousedown:
|
|
186
|
+
onMouseenter: s,
|
|
187
|
+
onMousedown: h[0] || (h[0] = pe(() => {
|
|
188
188
|
}, ["prevent"])),
|
|
189
|
-
onClick:
|
|
189
|
+
onClick: f
|
|
190
190
|
}, [
|
|
191
|
-
|
|
191
|
+
D(c.$slots, "item", {
|
|
192
192
|
option: e.option.raw,
|
|
193
193
|
selected: e.selected,
|
|
194
194
|
highlighted: e.highlighted
|
|
195
195
|
}, () => [
|
|
196
|
-
|
|
197
|
-
typeof e.option.icon == "string" ? (p(),
|
|
196
|
+
I("span", Ue, [
|
|
197
|
+
typeof e.option.icon == "string" ? (p(), b("img", {
|
|
198
198
|
key: 0,
|
|
199
199
|
src: e.option.icon,
|
|
200
200
|
class: "tr-model-selector__option-icon",
|
|
201
201
|
alt: "",
|
|
202
202
|
"aria-hidden": "true"
|
|
203
|
-
}, null, 8,
|
|
203
|
+
}, null, 8, je)) : e.option.icon ? (p(), _(se(e.option.icon), {
|
|
204
204
|
key: 1,
|
|
205
205
|
class: "tr-model-selector__option-icon",
|
|
206
206
|
"aria-hidden": "true",
|
|
207
207
|
focusable: "false"
|
|
208
|
-
})) :
|
|
209
|
-
|
|
210
|
-
|
|
208
|
+
})) : z("", !0),
|
|
209
|
+
I("span", Ne, [
|
|
210
|
+
I("span", {
|
|
211
211
|
class: "tr-model-selector__option-label",
|
|
212
212
|
title: e.option.label
|
|
213
|
-
},
|
|
214
|
-
e.option.description ? (p(),
|
|
213
|
+
}, F(e.option.label), 9, We),
|
|
214
|
+
e.option.description ? (p(), b("span", {
|
|
215
215
|
key: 0,
|
|
216
216
|
id: e.descriptionId,
|
|
217
217
|
class: "tr-model-selector__option-description",
|
|
218
218
|
title: e.option.description
|
|
219
|
-
},
|
|
219
|
+
}, F(e.option.description), 9, Qe)) : z("", !0)
|
|
220
220
|
])
|
|
221
221
|
]),
|
|
222
|
-
|
|
222
|
+
N(P(Oe), {
|
|
223
223
|
class: "tr-model-selector__option-check",
|
|
224
224
|
"aria-hidden": "true",
|
|
225
225
|
focusable: "false"
|
|
226
226
|
})
|
|
227
227
|
])
|
|
228
|
-
], 42,
|
|
228
|
+
], 42, He));
|
|
229
229
|
}
|
|
230
|
-
}),
|
|
230
|
+
}), Ye = ["role", "aria-labelledby"], Je = ["id"], Xe = /* @__PURE__ */ J({
|
|
231
231
|
name: "TrModelSelectorGroup",
|
|
232
232
|
__name: "ModelSelectorGroup",
|
|
233
233
|
props: {
|
|
@@ -238,51 +238,51 @@ const Le = { class: "tr-model-selector__effort" }, Re = { class: "tr-model-selec
|
|
|
238
238
|
},
|
|
239
239
|
emits: ["hover", "select"],
|
|
240
240
|
setup(e) {
|
|
241
|
-
return (a,
|
|
241
|
+
return (a, n) => (p(), b("div", {
|
|
242
242
|
class: "tr-model-selector__group",
|
|
243
243
|
role: e.group.label ? "group" : "presentation",
|
|
244
244
|
"aria-labelledby": e.group.label ? `${e.optionIdPrefix}-group-${e.group.index}` : void 0
|
|
245
245
|
}, [
|
|
246
|
-
e.group.label ? (p(),
|
|
246
|
+
e.group.label ? (p(), b("div", {
|
|
247
247
|
key: 0,
|
|
248
248
|
id: `${e.optionIdPrefix}-group-${e.group.index}`,
|
|
249
249
|
class: "tr-model-selector__group-title"
|
|
250
|
-
},
|
|
251
|
-
(p(!0),
|
|
252
|
-
key:
|
|
253
|
-
option:
|
|
254
|
-
selected: e.selectedValue ===
|
|
255
|
-
highlighted: e.highlightedKey ===
|
|
256
|
-
"option-id": `${e.optionIdPrefix}-option-${
|
|
257
|
-
"description-id": `${e.optionIdPrefix}-option-${
|
|
258
|
-
onHover:
|
|
259
|
-
onSelect:
|
|
250
|
+
}, F(e.group.label), 9, Je)) : z("", !0),
|
|
251
|
+
(p(!0), b(ae, null, re(e.group.items, (l) => (p(), _(Ge, {
|
|
252
|
+
key: l.key,
|
|
253
|
+
option: l,
|
|
254
|
+
selected: e.selectedValue === l.value,
|
|
255
|
+
highlighted: e.highlightedKey === l.key,
|
|
256
|
+
"option-id": `${e.optionIdPrefix}-option-${l.index}`,
|
|
257
|
+
"description-id": `${e.optionIdPrefix}-option-${l.index}-description`,
|
|
258
|
+
onHover: n[0] || (n[0] = (s) => a.$emit("hover", s)),
|
|
259
|
+
onSelect: n[1] || (n[1] = (s) => a.$emit("select", s))
|
|
260
260
|
}, te({ _: 2 }, [
|
|
261
261
|
a.$slots.item ? {
|
|
262
262
|
name: "item",
|
|
263
|
-
fn:
|
|
264
|
-
|
|
263
|
+
fn: H((s) => [
|
|
264
|
+
D(a.$slots, "item", ue({ ref_for: !0 }, s))
|
|
265
265
|
]),
|
|
266
266
|
key: "0"
|
|
267
267
|
} : void 0
|
|
268
268
|
]), 1032, ["option", "selected", "highlighted", "option-id", "description-id"]))), 128))
|
|
269
|
-
], 8,
|
|
269
|
+
], 8, Ye));
|
|
270
270
|
}
|
|
271
|
-
}),
|
|
271
|
+
}), Ze = {
|
|
272
272
|
key: 0,
|
|
273
273
|
class: "tr-model-selector__header"
|
|
274
|
-
},
|
|
274
|
+
}, _e = {
|
|
275
275
|
key: 1,
|
|
276
276
|
class: "tr-model-selector__search"
|
|
277
|
-
},
|
|
277
|
+
}, et = ["value", "placeholder", "aria-label", "aria-controls", "aria-activedescendant"], tt = {
|
|
278
278
|
key: 2,
|
|
279
279
|
class: "tr-model-selector__empty",
|
|
280
280
|
role: "status",
|
|
281
281
|
"aria-live": "polite"
|
|
282
|
-
},
|
|
282
|
+
}, lt = ["id", "aria-label", "aria-activedescendant"], ot = {
|
|
283
283
|
key: 3,
|
|
284
284
|
class: "tr-model-selector__footer"
|
|
285
|
-
},
|
|
285
|
+
}, nt = /* @__PURE__ */ J({
|
|
286
286
|
name: "TrModelSelectorPanel",
|
|
287
287
|
__name: "ModelSelectorPanel",
|
|
288
288
|
props: {
|
|
@@ -305,122 +305,122 @@ const Le = { class: "tr-model-selector__effort" }, Re = { class: "tr-model-selec
|
|
|
305
305
|
},
|
|
306
306
|
emits: ["select", "select-effort", "close"],
|
|
307
307
|
setup(e, { emit: a }) {
|
|
308
|
-
const
|
|
309
|
-
let
|
|
308
|
+
const n = e, l = a, s = V(null), f = V(null), c = V(null), h = V(null);
|
|
309
|
+
let d;
|
|
310
310
|
const i = g(
|
|
311
|
-
() =>
|
|
312
|
-
), r =
|
|
313
|
-
options: () =>
|
|
314
|
-
searchable: () =>
|
|
315
|
-
filterMethod: () =>
|
|
316
|
-
}),
|
|
311
|
+
() => h.value === null ? void 0 : { "--tr-model-selector-open-min-width": `${h.value}px` }
|
|
312
|
+
), r = Be({
|
|
313
|
+
options: () => n.options,
|
|
314
|
+
searchable: () => n.searchable,
|
|
315
|
+
filterMethod: () => n.filterMethod
|
|
316
|
+
}), u = Le({
|
|
317
317
|
enabled: () => !0,
|
|
318
318
|
options: () => r.visibleOptions.value,
|
|
319
|
-
selectedValue: () =>
|
|
320
|
-
containerEl:
|
|
321
|
-
}),
|
|
322
|
-
const
|
|
323
|
-
return
|
|
319
|
+
selectedValue: () => n.selectedValue,
|
|
320
|
+
containerEl: f
|
|
321
|
+
}), m = g(() => {
|
|
322
|
+
const t = u.highlightedOption.value;
|
|
323
|
+
return t ? `${n.optionIdPrefix}-option-${t.index}` : void 0;
|
|
324
324
|
}), y = g(() => ({
|
|
325
|
-
...
|
|
325
|
+
...n.slotContext,
|
|
326
326
|
query: r.query.value
|
|
327
|
-
})),
|
|
327
|
+
})), x = g(() => ({
|
|
328
328
|
...y.value,
|
|
329
|
-
reasoningEfforts:
|
|
330
|
-
reasoningEffortOption:
|
|
331
|
-
setReasoningEffort: (
|
|
329
|
+
reasoningEfforts: n.effortOptions,
|
|
330
|
+
reasoningEffortOption: n.effortOptions.find((t) => t.value === n.effortValue) ?? null,
|
|
331
|
+
setReasoningEffort: (t) => l("select-effort", t)
|
|
332
332
|
}));
|
|
333
|
-
function
|
|
334
|
-
r.setQuery(
|
|
333
|
+
function k(t) {
|
|
334
|
+
r.setQuery(t.target.value);
|
|
335
335
|
}
|
|
336
|
-
function
|
|
337
|
-
const
|
|
338
|
-
|
|
336
|
+
function $() {
|
|
337
|
+
const t = n.searchable ? s.value : f.value;
|
|
338
|
+
t == null || t.focus({ preventScroll: !0 });
|
|
339
339
|
}
|
|
340
|
-
async function
|
|
341
|
-
var
|
|
340
|
+
async function E() {
|
|
341
|
+
var S, M;
|
|
342
342
|
await Z();
|
|
343
|
-
const
|
|
344
|
-
if (!
|
|
345
|
-
|
|
343
|
+
const t = ((S = s.value) == null ? void 0 : S.ownerDocument.defaultView) ?? ((M = f.value) == null ? void 0 : M.ownerDocument.defaultView);
|
|
344
|
+
if (!t || typeof t.requestAnimationFrame != "function") {
|
|
345
|
+
$();
|
|
346
346
|
return;
|
|
347
347
|
}
|
|
348
|
-
|
|
349
|
-
|
|
348
|
+
t.requestAnimationFrame(() => {
|
|
349
|
+
$();
|
|
350
350
|
});
|
|
351
351
|
}
|
|
352
|
-
function
|
|
353
|
-
const
|
|
354
|
-
|
|
352
|
+
function R() {
|
|
353
|
+
const t = u.highlightedOption.value;
|
|
354
|
+
t && l("select", t.raw);
|
|
355
355
|
}
|
|
356
|
-
function
|
|
357
|
-
return
|
|
356
|
+
function T(t) {
|
|
357
|
+
return t.isComposing || t.keyCode === 229;
|
|
358
358
|
}
|
|
359
|
-
function
|
|
360
|
-
if (!(
|
|
361
|
-
if (
|
|
362
|
-
|
|
359
|
+
function O(t) {
|
|
360
|
+
if (!(t.defaultPrevented || T(t))) {
|
|
361
|
+
if (t.key === "ArrowDown" || t.key === "ArrowUp") {
|
|
362
|
+
t.preventDefault(), u.moveHighlight(t.key === "ArrowDown" ? 1 : -1);
|
|
363
363
|
return;
|
|
364
364
|
}
|
|
365
|
-
if (
|
|
366
|
-
|
|
365
|
+
if (t.key === "Enter") {
|
|
366
|
+
t.preventDefault(), R();
|
|
367
367
|
return;
|
|
368
368
|
}
|
|
369
|
-
|
|
369
|
+
t.key === "Escape" && (t.preventDefault(), l("close", !0));
|
|
370
370
|
}
|
|
371
371
|
}
|
|
372
|
-
function
|
|
373
|
-
if (!(
|
|
374
|
-
if (
|
|
375
|
-
|
|
372
|
+
function K(t) {
|
|
373
|
+
if (!(t.defaultPrevented || T(t))) {
|
|
374
|
+
if (t.key === "ArrowDown" || t.key === "ArrowUp") {
|
|
375
|
+
t.preventDefault(), u.moveHighlight(t.key === "ArrowDown" ? 1 : -1);
|
|
376
376
|
return;
|
|
377
377
|
}
|
|
378
|
-
if (
|
|
379
|
-
|
|
378
|
+
if (t.key === "Home" || t.key === "End") {
|
|
379
|
+
t.preventDefault(), u.highlightBoundary(t.key === "Home" ? "first" : "last");
|
|
380
380
|
return;
|
|
381
381
|
}
|
|
382
|
-
(
|
|
382
|
+
(t.key === "Enter" || t.key === " " || t.key === "Spacebar") && (t.preventDefault(), R());
|
|
383
383
|
}
|
|
384
384
|
}
|
|
385
|
-
function
|
|
386
|
-
|
|
385
|
+
function Q(t) {
|
|
386
|
+
t.defaultPrevented || t.key === "Escape" && (t.preventDefault(), l("close", !0));
|
|
387
387
|
}
|
|
388
|
-
return
|
|
389
|
-
var
|
|
390
|
-
const
|
|
388
|
+
return ce(() => {
|
|
389
|
+
var B;
|
|
390
|
+
const t = c.value, S = (B = t == null ? void 0 : t.ownerDocument.defaultView) == null ? void 0 : B.ResizeObserver;
|
|
391
391
|
function M() {
|
|
392
|
-
if (!
|
|
392
|
+
if (!t)
|
|
393
393
|
return;
|
|
394
|
-
const
|
|
395
|
-
|
|
394
|
+
const q = Math.ceil(t.getBoundingClientRect().width);
|
|
395
|
+
q > (h.value ?? 0) && (h.value = q);
|
|
396
396
|
}
|
|
397
|
-
M(),
|
|
398
|
-
}),
|
|
399
|
-
|
|
397
|
+
M(), t && S && (d = new S(M), d.observe(t)), E();
|
|
398
|
+
}), ye(() => {
|
|
399
|
+
d == null || d.disconnect();
|
|
400
400
|
}), Y(
|
|
401
|
-
() =>
|
|
401
|
+
() => n.searchable,
|
|
402
402
|
async () => {
|
|
403
|
-
r.clearQuery(), await
|
|
403
|
+
r.clearQuery(), await E();
|
|
404
404
|
}
|
|
405
|
-
), (
|
|
405
|
+
), (t, S) => (p(), b("div", {
|
|
406
406
|
ref_key: "panelEl",
|
|
407
407
|
ref: c,
|
|
408
|
-
class:
|
|
409
|
-
style:
|
|
410
|
-
onKeydown:
|
|
408
|
+
class: W(["tr-model-selector__panel", [`tr-model-selector__panel--${e.size}`, e.panelClass]]),
|
|
409
|
+
style: be(i.value),
|
|
410
|
+
onKeydown: Q
|
|
411
411
|
}, [
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
])) :
|
|
415
|
-
e.searchable ? (p(),
|
|
416
|
-
|
|
412
|
+
t.$slots.header ? (p(), b("div", Ze, [
|
|
413
|
+
D(t.$slots, "header", U(j(y.value)))
|
|
414
|
+
])) : z("", !0),
|
|
415
|
+
e.searchable ? (p(), b("div", _e, [
|
|
416
|
+
N(P(Se), {
|
|
417
417
|
class: "tr-model-selector__search-icon",
|
|
418
418
|
"aria-hidden": "true",
|
|
419
419
|
focusable: "false"
|
|
420
420
|
}),
|
|
421
|
-
|
|
421
|
+
I("input", {
|
|
422
422
|
ref_key: "searchInputEl",
|
|
423
|
-
ref:
|
|
423
|
+
ref: s,
|
|
424
424
|
type: "text",
|
|
425
425
|
class: "tr-model-selector__search-input",
|
|
426
426
|
"data-model-selector-search-input": "",
|
|
@@ -429,74 +429,74 @@ const Le = { class: "tr-model-selector__effort" }, Re = { class: "tr-model-selec
|
|
|
429
429
|
placeholder: e.searchPlaceholder,
|
|
430
430
|
"aria-label": e.searchPlaceholder,
|
|
431
431
|
"aria-controls": e.listboxId,
|
|
432
|
-
"aria-activedescendant":
|
|
432
|
+
"aria-activedescendant": m.value,
|
|
433
433
|
"aria-autocomplete": "list",
|
|
434
434
|
"aria-expanded": "true",
|
|
435
435
|
"aria-haspopup": "listbox",
|
|
436
436
|
autocomplete: "off",
|
|
437
437
|
spellcheck: !1,
|
|
438
|
-
onInput:
|
|
439
|
-
onKeydown:
|
|
440
|
-
}, null, 40,
|
|
441
|
-
])) :
|
|
442
|
-
P(r).isEmpty.value ? (p(),
|
|
443
|
-
|
|
438
|
+
onInput: k,
|
|
439
|
+
onKeydown: O
|
|
440
|
+
}, null, 40, et)
|
|
441
|
+
])) : z("", !0),
|
|
442
|
+
P(r).isEmpty.value ? (p(), b("div", tt, [
|
|
443
|
+
D(t.$slots, "empty", {
|
|
444
444
|
query: P(r).query.value
|
|
445
445
|
}, () => [
|
|
446
|
-
|
|
446
|
+
N(P(xe), {
|
|
447
447
|
class: "tr-model-selector__empty-icon",
|
|
448
448
|
"aria-hidden": "true",
|
|
449
449
|
focusable: "false"
|
|
450
450
|
}),
|
|
451
|
-
|
|
451
|
+
I("span", null, F(e.emptyText), 1)
|
|
452
452
|
])
|
|
453
|
-
])) :
|
|
454
|
-
|
|
453
|
+
])) : z("", !0),
|
|
454
|
+
I("div", {
|
|
455
455
|
id: e.listboxId,
|
|
456
456
|
ref_key: "listboxEl",
|
|
457
|
-
ref:
|
|
458
|
-
class:
|
|
457
|
+
ref: f,
|
|
458
|
+
class: W(["tr-model-selector__content", { "is-empty": P(r).isEmpty.value }]),
|
|
459
459
|
role: "listbox",
|
|
460
460
|
tabindex: "-1",
|
|
461
461
|
"aria-label": e.placeholder,
|
|
462
|
-
"aria-activedescendant": e.searchable ? void 0 :
|
|
463
|
-
onKeydown:
|
|
462
|
+
"aria-activedescendant": e.searchable ? void 0 : m.value,
|
|
463
|
+
onKeydown: K
|
|
464
464
|
}, [
|
|
465
|
-
(p(!0),
|
|
465
|
+
(p(!0), b(ae, null, re(P(r).groups.value, (M) => (p(), _(Xe, {
|
|
466
466
|
key: M.key,
|
|
467
467
|
group: M,
|
|
468
468
|
"selected-value": e.selectedValue,
|
|
469
|
-
"highlighted-key": P(
|
|
469
|
+
"highlighted-key": P(u).highlightedKey.value,
|
|
470
470
|
"option-id-prefix": e.optionIdPrefix,
|
|
471
|
-
onHover: P(
|
|
472
|
-
onSelect:
|
|
471
|
+
onHover: P(u).setHighlightedKey,
|
|
472
|
+
onSelect: S[0] || (S[0] = (B) => t.$emit("select", B))
|
|
473
473
|
}, te({ _: 2 }, [
|
|
474
|
-
|
|
474
|
+
t.$slots.item ? {
|
|
475
475
|
name: "item",
|
|
476
|
-
fn:
|
|
477
|
-
|
|
476
|
+
fn: H((B) => [
|
|
477
|
+
D(t.$slots, "item", ue({ ref_for: !0 }, B))
|
|
478
478
|
]),
|
|
479
479
|
key: "0"
|
|
480
480
|
} : void 0
|
|
481
481
|
]), 1032, ["group", "selected-value", "highlighted-key", "option-id-prefix", "onHover"]))), 128))
|
|
482
|
-
], 42,
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
482
|
+
], 42, lt),
|
|
483
|
+
t.$slots.footer || e.effortOptions.length > 0 ? (p(), b("div", ot, [
|
|
484
|
+
D(t.$slots, "footer", U(j(x.value)), () => [
|
|
485
|
+
N(Ae, {
|
|
486
486
|
options: e.effortOptions,
|
|
487
487
|
value: e.effortValue,
|
|
488
488
|
label: e.effortLabel,
|
|
489
489
|
disabled: e.effortDisabled,
|
|
490
|
-
onSelect:
|
|
490
|
+
onSelect: S[1] || (S[1] = (M) => t.$emit("select-effort", M))
|
|
491
491
|
}, null, 8, ["options", "value", "label", "disabled"])
|
|
492
492
|
])
|
|
493
|
-
])) :
|
|
493
|
+
])) : z("", !0)
|
|
494
494
|
], 38));
|
|
495
495
|
}
|
|
496
|
-
}),
|
|
496
|
+
}), at = ["title", "disabled", "aria-label", "aria-expanded", "aria-controls"], rt = { class: "tr-model-selector__trigger-content" }, it = ["src"], st = { class: "tr-model-selector__trigger-label" }, ut = {
|
|
497
497
|
key: 2,
|
|
498
498
|
class: "tr-model-selector__trigger-effort"
|
|
499
|
-
},
|
|
499
|
+
}, ct = /* @__PURE__ */ J({
|
|
500
500
|
name: "TrModelSelectorTrigger",
|
|
501
501
|
__name: "ModelSelectorTrigger",
|
|
502
502
|
props: {
|
|
@@ -511,217 +511,218 @@ const Le = { class: "tr-model-selector__effort" }, Re = { class: "tr-model-selec
|
|
|
511
511
|
},
|
|
512
512
|
emits: ["click", "enter"],
|
|
513
513
|
setup(e, { emit: a }) {
|
|
514
|
-
const
|
|
515
|
-
function
|
|
516
|
-
c.key === "Enter" && !c.defaultPrevented && (c.preventDefault(),
|
|
514
|
+
const n = e, l = g(() => n.effortLabel ? `${n.label} · ${n.effortLabel}` : n.label), s = a;
|
|
515
|
+
function f(c) {
|
|
516
|
+
c.key === "Enter" && !c.defaultPrevented && (c.preventDefault(), s("enter", c));
|
|
517
517
|
}
|
|
518
|
-
return (c,
|
|
518
|
+
return (c, h) => (p(), b("button", {
|
|
519
519
|
type: "button",
|
|
520
|
-
class:
|
|
521
|
-
title:
|
|
520
|
+
class: W(["tr-model-selector__trigger", [`tr-model-selector__trigger--${e.variant}`, `tr-model-selector__trigger--${e.size}`, { "is-open": e.open }]]),
|
|
521
|
+
title: l.value,
|
|
522
522
|
disabled: e.disabled,
|
|
523
|
-
"aria-label":
|
|
523
|
+
"aria-label": l.value,
|
|
524
524
|
"aria-expanded": e.open,
|
|
525
525
|
"aria-controls": e.controlsId,
|
|
526
526
|
"aria-haspopup": "listbox",
|
|
527
|
-
onClick:
|
|
528
|
-
onKeydown:
|
|
527
|
+
onClick: h[0] || (h[0] = (d) => c.$emit("click", d)),
|
|
528
|
+
onKeydown: f
|
|
529
529
|
}, [
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
typeof e.icon == "string" ? (p(),
|
|
530
|
+
D(c.$slots, "default", {}, () => [
|
|
531
|
+
I("span", rt, [
|
|
532
|
+
typeof e.icon == "string" ? (p(), b("img", {
|
|
533
533
|
key: 0,
|
|
534
534
|
src: e.icon,
|
|
535
535
|
class: "tr-model-selector__trigger-icon",
|
|
536
536
|
alt: "",
|
|
537
537
|
"aria-hidden": "true"
|
|
538
|
-
}, null, 8,
|
|
538
|
+
}, null, 8, it)) : e.icon ? (p(), _(se(e.icon), {
|
|
539
539
|
key: 1,
|
|
540
540
|
class: "tr-model-selector__trigger-icon",
|
|
541
541
|
"aria-hidden": "true",
|
|
542
542
|
focusable: "false"
|
|
543
|
-
})) :
|
|
544
|
-
|
|
545
|
-
e.effortLabel ? (p(),
|
|
543
|
+
})) : z("", !0),
|
|
544
|
+
I("span", st, F(e.label), 1),
|
|
545
|
+
e.effortLabel ? (p(), b("span", ut, F(e.effortLabel), 1)) : z("", !0)
|
|
546
546
|
]),
|
|
547
|
-
|
|
547
|
+
N(P(Me), {
|
|
548
548
|
class: "tr-model-selector__trigger-chevron",
|
|
549
549
|
"aria-hidden": "true",
|
|
550
550
|
focusable: "false"
|
|
551
551
|
})
|
|
552
552
|
])
|
|
553
|
-
], 42,
|
|
553
|
+
], 42, at));
|
|
554
554
|
}
|
|
555
555
|
});
|
|
556
|
-
function
|
|
557
|
-
const a = e.controlled,
|
|
558
|
-
function
|
|
559
|
-
if (Object.is(
|
|
556
|
+
function dt(e) {
|
|
557
|
+
const a = e.controlled, n = V(e.defaultValue), l = g(() => a ? e.value() ?? null : n.value), s = g(() => e.efforts().find((c) => c.value === l.value) ?? null);
|
|
558
|
+
function f(c) {
|
|
559
|
+
if (Object.is(l.value, c))
|
|
560
560
|
return !1;
|
|
561
561
|
if (c !== null) {
|
|
562
|
-
const
|
|
563
|
-
if (!
|
|
562
|
+
const h = e.efforts().find((d) => d.value === c);
|
|
563
|
+
if (!h || h.disabled)
|
|
564
564
|
return !1;
|
|
565
565
|
}
|
|
566
|
-
return a || (
|
|
566
|
+
return a || (n.value = c), e.onUpdateValue(c), !0;
|
|
567
567
|
}
|
|
568
568
|
return {
|
|
569
|
-
value:
|
|
570
|
-
activeOption:
|
|
571
|
-
setValue:
|
|
569
|
+
value: l,
|
|
570
|
+
activeOption: s,
|
|
571
|
+
setValue: f
|
|
572
572
|
};
|
|
573
573
|
}
|
|
574
|
-
function
|
|
575
|
-
var
|
|
576
|
-
if ((((
|
|
574
|
+
function ie(e, a) {
|
|
575
|
+
var s, f;
|
|
576
|
+
if ((((s = e.composedPath) == null ? void 0 : s.call(e)) ?? []).includes(a))
|
|
577
577
|
return !0;
|
|
578
|
-
const
|
|
579
|
-
return !!(
|
|
578
|
+
const l = (f = a.ownerDocument.defaultView) == null ? void 0 : f.Node;
|
|
579
|
+
return !!(l && e.target instanceof l && a.contains(e.target));
|
|
580
580
|
}
|
|
581
|
-
function
|
|
582
|
-
const a = V(!1),
|
|
581
|
+
function ft(e) {
|
|
582
|
+
const a = V(!1), n = Y(
|
|
583
583
|
() => [
|
|
584
584
|
e.open(),
|
|
585
585
|
e.referenceEl.value,
|
|
586
586
|
e.floatingEl.value,
|
|
587
587
|
e.placement(),
|
|
588
|
+
e.strategy(),
|
|
588
589
|
e.offset(),
|
|
589
590
|
e.teleportTarget()
|
|
590
591
|
],
|
|
591
|
-
async ([
|
|
592
|
-
if (a.value = !1, !
|
|
592
|
+
async ([l, s, f, c, h, d, i], r, u) => {
|
|
593
|
+
if (a.value = !1, !l || !s || !f)
|
|
593
594
|
return;
|
|
594
|
-
const
|
|
595
|
-
let
|
|
596
|
-
const
|
|
597
|
-
|
|
595
|
+
const m = s, y = f;
|
|
596
|
+
let x = !0, k = 0;
|
|
597
|
+
const $ = {}, E = m.ownerDocument, R = (O) => {
|
|
598
|
+
ie(O, m) || ie(O, y) || e.onOutsidePointerDown(O);
|
|
598
599
|
};
|
|
599
|
-
|
|
600
|
-
var
|
|
601
|
-
|
|
600
|
+
E.addEventListener("pointerdown", R, !0), u(() => {
|
|
601
|
+
var O;
|
|
602
|
+
x = !1, k += 1, (O = $.current) == null || O.call($), E.removeEventListener("pointerdown", R, !0), a.value = !1;
|
|
602
603
|
});
|
|
603
604
|
async function T() {
|
|
604
605
|
var K;
|
|
605
|
-
const
|
|
606
|
+
const O = ++k;
|
|
606
607
|
try {
|
|
607
|
-
const
|
|
608
|
+
const Q = await Ve(m, y, {
|
|
608
609
|
placement: c,
|
|
609
|
-
strategy:
|
|
610
|
+
strategy: h,
|
|
610
611
|
middleware: [
|
|
611
|
-
|
|
612
|
-
Te({ padding: 8 }),
|
|
612
|
+
Te(d),
|
|
613
613
|
Ce({ padding: 8 }),
|
|
614
|
-
De({
|
|
614
|
+
De({ padding: 8 }),
|
|
615
|
+
Ie({
|
|
615
616
|
padding: 8,
|
|
616
|
-
apply({ availableHeight:
|
|
617
|
-
const ee = Math.min(
|
|
618
|
-
G.floating.style.minWidth = `${Math.round(ee)}px`, G.floating.style.maxWidth = `${Math.max(0, Math.floor(
|
|
617
|
+
apply({ availableHeight: B, availableWidth: q, rects: oe, elements: G }) {
|
|
618
|
+
const ee = Math.min(oe.reference.width, Math.max(0, q));
|
|
619
|
+
G.floating.style.minWidth = `${Math.round(ee)}px`, G.floating.style.maxWidth = `${Math.max(0, Math.floor(q))}px`, G.floating.style.setProperty(
|
|
619
620
|
"--tr-model-selector-available-height",
|
|
620
|
-
`${Math.max(0, Math.floor(
|
|
621
|
+
`${Math.max(0, Math.floor(B))}px`
|
|
621
622
|
), G.floating.style.setProperty(
|
|
622
623
|
"--tr-model-selector-available-width",
|
|
623
|
-
`${Math.max(0, Math.floor(
|
|
624
|
+
`${Math.max(0, Math.floor(q))}px`
|
|
624
625
|
);
|
|
625
626
|
}
|
|
626
627
|
})
|
|
627
628
|
]
|
|
628
629
|
});
|
|
629
|
-
if (!
|
|
630
|
+
if (!x || O !== k || !e.open() || e.referenceEl.value !== m || e.floatingEl.value !== y)
|
|
630
631
|
return;
|
|
631
|
-
const
|
|
632
|
-
Object.assign(
|
|
633
|
-
left: `${
|
|
634
|
-
top: `${
|
|
632
|
+
const t = ((K = E.defaultView) == null ? void 0 : K.devicePixelRatio) || 1, S = Math.round(Q.x * t) / t, M = Math.round(Q.y * t) / t;
|
|
633
|
+
Object.assign(y.style, {
|
|
634
|
+
left: `${S}px`,
|
|
635
|
+
top: `${M}px`
|
|
635
636
|
}), a.value = !0;
|
|
636
637
|
} catch {
|
|
637
|
-
|
|
638
|
+
x && O === k && (a.value = !1);
|
|
638
639
|
}
|
|
639
640
|
}
|
|
640
|
-
await Z(), !(!
|
|
641
|
+
await Z(), !(!x || !e.open()) && ($.current = Pe(m, y, () => {
|
|
641
642
|
T();
|
|
642
643
|
}));
|
|
643
644
|
},
|
|
644
645
|
{ flush: "post", immediate: !0 }
|
|
645
646
|
);
|
|
646
|
-
return
|
|
647
|
-
|
|
647
|
+
return we(() => {
|
|
648
|
+
n();
|
|
648
649
|
}), {
|
|
649
650
|
isPositioned: a
|
|
650
651
|
};
|
|
651
652
|
}
|
|
652
|
-
function
|
|
653
|
-
const a = e.valueControlled,
|
|
654
|
-
function f(i) {
|
|
655
|
-
return Object.is(d.value, i) ? !1 : (a || (t.value = i), e.onUpdateValue(i), !0);
|
|
656
|
-
}
|
|
653
|
+
function ht(e) {
|
|
654
|
+
const a = e.valueControlled, n = e.openControlled, l = V(e.defaultValue), s = V(e.defaultOpen), f = g(() => a ? e.value() ?? null : l.value), c = g(() => n ? !!e.open() : s.value);
|
|
657
655
|
function h(i) {
|
|
658
|
-
return
|
|
656
|
+
return Object.is(f.value, i) ? !1 : (a || (l.value = i), e.onUpdateValue(i), !0);
|
|
657
|
+
}
|
|
658
|
+
function d(i) {
|
|
659
|
+
return c.value === i ? !1 : (n || (s.value = i), e.onUpdateOpen(i), !0);
|
|
659
660
|
}
|
|
660
661
|
return {
|
|
661
|
-
value:
|
|
662
|
+
value: f,
|
|
662
663
|
open: c,
|
|
663
|
-
setValue:
|
|
664
|
-
setOpen:
|
|
664
|
+
setValue: h,
|
|
665
|
+
setOpen: d
|
|
665
666
|
};
|
|
666
667
|
}
|
|
667
|
-
const
|
|
668
|
+
const vt = Object.freeze([
|
|
668
669
|
Object.freeze({ value: "low", label: "Low" }),
|
|
669
670
|
Object.freeze({ value: "medium", label: "Medium" }),
|
|
670
671
|
Object.freeze({ value: "high", label: "High" })
|
|
671
672
|
]);
|
|
672
|
-
function
|
|
673
|
+
function mt(e) {
|
|
673
674
|
if (!e)
|
|
674
675
|
return [];
|
|
675
676
|
if (e === !0)
|
|
676
|
-
return
|
|
677
|
-
const a = /* @__PURE__ */ new Set(),
|
|
678
|
-
for (const
|
|
679
|
-
a.has(
|
|
680
|
-
return
|
|
677
|
+
return vt;
|
|
678
|
+
const a = /* @__PURE__ */ new Set(), n = [];
|
|
679
|
+
for (const l of e)
|
|
680
|
+
a.has(l.value) || (a.add(l.value), n.push(l));
|
|
681
|
+
return n;
|
|
681
682
|
}
|
|
682
|
-
function
|
|
683
|
+
function gt(e) {
|
|
683
684
|
if (!e || e === !0)
|
|
684
685
|
return [];
|
|
685
|
-
const a = /* @__PURE__ */ new Set(),
|
|
686
|
-
for (const
|
|
687
|
-
a.has(
|
|
688
|
-
return Array.from(
|
|
686
|
+
const a = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
|
|
687
|
+
for (const l of e)
|
|
688
|
+
a.has(l.value) ? n.add(l.value) : a.add(l.value);
|
|
689
|
+
return Array.from(n);
|
|
689
690
|
}
|
|
690
|
-
const
|
|
691
|
-
function
|
|
691
|
+
const pt = "__tr-model-selector-ungrouped__";
|
|
692
|
+
function ne(e) {
|
|
692
693
|
return (e == null ? void 0 : e.trim()) ?? "";
|
|
693
694
|
}
|
|
694
|
-
function
|
|
695
|
+
function yt(e) {
|
|
695
696
|
return e.filter((a) => !!(a && a.trim())).join(" ").toLocaleLowerCase();
|
|
696
697
|
}
|
|
697
|
-
function
|
|
698
|
-
const a = /* @__PURE__ */ new Set(),
|
|
699
|
-
return e.forEach((
|
|
700
|
-
if (a.has(
|
|
698
|
+
function bt(e) {
|
|
699
|
+
const a = /* @__PURE__ */ new Set(), n = [];
|
|
700
|
+
return e.forEach((l, s) => {
|
|
701
|
+
if (a.has(l.value))
|
|
701
702
|
return;
|
|
702
|
-
a.add(
|
|
703
|
-
const
|
|
704
|
-
|
|
705
|
-
key: `value:${
|
|
706
|
-
index:
|
|
707
|
-
value:
|
|
708
|
-
label:
|
|
703
|
+
a.add(l.value);
|
|
704
|
+
const f = ne(l.label) || l.value, c = ne(l.description) || void 0, h = ne(l.group), d = h ? `group:${h}` : pt, i = typeof l.icon == "string" ? l.icon : l.icon ? ke(l.icon) : void 0;
|
|
705
|
+
n.push({
|
|
706
|
+
key: `value:${l.value}`,
|
|
707
|
+
index: s,
|
|
708
|
+
value: l.value,
|
|
709
|
+
label: f,
|
|
709
710
|
description: c,
|
|
710
711
|
icon: i,
|
|
711
|
-
disabled: !!
|
|
712
|
-
groupKey:
|
|
713
|
-
searchText:
|
|
714
|
-
raw:
|
|
712
|
+
disabled: !!l.disabled,
|
|
713
|
+
groupKey: d,
|
|
714
|
+
searchText: yt([f, l.value, c, h]),
|
|
715
|
+
raw: l
|
|
715
716
|
});
|
|
716
|
-
}),
|
|
717
|
+
}), n;
|
|
717
718
|
}
|
|
718
|
-
function
|
|
719
|
-
const a = /* @__PURE__ */ new Set(),
|
|
720
|
-
return e.forEach((
|
|
721
|
-
a.has(
|
|
722
|
-
}), [...
|
|
719
|
+
function wt(e) {
|
|
720
|
+
const a = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
|
|
721
|
+
return e.forEach((l) => {
|
|
722
|
+
a.has(l.value) ? n.add(l.value) : a.add(l.value);
|
|
723
|
+
}), [...n];
|
|
723
724
|
}
|
|
724
|
-
const
|
|
725
|
+
const kt = { class: "tr-model-selector__dropdown-surface" }, le = /* @__PURE__ */ J({
|
|
725
726
|
name: "TrModelSelector",
|
|
726
727
|
__name: "index",
|
|
727
728
|
props: {
|
|
@@ -743,261 +744,266 @@ const wt = { class: "tr-model-selector__dropdown-surface" }, le = /* @__PURE__ *
|
|
|
743
744
|
size: { default: "normal" },
|
|
744
745
|
placement: { default: "bottom-start" },
|
|
745
746
|
offset: { default: 8 },
|
|
746
|
-
appendTo: {},
|
|
747
|
+
appendTo: { default: "body" },
|
|
747
748
|
panelClass: {},
|
|
748
749
|
reasoningEffortLabel: { default: "Thinking" }
|
|
749
750
|
},
|
|
750
751
|
emits: ["update:modelValue", "change", "update:reasoningEffort", "reasoning-effort-change", "update:open"],
|
|
751
752
|
setup(e, { emit: a }) {
|
|
752
|
-
const
|
|
753
|
+
const n = e, l = a, s = $e(), f = (s == null ? void 0 : s.uid) ?? 0, c = (s == null ? void 0 : s.vnode.props) ?? {}, h = (...o) => o.some((v) => Object.prototype.hasOwnProperty.call(c, v)), d = `tr-model-selector-${f}`, i = `${d}-listbox`, r = V(null), u = V(null), m = V(!1), y = V(null), x = ze(r), k = g(() => {
|
|
753
754
|
var C, L;
|
|
754
|
-
if (!
|
|
755
|
+
if (!m.value)
|
|
755
756
|
return null;
|
|
756
|
-
const
|
|
757
|
-
if (!
|
|
758
|
-
return
|
|
759
|
-
if (typeof
|
|
760
|
-
return
|
|
761
|
-
if (
|
|
762
|
-
return
|
|
763
|
-
const
|
|
757
|
+
const o = x.value, v = n.appendTo;
|
|
758
|
+
if (!v)
|
|
759
|
+
return o;
|
|
760
|
+
if (typeof v != "string")
|
|
761
|
+
return v;
|
|
762
|
+
if (v === "body" && o === ((C = r.value) == null ? void 0 : C.ownerDocument.body))
|
|
763
|
+
return o;
|
|
764
|
+
const w = o;
|
|
764
765
|
try {
|
|
765
|
-
return ((L =
|
|
766
|
+
return ((L = w.querySelector) == null ? void 0 : L.call(w, v)) ?? o;
|
|
766
767
|
} catch {
|
|
767
|
-
return
|
|
768
|
+
return o;
|
|
768
769
|
}
|
|
769
|
-
}),
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
770
|
+
}), $ = g(() => {
|
|
771
|
+
var w;
|
|
772
|
+
const o = k.value, v = (w = r.value) == null ? void 0 : w.ownerDocument;
|
|
773
|
+
return !!(v && o && o !== v.body && o.nodeType === 1);
|
|
774
|
+
}), E = ht({
|
|
775
|
+
value: () => n.modelValue,
|
|
776
|
+
defaultValue: n.defaultValue,
|
|
777
|
+
valueControlled: h("modelValue", "model-value"),
|
|
778
|
+
open: () => n.open,
|
|
779
|
+
defaultOpen: n.disabled ? !1 : n.defaultOpen,
|
|
780
|
+
openControlled: h("open"),
|
|
781
|
+
onUpdateValue: (o) => l("update:modelValue", o),
|
|
782
|
+
onUpdateOpen: (o) => l("update:open", o)
|
|
783
|
+
}), R = g(() => bt(n.models));
|
|
784
|
+
g(() => wt(n.models));
|
|
785
|
+
const T = g(() => R.value.find((o) => o.value === E.value.value) ?? null), O = g(() => {
|
|
786
|
+
var o;
|
|
787
|
+
return mt((o = T.value) == null ? void 0 : o.raw.reasoningEfforts);
|
|
783
788
|
});
|
|
784
789
|
g(() => {
|
|
785
|
-
var
|
|
786
|
-
return
|
|
790
|
+
var o;
|
|
791
|
+
return gt((o = T.value) == null ? void 0 : o.raw.reasoningEfforts);
|
|
787
792
|
});
|
|
788
|
-
const K =
|
|
789
|
-
value: () =>
|
|
790
|
-
defaultValue:
|
|
791
|
-
efforts: () =>
|
|
792
|
-
controlled:
|
|
793
|
-
onUpdateValue: (
|
|
794
|
-
}),
|
|
795
|
-
var
|
|
796
|
-
return ((
|
|
797
|
-
}),
|
|
798
|
-
var
|
|
799
|
-
return ((
|
|
800
|
-
}),
|
|
801
|
-
var
|
|
793
|
+
const K = dt({
|
|
794
|
+
value: () => n.reasoningEffort,
|
|
795
|
+
defaultValue: n.defaultReasoningEffort,
|
|
796
|
+
efforts: () => O.value,
|
|
797
|
+
controlled: h("reasoningEffort", "reasoning-effort"),
|
|
798
|
+
onUpdateValue: (o) => l("update:reasoningEffort", o)
|
|
799
|
+
}), Q = g(() => {
|
|
800
|
+
var o;
|
|
801
|
+
return ((o = K.activeOption.value) == null ? void 0 : o.value) ?? null;
|
|
802
|
+
}), t = g(() => E.open.value && !n.disabled), S = g(() => {
|
|
803
|
+
var o;
|
|
804
|
+
return ((o = T.value) == null ? void 0 : o.label) ?? n.placeholder;
|
|
805
|
+
}), M = g(() => {
|
|
806
|
+
var o;
|
|
802
807
|
return {
|
|
803
|
-
option: ((
|
|
804
|
-
label:
|
|
805
|
-
open:
|
|
808
|
+
option: ((o = T.value) == null ? void 0 : o.raw) ?? null,
|
|
809
|
+
label: S.value,
|
|
810
|
+
open: t.value,
|
|
806
811
|
reasoningEffortOption: K.activeOption.value
|
|
807
812
|
};
|
|
808
|
-
}),
|
|
809
|
-
var
|
|
813
|
+
}), B = g(() => {
|
|
814
|
+
var o;
|
|
810
815
|
return {
|
|
811
|
-
option: ((
|
|
812
|
-
close:
|
|
816
|
+
option: ((o = T.value) == null ? void 0 : o.raw) ?? null,
|
|
817
|
+
close: me
|
|
813
818
|
};
|
|
814
819
|
});
|
|
815
|
-
function
|
|
816
|
-
var
|
|
817
|
-
(
|
|
820
|
+
function q() {
|
|
821
|
+
var o, v;
|
|
822
|
+
(v = (o = r.value) == null ? void 0 : o.querySelector(".tr-model-selector__trigger")) == null || v.focus({ preventScroll: !0 });
|
|
818
823
|
}
|
|
819
|
-
function
|
|
820
|
-
var
|
|
821
|
-
let
|
|
822
|
-
for (; (
|
|
823
|
-
|
|
824
|
-
return
|
|
824
|
+
function oe() {
|
|
825
|
+
var v, w;
|
|
826
|
+
let o = ((v = r.value) == null ? void 0 : v.ownerDocument.activeElement) ?? null;
|
|
827
|
+
for (; (w = o == null ? void 0 : o.shadowRoot) != null && w.activeElement; )
|
|
828
|
+
o = o.shadowRoot.activeElement;
|
|
829
|
+
return o;
|
|
825
830
|
}
|
|
826
831
|
function G() {
|
|
827
|
-
var
|
|
828
|
-
const
|
|
829
|
-
return !!(
|
|
832
|
+
var v;
|
|
833
|
+
const o = oe();
|
|
834
|
+
return !!(o && ((v = u.value) != null && v.contains(o)));
|
|
830
835
|
}
|
|
831
836
|
function ee() {
|
|
832
|
-
|
|
837
|
+
n.disabled || E.setOpen(!0);
|
|
833
838
|
}
|
|
834
|
-
function X(
|
|
839
|
+
function X(o) {
|
|
835
840
|
var L;
|
|
836
|
-
if (!
|
|
841
|
+
if (!t.value || y.value !== null)
|
|
837
842
|
return;
|
|
838
|
-
if (y.value =
|
|
843
|
+
if (y.value = o, !E.setOpen(!1)) {
|
|
839
844
|
y.value = null;
|
|
840
845
|
return;
|
|
841
846
|
}
|
|
842
|
-
const
|
|
843
|
-
|
|
847
|
+
const w = () => {
|
|
848
|
+
t.value && y.value === o && (y.value = null);
|
|
844
849
|
}, C = (L = r.value) == null ? void 0 : L.ownerDocument.defaultView;
|
|
845
|
-
C ? C.setTimeout(
|
|
846
|
-
}
|
|
847
|
-
function ce() {
|
|
848
|
-
O.value ? X(!1) : ee();
|
|
850
|
+
C ? C.setTimeout(w, 0) : Z().then(w);
|
|
849
851
|
}
|
|
850
852
|
function de() {
|
|
853
|
+
t.value ? X(!1) : ee();
|
|
854
|
+
}
|
|
855
|
+
function fe() {
|
|
851
856
|
ee();
|
|
852
857
|
}
|
|
853
|
-
function
|
|
854
|
-
const
|
|
855
|
-
if (!
|
|
858
|
+
function he(o) {
|
|
859
|
+
const v = R.value.find((C) => C.value === o.value);
|
|
860
|
+
if (!v || v.disabled)
|
|
856
861
|
return;
|
|
857
|
-
|
|
862
|
+
E.setValue(v.value) && l("change", v.raw), n.closeOnSelect && X(!0);
|
|
858
863
|
}
|
|
859
|
-
function
|
|
864
|
+
function ve(o) {
|
|
860
865
|
var C;
|
|
861
|
-
if (
|
|
866
|
+
if (n.disabled || (C = T.value) != null && C.disabled)
|
|
862
867
|
return;
|
|
863
|
-
const
|
|
864
|
-
K.setValue(
|
|
868
|
+
const v = o === null ? null : O.value.find((L) => L.value === o) ?? null;
|
|
869
|
+
K.setValue(o) && l("reasoning-effort-change", v);
|
|
865
870
|
}
|
|
866
|
-
function
|
|
871
|
+
function me() {
|
|
867
872
|
X(!0);
|
|
868
873
|
}
|
|
869
|
-
const { isPositioned:
|
|
874
|
+
const { isPositioned: ge } = ft({
|
|
870
875
|
referenceEl: r,
|
|
871
|
-
floatingEl:
|
|
872
|
-
open: () =>
|
|
873
|
-
placement: () =>
|
|
874
|
-
|
|
875
|
-
|
|
876
|
+
floatingEl: u,
|
|
877
|
+
open: () => t.value,
|
|
878
|
+
placement: () => n.placement,
|
|
879
|
+
strategy: () => $.value ? "absolute" : "fixed",
|
|
880
|
+
offset: () => n.offset,
|
|
881
|
+
teleportTarget: () => k.value,
|
|
876
882
|
onOutsidePointerDown: () => X(!1)
|
|
877
883
|
});
|
|
878
884
|
return Y(
|
|
879
|
-
() =>
|
|
880
|
-
(
|
|
881
|
-
|
|
885
|
+
() => n.disabled,
|
|
886
|
+
(o) => {
|
|
887
|
+
o && E.open.value && (y.value = !1, E.setOpen(!1));
|
|
882
888
|
}
|
|
883
889
|
), Y(
|
|
884
|
-
|
|
885
|
-
async (
|
|
886
|
-
if (!
|
|
887
|
-
if (
|
|
888
|
-
const
|
|
889
|
-
y.value = null,
|
|
890
|
+
t,
|
|
891
|
+
async (o, v) => {
|
|
892
|
+
if (!o) {
|
|
893
|
+
if (v) {
|
|
894
|
+
const w = y.value ?? G();
|
|
895
|
+
y.value = null, w && (await Z(), q());
|
|
890
896
|
}
|
|
891
897
|
return;
|
|
892
898
|
}
|
|
893
899
|
},
|
|
894
900
|
{ immediate: !0 }
|
|
895
|
-
),
|
|
896
|
-
|
|
897
|
-
}), (
|
|
898
|
-
var
|
|
899
|
-
return p(),
|
|
900
|
-
class:
|
|
901
|
+
), ce(() => {
|
|
902
|
+
m.value = !0;
|
|
903
|
+
}), (o, v) => {
|
|
904
|
+
var w, C, L;
|
|
905
|
+
return p(), b("div", {
|
|
906
|
+
class: W(["tr-model-selector", [`tr-model-selector--${e.variant}`, `tr-model-selector--${e.size}`]])
|
|
901
907
|
}, [
|
|
902
|
-
|
|
908
|
+
I("span", {
|
|
903
909
|
ref_key: "referenceEl",
|
|
904
910
|
ref: r,
|
|
905
911
|
class: "tr-model-selector__anchor"
|
|
906
912
|
}, [
|
|
907
|
-
|
|
908
|
-
open:
|
|
913
|
+
N(ct, {
|
|
914
|
+
open: t.value,
|
|
909
915
|
disabled: e.disabled,
|
|
910
|
-
label:
|
|
911
|
-
"effort-label": (
|
|
916
|
+
label: S.value,
|
|
917
|
+
"effort-label": (w = P(K).activeOption.value) == null ? void 0 : w.label,
|
|
912
918
|
icon: (C = T.value) == null ? void 0 : C.icon,
|
|
913
919
|
"controls-id": i,
|
|
914
920
|
variant: e.variant,
|
|
915
921
|
size: e.size,
|
|
916
|
-
onClick:
|
|
917
|
-
onEnter:
|
|
922
|
+
onClick: de,
|
|
923
|
+
onEnter: fe
|
|
918
924
|
}, te({ _: 2 }, [
|
|
919
|
-
|
|
925
|
+
o.$slots.trigger ? {
|
|
920
926
|
name: "default",
|
|
921
|
-
fn:
|
|
922
|
-
|
|
927
|
+
fn: H(() => [
|
|
928
|
+
D(o.$slots, "trigger", U(j(M.value)))
|
|
923
929
|
]),
|
|
924
930
|
key: "0"
|
|
925
931
|
} : void 0
|
|
926
932
|
]), 1032, ["open", "disabled", "label", "effort-label", "icon", "variant", "size"])
|
|
927
933
|
], 512),
|
|
928
|
-
|
|
934
|
+
k.value ? (p(), _(Ee, {
|
|
929
935
|
key: 0,
|
|
930
|
-
to:
|
|
936
|
+
to: k.value
|
|
931
937
|
}, [
|
|
932
|
-
|
|
938
|
+
t.value ? (p(), b("div", {
|
|
933
939
|
key: 0,
|
|
934
940
|
ref_key: "floatingEl",
|
|
935
|
-
ref:
|
|
936
|
-
class:
|
|
941
|
+
ref: u,
|
|
942
|
+
class: W(["tr-model-selector__dropdown-wrapper", { "is-positioned": P(ge), "is-absolute": $.value }])
|
|
937
943
|
}, [
|
|
938
|
-
|
|
939
|
-
|
|
944
|
+
I("div", kt, [
|
|
945
|
+
N(nt, {
|
|
940
946
|
options: R.value,
|
|
941
|
-
"selected-value": P(
|
|
947
|
+
"selected-value": P(E).value.value,
|
|
942
948
|
searchable: e.searchable,
|
|
943
949
|
"filter-method": e.filterMethod,
|
|
944
950
|
"listbox-id": i,
|
|
945
|
-
"option-id-prefix":
|
|
951
|
+
"option-id-prefix": d,
|
|
946
952
|
placeholder: e.placeholder,
|
|
947
953
|
"search-placeholder": e.searchPlaceholder,
|
|
948
954
|
"empty-text": e.emptyText,
|
|
949
|
-
"effort-options":
|
|
950
|
-
"effort-value":
|
|
955
|
+
"effort-options": O.value,
|
|
956
|
+
"effort-value": Q.value,
|
|
951
957
|
"effort-label": e.reasoningEffortLabel,
|
|
952
958
|
"effort-disabled": !!((L = T.value) != null && L.disabled),
|
|
953
959
|
size: e.size,
|
|
954
960
|
"panel-class": e.panelClass,
|
|
955
|
-
"slot-context":
|
|
956
|
-
onSelect:
|
|
957
|
-
onSelectEffort:
|
|
961
|
+
"slot-context": B.value,
|
|
962
|
+
onSelect: he,
|
|
963
|
+
onSelectEffort: ve,
|
|
958
964
|
onClose: X
|
|
959
965
|
}, te({ _: 2 }, [
|
|
960
|
-
|
|
966
|
+
o.$slots.header ? {
|
|
961
967
|
name: "header",
|
|
962
|
-
fn:
|
|
963
|
-
|
|
968
|
+
fn: H((A) => [
|
|
969
|
+
D(o.$slots, "header", U(j(A)))
|
|
964
970
|
]),
|
|
965
971
|
key: "0"
|
|
966
972
|
} : void 0,
|
|
967
|
-
|
|
973
|
+
o.$slots.item ? {
|
|
968
974
|
name: "item",
|
|
969
|
-
fn:
|
|
970
|
-
|
|
975
|
+
fn: H((A) => [
|
|
976
|
+
D(o.$slots, "item", U(j(A)))
|
|
971
977
|
]),
|
|
972
978
|
key: "1"
|
|
973
979
|
} : void 0,
|
|
974
|
-
|
|
980
|
+
o.$slots.empty ? {
|
|
975
981
|
name: "empty",
|
|
976
|
-
fn:
|
|
977
|
-
|
|
982
|
+
fn: H((A) => [
|
|
983
|
+
D(o.$slots, "empty", U(j(A)))
|
|
978
984
|
]),
|
|
979
985
|
key: "2"
|
|
980
986
|
} : void 0,
|
|
981
|
-
|
|
987
|
+
o.$slots.footer ? {
|
|
982
988
|
name: "footer",
|
|
983
|
-
fn:
|
|
984
|
-
|
|
989
|
+
fn: H((A) => [
|
|
990
|
+
D(o.$slots, "footer", U(j(A)))
|
|
985
991
|
]),
|
|
986
992
|
key: "3"
|
|
987
993
|
} : void 0
|
|
988
994
|
]), 1032, ["options", "selected-value", "searchable", "filter-method", "placeholder", "search-placeholder", "empty-text", "effort-options", "effort-value", "effort-label", "effort-disabled", "size", "panel-class", "slot-context"])
|
|
989
995
|
])
|
|
990
|
-
], 2)) :
|
|
991
|
-
], 8, ["to"])) :
|
|
996
|
+
], 2)) : z("", !0)
|
|
997
|
+
], 8, ["to"])) : z("", !0)
|
|
992
998
|
], 2);
|
|
993
999
|
};
|
|
994
1000
|
}
|
|
995
1001
|
});
|
|
996
1002
|
le.name = "TrModelSelector";
|
|
997
|
-
const
|
|
1003
|
+
const $t = function(e) {
|
|
998
1004
|
e.component(le.name, le);
|
|
999
1005
|
};
|
|
1000
|
-
le.install =
|
|
1006
|
+
le.install = $t;
|
|
1001
1007
|
export {
|
|
1002
1008
|
le as default
|
|
1003
1009
|
};
|