@yymojo-tec/mojo-ui 0.1.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 (69) hide show
  1. package/README.md +211 -0
  2. package/dist/mojo-ui.css +1 -0
  3. package/dist/mojo-ui.js +2270 -0
  4. package/dist/mojo-ui.js.map +1 -0
  5. package/dist/mojo-ui.umd.cjs +5 -0
  6. package/dist/mojo-ui.umd.cjs.map +1 -0
  7. package/dist/types/components/button/index.d.ts +60 -0
  8. package/dist/types/components/button/index.d.ts.map +1 -0
  9. package/dist/types/components/button/src/button.d.ts +35 -0
  10. package/dist/types/components/button/src/button.d.ts.map +1 -0
  11. package/dist/types/components/card/index.d.ts +62 -0
  12. package/dist/types/components/card/index.d.ts.map +1 -0
  13. package/dist/types/components/card/src/card.d.ts +13 -0
  14. package/dist/types/components/card/src/card.d.ts.map +1 -0
  15. package/dist/types/components/col/index.d.ts +26 -0
  16. package/dist/types/components/col/index.d.ts.map +1 -0
  17. package/dist/types/components/col/src/col.d.ts +4 -0
  18. package/dist/types/components/col/src/col.d.ts.map +1 -0
  19. package/dist/types/components/form/index.d.ts +56 -0
  20. package/dist/types/components/form/index.d.ts.map +1 -0
  21. package/dist/types/components/form/src/context.d.ts +22 -0
  22. package/dist/types/components/form/src/context.d.ts.map +1 -0
  23. package/dist/types/components/form/src/form.d.ts +21 -0
  24. package/dist/types/components/form/src/form.d.ts.map +1 -0
  25. package/dist/types/components/form-item/index.d.ts +41 -0
  26. package/dist/types/components/form-item/index.d.ts.map +1 -0
  27. package/dist/types/components/form-item/src/form-item.d.ts +9 -0
  28. package/dist/types/components/form-item/src/form-item.d.ts.map +1 -0
  29. package/dist/types/components/index.d.ts +15 -0
  30. package/dist/types/components/index.d.ts.map +1 -0
  31. package/dist/types/components/input/index.d.ts +36 -0
  32. package/dist/types/components/input/index.d.ts.map +1 -0
  33. package/dist/types/components/input/src/input.d.ts +21 -0
  34. package/dist/types/components/input/src/input.d.ts.map +1 -0
  35. package/dist/types/components/menu/index.d.ts +55 -0
  36. package/dist/types/components/menu/index.d.ts.map +1 -0
  37. package/dist/types/components/menu/src/menu.d.ts +16 -0
  38. package/dist/types/components/menu/src/menu.d.ts.map +1 -0
  39. package/dist/types/components/row/index.d.ts +35 -0
  40. package/dist/types/components/row/index.d.ts.map +1 -0
  41. package/dist/types/components/row/src/row.d.ts +9 -0
  42. package/dist/types/components/row/src/row.d.ts.map +1 -0
  43. package/dist/types/components/select/index.d.ts +74 -0
  44. package/dist/types/components/select/index.d.ts.map +1 -0
  45. package/dist/types/components/select/src/select.d.ts +19 -0
  46. package/dist/types/components/select/src/select.d.ts.map +1 -0
  47. package/dist/types/components/tabs/index.d.ts +55 -0
  48. package/dist/types/components/tabs/index.d.ts.map +1 -0
  49. package/dist/types/components/tabs/src/tabs.d.ts +14 -0
  50. package/dist/types/components/tabs/src/tabs.d.ts.map +1 -0
  51. package/dist/types/components/upload/index.d.ts +231 -0
  52. package/dist/types/components/upload/index.d.ts.map +1 -0
  53. package/dist/types/components/upload/src/upload.d.ts +36 -0
  54. package/dist/types/components/upload/src/upload.d.ts.map +1 -0
  55. package/dist/types/foundation/headless.d.ts +2 -0
  56. package/dist/types/foundation/headless.d.ts.map +1 -0
  57. package/dist/types/foundation/index.d.ts +3 -0
  58. package/dist/types/foundation/index.d.ts.map +1 -0
  59. package/dist/types/foundation/tokens.d.ts +6 -0
  60. package/dist/types/foundation/tokens.d.ts.map +1 -0
  61. package/dist/types/foundation/types.d.ts +5 -0
  62. package/dist/types/foundation/types.d.ts.map +1 -0
  63. package/dist/types/index.d.ts +6 -0
  64. package/dist/types/index.d.ts.map +1 -0
  65. package/dist/types/utils/install.d.ts +6 -0
  66. package/dist/types/utils/install.d.ts.map +1 -0
  67. package/dist/types/utils/validators.d.ts +14 -0
  68. package/dist/types/utils/validators.d.ts.map +1 -0
  69. package/package.json +64 -0
