@ozdao/prometheus-framework 0.0.87 → 0.0.89

Sign up to get free protection for your applications and to get access to all the features.
Files changed (102) hide show
  1. package/dist/Breadcrumbs.vue_vue_type_style_index_0_lang-300fcb55.js +1 -0
  2. package/dist/Breadcrumbs.vue_vue_type_style_index_0_lang-afba007a.mjs +1944 -0
  3. package/dist/ButtonFollow-001c4a65.mjs +130 -0
  4. package/dist/ButtonFollow-48043cc7.js +1 -0
  5. package/dist/CardHeader-0677d446.js +1 -0
  6. package/dist/CardHeader-e361dada.mjs +96 -0
  7. package/dist/CardOrganization-51309400.js +1 -0
  8. package/dist/CardOrganization-bacc2ef6.mjs +202 -0
  9. package/dist/Feed-4b28adc5.mjs +423 -0
  10. package/dist/Feed-51e4e232.js +1 -0
  11. package/dist/Feed-5d8d5c21.js +1 -0
  12. package/dist/Feed-76b2997e.mjs +367 -0
  13. package/dist/Feed-dc8b66bf.mjs +367 -0
  14. package/dist/Feed-eeb63363.js +1 -0
  15. package/dist/IconEdit-3028a3b7.js +1 -0
  16. package/dist/IconEdit-8df23653.mjs +205 -0
  17. package/dist/Image-30f04604.js +9 -0
  18. package/dist/Image-6c7584f5.mjs +477 -0
  19. package/dist/Image-6ec294f3.mjs +477 -0
  20. package/dist/Image-9a870c88.js +9 -0
  21. package/dist/PlaceholderUserpic-10fd9026.js +1 -0
  22. package/dist/PlaceholderUserpic-eb9820ce.mjs +28 -0
  23. package/dist/Popup-7c331e1c.js +1 -0
  24. package/dist/Popup-bdf043ba.mjs +76 -0
  25. package/dist/Product-1724d88d.mjs +837 -0
  26. package/dist/Product-a94d8b65.js +7 -0
  27. package/dist/Product-b233e2a3.js +7 -0
  28. package/dist/Product-eb00f35e.mjs +837 -0
  29. package/dist/ProductEdit-57484f1e.mjs +349 -0
  30. package/dist/ProductEdit-61413d02.mjs +349 -0
  31. package/dist/ProductEdit-ef301baa.js +1 -0
  32. package/dist/ProductEdit-fca68ff9.js +1 -0
  33. package/dist/ProfileBlogposts-6704a38c.js +1 -0
  34. package/dist/ProfileBlogposts-775b1cfa.mjs +63 -0
  35. package/dist/ProfileComments-175e42da.js +1 -0
  36. package/dist/ProfileComments-fd7d66bf.mjs +43 -0
  37. package/dist/ProfileEvents-1cfe6858.mjs +55 -0
  38. package/dist/ProfileEvents-4f2a5f00.js +1 -0
  39. package/dist/ProfileEvents-7a51a9e6.mjs +55 -0
  40. package/dist/ProfileEvents-d8e16509.js +1 -0
  41. package/dist/ProfileLikes-20a8a3c9.mjs +43 -0
  42. package/dist/ProfileLikes-b3b1350a.js +1 -0
  43. package/dist/ProfileOrganizations-4b866823.mjs +211 -0
  44. package/dist/ProfileOrganizations-6d3a43e4.js +1 -0
  45. package/dist/Publics-0e44c61e.mjs +122 -0
  46. package/dist/Publics-4e1c14fc.js +1 -0
  47. package/dist/Tab-a243605d.mjs +46 -0
  48. package/dist/UploadImage-6e312c46.mjs +83 -0
  49. package/dist/UploadImage-9e7e7468.js +1 -0
  50. package/dist/auth-2bc18d1e.js +8 -0
  51. package/dist/auth-fefd15a3.mjs +1503 -0
  52. package/dist/auth.client.cjs +1 -1
  53. package/dist/auth.client.js +5 -5
  54. package/dist/auth.validation-4a617c0b.mjs +20 -0
  55. package/dist/auth.validation-78a90fed.js +1 -0
  56. package/dist/community.client.cjs +1 -1
  57. package/dist/community.client.js +206 -222
  58. package/dist/components/Field/Field.vue.d.ts.map +1 -1
  59. package/dist/components/FieldPhone/FieldPhone(script-setup).vue.d.ts +3 -3
  60. package/dist/components/FieldPhone/FieldPhone.vue.d.ts +1 -1
  61. package/dist/events.client.cjs +1 -1
  62. package/dist/events.client.js +332 -312
  63. package/dist/events.server.js +77 -0
  64. package/dist/events.server.mjs +77 -0
  65. package/dist/inputs.validation-14e8e01f.mjs +93 -0
  66. package/dist/main.css +1 -1
  67. package/dist/organizations-1581c013.mjs +121 -0
  68. package/dist/organizations-c455dad7.js +1 -0
  69. package/dist/organizations.client-040ec107.js +3 -0
  70. package/dist/organizations.client-686845be.mjs +3179 -0
  71. package/dist/organizations.client-7937e180.mjs +3037 -0
  72. package/dist/organizations.client-99bfc474.js +3 -0
  73. package/dist/organizations.client.cjs +1 -1
  74. package/dist/organizations.client.js +39 -39
  75. package/dist/organizations.server.js +7 -3
  76. package/dist/organizations.server.mjs +7 -3
  77. package/dist/prometheus-framework.cjs.js +1 -1
  78. package/dist/prometheus-framework.es.js +3 -2
  79. package/dist/style.css +1 -1
  80. package/dist/users.client.cjs +1 -1
  81. package/dist/users.client.js +265 -256
  82. package/dist/users.server.js +2 -2
  83. package/dist/users.server.mjs +2 -2
  84. package/package.json +1 -1
  85. package/src/components/Field/Field.vue +2 -1
  86. package/src/modules/community/components/pages/CreateBlogPost.vue +2 -1
  87. package/src/modules/events/components/blocks/CardEvent.vue +1 -1
  88. package/src/modules/events/components/pages/EditEvent.vue +9 -3
  89. package/src/modules/events/components/pages/Event.vue +43 -4
  90. package/src/modules/events/middlewares/server/index.js +10 -0
  91. package/src/modules/events/middlewares/server/verifyEvent.js +60 -0
  92. package/src/modules/events/routes/events.routes.js +14 -1
  93. package/src/modules/organizations/components/blocks/Socials.vue +16 -3
  94. package/src/modules/organizations/components/pages/OrganizationEdit.vue +39 -15
  95. package/src/modules/organizations/components/sections/DetailsTab.vue +13 -9
  96. package/src/modules/organizations/controllers/organizations.controller.js +1 -1
  97. package/src/modules/organizations/models/organization.model.js +6 -2
  98. package/src/modules/organizations/store/organizations.js +2 -2
  99. package/src/modules/users/components/pages/Profile.vue +26 -11
  100. package/src/modules/users/components/pages/ProfileEdit.vue +28 -10
  101. package/src/modules/users/models/user.model.js +2 -2
  102. package/src/modules/users/store/users.js +1 -2
