@ed.yakovich/component-library 0.0.11 → 0.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/InfoBanner/index.js +23 -4
- package/dist/main.js +1 -1
- package/package.json +2 -5
- package/dist/index-0d8e0844-BJzWsYCM.js +0 -7403
- package/dist/index-By9FNwDt.js +0 -29159
- package/dist/index-b30029d4-WVn-64c9.js +0 -12
- package/dist/index-e6818ded-r_t6ryaW.js +0 -57
- package/dist/index.esm-322571ff-D1REhsOg.js +0 -41
- package/dist/prism-accordion.entry-Cx9R3pGR.js +0 -51
- package/dist/prism-avatar_2.entry-BYgG-lCw.js +0 -68
- package/dist/prism-badge.entry-7tkOjkOC.js +0 -58
- package/dist/prism-banner.entry-jfMhWTJ-.js +0 -82
- package/dist/prism-breadcrumb.entry-6BKiTFvg.js +0 -33
- package/dist/prism-button_2.entry-DnnPRWBp.js +0 -110
- package/dist/prism-card.entry-CkJQnJF8.js +0 -119
- package/dist/prism-carousel.entry-CjyHpSoz.js +0 -3111
- package/dist/prism-checkbox-group.entry-h68bFMNT.js +0 -62
- package/dist/prism-checkbox.entry-BnqA0ld6.js +0 -99
- package/dist/prism-data-table.entry-CRJbrNmp.js +0 -10475
- package/dist/prism-datepicker.entry-Xu0QUY2Q.js +0 -249
- package/dist/prism-form.entry-BJl2ma6x.js +0 -42
- package/dist/prism-grid.entry-DIdkZa73.js +0 -28
- package/dist/prism-header.entry-BZVXHBCx.js +0 -202
- package/dist/prism-hero.entry-D6vT9Cfs.js +0 -23
- package/dist/prism-icon_2.entry-u0DT931p.js +0 -118
- package/dist/prism-image.entry-Db2L08jh.js +0 -38
- package/dist/prism-input-file.entry-NMZff8Re.js +0 -119
- package/dist/prism-input-otp.entry-qFelMElv.js +0 -63
- package/dist/prism-input-text.entry-YbQ3NQuB.js +0 -228
- package/dist/prism-input-textarea.entry-Bz7ecyna.js +0 -140
- package/dist/prism-layout.entry-DVLlE1S8.js +0 -20
- package/dist/prism-lineitem.entry-BOUyDMlc.js +0 -44
- package/dist/prism-menu.entry-TqJabKKs.js +0 -231
- package/dist/prism-modal.entry-CiIsey_Y.js +0 -94
- package/dist/prism-pagination.entry-BZOMunz-.js +0 -60
- package/dist/prism-popover.entry-Bt1uXSV9.js +0 -1013
- package/dist/prism-popper.entry-Ck2qBmqM.js +0 -959
- package/dist/prism-progress.entry-DobqcGx4.js +0 -79
- package/dist/prism-radio-group.entry-DTVEUN2r.js +0 -66
- package/dist/prism-radio.entry-D0dGSQn2.js +0 -101
- package/dist/prism-select.entry-CRYklxK0.js +0 -230
- package/dist/prism-switch.entry-CINfgY_6.js +0 -95
- package/dist/prism-tab.entry-dV7AljQC.js +0 -20
- package/dist/prism-tabs.entry-DPc_2ypT.js +0 -70
- package/dist/prism-tooltip.entry-DZJ2tfFV.js +0 -52
- package/dist/prism-typeahead.entry-DDkmHo72.js +0 -1234
|
@@ -1,1234 +0,0 @@
|
|
|
1
|
-
import { r as pe, c as Q, h as p, F as X, H as fe, g as me } from "./index-By9FNwDt.js";
|
|
2
|
-
import { r as J } from "./index.esm-322571ff-D1REhsOg.js";
|
|
3
|
-
import { g as ge, r as ye, m as be } from "./index-e6818ded-r_t6ryaW.js";
|
|
4
|
-
/*!
|
|
5
|
-
* Copyright (c) 2025 Comcast. Prism UI - v7.32.2 - made with ❤️ in Philadelphia
|
|
6
|
-
*/
|
|
7
|
-
function E(s) {
|
|
8
|
-
return Array.isArray ? Array.isArray(s) : ae(s) === "[object Array]";
|
|
9
|
-
}
|
|
10
|
-
const ve = 1 / 0;
|
|
11
|
-
function xe(s) {
|
|
12
|
-
if (typeof s == "string")
|
|
13
|
-
return s;
|
|
14
|
-
let e = s + "";
|
|
15
|
-
return e == "0" && 1 / s == -ve ? "-0" : e;
|
|
16
|
-
}
|
|
17
|
-
function we(s) {
|
|
18
|
-
return s == null ? "" : xe(s);
|
|
19
|
-
}
|
|
20
|
-
function M(s) {
|
|
21
|
-
return typeof s == "string";
|
|
22
|
-
}
|
|
23
|
-
function ie(s) {
|
|
24
|
-
return typeof s == "number";
|
|
25
|
-
}
|
|
26
|
-
function ke(s) {
|
|
27
|
-
return s === !0 || s === !1 || Me(s) && ae(s) == "[object Boolean]";
|
|
28
|
-
}
|
|
29
|
-
function re(s) {
|
|
30
|
-
return typeof s == "object";
|
|
31
|
-
}
|
|
32
|
-
function Me(s) {
|
|
33
|
-
return re(s) && s !== null;
|
|
34
|
-
}
|
|
35
|
-
function x(s) {
|
|
36
|
-
return s != null;
|
|
37
|
-
}
|
|
38
|
-
function D(s) {
|
|
39
|
-
return !s.trim().length;
|
|
40
|
-
}
|
|
41
|
-
function ae(s) {
|
|
42
|
-
return s == null ? s === void 0 ? "[object Undefined]" : "[object Null]" : Object.prototype.toString.call(s);
|
|
43
|
-
}
|
|
44
|
-
const Ee = "Incorrect 'index' type", _e = (s) => `Invalid value for key ${s}`, Ie = (s) => `Pattern length exceeds max of ${s}.`, Se = (s) => `Missing ${s} property in key`, Le = (s) => `Property 'weight' in key '${s}' must be a positive integer`, Z = Object.prototype.hasOwnProperty;
|
|
45
|
-
class Ae {
|
|
46
|
-
constructor(e) {
|
|
47
|
-
this._keys = [], this._keyMap = {};
|
|
48
|
-
let t = 0;
|
|
49
|
-
e.forEach((i) => {
|
|
50
|
-
let r = ne(i);
|
|
51
|
-
t += r.weight, this._keys.push(r), this._keyMap[r.id] = r, t += r.weight;
|
|
52
|
-
}), this._keys.forEach((i) => {
|
|
53
|
-
i.weight /= t;
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
get(e) {
|
|
57
|
-
return this._keyMap[e];
|
|
58
|
-
}
|
|
59
|
-
keys() {
|
|
60
|
-
return this._keys;
|
|
61
|
-
}
|
|
62
|
-
toJSON() {
|
|
63
|
-
return JSON.stringify(this._keys);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
function ne(s) {
|
|
67
|
-
let e = null, t = null, i = null, r = 1, a = null;
|
|
68
|
-
if (M(s) || E(s))
|
|
69
|
-
i = s, e = q(s), t = j(s);
|
|
70
|
-
else {
|
|
71
|
-
if (!Z.call(s, "name"))
|
|
72
|
-
throw new Error(Se("name"));
|
|
73
|
-
const n = s.name;
|
|
74
|
-
if (i = n, Z.call(s, "weight") && (r = s.weight, r <= 0))
|
|
75
|
-
throw new Error(Le(n));
|
|
76
|
-
e = q(n), t = j(n), a = s.getFn;
|
|
77
|
-
}
|
|
78
|
-
return { path: e, id: t, weight: r, src: i, getFn: a };
|
|
79
|
-
}
|
|
80
|
-
function q(s) {
|
|
81
|
-
return E(s) ? s : s.split(".");
|
|
82
|
-
}
|
|
83
|
-
function j(s) {
|
|
84
|
-
return E(s) ? s.join(".") : s;
|
|
85
|
-
}
|
|
86
|
-
function Re(s, e) {
|
|
87
|
-
let t = [], i = !1;
|
|
88
|
-
const r = (a, n, o) => {
|
|
89
|
-
if (x(a))
|
|
90
|
-
if (!n[o])
|
|
91
|
-
t.push(a);
|
|
92
|
-
else {
|
|
93
|
-
let l = n[o];
|
|
94
|
-
const c = a[l];
|
|
95
|
-
if (!x(c))
|
|
96
|
-
return;
|
|
97
|
-
if (o === n.length - 1 && (M(c) || ie(c) || ke(c)))
|
|
98
|
-
t.push(we(c));
|
|
99
|
-
else if (E(c)) {
|
|
100
|
-
i = !0;
|
|
101
|
-
for (let h = 0, d = c.length; h < d; h += 1)
|
|
102
|
-
r(c[h], n, o + 1);
|
|
103
|
-
} else n.length && r(c, n, o + 1);
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
return r(s, M(e) ? e.split(".") : e, 0), i ? t : t[0];
|
|
107
|
-
}
|
|
108
|
-
const Oe = {
|
|
109
|
-
// Whether the matches should be included in the result set. When `true`, each record in the result
|
|
110
|
-
// set will include the indices of the matched characters.
|
|
111
|
-
// These can consequently be used for highlighting purposes.
|
|
112
|
-
includeMatches: !1,
|
|
113
|
-
// When `true`, the matching function will continue to the end of a search pattern even if
|
|
114
|
-
// a perfect match has already been located in the string.
|
|
115
|
-
findAllMatches: !1,
|
|
116
|
-
// Minimum number of characters that must be matched before a result is considered a match
|
|
117
|
-
minMatchCharLength: 1
|
|
118
|
-
}, Ce = {
|
|
119
|
-
// When `true`, the algorithm continues searching to the end of the input even if a perfect
|
|
120
|
-
// match is found before the end of the same input.
|
|
121
|
-
isCaseSensitive: !1,
|
|
122
|
-
// When true, the matching function will continue to the end of a search pattern even if
|
|
123
|
-
includeScore: !1,
|
|
124
|
-
// List of properties that will be searched. This also supports nested properties.
|
|
125
|
-
keys: [],
|
|
126
|
-
// Whether to sort the result list, by score
|
|
127
|
-
shouldSort: !0,
|
|
128
|
-
// Default sort function: sort by ascending score, ascending index
|
|
129
|
-
sortFn: (s, e) => s.score === e.score ? s.idx < e.idx ? -1 : 1 : s.score < e.score ? -1 : 1
|
|
130
|
-
}, Ve = {
|
|
131
|
-
// Approximately where in the text is the pattern expected to be found?
|
|
132
|
-
location: 0,
|
|
133
|
-
// At what point does the match algorithm give up. A threshold of '0.0' requires a perfect match
|
|
134
|
-
// (of both letters and location), a threshold of '1.0' would match anything.
|
|
135
|
-
threshold: 0.6,
|
|
136
|
-
// Determines how close the match must be to the fuzzy location (specified above).
|
|
137
|
-
// An exact letter match which is 'distance' characters away from the fuzzy location
|
|
138
|
-
// would score as a complete mismatch. A distance of '0' requires the match be at
|
|
139
|
-
// the exact location specified, a threshold of '1000' would require a perfect match
|
|
140
|
-
// to be within 800 characters of the fuzzy location to be found using a 0.8 threshold.
|
|
141
|
-
distance: 100
|
|
142
|
-
}, $e = {
|
|
143
|
-
// When `true`, it enables the use of unix-like search commands
|
|
144
|
-
useExtendedSearch: !1,
|
|
145
|
-
// The get function to use when fetching an object's properties.
|
|
146
|
-
// The default will search nested paths *ie foo.bar.baz*
|
|
147
|
-
getFn: Re,
|
|
148
|
-
// When `true`, search will ignore `location` and `distance`, so it won't matter
|
|
149
|
-
// where in the string the pattern appears.
|
|
150
|
-
// More info: https://fusejs.io/concepts/scoring-theory.html#fuzziness-score
|
|
151
|
-
ignoreLocation: !1,
|
|
152
|
-
// When `true`, the calculation for the relevance score (used for sorting) will
|
|
153
|
-
// ignore the field-length norm.
|
|
154
|
-
// More info: https://fusejs.io/concepts/scoring-theory.html#field-length-norm
|
|
155
|
-
ignoreFieldNorm: !1,
|
|
156
|
-
// The weight to determine how much field length norm effects scoring.
|
|
157
|
-
fieldNormWeight: 1
|
|
158
|
-
};
|
|
159
|
-
var u = {
|
|
160
|
-
...Ce,
|
|
161
|
-
...Oe,
|
|
162
|
-
...Ve,
|
|
163
|
-
...$e
|
|
164
|
-
};
|
|
165
|
-
const Fe = /[^ ]+/g;
|
|
166
|
-
function Ne(s = 1, e = 3) {
|
|
167
|
-
const t = /* @__PURE__ */ new Map(), i = Math.pow(10, e);
|
|
168
|
-
return {
|
|
169
|
-
get(r) {
|
|
170
|
-
const a = r.match(Fe).length;
|
|
171
|
-
if (t.has(a))
|
|
172
|
-
return t.get(a);
|
|
173
|
-
const n = 1 / Math.pow(a, 0.5 * s), o = parseFloat(Math.round(n * i) / i);
|
|
174
|
-
return t.set(a, o), o;
|
|
175
|
-
},
|
|
176
|
-
clear() {
|
|
177
|
-
t.clear();
|
|
178
|
-
}
|
|
179
|
-
};
|
|
180
|
-
}
|
|
181
|
-
class U {
|
|
182
|
-
constructor({
|
|
183
|
-
getFn: e = u.getFn,
|
|
184
|
-
fieldNormWeight: t = u.fieldNormWeight
|
|
185
|
-
} = {}) {
|
|
186
|
-
this.norm = Ne(t, 3), this.getFn = e, this.isCreated = !1, this.setIndexRecords();
|
|
187
|
-
}
|
|
188
|
-
setSources(e = []) {
|
|
189
|
-
this.docs = e;
|
|
190
|
-
}
|
|
191
|
-
setIndexRecords(e = []) {
|
|
192
|
-
this.records = e;
|
|
193
|
-
}
|
|
194
|
-
setKeys(e = []) {
|
|
195
|
-
this.keys = e, this._keysMap = {}, e.forEach((t, i) => {
|
|
196
|
-
this._keysMap[t.id] = i;
|
|
197
|
-
});
|
|
198
|
-
}
|
|
199
|
-
create() {
|
|
200
|
-
this.isCreated || !this.docs.length || (this.isCreated = !0, M(this.docs[0]) ? this.docs.forEach((e, t) => {
|
|
201
|
-
this._addString(e, t);
|
|
202
|
-
}) : this.docs.forEach((e, t) => {
|
|
203
|
-
this._addObject(e, t);
|
|
204
|
-
}), this.norm.clear());
|
|
205
|
-
}
|
|
206
|
-
// Adds a doc to the end of the index
|
|
207
|
-
add(e) {
|
|
208
|
-
const t = this.size();
|
|
209
|
-
M(e) ? this._addString(e, t) : this._addObject(e, t);
|
|
210
|
-
}
|
|
211
|
-
// Removes the doc at the specified index of the index
|
|
212
|
-
removeAt(e) {
|
|
213
|
-
this.records.splice(e, 1);
|
|
214
|
-
for (let t = e, i = this.size(); t < i; t += 1)
|
|
215
|
-
this.records[t].i -= 1;
|
|
216
|
-
}
|
|
217
|
-
getValueForItemAtKeyId(e, t) {
|
|
218
|
-
return e[this._keysMap[t]];
|
|
219
|
-
}
|
|
220
|
-
size() {
|
|
221
|
-
return this.records.length;
|
|
222
|
-
}
|
|
223
|
-
_addString(e, t) {
|
|
224
|
-
if (!x(e) || D(e))
|
|
225
|
-
return;
|
|
226
|
-
let i = {
|
|
227
|
-
v: e,
|
|
228
|
-
i: t,
|
|
229
|
-
n: this.norm.get(e)
|
|
230
|
-
};
|
|
231
|
-
this.records.push(i);
|
|
232
|
-
}
|
|
233
|
-
_addObject(e, t) {
|
|
234
|
-
let i = { i: t, $: {} };
|
|
235
|
-
this.keys.forEach((r, a) => {
|
|
236
|
-
let n = r.getFn ? r.getFn(e) : this.getFn(e, r.path);
|
|
237
|
-
if (x(n)) {
|
|
238
|
-
if (E(n)) {
|
|
239
|
-
let o = [];
|
|
240
|
-
const l = [{ nestedArrIndex: -1, value: n }];
|
|
241
|
-
for (; l.length; ) {
|
|
242
|
-
const { nestedArrIndex: c, value: h } = l.pop();
|
|
243
|
-
if (x(h))
|
|
244
|
-
if (M(h) && !D(h)) {
|
|
245
|
-
let d = {
|
|
246
|
-
v: h,
|
|
247
|
-
i: c,
|
|
248
|
-
n: this.norm.get(h)
|
|
249
|
-
};
|
|
250
|
-
o.push(d);
|
|
251
|
-
} else E(h) && h.forEach((d, f) => {
|
|
252
|
-
l.push({
|
|
253
|
-
nestedArrIndex: f,
|
|
254
|
-
value: d
|
|
255
|
-
});
|
|
256
|
-
});
|
|
257
|
-
}
|
|
258
|
-
i.$[a] = o;
|
|
259
|
-
} else if (M(n) && !D(n)) {
|
|
260
|
-
let o = {
|
|
261
|
-
v: n,
|
|
262
|
-
n: this.norm.get(n)
|
|
263
|
-
};
|
|
264
|
-
i.$[a] = o;
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
}), this.records.push(i);
|
|
268
|
-
}
|
|
269
|
-
toJSON() {
|
|
270
|
-
return {
|
|
271
|
-
keys: this.keys,
|
|
272
|
-
records: this.records
|
|
273
|
-
};
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
function oe(s, e, { getFn: t = u.getFn, fieldNormWeight: i = u.fieldNormWeight } = {}) {
|
|
277
|
-
const r = new U({ getFn: t, fieldNormWeight: i });
|
|
278
|
-
return r.setKeys(s.map(ne)), r.setSources(e), r.create(), r;
|
|
279
|
-
}
|
|
280
|
-
function Pe(s, { getFn: e = u.getFn, fieldNormWeight: t = u.fieldNormWeight } = {}) {
|
|
281
|
-
const { keys: i, records: r } = s, a = new U({ getFn: e, fieldNormWeight: t });
|
|
282
|
-
return a.setKeys(i), a.setIndexRecords(r), a;
|
|
283
|
-
}
|
|
284
|
-
function F(s, {
|
|
285
|
-
errors: e = 0,
|
|
286
|
-
currentLocation: t = 0,
|
|
287
|
-
expectedLocation: i = 0,
|
|
288
|
-
distance: r = u.distance,
|
|
289
|
-
ignoreLocation: a = u.ignoreLocation
|
|
290
|
-
} = {}) {
|
|
291
|
-
const n = e / s.length;
|
|
292
|
-
if (a)
|
|
293
|
-
return n;
|
|
294
|
-
const o = Math.abs(i - t);
|
|
295
|
-
return r ? n + o / r : o ? 1 : n;
|
|
296
|
-
}
|
|
297
|
-
function Te(s = [], e = u.minMatchCharLength) {
|
|
298
|
-
let t = [], i = -1, r = -1, a = 0;
|
|
299
|
-
for (let n = s.length; a < n; a += 1) {
|
|
300
|
-
let o = s[a];
|
|
301
|
-
o && i === -1 ? i = a : !o && i !== -1 && (r = a - 1, r - i + 1 >= e && t.push([i, r]), i = -1);
|
|
302
|
-
}
|
|
303
|
-
return s[a - 1] && a - i >= e && t.push([i, a - 1]), t;
|
|
304
|
-
}
|
|
305
|
-
const A = 32;
|
|
306
|
-
function De(s, e, t, {
|
|
307
|
-
location: i = u.location,
|
|
308
|
-
distance: r = u.distance,
|
|
309
|
-
threshold: a = u.threshold,
|
|
310
|
-
findAllMatches: n = u.findAllMatches,
|
|
311
|
-
minMatchCharLength: o = u.minMatchCharLength,
|
|
312
|
-
includeMatches: l = u.includeMatches,
|
|
313
|
-
ignoreLocation: c = u.ignoreLocation
|
|
314
|
-
} = {}) {
|
|
315
|
-
if (e.length > A)
|
|
316
|
-
throw new Error(Ie(A));
|
|
317
|
-
const h = e.length, d = s.length, f = Math.max(0, Math.min(i, d));
|
|
318
|
-
let m = a, g = f;
|
|
319
|
-
const y = o > 1 || l, b = y ? Array(d) : [];
|
|
320
|
-
let v;
|
|
321
|
-
for (; (v = s.indexOf(e, g)) > -1; ) {
|
|
322
|
-
let w = F(e, {
|
|
323
|
-
currentLocation: v,
|
|
324
|
-
expectedLocation: f,
|
|
325
|
-
distance: r,
|
|
326
|
-
ignoreLocation: c
|
|
327
|
-
});
|
|
328
|
-
if (m = Math.min(w, m), g = v + h, y) {
|
|
329
|
-
let _ = 0;
|
|
330
|
-
for (; _ < h; )
|
|
331
|
-
b[v + _] = 1, _ += 1;
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
g = -1;
|
|
335
|
-
let R = [], L = 1, V = h + d;
|
|
336
|
-
const ue = 1 << h - 1;
|
|
337
|
-
for (let w = 0; w < h; w += 1) {
|
|
338
|
-
let _ = 0, I = V;
|
|
339
|
-
for (; _ < I; )
|
|
340
|
-
F(e, {
|
|
341
|
-
errors: w,
|
|
342
|
-
currentLocation: f + I,
|
|
343
|
-
expectedLocation: f,
|
|
344
|
-
distance: r,
|
|
345
|
-
ignoreLocation: c
|
|
346
|
-
}) <= m ? _ = I : V = I, I = Math.floor((V - _) / 2 + _);
|
|
347
|
-
V = I;
|
|
348
|
-
let G = Math.max(1, f - I + 1), T = n ? d : Math.min(f + I, d) + h, O = Array(T + 2);
|
|
349
|
-
O[T + 1] = (1 << w) - 1;
|
|
350
|
-
for (let k = T; k >= G; k -= 1) {
|
|
351
|
-
let $ = k - 1, Y = t[s.charAt($)];
|
|
352
|
-
if (y && (b[$] = +!!Y), O[k] = (O[k + 1] << 1 | 1) & Y, w && (O[k] |= (R[k + 1] | R[k]) << 1 | 1 | R[k + 1]), O[k] & ue && (L = F(e, {
|
|
353
|
-
errors: w,
|
|
354
|
-
currentLocation: $,
|
|
355
|
-
expectedLocation: f,
|
|
356
|
-
distance: r,
|
|
357
|
-
ignoreLocation: c
|
|
358
|
-
}), L <= m)) {
|
|
359
|
-
if (m = L, g = $, g <= f)
|
|
360
|
-
break;
|
|
361
|
-
G = Math.max(1, 2 * f - g);
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
if (F(e, {
|
|
365
|
-
errors: w + 1,
|
|
366
|
-
currentLocation: f,
|
|
367
|
-
expectedLocation: f,
|
|
368
|
-
distance: r,
|
|
369
|
-
ignoreLocation: c
|
|
370
|
-
}) > m)
|
|
371
|
-
break;
|
|
372
|
-
R = O;
|
|
373
|
-
}
|
|
374
|
-
const P = {
|
|
375
|
-
isMatch: g >= 0,
|
|
376
|
-
// Count exact matches (those with a score of 0) to be "almost" exact
|
|
377
|
-
score: Math.max(1e-3, L)
|
|
378
|
-
};
|
|
379
|
-
if (y) {
|
|
380
|
-
const w = Te(b, o);
|
|
381
|
-
w.length ? l && (P.indices = w) : P.isMatch = !1;
|
|
382
|
-
}
|
|
383
|
-
return P;
|
|
384
|
-
}
|
|
385
|
-
function je(s) {
|
|
386
|
-
let e = {};
|
|
387
|
-
for (let t = 0, i = s.length; t < i; t += 1) {
|
|
388
|
-
const r = s.charAt(t);
|
|
389
|
-
e[r] = (e[r] || 0) | 1 << i - t - 1;
|
|
390
|
-
}
|
|
391
|
-
return e;
|
|
392
|
-
}
|
|
393
|
-
class le {
|
|
394
|
-
constructor(e, {
|
|
395
|
-
location: t = u.location,
|
|
396
|
-
threshold: i = u.threshold,
|
|
397
|
-
distance: r = u.distance,
|
|
398
|
-
includeMatches: a = u.includeMatches,
|
|
399
|
-
findAllMatches: n = u.findAllMatches,
|
|
400
|
-
minMatchCharLength: o = u.minMatchCharLength,
|
|
401
|
-
isCaseSensitive: l = u.isCaseSensitive,
|
|
402
|
-
ignoreLocation: c = u.ignoreLocation
|
|
403
|
-
} = {}) {
|
|
404
|
-
if (this.options = {
|
|
405
|
-
location: t,
|
|
406
|
-
threshold: i,
|
|
407
|
-
distance: r,
|
|
408
|
-
includeMatches: a,
|
|
409
|
-
findAllMatches: n,
|
|
410
|
-
minMatchCharLength: o,
|
|
411
|
-
isCaseSensitive: l,
|
|
412
|
-
ignoreLocation: c
|
|
413
|
-
}, this.pattern = l ? e : e.toLowerCase(), this.chunks = [], !this.pattern.length)
|
|
414
|
-
return;
|
|
415
|
-
const h = (f, m) => {
|
|
416
|
-
this.chunks.push({
|
|
417
|
-
pattern: f,
|
|
418
|
-
alphabet: je(f),
|
|
419
|
-
startIndex: m
|
|
420
|
-
});
|
|
421
|
-
}, d = this.pattern.length;
|
|
422
|
-
if (d > A) {
|
|
423
|
-
let f = 0;
|
|
424
|
-
const m = d % A, g = d - m;
|
|
425
|
-
for (; f < g; )
|
|
426
|
-
h(this.pattern.substr(f, A), f), f += A;
|
|
427
|
-
if (m) {
|
|
428
|
-
const y = d - A;
|
|
429
|
-
h(this.pattern.substr(y), y);
|
|
430
|
-
}
|
|
431
|
-
} else
|
|
432
|
-
h(this.pattern, 0);
|
|
433
|
-
}
|
|
434
|
-
searchIn(e) {
|
|
435
|
-
const { isCaseSensitive: t, includeMatches: i } = this.options;
|
|
436
|
-
if (t || (e = e.toLowerCase()), this.pattern === e) {
|
|
437
|
-
let g = {
|
|
438
|
-
isMatch: !0,
|
|
439
|
-
score: 0
|
|
440
|
-
};
|
|
441
|
-
return i && (g.indices = [[0, e.length - 1]]), g;
|
|
442
|
-
}
|
|
443
|
-
const {
|
|
444
|
-
location: r,
|
|
445
|
-
distance: a,
|
|
446
|
-
threshold: n,
|
|
447
|
-
findAllMatches: o,
|
|
448
|
-
minMatchCharLength: l,
|
|
449
|
-
ignoreLocation: c
|
|
450
|
-
} = this.options;
|
|
451
|
-
let h = [], d = 0, f = !1;
|
|
452
|
-
this.chunks.forEach(({ pattern: g, alphabet: y, startIndex: b }) => {
|
|
453
|
-
const { isMatch: v, score: R, indices: L } = De(e, g, y, {
|
|
454
|
-
location: r + b,
|
|
455
|
-
distance: a,
|
|
456
|
-
threshold: n,
|
|
457
|
-
findAllMatches: o,
|
|
458
|
-
minMatchCharLength: l,
|
|
459
|
-
includeMatches: i,
|
|
460
|
-
ignoreLocation: c
|
|
461
|
-
});
|
|
462
|
-
v && (f = !0), d += R, v && L && (h = [...h, ...L]);
|
|
463
|
-
});
|
|
464
|
-
let m = {
|
|
465
|
-
isMatch: f,
|
|
466
|
-
score: f ? d / this.chunks.length : 1
|
|
467
|
-
};
|
|
468
|
-
return f && i && (m.indices = h), m;
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
class S {
|
|
472
|
-
constructor(e) {
|
|
473
|
-
this.pattern = e;
|
|
474
|
-
}
|
|
475
|
-
static isMultiMatch(e) {
|
|
476
|
-
return ee(e, this.multiRegex);
|
|
477
|
-
}
|
|
478
|
-
static isSingleMatch(e) {
|
|
479
|
-
return ee(e, this.singleRegex);
|
|
480
|
-
}
|
|
481
|
-
search() {
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
function ee(s, e) {
|
|
485
|
-
const t = s.match(e);
|
|
486
|
-
return t ? t[1] : null;
|
|
487
|
-
}
|
|
488
|
-
class ze extends S {
|
|
489
|
-
constructor(e) {
|
|
490
|
-
super(e);
|
|
491
|
-
}
|
|
492
|
-
static get type() {
|
|
493
|
-
return "exact";
|
|
494
|
-
}
|
|
495
|
-
static get multiRegex() {
|
|
496
|
-
return /^="(.*)"$/;
|
|
497
|
-
}
|
|
498
|
-
static get singleRegex() {
|
|
499
|
-
return /^=(.*)$/;
|
|
500
|
-
}
|
|
501
|
-
search(e) {
|
|
502
|
-
const t = e === this.pattern;
|
|
503
|
-
return {
|
|
504
|
-
isMatch: t,
|
|
505
|
-
score: t ? 0 : 1,
|
|
506
|
-
indices: [0, this.pattern.length - 1]
|
|
507
|
-
};
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
class He extends S {
|
|
511
|
-
constructor(e) {
|
|
512
|
-
super(e);
|
|
513
|
-
}
|
|
514
|
-
static get type() {
|
|
515
|
-
return "inverse-exact";
|
|
516
|
-
}
|
|
517
|
-
static get multiRegex() {
|
|
518
|
-
return /^!"(.*)"$/;
|
|
519
|
-
}
|
|
520
|
-
static get singleRegex() {
|
|
521
|
-
return /^!(.*)$/;
|
|
522
|
-
}
|
|
523
|
-
search(e) {
|
|
524
|
-
const i = e.indexOf(this.pattern) === -1;
|
|
525
|
-
return {
|
|
526
|
-
isMatch: i,
|
|
527
|
-
score: i ? 0 : 1,
|
|
528
|
-
indices: [0, e.length - 1]
|
|
529
|
-
};
|
|
530
|
-
}
|
|
531
|
-
}
|
|
532
|
-
class Ke extends S {
|
|
533
|
-
constructor(e) {
|
|
534
|
-
super(e);
|
|
535
|
-
}
|
|
536
|
-
static get type() {
|
|
537
|
-
return "prefix-exact";
|
|
538
|
-
}
|
|
539
|
-
static get multiRegex() {
|
|
540
|
-
return /^\^"(.*)"$/;
|
|
541
|
-
}
|
|
542
|
-
static get singleRegex() {
|
|
543
|
-
return /^\^(.*)$/;
|
|
544
|
-
}
|
|
545
|
-
search(e) {
|
|
546
|
-
const t = e.startsWith(this.pattern);
|
|
547
|
-
return {
|
|
548
|
-
isMatch: t,
|
|
549
|
-
score: t ? 0 : 1,
|
|
550
|
-
indices: [0, this.pattern.length - 1]
|
|
551
|
-
};
|
|
552
|
-
}
|
|
553
|
-
}
|
|
554
|
-
class We extends S {
|
|
555
|
-
constructor(e) {
|
|
556
|
-
super(e);
|
|
557
|
-
}
|
|
558
|
-
static get type() {
|
|
559
|
-
return "inverse-prefix-exact";
|
|
560
|
-
}
|
|
561
|
-
static get multiRegex() {
|
|
562
|
-
return /^!\^"(.*)"$/;
|
|
563
|
-
}
|
|
564
|
-
static get singleRegex() {
|
|
565
|
-
return /^!\^(.*)$/;
|
|
566
|
-
}
|
|
567
|
-
search(e) {
|
|
568
|
-
const t = !e.startsWith(this.pattern);
|
|
569
|
-
return {
|
|
570
|
-
isMatch: t,
|
|
571
|
-
score: t ? 0 : 1,
|
|
572
|
-
indices: [0, e.length - 1]
|
|
573
|
-
};
|
|
574
|
-
}
|
|
575
|
-
}
|
|
576
|
-
class Be extends S {
|
|
577
|
-
constructor(e) {
|
|
578
|
-
super(e);
|
|
579
|
-
}
|
|
580
|
-
static get type() {
|
|
581
|
-
return "suffix-exact";
|
|
582
|
-
}
|
|
583
|
-
static get multiRegex() {
|
|
584
|
-
return /^"(.*)"\$$/;
|
|
585
|
-
}
|
|
586
|
-
static get singleRegex() {
|
|
587
|
-
return /^(.*)\$$/;
|
|
588
|
-
}
|
|
589
|
-
search(e) {
|
|
590
|
-
const t = e.endsWith(this.pattern);
|
|
591
|
-
return {
|
|
592
|
-
isMatch: t,
|
|
593
|
-
score: t ? 0 : 1,
|
|
594
|
-
indices: [e.length - this.pattern.length, e.length - 1]
|
|
595
|
-
};
|
|
596
|
-
}
|
|
597
|
-
}
|
|
598
|
-
class Ue extends S {
|
|
599
|
-
constructor(e) {
|
|
600
|
-
super(e);
|
|
601
|
-
}
|
|
602
|
-
static get type() {
|
|
603
|
-
return "inverse-suffix-exact";
|
|
604
|
-
}
|
|
605
|
-
static get multiRegex() {
|
|
606
|
-
return /^!"(.*)"\$$/;
|
|
607
|
-
}
|
|
608
|
-
static get singleRegex() {
|
|
609
|
-
return /^!(.*)\$$/;
|
|
610
|
-
}
|
|
611
|
-
search(e) {
|
|
612
|
-
const t = !e.endsWith(this.pattern);
|
|
613
|
-
return {
|
|
614
|
-
isMatch: t,
|
|
615
|
-
score: t ? 0 : 1,
|
|
616
|
-
indices: [0, e.length - 1]
|
|
617
|
-
};
|
|
618
|
-
}
|
|
619
|
-
}
|
|
620
|
-
class ce extends S {
|
|
621
|
-
constructor(e, {
|
|
622
|
-
location: t = u.location,
|
|
623
|
-
threshold: i = u.threshold,
|
|
624
|
-
distance: r = u.distance,
|
|
625
|
-
includeMatches: a = u.includeMatches,
|
|
626
|
-
findAllMatches: n = u.findAllMatches,
|
|
627
|
-
minMatchCharLength: o = u.minMatchCharLength,
|
|
628
|
-
isCaseSensitive: l = u.isCaseSensitive,
|
|
629
|
-
ignoreLocation: c = u.ignoreLocation
|
|
630
|
-
} = {}) {
|
|
631
|
-
super(e), this._bitapSearch = new le(e, {
|
|
632
|
-
location: t,
|
|
633
|
-
threshold: i,
|
|
634
|
-
distance: r,
|
|
635
|
-
includeMatches: a,
|
|
636
|
-
findAllMatches: n,
|
|
637
|
-
minMatchCharLength: o,
|
|
638
|
-
isCaseSensitive: l,
|
|
639
|
-
ignoreLocation: c
|
|
640
|
-
});
|
|
641
|
-
}
|
|
642
|
-
static get type() {
|
|
643
|
-
return "fuzzy";
|
|
644
|
-
}
|
|
645
|
-
static get multiRegex() {
|
|
646
|
-
return /^"(.*)"$/;
|
|
647
|
-
}
|
|
648
|
-
static get singleRegex() {
|
|
649
|
-
return /^(.*)$/;
|
|
650
|
-
}
|
|
651
|
-
search(e) {
|
|
652
|
-
return this._bitapSearch.searchIn(e);
|
|
653
|
-
}
|
|
654
|
-
}
|
|
655
|
-
class he extends S {
|
|
656
|
-
constructor(e) {
|
|
657
|
-
super(e);
|
|
658
|
-
}
|
|
659
|
-
static get type() {
|
|
660
|
-
return "include";
|
|
661
|
-
}
|
|
662
|
-
static get multiRegex() {
|
|
663
|
-
return /^'"(.*)"$/;
|
|
664
|
-
}
|
|
665
|
-
static get singleRegex() {
|
|
666
|
-
return /^'(.*)$/;
|
|
667
|
-
}
|
|
668
|
-
search(e) {
|
|
669
|
-
let t = 0, i;
|
|
670
|
-
const r = [], a = this.pattern.length;
|
|
671
|
-
for (; (i = e.indexOf(this.pattern, t)) > -1; )
|
|
672
|
-
t = i + a, r.push([i, t - 1]);
|
|
673
|
-
const n = !!r.length;
|
|
674
|
-
return {
|
|
675
|
-
isMatch: n,
|
|
676
|
-
score: n ? 0 : 1,
|
|
677
|
-
indices: r
|
|
678
|
-
};
|
|
679
|
-
}
|
|
680
|
-
}
|
|
681
|
-
const z = [
|
|
682
|
-
ze,
|
|
683
|
-
he,
|
|
684
|
-
Ke,
|
|
685
|
-
We,
|
|
686
|
-
Ue,
|
|
687
|
-
Be,
|
|
688
|
-
He,
|
|
689
|
-
ce
|
|
690
|
-
], te = z.length, Ge = / +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/, Ye = "|";
|
|
691
|
-
function Qe(s, e = {}) {
|
|
692
|
-
return s.split(Ye).map((t) => {
|
|
693
|
-
let i = t.trim().split(Ge).filter((a) => a && !!a.trim()), r = [];
|
|
694
|
-
for (let a = 0, n = i.length; a < n; a += 1) {
|
|
695
|
-
const o = i[a];
|
|
696
|
-
let l = !1, c = -1;
|
|
697
|
-
for (; !l && ++c < te; ) {
|
|
698
|
-
const h = z[c];
|
|
699
|
-
let d = h.isMultiMatch(o);
|
|
700
|
-
d && (r.push(new h(d, e)), l = !0);
|
|
701
|
-
}
|
|
702
|
-
if (!l)
|
|
703
|
-
for (c = -1; ++c < te; ) {
|
|
704
|
-
const h = z[c];
|
|
705
|
-
let d = h.isSingleMatch(o);
|
|
706
|
-
if (d) {
|
|
707
|
-
r.push(new h(d, e));
|
|
708
|
-
break;
|
|
709
|
-
}
|
|
710
|
-
}
|
|
711
|
-
}
|
|
712
|
-
return r;
|
|
713
|
-
});
|
|
714
|
-
}
|
|
715
|
-
const Xe = /* @__PURE__ */ new Set([ce.type, he.type]);
|
|
716
|
-
class Je {
|
|
717
|
-
constructor(e, {
|
|
718
|
-
isCaseSensitive: t = u.isCaseSensitive,
|
|
719
|
-
includeMatches: i = u.includeMatches,
|
|
720
|
-
minMatchCharLength: r = u.minMatchCharLength,
|
|
721
|
-
ignoreLocation: a = u.ignoreLocation,
|
|
722
|
-
findAllMatches: n = u.findAllMatches,
|
|
723
|
-
location: o = u.location,
|
|
724
|
-
threshold: l = u.threshold,
|
|
725
|
-
distance: c = u.distance
|
|
726
|
-
} = {}) {
|
|
727
|
-
this.query = null, this.options = {
|
|
728
|
-
isCaseSensitive: t,
|
|
729
|
-
includeMatches: i,
|
|
730
|
-
minMatchCharLength: r,
|
|
731
|
-
findAllMatches: n,
|
|
732
|
-
ignoreLocation: a,
|
|
733
|
-
location: o,
|
|
734
|
-
threshold: l,
|
|
735
|
-
distance: c
|
|
736
|
-
}, this.pattern = t ? e : e.toLowerCase(), this.query = Qe(this.pattern, this.options);
|
|
737
|
-
}
|
|
738
|
-
static condition(e, t) {
|
|
739
|
-
return t.useExtendedSearch;
|
|
740
|
-
}
|
|
741
|
-
searchIn(e) {
|
|
742
|
-
const t = this.query;
|
|
743
|
-
if (!t)
|
|
744
|
-
return {
|
|
745
|
-
isMatch: !1,
|
|
746
|
-
score: 1
|
|
747
|
-
};
|
|
748
|
-
const { includeMatches: i, isCaseSensitive: r } = this.options;
|
|
749
|
-
e = r ? e : e.toLowerCase();
|
|
750
|
-
let a = 0, n = [], o = 0;
|
|
751
|
-
for (let l = 0, c = t.length; l < c; l += 1) {
|
|
752
|
-
const h = t[l];
|
|
753
|
-
n.length = 0, a = 0;
|
|
754
|
-
for (let d = 0, f = h.length; d < f; d += 1) {
|
|
755
|
-
const m = h[d], { isMatch: g, indices: y, score: b } = m.search(e);
|
|
756
|
-
if (g) {
|
|
757
|
-
if (a += 1, o += b, i) {
|
|
758
|
-
const v = m.constructor.type;
|
|
759
|
-
Xe.has(v) ? n = [...n, ...y] : n.push(y);
|
|
760
|
-
}
|
|
761
|
-
} else {
|
|
762
|
-
o = 0, a = 0, n.length = 0;
|
|
763
|
-
break;
|
|
764
|
-
}
|
|
765
|
-
}
|
|
766
|
-
if (a) {
|
|
767
|
-
let d = {
|
|
768
|
-
isMatch: !0,
|
|
769
|
-
score: o / a
|
|
770
|
-
};
|
|
771
|
-
return i && (d.indices = n), d;
|
|
772
|
-
}
|
|
773
|
-
}
|
|
774
|
-
return {
|
|
775
|
-
isMatch: !1,
|
|
776
|
-
score: 1
|
|
777
|
-
};
|
|
778
|
-
}
|
|
779
|
-
}
|
|
780
|
-
const H = [];
|
|
781
|
-
function Ze(...s) {
|
|
782
|
-
H.push(...s);
|
|
783
|
-
}
|
|
784
|
-
function K(s, e) {
|
|
785
|
-
for (let t = 0, i = H.length; t < i; t += 1) {
|
|
786
|
-
let r = H[t];
|
|
787
|
-
if (r.condition(s, e))
|
|
788
|
-
return new r(s, e);
|
|
789
|
-
}
|
|
790
|
-
return new le(s, e);
|
|
791
|
-
}
|
|
792
|
-
const N = {
|
|
793
|
-
AND: "$and",
|
|
794
|
-
OR: "$or"
|
|
795
|
-
}, W = {
|
|
796
|
-
PATH: "$path",
|
|
797
|
-
PATTERN: "$val"
|
|
798
|
-
}, B = (s) => !!(s[N.AND] || s[N.OR]), qe = (s) => !!s[W.PATH], et = (s) => !E(s) && re(s) && !B(s), se = (s) => ({
|
|
799
|
-
[N.AND]: Object.keys(s).map((e) => ({
|
|
800
|
-
[e]: s[e]
|
|
801
|
-
}))
|
|
802
|
-
});
|
|
803
|
-
function de(s, e, { auto: t = !0 } = {}) {
|
|
804
|
-
const i = (r) => {
|
|
805
|
-
let a = Object.keys(r);
|
|
806
|
-
const n = qe(r);
|
|
807
|
-
if (!n && a.length > 1 && !B(r))
|
|
808
|
-
return i(se(r));
|
|
809
|
-
if (et(r)) {
|
|
810
|
-
const l = n ? r[W.PATH] : a[0], c = n ? r[W.PATTERN] : r[l];
|
|
811
|
-
if (!M(c))
|
|
812
|
-
throw new Error(_e(l));
|
|
813
|
-
const h = {
|
|
814
|
-
keyId: j(l),
|
|
815
|
-
pattern: c
|
|
816
|
-
};
|
|
817
|
-
return t && (h.searcher = K(c, e)), h;
|
|
818
|
-
}
|
|
819
|
-
let o = {
|
|
820
|
-
children: [],
|
|
821
|
-
operator: a[0]
|
|
822
|
-
};
|
|
823
|
-
return a.forEach((l) => {
|
|
824
|
-
const c = r[l];
|
|
825
|
-
E(c) && c.forEach((h) => {
|
|
826
|
-
o.children.push(i(h));
|
|
827
|
-
});
|
|
828
|
-
}), o;
|
|
829
|
-
};
|
|
830
|
-
return B(s) || (s = se(s)), i(s);
|
|
831
|
-
}
|
|
832
|
-
function tt(s, { ignoreFieldNorm: e = u.ignoreFieldNorm }) {
|
|
833
|
-
s.forEach((t) => {
|
|
834
|
-
let i = 1;
|
|
835
|
-
t.matches.forEach(({ key: r, norm: a, score: n }) => {
|
|
836
|
-
const o = r ? r.weight : null;
|
|
837
|
-
i *= Math.pow(
|
|
838
|
-
n === 0 && o ? Number.EPSILON : n,
|
|
839
|
-
(o || 1) * (e ? 1 : a)
|
|
840
|
-
);
|
|
841
|
-
}), t.score = i;
|
|
842
|
-
});
|
|
843
|
-
}
|
|
844
|
-
function st(s, e) {
|
|
845
|
-
const t = s.matches;
|
|
846
|
-
e.matches = [], x(t) && t.forEach((i) => {
|
|
847
|
-
if (!x(i.indices) || !i.indices.length)
|
|
848
|
-
return;
|
|
849
|
-
const { indices: r, value: a } = i;
|
|
850
|
-
let n = {
|
|
851
|
-
indices: r,
|
|
852
|
-
value: a
|
|
853
|
-
};
|
|
854
|
-
i.key && (n.key = i.key.src), i.idx > -1 && (n.refIndex = i.idx), e.matches.push(n);
|
|
855
|
-
});
|
|
856
|
-
}
|
|
857
|
-
function it(s, e) {
|
|
858
|
-
e.score = s.score;
|
|
859
|
-
}
|
|
860
|
-
function rt(s, e, {
|
|
861
|
-
includeMatches: t = u.includeMatches,
|
|
862
|
-
includeScore: i = u.includeScore
|
|
863
|
-
} = {}) {
|
|
864
|
-
const r = [];
|
|
865
|
-
return t && r.push(st), i && r.push(it), s.map((a) => {
|
|
866
|
-
const { idx: n } = a, o = {
|
|
867
|
-
item: e[n],
|
|
868
|
-
refIndex: n
|
|
869
|
-
};
|
|
870
|
-
return r.length && r.forEach((l) => {
|
|
871
|
-
l(a, o);
|
|
872
|
-
}), o;
|
|
873
|
-
});
|
|
874
|
-
}
|
|
875
|
-
class C {
|
|
876
|
-
constructor(e, t = {}, i) {
|
|
877
|
-
this.options = { ...u, ...t }, this.options.useExtendedSearch, this._keyStore = new Ae(this.options.keys), this.setCollection(e, i);
|
|
878
|
-
}
|
|
879
|
-
setCollection(e, t) {
|
|
880
|
-
if (this._docs = e, t && !(t instanceof U))
|
|
881
|
-
throw new Error(Ee);
|
|
882
|
-
this._myIndex = t || oe(this.options.keys, this._docs, {
|
|
883
|
-
getFn: this.options.getFn,
|
|
884
|
-
fieldNormWeight: this.options.fieldNormWeight
|
|
885
|
-
});
|
|
886
|
-
}
|
|
887
|
-
add(e) {
|
|
888
|
-
x(e) && (this._docs.push(e), this._myIndex.add(e));
|
|
889
|
-
}
|
|
890
|
-
remove(e = () => !1) {
|
|
891
|
-
const t = [];
|
|
892
|
-
for (let i = 0, r = this._docs.length; i < r; i += 1) {
|
|
893
|
-
const a = this._docs[i];
|
|
894
|
-
e(a, i) && (this.removeAt(i), i -= 1, r -= 1, t.push(a));
|
|
895
|
-
}
|
|
896
|
-
return t;
|
|
897
|
-
}
|
|
898
|
-
removeAt(e) {
|
|
899
|
-
this._docs.splice(e, 1), this._myIndex.removeAt(e);
|
|
900
|
-
}
|
|
901
|
-
getIndex() {
|
|
902
|
-
return this._myIndex;
|
|
903
|
-
}
|
|
904
|
-
search(e, { limit: t = -1 } = {}) {
|
|
905
|
-
const {
|
|
906
|
-
includeMatches: i,
|
|
907
|
-
includeScore: r,
|
|
908
|
-
shouldSort: a,
|
|
909
|
-
sortFn: n,
|
|
910
|
-
ignoreFieldNorm: o
|
|
911
|
-
} = this.options;
|
|
912
|
-
let l = M(e) ? M(this._docs[0]) ? this._searchStringList(e) : this._searchObjectList(e) : this._searchLogical(e);
|
|
913
|
-
return tt(l, { ignoreFieldNorm: o }), a && l.sort(n), ie(t) && t > -1 && (l = l.slice(0, t)), rt(l, this._docs, {
|
|
914
|
-
includeMatches: i,
|
|
915
|
-
includeScore: r
|
|
916
|
-
});
|
|
917
|
-
}
|
|
918
|
-
_searchStringList(e) {
|
|
919
|
-
const t = K(e, this.options), { records: i } = this._myIndex, r = [];
|
|
920
|
-
return i.forEach(({ v: a, i: n, n: o }) => {
|
|
921
|
-
if (!x(a))
|
|
922
|
-
return;
|
|
923
|
-
const { isMatch: l, score: c, indices: h } = t.searchIn(a);
|
|
924
|
-
l && r.push({
|
|
925
|
-
item: a,
|
|
926
|
-
idx: n,
|
|
927
|
-
matches: [{ score: c, value: a, norm: o, indices: h }]
|
|
928
|
-
});
|
|
929
|
-
}), r;
|
|
930
|
-
}
|
|
931
|
-
_searchLogical(e) {
|
|
932
|
-
const t = de(e, this.options), i = (o, l, c) => {
|
|
933
|
-
if (!o.children) {
|
|
934
|
-
const { keyId: d, searcher: f } = o, m = this._findMatches({
|
|
935
|
-
key: this._keyStore.get(d),
|
|
936
|
-
value: this._myIndex.getValueForItemAtKeyId(l, d),
|
|
937
|
-
searcher: f
|
|
938
|
-
});
|
|
939
|
-
return m && m.length ? [
|
|
940
|
-
{
|
|
941
|
-
idx: c,
|
|
942
|
-
item: l,
|
|
943
|
-
matches: m
|
|
944
|
-
}
|
|
945
|
-
] : [];
|
|
946
|
-
}
|
|
947
|
-
const h = [];
|
|
948
|
-
for (let d = 0, f = o.children.length; d < f; d += 1) {
|
|
949
|
-
const m = o.children[d], g = i(m, l, c);
|
|
950
|
-
if (g.length)
|
|
951
|
-
h.push(...g);
|
|
952
|
-
else if (o.operator === N.AND)
|
|
953
|
-
return [];
|
|
954
|
-
}
|
|
955
|
-
return h;
|
|
956
|
-
}, r = this._myIndex.records, a = {}, n = [];
|
|
957
|
-
return r.forEach(({ $: o, i: l }) => {
|
|
958
|
-
if (x(o)) {
|
|
959
|
-
let c = i(t, o, l);
|
|
960
|
-
c.length && (a[l] || (a[l] = { idx: l, item: o, matches: [] }, n.push(a[l])), c.forEach(({ matches: h }) => {
|
|
961
|
-
a[l].matches.push(...h);
|
|
962
|
-
}));
|
|
963
|
-
}
|
|
964
|
-
}), n;
|
|
965
|
-
}
|
|
966
|
-
_searchObjectList(e) {
|
|
967
|
-
const t = K(e, this.options), { keys: i, records: r } = this._myIndex, a = [];
|
|
968
|
-
return r.forEach(({ $: n, i: o }) => {
|
|
969
|
-
if (!x(n))
|
|
970
|
-
return;
|
|
971
|
-
let l = [];
|
|
972
|
-
i.forEach((c, h) => {
|
|
973
|
-
l.push(
|
|
974
|
-
...this._findMatches({
|
|
975
|
-
key: c,
|
|
976
|
-
value: n[h],
|
|
977
|
-
searcher: t
|
|
978
|
-
})
|
|
979
|
-
);
|
|
980
|
-
}), l.length && a.push({
|
|
981
|
-
idx: o,
|
|
982
|
-
item: n,
|
|
983
|
-
matches: l
|
|
984
|
-
});
|
|
985
|
-
}), a;
|
|
986
|
-
}
|
|
987
|
-
_findMatches({ key: e, value: t, searcher: i }) {
|
|
988
|
-
if (!x(t))
|
|
989
|
-
return [];
|
|
990
|
-
let r = [];
|
|
991
|
-
if (E(t))
|
|
992
|
-
t.forEach(({ v: a, i: n, n: o }) => {
|
|
993
|
-
if (!x(a))
|
|
994
|
-
return;
|
|
995
|
-
const { isMatch: l, score: c, indices: h } = i.searchIn(a);
|
|
996
|
-
l && r.push({
|
|
997
|
-
score: c,
|
|
998
|
-
key: e,
|
|
999
|
-
value: a,
|
|
1000
|
-
idx: n,
|
|
1001
|
-
norm: o,
|
|
1002
|
-
indices: h
|
|
1003
|
-
});
|
|
1004
|
-
});
|
|
1005
|
-
else {
|
|
1006
|
-
const { v: a, n } = t, { isMatch: o, score: l, indices: c } = i.searchIn(a);
|
|
1007
|
-
o && r.push({ score: l, key: e, value: a, norm: n, indices: c });
|
|
1008
|
-
}
|
|
1009
|
-
return r;
|
|
1010
|
-
}
|
|
1011
|
-
}
|
|
1012
|
-
C.version = "6.6.2";
|
|
1013
|
-
C.createIndex = oe;
|
|
1014
|
-
C.parseIndex = Pe;
|
|
1015
|
-
C.config = u;
|
|
1016
|
-
C.parseQuery = de;
|
|
1017
|
-
Ze(Je);
|
|
1018
|
-
const at = ".sc-prism-typeahead-h{--prism-typeahead-results-height:50vh;display:block;position:relative}.input.sc-prism-typeahead{--input-margin-bottom:0}.announcement.sc-prism-typeahead{clip:rect(0,0,0,0);border-width:0;height:1px;margin:-1px;overflow:hidden;padding:0;white-space:nowrap;width:1px}.announcement.sc-prism-typeahead,.results.sc-prism-typeahead{position:absolute}.results.sc-prism-typeahead{--tw-border-opacity:1;--tw-border-opacity:var(--border-opacity-tertiary,0.15);--tw-bg-opacity:1;--shadow-color:var(--material-neutral-base-shadow);--tw-shadow:0px 4px 8px -4px var(--shadow-color);--tw-shadow-colored:0px 4px 8px -4px var(--tw-shadow-color);background-color:rgb(var(--background-color-material-neutral-base)/var(--tw-bg-opacity));border-color:rgb(var(--border-color-stroke-neutral-base)/var(--tw-border-opacity));border-radius:var(--border-radius-medium,8px);border-style:solid;border-width:1px;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);display:none;left:0;margin-top:.25rem;max-height:var(--prism-typeahead-results-height);overflow:auto;top:0;width:100%;z-index:500}.results.top.sc-prism-typeahead{bottom:var(--bottom);max-height:12rem;top:inherit}.results-header.sc-prism-typeahead{align-items:center;display:flex;justify-content:space-between;margin-bottom:.25rem;padding-left:1rem;padding-right:1rem;padding-top:.75rem}.clear.sc-prism-typeahead{display:none}.clear.show.sc-prism-typeahead{display:block}.selections.sc-prism-typeahead{display:flex;flex-direction:row;flex-wrap:wrap;margin-top:.25rem;row-gap:.25rem}.selections.sc-prism-typeahead>.sc-prism-typeahead:not([hidden])~.sc-prism-typeahead:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(.25rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(.25rem*var(--tw-space-x-reverse))}.selections.sc-prism-typeahead{max-height:50vh}.remove.sc-prism-typeahead{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:var(--background-color-transparent,transparent);border-style:none;line-height:0;margin-left:.5rem}.remove-icon.sc-prism-typeahead{--icon-width:0.625rem;--icon-height:0.625rem}.remove.sc-prism-typeahead:focus{border-radius:50%;outline-color:var(--outline-color-neutral-base,#141417)}.results-container.sc-prism-typeahead{position:relative}.open.sc-prism-typeahead:not(.zero){display:block}.multi-controls.sc-prism-typeahead>.sc-prism-typeahead:not([hidden])~.sc-prism-typeahead:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(.5rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(.5rem*var(--tw-space-x-reverse))}.result-list.sc-prism-typeahead{list-style:none;margin:0;padding:0}.flush.sc-prism-typeahead{--checkbox-margin-top:0;--checkbox-margin-bottom:0}.multi.sc-prism-typeahead{padding:1rem}.result-list.sc-prism-typeahead:focus{outline:2px solid transparent;outline-offset:2px}.result-list.sc-prism-typeahead li.sc-prism-typeahead{transition:background-color .2s ease-in-out}.result-list.sc-prism-typeahead li.highlight.sc-prism-typeahead,.result-list.sc-prism-typeahead li.sc-prism-typeahead:hover{--tw-bg-opacity:1;--shadow-color:var(--material-neutral-hover-shadow);background-color:rgb(var(--background-color-material-neutral-hover)/var(--tw-bg-opacity))}.result-list.sc-prism-typeahead li.sc-prism-typeahead:active{--tw-bg-opacity:1;--shadow-color:var(--material-neutral-down-shadow);background-color:rgb(var(--background-color-material-neutral-down)/var(--tw-bg-opacity))}.result-list.sc-prism-typeahead li.selected.sc-prism-typeahead{--tw-bg-opacity:1;--shadow-color:var(--material-theme1-base-shadow);background-color:rgb(var(--background-color-material-theme1-base)/var(--tw-bg-opacity))}.result-list.sc-prism-typeahead li.selected.highlight.sc-prism-typeahead,.result-list.sc-prism-typeahead li.selected.sc-prism-typeahead:hover{--tw-bg-opacity:1;--shadow-color:var(--material-theme1-hover-shadow);background-color:rgb(var(--background-color-material-theme1-hover)/var(--tw-bg-opacity))}.result-list.sc-prism-typeahead li.selected.sc-prism-typeahead:active{--tw-bg-opacity:1;--shadow-color:var(--material-neutral-down-shadow);background-color:rgb(var(--background-color-material-neutral-down)/var(--tw-bg-opacity))}.result-list.sc-prism-typeahead li.selected.sc-prism-typeahead:active .selected-icon.sc-prism-typeahead{--tw-text-opacity:1;color:rgb(var(--text-color-theme1-down)/var(--tw-text-opacity))}.checked-icon.hide.sc-prism-typeahead{display:none}.result.sc-prism-typeahead{align-items:center;-webkit-appearance:none;-moz-appearance:none;appearance:none;cursor:pointer;display:flex;justify-content:space-between;padding:1rem;width:100%}.result.sc-prism-typeahead>.sc-prism-typeahead:not([hidden])~.sc-prism-typeahead:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(1rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(1rem*var(--tw-space-x-reverse))}.result.sc-prism-typeahead{background-color:var(--background-color-transparent,transparent);border-style:none;text-align:left}.result.sc-prism-typeahead .selected-icon.sc-prism-typeahead{--tw-text-opacity:1;color:rgb(var(--text-color-theme1-base)/var(--tw-text-opacity))}.result.sc-prism-typeahead:focus{--tw-bg-opacity:1;--shadow-color:var(--material-neutral-hover-shadow);background-color:rgb(var(--background-color-material-neutral-hover)/var(--tw-bg-opacity));outline-color:var(--outline-color-theme1-base,#5a23b9);outline-offset:-3px;outline-style:solid;outline-width:2px}.result-list.sc-prism-typeahead li.selected.sc-prism-typeahead .result.sc-prism-typeahead:focus{--tw-bg-opacity:1;--shadow-color:var(--material-theme1-hover-shadow);background-color:rgb(var(--background-color-material-theme1-hover)/var(--tw-bg-opacity))}.result-list.sc-prism-typeahead li.selected.sc-prism-typeahead .result.sc-prism-typeahead:focus .selected-icon.sc-prism-typeahead{--tw-text-opacity:1;color:rgb(var(--text-color-theme1-focus)/var(--tw-text-opacity))}.result.sc-prism-typeahead:disabled{cursor:not-allowed}.selection-content.sc-prism-typeahead{flex:1 1 auto}.nonselectable.sc-prism-typeahead{--color:rgb(var(--text-color-neutral-base))}.no-results.sc-prism-typeahead{display:block;padding:.75rem}.add-item.sc-prism-typeahead{--tw-border-opacity:1;--tw-border-opacity:var(--border-opacity-tertiary,0.15);align-items:center;border-color:rgb(var(--border-color-stroke-neutral-base)/var(--tw-border-opacity));border-top-width:1px;display:flex;padding:.75rem}@media (prefers-reduced-motion){.result-list.sc-prism-typeahead li.sc-prism-typeahead{transition:none}}.loading.sc-prism-typeahead{display:flex;gap:.5rem;padding:1rem;text-align:left}", nt = at, ot = class {
|
|
1019
|
-
constructor(s) {
|
|
1020
|
-
pe(this, s), this.prismChange = Q(this, "prismChange", 7), this.prismWatch = Q(this, "prismWatch", 7), this.uid = ge(), this.singleResultId = `prism-typeahead-option-${this.uid}`, this.resultsListId = `prism-typeahead-results-${this.uid}`, this.customOptionId = `prism-typeahead-custom-${this.uid}`, this.textInput = `prism-input-text-${this.prismId}`, this.debounceDelay = 500, this._hostTag = "prism-typeahead", this.generateHighlightedText = (e, t = []) => {
|
|
1021
|
-
let i = "", r = 0;
|
|
1022
|
-
return t.forEach((a) => {
|
|
1023
|
-
const n = a[1] + 1;
|
|
1024
|
-
i += [e.substring(r, a[0]), "<mark>", e.substring(a[0], n), "</mark>"].join(""), r = n;
|
|
1025
|
-
}), i += e.substring(r), i;
|
|
1026
|
-
}, this.announce = J(() => {
|
|
1027
|
-
this.liveMessage = this.matchingValues.length ? `${this.matchingValues.length} result${this.matchingValues.length > 1 ? "s" : ""} found` : this.noResultsMessage;
|
|
1028
|
-
}, this.debounceDelay), this._setResultsPosition = (e) => {
|
|
1029
|
-
if (this.aware) {
|
|
1030
|
-
let t = window.innerHeight / 2;
|
|
1031
|
-
this.appearFrom === "top" && t > e.top && (this.resultsPosition = "bottom"), this.appearFrom === "bottom" && t < e.bottom && (this.resultsPosition = "top");
|
|
1032
|
-
}
|
|
1033
|
-
this.hostHeight = `${e.height}px`;
|
|
1034
|
-
}, this.onBlur = (e) => {
|
|
1035
|
-
e.target.closest(this._hostTag) !== this.el && (this.displayResults = !1);
|
|
1036
|
-
}, this.close = () => {
|
|
1037
|
-
var e;
|
|
1038
|
-
(e = this.searchElement) === null || e === void 0 || e.setFocus(), this.displayResults = !1;
|
|
1039
|
-
}, this.removeSelection = (e) => {
|
|
1040
|
-
this.options = this.options.map((t) => (t[this.displayValue] === e[this.displayValue] && (t.selected = !e.selected), t), setTimeout(() => {
|
|
1041
|
-
var t;
|
|
1042
|
-
return (t = this.searchElement) === null || t === void 0 ? void 0 : t.setFocus();
|
|
1043
|
-
}, 0));
|
|
1044
|
-
}, this.setSelectedValue = (e, t) => {
|
|
1045
|
-
var i;
|
|
1046
|
-
const r = e.currentTarget;
|
|
1047
|
-
this.type === "single" && (this.searchValue = t, (i = this.searchElement) === null || i === void 0 || i.setFocus(), this.displayResults = !1), this.type === "multi" && (this.options = this.options.map((a) => (String(a[this.displayValue]) === t.replaceAll(" ", "") && (a.selected = !a.selected), a))), this.prismWatch.emit({
|
|
1048
|
-
name: `${this.type}-value-selected`,
|
|
1049
|
-
value: r.dataset.itemValue,
|
|
1050
|
-
label: r.dataset.itemLabel
|
|
1051
|
-
});
|
|
1052
|
-
}, this._setFocus = () => {
|
|
1053
|
-
this.resultsElement.querySelectorAll("[data-remove]")[0].firstChild.focus();
|
|
1054
|
-
}, this.inputKeyListeners = (e) => {
|
|
1055
|
-
switch (e.key) {
|
|
1056
|
-
case "ArrowUp":
|
|
1057
|
-
e.preventDefault(), this.resultsElement && this.appearFrom === "top" && this._setFocus();
|
|
1058
|
-
break;
|
|
1059
|
-
case "ArrowDown":
|
|
1060
|
-
e.preventDefault(), this.resultsElement && this.appearFrom === "bottom" && this._setFocus();
|
|
1061
|
-
break;
|
|
1062
|
-
case "Escape":
|
|
1063
|
-
case "Enter":
|
|
1064
|
-
this.displayResults = !1;
|
|
1065
|
-
break;
|
|
1066
|
-
}
|
|
1067
|
-
}, this.resultsKeyListeners = (e) => {
|
|
1068
|
-
var t, i, r;
|
|
1069
|
-
let a = e.currentTarget, n = a.closest("ol").querySelectorAll("[data-remove]"), o = n[0], l = n[n.length - 1];
|
|
1070
|
-
switch (e.key) {
|
|
1071
|
-
case "ArrowDown":
|
|
1072
|
-
e.preventDefault(), !((t = a.nextElementSibling) === null || t === void 0) && t.hasAttribute("data-remove") ? a.nextElementSibling.firstChild.focus() : o.firstChild.focus();
|
|
1073
|
-
break;
|
|
1074
|
-
case "ArrowUp":
|
|
1075
|
-
e.preventDefault(), !((i = a.previousElementSibling) === null || i === void 0) && i.hasAttribute("data-remove") ? a.previousElementSibling.firstChild.focus() : l.lastChild.focus();
|
|
1076
|
-
break;
|
|
1077
|
-
case "Home":
|
|
1078
|
-
o.firstChild.focus();
|
|
1079
|
-
break;
|
|
1080
|
-
case "End":
|
|
1081
|
-
l.lastChild.focus();
|
|
1082
|
-
break;
|
|
1083
|
-
case "Escape":
|
|
1084
|
-
this.displayResults = !1, (r = this.searchElement) === null || r === void 0 || r.setFocus();
|
|
1085
|
-
break;
|
|
1086
|
-
}
|
|
1087
|
-
}, this._resultsMenuKeyListeners = (e) => {
|
|
1088
|
-
let i = this.resultsElement.querySelectorAll("[data-remove]")[0];
|
|
1089
|
-
switch (e.key) {
|
|
1090
|
-
case "ArrowDown":
|
|
1091
|
-
i.firstChild.focus();
|
|
1092
|
-
}
|
|
1093
|
-
}, this.clearAll = () => {
|
|
1094
|
-
var e;
|
|
1095
|
-
this.liveMessage = "all suggestions and the search value have been removed", this.searchValue = "", this.displayResults = !1, this.options = this.options.map((t) => (t.isFixed || (t.selected = !1), t)), (e = this.searchElement) === null || e === void 0 || e.setFocus();
|
|
1096
|
-
}, this.toggleSelect = (e) => {
|
|
1097
|
-
var t;
|
|
1098
|
-
(t = this.resultsElement) === null || t === void 0 || t.querySelectorAll("li").forEach((i) => {
|
|
1099
|
-
let r = i.querySelector("button");
|
|
1100
|
-
switch (e) {
|
|
1101
|
-
case "select":
|
|
1102
|
-
r.ariaChecked === "false" && r.click();
|
|
1103
|
-
break;
|
|
1104
|
-
case "remove":
|
|
1105
|
-
r.ariaChecked === "true" && r.click();
|
|
1106
|
-
break;
|
|
1107
|
-
}
|
|
1108
|
-
});
|
|
1109
|
-
}, this.saveItem = (e) => {
|
|
1110
|
-
let t = this.customOptionElement;
|
|
1111
|
-
if (t.value === "") {
|
|
1112
|
-
t.invalid = !0, t.invalidMessage = "Please enter a custom item";
|
|
1113
|
-
return;
|
|
1114
|
-
}
|
|
1115
|
-
t.value && (this.customItem = t.value, this.close());
|
|
1116
|
-
}, this.prismId = `prism-typeahead-${this.uid}`, this.label = void 0, this.hideLabel = !1, this.hideInvalid = !1, this.disabled = !1, this.pattern = void 0, this.required = !1, this.invalid = !1, this.invalidMessage = "This field is required", this.placeholder = "Type to see results...", this.start = 3, this.maxlength = void 0, this.options = [], this.fuseOptions = {}, this.search = "include", this.delimiter = ",", this.type = "multi", this.name = void 0, this.noResultsMessage = "Sorry, we didn't find results. Would you like to try a new search?", this.hideNoresultsmessage = void 0, this.addOption = !1, this.addOptionPlaceholder = "Add a custom item", this.addOptionLabel = "Add a custom item", this.value = "", this.appearFrom = "bottom", this.aware = !1, this.variant = "contained", this.loading = !1, this.loadingMessage = "Loading...", this.keys = ["label", "value", "children.label", "children.value"], this.displayValue = "value", this.displayLabel = "label", this.ignoreLocation = !1, this.displayIcon = !0, this.iconName = "search", this.iconStyle = "fill", this.highlight = !1, this.hint = void 0, this.ignoredCharacters = void 0, this.unplug = !1, this.extendedSearch = "and", this.searchValue = "", this.matchingValues = [], this.displayResults = !1, this.hiddenValue = void 0, this.liveMessage = void 0, this.customItem = void 0, this.resultsPosition = "bottom", this.hostHeight = "83", this.selectedOptions = [];
|
|
1117
|
-
}
|
|
1118
|
-
loadingHandler(s) {
|
|
1119
|
-
s && (this.liveMessage = this.loadingMessage);
|
|
1120
|
-
}
|
|
1121
|
-
// Listen for Input Value Change
|
|
1122
|
-
getValue(s) {
|
|
1123
|
-
s.detail.target.id === this.textInput && s.detail.name === "input-change" && (s.detail.value.length < this.start && (this.liveMessage = ""), this.searchValue = s.detail.value, this.prismChange.emit({
|
|
1124
|
-
name: "prism-typeahead",
|
|
1125
|
-
target: this.el,
|
|
1126
|
-
value: this.searchValue,
|
|
1127
|
-
origin: s.detail
|
|
1128
|
-
}), this.displayResults = s.detail.value.length >= this.start, this.displayResults && this.announce());
|
|
1129
|
-
}
|
|
1130
|
-
// Watch for changes to the form value
|
|
1131
|
-
emitHiddenValue(s, e) {
|
|
1132
|
-
s !== e && this.prismWatch.emit({
|
|
1133
|
-
name: "multi-results-updated",
|
|
1134
|
-
value: this.hiddenValue
|
|
1135
|
-
});
|
|
1136
|
-
}
|
|
1137
|
-
// Watching Value Changes
|
|
1138
|
-
updateSearchValue(s, e) {
|
|
1139
|
-
this.searchValue = s;
|
|
1140
|
-
}
|
|
1141
|
-
// Watch for changes to the internal state `searchValue` and `options`
|
|
1142
|
-
filterResults(s, e, t) {
|
|
1143
|
-
let i = { findAllMatches: !0, includeMatches: !0, includeScore: !0, shouldSort: !0, useExtendedSearch: !0, fieldNormWeight: 1 }, r = { minMatchCharLength: this.start, ignoreLocation: this.ignoreLocation, keys: typeof this.keys == "string" ? [this.keys] : this.keys };
|
|
1144
|
-
const a = Object.assign(Object.assign(Object.assign({}, i), this.fuseOptions), r), n = new C(this.options, a);
|
|
1145
|
-
let o = this.searchValue.trim(), l = "";
|
|
1146
|
-
switch (this.search) {
|
|
1147
|
-
case "start":
|
|
1148
|
-
l = "^";
|
|
1149
|
-
break;
|
|
1150
|
-
case "exact":
|
|
1151
|
-
l = "=";
|
|
1152
|
-
break;
|
|
1153
|
-
case "include":
|
|
1154
|
-
l = "'";
|
|
1155
|
-
break;
|
|
1156
|
-
default:
|
|
1157
|
-
l = "";
|
|
1158
|
-
break;
|
|
1159
|
-
}
|
|
1160
|
-
const c = (d) => {
|
|
1161
|
-
const f = (m, g, y) => {
|
|
1162
|
-
const b = g.split(".");
|
|
1163
|
-
let v;
|
|
1164
|
-
for (v = 0; v < b.length - 1; v++)
|
|
1165
|
-
m = m[b[v]];
|
|
1166
|
-
m[b[v]] = y;
|
|
1167
|
-
};
|
|
1168
|
-
return d.filter(({ matches: m }) => m && m.length).map(({ item: m, matches: g }) => {
|
|
1169
|
-
const y = Object.assign({}, m);
|
|
1170
|
-
return g.forEach((b) => {
|
|
1171
|
-
f(y, b.key, this.generateHighlightedText(b.value, b.indices));
|
|
1172
|
-
}), { highlight: y, item: m };
|
|
1173
|
-
});
|
|
1174
|
-
};
|
|
1175
|
-
this.ignoredCharacters && (o = ye(o, this.ignoredCharacters));
|
|
1176
|
-
const h = n.search(`${l}"${this.extendedSearch === "and" ? o : o.replaceAll(" ", "|")}"`);
|
|
1177
|
-
this.unplug ? (this.matchingValues = [], this.options.map((d) => {
|
|
1178
|
-
this.matchingValues.push({ item: Object.assign({}, d) });
|
|
1179
|
-
})) : this.matchingValues = this.highlight ? c(h) : h, this.options.filter((d) => d.value === s).length === 0 && t === "customItem" && s !== e && n.add({ value: s, label: s, selected: !0 }), this.type === "multi" && (this.selectedOptions = this.options.filter((d) => d.selected === !0), this.hiddenValue = this.selectedOptions.map((d) => d.value).join(this.delimiter)), this.prismWatch.emit({
|
|
1180
|
-
name: `${this.type}-value-updated`,
|
|
1181
|
-
value: this.searchValue
|
|
1182
|
-
});
|
|
1183
|
-
}
|
|
1184
|
-
connectedCallback() {
|
|
1185
|
-
document.addEventListener("mousedown", this.onBlur), document.addEventListener("keyup", this.onBlur), this.appearFrom ? this.resultsPosition = this.appearFrom : window.addEventListener("resize", J(() => {
|
|
1186
|
-
this._setResultsPosition(this.el.getBoundingClientRect());
|
|
1187
|
-
}, this.debounceDelay)), this.searchValue = this.value, be("prism-typeahead");
|
|
1188
|
-
}
|
|
1189
|
-
disconnectedCallback() {
|
|
1190
|
-
document.removeEventListener("mousedown", this.onBlur), document.removeEventListener("keyup", this.onBlur);
|
|
1191
|
-
}
|
|
1192
|
-
componentDidLoad() {
|
|
1193
|
-
this._hostDimensions = this.el.getBoundingClientRect(), this.type === "multi" && this.el.querySelectorAll("div.selections")[0].addEventListener("focusin", () => {
|
|
1194
|
-
this.displayResults = !1;
|
|
1195
|
-
});
|
|
1196
|
-
}
|
|
1197
|
-
componentWillRender() {
|
|
1198
|
-
this._hostDimensions && this._setResultsPosition(this._hostDimensions), this.loadingHandler(this.loading);
|
|
1199
|
-
}
|
|
1200
|
-
// Buttons when in type multi to select all, remove all, and close the panel
|
|
1201
|
-
/** @internal */
|
|
1202
|
-
multiControls(s) {
|
|
1203
|
-
s.detail.id === "select-button" && (this.toggleSelect("select"), this.liveMessage = `${this.matchingValues.length} results selected`), s.detail.id === "deselect-button" && (this.toggleSelect("remove"), this.liveMessage = `${this.matchingValues.length} results removed`), s.detail.id === "close-results" && this.close();
|
|
1204
|
-
}
|
|
1205
|
-
render() {
|
|
1206
|
-
var s;
|
|
1207
|
-
return p(fe, { key: "aef83d2d8671ef2c0a281b6a90e9fbb0cfca56e3", id: this.prismId }, p("div", { key: "9123cffcd6d77b4655514f4902854afd5c08f480", class: "announcement", "aria-live": "polite", "aria-atomic": "true" }, this.liveMessage), p("prism-input-text", { key: "c3e6cd3ab37f9c8133336189b801735ae3e48fd5", hint: this.hint, variant: this.variant, "prism-id": this.textInput, "aria-controls": this.resultsListId, "aria-expanded": this.displayResults.toString(), "aria-autocomplete": this.type === "single" ? "list" : void 0, autocomplete: "off", disabled: this.disabled, required: this.required, invalid: this.invalid, invalidMessage: this.invalidMessage, hideInvalid: this.hideInvalid, role: this.type === "single" ? "combobox" : void 0, placeholder: this.placeholder, hideLabel: this.hideLabel, label: this.label, maxlength: isNaN(this.maxlength) ? void 0 : this.maxlength, onKeyDown: (e) => this.inputKeyListeners(e), ref: (e) => this.searchElement = e, name: this.type === "single" ? this.name : "prism-typeahead-search", value: this.searchValue, class: "input" }, p("span", { key: "e11b88b153e16082cdb08d6fbc6af69a052f848a", slot: "icon-trailing" }, !this.disabled && p("prism-button", { key: "6252312b122542b192c5a4099ddaacdc4b69bb91", display: "ghost-icon", size: "sm", class: { clear: !0, show: this.selectedOptions.length > 0 || this.searchValue !== "" }, label: "clear all values", onPrismPress: () => this.clearAll(), slot: "icon-trailing" }, p("prism-icon", { key: "cb04ca4349fcfda0df1a1a30a143781c2b8779e7", name: "close", role: "presentation", size: "xs" })), p("slot", { key: "5ab3914d7dd5b9451a5be481f2dea56edf81c1a3", name: "asset-trailing" })), p("span", { key: "f3cf1685c5919b28cbf5d0e86ce31a9905f13ecc", slot: "icon-leading" }, this.displayIcon && p("prism-icon", { key: "c56ed1256e96c25f897594eb7409ae4ee14a193a", name: this.iconName, theme: this.iconStyle, role: "presentation" }))), p("div", { key: "6e626921fa2b5c258693a6a145fd2ad8a229c43b", style: { "--bottom": this.hostHeight }, class: { "results-container": !0 }, ref: (e) => this.resultsContainerElement = e }, p("div", { key: "50ea72cac327212c34d7c183b77ef07af07fd93a", class: {
|
|
1208
|
-
results: !0,
|
|
1209
|
-
open: this.displayResults || this.loading,
|
|
1210
|
-
[this.resultsPosition]: !0,
|
|
1211
|
-
zero: this.matchingValues.length === 0 && !this.addOption && this.hideNoresultsmessage
|
|
1212
|
-
} }, this.loading && p("section", { key: "e4a2a395fff8d812df8c91240cca65efd1011101", class: { loading: !0 } }, p("prism-loading", { key: "6511ec08af7851733db2d774c1f53ae347dd5f8a", type: "spinner", display: "inline" }), this.loadingMessage), this.type === "multi" && this.matchingValues.length > 0 && p("section", { key: "c95475a7161a1b21ae28858effb0c4589a6dfd32", class: "results-header", onKeyDown: (e) => this._resultsMenuKeyListeners(e) }, p("div", { key: "86074123fdc70be0ceca996c414689f4f8c77707", class: "multi-controls" }, p("prism-button", { key: "da38f36a840dcf3f0d5c02f18cac1b3794db46f6", "prism-id": "select-button", name: "toggle-button", size: "xs", display: "ghost", onPrismPress: (e) => this.multiControls(e) }, "Select All", p("prism-icon", { key: "fb4ac6f5cef09104c455f2dfdd10d549fa57fff4", size: "xs", role: "presentation", theme: "outline", slot: "icon", name: "multi_select" })), p("prism-button", { key: "26f98b7758f3c403ec8b679c8cc1159198fd923c", "prism-id": "deselect-button", name: "toggle-button", size: "xs", display: "ghost", onPrismPress: (e) => this.multiControls(e) }, "Clear", p("prism-icon", { key: "b24c5b84375f8bfa534bfe8a6034bec747f4c41b", size: "xs", role: "presentation", slot: "icon", theme: "outline", name: "trash" }))), p("prism-button", { key: "428cb3a657db4589f49d5896286a4342b3a3a877", label: "close results", "prism-id": "close-results", name: "close-results", display: "ghost-icon", size: "xs", onPrismPress: (e) => this.multiControls(e) }, p("prism-icon", { key: "e487bcb5e32967739973e6c3247e4b05ad371a9e", name: this.appearFrom === "bottom" ? "caret_up_button" : "caret_down_button" }))), this.matchingValues.length ? p("ol", { class: "result-list", id: this.resultsListId, role: this.type === "single" ? "listbox" : void 0, ref: (e) => this.resultsElement = e }, (s = this.matchingValues) === null || s === void 0 ? void 0 : s.map(({ highlight: e, item: t }, i) => {
|
|
1213
|
-
let r = (t == null ? void 0 : t.selected) || (t == null ? void 0 : t.isFixed) || this.searchValue === (t == null ? void 0 : t.value) && this.type === "single", a = this.type === "multi" && r ? "true" : this.type !== "multi" ? !1 : "false";
|
|
1214
|
-
return p(X, null, p("li", { "data-remove": !(t != null && t.isFixed), id: `${this.singleResultId}-result-${i}`, onKeyDown: (n) => this.resultsKeyListeners(n), class: { selected: r } }, p("button", { onClick: (n) => this.setSelectedValue(n, t[this.displayLabel] || t[this.displayValue]), "aria-label": t[this.displayLabel] || t[this.displayValue], key: i, type: "button", "data-item-label": t == null ? void 0 : t.label, "data-item-value": t == null ? void 0 : t.value, class: { result: !0 }, role: this.type === "multi" ? "checkbox" : "option", "aria-checked": a, tabindex: "-1", disabled: t == null ? void 0 : t.isFixed }, (t == null ? void 0 : t.icon) && p("prism-icon", { tone: "custom", "aria-hidden": "true", role: "presentation", label: t == null ? void 0 : t.iconLabel, theme: (t == null ? void 0 : t.iconTheme) || "fill", name: t == null ? void 0 : t.icon }), p("section", { class: "selection-content" }, p("prism-text", { class: { nonselectable: t == null ? void 0 : t.isFixed }, display: "body1" }, this.highlight ? p("span", { innerHTML: e[this.displayLabel] || e[this.displayValue] }) : t[this.displayLabel] || t[this.displayValue]), (t == null ? void 0 : t.description) && p("prism-text", { display: "body2", priority: "secondary", class: "selection-description" }, t == null ? void 0 : t.description)), p("prism-icon", { class: { "checked-icon": !0, "selected-icon": r, hide: !r }, tone: "custom", name: "check", role: "presentation", "aria-hidden": "true" }))));
|
|
1215
|
-
})) : p(X, null, !this.hideNoresultsmessage && !this.loading && p("strong", { class: "no-results" }, p("slot", { name: "no-results-asset" }), this.noResultsMessage), this.addOption && p("section", { class: "add-item" }, p("prism-input-text", { prismId: this.customOptionId, value: this.searchValue, ref: (e) => this.customOptionElement = e, label: this.addOptionLabel, placeholder: this.addOptionPlaceholder, variant: "minimal", hideLabel: !0 }), p("prism-button", { "aria-describedby": this.customOptionId, prismId: `${this.customOptionId}-add-custom-item-`, onPrismPress: (e) => this.saveItem(e), display: "ghost-icon" }, p("prism-icon", { name: "add" }), "Add"))))), this.type === "multi" && p("div", { key: "7f9dae8ce8fbd99ef26316e9132c538767f5db36", class: "selections", ref: (e) => this.selectionsElement = e }, this.selectedOptions.map((e, t) => p("prism-badge", { interactive: e.isFixed ? null : "trailing", size: "lg", "data-remove": !e.isFixed, key: t, class: "selection", tone: "theme1", label: `Remove ${e[this.displayLabel]}`, onPrismClick: () => this.removeSelection(e) }, e[this.displayLabel], !e.isFixed && p("prism-icon", { slot: "asset-trailing", class: "remove-icon", size: "xs", name: "close", tone: "custom" })))), this.type === "multi" && p("input", { key: "ebd7ce35caf3ee85552e53da2dcf80302ca68432", type: "hidden", name: this.name, value: this.hiddenValue }));
|
|
1216
|
-
}
|
|
1217
|
-
get el() {
|
|
1218
|
-
return me(this);
|
|
1219
|
-
}
|
|
1220
|
-
static get watchers() {
|
|
1221
|
-
return {
|
|
1222
|
-
loading: ["loadingHandler"],
|
|
1223
|
-
hiddenValue: ["emitHiddenValue"],
|
|
1224
|
-
value: ["updateSearchValue"],
|
|
1225
|
-
options: ["filterResults"],
|
|
1226
|
-
searchValue: ["filterResults"],
|
|
1227
|
-
customItem: ["filterResults"]
|
|
1228
|
-
};
|
|
1229
|
-
}
|
|
1230
|
-
};
|
|
1231
|
-
ot.style = nt;
|
|
1232
|
-
export {
|
|
1233
|
-
ot as prism_typeahead
|
|
1234
|
-
};
|