@@ -0,0 +1,2270 @@
1
+ import * as tt from "vue";
2
+ import { defineComponent as F, useSlots as Qt, computed as g, openBlock as P, createElementBlock as E, normalizeStyle as Q, normalizeClass as j, renderSlot as B, createCommentVNode as D, withKeys as ce, withModifiers as q, createTextVNode as ke, createElementVNode as O, reactive as Jt, provide as pe, inject as ie, ref as M, onMounted as Z, onBeforeUnmount as st, unref as N, toDisplayString as V, Fragment as te, renderList as ve, nextTick as W, watchEffect as de, cloneVNode as Zt, h as ue, watch as Ne, toRaw as G, onUnmounted as Pe, createBlock as oe, withCtx as K, createVNode as be, withDirectives as el, vModelText as tl } from "vue";
3
+ function J(e) {
4
+ return Object.assign(e, {
5
+ install(a) {
6
+ e.name && a.component(e.name, e);
7
+ }
8
+ });
9
+ }
10
+ const ll = ["disabled"], al = {
11
+ key: 0,
12
+ class: "mo-button__spinner",
13
+ "aria-hidden": "true"
14
+ }, nl = {
15
+ key: 1,
16
+ class: "mo-button__icon",
17
+ "aria-hidden": "true"
18
+ }, ol = {
19
+ key: 2,
20
+ class: "mo-button__icon",
21
+ "aria-hidden": "true"
22
+ }, rl = {
23
+ key: 3,
24
+ class: "mo-button__content"
25
+ }, ul = {
26
+ key: 4,
27
+ class: "mo-button__icon",
28
+ "aria-hidden": "true"
29
+ }, sl = /* @__PURE__ */ F({
30
+ name: "MoButton",
31
+ __name: "button",
32
+ props: {
33
+ type: { default: "default" },
34
+ size: { default: "default" },
35
+ theme: { default: "light" },
36
+ disabled: { type: Boolean, default: !1 },
37
+ loading: { type: Boolean, default: !1 },
38
+ round: { type: Boolean, default: !1 },
39
+ icon: { type: Boolean, default: !1 },
40
+ block: { type: Boolean, default: !1 },
41
+ backgroundColor: {},
42
+ borderColor: {},
43
+ textColor: {}
44
+ },
45
+ emits: ["click"],
46
+ setup(e, { emit: a }) {
47
+ const l = e, n = a, s = Qt(), o = g(() => l.icon || !s.default && !!s.icon), t = g(() => [
48
+ "mo-button",
49
+ `mo-button--${l.type}`,
50
+ `mo-button--${l.size}`,
51
+ `mo-theme--${l.theme}`,
52
+ {
53
+ "is-block": l.block,
54
+ "is-disabled": l.disabled,
55
+ "is-icon-only": o.value,
56
+ "is-loading": l.loading,
57
+ "is-round": l.round
58
+ }
59
+ ]), i = g(() => ({
60
+ "--mo-button-custom-bg": l.backgroundColor,
61
+ "--mo-button-custom-border": l.borderColor,
62
+ "--mo-button-custom-color": l.textColor
63
+ }));
64
+ function p(v) {
65
+ l.disabled || l.loading || n("click", v);
66
+ }
67
+ return (v, c) => (P(), E("button", {
68
+ class: j(t.value),
69
+ disabled: e.disabled || e.loading,
70
+ style: Q(i.value),
71
+ type: "button",
72
+ onClick: p
73
+ }, [
74
+ e.loading ? (P(), E("span", al)) : v.$slots.icon ? (P(), E("span", nl, [
75
+ B(v.$slots, "icon")
76
+ ])) : D("", !0),
77
+ v.$slots.prefix && !o.value ? (P(), E("span", ol, [
78
+ B(v.$slots, "prefix")
79
+ ])) : D("", !0),
80
+ v.$slots.default ? (P(), E("span", rl, [
81
+ B(v.$slots, "default")
82
+ ])) : D("", !0),
83
+ v.$slots.suffix && !o.value ? (P(), E("span", ul, [
84
+ B(v.$slots, "suffix")
85
+ ])) : D("", !0)
86
+ ], 14, ll));
87
+ }
88
+ }), il = J(sl), dl = ["role", "tabindex", "aria-pressed", "onKeydown"], cl = {
89
+ key: 0,
90
+ class: "mo-card__selected-mark",
91
+ "aria-hidden": "true"
92
+ }, pl = {
93
+ key: 1,
94
+ class: "mo-card__header"
95
+ }, vl = { class: "mo-card__body" }, fl = {
96
+ key: 2,
97
+ class: "mo-card__footer"
98
+ }, ml = /* @__PURE__ */ F({
99
+ name: "MoCard",
100
+ __name: "card",
101
+ props: {
102
+ theme: { default: "light" },
103
+ shadow: { default: "hover" },
104
+ borderStyle: { default: "solid" },
105
+ hoverable: { type: Boolean, default: !0 },
106
+ animated: { type: Boolean, default: !0 },
107
+ selectable: { type: Boolean, default: !1 },
108
+ selected: { type: Boolean, default: !1 }
109
+ },
110
+ emits: ["update:selected", "select"],
111
+ setup(e, { emit: a }) {
112
+ const l = e, n = a, s = g(() => [
113
+ "mo-card",
114
+ `mo-theme--${l.theme}`,
115
+ `mo-card--shadow-${l.shadow}`,
116
+ `mo-card--border-${l.borderStyle}`,
117
+ {
118
+ "is-animated": l.animated,
119
+ "is-hoverable": l.hoverable,
120
+ "is-selectable": l.selectable,
121
+ "is-selected": l.selectable && l.selected
122
+ }
123
+ ]);
124
+ function o() {
125
+ if (!l.selectable)
126
+ return;
127
+ const t = !l.selected;
128
+ n("update:selected", t), n("select", t);
129
+ }
130
+ return (t, i) => (P(), E("section", {
131
+ class: j(s.value),
132
+ role: e.selectable ? "button" : void 0,
133
+ tabindex: e.selectable ? 0 : void 0,
134
+ "aria-pressed": e.selectable ? e.selected : void 0,
135
+ onClick: o,
136
+ onKeydown: [
137
+ ce(q(o, ["prevent"]), ["enter"]),
138
+ ce(q(o, ["prevent"]), ["space"])
139
+ ]
140
+ }, [
141
+ e.selectable && e.selected ? (P(), E("div", cl, [
142
+ B(t.$slots, "selected-icon", {}, () => [
143
+ i[0] || (i[0] = ke("♛", -1))
144
+ ])
145
+ ])) : D("", !0),
146
+ t.$slots.header ? (P(), E("div", pl, [
147
+ B(t.$slots, "header")
148
+ ])) : D("", !0),
149
+ O("div", vl, [
150
+ B(t.$slots, "default")
151
+ ]),
152
+ t.$slots.footer ? (P(), E("div", fl, [
153
+ B(t.$slots, "footer")
154
+ ])) : D("", !0)
155
+ ], 42, dl));
156
+ }
157
+ }), hl = J(ml), bl = /* @__PURE__ */ F({
158
+ name: "MoCol",
159
+ __name: "col",
160
+ props: {
161
+ span: { default: 24 }
162
+ },
163
+ setup(e) {
164
+ const a = e, l = g(() => {
165
+ const s = Number(a.span);
166
+ return Number.isFinite(s) ? Math.min(Math.max(s, 1), 24) : 24;
167
+ }), n = g(() => ({
168
+ "--mo-col-span": l.value
169
+ }));
170
+ return (s, o) => (P(), E("div", {
171
+ class: "mo-col",
172
+ style: Q(n.value)
173
+ }, [
174
+ B(s.$slots, "default")
175
+ ], 4));
176
+ }
177
+ }), gl = J(bl), it = Symbol("MoFormContext"), yl = /* @__PURE__ */ F({
178
+ name: "MoForm",
179
+ __name: "form",
180
+ props: {
181
+ model: { default: void 0 },
182
+ rules: { default: void 0 },
183
+ theme: { default: "light" },
184
+ labelPosition: { default: "right" },
185
+ labelWidth: { default: "" },
186
+ requireAsteriskPosition: { default: "left" },
187
+ labelSuffix: { default: "" },
188
+ showMessage: { type: Boolean, default: !0 }
189
+ },
190
+ setup(e, { expose: a }) {
191
+ const l = e, n = Jt([]), s = g(() => [
192
+ "mo-form",
193
+ `mo-theme--${l.theme}`,
194
+ `mo-form--label-${l.labelPosition}`
195
+ ]), o = g(() => ({
196
+ "--mo-form-label-width": typeof l.labelWidth == "number" ? `${l.labelWidth}px` : l.labelWidth || void 0
197
+ }));
198
+ function t(r) {
199
+ n.includes(r) || n.push(r);
200
+ }
201
+ function i(r) {
202
+ const u = n.indexOf(r);
203
+ u >= 0 && n.splice(u, 1);
204
+ }
205
+ async function p() {
206
+ const r = await Promise.all(n.map((h) => h.validate())), u = {};
207
+ return n.forEach((h, m) => {
208
+ !r[m] && h.prop && (u[h.prop] = "");
209
+ }), {
210
+ valid: r.every(Boolean),
211
+ errors: u
212
+ };
213
+ }
214
+ function v() {
215
+ n.forEach((r) => r.resetValidation());
216
+ }
217
+ const c = g(() => ({
218
+ model: l.model,
219
+ rules: l.rules,
220
+ theme: l.theme,
221
+ labelPosition: l.labelPosition,
222
+ labelWidth: l.labelWidth,
223
+ requireAsteriskPosition: l.requireAsteriskPosition,
224
+ labelSuffix: l.labelSuffix,
225
+ showMessage: l.showMessage,
226
+ addField: t,
227
+ removeField: i
228
+ }));
229
+ return pe(it, c.value), a({
230
+ validate: p,
231
+ resetFields: v
232
+ }), (r, u) => (P(), E("form", {
233
+ class: j(s.value),
234
+ style: Q(o.value)
235
+ }, [
236
+ B(r.$slots, "default")
237
+ ], 6));
238
+ }
239
+ }), xl = J(yl);
240
+ function Oe(e) {
241
+ return e == null ? !0 : typeof e == "string" ? e.trim().length === 0 : Array.isArray(e) ? e.length === 0 : !1;
242
+ }
243
+ function bn(e) {
244
+ return !Oe(e);
245
+ }
246
+ function wl(e) {
247
+ return Oe(e) ? !0 : /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(e));
248
+ }
249
+ function Sl(e) {
250
+ return Oe(e) ? !0 : /^1[3-9]\d{9}$/.test(String(e));
251
+ }
252
+ function gn(e = "该项为必填项") {
253
+ return {
254
+ required: !0,
255
+ message: e
256
+ };
257
+ }
258
+ function yn(e = "请输入正确的邮箱地址") {
259
+ return {
260
+ message: e,
261
+ validator: (a) => wl(a) || e
262
+ };
263
+ }
264
+ function xn(e = "请输入正确的手机号") {
265
+ return {
266
+ message: e,
267
+ validator: (a) => Sl(a) || e
268
+ };
269
+ }
270
+ const $l = {
271
+ key: 0,
272
+ class: "mo-form-item__label"
273
+ }, _l = {
274
+ key: 0,
275
+ class: "mo-form-item__asterisk"
276
+ }, Il = {
277
+ key: 1,
278
+ class: "mo-form-item__suffix"
279
+ }, kl = {
280
+ key: 2,
281
+ class: "mo-form-item__asterisk"
282
+ }, Pl = { class: "mo-form-item__content" }, Ol = {
283
+ key: 0,
284
+ class: "mo-form-item__help"
285
+ }, Ml = {
286
+ key: 1,
287
+ class: "mo-form-item__error"
288
+ }, Rl = /* @__PURE__ */ F({
289
+ name: "MoFormItem",
290
+ __name: "form-item",
291
+ props: {
292
+ label: { default: "" },
293
+ prop: { default: "" },
294
+ required: { type: Boolean, default: !1 },
295
+ rules: { default: void 0 },
296
+ help: { default: "" }
297
+ },
298
+ setup(e) {
299
+ const a = e, l = ie(it), n = M(""), s = g(() => {
300
+ var r;
301
+ return a.prop ? (r = l == null ? void 0 : l.model) == null ? void 0 : r[a.prop] : void 0;
302
+ }), o = g(() => {
303
+ var h;
304
+ const r = a.prop ? (h = l == null ? void 0 : l.rules) == null ? void 0 : h[a.prop] : void 0, u = [a.rules, r].flat().filter(Boolean);
305
+ return a.required && !u.some((m) => m.required) && u.unshift({ required: !0, message: "该项为必填项" }), u;
306
+ }), t = g(
307
+ () => a.required || o.value.some((r) => r.required)
308
+ ), i = g(() => [
309
+ "mo-form-item",
310
+ {
311
+ "is-error": !!n.value,
312
+ "is-required": t.value
313
+ }
314
+ ]);
315
+ async function p() {
316
+ n.value = "";
317
+ for (const r of o.value) {
318
+ if (r.required && Oe(s.value))
319
+ return n.value = r.message || "该项为必填项", !1;
320
+ if (r.validator) {
321
+ const u = await r.validator(s.value);
322
+ if (u !== !0)
323
+ return n.value = typeof u == "string" ? u : r.message || "校验失败", !1;
324
+ }
325
+ }
326
+ return !0;
327
+ }
328
+ function v() {
329
+ n.value = "";
330
+ }
331
+ const c = {
332
+ prop: a.prop,
333
+ validate: p,
334
+ resetValidation: v
335
+ };
336
+ return Z(() => {
337
+ l == null || l.addField(c);
338
+ }), st(() => {
339
+ l == null || l.removeField(c);
340
+ }), (r, u) => {
341
+ var h, m, f, y;
342
+ return P(), E("div", {
343
+ class: j(i.value)
344
+ }, [
345
+ e.label ? (P(), E("label", $l, [
346
+ t.value && ((h = N(l)) == null ? void 0 : h.requireAsteriskPosition) === "left" ? (P(), E("span", _l, " * ")) : D("", !0),
347
+ O("span", null, V(e.label), 1),
348
+ (m = N(l)) != null && m.labelSuffix ? (P(), E("span", Il, V(N(l).labelSuffix), 1)) : D("", !0),
349
+ t.value && ((f = N(l)) == null ? void 0 : f.requireAsteriskPosition) === "right" ? (P(), E("span", kl, " * ")) : D("", !0)
350
+ ])) : D("", !0),
351
+ O("div", Pl, [
352
+ B(r.$slots, "default", {
353
+ error: n.value,
354
+ validate: p
355
+ }),
356
+ e.help && !n.value ? (P(), E("div", Ol, V(e.help), 1)) : D("", !0),
357
+ (y = N(l)) != null && y.showMessage && n.value ? (P(), E("div", Ml, V(n.value), 1)) : D("", !0)
358
+ ])
359
+ ], 2);
360
+ };
361
+ }
362
+ }), Tl = J(Rl), El = ["disabled", "maxlength", "placeholder", "readonly", "rows", "value"], Cl = {
363
+ key: 1,
364
+ class: "mo-input__tag-wrapper"
365
+ }, Fl = { class: "mo-input__tag-text" }, Ll = ["aria-label", "onClick"], Dl = ["disabled", "maxlength", "placeholder", "readonly", "value"], Al = ["disabled", "maxlength", "placeholder", "readonly", "value"], Bl = {
366
+ key: 4,
367
+ class: "mo-input__count"
368
+ }, Nl = /* @__PURE__ */ F({
369
+ name: "MoInput",
370
+ __name: "input",
371
+ props: {
372
+ modelValue: { default: "" },
373
+ tags: { default: () => [] },
374
+ type: { default: "text" },
375
+ size: { default: "default" },
376
+ theme: { default: "light" },
377
+ placeholder: { default: "" },
378
+ maxlength: { default: void 0 },
379
+ showWordLimit: { type: Boolean, default: !1 },
380
+ rows: { default: 3 },
381
+ disabled: { type: Boolean, default: !1 },
382
+ readonly: { type: Boolean, default: !1 },
383
+ clearable: { type: Boolean, default: !1 },
384
+ taggable: { type: Boolean, default: !1 },
385
+ allowDuplicateTags: { type: Boolean, default: !1 },
386
+ resize: { default: "vertical" }
387
+ },
388
+ emits: ["update:modelValue", "update:tags", "input", "change", "clear", "tagAdd", "tagRemove"],
389
+ setup(e, { emit: a }) {
390
+ const l = e, n = a, s = g(() => String(l.modelValue ?? "")), o = g(() => l.type === "textarea"), t = g(() => l.taggable && !o.value), i = g(() => l.showWordLimit && l.maxlength !== void 0), p = g(() => [
391
+ "mo-input",
392
+ `mo-input--${l.size}`,
393
+ `mo-theme--${l.theme}`,
394
+ {
395
+ "is-disabled": l.disabled,
396
+ "is-taggable": t.value,
397
+ "is-textarea": o.value
398
+ }
399
+ ]), v = g(() => ({
400
+ "--mo-input-rows": l.rows
401
+ }));
402
+ function c(f) {
403
+ const y = f.target.value;
404
+ n("update:modelValue", y), n("input", y);
405
+ }
406
+ function r(f) {
407
+ n("change", f.target.value);
408
+ }
409
+ function u() {
410
+ n("update:modelValue", ""), n("input", ""), n("clear");
411
+ }
412
+ function h(f) {
413
+ if (!t.value || l.disabled || l.readonly)
414
+ return;
415
+ const y = s.value.trim();
416
+ if (y) {
417
+ if (f.preventDefault(), !l.allowDuplicateTags && l.tags.includes(y)) {
418
+ n("update:modelValue", ""), n("input", "");
419
+ return;
420
+ }
421
+ n("update:tags", [...l.tags, y]), n("update:modelValue", ""), n("input", ""), n("tagAdd", y);
422
+ }
423
+ }
424
+ function m(f, y) {
425
+ const $ = l.tags.filter((w, b) => b !== y);
426
+ n("update:tags", $), n("tagRemove", f, y);
427
+ }
428
+ return (f, y) => (P(), E("div", {
429
+ class: j(p.value),
430
+ style: Q(v.value)
431
+ }, [
432
+ o.value ? (P(), E("textarea", {
433
+ key: 0,
434
+ class: "mo-input__inner",
435
+ disabled: e.disabled,
436
+ maxlength: e.maxlength,
437
+ placeholder: e.placeholder,
438
+ readonly: e.readonly,
439
+ rows: Number(e.rows),
440
+ style: Q({ resize: e.resize }),
441
+ value: s.value,
442
+ onChange: r,
443
+ onInput: c
444
+ }, null, 44, El)) : t.value ? (P(), E("div", Cl, [
445
+ (P(!0), E(te, null, ve(e.tags, ($, w) => (P(), E("span", {
446
+ key: `${$}-${w}`,
447
+ class: "mo-input__tag"
448
+ }, [
449
+ O("span", Fl, V($), 1),
450
+ O("button", {
451
+ class: "mo-input__tag-close",
452
+ type: "button",
453
+ "aria-label": `Remove ${$}`,
454
+ onClick: (b) => m($, w)
455
+ }, " × ", 8, Ll)
456
+ ]))), 128)),
457
+ O("input", {
458
+ class: "mo-input__tag-input",
459
+ disabled: e.disabled,
460
+ maxlength: e.maxlength,
461
+ placeholder: e.placeholder,
462
+ readonly: e.readonly,
463
+ value: s.value,
464
+ type: "text",
465
+ onChange: r,
466
+ onInput: c,
467
+ onKeydown: ce(h, ["enter"])
468
+ }, null, 40, Dl)
469
+ ])) : (P(), E("input", {
470
+ key: 2,
471
+ class: "mo-input__inner",
472
+ disabled: e.disabled,
473
+ maxlength: e.maxlength,
474
+ placeholder: e.placeholder,
475
+ readonly: e.readonly,
476
+ value: s.value,
477
+ type: "text",
478
+ onChange: r,
479
+ onInput: c,
480
+ onKeydown: ce(h, ["enter"])
481
+ }, null, 40, Al)),
482
+ e.clearable && s.value && !e.disabled && !e.readonly && !o.value && !t.value ? (P(), E("button", {
483
+ key: 3,
484
+ class: "mo-input__clear",
485
+ type: "button",
486
+ "aria-label": "Clear",
487
+ onClick: u
488
+ }, " × ")) : D("", !0),
489
+ i.value ? (P(), E("span", Bl, V(s.value.length) + " / " + V(e.maxlength), 1)) : D("", !0)
490
+ ], 6));
491
+ }
492
+ }), jl = J(Nl);
493
+ function Vl(e, a, l) {
494
+ let n = M(l == null ? void 0 : l.value), s = g(() => e.value !== void 0);
495
+ return [g(() => s.value ? e.value : n.value), function(o) {
496
+ return s.value || (n.value = o), a == null ? void 0 : a(o);
497
+ }];
498
+ }
499
+ function zl(e) {
500
+ typeof queueMicrotask == "function" ? queueMicrotask(e) : Promise.resolve().then(e).catch((a) => setTimeout(() => {
501
+ throw a;
502
+ }));
503
+ }
504
+ var lt;
505
+ let Ul = Symbol("headlessui.useid"), Wl = 0;
506
+ const ae = (lt = tt.useId) != null ? lt : function() {
507
+ return tt.inject(Ul, () => `${++Wl}`)();
508
+ };
509
+ function k(e) {
510
+ var a;
511
+ if (e == null || e.value == null) return null;
512
+ let l = (a = e.value.$el) != null ? a : e.value;
513
+ return l instanceof Node ? l : null;
514
+ }
515
+ function z(e, a, ...l) {
516
+ if (e in a) {
517
+ let s = a[e];
518
+ return typeof s == "function" ? s(...l) : s;
519
+ }
520
+ let n = new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(a).map((s) => `"${s}"`).join(", ")}.`);
521
+ throw Error.captureStackTrace && Error.captureStackTrace(n, z), n;
522
+ }
523
+ var ql = Object.defineProperty, Hl = (e, a, l) => a in e ? ql(e, a, { enumerable: !0, configurable: !0, writable: !0, value: l }) : e[a] = l, at = (e, a, l) => (Hl(e, typeof a != "symbol" ? a + "" : a, l), l);
524
+ let Kl = class {
525
+ constructor() {
526
+ at(this, "current", this.detect()), at(this, "currentId", 0);
527
+ }
528
+ set(a) {
529
+ this.current !== a && (this.currentId = 0, this.current = a);
530
+ }
531
+ reset() {
532
+ this.set(this.detect());
533
+ }
534
+ nextId() {
535
+ return ++this.currentId;
536
+ }
537
+ get isServer() {
538
+ return this.current === "server";
539
+ }
540
+ get isClient() {
541
+ return this.current === "client";
542
+ }
543
+ detect() {
544
+ return typeof window > "u" || typeof document > "u" ? "server" : "client";
545
+ }
546
+ }, je = new Kl();
547
+ function Me(e) {
548
+ if (je.isServer) return null;
549
+ if (e instanceof Node) return e.ownerDocument;
550
+ if (e != null && e.hasOwnProperty("value")) {
551
+ let a = k(e);
552
+ if (a) return a.ownerDocument;
553
+ }
554
+ return document;
555
+ }
556
+ let Be = ["[contentEditable=true]", "[tabindex]", "a[href]", "area[href]", "button:not([disabled])", "iframe", "input:not([disabled])", "select:not([disabled])", "textarea:not([disabled])"].map((e) => `${e}:not([tabindex='-1'])`).join(",");
557
+ var H = ((e) => (e[e.First = 1] = "First", e[e.Previous = 2] = "Previous", e[e.Next = 4] = "Next", e[e.Last = 8] = "Last", e[e.WrapAround = 16] = "WrapAround", e[e.NoScroll = 32] = "NoScroll", e))(H || {}), he = ((e) => (e[e.Error = 0] = "Error", e[e.Overflow = 1] = "Overflow", e[e.Success = 2] = "Success", e[e.Underflow = 3] = "Underflow", e))(he || {}), Xl = ((e) => (e[e.Previous = -1] = "Previous", e[e.Next = 1] = "Next", e))(Xl || {});
558
+ function dt(e = document.body) {
559
+ return e == null ? [] : Array.from(e.querySelectorAll(Be)).sort((a, l) => Math.sign((a.tabIndex || Number.MAX_SAFE_INTEGER) - (l.tabIndex || Number.MAX_SAFE_INTEGER)));
560
+ }
561
+ var Re = ((e) => (e[e.Strict = 0] = "Strict", e[e.Loose = 1] = "Loose", e))(Re || {});
562
+ function Te(e, a = 0) {
563
+ var l;
564
+ return e === ((l = Me(e)) == null ? void 0 : l.body) ? !1 : z(a, { 0() {
565
+ return e.matches(Be);
566
+ }, 1() {
567
+ let n = e;
568
+ for (; n !== null; ) {
569
+ if (n.matches(Be)) return !0;
570
+ n = n.parentElement;
571
+ }
572
+ return !1;
573
+ } });
574
+ }
575
+ function ct(e) {
576
+ let a = Me(e);
577
+ W(() => {
578
+ a && !Te(a.activeElement, 0) && Gl(e);
579
+ });
580
+ }
581
+ var Yl = ((e) => (e[e.Keyboard = 0] = "Keyboard", e[e.Mouse = 1] = "Mouse", e))(Yl || {});
582
+ typeof window < "u" && typeof document < "u" && (document.addEventListener("keydown", (e) => {
583
+ e.metaKey || e.altKey || e.ctrlKey || (document.documentElement.dataset.headlessuiFocusVisible = "");
584
+ }, !0), document.addEventListener("click", (e) => {
585
+ e.detail === 1 ? delete document.documentElement.dataset.headlessuiFocusVisible : e.detail === 0 && (document.documentElement.dataset.headlessuiFocusVisible = "");
586
+ }, !0));
587
+ function Gl(e) {
588
+ e == null || e.focus({ preventScroll: !0 });
589
+ }
590
+ let Ql = ["textarea", "input"].join(",");
591
+ function Jl(e) {
592
+ var a, l;
593
+ return (l = (a = e == null ? void 0 : e.matches) == null ? void 0 : a.call(e, Ql)) != null ? l : !1;
594
+ }
595
+ function ne(e, a = (l) => l) {
596
+ return e.slice().sort((l, n) => {
597
+ let s = a(l), o = a(n);
598
+ if (s === null || o === null) return 0;
599
+ let t = s.compareDocumentPosition(o);
600
+ return t & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : t & Node.DOCUMENT_POSITION_PRECEDING ? 1 : 0;
601
+ });
602
+ }
603
+ function Zl(e, a) {
604
+ return re(dt(), a, { relativeTo: e });
605
+ }
606
+ function re(e, a, { sorted: l = !0, relativeTo: n = null, skipElements: s = [] } = {}) {
607
+ var o;
608
+ let t = (o = Array.isArray(e) ? e.length > 0 ? e[0].ownerDocument : document : e == null ? void 0 : e.ownerDocument) != null ? o : document, i = Array.isArray(e) ? l ? ne(e) : e : dt(e);
609
+ s.length > 0 && i.length > 1 && (i = i.filter((m) => !s.includes(m))), n = n ?? t.activeElement;
610
+ let p = (() => {
611
+ if (a & 5) return 1;
612
+ if (a & 10) return -1;
613
+ throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last");
614
+ })(), v = (() => {
615
+ if (a & 1) return 0;
616
+ if (a & 2) return Math.max(0, i.indexOf(n)) - 1;
617
+ if (a & 4) return Math.max(0, i.indexOf(n)) + 1;
618
+ if (a & 8) return i.length - 1;
619
+ throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last");
620
+ })(), c = a & 32 ? { preventScroll: !0 } : {}, r = 0, u = i.length, h;
621
+ do {
622
+ if (r >= u || r + u <= 0) return 0;
623
+ let m = v + r;
624
+ if (a & 16) m = (m + u) % u;
625
+ else {
626
+ if (m < 0) return 3;
627
+ if (m >= u) return 1;
628
+ }
629
+ h = i[m], h == null || h.focus(c), r += p;
630
+ } while (h !== t.activeElement);
631
+ return a & 6 && Jl(h) && h.select(), 2;
632
+ }
633
+ function ea() {
634
+ return /iPhone/gi.test(window.navigator.platform) || /Mac/gi.test(window.navigator.platform) && window.navigator.maxTouchPoints > 0;
635
+ }
636
+ function ta() {
637
+ return /Android/gi.test(window.navigator.userAgent);
638
+ }
639
+ function la() {
640
+ return ea() || ta();
641
+ }
642
+ function Ie(e, a, l) {
643
+ je.isServer || de((n) => {
644
+ document.addEventListener(e, a, l), n(() => document.removeEventListener(e, a, l));
645
+ });
646
+ }
647
+ function aa(e, a, l) {
648
+ je.isServer || de((n) => {
649
+ window.addEventListener(e, a, l), n(() => window.removeEventListener(e, a, l));
650
+ });
651
+ }
652
+ function pt(e, a, l = g(() => !0)) {
653
+ function n(o, t) {
654
+ if (!l.value || o.defaultPrevented) return;
655
+ let i = t(o);
656
+ if (i === null || !i.getRootNode().contains(i)) return;
657
+ let p = (function v(c) {
658
+ return typeof c == "function" ? v(c()) : Array.isArray(c) || c instanceof Set ? c : [c];
659
+ })(e);
660
+ for (let v of p) {
661
+ if (v === null) continue;
662
+ let c = v instanceof HTMLElement ? v : k(v);
663
+ if (c != null && c.contains(i) || o.composed && o.composedPath().includes(c)) return;
664
+ }
665
+ return !Te(i, Re.Loose) && i.tabIndex !== -1 && o.preventDefault(), a(o, i);
666
+ }
667
+ let s = M(null);
668
+ Ie("pointerdown", (o) => {
669
+ var t, i;
670
+ l.value && (s.value = ((i = (t = o.composedPath) == null ? void 0 : t.call(o)) == null ? void 0 : i[0]) || o.target);
671
+ }, !0), Ie("mousedown", (o) => {
672
+ var t, i;
673
+ l.value && (s.value = ((i = (t = o.composedPath) == null ? void 0 : t.call(o)) == null ? void 0 : i[0]) || o.target);
674
+ }, !0), Ie("click", (o) => {
675
+ la() || s.value && (n(o, () => s.value), s.value = null);
676
+ }, !0), Ie("touchend", (o) => n(o, () => o.target instanceof HTMLElement ? o.target : null), !0), aa("blur", (o) => n(o, () => window.document.activeElement instanceof HTMLIFrameElement ? window.document.activeElement : null), !0);
677
+ }
678
+ function nt(e, a) {
679
+ if (e) return e;
680
+ let l = a ?? "button";
681
+ if (typeof l == "string" && l.toLowerCase() === "button") return "button";
682
+ }
683
+ function Ve(e, a) {
684
+ let l = M(nt(e.value.type, e.value.as));
685
+ return Z(() => {
686
+ l.value = nt(e.value.type, e.value.as);
687
+ }), de(() => {
688
+ var n;
689
+ l.value || k(a) && k(a) instanceof HTMLButtonElement && !((n = k(a)) != null && n.hasAttribute("type")) && (l.value = "button");
690
+ }), l;
691
+ }
692
+ function ot(e) {
693
+ return [e.screenX, e.screenY];
694
+ }
695
+ function vt() {
696
+ let e = M([-1, -1]);
697
+ return { wasMoved(a) {
698
+ let l = ot(a);
699
+ return e.value[0] === l[0] && e.value[1] === l[1] ? !1 : (e.value = l, !0);
700
+ }, update(a) {
701
+ e.value = ot(a);
702
+ } };
703
+ }
704
+ function na({ container: e, accept: a, walk: l, enabled: n }) {
705
+ de(() => {
706
+ let s = e.value;
707
+ if (!s || n !== void 0 && !n.value) return;
708
+ let o = Me(e);
709
+ if (!o) return;
710
+ let t = Object.assign((p) => a(p), { acceptNode: a }), i = o.createTreeWalker(s, NodeFilter.SHOW_ELEMENT, t, !1);
711
+ for (; i.nextNode(); ) l(i.currentNode);
712
+ });
713
+ }
714
+ var se = ((e) => (e[e.None = 0] = "None", e[e.RenderStrategy = 1] = "RenderStrategy", e[e.Static = 2] = "Static", e))(se || {}), oa = ((e) => (e[e.Unmount = 0] = "Unmount", e[e.Hidden = 1] = "Hidden", e))(oa || {});
715
+ function U({ visible: e = !0, features: a = 0, ourProps: l, theirProps: n, ...s }) {
716
+ var o;
717
+ let t = mt(n, l), i = Object.assign(s, { props: t });
718
+ if (e || a & 2 && t.static) return Ae(i);
719
+ if (a & 1) {
720
+ let p = (o = t.unmount) == null || o ? 0 : 1;
721
+ return z(p, { 0() {
722
+ return null;
723
+ }, 1() {
724
+ return Ae({ ...s, props: { ...t, hidden: !0, style: { display: "none" } } });
725
+ } });
726
+ }
727
+ return Ae(i);
728
+ }
729
+ function Ae({ props: e, attrs: a, slots: l, slot: n, name: s }) {
730
+ var o, t;
731
+ let { as: i, ...p } = ze(e, ["unmount", "static"]), v = (o = l.default) == null ? void 0 : o.call(l, n), c = {};
732
+ if (n) {
733
+ let r = !1, u = [];
734
+ for (let [h, m] of Object.entries(n)) typeof m == "boolean" && (r = !0), m === !0 && u.push(h);
735
+ r && (c["data-headlessui-state"] = u.join(" "));
736
+ }
737
+ if (i === "template") {
738
+ if (v = ft(v ?? []), Object.keys(p).length > 0 || Object.keys(a).length > 0) {
739
+ let [r, ...u] = v ?? [];
740
+ if (!ua(r) || u.length > 0) throw new Error(['Passing props on "template"!', "", `The current component <${s} /> is rendering a "template".`, "However we need to passthrough the following props:", Object.keys(p).concat(Object.keys(a)).map((f) => f.trim()).filter((f, y, $) => $.indexOf(f) === y).sort((f, y) => f.localeCompare(y)).map((f) => ` - ${f}`).join(`
741
+ `), "", "You can apply a few solutions:", ['Add an `as="..."` prop, to ensure that we render an actual element instead of a "template".', "Render a single element as the child so that we can forward the props onto that element."].map((f) => ` - ${f}`).join(`
742
+ `)].join(`
743
+ `));
744
+ let h = mt((t = r.props) != null ? t : {}, p, c), m = Zt(r, h, !0);
745
+ for (let f in h) f.startsWith("on") && (m.props || (m.props = {}), m.props[f] = h[f]);
746
+ return m;
747
+ }
748
+ return Array.isArray(v) && v.length === 1 ? v[0] : v;
749
+ }
750
+ return ue(i, Object.assign({}, p, c), { default: () => v });
751
+ }
752
+ function ft(e) {
753
+ return e.flatMap((a) => a.type === te ? ft(a.children) : [a]);
754
+ }
755
+ function mt(...e) {
756
+ if (e.length === 0) return {};
757
+ if (e.length === 1) return e[0];
758
+ let a = {}, l = {};
759
+ for (let n of e) for (let s in n) s.startsWith("on") && typeof n[s] == "function" ? (l[s] != null || (l[s] = []), l[s].push(n[s])) : a[s] = n[s];
760
+ if (a.disabled || a["aria-disabled"]) return Object.assign(a, Object.fromEntries(Object.keys(l).map((n) => [n, void 0])));
761
+ for (let n in l) Object.assign(a, { [n](s, ...o) {
762
+ let t = l[n];
763
+ for (let i of t) {
764
+ if (s instanceof Event && s.defaultPrevented) return;
765
+ i(s, ...o);
766
+ }
767
+ } });
768
+ return a;
769
+ }
770
+ function ra(e) {
771
+ let a = Object.assign({}, e);
772
+ for (let l in a) a[l] === void 0 && delete a[l];
773
+ return a;
774
+ }
775
+ function ze(e, a = []) {
776
+ let l = Object.assign({}, e);
777
+ for (let n of a) n in l && delete l[n];
778
+ return l;
779
+ }
780
+ function ua(e) {
781
+ return e == null ? !1 : typeof e.type == "string" || typeof e.type == "object" || typeof e.type == "function";
782
+ }
783
+ var Ue = ((e) => (e[e.None = 1] = "None", e[e.Focusable = 2] = "Focusable", e[e.Hidden = 4] = "Hidden", e))(Ue || {});
784
+ let We = F({ name: "Hidden", props: { as: { type: [Object, String], default: "div" }, features: { type: Number, default: 1 } }, setup(e, { slots: a, attrs: l }) {
785
+ return () => {
786
+ var n;
787
+ let { features: s, ...o } = e, t = { "aria-hidden": (s & 2) === 2 ? !0 : (n = o["aria-hidden"]) != null ? n : void 0, hidden: (s & 4) === 4 ? !0 : void 0, style: { position: "fixed", top: 1, left: 1, width: 1, height: 0, padding: 0, margin: -1, overflow: "hidden", clip: "rect(0, 0, 0, 0)", whiteSpace: "nowrap", borderWidth: "0", ...(s & 4) === 4 && (s & 2) !== 2 && { display: "none" } } };
788
+ return U({ ourProps: t, theirProps: o, slot: {}, attrs: l, slots: a, name: "Hidden" });
789
+ };
790
+ } }), ht = Symbol("Context");
791
+ var le = ((e) => (e[e.Open = 1] = "Open", e[e.Closed = 2] = "Closed", e[e.Closing = 4] = "Closing", e[e.Opening = 8] = "Opening", e))(le || {});
792
+ function bt() {
793
+ return ie(ht, null);
794
+ }
795
+ function gt(e) {
796
+ pe(ht, e);
797
+ }
798
+ var R = ((e) => (e.Space = " ", e.Enter = "Enter", e.Escape = "Escape", e.Backspace = "Backspace", e.Delete = "Delete", e.ArrowLeft = "ArrowLeft", e.ArrowUp = "ArrowUp", e.ArrowRight = "ArrowRight", e.ArrowDown = "ArrowDown", e.Home = "Home", e.End = "End", e.PageUp = "PageUp", e.PageDown = "PageDown", e.Tab = "Tab", e))(R || {});
799
+ function sa(e) {
800
+ throw new Error("Unexpected object: " + e);
801
+ }
802
+ var C = ((e) => (e[e.First = 0] = "First", e[e.Previous = 1] = "Previous", e[e.Next = 2] = "Next", e[e.Last = 3] = "Last", e[e.Specific = 4] = "Specific", e[e.Nothing = 5] = "Nothing", e))(C || {});
803
+ function yt(e, a) {
804
+ let l = a.resolveItems();
805
+ if (l.length <= 0) return null;
806
+ let n = a.resolveActiveIndex(), s = n ?? -1;
807
+ switch (e.focus) {
808
+ case 0: {
809
+ for (let o = 0; o < l.length; ++o) if (!a.resolveDisabled(l[o], o, l)) return o;
810
+ return n;
811
+ }
812
+ case 1: {
813
+ s === -1 && (s = l.length);
814
+ for (let o = s - 1; o >= 0; --o) if (!a.resolveDisabled(l[o], o, l)) return o;
815
+ return n;
816
+ }
817
+ case 2: {
818
+ for (let o = s + 1; o < l.length; ++o) if (!a.resolveDisabled(l[o], o, l)) return o;
819
+ return n;
820
+ }
821
+ case 3: {
822
+ for (let o = l.length - 1; o >= 0; --o) if (!a.resolveDisabled(l[o], o, l)) return o;
823
+ return n;
824
+ }
825
+ case 4: {
826
+ for (let o = 0; o < l.length; ++o) if (a.resolveId(l[o], o, l) === e.id) return o;
827
+ return n;
828
+ }
829
+ case 5:
830
+ return null;
831
+ default:
832
+ sa(e);
833
+ }
834
+ }
835
+ function xt(e = {}, a = null, l = []) {
836
+ for (let [n, s] of Object.entries(e)) St(l, wt(a, n), s);
837
+ return l;
838
+ }
839
+ function wt(e, a) {
840
+ return e ? e + "[" + a + "]" : a;
841
+ }
842
+ function St(e, a, l) {
843
+ if (Array.isArray(l)) for (let [n, s] of l.entries()) St(e, wt(a, n.toString()), s);
844
+ else l instanceof Date ? e.push([a, l.toISOString()]) : typeof l == "boolean" ? e.push([a, l ? "1" : "0"]) : typeof l == "string" ? e.push([a, l]) : typeof l == "number" ? e.push([a, `${l}`]) : l == null ? e.push([a, ""]) : xt(l, a, e);
845
+ }
846
+ let rt = /([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;
847
+ function ut(e) {
848
+ var a, l;
849
+ let n = (a = e.innerText) != null ? a : "", s = e.cloneNode(!0);
850
+ if (!(s instanceof HTMLElement)) return n;
851
+ let o = !1;
852
+ for (let i of s.querySelectorAll('[hidden],[aria-hidden],[role="img"]')) i.remove(), o = !0;
853
+ let t = o ? (l = s.innerText) != null ? l : "" : n;
854
+ return rt.test(t) && (t = t.replace(rt, "")), t;
855
+ }
856
+ function ia(e) {
857
+ let a = e.getAttribute("aria-label");
858
+ if (typeof a == "string") return a.trim();
859
+ let l = e.getAttribute("aria-labelledby");
860
+ if (l) {
861
+ let n = l.split(" ").map((s) => {
862
+ let o = document.getElementById(s);
863
+ if (o) {
864
+ let t = o.getAttribute("aria-label");
865
+ return typeof t == "string" ? t.trim() : ut(o).trim();
866
+ }
867
+ return null;
868
+ }).filter(Boolean);
869
+ if (n.length > 0) return n.join(", ");
870
+ }
871
+ return ut(e).trim();
872
+ }
873
+ function $t(e) {
874
+ let a = M(""), l = M("");
875
+ return () => {
876
+ let n = k(e);
877
+ if (!n) return "";
878
+ let s = n.innerText;
879
+ if (a.value === s) return l.value;
880
+ let o = ia(n).trim().toLowerCase();
881
+ return a.value = s, l.value = o, o;
882
+ };
883
+ }
884
+ function da(e, a) {
885
+ return e === a;
886
+ }
887
+ var ca = ((e) => (e[e.Open = 0] = "Open", e[e.Closed = 1] = "Closed", e))(ca || {}), pa = ((e) => (e[e.Single = 0] = "Single", e[e.Multi = 1] = "Multi", e))(pa || {}), va = ((e) => (e[e.Pointer = 0] = "Pointer", e[e.Other = 1] = "Other", e))(va || {});
888
+ function fa(e) {
889
+ requestAnimationFrame(() => requestAnimationFrame(e));
890
+ }
891
+ let _t = Symbol("ListboxContext");
892
+ function ge(e) {
893
+ let a = ie(_t, null);
894
+ if (a === null) {
895
+ let l = new Error(`<${e} /> is missing a parent <Listbox /> component.`);
896
+ throw Error.captureStackTrace && Error.captureStackTrace(l, ge), l;
897
+ }
898
+ return a;
899
+ }
900
+ let ma = F({ name: "Listbox", emits: { "update:modelValue": (e) => !0 }, props: { as: { type: [Object, String], default: "template" }, disabled: { type: [Boolean], default: !1 }, by: { type: [String, Function], default: () => da }, horizontal: { type: [Boolean], default: !1 }, modelValue: { type: [Object, String, Number, Boolean], default: void 0 }, defaultValue: { type: [Object, String, Number, Boolean], default: void 0 }, form: { type: String, optional: !0 }, name: { type: String, optional: !0 }, multiple: { type: [Boolean], default: !1 } }, inheritAttrs: !1, setup(e, { slots: a, attrs: l, emit: n }) {
901
+ let s = M(1), o = M(null), t = M(null), i = M(null), p = M([]), v = M(""), c = M(null), r = M(1);
902
+ function u(b = (_) => _) {
903
+ let _ = c.value !== null ? p.value[c.value] : null, S = ne(b(p.value.slice()), (A) => k(A.dataRef.domRef)), T = _ ? S.indexOf(_) : null;
904
+ return T === -1 && (T = null), { options: S, activeOptionIndex: T };
905
+ }
906
+ let h = g(() => e.multiple ? 1 : 0), [m, f] = Vl(g(() => e.modelValue), (b) => n("update:modelValue", b), g(() => e.defaultValue)), y = g(() => m.value === void 0 ? z(h.value, { 1: [], 0: void 0 }) : m.value), $ = { listboxState: s, value: y, mode: h, compare(b, _) {
907
+ if (typeof e.by == "string") {
908
+ let S = e.by;
909
+ return (b == null ? void 0 : b[S]) === (_ == null ? void 0 : _[S]);
910
+ }
911
+ return e.by(b, _);
912
+ }, orientation: g(() => e.horizontal ? "horizontal" : "vertical"), labelRef: o, buttonRef: t, optionsRef: i, disabled: g(() => e.disabled), options: p, searchQuery: v, activeOptionIndex: c, activationTrigger: r, closeListbox() {
913
+ e.disabled || s.value !== 1 && (s.value = 1, c.value = null);
914
+ }, openListbox() {
915
+ e.disabled || s.value !== 0 && (s.value = 0);
916
+ }, goToOption(b, _, S) {
917
+ if (e.disabled || s.value === 1) return;
918
+ let T = u(), A = yt(b === C.Specific ? { focus: C.Specific, id: _ } : { focus: b }, { resolveItems: () => T.options, resolveActiveIndex: () => T.activeOptionIndex, resolveId: (X) => X.id, resolveDisabled: (X) => X.dataRef.disabled });
919
+ v.value = "", c.value = A, r.value = S ?? 1, p.value = T.options;
920
+ }, search(b) {
921
+ if (e.disabled || s.value === 1) return;
922
+ let _ = v.value !== "" ? 0 : 1;
923
+ v.value += b.toLowerCase();
924
+ let S = (c.value !== null ? p.value.slice(c.value + _).concat(p.value.slice(0, c.value + _)) : p.value).find((A) => A.dataRef.textValue.startsWith(v.value) && !A.dataRef.disabled), T = S ? p.value.indexOf(S) : -1;
925
+ T === -1 || T === c.value || (c.value = T, r.value = 1);
926
+ }, clearSearch() {
927
+ e.disabled || s.value !== 1 && v.value !== "" && (v.value = "");
928
+ }, registerOption(b, _) {
929
+ let S = u((T) => [...T, { id: b, dataRef: _ }]);
930
+ p.value = S.options, c.value = S.activeOptionIndex;
931
+ }, unregisterOption(b) {
932
+ let _ = u((S) => {
933
+ let T = S.findIndex((A) => A.id === b);
934
+ return T !== -1 && S.splice(T, 1), S;
935
+ });
936
+ p.value = _.options, c.value = _.activeOptionIndex, r.value = 1;
937
+ }, theirOnChange(b) {
938
+ e.disabled || f(b);
939
+ }, select(b) {
940
+ e.disabled || f(z(h.value, { 0: () => b, 1: () => {
941
+ let _ = G($.value.value).slice(), S = G(b), T = _.findIndex((A) => $.compare(S, G(A)));
942
+ return T === -1 ? _.push(S) : _.splice(T, 1), _;
943
+ } }));
944
+ } };
945
+ pt([t, i], (b, _) => {
946
+ var S;
947
+ $.closeListbox(), Te(_, Re.Loose) || (b.preventDefault(), (S = k(t)) == null || S.focus());
948
+ }, g(() => s.value === 0)), pe(_t, $), gt(g(() => z(s.value, { 0: le.Open, 1: le.Closed })));
949
+ let w = g(() => {
950
+ var b;
951
+ return (b = k(t)) == null ? void 0 : b.closest("form");
952
+ });
953
+ return Z(() => {
954
+ Ne([w], () => {
955
+ if (!w.value || e.defaultValue === void 0) return;
956
+ function b() {
957
+ $.theirOnChange(e.defaultValue);
958
+ }
959
+ return w.value.addEventListener("reset", b), () => {
960
+ var _;
961
+ (_ = w.value) == null || _.removeEventListener("reset", b);
962
+ };
963
+ }, { immediate: !0 });
964
+ }), () => {
965
+ let { name: b, modelValue: _, disabled: S, form: T, ...A } = e, X = { open: s.value === 0, disabled: S, value: y.value };
966
+ return ue(te, [...b != null && y.value != null ? xt({ [b]: y.value }).map(([xe, Ce]) => ue(We, ra({ features: Ue.Hidden, key: xe, as: "input", type: "hidden", hidden: !0, readOnly: !0, form: T, disabled: S, name: xe, value: Ce }))) : [], U({ ourProps: {}, theirProps: { ...l, ...ze(A, ["defaultValue", "onUpdate:modelValue", "horizontal", "multiple", "by"]) }, slot: X, slots: a, attrs: l, name: "Listbox" })]);
967
+ };
968
+ } });
969
+ F({ name: "ListboxLabel", props: { as: { type: [Object, String], default: "label" }, id: { type: String, default: null } }, setup(e, { attrs: a, slots: l }) {
970
+ var n;
971
+ let s = (n = e.id) != null ? n : `headlessui-listbox-label-${ae()}`, o = ge("ListboxLabel");
972
+ function t() {
973
+ var i;
974
+ (i = k(o.buttonRef)) == null || i.focus({ preventScroll: !0 });
975
+ }
976
+ return () => {
977
+ let i = { open: o.listboxState.value === 0, disabled: o.disabled.value }, { ...p } = e, v = { id: s, ref: o.labelRef, onClick: t };
978
+ return U({ ourProps: v, theirProps: p, slot: i, attrs: a, slots: l, name: "ListboxLabel" });
979
+ };
980
+ } });
981
+ let ha = F({ name: "ListboxButton", props: { as: { type: [Object, String], default: "button" }, id: { type: String, default: null } }, setup(e, { attrs: a, slots: l, expose: n }) {
982
+ var s;
983
+ let o = (s = e.id) != null ? s : `headlessui-listbox-button-${ae()}`, t = ge("ListboxButton");
984
+ n({ el: t.buttonRef, $el: t.buttonRef });
985
+ function i(r) {
986
+ switch (r.key) {
987
+ case R.Space:
988
+ case R.Enter:
989
+ case R.ArrowDown:
990
+ r.preventDefault(), t.openListbox(), W(() => {
991
+ var u;
992
+ (u = k(t.optionsRef)) == null || u.focus({ preventScroll: !0 }), t.value.value || t.goToOption(C.First);
993
+ });
994
+ break;
995
+ case R.ArrowUp:
996
+ r.preventDefault(), t.openListbox(), W(() => {
997
+ var u;
998
+ (u = k(t.optionsRef)) == null || u.focus({ preventScroll: !0 }), t.value.value || t.goToOption(C.Last);
999
+ });
1000
+ break;
1001
+ }
1002
+ }
1003
+ function p(r) {
1004
+ switch (r.key) {
1005
+ case R.Space:
1006
+ r.preventDefault();
1007
+ break;
1008
+ }
1009
+ }
1010
+ function v(r) {
1011
+ t.disabled.value || (t.listboxState.value === 0 ? (t.closeListbox(), W(() => {
1012
+ var u;
1013
+ return (u = k(t.buttonRef)) == null ? void 0 : u.focus({ preventScroll: !0 });
1014
+ })) : (r.preventDefault(), t.openListbox(), fa(() => {
1015
+ var u;
1016
+ return (u = k(t.optionsRef)) == null ? void 0 : u.focus({ preventScroll: !0 });
1017
+ })));
1018
+ }
1019
+ let c = Ve(g(() => ({ as: e.as, type: a.type })), t.buttonRef);
1020
+ return () => {
1021
+ var r, u;
1022
+ let h = { open: t.listboxState.value === 0, disabled: t.disabled.value, value: t.value.value }, { ...m } = e, f = { ref: t.buttonRef, id: o, type: c.value, "aria-haspopup": "listbox", "aria-controls": (r = k(t.optionsRef)) == null ? void 0 : r.id, "aria-expanded": t.listboxState.value === 0, "aria-labelledby": t.labelRef.value ? [(u = k(t.labelRef)) == null ? void 0 : u.id, o].join(" ") : void 0, disabled: t.disabled.value === !0 ? !0 : void 0, onKeydown: i, onKeyup: p, onClick: v };
1023
+ return U({ ourProps: f, theirProps: m, slot: h, attrs: a, slots: l, name: "ListboxButton" });
1024
+ };
1025
+ } }), ba = F({ name: "ListboxOptions", props: { as: { type: [Object, String], default: "ul" }, static: { type: Boolean, default: !1 }, unmount: { type: Boolean, default: !0 }, id: { type: String, default: null } }, setup(e, { attrs: a, slots: l, expose: n }) {
1026
+ var s;
1027
+ let o = (s = e.id) != null ? s : `headlessui-listbox-options-${ae()}`, t = ge("ListboxOptions"), i = M(null);
1028
+ n({ el: t.optionsRef, $el: t.optionsRef });
1029
+ function p(r) {
1030
+ switch (i.value && clearTimeout(i.value), r.key) {
1031
+ case R.Space:
1032
+ if (t.searchQuery.value !== "") return r.preventDefault(), r.stopPropagation(), t.search(r.key);
1033
+ case R.Enter:
1034
+ if (r.preventDefault(), r.stopPropagation(), t.activeOptionIndex.value !== null) {
1035
+ let u = t.options.value[t.activeOptionIndex.value];
1036
+ t.select(u.dataRef.value);
1037
+ }
1038
+ t.mode.value === 0 && (t.closeListbox(), W(() => {
1039
+ var u;
1040
+ return (u = k(t.buttonRef)) == null ? void 0 : u.focus({ preventScroll: !0 });
1041
+ }));
1042
+ break;
1043
+ case z(t.orientation.value, { vertical: R.ArrowDown, horizontal: R.ArrowRight }):
1044
+ return r.preventDefault(), r.stopPropagation(), t.goToOption(C.Next);
1045
+ case z(t.orientation.value, { vertical: R.ArrowUp, horizontal: R.ArrowLeft }):
1046
+ return r.preventDefault(), r.stopPropagation(), t.goToOption(C.Previous);
1047
+ case R.Home:
1048
+ case R.PageUp:
1049
+ return r.preventDefault(), r.stopPropagation(), t.goToOption(C.First);
1050
+ case R.End:
1051
+ case R.PageDown:
1052
+ return r.preventDefault(), r.stopPropagation(), t.goToOption(C.Last);
1053
+ case R.Escape:
1054
+ r.preventDefault(), r.stopPropagation(), t.closeListbox(), W(() => {
1055
+ var u;
1056
+ return (u = k(t.buttonRef)) == null ? void 0 : u.focus({ preventScroll: !0 });
1057
+ });
1058
+ break;
1059
+ case R.Tab:
1060
+ r.preventDefault(), r.stopPropagation();
1061
+ break;
1062
+ default:
1063
+ r.key.length === 1 && (t.search(r.key), i.value = setTimeout(() => t.clearSearch(), 350));
1064
+ break;
1065
+ }
1066
+ }
1067
+ let v = bt(), c = g(() => v !== null ? (v.value & le.Open) === le.Open : t.listboxState.value === 0);
1068
+ return () => {
1069
+ var r, u;
1070
+ let h = { open: t.listboxState.value === 0 }, { ...m } = e, f = { "aria-activedescendant": t.activeOptionIndex.value === null || (r = t.options.value[t.activeOptionIndex.value]) == null ? void 0 : r.id, "aria-multiselectable": t.mode.value === 1 ? !0 : void 0, "aria-labelledby": (u = k(t.buttonRef)) == null ? void 0 : u.id, "aria-orientation": t.orientation.value, id: o, onKeydown: p, role: "listbox", tabIndex: 0, ref: t.optionsRef };
1071
+ return U({ ourProps: f, theirProps: m, slot: h, attrs: a, slots: l, features: se.RenderStrategy | se.Static, visible: c.value, name: "ListboxOptions" });
1072
+ };
1073
+ } }), ga = F({ name: "ListboxOption", props: { as: { type: [Object, String], default: "li" }, value: { type: [Object, String, Number, Boolean] }, disabled: { type: Boolean, default: !1 }, id: { type: String, default: null } }, setup(e, { slots: a, attrs: l, expose: n }) {
1074
+ var s;
1075
+ let o = (s = e.id) != null ? s : `headlessui-listbox-option-${ae()}`, t = ge("ListboxOption"), i = M(null);
1076
+ n({ el: i, $el: i });
1077
+ let p = g(() => t.activeOptionIndex.value !== null ? t.options.value[t.activeOptionIndex.value].id === o : !1), v = g(() => z(t.mode.value, { 0: () => t.compare(G(t.value.value), G(e.value)), 1: () => G(t.value.value).some((b) => t.compare(G(b), G(e.value))) })), c = g(() => z(t.mode.value, { 1: () => {
1078
+ var b;
1079
+ let _ = G(t.value.value);
1080
+ return ((b = t.options.value.find((S) => _.some((T) => t.compare(G(T), G(S.dataRef.value))))) == null ? void 0 : b.id) === o;
1081
+ }, 0: () => v.value })), r = $t(i), u = g(() => ({ disabled: e.disabled, value: e.value, get textValue() {
1082
+ return r();
1083
+ }, domRef: i }));
1084
+ Z(() => t.registerOption(o, u)), Pe(() => t.unregisterOption(o)), Z(() => {
1085
+ Ne([t.listboxState, v], () => {
1086
+ t.listboxState.value === 0 && v.value && z(t.mode.value, { 1: () => {
1087
+ c.value && t.goToOption(C.Specific, o);
1088
+ }, 0: () => {
1089
+ t.goToOption(C.Specific, o);
1090
+ } });
1091
+ }, { immediate: !0 });
1092
+ }), de(() => {
1093
+ t.listboxState.value === 0 && p.value && t.activationTrigger.value !== 0 && W(() => {
1094
+ var b, _;
1095
+ return (_ = (b = k(i)) == null ? void 0 : b.scrollIntoView) == null ? void 0 : _.call(b, { block: "nearest" });
1096
+ });
1097
+ });
1098
+ function h(b) {
1099
+ if (e.disabled) return b.preventDefault();
1100
+ t.select(e.value), t.mode.value === 0 && (t.closeListbox(), W(() => {
1101
+ var _;
1102
+ return (_ = k(t.buttonRef)) == null ? void 0 : _.focus({ preventScroll: !0 });
1103
+ }));
1104
+ }
1105
+ function m() {
1106
+ if (e.disabled) return t.goToOption(C.Nothing);
1107
+ t.goToOption(C.Specific, o);
1108
+ }
1109
+ let f = vt();
1110
+ function y(b) {
1111
+ f.update(b);
1112
+ }
1113
+ function $(b) {
1114
+ f.wasMoved(b) && (e.disabled || p.value || t.goToOption(C.Specific, o, 0));
1115
+ }
1116
+ function w(b) {
1117
+ f.wasMoved(b) && (e.disabled || p.value && t.goToOption(C.Nothing));
1118
+ }
1119
+ return () => {
1120
+ let { disabled: b } = e, _ = { active: p.value, selected: v.value, disabled: b }, { value: S, disabled: T, ...A } = e, X = { id: o, ref: i, role: "option", tabIndex: b === !0 ? void 0 : -1, "aria-disabled": b === !0 ? !0 : void 0, "aria-selected": v.value, disabled: void 0, onClick: h, onFocus: m, onPointerenter: y, onMouseenter: y, onPointermove: $, onMousemove: $, onPointerleave: w, onMouseleave: w };
1121
+ return U({ ourProps: X, theirProps: A, slot: _, attrs: l, slots: a, name: "ListboxOption" });
1122
+ };
1123
+ } });
1124
+ var ya = ((e) => (e[e.Open = 0] = "Open", e[e.Closed = 1] = "Closed", e))(ya || {}), xa = ((e) => (e[e.Pointer = 0] = "Pointer", e[e.Other = 1] = "Other", e))(xa || {});
1125
+ function wa(e) {
1126
+ requestAnimationFrame(() => requestAnimationFrame(e));
1127
+ }
1128
+ let It = Symbol("MenuContext");
1129
+ function Ee(e) {
1130
+ let a = ie(It, null);
1131
+ if (a === null) {
1132
+ let l = new Error(`<${e} /> is missing a parent <Menu /> component.`);
1133
+ throw Error.captureStackTrace && Error.captureStackTrace(l, Ee), l;
1134
+ }
1135
+ return a;
1136
+ }
1137
+ let Sa = F({ name: "Menu", props: { as: { type: [Object, String], default: "template" } }, setup(e, { slots: a, attrs: l }) {
1138
+ let n = M(1), s = M(null), o = M(null), t = M([]), i = M(""), p = M(null), v = M(1);
1139
+ function c(u = (h) => h) {
1140
+ let h = p.value !== null ? t.value[p.value] : null, m = ne(u(t.value.slice()), (y) => k(y.dataRef.domRef)), f = h ? m.indexOf(h) : null;
1141
+ return f === -1 && (f = null), { items: m, activeItemIndex: f };
1142
+ }
1143
+ let r = { menuState: n, buttonRef: s, itemsRef: o, items: t, searchQuery: i, activeItemIndex: p, activationTrigger: v, closeMenu: () => {
1144
+ n.value = 1, p.value = null;
1145
+ }, openMenu: () => n.value = 0, goToItem(u, h, m) {
1146
+ let f = c(), y = yt(u === C.Specific ? { focus: C.Specific, id: h } : { focus: u }, { resolveItems: () => f.items, resolveActiveIndex: () => f.activeItemIndex, resolveId: ($) => $.id, resolveDisabled: ($) => $.dataRef.disabled });
1147
+ i.value = "", p.value = y, v.value = m ?? 1, t.value = f.items;
1148
+ }, search(u) {
1149
+ let h = i.value !== "" ? 0 : 1;
1150
+ i.value += u.toLowerCase();
1151
+ let m = (p.value !== null ? t.value.slice(p.value + h).concat(t.value.slice(0, p.value + h)) : t.value).find((y) => y.dataRef.textValue.startsWith(i.value) && !y.dataRef.disabled), f = m ? t.value.indexOf(m) : -1;
1152
+ f === -1 || f === p.value || (p.value = f, v.value = 1);
1153
+ }, clearSearch() {
1154
+ i.value = "";
1155
+ }, registerItem(u, h) {
1156
+ let m = c((f) => [...f, { id: u, dataRef: h }]);
1157
+ t.value = m.items, p.value = m.activeItemIndex, v.value = 1;
1158
+ }, unregisterItem(u) {
1159
+ let h = c((m) => {
1160
+ let f = m.findIndex((y) => y.id === u);
1161
+ return f !== -1 && m.splice(f, 1), m;
1162
+ });
1163
+ t.value = h.items, p.value = h.activeItemIndex, v.value = 1;
1164
+ } };
1165
+ return pt([s, o], (u, h) => {
1166
+ var m;
1167
+ r.closeMenu(), Te(h, Re.Loose) || (u.preventDefault(), (m = k(s)) == null || m.focus());
1168
+ }, g(() => n.value === 0)), pe(It, r), gt(g(() => z(n.value, { 0: le.Open, 1: le.Closed }))), () => {
1169
+ let u = { open: n.value === 0, close: r.closeMenu };
1170
+ return U({ ourProps: {}, theirProps: e, slot: u, slots: a, attrs: l, name: "Menu" });
1171
+ };
1172
+ } }), $a = F({ name: "MenuButton", props: { disabled: { type: Boolean, default: !1 }, as: { type: [Object, String], default: "button" }, id: { type: String, default: null } }, setup(e, { attrs: a, slots: l, expose: n }) {
1173
+ var s;
1174
+ let o = (s = e.id) != null ? s : `headlessui-menu-button-${ae()}`, t = Ee("MenuButton");
1175
+ n({ el: t.buttonRef, $el: t.buttonRef });
1176
+ function i(r) {
1177
+ switch (r.key) {
1178
+ case R.Space:
1179
+ case R.Enter:
1180
+ case R.ArrowDown:
1181
+ r.preventDefault(), r.stopPropagation(), t.openMenu(), W(() => {
1182
+ var u;
1183
+ (u = k(t.itemsRef)) == null || u.focus({ preventScroll: !0 }), t.goToItem(C.First);
1184
+ });
1185
+ break;
1186
+ case R.ArrowUp:
1187
+ r.preventDefault(), r.stopPropagation(), t.openMenu(), W(() => {
1188
+ var u;
1189
+ (u = k(t.itemsRef)) == null || u.focus({ preventScroll: !0 }), t.goToItem(C.Last);
1190
+ });
1191
+ break;
1192
+ }
1193
+ }
1194
+ function p(r) {
1195
+ switch (r.key) {
1196
+ case R.Space:
1197
+ r.preventDefault();
1198
+ break;
1199
+ }
1200
+ }
1201
+ function v(r) {
1202
+ e.disabled || (t.menuState.value === 0 ? (t.closeMenu(), W(() => {
1203
+ var u;
1204
+ return (u = k(t.buttonRef)) == null ? void 0 : u.focus({ preventScroll: !0 });
1205
+ })) : (r.preventDefault(), t.openMenu(), wa(() => {
1206
+ var u;
1207
+ return (u = k(t.itemsRef)) == null ? void 0 : u.focus({ preventScroll: !0 });
1208
+ })));
1209
+ }
1210
+ let c = Ve(g(() => ({ as: e.as, type: a.type })), t.buttonRef);
1211
+ return () => {
1212
+ var r;
1213
+ let u = { open: t.menuState.value === 0 }, { ...h } = e, m = { ref: t.buttonRef, id: o, type: c.value, "aria-haspopup": "menu", "aria-controls": (r = k(t.itemsRef)) == null ? void 0 : r.id, "aria-expanded": t.menuState.value === 0, onKeydown: i, onKeyup: p, onClick: v };
1214
+ return U({ ourProps: m, theirProps: h, slot: u, attrs: a, slots: l, name: "MenuButton" });
1215
+ };
1216
+ } }), _a = F({ name: "MenuItems", props: { as: { type: [Object, String], default: "div" }, static: { type: Boolean, default: !1 }, unmount: { type: Boolean, default: !0 }, id: { type: String, default: null } }, setup(e, { attrs: a, slots: l, expose: n }) {
1217
+ var s;
1218
+ let o = (s = e.id) != null ? s : `headlessui-menu-items-${ae()}`, t = Ee("MenuItems"), i = M(null);
1219
+ n({ el: t.itemsRef, $el: t.itemsRef }), na({ container: g(() => k(t.itemsRef)), enabled: g(() => t.menuState.value === 0), accept(u) {
1220
+ return u.getAttribute("role") === "menuitem" ? NodeFilter.FILTER_REJECT : u.hasAttribute("role") ? NodeFilter.FILTER_SKIP : NodeFilter.FILTER_ACCEPT;
1221
+ }, walk(u) {
1222
+ u.setAttribute("role", "none");
1223
+ } });
1224
+ function p(u) {
1225
+ var h;
1226
+ switch (i.value && clearTimeout(i.value), u.key) {
1227
+ case R.Space:
1228
+ if (t.searchQuery.value !== "") return u.preventDefault(), u.stopPropagation(), t.search(u.key);
1229
+ case R.Enter:
1230
+ if (u.preventDefault(), u.stopPropagation(), t.activeItemIndex.value !== null) {
1231
+ let m = t.items.value[t.activeItemIndex.value];
1232
+ (h = k(m.dataRef.domRef)) == null || h.click();
1233
+ }
1234
+ t.closeMenu(), ct(k(t.buttonRef));
1235
+ break;
1236
+ case R.ArrowDown:
1237
+ return u.preventDefault(), u.stopPropagation(), t.goToItem(C.Next);
1238
+ case R.ArrowUp:
1239
+ return u.preventDefault(), u.stopPropagation(), t.goToItem(C.Previous);
1240
+ case R.Home:
1241
+ case R.PageUp:
1242
+ return u.preventDefault(), u.stopPropagation(), t.goToItem(C.First);
1243
+ case R.End:
1244
+ case R.PageDown:
1245
+ return u.preventDefault(), u.stopPropagation(), t.goToItem(C.Last);
1246
+ case R.Escape:
1247
+ u.preventDefault(), u.stopPropagation(), t.closeMenu(), W(() => {
1248
+ var m;
1249
+ return (m = k(t.buttonRef)) == null ? void 0 : m.focus({ preventScroll: !0 });
1250
+ });
1251
+ break;
1252
+ case R.Tab:
1253
+ u.preventDefault(), u.stopPropagation(), t.closeMenu(), W(() => Zl(k(t.buttonRef), u.shiftKey ? H.Previous : H.Next));
1254
+ break;
1255
+ default:
1256
+ u.key.length === 1 && (t.search(u.key), i.value = setTimeout(() => t.clearSearch(), 350));
1257
+ break;
1258
+ }
1259
+ }
1260
+ function v(u) {
1261
+ switch (u.key) {
1262
+ case R.Space:
1263
+ u.preventDefault();
1264
+ break;
1265
+ }
1266
+ }
1267
+ let c = bt(), r = g(() => c !== null ? (c.value & le.Open) === le.Open : t.menuState.value === 0);
1268
+ return () => {
1269
+ var u, h;
1270
+ let m = { open: t.menuState.value === 0 }, { ...f } = e, y = { "aria-activedescendant": t.activeItemIndex.value === null || (u = t.items.value[t.activeItemIndex.value]) == null ? void 0 : u.id, "aria-labelledby": (h = k(t.buttonRef)) == null ? void 0 : h.id, id: o, onKeydown: p, onKeyup: v, role: "menu", tabIndex: 0, ref: t.itemsRef };
1271
+ return U({ ourProps: y, theirProps: f, slot: m, attrs: a, slots: l, features: se.RenderStrategy | se.Static, visible: r.value, name: "MenuItems" });
1272
+ };
1273
+ } }), Ia = F({ name: "MenuItem", inheritAttrs: !1, props: { as: { type: [Object, String], default: "template" }, disabled: { type: Boolean, default: !1 }, id: { type: String, default: null } }, setup(e, { slots: a, attrs: l, expose: n }) {
1274
+ var s;
1275
+ let o = (s = e.id) != null ? s : `headlessui-menu-item-${ae()}`, t = Ee("MenuItem"), i = M(null);
1276
+ n({ el: i, $el: i });
1277
+ let p = g(() => t.activeItemIndex.value !== null ? t.items.value[t.activeItemIndex.value].id === o : !1), v = $t(i), c = g(() => ({ disabled: e.disabled, get textValue() {
1278
+ return v();
1279
+ }, domRef: i }));
1280
+ Z(() => t.registerItem(o, c)), Pe(() => t.unregisterItem(o)), de(() => {
1281
+ t.menuState.value === 0 && p.value && t.activationTrigger.value !== 0 && W(() => {
1282
+ var $, w;
1283
+ return (w = ($ = k(i)) == null ? void 0 : $.scrollIntoView) == null ? void 0 : w.call($, { block: "nearest" });
1284
+ });
1285
+ });
1286
+ function r($) {
1287
+ if (e.disabled) return $.preventDefault();
1288
+ t.closeMenu(), ct(k(t.buttonRef));
1289
+ }
1290
+ function u() {
1291
+ if (e.disabled) return t.goToItem(C.Nothing);
1292
+ t.goToItem(C.Specific, o);
1293
+ }
1294
+ let h = vt();
1295
+ function m($) {
1296
+ h.update($);
1297
+ }
1298
+ function f($) {
1299
+ h.wasMoved($) && (e.disabled || p.value || t.goToItem(C.Specific, o, 0));
1300
+ }
1301
+ function y($) {
1302
+ h.wasMoved($) && (e.disabled || p.value && t.goToItem(C.Nothing));
1303
+ }
1304
+ return () => {
1305
+ let { disabled: $, ...w } = e, b = { active: p.value, disabled: $, close: t.closeMenu };
1306
+ return U({ ourProps: { id: o, ref: i, role: "menuitem", tabIndex: $ === !0 ? void 0 : -1, "aria-disabled": $ === !0 ? !0 : void 0, onClick: r, onFocus: u, onPointerenter: m, onMouseenter: m, onPointermove: f, onMousemove: f, onPointerleave: y, onMouseleave: y }, theirProps: { ...l, ...w }, slot: b, attrs: l, slots: a, name: "MenuItem" });
1307
+ };
1308
+ } }), ka = F({ props: { onFocus: { type: Function, required: !0 } }, setup(e) {
1309
+ let a = M(!0);
1310
+ return () => a.value ? ue(We, { as: "button", type: "button", features: Ue.Focusable, onFocus(l) {
1311
+ l.preventDefault();
1312
+ let n, s = 50;
1313
+ function o() {
1314
+ var t;
1315
+ if (s-- <= 0) {
1316
+ n && cancelAnimationFrame(n);
1317
+ return;
1318
+ }
1319
+ if ((t = e.onFocus) != null && t.call(e)) {
1320
+ a.value = !1, cancelAnimationFrame(n);
1321
+ return;
1322
+ }
1323
+ n = requestAnimationFrame(o);
1324
+ }
1325
+ n = requestAnimationFrame(o);
1326
+ } }) : null;
1327
+ } });
1328
+ var Pa = ((e) => (e[e.Forwards = 0] = "Forwards", e[e.Backwards = 1] = "Backwards", e))(Pa || {}), Oa = ((e) => (e[e.Less = -1] = "Less", e[e.Equal = 0] = "Equal", e[e.Greater = 1] = "Greater", e))(Oa || {});
1329
+ let kt = Symbol("TabsContext");
1330
+ function ye(e) {
1331
+ let a = ie(kt, null);
1332
+ if (a === null) {
1333
+ let l = new Error(`<${e} /> is missing a parent <TabGroup /> component.`);
1334
+ throw Error.captureStackTrace && Error.captureStackTrace(l, ye), l;
1335
+ }
1336
+ return a;
1337
+ }
1338
+ let qe = Symbol("TabsSSRContext"), Ma = F({ name: "TabGroup", emits: { change: (e) => !0 }, props: { as: { type: [Object, String], default: "template" }, selectedIndex: { type: [Number], default: null }, defaultIndex: { type: [Number], default: 0 }, vertical: { type: [Boolean], default: !1 }, manual: { type: [Boolean], default: !1 } }, inheritAttrs: !1, setup(e, { slots: a, attrs: l, emit: n }) {
1339
+ var s;
1340
+ let o = M((s = e.selectedIndex) != null ? s : e.defaultIndex), t = M([]), i = M([]), p = g(() => e.selectedIndex !== null), v = g(() => p.value ? e.selectedIndex : o.value);
1341
+ function c(f) {
1342
+ var y;
1343
+ let $ = ne(r.tabs.value, k), w = ne(r.panels.value, k), b = $.filter((_) => {
1344
+ var S;
1345
+ return !((S = k(_)) != null && S.hasAttribute("disabled"));
1346
+ });
1347
+ if (f < 0 || f > $.length - 1) {
1348
+ let _ = z(o.value === null ? 0 : Math.sign(f - o.value), { [-1]: () => 1, 0: () => z(Math.sign(f), { [-1]: () => 0, 0: () => 0, 1: () => 1 }), 1: () => 0 }), S = z(_, { 0: () => $.indexOf(b[0]), 1: () => $.indexOf(b[b.length - 1]) });
1349
+ S !== -1 && (o.value = S), r.tabs.value = $, r.panels.value = w;
1350
+ } else {
1351
+ let _ = $.slice(0, f), S = [...$.slice(f), ..._].find((A) => b.includes(A));
1352
+ if (!S) return;
1353
+ let T = (y = $.indexOf(S)) != null ? y : r.selectedIndex.value;
1354
+ T === -1 && (T = r.selectedIndex.value), o.value = T, r.tabs.value = $, r.panels.value = w;
1355
+ }
1356
+ }
1357
+ let r = { selectedIndex: g(() => {
1358
+ var f, y;
1359
+ return (y = (f = o.value) != null ? f : e.defaultIndex) != null ? y : null;
1360
+ }), orientation: g(() => e.vertical ? "vertical" : "horizontal"), activation: g(() => e.manual ? "manual" : "auto"), tabs: t, panels: i, setSelectedIndex(f) {
1361
+ v.value !== f && n("change", f), p.value || c(f);
1362
+ }, registerTab(f) {
1363
+ var y;
1364
+ if (t.value.includes(f)) return;
1365
+ let $ = t.value[o.value];
1366
+ if (t.value.push(f), t.value = ne(t.value, k), !p.value) {
1367
+ let w = (y = t.value.indexOf($)) != null ? y : o.value;
1368
+ w !== -1 && (o.value = w);
1369
+ }
1370
+ }, unregisterTab(f) {
1371
+ let y = t.value.indexOf(f);
1372
+ y !== -1 && t.value.splice(y, 1);
1373
+ }, registerPanel(f) {
1374
+ i.value.includes(f) || (i.value.push(f), i.value = ne(i.value, k));
1375
+ }, unregisterPanel(f) {
1376
+ let y = i.value.indexOf(f);
1377
+ y !== -1 && i.value.splice(y, 1);
1378
+ } };
1379
+ pe(kt, r);
1380
+ let u = M({ tabs: [], panels: [] }), h = M(!1);
1381
+ Z(() => {
1382
+ h.value = !0;
1383
+ }), pe(qe, g(() => h.value ? null : u.value));
1384
+ let m = g(() => e.selectedIndex);
1385
+ return Z(() => {
1386
+ Ne([m], () => {
1387
+ var f;
1388
+ return c((f = e.selectedIndex) != null ? f : e.defaultIndex);
1389
+ }, { immediate: !0 });
1390
+ }), de(() => {
1391
+ if (!p.value || v.value == null || r.tabs.value.length <= 0) return;
1392
+ let f = ne(r.tabs.value, k);
1393
+ f.some((y, $) => k(r.tabs.value[$]) !== k(y)) && r.setSelectedIndex(f.findIndex((y) => k(y) === k(r.tabs.value[v.value])));
1394
+ }), () => {
1395
+ let f = { selectedIndex: o.value };
1396
+ return ue(te, [t.value.length <= 0 && ue(ka, { onFocus: () => {
1397
+ for (let y of t.value) {
1398
+ let $ = k(y);
1399
+ if (($ == null ? void 0 : $.tabIndex) === 0) return $.focus(), !0;
1400
+ }
1401
+ return !1;
1402
+ } }), U({ theirProps: { ...l, ...ze(e, ["selectedIndex", "defaultIndex", "manual", "vertical", "onChange"]) }, ourProps: {}, slot: f, slots: a, attrs: l, name: "TabGroup" })]);
1403
+ };
1404
+ } }), Ra = F({ name: "TabList", props: { as: { type: [Object, String], default: "div" } }, setup(e, { attrs: a, slots: l }) {
1405
+ let n = ye("TabList");
1406
+ return () => {
1407
+ let s = { selectedIndex: n.selectedIndex.value }, o = { role: "tablist", "aria-orientation": n.orientation.value };
1408
+ return U({ ourProps: o, theirProps: e, slot: s, attrs: a, slots: l, name: "TabList" });
1409
+ };
1410
+ } }), Ta = F({ name: "Tab", props: { as: { type: [Object, String], default: "button" }, disabled: { type: [Boolean], default: !1 }, id: { type: String, default: null } }, setup(e, { attrs: a, slots: l, expose: n }) {
1411
+ var s;
1412
+ let o = (s = e.id) != null ? s : `headlessui-tabs-tab-${ae()}`, t = ye("Tab"), i = M(null);
1413
+ n({ el: i, $el: i }), Z(() => t.registerTab(i)), Pe(() => t.unregisterTab(i));
1414
+ let p = ie(qe), v = g(() => {
1415
+ if (p.value) {
1416
+ let w = p.value.tabs.indexOf(o);
1417
+ return w === -1 ? p.value.tabs.push(o) - 1 : w;
1418
+ }
1419
+ return -1;
1420
+ }), c = g(() => {
1421
+ let w = t.tabs.value.indexOf(i);
1422
+ return w === -1 ? v.value : w;
1423
+ }), r = g(() => c.value === t.selectedIndex.value);
1424
+ function u(w) {
1425
+ var b;
1426
+ let _ = w();
1427
+ if (_ === he.Success && t.activation.value === "auto") {
1428
+ let S = (b = Me(i)) == null ? void 0 : b.activeElement, T = t.tabs.value.findIndex((A) => k(A) === S);
1429
+ T !== -1 && t.setSelectedIndex(T);
1430
+ }
1431
+ return _;
1432
+ }
1433
+ function h(w) {
1434
+ let b = t.tabs.value.map((_) => k(_)).filter(Boolean);
1435
+ if (w.key === R.Space || w.key === R.Enter) {
1436
+ w.preventDefault(), w.stopPropagation(), t.setSelectedIndex(c.value);
1437
+ return;
1438
+ }
1439
+ switch (w.key) {
1440
+ case R.Home:
1441
+ case R.PageUp:
1442
+ return w.preventDefault(), w.stopPropagation(), u(() => re(b, H.First));
1443
+ case R.End:
1444
+ case R.PageDown:
1445
+ return w.preventDefault(), w.stopPropagation(), u(() => re(b, H.Last));
1446
+ }
1447
+ if (u(() => z(t.orientation.value, { vertical() {
1448
+ return w.key === R.ArrowUp ? re(b, H.Previous | H.WrapAround) : w.key === R.ArrowDown ? re(b, H.Next | H.WrapAround) : he.Error;
1449
+ }, horizontal() {
1450
+ return w.key === R.ArrowLeft ? re(b, H.Previous | H.WrapAround) : w.key === R.ArrowRight ? re(b, H.Next | H.WrapAround) : he.Error;
1451
+ } })) === he.Success) return w.preventDefault();
1452
+ }
1453
+ let m = M(!1);
1454
+ function f() {
1455
+ var w;
1456
+ m.value || (m.value = !0, !e.disabled && ((w = k(i)) == null || w.focus({ preventScroll: !0 }), t.setSelectedIndex(c.value), zl(() => {
1457
+ m.value = !1;
1458
+ })));
1459
+ }
1460
+ function y(w) {
1461
+ w.preventDefault();
1462
+ }
1463
+ let $ = Ve(g(() => ({ as: e.as, type: a.type })), i);
1464
+ return () => {
1465
+ var w, b;
1466
+ let _ = { selected: r.value, disabled: (w = e.disabled) != null ? w : !1 }, { ...S } = e, T = { ref: i, onKeydown: h, onMousedown: y, onClick: f, id: o, role: "tab", type: $.value, "aria-controls": (b = k(t.panels.value[c.value])) == null ? void 0 : b.id, "aria-selected": r.value, tabIndex: r.value ? 0 : -1, disabled: e.disabled ? !0 : void 0 };
1467
+ return U({ ourProps: T, theirProps: S, slot: _, attrs: a, slots: l, name: "Tab" });
1468
+ };
1469
+ } }), Ea = F({ name: "TabPanels", props: { as: { type: [Object, String], default: "div" } }, setup(e, { slots: a, attrs: l }) {
1470
+ let n = ye("TabPanels");
1471
+ return () => {
1472
+ let s = { selectedIndex: n.selectedIndex.value };
1473
+ return U({ theirProps: e, ourProps: {}, slot: s, attrs: l, slots: a, name: "TabPanels" });
1474
+ };
1475
+ } }), Ca = F({ name: "TabPanel", props: { as: { type: [Object, String], default: "div" }, static: { type: Boolean, default: !1 }, unmount: { type: Boolean, default: !0 }, id: { type: String, default: null }, tabIndex: { type: Number, default: 0 } }, setup(e, { attrs: a, slots: l, expose: n }) {
1476
+ var s;
1477
+ let o = (s = e.id) != null ? s : `headlessui-tabs-panel-${ae()}`, t = ye("TabPanel"), i = M(null);
1478
+ n({ el: i, $el: i }), Z(() => t.registerPanel(i)), Pe(() => t.unregisterPanel(i));
1479
+ let p = ie(qe), v = g(() => {
1480
+ if (p.value) {
1481
+ let u = p.value.panels.indexOf(o);
1482
+ return u === -1 ? p.value.panels.push(o) - 1 : u;
1483
+ }
1484
+ return -1;
1485
+ }), c = g(() => {
1486
+ let u = t.panels.value.indexOf(i);
1487
+ return u === -1 ? v.value : u;
1488
+ }), r = g(() => c.value === t.selectedIndex.value);
1489
+ return () => {
1490
+ var u;
1491
+ let h = { selected: r.value }, { tabIndex: m, ...f } = e, y = { ref: i, id: o, role: "tabpanel", "aria-labelledby": (u = k(t.tabs.value[c.value])) == null ? void 0 : u.id, tabIndex: r.value ? m : -1 };
1492
+ return !r.value && e.unmount && !e.static ? ue(We, { as: "span", "aria-hidden": !0, ...y }) : U({ ourProps: y, theirProps: f, slot: h, attrs: a, slots: l, features: se.Static | se.RenderStrategy, visible: r.value, name: "TabPanel" });
1493
+ };
1494
+ } });
1495
+ const Fa = ["onClick"], La = {
1496
+ class: "mo-menu__icon",
1497
+ "aria-hidden": "true"
1498
+ }, Da = { class: "mo-menu__text" }, Aa = { class: "mo-menu__label" }, Ba = {
1499
+ key: 0,
1500
+ class: "mo-menu__description"
1501
+ }, Na = /* @__PURE__ */ F({
1502
+ name: "MoMenu",
1503
+ __name: "menu",
1504
+ props: {
1505
+ items: { default: () => [] },
1506
+ theme: { default: "light" },
1507
+ placement: { default: "bottom-start" },
1508
+ width: { default: 272 }
1509
+ },
1510
+ emits: ["select"],
1511
+ setup(e, { emit: a }) {
1512
+ const l = e, n = a, s = g(() => [
1513
+ "mo-menu",
1514
+ `mo-theme--${l.theme}`,
1515
+ `mo-menu--${l.placement}`
1516
+ ]), o = g(() => ({
1517
+ "--mo-menu-width": typeof l.width == "number" ? `${l.width}px` : l.width
1518
+ }));
1519
+ function t(i, p) {
1520
+ i.disabled || n("select", i.value, i, p);
1521
+ }
1522
+ return (i, p) => (P(), oe(N(Sa), {
1523
+ as: "div",
1524
+ class: j(s.value),
1525
+ style: Q(o.value)
1526
+ }, {
1527
+ default: K(() => [
1528
+ be(N($a), { as: "template" }, {
1529
+ default: K(() => [
1530
+ B(i.$slots, "trigger", {}, () => [
1531
+ p[0] || (p[0] = O("button", {
1532
+ class: "mo-menu__trigger",
1533
+ type: "button"
1534
+ }, "打开菜单", -1))
1535
+ ])
1536
+ ]),
1537
+ _: 3
1538
+ }),
1539
+ be(N(_a), { class: "mo-menu__items" }, {
1540
+ default: K(() => [
1541
+ (P(!0), E(te, null, ve(e.items, (v, c) => (P(), oe(N(Ia), {
1542
+ key: v.value,
1543
+ as: "template",
1544
+ disabled: v.disabled
1545
+ }, {
1546
+ default: K(({ active: r, disabled: u }) => [
1547
+ O("button", {
1548
+ class: j(["mo-menu__item", { "is-active": r, "is-disabled": u }]),
1549
+ type: "button",
1550
+ onClick: (h) => t(v, c)
1551
+ }, [
1552
+ O("span", La, [
1553
+ B(i.$slots, "icon", {
1554
+ item: v,
1555
+ index: c,
1556
+ active: r
1557
+ }, () => [
1558
+ p[1] || (p[1] = O("span", { class: "mo-menu__icon-dot" }, null, -1))
1559
+ ])
1560
+ ]),
1561
+ O("span", Da, [
1562
+ B(i.$slots, "item", {
1563
+ item: v,
1564
+ index: c,
1565
+ active: r
1566
+ }, () => [
1567
+ O("span", Aa, V(v.label), 1),
1568
+ v.description ? (P(), E("span", Ba, V(v.description), 1)) : D("", !0)
1569
+ ])
1570
+ ])
1571
+ ], 10, Fa)
1572
+ ]),
1573
+ _: 2
1574
+ }, 1032, ["disabled"]))), 128))
1575
+ ]),
1576
+ _: 3
1577
+ })
1578
+ ]),
1579
+ _: 3
1580
+ }, 8, ["class", "style"]));
1581
+ }
1582
+ }), ja = J(Na), Va = /* @__PURE__ */ F({
1583
+ name: "MoRow",
1584
+ __name: "row",
1585
+ props: {
1586
+ gutter: { default: 0 },
1587
+ justify: { default: "start" },
1588
+ align: { default: "top" },
1589
+ wrap: { type: Boolean, default: !0 }
1590
+ },
1591
+ setup(e) {
1592
+ const a = e, l = g(() => typeof a.gutter == "number" ? `${a.gutter}px` : a.gutter), n = g(() => [
1593
+ "mo-row",
1594
+ `mo-row--justify-${a.justify}`,
1595
+ `mo-row--align-${a.align}`,
1596
+ {
1597
+ "is-nowrap": !a.wrap
1598
+ }
1599
+ ]), s = g(() => ({
1600
+ "--mo-row-gutter": l.value,
1601
+ "--mo-row-gutter-half": `calc(${l.value} / 2)`
1602
+ }));
1603
+ return (o, t) => (P(), E("div", {
1604
+ class: j(n.value),
1605
+ style: Q(s.value)
1606
+ }, [
1607
+ B(o.$slots, "default")
1608
+ ], 6));
1609
+ }
1610
+ }), za = J(Va), Ua = { class: "mo-select__label" }, Wa = /* @__PURE__ */ F({
1611
+ name: "MoSelect",
1612
+ __name: "select",
1613
+ props: {
1614
+ modelValue: { type: [String, Number, Boolean, Object, null], default: null },
1615
+ options: { default: () => [] },
1616
+ theme: { default: "light" },
1617
+ size: { default: "default" },
1618
+ placeholder: { default: "请选择" },
1619
+ disabled: { type: Boolean, default: !1 },
1620
+ horizontal: { type: Boolean, default: !1 },
1621
+ name: { default: void 0 },
1622
+ by: { type: [String, Function], default: void 0 }
1623
+ },
1624
+ emits: ["update:modelValue", "change"],
1625
+ setup(e, { emit: a }) {
1626
+ const l = e, n = a, s = g(
1627
+ () => l.options.find((c) => i(c.value, l.modelValue))
1628
+ ), o = g(() => {
1629
+ var c;
1630
+ return ((c = s.value) == null ? void 0 : c.label) || l.placeholder;
1631
+ }), t = g(() => [
1632
+ "mo-select",
1633
+ `mo-select--${l.size}`,
1634
+ `mo-theme--${l.theme}`,
1635
+ {
1636
+ "is-disabled": l.disabled,
1637
+ "is-placeholder": !s.value
1638
+ }
1639
+ ]);
1640
+ function i(c, r) {
1641
+ return typeof l.by == "function" ? l.by(c, r) : typeof l.by == "string" && p(c) && p(r) ? c[l.by] === r[l.by] : c === r;
1642
+ }
1643
+ function p(c) {
1644
+ return typeof c == "object" && c !== null;
1645
+ }
1646
+ function v(c) {
1647
+ const r = l.options.find((u) => i(u.value, c));
1648
+ n("update:modelValue", c), n("change", c, r);
1649
+ }
1650
+ return (c, r) => (P(), oe(N(ma), {
1651
+ "model-value": e.modelValue,
1652
+ disabled: e.disabled,
1653
+ horizontal: e.horizontal,
1654
+ name: e.name,
1655
+ by: e.by,
1656
+ "onUpdate:modelValue": v
1657
+ }, {
1658
+ default: K(() => [
1659
+ O("div", {
1660
+ class: j(t.value)
1661
+ }, [
1662
+ be(N(ha), { class: "mo-select__button" }, {
1663
+ default: K(() => [
1664
+ O("span", Ua, [
1665
+ B(c.$slots, "label", {
1666
+ option: s.value,
1667
+ label: o.value
1668
+ }, () => [
1669
+ ke(V(o.value), 1)
1670
+ ])
1671
+ ]),
1672
+ r[0] || (r[0] = O("span", {
1673
+ class: "mo-select__arrow",
1674
+ "aria-hidden": "true"
1675
+ }, null, -1))
1676
+ ]),
1677
+ _: 3
1678
+ }),
1679
+ be(N(ba), { class: "mo-select__options" }, {
1680
+ default: K(() => [
1681
+ (P(!0), E(te, null, ve(e.options, (u) => (P(), oe(N(ga), {
1682
+ key: `${u.label}-${String(u.value)}`,
1683
+ as: "template",
1684
+ value: u.value,
1685
+ disabled: u.disabled
1686
+ }, {
1687
+ default: K(({ active: h, selected: m, disabled: f }) => [
1688
+ O("li", {
1689
+ class: j(["mo-select__option", {
1690
+ "is-active": h,
1691
+ "is-selected": m,
1692
+ "is-disabled": f
1693
+ }])
1694
+ }, [
1695
+ r[1] || (r[1] = O("span", {
1696
+ class: "mo-select__check",
1697
+ "aria-hidden": "true"
1698
+ }, null, -1)),
1699
+ B(c.$slots, "option", {
1700
+ option: u,
1701
+ active: h,
1702
+ selected: m,
1703
+ disabled: f
1704
+ }, () => [
1705
+ ke(V(u.label), 1)
1706
+ ])
1707
+ ], 2)
1708
+ ]),
1709
+ _: 2
1710
+ }, 1032, ["value", "disabled"]))), 128))
1711
+ ]),
1712
+ _: 3
1713
+ })
1714
+ ], 2)
1715
+ ]),
1716
+ _: 3
1717
+ }, 8, ["model-value", "disabled", "horizontal", "name", "by"]));
1718
+ }
1719
+ }), qa = J(Wa), Ha = /* @__PURE__ */ F({
1720
+ name: "MoTabs",
1721
+ __name: "tabs",
1722
+ props: {
1723
+ modelValue: { default: void 0 },
1724
+ items: {},
1725
+ size: { default: "default" },
1726
+ theme: { default: "light" }
1727
+ },
1728
+ emits: ["update:modelValue", "change"],
1729
+ setup(e, { emit: a }) {
1730
+ const l = e, n = a, s = g(() => {
1731
+ const p = l.items.findIndex((v) => v.value === l.modelValue);
1732
+ return p >= 0 ? p : 0;
1733
+ }), o = g(() => ["mo-tabs", `mo-tabs--${l.size}`, `mo-theme--${l.theme}`]), t = g(() => ({
1734
+ "--mo-tabs-count": Math.max(l.items.length, 1),
1735
+ "--mo-tabs-active-index": s.value
1736
+ }));
1737
+ function i(p) {
1738
+ const v = l.items[p];
1739
+ !v || v.disabled || (n("update:modelValue", v.value), n("change", v.value, v, p));
1740
+ }
1741
+ return (p, v) => (P(), oe(N(Ma), {
1742
+ "selected-index": s.value,
1743
+ onChange: i
1744
+ }, {
1745
+ default: K(() => [
1746
+ O("div", {
1747
+ class: j(o.value),
1748
+ style: Q(t.value)
1749
+ }, [
1750
+ be(N(Ra), { class: "mo-tabs__list" }, {
1751
+ default: K(() => [
1752
+ v[0] || (v[0] = O("span", {
1753
+ class: "mo-tabs__indicator",
1754
+ "aria-hidden": "true"
1755
+ }, null, -1)),
1756
+ (P(!0), E(te, null, ve(e.items, (c, r) => (P(), oe(N(Ta), {
1757
+ key: c.value,
1758
+ as: "template",
1759
+ disabled: c.disabled
1760
+ }, {
1761
+ default: K(({ selected: u }) => [
1762
+ O("button", {
1763
+ class: j(["mo-tabs__tab", { "is-active": u, "is-disabled": c.disabled }]),
1764
+ type: "button"
1765
+ }, [
1766
+ B(p.$slots, "label", {
1767
+ item: c,
1768
+ index: r,
1769
+ selected: u
1770
+ }, () => [
1771
+ ke(V(c.label), 1)
1772
+ ])
1773
+ ], 2)
1774
+ ]),
1775
+ _: 2
1776
+ }, 1032, ["disabled"]))), 128))
1777
+ ]),
1778
+ _: 3
1779
+ }),
1780
+ p.$slots.panel ? (P(), oe(N(Ea), {
1781
+ key: 0,
1782
+ class: "mo-tabs__panels"
1783
+ }, {
1784
+ default: K(() => [
1785
+ (P(!0), E(te, null, ve(e.items, (c, r) => (P(), oe(N(Ca), {
1786
+ key: c.value,
1787
+ class: "mo-tabs__panel"
1788
+ }, {
1789
+ default: K(() => [
1790
+ B(p.$slots, "panel", {
1791
+ item: c,
1792
+ index: r
1793
+ })
1794
+ ]),
1795
+ _: 2
1796
+ }, 1024))), 128))
1797
+ ]),
1798
+ _: 3
1799
+ })) : D("", !0)
1800
+ ], 6)
1801
+ ]),
1802
+ _: 3
1803
+ }, 8, ["selected-index"]));
1804
+ }
1805
+ }), Ka = J(Ha), Xa = ["onKeydown"], Ya = ["accept", "multiple"], Ga = { class: "mo-upload__hint" }, Qa = {
1806
+ key: 0,
1807
+ class: "mo-upload__list"
1808
+ }, Ja = ["src", "alt"], Za = ["src"], en = {
1809
+ key: 2,
1810
+ class: "mo-upload__file-icon"
1811
+ }, tn = { class: "mo-upload__meta" }, ln = { class: "mo-upload__name" }, an = { class: "mo-upload__size" }, nn = { class: "mo-upload__progress" }, on = { class: "mo-upload__status" }, rn = ["onClick"], un = ["onClick"], sn = {
1812
+ key: 1,
1813
+ class: "mo-upload-cropper",
1814
+ role: "dialog",
1815
+ "aria-modal": "true"
1816
+ }, dn = { class: "mo-upload-cropper__panel" }, cn = ["src"], pn = { class: "mo-upload-cropper__slider" }, vn = /* @__PURE__ */ F({
1817
+ name: "MoUpload",
1818
+ __name: "upload",
1819
+ props: {
1820
+ theme: { default: "light" },
1821
+ accept: { default: "" },
1822
+ multiple: { type: Boolean, default: !1 },
1823
+ limit: { default: 1 },
1824
+ maxSize: { default: 10 },
1825
+ hint: { default: "PNG/JPG/WebP,最大10MB" },
1826
+ autoUpload: { type: Boolean, default: !0 },
1827
+ request: { type: Function, default: void 0 },
1828
+ crop: { type: Boolean, default: !1 },
1829
+ manualCrop: { type: Boolean, default: !0 },
1830
+ cropShape: { default: "square" },
1831
+ cropSize: { default: 64 },
1832
+ cropWidth: { default: void 0 },
1833
+ cropHeight: { default: void 0 }
1834
+ },
1835
+ emits: ["change", "success", "error", "remove"],
1836
+ setup(e, { expose: a, emit: l }) {
1837
+ const n = e, s = l, o = M(), t = M(), i = M([]), p = M(!1), v = M(), c = M(""), r = M(1), u = M(0), h = M(0), m = M({ width: 0, height: 0 }), f = M(!1), y = M({ x: 0, y: 0, cropX: 0, cropY: 0 }), $ = /* @__PURE__ */ new Map(), w = {
1838
+ width: 320,
1839
+ height: 240
1840
+ }, b = g(() => [
1841
+ "mo-upload",
1842
+ `mo-theme--${n.theme}`,
1843
+ {
1844
+ "is-dragging": p.value
1845
+ }
1846
+ ]), _ = g(() => ({
1847
+ "--mo-upload-crop-size": typeof n.cropSize == "number" ? `${n.cropSize}px` : n.cropSize,
1848
+ "--mo-upload-crop-preview-width": `${Math.min(S.value.width, 140)}px`,
1849
+ "--mo-upload-crop-preview-height": `${Math.min(
1850
+ S.value.height,
1851
+ 140 / S.value.width * S.value.height
1852
+ )}px`,
1853
+ "--mo-upload-crop-width": `${T.value.width}px`,
1854
+ "--mo-upload-crop-height": `${T.value.height}px`
1855
+ })), S = g(() => {
1856
+ if (n.cropShape === "rect")
1857
+ return {
1858
+ width: Fe(n.cropWidth, 320),
1859
+ height: Fe(n.cropHeight, 180)
1860
+ };
1861
+ const d = Fe(n.cropSize, 96);
1862
+ return {
1863
+ width: d,
1864
+ height: d
1865
+ };
1866
+ }), T = g(() => {
1867
+ const d = m.value.width || S.value.width, x = m.value.height || S.value.height, I = we(d, x), L = Math.min(w.width, d * I), Y = Math.min(w.height, x * I), ee = S.value.width / S.value.height;
1868
+ return ee >= L / Y ? {
1869
+ width: L,
1870
+ height: L / ee
1871
+ } : {
1872
+ width: Y * ee,
1873
+ height: Y
1874
+ };
1875
+ }), A = g(() => {
1876
+ const d = m.value.width || S.value.width, x = m.value.height || S.value.height, I = we(d, x);
1877
+ return {
1878
+ width: `${d * I}px`,
1879
+ height: `${x * I}px`,
1880
+ transform: `translate(calc(-50% + ${u.value}px), calc(-50% + ${h.value}px)) scale(${r.value})`
1881
+ };
1882
+ });
1883
+ function X() {
1884
+ var d;
1885
+ (d = o.value) == null || d.click();
1886
+ }
1887
+ function xe(d) {
1888
+ const x = d.target;
1889
+ He(x.files), x.value = "";
1890
+ }
1891
+ function Ce(d) {
1892
+ var x;
1893
+ p.value = !1, He((x = d.dataTransfer) == null ? void 0 : x.files);
1894
+ }
1895
+ function He(d) {
1896
+ if (!d)
1897
+ return;
1898
+ const x = Array.from(d).filter((L) => L.size <= n.maxSize * 1024 * 1024).slice(0, Math.max(n.limit - i.value.length, 0));
1899
+ if (n.crop && n.manualCrop) {
1900
+ const L = x.find((Y) => Y.type.startsWith("image/"));
1901
+ if (L) {
1902
+ Ot(L);
1903
+ return;
1904
+ }
1905
+ }
1906
+ const I = x.map(Xe);
1907
+ i.value = n.multiple ? [...i.value, ...I] : I.slice(0, 1), s("change", i.value), n.autoUpload && I.forEach((L) => Se(L));
1908
+ }
1909
+ function Pt(d) {
1910
+ const x = Xe(d);
1911
+ i.value = n.multiple ? [...i.value, x] : [x], s("change", i.value), n.autoUpload && Se(x);
1912
+ }
1913
+ function Ot(d) {
1914
+ fe(), v.value = d, c.value = URL.createObjectURL(d), r.value = 1, u.value = 0, h.value = 0, m.value = { width: 0, height: 0 };
1915
+ }
1916
+ function fe() {
1917
+ c.value && URL.revokeObjectURL(c.value), v.value = void 0, c.value = "", m.value = { width: 0, height: 0 }, f.value = !1;
1918
+ }
1919
+ function Mt(d) {
1920
+ const x = d.target;
1921
+ m.value = {
1922
+ width: x.naturalWidth,
1923
+ height: x.naturalHeight
1924
+ }, Lt();
1925
+ }
1926
+ function Rt(d) {
1927
+ f.value = !0, y.value = {
1928
+ x: d.clientX,
1929
+ y: d.clientY,
1930
+ cropX: u.value,
1931
+ cropY: h.value
1932
+ }, d.currentTarget.setPointerCapture(d.pointerId);
1933
+ }
1934
+ function Tt(d) {
1935
+ f.value && Le(
1936
+ y.value.cropX + d.clientX - y.value.x,
1937
+ y.value.cropY + d.clientY - y.value.y
1938
+ );
1939
+ }
1940
+ function Ke(d) {
1941
+ f.value = !1, d.currentTarget.releasePointerCapture(d.pointerId);
1942
+ }
1943
+ function Et(d) {
1944
+ const x = De(r.value + (d.deltaY > 0 ? -0.08 : 0.08), 1, 4);
1945
+ r.value = x, Le(u.value, h.value);
1946
+ }
1947
+ async function Ct() {
1948
+ if (!v.value || !t.value)
1949
+ return;
1950
+ const d = await Ft(v.value, t.value);
1951
+ fe(), Pt(d);
1952
+ }
1953
+ function Ft(d, x) {
1954
+ const I = document.createElement("canvas"), L = I.getContext("2d");
1955
+ if (I.width = S.value.width, I.height = S.value.height, !L)
1956
+ return Promise.resolve(d);
1957
+ const Y = T.value.width, ee = T.value.height, $e = (w.width - Y) / 2, _e = (w.height - ee) / 2, me = we(x.naturalWidth, x.naturalHeight), Ye = x.naturalWidth * me * r.value, Ge = x.naturalHeight * me * r.value, Ht = (w.width - Ye) / 2 + u.value, Kt = (w.height - Ge) / 2 + h.value, Xt = Ht - $e, Yt = Kt - _e, Qe = S.value.width / Y, Je = S.value.height / ee;
1958
+ return n.cropShape === "circle" && (L.beginPath(), L.arc(
1959
+ S.value.width / 2,
1960
+ S.value.height / 2,
1961
+ Math.min(S.value.width, S.value.height) / 2,
1962
+ 0,
1963
+ Math.PI * 2
1964
+ ), L.clip()), L.drawImage(
1965
+ x,
1966
+ Xt * Qe,
1967
+ Yt * Je,
1968
+ Ye * Qe,
1969
+ Ge * Je
1970
+ ), new Promise((Ze) => {
1971
+ I.toBlob((et) => {
1972
+ if (!et) {
1973
+ Ze(d);
1974
+ return;
1975
+ }
1976
+ const Gt = d.name.replace(/\.[^.]+$/, ".png");
1977
+ Ze(new File([et], Gt, { type: "image/png", lastModified: Date.now() }));
1978
+ }, "image/png");
1979
+ });
1980
+ }
1981
+ function Fe(d, x) {
1982
+ if (typeof d == "number")
1983
+ return d;
1984
+ if (typeof d == "string") {
1985
+ const I = Number.parseInt(d, 10);
1986
+ return Number.isFinite(I) ? I : x;
1987
+ }
1988
+ return x;
1989
+ }
1990
+ function we(d, x) {
1991
+ return Math.min(w.width / d, w.height / x);
1992
+ }
1993
+ function Lt() {
1994
+ r.value = 1, Le(0, 0);
1995
+ }
1996
+ function Le(d, x) {
1997
+ const I = Dt();
1998
+ u.value = De(d, I.minX, I.maxX), h.value = De(x, I.minY, I.maxY);
1999
+ }
2000
+ function Dt() {
2001
+ const d = m.value.width || S.value.width, x = m.value.height || S.value.height, I = we(d, x), L = d * I * r.value, Y = x * I * r.value, ee = (w.width - L) / 2, $e = (w.height - Y) / 2, _e = (w.width - T.value.width) / 2, me = (w.height - T.value.height) / 2;
2002
+ return {
2003
+ minX: _e + T.value.width - L - ee,
2004
+ maxX: _e - ee,
2005
+ minY: me + T.value.height - Y - $e,
2006
+ maxY: me - $e
2007
+ };
2008
+ }
2009
+ function De(d, x, I) {
2010
+ return Math.min(Math.max(d, x), I);
2011
+ }
2012
+ function Xe(d) {
2013
+ return {
2014
+ uid: `${Date.now()}-${Math.random().toString(16).slice(2)}`,
2015
+ name: d.name,
2016
+ size: d.size,
2017
+ type: d.type,
2018
+ file: d,
2019
+ status: "ready",
2020
+ percent: 0,
2021
+ url: URL.createObjectURL(d)
2022
+ };
2023
+ }
2024
+ async function Se(d) {
2025
+ d.status = "uploading", d.percent = 0, d.error = "";
2026
+ try {
2027
+ n.request ? (await n.request({
2028
+ file: d.file,
2029
+ onProgress(x) {
2030
+ d.percent = qt(x);
2031
+ }
2032
+ }), d.percent = 100) : await At(d), d.status = "success", s("success", d);
2033
+ } catch (x) {
2034
+ d.status = "error", d.error = x instanceof Error ? x.message : "上传失败", s("error", d);
2035
+ }
2036
+ s("change", i.value);
2037
+ }
2038
+ function At(d) {
2039
+ return new Promise((x) => {
2040
+ const I = window.setInterval(() => {
2041
+ d.percent = Math.min(d.percent + 12, 100), d.percent >= 100 && (window.clearInterval(I), $.delete(d.uid), x());
2042
+ }, 120);
2043
+ $.set(d.uid, I);
2044
+ });
2045
+ }
2046
+ function Bt(d) {
2047
+ Se(d);
2048
+ }
2049
+ function Nt(d) {
2050
+ const x = $.get(d.uid);
2051
+ x && (window.clearInterval(x), $.delete(d.uid)), d.url && URL.revokeObjectURL(d.url), i.value = i.value.filter((I) => I.uid !== d.uid), s("remove", d), s("change", i.value);
2052
+ }
2053
+ function jt() {
2054
+ i.value.filter((d) => d.status === "ready" || d.status === "error").forEach(Se);
2055
+ }
2056
+ function Vt() {
2057
+ i.value.forEach((d) => {
2058
+ d.url && URL.revokeObjectURL(d.url);
2059
+ }), i.value = [], s("change", i.value);
2060
+ }
2061
+ function zt(d) {
2062
+ return d.type.startsWith("image/");
2063
+ }
2064
+ function Ut(d) {
2065
+ return d.type.startsWith("video/");
2066
+ }
2067
+ function Wt(d) {
2068
+ return d < 1024 * 1024 ? `${(d / 1024).toFixed(1)}KB` : `${(d / 1024 / 1024).toFixed(1)}MB`;
2069
+ }
2070
+ function qt(d) {
2071
+ return Math.min(Math.max(Math.round(d), 0), 100);
2072
+ }
2073
+ return st(() => {
2074
+ $.forEach((d) => window.clearInterval(d)), i.value.forEach((d) => {
2075
+ d.url && URL.revokeObjectURL(d.url);
2076
+ }), fe();
2077
+ }), a({
2078
+ files: i,
2079
+ submit: jt,
2080
+ clearFiles: Vt
2081
+ }), (d, x) => (P(), E("div", {
2082
+ class: j(b.value),
2083
+ style: Q(_.value)
2084
+ }, [
2085
+ O("div", {
2086
+ class: j(["mo-upload__dropzone", { "has-custom-dropzone": d.$slots.dropzone }]),
2087
+ role: "button",
2088
+ tabindex: "0",
2089
+ onClick: X,
2090
+ onDragenter: x[0] || (x[0] = q((I) => p.value = !0, ["prevent"])),
2091
+ onDragover: x[1] || (x[1] = q((I) => p.value = !0, ["prevent"])),
2092
+ onDragleave: x[2] || (x[2] = q((I) => p.value = !1, ["prevent"])),
2093
+ onDrop: q(Ce, ["prevent"]),
2094
+ onKeydown: [
2095
+ ce(q(X, ["prevent"]), ["enter"]),
2096
+ ce(q(X, ["prevent"]), ["space"])
2097
+ ]
2098
+ }, [
2099
+ O("input", {
2100
+ ref_key: "inputRef",
2101
+ ref: o,
2102
+ class: "mo-upload__input",
2103
+ type: "file",
2104
+ accept: e.accept,
2105
+ multiple: e.multiple,
2106
+ onChange: xe
2107
+ }, null, 40, Ya),
2108
+ d.$slots.dropzone ? B(d.$slots, "dropzone", { key: 0 }) : D("", !0),
2109
+ x[4] || (x[4] = O("div", {
2110
+ class: "mo-upload__icon",
2111
+ "aria-hidden": "true"
2112
+ }, "↑", -1)),
2113
+ x[5] || (x[5] = O("div", { class: "mo-upload__title" }, "拖拽文件到这里", -1)),
2114
+ x[6] || (x[6] = O("div", { class: "mo-upload__action" }, "或点击上传", -1)),
2115
+ O("div", Ga, V(e.hint), 1)
2116
+ ], 42, Xa),
2117
+ i.value.length ? (P(), E("div", Qa, [
2118
+ (P(!0), E(te, null, ve(i.value, (I) => (P(), E("article", {
2119
+ key: I.uid,
2120
+ class: "mo-upload__file"
2121
+ }, [
2122
+ O("div", {
2123
+ class: j(["mo-upload__preview", {
2124
+ "is-crop": e.crop,
2125
+ "is-circle": e.crop && e.cropShape === "circle",
2126
+ "is-square": e.crop && e.cropShape === "square",
2127
+ "is-rect": e.crop && e.cropShape === "rect"
2128
+ }])
2129
+ }, [
2130
+ zt(I) ? (P(), E("img", {
2131
+ key: 0,
2132
+ src: I.url,
2133
+ alt: I.name
2134
+ }, null, 8, Ja)) : Ut(I) ? (P(), E("video", {
2135
+ key: 1,
2136
+ src: I.url,
2137
+ muted: "",
2138
+ preload: "metadata"
2139
+ }, null, 8, Za)) : (P(), E("span", en, "FILE"))
2140
+ ], 2),
2141
+ O("div", tn, [
2142
+ O("div", ln, V(I.name), 1),
2143
+ O("div", an, V(Wt(I.size)), 1),
2144
+ O("div", nn, [
2145
+ O("span", {
2146
+ class: "mo-upload__progress-bar",
2147
+ style: Q({ width: `${I.percent}%` })
2148
+ }, null, 4)
2149
+ ]),
2150
+ O("div", on, [
2151
+ O("span", null, V(I.status === "error" ? I.error || "上传失败" : `${I.percent}%`), 1),
2152
+ I.status === "error" ? (P(), E("button", {
2153
+ key: 0,
2154
+ type: "button",
2155
+ onClick: (L) => Bt(I)
2156
+ }, " 重新上传 ", 8, rn)) : D("", !0)
2157
+ ])
2158
+ ]),
2159
+ O("button", {
2160
+ class: "mo-upload__remove",
2161
+ type: "button",
2162
+ "aria-label": "删除",
2163
+ onClick: (L) => Nt(I)
2164
+ }, " × ", 8, un)
2165
+ ]))), 128))
2166
+ ])) : D("", !0),
2167
+ c.value ? (P(), E("div", sn, [
2168
+ O("div", dn, [
2169
+ O("div", { class: "mo-upload-cropper__header" }, [
2170
+ x[7] || (x[7] = O("strong", null, "裁切图片", -1)),
2171
+ O("button", {
2172
+ type: "button",
2173
+ onClick: fe
2174
+ }, "×")
2175
+ ]),
2176
+ O("div", {
2177
+ class: "mo-upload-cropper__stage",
2178
+ onPointerdown: q(Rt, ["prevent"]),
2179
+ onPointermove: q(Tt, ["prevent"]),
2180
+ onPointerup: q(Ke, ["prevent"]),
2181
+ onPointercancel: q(Ke, ["prevent"]),
2182
+ onWheel: q(Et, ["prevent"])
2183
+ }, [
2184
+ O("img", {
2185
+ ref_key: "cropImageRef",
2186
+ ref: t,
2187
+ class: "mo-upload-cropper__image",
2188
+ src: c.value,
2189
+ alt: "",
2190
+ style: Q(A.value),
2191
+ draggable: "false",
2192
+ onLoad: Mt
2193
+ }, null, 44, cn),
2194
+ O("div", {
2195
+ class: j(["mo-upload-cropper__frame", { "is-circle": e.cropShape === "circle" }])
2196
+ }, null, 2)
2197
+ ], 32),
2198
+ O("label", pn, [
2199
+ x[8] || (x[8] = O("span", null, "缩放", -1)),
2200
+ el(O("input", {
2201
+ "onUpdate:modelValue": x[3] || (x[3] = (I) => r.value = I),
2202
+ type: "range",
2203
+ min: "1",
2204
+ max: "3",
2205
+ step: "0.01"
2206
+ }, null, 512), [
2207
+ [
2208
+ tl,
2209
+ r.value,
2210
+ void 0,
2211
+ { number: !0 }
2212
+ ]
2213
+ ])
2214
+ ]),
2215
+ O("div", { class: "mo-upload-cropper__actions" }, [
2216
+ O("button", {
2217
+ type: "button",
2218
+ onClick: fe
2219
+ }, "取消"),
2220
+ O("button", {
2221
+ type: "button",
2222
+ onClick: Ct
2223
+ }, "确认裁切")
2224
+ ])
2225
+ ])
2226
+ ])) : D("", !0)
2227
+ ], 6));
2228
+ }
2229
+ }), fn = J(vn), mn = [
2230
+ il,
2231
+ hl,
2232
+ gl,
2233
+ xl,
2234
+ Tl,
2235
+ jl,
2236
+ ja,
2237
+ za,
2238
+ qa,
2239
+ Ka,
2240
+ fn
2241
+ ], Sn = {
2242
+ install(e) {
2243
+ mn.forEach((a) => {
2244
+ e.use(a);
2245
+ });
2246
+ }
2247
+ };
2248
+ export {
2249
+ il as MoButton,
2250
+ hl as MoCard,
2251
+ gl as MoCol,
2252
+ xl as MoForm,
2253
+ Tl as MoFormItem,
2254
+ jl as MoInput,
2255
+ ja as MoMenu,
2256
+ za as MoRow,
2257
+ qa as MoSelect,
2258
+ Ka as MoTabs,
2259
+ fn as MoUpload,
2260
+ mn as components,
2261
+ Sn as default,
2262
+ yn as emailRule,
2263
+ wl as isEmail,
2264
+ Oe as isEmpty,
2265
+ Sl as isPhone,
2266
+ bn as isRequired,
2267
+ xn as phoneRule,
2268
+ gn as requiredRule
2269
+ };
2270
+ //# sourceMappingURL=mojo-ui.js.map