@@ -0,0 +1,1944 @@
1
+ import { withDirectives as $, openBlock as u, createElementBlock as d, vModelText as U, createCommentVNode as f, resolveComponent as J, normalizeClass as y, normalizeStyle as w, createElementVNode as h, Fragment as V, renderList as E, renderSlot as p, toDisplayString as b, createBlock as W, vShow as S, mergeProps as Y, withKeys as c, ref as B, computed as P, createVNode as I, unref as L, withModifiers as g, Transition as K, withCtx as N, createTextVNode as k } from "vue";
2
+ import { g as Q, _ as D } from "./auth-fefd15a3.mjs";
3
+ var X = function e(t, s) {
4
+ if (t === s)
5
+ return !0;
6
+ if (t && s && typeof t == "object" && typeof s == "object") {
7
+ if (t.constructor !== s.constructor)
8
+ return !1;
9
+ var l, a, r;
10
+ if (Array.isArray(t)) {
11
+ if (l = t.length, l != s.length)
12
+ return !1;
13
+ for (a = l; a-- !== 0; )
14
+ if (!e(t[a], s[a]))
15
+ return !1;
16
+ return !0;
17
+ }
18
+ if (t.constructor === RegExp)
19
+ return t.source === s.source && t.flags === s.flags;
20
+ if (t.valueOf !== Object.prototype.valueOf)
21
+ return t.valueOf() === s.valueOf();
22
+ if (t.toString !== Object.prototype.toString)
23
+ return t.toString() === s.toString();
24
+ if (r = Object.keys(t), l = r.length, l !== Object.keys(s).length)
25
+ return !1;
26
+ for (a = l; a-- !== 0; )
27
+ if (!Object.prototype.hasOwnProperty.call(s, r[a]))
28
+ return !1;
29
+ for (a = l; a-- !== 0; ) {
30
+ var i = r[a];
31
+ if (!e(t[i], s[i]))
32
+ return !1;
33
+ }
34
+ return !0;
35
+ }
36
+ return t !== t && s !== s;
37
+ };
38
+ const Z = /* @__PURE__ */ Q(X), x = (e, t) => t.filter((s) => {
39
+ const { text: l } = e;
40
+ if (typeof s.rule == "string")
41
+ return !new RegExp(s.rule).test(l);
42
+ if (s.rule instanceof RegExp)
43
+ return !s.rule.test(l);
44
+ if ({}.toString.call(s.rule) === "[object Function]")
45
+ return s.rule(e);
46
+ }).map((s) => s.classes), O = (e) => JSON.parse(JSON.stringify(e)), _ = (e, t) => {
47
+ let s = 0;
48
+ for (; s < e.length; ) {
49
+ if (t(e[s], s, e))
50
+ return s;
51
+ s++;
52
+ }
53
+ return -1;
54
+ }, j = (e, t, s = [], l) => {
55
+ e.text === void 0 && (e = { text: e });
56
+ const a = x(e, s), r = _(t, (m) => m === e), i = O(t), n = r !== -1 ? i.splice(r, 1)[0] : O(e);
57
+ return (l ? l(i, n) : i.map((m) => m.text).indexOf(n.text) !== -1) && a.push("ti-duplicate"), a.length === 0 ? a.push("ti-valid") : a.push("ti-invalid"), a;
58
+ }, C = (e, ...t) => {
59
+ e.text === void 0 && (e = { text: e });
60
+ const s = O(e);
61
+ return s.tiClasses = j(e, ...t), s;
62
+ }, ee = (e, ...t) => e.map((s) => C(s, e, ...t));
63
+ const te = {
64
+ name: "TagInput",
65
+ props: {
66
+ scope: {
67
+ type: Object
68
+ }
69
+ }
70
+ }, se = ["maxlength"];
71
+ function ie(e, t, s, l, a, r) {
72
+ return s.scope.edit ? $((u(), d("input", {
73
+ key: 0,
74
+ "onUpdate:modelValue": t[0] || (t[0] = (i) => s.scope.tag.text = i),
75
+ maxlength: s.scope.maxlength,
76
+ type: "text",
77
+ class: "ti-tag-input",
78
+ size: "1",
79
+ onInput: t[1] || (t[1] = (i) => s.scope.validateTag(s.scope.index, i)),
80
+ onBlur: t[2] || (t[2] = (i) => s.scope.performCancelEdit(s.scope.index)),
81
+ onKeydown: t[3] || (t[3] = (i) => s.scope.performSaveEdit(s.scope.index, i))
82
+ }, null, 40, se)), [
83
+ [U, s.scope.tag.text]
84
+ ]) : f("", !0);
85
+ }
86
+ const le = /* @__PURE__ */ D(te, [["render", ie], ["__scopeId", "data-v-a1f1c345"]]), R = (e) => !e.some((t) => {
87
+ const s = !t.text;
88
+ s && console.warn('Missing property "text"', t);
89
+ let l = !1;
90
+ return t.classes && (l = typeof t.classes != "string"), l && console.warn('Property "classes" must be type of string', t), s || l;
91
+ }), H = (e) => !e.some((t) => {
92
+ if (typeof t == "number") {
93
+ const s = isFinite(t) && Math.floor(t) === t;
94
+ return s || console.warn("Only numerics are allowed for this prop. Found:", t), !s;
95
+ } else if (typeof t == "string") {
96
+ const s = /\W|[a-z]|!\d/i.test(t);
97
+ return s || console.warn("Only alpha strings are allowed for this prop. Found:", t), !s;
98
+ } else
99
+ return console.warn("Only numeric and string values are allowed. Found:", t), !1;
100
+ }), ae = {
101
+ /**
102
+ * @description Property to bind a model to the input.
103
+ If the user changes the input value, the model updates, too.
104
+ If the user presses enter with an valid input,
105
+ a new tag is created with the value of this model.
106
+ After creating the new tag, the model is cleared.
107
+ * @property {props}
108
+ * @required
109
+ * @type {String}
110
+ * @model
111
+ * @default ''
112
+ */
113
+ modelValue: {
114
+ type: String,
115
+ default: "",
116
+ required: !0
117
+ },
118
+ /**
119
+ * @description Pass an array containing objects like in the example below.
120
+ The properties 'style' and 'class' are optional. Of course it is possible to add custom
121
+ properties to a tag object. vue-tags-input won't change the key and value.
122
+ * @property {props}
123
+ * @type {Array}
124
+ * @sync
125
+ * @default []
126
+ * @example
127
+ {
128
+ &emsp;text: 'My tag value', &#47;* The visible text on display *&#47;
129
+ &emsp;style: 'background-color: #ccc', &#47;* Adding inline styles is possible *&#47;
130
+ &emsp;classes: 'custom-class another', &#47;* The value will be added as css classes *&#47;
131
+ }
132
+ */
133
+ tags: {
134
+ type: Array,
135
+ default: () => [],
136
+ validator: R
137
+ },
138
+ /**
139
+ * @description Expects an array containing objects inside. The objects
140
+ can have the same properties as a tag object.
141
+ * @property {props}
142
+ * @type {Array}
143
+ * @default []
144
+ */
145
+ autocompleteItems: {
146
+ type: Array,
147
+ default: () => [],
148
+ validator: R
149
+ },
150
+ /**
151
+ * @description Defines whether a tag is editable after creation or not.
152
+ * @property {props}
153
+ * @type {Boolean}
154
+ * @default false
155
+ */
156
+ allowEditTags: {
157
+ type: Boolean,
158
+ default: !1
159
+ },
160
+ /**
161
+ * @description Defines if duplicate autocomplete items are filtered out from the view or not.
162
+ * @property {props}
163
+ * @type {Boolean}
164
+ * @default true
165
+ */
166
+ autocompleteFilterDuplicates: {
167
+ default: !0,
168
+ type: Boolean
169
+ },
170
+ /**
171
+ * @description If it's true, the user can add tags only via the autocomplete layer.
172
+ * @property {props}
173
+ * @type {Boolean}
174
+ * @default false
175
+ */
176
+ addOnlyFromAutocomplete: {
177
+ type: Boolean,
178
+ default: !1
179
+ },
180
+ /**
181
+ * @description The minimum character length which is required
182
+ until the autocomplete layer is shown. If set to 0,
183
+ then it'll be shown on focus.
184
+ * @property {props}
185
+ * @type {Number}
186
+ * @default 1
187
+ */
188
+ autocompleteMinLength: {
189
+ type: Number,
190
+ default: 1
191
+ },
192
+ /**
193
+ * @description If it's true, the autocomplete layer is always shown, regardless if
194
+ an input or an autocomplete items exists.
195
+ * @property {props}
196
+ * @type {Boolean}
197
+ * @default false
198
+ */
199
+ autocompleteAlwaysOpen: {
200
+ type: Boolean,
201
+ default: !1
202
+ },
203
+ /**
204
+ * @description Property to disable vue-tags-input.
205
+ * @property {props}
206
+ * @type {Boolean}
207
+ * @default false
208
+ */
209
+ disabled: {
210
+ type: Boolean,
211
+ default: !1
212
+ },
213
+ /**
214
+ * @description The placeholder text which is shown in the input, when it's empty.
215
+ * @property {props}
216
+ * @type {String}
217
+ * @default Add Tag
218
+ */
219
+ placeholder: {
220
+ type: String,
221
+ default: "Add Tag"
222
+ },
223
+ /**
224
+ * @description Custom trigger key codes can be registrated. If the user presses one of these,
225
+ a tag will be generated out of the input value. Can be either a numeric keyCode or the key
226
+ as a string.
227
+ * @property {props}
228
+ * @type {Array}
229
+ * @default [13]
230
+ * @example add-on-key="[13, ':', ';']"
231
+ */
232
+ addOnKey: {
233
+ type: Array,
234
+ default: () => [13],
235
+ validator: H
236
+ },
237
+ /**
238
+ * @description Custom trigger key codes can be registrated. If the user edits a tag
239
+ and presses one of these, the edited tag will be saved.
240
+ Can be either a numeric keyCode or the key as a string.
241
+ * @property {props}
242
+ * @type {Array}
243
+ * @default [13]
244
+ * @example save-on-key="[13, ':', ';']"
245
+ */
246
+ saveOnKey: {
247
+ type: Array,
248
+ default: () => [13],
249
+ validator: H
250
+ },
251
+ /**
252
+ * @description The maximum amount the tags array is allowed to hold.
253
+ * @property {props}
254
+ * @type {Number}
255
+ */
256
+ maxTags: {
257
+ type: Number
258
+ },
259
+ /**
260
+ * @description The maximum amount of characters the input is allowed to hold.
261
+ * @property {props}
262
+ * @type {Number}
263
+ */
264
+ maxlength: {
265
+ type: Number
266
+ },
267
+ /**
268
+ * @description Pass an array containing objects like in the example below.
269
+ The property 'classes' will be added as css classes, if the property 'rule' matches the text
270
+ of a tag, an autocomplete item or the input. The property 'rule' can be type of
271
+ RegExp or function. If the property 'disableAdd' is 'true', the item can't be added
272
+ to the tags array, if the appropriated rule matches.
273
+ * @property {props}
274
+ * @type {Array}
275
+ * @default []
276
+ * @example
277
+ {
278
+ &ensp;classes: 'class', &#47;* css class *&#47;
279
+ &ensp;rule: /^([^0-9]*)$/, &#47;* RegExp *&#47;
280
+ }, {
281
+ &ensp;classes: 'no-braces', &#47;* css class *&#47;
282
+ &ensp;rule(text) { &#47;* function with text as param *&#47;
283
+ &ensp;&ensp;return text.indexOf('{') !== -1 || text.indexOf('}') !== -1;
284
+ &ensp;},
285
+ &ensp;disableAdd: true, &#47;* if the rule matches, the item cannot be added *&#47;,
286
+ },
287
+ */
288
+ validation: {
289
+ type: Array,
290
+ default: () => [],
291
+ validator(e) {
292
+ return !e.some((t) => {
293
+ const s = !t.rule;
294
+ s && console.warn('Property "rule" is missing', t);
295
+ const l = t.rule && (typeof t.rule == "string" || t.rule instanceof RegExp || {}.toString.call(t.rule) === "[object Function]");
296
+ l || console.warn(
297
+ "A rule must be type of string, RegExp or function. Found:",
298
+ JSON.stringify(t.rule)
299
+ );
300
+ const a = !t.classes;
301
+ a && console.warn('Property "classes" is missing', t);
302
+ const r = t.type && typeof t.type != "string";
303
+ return r && console.warn('Property "type" must be type of string. Found:', t), !l || s || a || r;
304
+ });
305
+ }
306
+ },
307
+ /**
308
+ * @description Defines the characters which splits a text into different pieces,
309
+ to generate tags out of this pieces.
310
+ * @property {props}
311
+ * @type {Array}
312
+ * @default [';']
313
+ * @example
314
+ separators: [';', ',']
315
+ input: some; user input, has random; commas, an,d semicolons
316
+ will split into: some - user input - has random - commas - an - d semicolons
317
+ */
318
+ separators: {
319
+ type: Array,
320
+ default: () => [";"],
321
+ validator(e) {
322
+ return !e.some((t) => {
323
+ const s = typeof t != "string";
324
+ return s && console.warn("Separators must be type of string. Found:", t), s;
325
+ });
326
+ }
327
+ },
328
+ /**
329
+ * @description If it's true, the user can't add or save a tag,
330
+ if another exists, with the same text value.
331
+ * @property {props}
332
+ * @type {Boolean}
333
+ * @default true
334
+ */
335
+ avoidAddingDuplicates: {
336
+ type: Boolean,
337
+ default: !0
338
+ },
339
+ /**
340
+ * @description If the input holds a value and loses the focus,
341
+ a tag will be generated out of this value, if possible.
342
+ * @property {props}
343
+ * @type {Boolean}
344
+ * @default true
345
+ */
346
+ addOnBlur: {
347
+ type: Boolean,
348
+ default: !0
349
+ },
350
+ /**
351
+ * @description Custom function to detect duplicates. If the function returns 'true',
352
+ the tag will be marked as duplicate.
353
+ * @property {props}
354
+ * @type {Function}
355
+ * @param {Array} tagsarray The Array of tags minus the one which is edited/created.
356
+ * @param {Object} tag The tag which is edited or should be added to the tags array.
357
+ * @example
358
+ // The duplicate function to recreate the default behaviour, would look like this:
359
+ isDuplicate(tags, tag) {
360
+ &ensp;return tags.map(t => t.text).indexOf(tag.text) !== -1;
361
+ }
362
+ */
363
+ isDuplicate: {
364
+ type: Function,
365
+ default: null
366
+ },
367
+ /**
368
+ * @description If it's true, the user can paste into the input element and
369
+ vue-tags-input will create tags out of the incoming text.
370
+ * @property {props}
371
+ * @type {Boolean}
372
+ * @default true
373
+ */
374
+ addFromPaste: {
375
+ type: Boolean,
376
+ default: !0
377
+ },
378
+ /**
379
+ * @description Defines if it's possible to delete tags by pressing backspace.
380
+ If so and the user wants to delete a tag,
381
+ the tag gets the css class 'deletion-mark' for 1 second.
382
+ If the user presses backspace again in that time period,
383
+ the tag is removed from the tags array and the view.
384
+ * @property {props}
385
+ * @type {Boolean}
386
+ * @default true
387
+ */
388
+ deleteOnBackspace: {
389
+ default: !0,
390
+ type: Boolean
391
+ },
392
+ // event handlers
393
+ onBeforeAddingTag: Function,
394
+ onBeforeDeletingTag: Function,
395
+ onBeforeEditingTag: Function,
396
+ onBeforeSavingTag: Function
397
+ }, ne = {
398
+ name: "VueTagsInput",
399
+ components: { TagInput: le },
400
+ props: ae,
401
+ emits: [
402
+ "adding-duplicate",
403
+ "before-adding-tag",
404
+ "before-deleting-tag",
405
+ "before-editing-tag",
406
+ "before-saving-tag",
407
+ "max-tags-reached",
408
+ "saving-duplicate",
409
+ "tags-changed",
410
+ "tag-clicked",
411
+ "update:modelValue",
412
+ "update:tags"
413
+ ],
414
+ inheritAttrs: !1,
415
+ data() {
416
+ return {
417
+ tagCenter: [],
418
+ newTag: null,
419
+ tagsCopy: [],
420
+ tagsEditStatus: null,
421
+ deletionMark: null,
422
+ deletionMarkTime: null,
423
+ selectedItem: null,
424
+ focused: null
425
+ };
426
+ },
427
+ computed: {
428
+ // Property which calculates if the autocomplete should be opened or not
429
+ autocompleteOpen() {
430
+ return this.autocompleteAlwaysOpen ? !0 : this.newTag !== null && this.newTag.length >= this.autocompleteMinLength && this.filteredAutocompleteItems.length > 0 && this.focused;
431
+ },
432
+ // Returns validated autocomplete items. Maybe duplicates are filtered out
433
+ filteredAutocompleteItems() {
434
+ const e = this.autocompleteItems.map((t) => C(t, this.tags, this.validation, this.isDuplicate));
435
+ return this.autocompleteFilterDuplicates ? e.filter(this.duplicateFilter) : e;
436
+ }
437
+ },
438
+ methods: {
439
+ createClasses: j,
440
+ // Returns the index which item should be selected, based on the parameter 'method'
441
+ getSelectedIndex(e) {
442
+ const t = this.filteredAutocompleteItems, s = this.selectedItem, l = t.length - 1;
443
+ if (t.length !== 0)
444
+ return s === null ? 0 : e === "before" && s === 0 ? l : e === "after" && s === l ? 0 : e === "after" ? s + 1 : s - 1;
445
+ },
446
+ selectDefaultItem() {
447
+ this.addOnlyFromAutocomplete && this.filteredAutocompleteItems.length > 0 ? this.selectedItem = 0 : this.selectedItem = null;
448
+ },
449
+ selectItem(e, t) {
450
+ e.preventDefault(), this.selectedItem = this.getSelectedIndex(t);
451
+ },
452
+ isSelected(e) {
453
+ return this.selectedItem === e;
454
+ },
455
+ isMarked(e) {
456
+ return this.deletionMark === e;
457
+ },
458
+ // Save ref for tag
459
+ setTagCenter(e) {
460
+ e && this.tagCenter.push(e);
461
+ },
462
+ // Method which is called when the user presses backspace → remove the last tag
463
+ invokeDelete() {
464
+ if (!this.deleteOnBackspace || this.newTag.length > 0)
465
+ return;
466
+ const e = this.tagsCopy.length - 1;
467
+ this.deletionMark === null ? (this.deletionMarkTime = setTimeout(() => this.deletionMark = null, 1e3), this.deletionMark = e) : this.performDeleteTag(e);
468
+ },
469
+ addTagsFromPaste() {
470
+ this.addFromPaste && setTimeout(() => this.performAddTags(this.newTag), 10);
471
+ },
472
+ // Method to call if a tag should switch to it's edit mode
473
+ performEditTag(e) {
474
+ this.allowEditTags && (this.onBeforeAddingTag || this.editTag(e), this.$emit("before-editing-tag", {
475
+ index: e,
476
+ tag: this.tagsCopy[e],
477
+ editTag: () => this.editTag(e)
478
+ }));
479
+ },
480
+ // Opens the edit mode for a tag and focuses it
481
+ editTag(e) {
482
+ this.allowEditTags && (this.toggleEditMode(e), this.focus(e));
483
+ },
484
+ // Toggles the edit mode for a tag
485
+ toggleEditMode(e) {
486
+ !this.allowEditTags || this.disabled || (this.tagsEditStatus[e] = !this.tagsEditStatus[e]);
487
+ },
488
+ // only called by the @input event from TagInput.
489
+ // Creates a new tag model and applys it to this.tagsCopy[index]
490
+ createChangedTag(e, t) {
491
+ const s = this.tagsCopy[e];
492
+ s.text = t ? t.target.value : this.tagsCopy[e].text, this.tagsCopy[e] = C(s, this.tagsCopy, this.validation, this.isDuplicate);
493
+ },
494
+ // Focuses the input of a tag
495
+ focus(e) {
496
+ this.$nextTick(() => {
497
+ const t = this.tagCenter[e].querySelector("input.ti-tag-input");
498
+ t && t.focus();
499
+ });
500
+ },
501
+ quote(e) {
502
+ return e.replace(/([()[{*+.$^\\|?])/g, "\\$1");
503
+ },
504
+ // Cancels the edit mode for a tag → resets the tag to it's original model!
505
+ cancelEdit(e) {
506
+ this.tags[e] && (this.tagsCopy[e] = O(
507
+ C(this.tags[e], this.tags, this.validation, this.isDuplicate)
508
+ ), this.tagsEditStatus[e] = !1);
509
+ },
510
+ hasForbiddingAddRule(e) {
511
+ return e.some((t) => {
512
+ const s = this.validation.find((l) => t === l.classes);
513
+ return s ? s.disableAdd : !1;
514
+ });
515
+ },
516
+ // Creates multiple tags out of a string, based on the prop separators
517
+ createTagTexts(e) {
518
+ const t = new RegExp(this.separators.map((s) => this.quote(s)).join("|"));
519
+ return e.split(t).map((s) => ({ text: s }));
520
+ },
521
+ // Method to call to delete a tag
522
+ performDeleteTag(e) {
523
+ this.onBeforeDeletingTag || this.deleteTag(e), this.$emit("before-deleting-tag", {
524
+ index: e,
525
+ tag: this.tagsCopy[e],
526
+ deleteTag: () => this.deleteTag(e)
527
+ });
528
+ },
529
+ deleteTag(e) {
530
+ this.disabled || (this.deletionMark = null, clearTimeout(this.deletionMarkTime), this.tagsCopy.splice(e, 1), this.$emit("update:tags", this.tagsCopy), this.$emit("tags-changed", this.tagsCopy));
531
+ },
532
+ // Decides wether the input keyCode is one, which is allowed to modify/add tags
533
+ noTriggerKey(e, t) {
534
+ const s = this[t].indexOf(e.keyCode) !== -1 || this[t].indexOf(e.key) !== -1;
535
+ return s && e.preventDefault(), !s;
536
+ },
537
+ // Method to call to add a tag
538
+ performAddTags(e, t, s) {
539
+ if (this.disabled || t && this.noTriggerKey(t, "addOnKey"))
540
+ return;
541
+ let l = [];
542
+ typeof e == "object" && (l = [e]), typeof e == "string" && (l = this.createTagTexts(e)), l = l.filter((a) => a.text.trim().length > 0), l.forEach((a) => {
543
+ a = C(a, this.tags, this.validation, this.isDuplicate), this.onBeforeAddingTag || this.addTag(a, s), this.$emit("before-adding-tag", {
544
+ tag: a,
545
+ addTag: () => this.addTag(a, s)
546
+ });
547
+ });
548
+ },
549
+ duplicateFilter(e) {
550
+ return this.isDuplicate ? !this.isDuplicate(this.tagsCopy, e) : !this.tagsCopy.find((t) => t.text === e.text);
551
+ },
552
+ addTag(e, t = "new-tag-input") {
553
+ const s = this.filteredAutocompleteItems.map((l) => l.text);
554
+ this.addOnlyFromAutocomplete && s.indexOf(e.text) === -1 || this.$nextTick(() => {
555
+ if (this.maxTags && this.maxTags <= this.tagsCopy.length)
556
+ return this.$emit("max-tags-reached", e);
557
+ if (this.avoidAddingDuplicates && !this.duplicateFilter(e))
558
+ return this.$emit("adding-duplicate", e);
559
+ this.hasForbiddingAddRule(e.tiClasses) || (this.newTag = "", this.tagsCopy.push(e), this.$emit("update:tags", this.tagsCopy), t === "autocomplete" && this.$refs.newTagInput.focus(), this.$emit("tags-changed", this.tagsCopy));
560
+ });
561
+ },
562
+ // Method to call to save a tag
563
+ performSaveTag(e, t) {
564
+ const s = this.tagsCopy[e];
565
+ this.disabled || t && this.noTriggerKey(t, "addOnKey") || s.text.trim().length !== 0 && (this["on-before-saving-tag"] || this.saveTag(e, s), this.$emit("before-saving-tag", {
566
+ index: e,
567
+ tag: s,
568
+ saveTag: () => this.saveTag(e, s)
569
+ }));
570
+ },
571
+ saveTag(e, t) {
572
+ if (this.avoidAddingDuplicates) {
573
+ const s = O(this.tagsCopy), l = s.splice(e, 1)[0];
574
+ if (this.isDuplicate ? this.isDuplicate(s, l) : s.map((r) => r.text).indexOf(l.text) !== -1)
575
+ return this.$emit("saving-duplicate", t);
576
+ }
577
+ this.hasForbiddingAddRule(t.tiClasses) || (this.tagsCopy[e] = t, this.toggleEditMode(e), this.$emit("update:tags", this.tagsCopy), this.$emit("tags-changed", this.tagsCopy));
578
+ },
579
+ tagsEqual() {
580
+ return !this.tagsCopy.some((e, t) => !Z(e, this.tags[t]));
581
+ },
582
+ updateNewTag(e) {
583
+ const t = e.target.value;
584
+ this.newTag = t, this.$emit("update:modelValue", t);
585
+ },
586
+ initTags() {
587
+ this.tagsCopy = ee(this.tags, this.validation, this.isDuplicate), this.tagsEditStatus = O(this.tags).map(() => !1), this.tagsEqual() || this.$emit("update:tags", this.tagsCopy);
588
+ },
589
+ blurredOnClick(e) {
590
+ this.$el.contains(e.target) || this.$el.contains(document.activeElement) || this.performBlur(e);
591
+ },
592
+ performBlur() {
593
+ this.addOnBlur && this.focused && this.performAddTags(this.newTag), this.focused = !1;
594
+ }
595
+ },
596
+ watch: {
597
+ modelValue(e) {
598
+ this.addOnlyFromAutocomplete || (this.selectedItem = null), this.newTag = e;
599
+ },
600
+ tags: {
601
+ handler() {
602
+ this.initTags();
603
+ },
604
+ deep: !0
605
+ },
606
+ autocompleteOpen: "selectDefaultItem"
607
+ },
608
+ created() {
609
+ this.newTag = this.modelValue, this.initTags();
610
+ },
611
+ mounted() {
612
+ this.selectDefaultItem(), document.addEventListener("click", this.blurredOnClick);
613
+ },
614
+ beforeUpdate() {
615
+ this.tagCenter = [];
616
+ },
617
+ unmounted() {
618
+ document.removeEventListener("click", this.blurredOnClick);
619
+ }
620
+ };
621
+ const re = { class: "ti-input" }, oe = {
622
+ key: 0,
623
+ class: "ti-tags"
624
+ }, ue = ["onClick"], de = { class: "ti-content" }, he = {
625
+ key: 0,
626
+ class: "ti-tag-left"
627
+ }, pe = ["onClick"], ge = {
628
+ key: 1,
629
+ class: "ti-tag-right"
630
+ }, fe = { class: "ti-actions" }, ce = ["onClick"], me = ["onClick"], ye = { class: "ti-new-tag-input-wrapper" }, be = ["placeholder", "value", "maxlength", "disabled"], ve = ["onMouseover"], Te = ["onClick"];
631
+ function $e(e, t, s, l, a, r) {
632
+ const i = J("tag-input");
633
+ return u(), d("div", {
634
+ class: y(["vue-tags-input", [{ "ti-disabled": e.disabled }, { "ti-focus": e.focused }, e.$attrs.class]]),
635
+ style: w(e.$attrs.style)
636
+ }, [
637
+ h("div", re, [
638
+ e.tagsCopy ? (u(), d("ul", oe, [
639
+ (u(!0), d(V, null, E(e.tagsCopy, (n, o) => (u(), d("li", {
640
+ key: o,
641
+ style: w(n.style),
642
+ class: y([[
643
+ { "ti-editing": e.tagsEditStatus[o] },
644
+ n.tiClasses,
645
+ n.classes,
646
+ { "ti-deletion-mark": e.isMarked(o) }
647
+ ], "ti-tag"]),
648
+ tabindex: "0",
649
+ onClick: (m) => e.$emit("tag-clicked", { tag: n, index: o })
650
+ }, [
651
+ h("div", de, [
652
+ e.$slots["tag-left"] ? (u(), d("div", he, [
653
+ p(e.$slots, "tag-left", {
654
+ tag: n,
655
+ index: o,
656
+ edit: e.tagsEditStatus[o],
657
+ performSaveEdit: e.performSaveTag,
658
+ performDelete: e.performDeleteTag,
659
+ performCancelEdit: e.cancelEdit,
660
+ performOpenEdit: e.performEditTag,
661
+ deletionMark: e.isMarked(o)
662
+ }, void 0, !0)
663
+ ])) : f("", !0),
664
+ h("div", {
665
+ ref_for: !0,
666
+ ref: e.setTagCenter,
667
+ class: "ti-tag-center"
668
+ }, [
669
+ e.$slots["tag-center"] ? f("", !0) : (u(), d("span", {
670
+ key: 0,
671
+ class: y({ "ti-hidden": e.tagsEditStatus[o] }),
672
+ onClick: (m) => e.performEditTag(o)
673
+ }, b(n.text), 11, pe)),
674
+ e.$slots["tag-center"] ? f("", !0) : (u(), W(i, {
675
+ key: 1,
676
+ scope: {
677
+ edit: e.tagsEditStatus[o],
678
+ maxlength: e.maxlength,
679
+ tag: n,
680
+ index: o,
681
+ validateTag: e.createChangedTag,
682
+ performCancelEdit: e.cancelEdit,
683
+ performSaveEdit: e.performSaveTag
684
+ }
685
+ }, null, 8, ["scope"])),
686
+ p(e.$slots, "tag-center", {
687
+ tag: n,
688
+ index: o,
689
+ maxlength: e.maxlength,
690
+ edit: e.tagsEditStatus[o],
691
+ performSaveEdit: e.performSaveTag,
692
+ performDelete: e.performDeleteTag,
693
+ performCancelEdit: e.cancelEdit,
694
+ validateTag: e.createChangedTag,
695
+ performOpenEdit: e.performEditTag,
696
+ deletionMark: e.isMarked(o)
697
+ }, void 0, !0)
698
+ ], 512),
699
+ e.$slots["tag-right"] ? (u(), d("div", ge, [
700
+ p(e.$slots, "tag-right", {
701
+ tag: n,
702
+ index: o,
703
+ edit: e.tagsEditStatus[o],
704
+ performSaveEdit: e.performSaveTag,
705
+ performDelete: e.performDeleteTag,
706
+ performCancelEdit: e.cancelEdit,
707
+ performOpenEdit: e.performEditTag,
708
+ deletionMark: e.isMarked(o)
709
+ }, void 0, !0)
710
+ ])) : f("", !0)
711
+ ]),
712
+ h("div", fe, [
713
+ e.$slots["tag-actions"] ? f("", !0) : $((u(), d("i", {
714
+ key: 0,
715
+ class: "ti-icon-undo",
716
+ onClick: (m) => e.cancelEdit(o)
717
+ }, null, 8, ce)), [
718
+ [S, e.tagsEditStatus[o]]
719
+ ]),
720
+ e.$slots["tag-actions"] ? f("", !0) : $((u(), d("i", {
721
+ key: 1,
722
+ class: "ti-icon-close",
723
+ onClick: (m) => e.performDeleteTag(o)
724
+ }, null, 8, me)), [
725
+ [S, !e.tagsEditStatus[o]]
726
+ ]),
727
+ e.$slots["tag-actions"] ? p(e.$slots, "tag-actions", {
728
+ key: 2,
729
+ tag: n,
730
+ index: o,
731
+ edit: e.tagsEditStatus[o],
732
+ performSaveEdit: e.performSaveTag,
733
+ performDelete: e.performDeleteTag,
734
+ performCancelEdit: e.cancelEdit,
735
+ performOpenEdit: e.performEditTag,
736
+ deletionMark: e.isMarked(o)
737
+ }, void 0, !0) : f("", !0)
738
+ ])
739
+ ], 14, ue))), 128)),
740
+ h("li", ye, [
741
+ h("input", Y({ ref: "newTagInput" }, e.$attrs, {
742
+ class: [[e.createClasses(e.newTag, e.tags, e.validation, e.isDuplicate)], "ti-new-tag-input"],
743
+ placeholder: e.placeholder,
744
+ value: e.newTag,
745
+ maxlength: e.maxlength,
746
+ disabled: e.disabled,
747
+ type: "text",
748
+ size: "1",
749
+ onKeydown: [
750
+ t[0] || (t[0] = (n) => e.performAddTags(
751
+ e.filteredAutocompleteItems[e.selectedItem] || e.newTag,
752
+ n
753
+ )),
754
+ t[2] || (t[2] = c((...n) => e.invokeDelete && e.invokeDelete(...n), ["delete"])),
755
+ t[3] || (t[3] = c((...n) => e.performBlur && e.performBlur(...n), ["tab"])),
756
+ t[4] || (t[4] = c((n) => e.selectItem(n, "before"), ["up"])),
757
+ t[5] || (t[5] = c((n) => e.selectItem(n, "after"), ["down"]))
758
+ ],
759
+ onPaste: t[1] || (t[1] = (...n) => e.addTagsFromPaste && e.addTagsFromPaste(...n)),
760
+ onInput: t[6] || (t[6] = (...n) => e.updateNewTag && e.updateNewTag(...n)),
761
+ onFocus: t[7] || (t[7] = (n) => e.focused = !0),
762
+ onClick: t[8] || (t[8] = (n) => e.addOnlyFromAutocomplete ? !1 : e.selectedItem = null)
763
+ }), null, 16, be)
764
+ ])
765
+ ])) : f("", !0)
766
+ ]),
767
+ p(e.$slots, "between-elements", {}, void 0, !0),
768
+ e.autocompleteOpen ? (u(), d("div", {
769
+ key: 0,
770
+ class: y(["ti-autocomplete", e.$attrs.class]),
771
+ onMouseout: t[9] || (t[9] = (n) => e.selectedItem = null)
772
+ }, [
773
+ p(e.$slots, "autocomplete-header", {}, void 0, !0),
774
+ h("ul", null, [
775
+ (u(!0), d(V, null, E(e.filteredAutocompleteItems, (n, o) => (u(), d("li", {
776
+ key: o,
777
+ style: w(n.style),
778
+ class: y([[
779
+ n.tiClasses,
780
+ n.classes,
781
+ { "ti-selected-item": e.isSelected(o) }
782
+ ], "ti-item"]),
783
+ onMouseover: (m) => e.disabled ? !1 : e.selectedItem = o
784
+ }, [
785
+ e.$slots["autocomplete-item"] ? p(e.$slots, "autocomplete-item", {
786
+ key: 1,
787
+ item: n,
788
+ index: o,
789
+ performAdd: (m) => e.performAddTags(m, void 0, "autocomplete"),
790
+ selected: e.isSelected(o)
791
+ }, void 0, !0) : (u(), d("div", {
792
+ key: 0,
793
+ onClick: (m) => e.performAddTags(n, void 0, "autocomplete")
794
+ }, b(n.text), 9, Te))
795
+ ], 46, ve))), 128))
796
+ ]),
797
+ p(e.$slots, "autocomplete-footer", {}, void 0, !0)
798
+ ], 34)) : f("", !0)
799
+ ], 6);
800
+ }
801
+ const Se = /* @__PURE__ */ D(ne, [["render", $e], ["__scopeId", "data-v-d14eec25"]]);
802
+ const we = /* @__PURE__ */ h("h5", { class: "mn-thin" }, "Tags (maximum 20):", -1), Oe = { class: "mn-medium" }, ke = /* @__PURE__ */ h("p", { class: "p-small mn-thin" }, "Suggested:", -1), Ce = ["onClick"], Ve = { key: 1 }, at = {
803
+ __name: "BlockTags",
804
+ props: ["tags"],
805
+ emits: ["tags-changed"],
806
+ setup(e, { emit: t }) {
807
+ const s = e, l = B(""), a = B([]), r = B([
808
+ { text: "story" },
809
+ { text: "news" },
810
+ { text: "guide" },
811
+ { text: "discussion" },
812
+ { text: "photos" }
813
+ ]);
814
+ s.tags && (a.value = s.tags.map((v) => ({ text: v })));
815
+ const i = P(() => r.value.filter((v) => v.text.toLowerCase().includes(l.value.toLowerCase()))), n = P(() => r.value.filter((v) => !a.value.some((T) => T.text === v.text)));
816
+ function o(v) {
817
+ a.value.push(v), t("tags-changed", a.value.map((T) => T.text));
818
+ }
819
+ function m(v) {
820
+ a.value = v, t("tags-changed", a.value.map((T) => T.text));
821
+ }
822
+ return (v, T) => (u(), d("div", null, [
823
+ we,
824
+ I(Se, {
825
+ modelValue: l.value,
826
+ "onUpdate:modelValue": T[0] || (T[0] = (A) => l.value = A),
827
+ tags: a.value,
828
+ "autocomplete-items": L(i),
829
+ "add-on-key": [13, ":", ";", ","],
830
+ "save-on-key": [13, ":", ";", ","],
831
+ separators: [";", ","],
832
+ "max-tags": 20,
833
+ maxlength: 20,
834
+ placeholder: "Please add tags",
835
+ "add-from-paste": !0,
836
+ "allow-edit-tags": !0,
837
+ onTagsChanged: m,
838
+ class: "mn-thin bg-grey radius-medium pd-small"
839
+ }, null, 8, ["modelValue", "tags", "autocomplete-items"]),
840
+ h("p", Oe, [
841
+ ke,
842
+ L(n).length > 0 ? (u(!0), d(V, { key: 0 }, E(L(n), (A, z) => (u(), d("span", {
843
+ onClick: (st) => o(A),
844
+ class: y(["cursor-pointer ti-tag-toDefactor", { "mn-r-micro": z !== L(n).length - 1 }])
845
+ }, b(A.text), 11, Ce))), 256)) : (u(), d("span", Ve, "You added all suggested tags"))
846
+ ])
847
+ ]));
848
+ }
849
+ };
850
+ const Ee = { class: "flex-v-center flex-nowrap flex" }, Ae = {
851
+ key: 0,
852
+ class: "mn-r-auto t-transp mn-r-small"
853
+ }, Le = ["name", "value", "checked"], De = {
854
+ __name: "Checkbox",
855
+ props: {
856
+ label: String,
857
+ name: String,
858
+ value: String,
859
+ radio: {
860
+ type: [Array, Boolean, Object],
861
+ default: () => []
862
+ }
863
+ },
864
+ emits: ["update:radio"],
865
+ setup(e, { emit: t }) {
866
+ const s = e, l = (a) => {
867
+ if (Array.isArray(s.radio)) {
868
+ let r = [...s.radio];
869
+ if (a.target.checked)
870
+ r.push(s.value);
871
+ else {
872
+ const i = r.indexOf(s.value);
873
+ i !== -1 && r.splice(i, 1);
874
+ }
875
+ t("update:radio", r);
876
+ } else
877
+ typeof s.radio == "boolean" && t("update:radio", a.target.checked);
878
+ };
879
+ return (a, r) => (u(), d("label", Ee, [
880
+ e.label ? (u(), d("div", Ae, [
881
+ h("span", null, b(e.label), 1)
882
+ ])) : f("", !0),
883
+ h("input", {
884
+ onChange: l,
885
+ class: "round radiobutton",
886
+ type: "checkbox",
887
+ name: e.name,
888
+ value: e.value,
889
+ checked: Array.isArray(e.radio) ? e.radio.includes(e.value) : e.radio
890
+ }, null, 40, Le),
891
+ h("div", {
892
+ class: y(["transition-elastic pd-thin h-2r w-4r radius-extra", {
893
+ "bg-grey": !(Array.isArray(e.radio) ? e.radio.includes(e.value) : e.radio),
894
+ "bg-main": Array.isArray(e.radio) ? e.radio.includes(e.value) : e.radio
895
+ }])
896
+ }, [
897
+ h("div", {
898
+ class: y(["transition-linear w-1r h-1r radius-extra h-100 bg-white", {
899
+ "mn-r-auto": !(Array.isArray(e.radio) ? e.radio.includes(e.value) : e.radio),
900
+ "mn-l-auto": Array.isArray(e.radio) ? e.radio.includes(e.value) : e.radio
901
+ }])
902
+ }, null, 2)
903
+ ], 2)
904
+ ]));
905
+ }
906
+ }, nt = /* @__PURE__ */ D(De, [["__scopeId", "data-v-f641f618"]]);
907
+ function M(e) {
908
+ return e === 0 ? !1 : Array.isArray(e) && e.length === 0 ? !0 : !e;
909
+ }
910
+ function Be(e) {
911
+ return (...t) => !e(...t);
912
+ }
913
+ function Me(e, t) {
914
+ return e === void 0 && (e = "undefined"), e === null && (e = "null"), e === !1 && (e = "false"), e.toString().toLowerCase().indexOf(t.trim()) !== -1;
915
+ }
916
+ function q(e, t, s, l) {
917
+ return t ? e.filter((a) => Me(l(a, s), t)).sort((a, r) => l(a, s).length - l(r, s).length) : e;
918
+ }
919
+ function Fe(e) {
920
+ return e.filter((t) => !t.$isLabel);
921
+ }
922
+ function F(e, t) {
923
+ return (s) => s.reduce((l, a) => a[e] && a[e].length ? (l.push({
924
+ $groupLabel: a[t],
925
+ $isLabel: !0
926
+ }), l.concat(a[e])) : l, []);
927
+ }
928
+ function Ie(e, t, s, l, a) {
929
+ return (r) => r.map((i) => {
930
+ if (!i[s])
931
+ return console.warn("Options passed to vue-multiselect do not contain groups, despite the config."), [];
932
+ const n = q(i[s], e, t, a);
933
+ return n.length ? {
934
+ [l]: i[l],
935
+ [s]: n
936
+ } : [];
937
+ });
938
+ }
939
+ const G = (...e) => (t) => e.reduce((s, l) => l(s), t), Pe = {
940
+ data() {
941
+ return {
942
+ search: "",
943
+ isOpen: !1,
944
+ preferredOpenDirection: "below",
945
+ optimizedHeight: this.maxHeight
946
+ };
947
+ },
948
+ props: {
949
+ /**
950
+ * Decide whether to filter the results based on search query.
951
+ * Useful for async filtering, where we search through more complex data.
952
+ * @type {Boolean}
953
+ */
954
+ internalSearch: {
955
+ type: Boolean,
956
+ default: !0
957
+ },
958
+ /**
959
+ * Array of available options: Objects, Strings or Integers.
960
+ * If array of objects, visible label will default to option.label.
961
+ * If `labal` prop is passed, label will equal option['label']
962
+ * @type {Array}
963
+ */
964
+ options: {
965
+ type: Array,
966
+ required: !0
967
+ },
968
+ /**
969
+ * Equivalent to the `multiple` attribute on a `<select>` input.
970
+ * @default false
971
+ * @type {Boolean}
972
+ */
973
+ multiple: {
974
+ type: Boolean,
975
+ default: !1
976
+ },
977
+ /**
978
+ * Key to compare objects
979
+ * @default 'id'
980
+ * @type {String}
981
+ */
982
+ trackBy: {
983
+ type: String
984
+ },
985
+ /**
986
+ * Label to look for in option Object
987
+ * @default 'label'
988
+ * @type {String}
989
+ */
990
+ label: {
991
+ type: String
992
+ },
993
+ /**
994
+ * Enable/disable search in options
995
+ * @default true
996
+ * @type {Boolean}
997
+ */
998
+ searchable: {
999
+ type: Boolean,
1000
+ default: !0
1001
+ },
1002
+ /**
1003
+ * Clear the search input after `)
1004
+ * @default true
1005
+ * @type {Boolean}
1006
+ */
1007
+ clearOnSelect: {
1008
+ type: Boolean,
1009
+ default: !0
1010
+ },
1011
+ /**
1012
+ * Hide already selected options
1013
+ * @default false
1014
+ * @type {Boolean}
1015
+ */
1016
+ hideSelected: {
1017
+ type: Boolean,
1018
+ default: !1
1019
+ },
1020
+ /**
1021
+ * Equivalent to the `placeholder` attribute on a `<select>` input.
1022
+ * @default 'Select option'
1023
+ * @type {String}
1024
+ */
1025
+ placeholder: {
1026
+ type: String,
1027
+ default: "Select option"
1028
+ },
1029
+ /**
1030
+ * Allow to remove all selected values
1031
+ * @default true
1032
+ * @type {Boolean}
1033
+ */
1034
+ allowEmpty: {
1035
+ type: Boolean,
1036
+ default: !0
1037
+ },
1038
+ /**
1039
+ * Reset this.internalValue, this.search after this.internalValue changes.
1040
+ * Useful if want to create a stateless dropdown.
1041
+ * @default false
1042
+ * @type {Boolean}
1043
+ */
1044
+ resetAfter: {
1045
+ type: Boolean,
1046
+ default: !1
1047
+ },
1048
+ /**
1049
+ * Enable/disable closing after selecting an option
1050
+ * @default true
1051
+ * @type {Boolean}
1052
+ */
1053
+ closeOnSelect: {
1054
+ type: Boolean,
1055
+ default: !0
1056
+ },
1057
+ /**
1058
+ * Function to interpolate the custom label
1059
+ * @default false
1060
+ * @type {Function}
1061
+ */
1062
+ customLabel: {
1063
+ type: Function,
1064
+ default(e, t) {
1065
+ return M(e) ? "" : t ? e[t] : e;
1066
+ }
1067
+ },
1068
+ /**
1069
+ * Disable / Enable tagging
1070
+ * @default false
1071
+ * @type {Boolean}
1072
+ */
1073
+ taggable: {
1074
+ type: Boolean,
1075
+ default: !1
1076
+ },
1077
+ /**
1078
+ * String to show when highlighting a potential tag
1079
+ * @default 'Press enter to create a tag'
1080
+ * @type {String}
1081
+ */
1082
+ tagPlaceholder: {
1083
+ type: String,
1084
+ default: "Press enter to create a tag"
1085
+ },
1086
+ /**
1087
+ * By default new tags will appear above the search results.
1088
+ * Changing to 'bottom' will revert this behaviour
1089
+ * and will proritize the search results
1090
+ * @default 'top'
1091
+ * @type {String}
1092
+ */
1093
+ tagPosition: {
1094
+ type: String,
1095
+ default: "top"
1096
+ },
1097
+ /**
1098
+ * Number of allowed selected options. No limit if 0.
1099
+ * @default 0
1100
+ * @type {Number}
1101
+ */
1102
+ max: {
1103
+ type: [Number, Boolean],
1104
+ default: !1
1105
+ },
1106
+ /**
1107
+ * Will be passed with all events as second param.
1108
+ * Useful for identifying events origin.
1109
+ * @default null
1110
+ * @type {String|Integer}
1111
+ */
1112
+ id: {
1113
+ default: null
1114
+ },
1115
+ /**
1116
+ * Limits the options displayed in the dropdown
1117
+ * to the first X options.
1118
+ * @default 1000
1119
+ * @type {Integer}
1120
+ */
1121
+ optionsLimit: {
1122
+ type: Number,
1123
+ default: 1e3
1124
+ },
1125
+ /**
1126
+ * Name of the property containing
1127
+ * the group values
1128
+ * @default 1000
1129
+ * @type {String}
1130
+ */
1131
+ groupValues: {
1132
+ type: String
1133
+ },
1134
+ /**
1135
+ * Name of the property containing
1136
+ * the group label
1137
+ * @default 1000
1138
+ * @type {String}
1139
+ */
1140
+ groupLabel: {
1141
+ type: String
1142
+ },
1143
+ /**
1144
+ * Allow to select all group values
1145
+ * by selecting the group label
1146
+ * @default false
1147
+ * @type {Boolean}
1148
+ */
1149
+ groupSelect: {
1150
+ type: Boolean,
1151
+ default: !1
1152
+ },
1153
+ /**
1154
+ * Array of keyboard keys to block
1155
+ * when selecting
1156
+ * @default 1000
1157
+ * @type {String}
1158
+ */
1159
+ blockKeys: {
1160
+ type: Array,
1161
+ default() {
1162
+ return [];
1163
+ }
1164
+ },
1165
+ /**
1166
+ * Prevent from wiping up the search value
1167
+ * @default false
1168
+ * @type {Boolean}
1169
+ */
1170
+ preserveSearch: {
1171
+ type: Boolean,
1172
+ default: !1
1173
+ },
1174
+ /**
1175
+ * Select 1st options if value is empty
1176
+ * @default false
1177
+ * @type {Boolean}
1178
+ */
1179
+ preselectFirst: {
1180
+ type: Boolean,
1181
+ default: !1
1182
+ },
1183
+ /**
1184
+ * Prevent autofocus
1185
+ * @default false
1186
+ * @type {Boolean}
1187
+ */
1188
+ preventAutofocus: {
1189
+ type: Boolean,
1190
+ default: !1
1191
+ }
1192
+ },
1193
+ mounted() {
1194
+ !this.multiple && this.max && console.warn("[Vue-Multiselect warn]: Max prop should not be used when prop Multiple equals false."), this.preselectFirst && !this.internalValue.length && this.options.length && this.select(this.filteredOptions[0]);
1195
+ },
1196
+ computed: {
1197
+ internalValue() {
1198
+ return this.modelValue || this.modelValue === 0 ? Array.isArray(this.modelValue) ? this.modelValue : [this.modelValue] : [];
1199
+ },
1200
+ filteredOptions() {
1201
+ const e = this.search || "", t = e.toLowerCase().trim();
1202
+ let s = this.options.concat();
1203
+ return this.internalSearch ? s = this.groupValues ? this.filterAndFlat(s, t, this.label) : q(s, t, this.label, this.customLabel) : s = this.groupValues ? F(this.groupValues, this.groupLabel)(s) : s, s = this.hideSelected ? s.filter(Be(this.isSelected)) : s, this.taggable && t.length && !this.isExistingOption(t) && (this.tagPosition === "bottom" ? s.push({ isTag: !0, label: e }) : s.unshift({ isTag: !0, label: e })), s.slice(0, this.optionsLimit);
1204
+ },
1205
+ valueKeys() {
1206
+ return this.trackBy ? this.internalValue.map((e) => e[this.trackBy]) : this.internalValue;
1207
+ },
1208
+ optionKeys() {
1209
+ return (this.groupValues ? this.flatAndStrip(this.options) : this.options).map((t) => this.customLabel(t, this.label).toString().toLowerCase());
1210
+ },
1211
+ currentOptionLabel() {
1212
+ return this.multiple ? this.searchable ? "" : this.placeholder : this.internalValue.length ? this.getOptionLabel(this.internalValue[0]) : this.searchable ? "" : this.placeholder;
1213
+ }
1214
+ },
1215
+ watch: {
1216
+ internalValue: {
1217
+ handler() {
1218
+ this.resetAfter && this.internalValue.length && (this.search = "", this.$emit("update:modelValue", this.multiple ? [] : null));
1219
+ },
1220
+ deep: !0
1221
+ },
1222
+ search() {
1223
+ this.$emit("search-change", this.search);
1224
+ }
1225
+ },
1226
+ emits: ["open", "search-change", "close", "select", "update:modelValue", "remove", "tag"],
1227
+ methods: {
1228
+ /**
1229
+ * Returns the internalValue in a way it can be emited to the parent
1230
+ * @returns {Object||Array||String||Integer}
1231
+ */
1232
+ getValue() {
1233
+ return this.multiple ? this.internalValue : this.internalValue.length === 0 ? null : this.internalValue[0];
1234
+ },
1235
+ /**
1236
+ * Filters and then flattens the options list
1237
+ * @param {Array}
1238
+ * @return {Array} returns a filtered and flat options list
1239
+ */
1240
+ filterAndFlat(e, t, s) {
1241
+ return G(
1242
+ Ie(t, s, this.groupValues, this.groupLabel, this.customLabel),
1243
+ F(this.groupValues, this.groupLabel)
1244
+ )(e);
1245
+ },
1246
+ /**
1247
+ * Flattens and then strips the group labels from the options list
1248
+ * @param {Array}
1249
+ * @return {Array} returns a flat options list without group labels
1250
+ */
1251
+ flatAndStrip(e) {
1252
+ return G(
1253
+ F(this.groupValues, this.groupLabel),
1254
+ Fe
1255
+ )(e);
1256
+ },
1257
+ /**
1258
+ * Updates the search value
1259
+ * @param {String}
1260
+ */
1261
+ updateSearch(e) {
1262
+ this.search = e;
1263
+ },
1264
+ /**
1265
+ * Finds out if the given query is already present
1266
+ * in the available options
1267
+ * @param {String}
1268
+ * @return {Boolean} returns true if element is available
1269
+ */
1270
+ isExistingOption(e) {
1271
+ return this.options ? this.optionKeys.indexOf(e) > -1 : !1;
1272
+ },
1273
+ /**
1274
+ * Finds out if the given element is already present
1275
+ * in the result value
1276
+ * @param {Object||String||Integer} option passed element to check
1277
+ * @returns {Boolean} returns true if element is selected
1278
+ */
1279
+ isSelected(e) {
1280
+ const t = this.trackBy ? e[this.trackBy] : e;
1281
+ return this.valueKeys.indexOf(t) > -1;
1282
+ },
1283
+ /**
1284
+ * Finds out if the given option is disabled
1285
+ * @param {Object||String||Integer} option passed element to check
1286
+ * @returns {Boolean} returns true if element is disabled
1287
+ */
1288
+ isOptionDisabled(e) {
1289
+ return !!e.$isDisabled;
1290
+ },
1291
+ /**
1292
+ * Returns empty string when options is null/undefined
1293
+ * Returns tag query if option is tag.
1294
+ * Returns the customLabel() results and casts it to string.
1295
+ *
1296
+ * @param {Object||String||Integer} Passed option
1297
+ * @returns {Object||String}
1298
+ */
1299
+ getOptionLabel(e) {
1300
+ if (M(e))
1301
+ return "";
1302
+ if (e.isTag)
1303
+ return e.label;
1304
+ if (e.$isLabel)
1305
+ return e.$groupLabel;
1306
+ const t = this.customLabel(e, this.label);
1307
+ return M(t) ? "" : t;
1308
+ },
1309
+ /**
1310
+ * Add the given option to the list of selected options
1311
+ * or sets the option as the selected option.
1312
+ * If option is already selected -> remove it from the results.
1313
+ *
1314
+ * @param {Object||String||Integer} option to select/deselect
1315
+ * @param {Boolean} block removing
1316
+ */
1317
+ select(e, t) {
1318
+ if (e.$isLabel && this.groupSelect) {
1319
+ this.selectGroup(e);
1320
+ return;
1321
+ }
1322
+ if (!(this.blockKeys.indexOf(t) !== -1 || this.disabled || e.$isDisabled || e.$isLabel) && !(this.max && this.multiple && this.internalValue.length === this.max) && !(t === "Tab" && !this.pointerDirty)) {
1323
+ if (e.isTag)
1324
+ this.$emit("tag", e.label, this.id), this.search = "", this.closeOnSelect && !this.multiple && this.deactivate();
1325
+ else {
1326
+ if (this.isSelected(e)) {
1327
+ t !== "Tab" && this.removeElement(e);
1328
+ return;
1329
+ }
1330
+ this.multiple ? this.$emit("update:modelValue", this.internalValue.concat([e])) : this.$emit("update:modelValue", e), this.$emit("select", e, this.id), this.clearOnSelect && (this.search = "");
1331
+ }
1332
+ this.closeOnSelect && this.deactivate();
1333
+ }
1334
+ },
1335
+ /**
1336
+ * Add the given group options to the list of selected options
1337
+ * If all group optiona are already selected -> remove it from the results.
1338
+ *
1339
+ * @param {Object||String||Integer} group to select/deselect
1340
+ */
1341
+ selectGroup(e) {
1342
+ const t = this.options.find((s) => s[this.groupLabel] === e.$groupLabel);
1343
+ if (t) {
1344
+ if (this.wholeGroupSelected(t)) {
1345
+ this.$emit("remove", t[this.groupValues], this.id);
1346
+ const s = this.internalValue.filter(
1347
+ (l) => t[this.groupValues].indexOf(l) === -1
1348
+ );
1349
+ this.$emit("update:modelValue", s);
1350
+ } else {
1351
+ let s = t[this.groupValues].filter(
1352
+ (l) => !(this.isOptionDisabled(l) || this.isSelected(l))
1353
+ );
1354
+ this.max && s.splice(this.max - this.internalValue.length), this.$emit("select", s, this.id), this.$emit(
1355
+ "update:modelValue",
1356
+ this.internalValue.concat(s)
1357
+ );
1358
+ }
1359
+ this.closeOnSelect && this.deactivate();
1360
+ }
1361
+ },
1362
+ /**
1363
+ * Helper to identify if all values in a group are selected
1364
+ *
1365
+ * @param {Object} group to validated selected values against
1366
+ */
1367
+ wholeGroupSelected(e) {
1368
+ return e[this.groupValues].every(
1369
+ (t) => this.isSelected(t) || this.isOptionDisabled(t)
1370
+ );
1371
+ },
1372
+ /**
1373
+ * Helper to identify if all values in a group are disabled
1374
+ *
1375
+ * @param {Object} group to check for disabled values
1376
+ */
1377
+ wholeGroupDisabled(e) {
1378
+ return e[this.groupValues].every(this.isOptionDisabled);
1379
+ },
1380
+ /**
1381
+ * Removes the given option from the selected options.
1382
+ * Additionally checks this.allowEmpty prop if option can be removed when
1383
+ * it is the last selected option.
1384
+ *
1385
+ * @param {type} option description
1386
+ * @return {type} description
1387
+ */
1388
+ removeElement(e, t = !0) {
1389
+ if (this.disabled || e.$isDisabled)
1390
+ return;
1391
+ if (!this.allowEmpty && this.internalValue.length <= 1) {
1392
+ this.deactivate();
1393
+ return;
1394
+ }
1395
+ const s = typeof e == "object" ? this.valueKeys.indexOf(e[this.trackBy]) : this.valueKeys.indexOf(e);
1396
+ if (this.multiple) {
1397
+ const l = this.internalValue.slice(0, s).concat(this.internalValue.slice(s + 1));
1398
+ this.$emit("update:modelValue", l);
1399
+ } else
1400
+ this.$emit("update:modelValue", null);
1401
+ this.$emit("remove", e, this.id), this.closeOnSelect && t && this.deactivate();
1402
+ },
1403
+ /**
1404
+ * Calls this.removeElement() with the last element
1405
+ * from this.internalValue (selected element Array)
1406
+ *
1407
+ * @fires this#removeElement
1408
+ */
1409
+ removeLastElement() {
1410
+ this.blockKeys.indexOf("Delete") === -1 && this.search.length === 0 && Array.isArray(this.internalValue) && this.internalValue.length && this.removeElement(this.internalValue[this.internalValue.length - 1], !1);
1411
+ },
1412
+ /**
1413
+ * Opens the multiselect’s dropdown.
1414
+ * Sets this.isOpen to TRUE
1415
+ */
1416
+ activate() {
1417
+ this.isOpen || this.disabled || (this.adjustPosition(), this.groupValues && this.pointer === 0 && this.filteredOptions.length && (this.pointer = 1), this.isOpen = !0, this.searchable ? (this.preserveSearch || (this.search = ""), this.preventAutofocus || this.$nextTick(() => this.$refs.search && this.$refs.search.focus())) : this.preventAutofocus || typeof this.$el < "u" && this.$el.focus(), this.$emit("open", this.id));
1418
+ },
1419
+ /**
1420
+ * Closes the multiselect’s dropdown.
1421
+ * Sets this.isOpen to FALSE
1422
+ */
1423
+ deactivate() {
1424
+ this.isOpen && (this.isOpen = !1, this.searchable ? typeof this.$refs.search < "u" && this.$refs.search.blur() : typeof this.$el < "u" && this.$el.blur(), this.preserveSearch || (this.search = ""), this.$emit("close", this.getValue(), this.id));
1425
+ },
1426
+ /**
1427
+ * Call this.activate() or this.deactivate()
1428
+ * depending on this.isOpen value.
1429
+ *
1430
+ * @fires this#activate || this#deactivate
1431
+ * @property {Boolean} isOpen indicates if dropdown is open
1432
+ */
1433
+ toggle() {
1434
+ this.isOpen ? this.deactivate() : this.activate();
1435
+ },
1436
+ /**
1437
+ * Updates the hasEnoughSpace variable used for
1438
+ * detecting where to expand the dropdown
1439
+ */
1440
+ adjustPosition() {
1441
+ if (typeof window > "u")
1442
+ return;
1443
+ const e = this.$el.getBoundingClientRect().top, t = window.innerHeight - this.$el.getBoundingClientRect().bottom;
1444
+ t > this.maxHeight || t > e || this.openDirection === "below" || this.openDirection === "bottom" ? (this.preferredOpenDirection = "below", this.optimizedHeight = Math.min(t - 40, this.maxHeight)) : (this.preferredOpenDirection = "above", this.optimizedHeight = Math.min(e - 40, this.maxHeight));
1445
+ }
1446
+ }
1447
+ }, Ke = {
1448
+ data() {
1449
+ return {
1450
+ pointer: 0,
1451
+ pointerDirty: !1
1452
+ };
1453
+ },
1454
+ props: {
1455
+ /**
1456
+ * Enable/disable highlighting of the pointed value.
1457
+ * @type {Boolean}
1458
+ * @default true
1459
+ */
1460
+ showPointer: {
1461
+ type: Boolean,
1462
+ default: !0
1463
+ },
1464
+ optionHeight: {
1465
+ type: Number,
1466
+ default: 40
1467
+ }
1468
+ },
1469
+ computed: {
1470
+ pointerPosition() {
1471
+ return this.pointer * this.optionHeight;
1472
+ },
1473
+ visibleElements() {
1474
+ return this.optimizedHeight / this.optionHeight;
1475
+ }
1476
+ },
1477
+ watch: {
1478
+ filteredOptions() {
1479
+ this.pointerAdjust();
1480
+ },
1481
+ isOpen() {
1482
+ this.pointerDirty = !1;
1483
+ },
1484
+ pointer() {
1485
+ this.$refs.search && this.$refs.search.setAttribute("aria-activedescendant", this.id + "-" + this.pointer.toString());
1486
+ }
1487
+ },
1488
+ methods: {
1489
+ optionHighlight(e, t) {
1490
+ return {
1491
+ "multiselect__option--highlight": e === this.pointer && this.showPointer,
1492
+ "multiselect__option--selected": this.isSelected(t)
1493
+ };
1494
+ },
1495
+ groupHighlight(e, t) {
1496
+ if (!this.groupSelect)
1497
+ return [
1498
+ "multiselect__option--disabled",
1499
+ { "multiselect__option--group": t.$isLabel }
1500
+ ];
1501
+ const s = this.options.find((l) => l[this.groupLabel] === t.$groupLabel);
1502
+ return s && !this.wholeGroupDisabled(s) ? [
1503
+ "multiselect__option--group",
1504
+ { "multiselect__option--highlight": e === this.pointer && this.showPointer },
1505
+ { "multiselect__option--group-selected": this.wholeGroupSelected(s) }
1506
+ ] : "multiselect__option--disabled";
1507
+ },
1508
+ addPointerElement({ key: e } = "Enter") {
1509
+ this.filteredOptions.length > 0 && this.select(this.filteredOptions[this.pointer], e), this.pointerReset();
1510
+ },
1511
+ pointerForward() {
1512
+ this.pointer < this.filteredOptions.length - 1 && (this.pointer++, this.$refs.list.scrollTop <= this.pointerPosition - (this.visibleElements - 1) * this.optionHeight && (this.$refs.list.scrollTop = this.pointerPosition - (this.visibleElements - 1) * this.optionHeight), this.filteredOptions[this.pointer] && this.filteredOptions[this.pointer].$isLabel && !this.groupSelect && this.pointerForward()), this.pointerDirty = !0;
1513
+ },
1514
+ pointerBackward() {
1515
+ this.pointer > 0 ? (this.pointer--, this.$refs.list.scrollTop >= this.pointerPosition && (this.$refs.list.scrollTop = this.pointerPosition), this.filteredOptions[this.pointer] && this.filteredOptions[this.pointer].$isLabel && !this.groupSelect && this.pointerBackward()) : this.filteredOptions[this.pointer] && this.filteredOptions[0].$isLabel && !this.groupSelect && this.pointerForward(), this.pointerDirty = !0;
1516
+ },
1517
+ pointerReset() {
1518
+ this.closeOnSelect && (this.pointer = 0, this.$refs.list && (this.$refs.list.scrollTop = 0));
1519
+ },
1520
+ pointerAdjust() {
1521
+ this.pointer >= this.filteredOptions.length - 1 && (this.pointer = this.filteredOptions.length ? this.filteredOptions.length - 1 : 0), this.filteredOptions.length > 0 && this.filteredOptions[this.pointer].$isLabel && !this.groupSelect && this.pointerForward();
1522
+ },
1523
+ pointerSet(e) {
1524
+ this.pointer = e, this.pointerDirty = !0;
1525
+ }
1526
+ }
1527
+ };
1528
+ const Ne = {
1529
+ name: "vue-multiselect",
1530
+ mixins: [Pe, Ke],
1531
+ compatConfig: {
1532
+ MODE: 3,
1533
+ ATTR_ENUMERATED_COERCION: !1
1534
+ },
1535
+ props: {
1536
+ /**
1537
+ * name attribute to match optional label element
1538
+ * @default ''
1539
+ * @type {String}
1540
+ */
1541
+ name: {
1542
+ type: String,
1543
+ default: ""
1544
+ },
1545
+ /**
1546
+ * Presets the selected options value.
1547
+ * @type {Object||Array||String||Integer}
1548
+ */
1549
+ modelValue: {
1550
+ type: null,
1551
+ default() {
1552
+ return [];
1553
+ }
1554
+ },
1555
+ /**
1556
+ * String to show when pointing to an option
1557
+ * @default 'Press enter to select'
1558
+ * @type {String}
1559
+ */
1560
+ selectLabel: {
1561
+ type: String,
1562
+ default: "Press enter to select"
1563
+ },
1564
+ /**
1565
+ * String to show when pointing to an option
1566
+ * @default 'Press enter to select'
1567
+ * @type {String}
1568
+ */
1569
+ selectGroupLabel: {
1570
+ type: String,
1571
+ default: "Press enter to select group"
1572
+ },
1573
+ /**
1574
+ * String to show next to selected option
1575
+ * @default 'Selected'
1576
+ * @type {String}
1577
+ */
1578
+ selectedLabel: {
1579
+ type: String,
1580
+ default: "Selected"
1581
+ },
1582
+ /**
1583
+ * String to show when pointing to an already selected option
1584
+ * @default 'Press enter to remove'
1585
+ * @type {String}
1586
+ */
1587
+ deselectLabel: {
1588
+ type: String,
1589
+ default: "Press enter to remove"
1590
+ },
1591
+ /**
1592
+ * String to show when pointing to an already selected option
1593
+ * @default 'Press enter to remove'
1594
+ * @type {String}
1595
+ */
1596
+ deselectGroupLabel: {
1597
+ type: String,
1598
+ default: "Press enter to deselect group"
1599
+ },
1600
+ /**
1601
+ * Decide whether to show pointer labels
1602
+ * @default true
1603
+ * @type {Boolean}
1604
+ */
1605
+ showLabels: {
1606
+ type: Boolean,
1607
+ default: !0
1608
+ },
1609
+ /**
1610
+ * Limit the display of selected options. The rest will be hidden within the limitText string.
1611
+ * @default 99999
1612
+ * @type {Integer}
1613
+ */
1614
+ limit: {
1615
+ type: Number,
1616
+ default: 99999
1617
+ },
1618
+ /**
1619
+ * Sets maxHeight style value of the dropdown
1620
+ * @default 300
1621
+ * @type {Integer}
1622
+ */
1623
+ maxHeight: {
1624
+ type: Number,
1625
+ default: 300
1626
+ },
1627
+ /**
1628
+ * Function that process the message shown when selected
1629
+ * elements pass the defined limit.
1630
+ * @default 'and * more'
1631
+ * @param {Int} count Number of elements more than limit
1632
+ * @type {Function}
1633
+ */
1634
+ limitText: {
1635
+ type: Function,
1636
+ default: (e) => `and ${e} more`
1637
+ },
1638
+ /**
1639
+ * Set true to trigger the loading spinner.
1640
+ * @default False
1641
+ * @type {Boolean}
1642
+ */
1643
+ loading: {
1644
+ type: Boolean,
1645
+ default: !1
1646
+ },
1647
+ /**
1648
+ * Disables the multiselect if true.
1649
+ * @default false
1650
+ * @type {Boolean}
1651
+ */
1652
+ disabled: {
1653
+ type: Boolean,
1654
+ default: !1
1655
+ },
1656
+ /**
1657
+ * Fixed opening direction
1658
+ * @default ''
1659
+ * @type {String}
1660
+ */
1661
+ openDirection: {
1662
+ type: String,
1663
+ default: ""
1664
+ },
1665
+ /**
1666
+ * Shows slot with message about empty options
1667
+ * @default true
1668
+ * @type {Boolean}
1669
+ */
1670
+ showNoOptions: {
1671
+ type: Boolean,
1672
+ default: !0
1673
+ },
1674
+ showNoResults: {
1675
+ type: Boolean,
1676
+ default: !0
1677
+ },
1678
+ tabindex: {
1679
+ type: Number,
1680
+ default: 0
1681
+ }
1682
+ },
1683
+ computed: {
1684
+ hasOptionGroup() {
1685
+ return this.groupValues && this.groupLabel && this.groupSelect;
1686
+ },
1687
+ isSingleLabelVisible() {
1688
+ return (this.singleValue || this.singleValue === 0) && (!this.isOpen || !this.searchable) && !this.visibleValues.length;
1689
+ },
1690
+ isPlaceholderVisible() {
1691
+ return !this.internalValue.length && (!this.searchable || !this.isOpen);
1692
+ },
1693
+ visibleValues() {
1694
+ return this.multiple ? this.internalValue.slice(0, this.limit) : [];
1695
+ },
1696
+ singleValue() {
1697
+ return this.internalValue[0];
1698
+ },
1699
+ deselectLabelText() {
1700
+ return this.showLabels ? this.deselectLabel : "";
1701
+ },
1702
+ deselectGroupLabelText() {
1703
+ return this.showLabels ? this.deselectGroupLabel : "";
1704
+ },
1705
+ selectLabelText() {
1706
+ return this.showLabels ? this.selectLabel : "";
1707
+ },
1708
+ selectGroupLabelText() {
1709
+ return this.showLabels ? this.selectGroupLabel : "";
1710
+ },
1711
+ selectedLabelText() {
1712
+ return this.showLabels ? this.selectedLabel : "";
1713
+ },
1714
+ inputStyle() {
1715
+ return this.searchable || this.multiple && this.modelValue && this.modelValue.length ? this.isOpen ? { width: "100%" } : { width: "0", position: "absolute", padding: "0" } : "";
1716
+ },
1717
+ contentStyle() {
1718
+ return this.options.length ? { display: "inline-block" } : { display: "block" };
1719
+ },
1720
+ isAbove() {
1721
+ return this.openDirection === "above" || this.openDirection === "top" ? !0 : this.openDirection === "below" || this.openDirection === "bottom" ? !1 : this.preferredOpenDirection === "above";
1722
+ },
1723
+ showSearchInput() {
1724
+ return this.searchable && (this.hasSingleSelectedSlot && (this.visibleSingleValue || this.visibleSingleValue === 0) ? this.isOpen : !0);
1725
+ }
1726
+ }
1727
+ }, Re = ["tabindex", "aria-owns"], He = {
1728
+ ref: "tags",
1729
+ class: "multiselect__tags"
1730
+ }, Ge = { class: "multiselect__tags-wrap" }, je = ["textContent"], qe = ["onKeypress", "onMousedown"], ze = ["textContent"], Ue = { class: "multiselect__spinner" }, Je = ["name", "id", "placeholder", "value", "disabled", "tabindex", "aria-controls"], We = ["id"], Ye = { key: 0 }, Qe = { class: "multiselect__option" }, Xe = ["id", "role"], Ze = ["onClick", "onMouseenter", "data-select", "data-selected", "data-deselect"], xe = ["data-select", "data-deselect", "onMouseenter", "onMousedown"], _e = { class: "multiselect__option" }, et = { class: "multiselect__option" };
1731
+ function tt(e, t, s, l, a, r) {
1732
+ return u(), d("div", {
1733
+ tabindex: e.searchable ? -1 : s.tabindex,
1734
+ class: y([{ "multiselect--active": e.isOpen, "multiselect--disabled": s.disabled, "multiselect--above": r.isAbove, "multiselect--has-options-group": r.hasOptionGroup }, "multiselect"]),
1735
+ onFocus: t[13] || (t[13] = (i) => e.activate()),
1736
+ onBlur: t[14] || (t[14] = (i) => e.searchable ? !1 : e.deactivate()),
1737
+ onKeydown: [
1738
+ t[15] || (t[15] = c(g((i) => e.pointerForward(), ["self", "prevent"]), ["down"])),
1739
+ t[16] || (t[16] = c(g((i) => e.pointerBackward(), ["self", "prevent"]), ["up"]))
1740
+ ],
1741
+ onKeypress: t[17] || (t[17] = c(g((i) => e.addPointerElement(i), ["stop", "self"]), ["enter", "tab"])),
1742
+ onKeyup: t[18] || (t[18] = c((i) => e.deactivate(), ["esc"])),
1743
+ role: "combobox",
1744
+ "aria-owns": "listbox-" + e.id
1745
+ }, [
1746
+ p(e.$slots, "caret", { toggle: e.toggle }, () => [
1747
+ h("div", {
1748
+ onMousedown: t[0] || (t[0] = g((i) => e.toggle(), ["prevent", "stop"])),
1749
+ class: "multiselect__select"
1750
+ }, null, 32)
1751
+ ]),
1752
+ p(e.$slots, "clear", { search: e.search }),
1753
+ h("div", He, [
1754
+ p(e.$slots, "selection", {
1755
+ search: e.search,
1756
+ remove: e.removeElement,
1757
+ values: r.visibleValues,
1758
+ isOpen: e.isOpen
1759
+ }, () => [
1760
+ $(h("div", Ge, [
1761
+ (u(!0), d(V, null, E(r.visibleValues, (i, n) => p(e.$slots, "tag", {
1762
+ option: i,
1763
+ search: e.search,
1764
+ remove: e.removeElement
1765
+ }, () => [
1766
+ (u(), d("span", {
1767
+ class: "multiselect__tag",
1768
+ key: n
1769
+ }, [
1770
+ h("span", {
1771
+ textContent: b(e.getOptionLabel(i))
1772
+ }, null, 8, je),
1773
+ h("i", {
1774
+ tabindex: "1",
1775
+ onKeypress: c(g((o) => e.removeElement(i), ["prevent"]), ["enter"]),
1776
+ onMousedown: g((o) => e.removeElement(i), ["prevent"]),
1777
+ class: "multiselect__tag-icon"
1778
+ }, null, 40, qe)
1779
+ ]))
1780
+ ])), 256))
1781
+ ], 512), [
1782
+ [S, r.visibleValues.length > 0]
1783
+ ]),
1784
+ e.internalValue && e.internalValue.length > s.limit ? p(e.$slots, "limit", { key: 0 }, () => [
1785
+ h("strong", {
1786
+ class: "multiselect__strong",
1787
+ textContent: b(s.limitText(e.internalValue.length - s.limit))
1788
+ }, null, 8, ze)
1789
+ ]) : f("", !0)
1790
+ ]),
1791
+ I(K, { name: "multiselect__loading" }, {
1792
+ default: N(() => [
1793
+ p(e.$slots, "loading", {}, () => [
1794
+ $(h("div", Ue, null, 512), [
1795
+ [S, s.loading]
1796
+ ])
1797
+ ])
1798
+ ]),
1799
+ _: 3
1800
+ }),
1801
+ e.searchable ? (u(), d("input", {
1802
+ key: 0,
1803
+ ref: "search",
1804
+ name: s.name,
1805
+ id: e.id,
1806
+ type: "text",
1807
+ autocomplete: "off",
1808
+ spellcheck: "false",
1809
+ placeholder: e.placeholder,
1810
+ style: w(r.inputStyle),
1811
+ value: e.search,
1812
+ disabled: s.disabled,
1813
+ tabindex: s.tabindex,
1814
+ onInput: t[1] || (t[1] = (i) => e.updateSearch(i.target.value)),
1815
+ onFocus: t[2] || (t[2] = g((i) => e.activate(), ["prevent"])),
1816
+ onBlur: t[3] || (t[3] = g((i) => e.deactivate(), ["prevent"])),
1817
+ onKeyup: t[4] || (t[4] = c((i) => e.deactivate(), ["esc"])),
1818
+ onKeydown: [
1819
+ t[5] || (t[5] = c(g((i) => e.pointerForward(), ["prevent"]), ["down"])),
1820
+ t[6] || (t[6] = c(g((i) => e.pointerBackward(), ["prevent"]), ["up"])),
1821
+ t[8] || (t[8] = c(g((i) => e.removeLastElement(), ["stop"]), ["delete"]))
1822
+ ],
1823
+ onKeypress: t[7] || (t[7] = c(g((i) => e.addPointerElement(i), ["prevent", "stop", "self"]), ["enter"])),
1824
+ class: "multiselect__input",
1825
+ "aria-controls": "listbox-" + e.id
1826
+ }, null, 44, Je)) : f("", !0),
1827
+ r.isSingleLabelVisible ? (u(), d("span", {
1828
+ key: 1,
1829
+ class: "multiselect__single",
1830
+ onMousedown: t[9] || (t[9] = g((...i) => e.toggle && e.toggle(...i), ["prevent"]))
1831
+ }, [
1832
+ p(e.$slots, "singleLabel", { option: r.singleValue }, () => [
1833
+ k(b(e.currentOptionLabel), 1)
1834
+ ])
1835
+ ], 32)) : f("", !0),
1836
+ r.isPlaceholderVisible ? (u(), d("span", {
1837
+ key: 2,
1838
+ class: "multiselect__placeholder",
1839
+ onMousedown: t[10] || (t[10] = g((...i) => e.toggle && e.toggle(...i), ["prevent"]))
1840
+ }, [
1841
+ p(e.$slots, "placeholder", {}, () => [
1842
+ k(b(e.placeholder), 1)
1843
+ ])
1844
+ ], 32)) : f("", !0)
1845
+ ], 512),
1846
+ I(K, { name: "multiselect" }, {
1847
+ default: N(() => [
1848
+ $(h("div", {
1849
+ class: y(["multiselect__content-wrapper", e.$attrs.class]),
1850
+ onFocus: t[11] || (t[11] = (...i) => e.activate && e.activate(...i)),
1851
+ tabindex: "-1",
1852
+ onMousedown: t[12] || (t[12] = g(() => {
1853
+ }, ["prevent"])),
1854
+ style: w({ maxHeight: e.optimizedHeight + "px" }),
1855
+ ref: "list"
1856
+ }, [
1857
+ h("ul", {
1858
+ class: "multiselect__content",
1859
+ style: w(r.contentStyle),
1860
+ role: "listbox",
1861
+ id: "listbox-" + e.id
1862
+ }, [
1863
+ p(e.$slots, "beforeList"),
1864
+ e.multiple && e.max === e.internalValue.length ? (u(), d("li", Ye, [
1865
+ h("span", Qe, [
1866
+ p(e.$slots, "maxElements", {}, () => [
1867
+ k("Maximum of " + b(e.max) + " options selected. First remove a selected option to select another.", 1)
1868
+ ])
1869
+ ])
1870
+ ])) : f("", !0),
1871
+ !e.max || e.internalValue.length < e.max ? (u(!0), d(V, { key: 1 }, E(e.filteredOptions, (i, n) => (u(), d("li", {
1872
+ class: "multiselect__element",
1873
+ key: n,
1874
+ id: e.id + "-" + n,
1875
+ role: i && (i.$isLabel || i.$isDisabled) ? null : "option"
1876
+ }, [
1877
+ i && (i.$isLabel || i.$isDisabled) ? f("", !0) : (u(), d("span", {
1878
+ key: 0,
1879
+ class: y([e.optionHighlight(n, i), "multiselect__option"]),
1880
+ onClick: g((o) => e.select(i), ["stop"]),
1881
+ onMouseenter: g((o) => e.pointerSet(n), ["self"]),
1882
+ "data-select": i && i.isTag ? e.tagPlaceholder : r.selectLabelText,
1883
+ "data-selected": r.selectedLabelText,
1884
+ "data-deselect": r.deselectLabelText
1885
+ }, [
1886
+ p(e.$slots, "option", {
1887
+ option: i,
1888
+ search: e.search,
1889
+ index: n
1890
+ }, () => [
1891
+ h("span", null, b(e.getOptionLabel(i)), 1)
1892
+ ])
1893
+ ], 42, Ze)),
1894
+ i && (i.$isLabel || i.$isDisabled) ? (u(), d("span", {
1895
+ key: 1,
1896
+ "data-select": e.groupSelect && r.selectGroupLabelText,
1897
+ "data-deselect": e.groupSelect && r.deselectGroupLabelText,
1898
+ class: y([e.groupHighlight(n, i), "multiselect__option"]),
1899
+ onMouseenter: g((o) => e.groupSelect && e.pointerSet(n), ["self"]),
1900
+ onMousedown: g((o) => e.selectGroup(i), ["prevent"])
1901
+ }, [
1902
+ p(e.$slots, "option", {
1903
+ option: i,
1904
+ search: e.search,
1905
+ index: n
1906
+ }, () => [
1907
+ h("span", null, b(e.getOptionLabel(i)), 1)
1908
+ ])
1909
+ ], 42, xe)) : f("", !0)
1910
+ ], 8, Xe))), 128)) : f("", !0),
1911
+ $(h("li", null, [
1912
+ h("span", _e, [
1913
+ p(e.$slots, "noResult", { search: e.search }, () => [
1914
+ k("No elements found. Consider changing the search query.")
1915
+ ])
1916
+ ])
1917
+ ], 512), [
1918
+ [S, s.showNoResults && e.filteredOptions.length === 0 && e.search && !s.loading]
1919
+ ]),
1920
+ $(h("li", null, [
1921
+ h("span", et, [
1922
+ p(e.$slots, "noOptions", {}, () => [
1923
+ k("List is empty.")
1924
+ ])
1925
+ ])
1926
+ ], 512), [
1927
+ [S, s.showNoOptions && (e.options.length === 0 || r.hasOptionGroup === !0 && e.filteredOptions.length === 0) && !e.search && !s.loading]
1928
+ ]),
1929
+ p(e.$slots, "afterList")
1930
+ ], 12, We)
1931
+ ], 38), [
1932
+ [S, e.isOpen]
1933
+ ])
1934
+ ]),
1935
+ _: 3
1936
+ })
1937
+ ], 42, Re);
1938
+ }
1939
+ const rt = /* @__PURE__ */ D(Ne, [["render", tt]]);
1940
+ export {
1941
+ nt as C,
1942
+ rt as S,
1943
+ at as _
1944
+ };