iconfont-preview-cli 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +255 -0
- package/app/assets/index-BN1JFPmQ.js +22 -0
- package/app/assets/index-fas_yV9m.css +1 -0
- package/app/index.html +14 -0
- package/app/vite.svg +1 -0
- package/components/index.cjs +1 -0
- package/components/index.css +1 -0
- package/components/index.mjs +1233 -0
- package/components/types/index.d.ts +2 -0
- package/components/types/render-icon-list/index.d.ts +3 -0
- package/components/types/render-icon-list/src/components/render-icon-class.d.ts +23 -0
- package/components/types/render-icon-list/src/components/render-icon.d.ts +26 -0
- package/components/types/render-icon-list/src/render-icon-list.d.ts +33 -0
- package/components/types/render-icon-list/src/render-icon-list.vue.d.ts +61 -0
- package/package.json +66 -0
- package/server/bin.cjs +163 -0
- package/server/bin.mjs +150 -0
- package/server/index.cjs +141 -0
- package/server/index.d.cts +6 -0
- package/server/index.d.mts +6 -0
- package/server/index.d.ts +6 -0
- package/server/index.mjs +133 -0
|
@@ -0,0 +1,1233 @@
|
|
|
1
|
+
import { defineComponent as J, createVNode as k, computed as pe, ref as N, onMounted as Ae, createElementBlock as Ce, openBlock as me, renderSlot as Ee, unref as ye } from "vue";
|
|
2
|
+
import { ElMessage as Me } from "element-plus";
|
|
3
|
+
function I(t) {
|
|
4
|
+
return Array.isArray ? Array.isArray(t) : oe(t) === "[object Array]";
|
|
5
|
+
}
|
|
6
|
+
function Fe(t) {
|
|
7
|
+
if (typeof t == "string")
|
|
8
|
+
return t;
|
|
9
|
+
let e = t + "";
|
|
10
|
+
return e == "0" && 1 / t == -1 / 0 ? "-0" : e;
|
|
11
|
+
}
|
|
12
|
+
function Be(t) {
|
|
13
|
+
return t == null ? "" : Fe(t);
|
|
14
|
+
}
|
|
15
|
+
function D(t) {
|
|
16
|
+
return typeof t == "string";
|
|
17
|
+
}
|
|
18
|
+
function ce(t) {
|
|
19
|
+
return typeof t == "number";
|
|
20
|
+
}
|
|
21
|
+
function De(t) {
|
|
22
|
+
return t === !0 || t === !1 || Ie(t) && oe(t) == "[object Boolean]";
|
|
23
|
+
}
|
|
24
|
+
function ue(t) {
|
|
25
|
+
return typeof t == "object";
|
|
26
|
+
}
|
|
27
|
+
function Ie(t) {
|
|
28
|
+
return ue(t) && t !== null;
|
|
29
|
+
}
|
|
30
|
+
function E(t) {
|
|
31
|
+
return t != null;
|
|
32
|
+
}
|
|
33
|
+
function W(t) {
|
|
34
|
+
return !t.trim().length;
|
|
35
|
+
}
|
|
36
|
+
function oe(t) {
|
|
37
|
+
return t == null ? t === void 0 ? "[object Undefined]" : "[object Null]" : Object.prototype.toString.call(t);
|
|
38
|
+
}
|
|
39
|
+
const _e = "Incorrect 'index' type", xe = (t) => `Invalid value for key ${t}`, we = (t) => `Pattern length exceeds max of ${t}.`, Se = (t) => `Missing ${t} property in key`, be = (t) => `Property 'weight' in key '${t}' must be a positive integer`, ee = Object.prototype.hasOwnProperty;
|
|
40
|
+
class ve {
|
|
41
|
+
constructor(e) {
|
|
42
|
+
this._keys = [], this._keyMap = {};
|
|
43
|
+
let s = 0;
|
|
44
|
+
e.forEach((n) => {
|
|
45
|
+
let r = ae(n);
|
|
46
|
+
this._keys.push(r), this._keyMap[r.id] = r, s += r.weight;
|
|
47
|
+
}), this._keys.forEach((n) => {
|
|
48
|
+
n.weight /= s;
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
get(e) {
|
|
52
|
+
return this._keyMap[e];
|
|
53
|
+
}
|
|
54
|
+
keys() {
|
|
55
|
+
return this._keys;
|
|
56
|
+
}
|
|
57
|
+
toJSON() {
|
|
58
|
+
return JSON.stringify(this._keys);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
function ae(t) {
|
|
62
|
+
let e = null, s = null, n = null, r = 1, i = null;
|
|
63
|
+
if (D(t) || I(t))
|
|
64
|
+
n = t, e = te(t), s = H(t);
|
|
65
|
+
else {
|
|
66
|
+
if (!ee.call(t, "name"))
|
|
67
|
+
throw new Error(Se("name"));
|
|
68
|
+
const c = t.name;
|
|
69
|
+
if (n = c, ee.call(t, "weight") && (r = t.weight, r <= 0))
|
|
70
|
+
throw new Error(be(c));
|
|
71
|
+
e = te(c), s = H(c), i = t.getFn;
|
|
72
|
+
}
|
|
73
|
+
return { path: e, id: s, weight: r, src: n, getFn: i };
|
|
74
|
+
}
|
|
75
|
+
function te(t) {
|
|
76
|
+
return I(t) ? t : t.split(".");
|
|
77
|
+
}
|
|
78
|
+
function H(t) {
|
|
79
|
+
return I(t) ? t.join(".") : t;
|
|
80
|
+
}
|
|
81
|
+
function Re(t, e) {
|
|
82
|
+
let s = [], n = !1;
|
|
83
|
+
const r = (i, c, u) => {
|
|
84
|
+
if (E(i))
|
|
85
|
+
if (!c[u])
|
|
86
|
+
s.push(i);
|
|
87
|
+
else {
|
|
88
|
+
let o = c[u];
|
|
89
|
+
const h = i[o];
|
|
90
|
+
if (!E(h))
|
|
91
|
+
return;
|
|
92
|
+
if (u === c.length - 1 && (D(h) || ce(h) || De(h)))
|
|
93
|
+
s.push(Be(h));
|
|
94
|
+
else if (I(h)) {
|
|
95
|
+
n = !0;
|
|
96
|
+
for (let a = 0, l = h.length; a < l; a += 1)
|
|
97
|
+
r(h[a], c, u + 1);
|
|
98
|
+
} else c.length && r(h, c, u + 1);
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
return r(t, D(e) ? e.split(".") : e, 0), n ? s : s[0];
|
|
102
|
+
}
|
|
103
|
+
const ke = {
|
|
104
|
+
// Whether the matches should be included in the result set. When `true`, each record in the result
|
|
105
|
+
// set will include the indices of the matched characters.
|
|
106
|
+
// These can consequently be used for highlighting purposes.
|
|
107
|
+
includeMatches: !1,
|
|
108
|
+
// When `true`, the matching function will continue to the end of a search pattern even if
|
|
109
|
+
// a perfect match has already been located in the string.
|
|
110
|
+
findAllMatches: !1,
|
|
111
|
+
// Minimum number of characters that must be matched before a result is considered a match
|
|
112
|
+
minMatchCharLength: 1
|
|
113
|
+
}, Le = {
|
|
114
|
+
// When `true`, the algorithm continues searching to the end of the input even if a perfect
|
|
115
|
+
// match is found before the end of the same input.
|
|
116
|
+
isCaseSensitive: !1,
|
|
117
|
+
// When `true`, the algorithm will ignore diacritics (accents) in comparisons
|
|
118
|
+
ignoreDiacritics: !1,
|
|
119
|
+
// When true, the matching function will continue to the end of a search pattern even if
|
|
120
|
+
includeScore: !1,
|
|
121
|
+
// List of properties that will be searched. This also supports nested properties.
|
|
122
|
+
keys: [],
|
|
123
|
+
// Whether to sort the result list, by score
|
|
124
|
+
shouldSort: !0,
|
|
125
|
+
// Default sort function: sort by ascending score, ascending index
|
|
126
|
+
sortFn: (t, e) => t.score === e.score ? t.idx < e.idx ? -1 : 1 : t.score < e.score ? -1 : 1
|
|
127
|
+
}, Ne = {
|
|
128
|
+
// Approximately where in the text is the pattern expected to be found?
|
|
129
|
+
location: 0,
|
|
130
|
+
// At what point does the match algorithm give up. A threshold of '0.0' requires a perfect match
|
|
131
|
+
// (of both letters and location), a threshold of '1.0' would match anything.
|
|
132
|
+
threshold: 0.6,
|
|
133
|
+
// Determines how close the match must be to the fuzzy location (specified above).
|
|
134
|
+
// An exact letter match which is 'distance' characters away from the fuzzy location
|
|
135
|
+
// would score as a complete mismatch. A distance of '0' requires the match be at
|
|
136
|
+
// the exact location specified, a threshold of '1000' would require a perfect match
|
|
137
|
+
// to be within 800 characters of the fuzzy location to be found using a 0.8 threshold.
|
|
138
|
+
distance: 100
|
|
139
|
+
}, $e = {
|
|
140
|
+
// When `true`, it enables the use of unix-like search commands
|
|
141
|
+
useExtendedSearch: !1,
|
|
142
|
+
// The get function to use when fetching an object's properties.
|
|
143
|
+
// The default will search nested paths *ie foo.bar.baz*
|
|
144
|
+
getFn: Re,
|
|
145
|
+
// When `true`, search will ignore `location` and `distance`, so it won't matter
|
|
146
|
+
// where in the string the pattern appears.
|
|
147
|
+
// More info: https://fusejs.io/concepts/scoring-theory.html#fuzziness-score
|
|
148
|
+
ignoreLocation: !1,
|
|
149
|
+
// When `true`, the calculation for the relevance score (used for sorting) will
|
|
150
|
+
// ignore the field-length norm.
|
|
151
|
+
// More info: https://fusejs.io/concepts/scoring-theory.html#field-length-norm
|
|
152
|
+
ignoreFieldNorm: !1,
|
|
153
|
+
// The weight to determine how much field length norm effects scoring.
|
|
154
|
+
fieldNormWeight: 1
|
|
155
|
+
};
|
|
156
|
+
var f = {
|
|
157
|
+
...Le,
|
|
158
|
+
...ke,
|
|
159
|
+
...Ne,
|
|
160
|
+
...$e
|
|
161
|
+
};
|
|
162
|
+
const Oe = /[^ ]+/g;
|
|
163
|
+
function Pe(t = 1, e = 3) {
|
|
164
|
+
const s = /* @__PURE__ */ new Map(), n = Math.pow(10, e);
|
|
165
|
+
return {
|
|
166
|
+
get(r) {
|
|
167
|
+
const i = r.match(Oe).length;
|
|
168
|
+
if (s.has(i))
|
|
169
|
+
return s.get(i);
|
|
170
|
+
const c = 1 / Math.pow(i, 0.5 * t), u = parseFloat(Math.round(c * n) / n);
|
|
171
|
+
return s.set(i, u), u;
|
|
172
|
+
},
|
|
173
|
+
clear() {
|
|
174
|
+
s.clear();
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
class X {
|
|
179
|
+
constructor({
|
|
180
|
+
getFn: e = f.getFn,
|
|
181
|
+
fieldNormWeight: s = f.fieldNormWeight
|
|
182
|
+
} = {}) {
|
|
183
|
+
this.norm = Pe(s, 3), this.getFn = e, this.isCreated = !1, this.setIndexRecords();
|
|
184
|
+
}
|
|
185
|
+
setSources(e = []) {
|
|
186
|
+
this.docs = e;
|
|
187
|
+
}
|
|
188
|
+
setIndexRecords(e = []) {
|
|
189
|
+
this.records = e;
|
|
190
|
+
}
|
|
191
|
+
setKeys(e = []) {
|
|
192
|
+
this.keys = e, this._keysMap = {}, e.forEach((s, n) => {
|
|
193
|
+
this._keysMap[s.id] = n;
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
create() {
|
|
197
|
+
this.isCreated || !this.docs.length || (this.isCreated = !0, D(this.docs[0]) ? this.docs.forEach((e, s) => {
|
|
198
|
+
this._addString(e, s);
|
|
199
|
+
}) : this.docs.forEach((e, s) => {
|
|
200
|
+
this._addObject(e, s);
|
|
201
|
+
}), this.norm.clear());
|
|
202
|
+
}
|
|
203
|
+
// Adds a doc to the end of the index
|
|
204
|
+
add(e) {
|
|
205
|
+
const s = this.size();
|
|
206
|
+
D(e) ? this._addString(e, s) : this._addObject(e, s);
|
|
207
|
+
}
|
|
208
|
+
// Removes the doc at the specified index of the index
|
|
209
|
+
removeAt(e) {
|
|
210
|
+
this.records.splice(e, 1);
|
|
211
|
+
for (let s = e, n = this.size(); s < n; s += 1)
|
|
212
|
+
this.records[s].i -= 1;
|
|
213
|
+
}
|
|
214
|
+
getValueForItemAtKeyId(e, s) {
|
|
215
|
+
return e[this._keysMap[s]];
|
|
216
|
+
}
|
|
217
|
+
size() {
|
|
218
|
+
return this.records.length;
|
|
219
|
+
}
|
|
220
|
+
_addString(e, s) {
|
|
221
|
+
if (!E(e) || W(e))
|
|
222
|
+
return;
|
|
223
|
+
let n = {
|
|
224
|
+
v: e,
|
|
225
|
+
i: s,
|
|
226
|
+
n: this.norm.get(e)
|
|
227
|
+
};
|
|
228
|
+
this.records.push(n);
|
|
229
|
+
}
|
|
230
|
+
_addObject(e, s) {
|
|
231
|
+
let n = { i: s, $: {} };
|
|
232
|
+
this.keys.forEach((r, i) => {
|
|
233
|
+
let c = r.getFn ? r.getFn(e) : this.getFn(e, r.path);
|
|
234
|
+
if (E(c)) {
|
|
235
|
+
if (I(c)) {
|
|
236
|
+
let u = [];
|
|
237
|
+
const o = [{ nestedArrIndex: -1, value: c }];
|
|
238
|
+
for (; o.length; ) {
|
|
239
|
+
const { nestedArrIndex: h, value: a } = o.pop();
|
|
240
|
+
if (E(a))
|
|
241
|
+
if (D(a) && !W(a)) {
|
|
242
|
+
let l = {
|
|
243
|
+
v: a,
|
|
244
|
+
i: h,
|
|
245
|
+
n: this.norm.get(a)
|
|
246
|
+
};
|
|
247
|
+
u.push(l);
|
|
248
|
+
} else I(a) && a.forEach((l, d) => {
|
|
249
|
+
o.push({
|
|
250
|
+
nestedArrIndex: d,
|
|
251
|
+
value: l
|
|
252
|
+
});
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
n.$[i] = u;
|
|
256
|
+
} else if (D(c) && !W(c)) {
|
|
257
|
+
let u = {
|
|
258
|
+
v: c,
|
|
259
|
+
n: this.norm.get(c)
|
|
260
|
+
};
|
|
261
|
+
n.$[i] = u;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}), this.records.push(n);
|
|
265
|
+
}
|
|
266
|
+
toJSON() {
|
|
267
|
+
return {
|
|
268
|
+
keys: this.keys,
|
|
269
|
+
records: this.records
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
function he(t, e, { getFn: s = f.getFn, fieldNormWeight: n = f.fieldNormWeight } = {}) {
|
|
274
|
+
const r = new X({ getFn: s, fieldNormWeight: n });
|
|
275
|
+
return r.setKeys(t.map(ae)), r.setSources(e), r.create(), r;
|
|
276
|
+
}
|
|
277
|
+
function Te(t, { getFn: e = f.getFn, fieldNormWeight: s = f.fieldNormWeight } = {}) {
|
|
278
|
+
const { keys: n, records: r } = t, i = new X({ getFn: e, fieldNormWeight: s });
|
|
279
|
+
return i.setKeys(n), i.setIndexRecords(r), i;
|
|
280
|
+
}
|
|
281
|
+
function $(t, {
|
|
282
|
+
errors: e = 0,
|
|
283
|
+
currentLocation: s = 0,
|
|
284
|
+
expectedLocation: n = 0,
|
|
285
|
+
distance: r = f.distance,
|
|
286
|
+
ignoreLocation: i = f.ignoreLocation
|
|
287
|
+
} = {}) {
|
|
288
|
+
const c = e / t.length;
|
|
289
|
+
if (i)
|
|
290
|
+
return c;
|
|
291
|
+
const u = Math.abs(n - s);
|
|
292
|
+
return r ? c + u / r : u ? 1 : c;
|
|
293
|
+
}
|
|
294
|
+
function je(t = [], e = f.minMatchCharLength) {
|
|
295
|
+
let s = [], n = -1, r = -1, i = 0;
|
|
296
|
+
for (let c = t.length; i < c; i += 1) {
|
|
297
|
+
let u = t[i];
|
|
298
|
+
u && n === -1 ? n = i : !u && n !== -1 && (r = i - 1, r - n + 1 >= e && s.push([n, r]), n = -1);
|
|
299
|
+
}
|
|
300
|
+
return t[i - 1] && i - n >= e && s.push([n, i - 1]), s;
|
|
301
|
+
}
|
|
302
|
+
const b = 32;
|
|
303
|
+
function Ke(t, e, s, {
|
|
304
|
+
location: n = f.location,
|
|
305
|
+
distance: r = f.distance,
|
|
306
|
+
threshold: i = f.threshold,
|
|
307
|
+
findAllMatches: c = f.findAllMatches,
|
|
308
|
+
minMatchCharLength: u = f.minMatchCharLength,
|
|
309
|
+
includeMatches: o = f.includeMatches,
|
|
310
|
+
ignoreLocation: h = f.ignoreLocation
|
|
311
|
+
} = {}) {
|
|
312
|
+
if (e.length > b)
|
|
313
|
+
throw new Error(we(b));
|
|
314
|
+
const a = e.length, l = t.length, d = Math.max(0, Math.min(n, l));
|
|
315
|
+
let g = i, p = d;
|
|
316
|
+
const A = u > 1 || o, C = A ? Array(l) : [];
|
|
317
|
+
let M;
|
|
318
|
+
for (; (M = t.indexOf(e, p)) > -1; ) {
|
|
319
|
+
let y = $(e, {
|
|
320
|
+
currentLocation: M,
|
|
321
|
+
expectedLocation: d,
|
|
322
|
+
distance: r,
|
|
323
|
+
ignoreLocation: h
|
|
324
|
+
});
|
|
325
|
+
if (g = Math.min(y, g), p = M + a, A) {
|
|
326
|
+
let x = 0;
|
|
327
|
+
for (; x < a; )
|
|
328
|
+
C[M + x] = 1, x += 1;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
p = -1;
|
|
332
|
+
let m = [], _ = 1, B = a + l;
|
|
333
|
+
const T = 1 << a - 1;
|
|
334
|
+
for (let y = 0; y < a; y += 1) {
|
|
335
|
+
let x = 0, w = B;
|
|
336
|
+
for (; x < w; )
|
|
337
|
+
$(e, {
|
|
338
|
+
errors: y,
|
|
339
|
+
currentLocation: d + w,
|
|
340
|
+
expectedLocation: d,
|
|
341
|
+
distance: r,
|
|
342
|
+
ignoreLocation: h
|
|
343
|
+
}) <= g ? x = w : B = w, w = Math.floor((B - x) / 2 + x);
|
|
344
|
+
B = w;
|
|
345
|
+
let Z = Math.max(1, d - w + 1), K = c ? l : Math.min(d + w, l) + a, v = Array(K + 2);
|
|
346
|
+
v[K + 1] = (1 << y) - 1;
|
|
347
|
+
for (let F = K; F >= Z; F -= 1) {
|
|
348
|
+
let L = F - 1, q = s[t.charAt(L)];
|
|
349
|
+
if (A && (C[L] = +!!q), v[F] = (v[F + 1] << 1 | 1) & q, y && (v[F] |= (m[F + 1] | m[F]) << 1 | 1 | m[F + 1]), v[F] & T && (_ = $(e, {
|
|
350
|
+
errors: y,
|
|
351
|
+
currentLocation: L,
|
|
352
|
+
expectedLocation: d,
|
|
353
|
+
distance: r,
|
|
354
|
+
ignoreLocation: h
|
|
355
|
+
}), _ <= g)) {
|
|
356
|
+
if (g = _, p = L, p <= d)
|
|
357
|
+
break;
|
|
358
|
+
Z = Math.max(1, 2 * d - p);
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
if ($(e, {
|
|
362
|
+
errors: y + 1,
|
|
363
|
+
currentLocation: d,
|
|
364
|
+
expectedLocation: d,
|
|
365
|
+
distance: r,
|
|
366
|
+
ignoreLocation: h
|
|
367
|
+
}) > g)
|
|
368
|
+
break;
|
|
369
|
+
m = v;
|
|
370
|
+
}
|
|
371
|
+
const j = {
|
|
372
|
+
isMatch: p >= 0,
|
|
373
|
+
// Count exact matches (those with a score of 0) to be "almost" exact
|
|
374
|
+
score: Math.max(1e-3, _)
|
|
375
|
+
};
|
|
376
|
+
if (A) {
|
|
377
|
+
const y = je(C, u);
|
|
378
|
+
y.length ? o && (j.indices = y) : j.isMatch = !1;
|
|
379
|
+
}
|
|
380
|
+
return j;
|
|
381
|
+
}
|
|
382
|
+
function We(t) {
|
|
383
|
+
let e = {};
|
|
384
|
+
for (let s = 0, n = t.length; s < n; s += 1) {
|
|
385
|
+
const r = t.charAt(s);
|
|
386
|
+
e[r] = (e[r] || 0) | 1 << n - s - 1;
|
|
387
|
+
}
|
|
388
|
+
return e;
|
|
389
|
+
}
|
|
390
|
+
const O = String.prototype.normalize ? ((t) => t.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g, "")) : ((t) => t);
|
|
391
|
+
class le {
|
|
392
|
+
constructor(e, {
|
|
393
|
+
location: s = f.location,
|
|
394
|
+
threshold: n = f.threshold,
|
|
395
|
+
distance: r = f.distance,
|
|
396
|
+
includeMatches: i = f.includeMatches,
|
|
397
|
+
findAllMatches: c = f.findAllMatches,
|
|
398
|
+
minMatchCharLength: u = f.minMatchCharLength,
|
|
399
|
+
isCaseSensitive: o = f.isCaseSensitive,
|
|
400
|
+
ignoreDiacritics: h = f.ignoreDiacritics,
|
|
401
|
+
ignoreLocation: a = f.ignoreLocation
|
|
402
|
+
} = {}) {
|
|
403
|
+
if (this.options = {
|
|
404
|
+
location: s,
|
|
405
|
+
threshold: n,
|
|
406
|
+
distance: r,
|
|
407
|
+
includeMatches: i,
|
|
408
|
+
findAllMatches: c,
|
|
409
|
+
minMatchCharLength: u,
|
|
410
|
+
isCaseSensitive: o,
|
|
411
|
+
ignoreDiacritics: h,
|
|
412
|
+
ignoreLocation: a
|
|
413
|
+
}, e = o ? e : e.toLowerCase(), e = h ? O(e) : e, this.pattern = e, this.chunks = [], !this.pattern.length)
|
|
414
|
+
return;
|
|
415
|
+
const l = (g, p) => {
|
|
416
|
+
this.chunks.push({
|
|
417
|
+
pattern: g,
|
|
418
|
+
alphabet: We(g),
|
|
419
|
+
startIndex: p
|
|
420
|
+
});
|
|
421
|
+
}, d = this.pattern.length;
|
|
422
|
+
if (d > b) {
|
|
423
|
+
let g = 0;
|
|
424
|
+
const p = d % b, A = d - p;
|
|
425
|
+
for (; g < A; )
|
|
426
|
+
l(this.pattern.substr(g, b), g), g += b;
|
|
427
|
+
if (p) {
|
|
428
|
+
const C = d - b;
|
|
429
|
+
l(this.pattern.substr(C), C);
|
|
430
|
+
}
|
|
431
|
+
} else
|
|
432
|
+
l(this.pattern, 0);
|
|
433
|
+
}
|
|
434
|
+
searchIn(e) {
|
|
435
|
+
const { isCaseSensitive: s, ignoreDiacritics: n, includeMatches: r } = this.options;
|
|
436
|
+
if (e = s ? e : e.toLowerCase(), e = n ? O(e) : e, this.pattern === e) {
|
|
437
|
+
let A = {
|
|
438
|
+
isMatch: !0,
|
|
439
|
+
score: 0
|
|
440
|
+
};
|
|
441
|
+
return r && (A.indices = [[0, e.length - 1]]), A;
|
|
442
|
+
}
|
|
443
|
+
const {
|
|
444
|
+
location: i,
|
|
445
|
+
distance: c,
|
|
446
|
+
threshold: u,
|
|
447
|
+
findAllMatches: o,
|
|
448
|
+
minMatchCharLength: h,
|
|
449
|
+
ignoreLocation: a
|
|
450
|
+
} = this.options;
|
|
451
|
+
let l = [], d = 0, g = !1;
|
|
452
|
+
this.chunks.forEach(({ pattern: A, alphabet: C, startIndex: M }) => {
|
|
453
|
+
const { isMatch: m, score: _, indices: B } = Ke(e, A, C, {
|
|
454
|
+
location: i + M,
|
|
455
|
+
distance: c,
|
|
456
|
+
threshold: u,
|
|
457
|
+
findAllMatches: o,
|
|
458
|
+
minMatchCharLength: h,
|
|
459
|
+
includeMatches: r,
|
|
460
|
+
ignoreLocation: a
|
|
461
|
+
});
|
|
462
|
+
m && (g = !0), d += _, m && B && (l = [...l, ...B]);
|
|
463
|
+
});
|
|
464
|
+
let p = {
|
|
465
|
+
isMatch: g,
|
|
466
|
+
score: g ? d / this.chunks.length : 1
|
|
467
|
+
};
|
|
468
|
+
return g && r && (p.indices = l), p;
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
class S {
|
|
472
|
+
constructor(e) {
|
|
473
|
+
this.pattern = e;
|
|
474
|
+
}
|
|
475
|
+
static isMultiMatch(e) {
|
|
476
|
+
return se(e, this.multiRegex);
|
|
477
|
+
}
|
|
478
|
+
static isSingleMatch(e) {
|
|
479
|
+
return se(e, this.singleRegex);
|
|
480
|
+
}
|
|
481
|
+
search() {
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
function se(t, e) {
|
|
485
|
+
const s = t.match(e);
|
|
486
|
+
return s ? s[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 s = e === this.pattern;
|
|
503
|
+
return {
|
|
504
|
+
isMatch: s,
|
|
505
|
+
score: s ? 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 n = e.indexOf(this.pattern) === -1;
|
|
525
|
+
return {
|
|
526
|
+
isMatch: n,
|
|
527
|
+
score: n ? 0 : 1,
|
|
528
|
+
indices: [0, e.length - 1]
|
|
529
|
+
};
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
class Ge 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 s = e.startsWith(this.pattern);
|
|
547
|
+
return {
|
|
548
|
+
isMatch: s,
|
|
549
|
+
score: s ? 0 : 1,
|
|
550
|
+
indices: [0, this.pattern.length - 1]
|
|
551
|
+
};
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
class Ve 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 s = !e.startsWith(this.pattern);
|
|
569
|
+
return {
|
|
570
|
+
isMatch: s,
|
|
571
|
+
score: s ? 0 : 1,
|
|
572
|
+
indices: [0, e.length - 1]
|
|
573
|
+
};
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
class Ye 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 s = e.endsWith(this.pattern);
|
|
591
|
+
return {
|
|
592
|
+
isMatch: s,
|
|
593
|
+
score: s ? 0 : 1,
|
|
594
|
+
indices: [e.length - this.pattern.length, e.length - 1]
|
|
595
|
+
};
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
class Qe 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 s = !e.endsWith(this.pattern);
|
|
613
|
+
return {
|
|
614
|
+
isMatch: s,
|
|
615
|
+
score: s ? 0 : 1,
|
|
616
|
+
indices: [0, e.length - 1]
|
|
617
|
+
};
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
class fe extends S {
|
|
621
|
+
constructor(e, {
|
|
622
|
+
location: s = f.location,
|
|
623
|
+
threshold: n = f.threshold,
|
|
624
|
+
distance: r = f.distance,
|
|
625
|
+
includeMatches: i = f.includeMatches,
|
|
626
|
+
findAllMatches: c = f.findAllMatches,
|
|
627
|
+
minMatchCharLength: u = f.minMatchCharLength,
|
|
628
|
+
isCaseSensitive: o = f.isCaseSensitive,
|
|
629
|
+
ignoreDiacritics: h = f.ignoreDiacritics,
|
|
630
|
+
ignoreLocation: a = f.ignoreLocation
|
|
631
|
+
} = {}) {
|
|
632
|
+
super(e), this._bitapSearch = new le(e, {
|
|
633
|
+
location: s,
|
|
634
|
+
threshold: n,
|
|
635
|
+
distance: r,
|
|
636
|
+
includeMatches: i,
|
|
637
|
+
findAllMatches: c,
|
|
638
|
+
minMatchCharLength: u,
|
|
639
|
+
isCaseSensitive: o,
|
|
640
|
+
ignoreDiacritics: h,
|
|
641
|
+
ignoreLocation: a
|
|
642
|
+
});
|
|
643
|
+
}
|
|
644
|
+
static get type() {
|
|
645
|
+
return "fuzzy";
|
|
646
|
+
}
|
|
647
|
+
static get multiRegex() {
|
|
648
|
+
return /^"(.*)"$/;
|
|
649
|
+
}
|
|
650
|
+
static get singleRegex() {
|
|
651
|
+
return /^(.*)$/;
|
|
652
|
+
}
|
|
653
|
+
search(e) {
|
|
654
|
+
return this._bitapSearch.searchIn(e);
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
class de extends S {
|
|
658
|
+
constructor(e) {
|
|
659
|
+
super(e);
|
|
660
|
+
}
|
|
661
|
+
static get type() {
|
|
662
|
+
return "include";
|
|
663
|
+
}
|
|
664
|
+
static get multiRegex() {
|
|
665
|
+
return /^'"(.*)"$/;
|
|
666
|
+
}
|
|
667
|
+
static get singleRegex() {
|
|
668
|
+
return /^'(.*)$/;
|
|
669
|
+
}
|
|
670
|
+
search(e) {
|
|
671
|
+
let s = 0, n;
|
|
672
|
+
const r = [], i = this.pattern.length;
|
|
673
|
+
for (; (n = e.indexOf(this.pattern, s)) > -1; )
|
|
674
|
+
s = n + i, r.push([n, s - 1]);
|
|
675
|
+
const c = !!r.length;
|
|
676
|
+
return {
|
|
677
|
+
isMatch: c,
|
|
678
|
+
score: c ? 0 : 1,
|
|
679
|
+
indices: r
|
|
680
|
+
};
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
const G = [
|
|
684
|
+
ze,
|
|
685
|
+
de,
|
|
686
|
+
Ge,
|
|
687
|
+
Ve,
|
|
688
|
+
Qe,
|
|
689
|
+
Ye,
|
|
690
|
+
He,
|
|
691
|
+
fe
|
|
692
|
+
], ne = G.length, Ue = / +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/, Je = "|";
|
|
693
|
+
function Xe(t, e = {}) {
|
|
694
|
+
return t.split(Je).map((s) => {
|
|
695
|
+
let n = s.trim().split(Ue).filter((i) => i && !!i.trim()), r = [];
|
|
696
|
+
for (let i = 0, c = n.length; i < c; i += 1) {
|
|
697
|
+
const u = n[i];
|
|
698
|
+
let o = !1, h = -1;
|
|
699
|
+
for (; !o && ++h < ne; ) {
|
|
700
|
+
const a = G[h];
|
|
701
|
+
let l = a.isMultiMatch(u);
|
|
702
|
+
l && (r.push(new a(l, e)), o = !0);
|
|
703
|
+
}
|
|
704
|
+
if (!o)
|
|
705
|
+
for (h = -1; ++h < ne; ) {
|
|
706
|
+
const a = G[h];
|
|
707
|
+
let l = a.isSingleMatch(u);
|
|
708
|
+
if (l) {
|
|
709
|
+
r.push(new a(l, e));
|
|
710
|
+
break;
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
return r;
|
|
715
|
+
});
|
|
716
|
+
}
|
|
717
|
+
const Ze = /* @__PURE__ */ new Set([fe.type, de.type]);
|
|
718
|
+
class qe {
|
|
719
|
+
constructor(e, {
|
|
720
|
+
isCaseSensitive: s = f.isCaseSensitive,
|
|
721
|
+
ignoreDiacritics: n = f.ignoreDiacritics,
|
|
722
|
+
includeMatches: r = f.includeMatches,
|
|
723
|
+
minMatchCharLength: i = f.minMatchCharLength,
|
|
724
|
+
ignoreLocation: c = f.ignoreLocation,
|
|
725
|
+
findAllMatches: u = f.findAllMatches,
|
|
726
|
+
location: o = f.location,
|
|
727
|
+
threshold: h = f.threshold,
|
|
728
|
+
distance: a = f.distance
|
|
729
|
+
} = {}) {
|
|
730
|
+
this.query = null, this.options = {
|
|
731
|
+
isCaseSensitive: s,
|
|
732
|
+
ignoreDiacritics: n,
|
|
733
|
+
includeMatches: r,
|
|
734
|
+
minMatchCharLength: i,
|
|
735
|
+
findAllMatches: u,
|
|
736
|
+
ignoreLocation: c,
|
|
737
|
+
location: o,
|
|
738
|
+
threshold: h,
|
|
739
|
+
distance: a
|
|
740
|
+
}, e = s ? e : e.toLowerCase(), e = n ? O(e) : e, this.pattern = e, this.query = Xe(this.pattern, this.options);
|
|
741
|
+
}
|
|
742
|
+
static condition(e, s) {
|
|
743
|
+
return s.useExtendedSearch;
|
|
744
|
+
}
|
|
745
|
+
searchIn(e) {
|
|
746
|
+
const s = this.query;
|
|
747
|
+
if (!s)
|
|
748
|
+
return {
|
|
749
|
+
isMatch: !1,
|
|
750
|
+
score: 1
|
|
751
|
+
};
|
|
752
|
+
const { includeMatches: n, isCaseSensitive: r, ignoreDiacritics: i } = this.options;
|
|
753
|
+
e = r ? e : e.toLowerCase(), e = i ? O(e) : e;
|
|
754
|
+
let c = 0, u = [], o = 0;
|
|
755
|
+
for (let h = 0, a = s.length; h < a; h += 1) {
|
|
756
|
+
const l = s[h];
|
|
757
|
+
u.length = 0, c = 0;
|
|
758
|
+
for (let d = 0, g = l.length; d < g; d += 1) {
|
|
759
|
+
const p = l[d], { isMatch: A, indices: C, score: M } = p.search(e);
|
|
760
|
+
if (A) {
|
|
761
|
+
if (c += 1, o += M, n) {
|
|
762
|
+
const m = p.constructor.type;
|
|
763
|
+
Ze.has(m) ? u = [...u, ...C] : u.push(C);
|
|
764
|
+
}
|
|
765
|
+
} else {
|
|
766
|
+
o = 0, c = 0, u.length = 0;
|
|
767
|
+
break;
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
if (c) {
|
|
771
|
+
let d = {
|
|
772
|
+
isMatch: !0,
|
|
773
|
+
score: o / c
|
|
774
|
+
};
|
|
775
|
+
return n && (d.indices = u), d;
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
return {
|
|
779
|
+
isMatch: !1,
|
|
780
|
+
score: 1
|
|
781
|
+
};
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
const V = [];
|
|
785
|
+
function et(...t) {
|
|
786
|
+
V.push(...t);
|
|
787
|
+
}
|
|
788
|
+
function Y(t, e) {
|
|
789
|
+
for (let s = 0, n = V.length; s < n; s += 1) {
|
|
790
|
+
let r = V[s];
|
|
791
|
+
if (r.condition(t, e))
|
|
792
|
+
return new r(t, e);
|
|
793
|
+
}
|
|
794
|
+
return new le(t, e);
|
|
795
|
+
}
|
|
796
|
+
const P = {
|
|
797
|
+
AND: "$and",
|
|
798
|
+
OR: "$or"
|
|
799
|
+
}, Q = {
|
|
800
|
+
PATH: "$path",
|
|
801
|
+
PATTERN: "$val"
|
|
802
|
+
}, U = (t) => !!(t[P.AND] || t[P.OR]), tt = (t) => !!t[Q.PATH], st = (t) => !I(t) && ue(t) && !U(t), re = (t) => ({
|
|
803
|
+
[P.AND]: Object.keys(t).map((e) => ({
|
|
804
|
+
[e]: t[e]
|
|
805
|
+
}))
|
|
806
|
+
});
|
|
807
|
+
function ge(t, e, { auto: s = !0 } = {}) {
|
|
808
|
+
const n = (r) => {
|
|
809
|
+
let i = Object.keys(r);
|
|
810
|
+
const c = tt(r);
|
|
811
|
+
if (!c && i.length > 1 && !U(r))
|
|
812
|
+
return n(re(r));
|
|
813
|
+
if (st(r)) {
|
|
814
|
+
const o = c ? r[Q.PATH] : i[0], h = c ? r[Q.PATTERN] : r[o];
|
|
815
|
+
if (!D(h))
|
|
816
|
+
throw new Error(xe(o));
|
|
817
|
+
const a = {
|
|
818
|
+
keyId: H(o),
|
|
819
|
+
pattern: h
|
|
820
|
+
};
|
|
821
|
+
return s && (a.searcher = Y(h, e)), a;
|
|
822
|
+
}
|
|
823
|
+
let u = {
|
|
824
|
+
children: [],
|
|
825
|
+
operator: i[0]
|
|
826
|
+
};
|
|
827
|
+
return i.forEach((o) => {
|
|
828
|
+
const h = r[o];
|
|
829
|
+
I(h) && h.forEach((a) => {
|
|
830
|
+
u.children.push(n(a));
|
|
831
|
+
});
|
|
832
|
+
}), u;
|
|
833
|
+
};
|
|
834
|
+
return U(t) || (t = re(t)), n(t);
|
|
835
|
+
}
|
|
836
|
+
function nt(t, { ignoreFieldNorm: e = f.ignoreFieldNorm }) {
|
|
837
|
+
t.forEach((s) => {
|
|
838
|
+
let n = 1;
|
|
839
|
+
s.matches.forEach(({ key: r, norm: i, score: c }) => {
|
|
840
|
+
const u = r ? r.weight : null;
|
|
841
|
+
n *= Math.pow(
|
|
842
|
+
c === 0 && u ? Number.EPSILON : c,
|
|
843
|
+
(u || 1) * (e ? 1 : i)
|
|
844
|
+
);
|
|
845
|
+
}), s.score = n;
|
|
846
|
+
});
|
|
847
|
+
}
|
|
848
|
+
function rt(t, e) {
|
|
849
|
+
const s = t.matches;
|
|
850
|
+
e.matches = [], E(s) && s.forEach((n) => {
|
|
851
|
+
if (!E(n.indices) || !n.indices.length)
|
|
852
|
+
return;
|
|
853
|
+
const { indices: r, value: i } = n;
|
|
854
|
+
let c = {
|
|
855
|
+
indices: r,
|
|
856
|
+
value: i
|
|
857
|
+
};
|
|
858
|
+
n.key && (c.key = n.key.src), n.idx > -1 && (c.refIndex = n.idx), e.matches.push(c);
|
|
859
|
+
});
|
|
860
|
+
}
|
|
861
|
+
function it(t, e) {
|
|
862
|
+
e.score = t.score;
|
|
863
|
+
}
|
|
864
|
+
function ct(t, e, {
|
|
865
|
+
includeMatches: s = f.includeMatches,
|
|
866
|
+
includeScore: n = f.includeScore
|
|
867
|
+
} = {}) {
|
|
868
|
+
const r = [];
|
|
869
|
+
return s && r.push(rt), n && r.push(it), t.map((i) => {
|
|
870
|
+
const { idx: c } = i, u = {
|
|
871
|
+
item: e[c],
|
|
872
|
+
refIndex: c
|
|
873
|
+
};
|
|
874
|
+
return r.length && r.forEach((o) => {
|
|
875
|
+
o(i, u);
|
|
876
|
+
}), u;
|
|
877
|
+
});
|
|
878
|
+
}
|
|
879
|
+
class R {
|
|
880
|
+
constructor(e, s = {}, n) {
|
|
881
|
+
this.options = { ...f, ...s }, this.options.useExtendedSearch, this._keyStore = new ve(this.options.keys), this.setCollection(e, n);
|
|
882
|
+
}
|
|
883
|
+
setCollection(e, s) {
|
|
884
|
+
if (this._docs = e, s && !(s instanceof X))
|
|
885
|
+
throw new Error(_e);
|
|
886
|
+
this._myIndex = s || he(this.options.keys, this._docs, {
|
|
887
|
+
getFn: this.options.getFn,
|
|
888
|
+
fieldNormWeight: this.options.fieldNormWeight
|
|
889
|
+
});
|
|
890
|
+
}
|
|
891
|
+
add(e) {
|
|
892
|
+
E(e) && (this._docs.push(e), this._myIndex.add(e));
|
|
893
|
+
}
|
|
894
|
+
remove(e = () => !1) {
|
|
895
|
+
const s = [];
|
|
896
|
+
for (let n = 0, r = this._docs.length; n < r; n += 1) {
|
|
897
|
+
const i = this._docs[n];
|
|
898
|
+
e(i, n) && (this.removeAt(n), n -= 1, r -= 1, s.push(i));
|
|
899
|
+
}
|
|
900
|
+
return s;
|
|
901
|
+
}
|
|
902
|
+
removeAt(e) {
|
|
903
|
+
this._docs.splice(e, 1), this._myIndex.removeAt(e);
|
|
904
|
+
}
|
|
905
|
+
getIndex() {
|
|
906
|
+
return this._myIndex;
|
|
907
|
+
}
|
|
908
|
+
search(e, { limit: s = -1 } = {}) {
|
|
909
|
+
const {
|
|
910
|
+
includeMatches: n,
|
|
911
|
+
includeScore: r,
|
|
912
|
+
shouldSort: i,
|
|
913
|
+
sortFn: c,
|
|
914
|
+
ignoreFieldNorm: u
|
|
915
|
+
} = this.options;
|
|
916
|
+
let o = D(e) ? D(this._docs[0]) ? this._searchStringList(e) : this._searchObjectList(e) : this._searchLogical(e);
|
|
917
|
+
return nt(o, { ignoreFieldNorm: u }), i && o.sort(c), ce(s) && s > -1 && (o = o.slice(0, s)), ct(o, this._docs, {
|
|
918
|
+
includeMatches: n,
|
|
919
|
+
includeScore: r
|
|
920
|
+
});
|
|
921
|
+
}
|
|
922
|
+
_searchStringList(e) {
|
|
923
|
+
const s = Y(e, this.options), { records: n } = this._myIndex, r = [];
|
|
924
|
+
return n.forEach(({ v: i, i: c, n: u }) => {
|
|
925
|
+
if (!E(i))
|
|
926
|
+
return;
|
|
927
|
+
const { isMatch: o, score: h, indices: a } = s.searchIn(i);
|
|
928
|
+
o && r.push({
|
|
929
|
+
item: i,
|
|
930
|
+
idx: c,
|
|
931
|
+
matches: [{ score: h, value: i, norm: u, indices: a }]
|
|
932
|
+
});
|
|
933
|
+
}), r;
|
|
934
|
+
}
|
|
935
|
+
_searchLogical(e) {
|
|
936
|
+
const s = ge(e, this.options), n = (u, o, h) => {
|
|
937
|
+
if (!u.children) {
|
|
938
|
+
const { keyId: l, searcher: d } = u, g = this._findMatches({
|
|
939
|
+
key: this._keyStore.get(l),
|
|
940
|
+
value: this._myIndex.getValueForItemAtKeyId(o, l),
|
|
941
|
+
searcher: d
|
|
942
|
+
});
|
|
943
|
+
return g && g.length ? [
|
|
944
|
+
{
|
|
945
|
+
idx: h,
|
|
946
|
+
item: o,
|
|
947
|
+
matches: g
|
|
948
|
+
}
|
|
949
|
+
] : [];
|
|
950
|
+
}
|
|
951
|
+
const a = [];
|
|
952
|
+
for (let l = 0, d = u.children.length; l < d; l += 1) {
|
|
953
|
+
const g = u.children[l], p = n(g, o, h);
|
|
954
|
+
if (p.length)
|
|
955
|
+
a.push(...p);
|
|
956
|
+
else if (u.operator === P.AND)
|
|
957
|
+
return [];
|
|
958
|
+
}
|
|
959
|
+
return a;
|
|
960
|
+
}, r = this._myIndex.records, i = {}, c = [];
|
|
961
|
+
return r.forEach(({ $: u, i: o }) => {
|
|
962
|
+
if (E(u)) {
|
|
963
|
+
let h = n(s, u, o);
|
|
964
|
+
h.length && (i[o] || (i[o] = { idx: o, item: u, matches: [] }, c.push(i[o])), h.forEach(({ matches: a }) => {
|
|
965
|
+
i[o].matches.push(...a);
|
|
966
|
+
}));
|
|
967
|
+
}
|
|
968
|
+
}), c;
|
|
969
|
+
}
|
|
970
|
+
_searchObjectList(e) {
|
|
971
|
+
const s = Y(e, this.options), { keys: n, records: r } = this._myIndex, i = [];
|
|
972
|
+
return r.forEach(({ $: c, i: u }) => {
|
|
973
|
+
if (!E(c))
|
|
974
|
+
return;
|
|
975
|
+
let o = [];
|
|
976
|
+
n.forEach((h, a) => {
|
|
977
|
+
o.push(
|
|
978
|
+
...this._findMatches({
|
|
979
|
+
key: h,
|
|
980
|
+
value: c[a],
|
|
981
|
+
searcher: s
|
|
982
|
+
})
|
|
983
|
+
);
|
|
984
|
+
}), o.length && i.push({
|
|
985
|
+
idx: u,
|
|
986
|
+
item: c,
|
|
987
|
+
matches: o
|
|
988
|
+
});
|
|
989
|
+
}), i;
|
|
990
|
+
}
|
|
991
|
+
_findMatches({ key: e, value: s, searcher: n }) {
|
|
992
|
+
if (!E(s))
|
|
993
|
+
return [];
|
|
994
|
+
let r = [];
|
|
995
|
+
if (I(s))
|
|
996
|
+
s.forEach(({ v: i, i: c, n: u }) => {
|
|
997
|
+
if (!E(i))
|
|
998
|
+
return;
|
|
999
|
+
const { isMatch: o, score: h, indices: a } = n.searchIn(i);
|
|
1000
|
+
o && r.push({
|
|
1001
|
+
score: h,
|
|
1002
|
+
key: e,
|
|
1003
|
+
value: i,
|
|
1004
|
+
idx: c,
|
|
1005
|
+
norm: u,
|
|
1006
|
+
indices: a
|
|
1007
|
+
});
|
|
1008
|
+
});
|
|
1009
|
+
else {
|
|
1010
|
+
const { v: i, n: c } = s, { isMatch: u, score: o, indices: h } = n.searchIn(i);
|
|
1011
|
+
u && r.push({ score: o, key: e, value: i, norm: c, indices: h });
|
|
1012
|
+
}
|
|
1013
|
+
return r;
|
|
1014
|
+
}
|
|
1015
|
+
}
|
|
1016
|
+
R.version = "7.1.0";
|
|
1017
|
+
R.createIndex = he;
|
|
1018
|
+
R.parseIndex = Te;
|
|
1019
|
+
R.config = f;
|
|
1020
|
+
R.parseQuery = ge;
|
|
1021
|
+
et(qe);
|
|
1022
|
+
const ut = /* @__PURE__ */ J({
|
|
1023
|
+
name: "RenderIconClass",
|
|
1024
|
+
props: {
|
|
1025
|
+
iconClass: {
|
|
1026
|
+
type: String,
|
|
1027
|
+
required: !0
|
|
1028
|
+
},
|
|
1029
|
+
highlightChunks: {
|
|
1030
|
+
type: Array,
|
|
1031
|
+
default: () => []
|
|
1032
|
+
}
|
|
1033
|
+
},
|
|
1034
|
+
setup(t) {
|
|
1035
|
+
const e = () => {
|
|
1036
|
+
const {
|
|
1037
|
+
iconClass: s,
|
|
1038
|
+
highlightChunks: n
|
|
1039
|
+
} = t;
|
|
1040
|
+
if (!s || n.length === 0)
|
|
1041
|
+
return s;
|
|
1042
|
+
const r = [];
|
|
1043
|
+
let i = 0;
|
|
1044
|
+
for (const [c, u] of n)
|
|
1045
|
+
c > i && r.push(s.slice(i, c)), r.push(k("span", {
|
|
1046
|
+
class: "highlight"
|
|
1047
|
+
}, [s.slice(c, u + 1)])), i = u + 1;
|
|
1048
|
+
return i < s.length && r.push(s.slice(i)), r;
|
|
1049
|
+
};
|
|
1050
|
+
return () => k("span", {
|
|
1051
|
+
class: "render-icon-class"
|
|
1052
|
+
}, [e()]);
|
|
1053
|
+
}
|
|
1054
|
+
});
|
|
1055
|
+
function ot(t) {
|
|
1056
|
+
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
1057
|
+
}
|
|
1058
|
+
/*! clipboard-copy. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
1059
|
+
var z, ie;
|
|
1060
|
+
function at() {
|
|
1061
|
+
if (ie) return z;
|
|
1062
|
+
ie = 1, z = n;
|
|
1063
|
+
function t() {
|
|
1064
|
+
return new DOMException("The request is not allowed", "NotAllowedError");
|
|
1065
|
+
}
|
|
1066
|
+
async function e(r) {
|
|
1067
|
+
if (!navigator.clipboard)
|
|
1068
|
+
throw t();
|
|
1069
|
+
return navigator.clipboard.writeText(r);
|
|
1070
|
+
}
|
|
1071
|
+
async function s(r) {
|
|
1072
|
+
const i = document.createElement("span");
|
|
1073
|
+
i.textContent = r, i.style.whiteSpace = "pre", i.style.webkitUserSelect = "auto", i.style.userSelect = "all", document.body.appendChild(i);
|
|
1074
|
+
const c = window.getSelection(), u = window.document.createRange();
|
|
1075
|
+
c.removeAllRanges(), u.selectNode(i), c.addRange(u);
|
|
1076
|
+
let o = !1;
|
|
1077
|
+
try {
|
|
1078
|
+
o = window.document.execCommand("copy");
|
|
1079
|
+
} finally {
|
|
1080
|
+
c.removeAllRanges(), window.document.body.removeChild(i);
|
|
1081
|
+
}
|
|
1082
|
+
if (!o) throw t();
|
|
1083
|
+
}
|
|
1084
|
+
async function n(r) {
|
|
1085
|
+
try {
|
|
1086
|
+
await e(r);
|
|
1087
|
+
} catch (i) {
|
|
1088
|
+
try {
|
|
1089
|
+
await s(r);
|
|
1090
|
+
} catch (c) {
|
|
1091
|
+
throw c || i || t();
|
|
1092
|
+
}
|
|
1093
|
+
}
|
|
1094
|
+
}
|
|
1095
|
+
return z;
|
|
1096
|
+
}
|
|
1097
|
+
var ht = at();
|
|
1098
|
+
const lt = /* @__PURE__ */ ot(ht), ft = /* @__PURE__ */ J({
|
|
1099
|
+
name: "RenderIcon",
|
|
1100
|
+
props: {
|
|
1101
|
+
iconInfo: {
|
|
1102
|
+
type: Object,
|
|
1103
|
+
default: ""
|
|
1104
|
+
},
|
|
1105
|
+
iconClass: {
|
|
1106
|
+
type: String,
|
|
1107
|
+
required: !0
|
|
1108
|
+
},
|
|
1109
|
+
copyHandler: Function
|
|
1110
|
+
},
|
|
1111
|
+
setup(t) {
|
|
1112
|
+
const e = async (n) => {
|
|
1113
|
+
if (t.copyHandler) {
|
|
1114
|
+
t.copyHandler(n);
|
|
1115
|
+
return;
|
|
1116
|
+
}
|
|
1117
|
+
let r = "";
|
|
1118
|
+
try {
|
|
1119
|
+
await lt(n), r = "success";
|
|
1120
|
+
} catch {
|
|
1121
|
+
r = "error";
|
|
1122
|
+
}
|
|
1123
|
+
Me({
|
|
1124
|
+
message: `copy ${r} [${n}]`,
|
|
1125
|
+
type: r
|
|
1126
|
+
});
|
|
1127
|
+
}, s = pe(() => t.iconInfo.baseClassName ? `${t.iconInfo.baseClassName} ${t.iconClass}` : t.iconClass);
|
|
1128
|
+
return () => {
|
|
1129
|
+
var n;
|
|
1130
|
+
return k("span", {
|
|
1131
|
+
class: "render-icon",
|
|
1132
|
+
onClick: () => e(s.value)
|
|
1133
|
+
}, [t.iconInfo.renderIcon ? t.iconInfo.renderIcon(s.value) : k("i", {
|
|
1134
|
+
class: [t.iconInfo.baseClassName, t.iconClass]
|
|
1135
|
+
}, null), k(ut, {
|
|
1136
|
+
iconClass: t.iconClass,
|
|
1137
|
+
"highlight-chunks": (n = t.iconInfo.matchesMap) == null ? void 0 : n.get(t.iconClass)
|
|
1138
|
+
}, null)]);
|
|
1139
|
+
};
|
|
1140
|
+
}
|
|
1141
|
+
}), dt = {
|
|
1142
|
+
getIconsInfo: {
|
|
1143
|
+
type: Function,
|
|
1144
|
+
required: !0
|
|
1145
|
+
},
|
|
1146
|
+
cssLinkFormat: {
|
|
1147
|
+
type: Function,
|
|
1148
|
+
default: (t) => t
|
|
1149
|
+
}
|
|
1150
|
+
}, gt = { class: "render-icon-list" }, mt = /* @__PURE__ */ J({
|
|
1151
|
+
__name: "render-icon-list",
|
|
1152
|
+
props: dt,
|
|
1153
|
+
setup(t, { expose: e }) {
|
|
1154
|
+
const s = t, n = N(), r = N(), i = N([]), c = N([]), u = (a) => {
|
|
1155
|
+
n.value = a, r.value = a, i.value = a.map((l) => l.filePath), c.value = a.map((l) => ({
|
|
1156
|
+
iconInfo: l,
|
|
1157
|
+
fuse: new R(l.classNames, {
|
|
1158
|
+
/**
|
|
1159
|
+
* 搜索结果是否包含匹配的相关性分数,开启后会额外包含一个 score 字段,表示匹配的相似度分数
|
|
1160
|
+
* 0 表示完全匹配
|
|
1161
|
+
* 越接近 1 表示匹配度越低
|
|
1162
|
+
*/
|
|
1163
|
+
includeScore: !0,
|
|
1164
|
+
findAllMatches: !0,
|
|
1165
|
+
// 即使字符串中已经找到了完美匹配,匹配函数也会持续到搜索模式的末尾
|
|
1166
|
+
includeMatches: !0,
|
|
1167
|
+
// ✅ 必须开启!用于高亮
|
|
1168
|
+
threshold: 0.3,
|
|
1169
|
+
// 模糊匹配容错度
|
|
1170
|
+
minMatchCharLength: 1,
|
|
1171
|
+
// 长度超过此值的匹配项才会返回
|
|
1172
|
+
shouldSort: !0
|
|
1173
|
+
// 是否按分数对结果列表进行排序
|
|
1174
|
+
})
|
|
1175
|
+
}));
|
|
1176
|
+
}, o = (a) => {
|
|
1177
|
+
const l = document.querySelector("head");
|
|
1178
|
+
if (!l) {
|
|
1179
|
+
console.error("Head element not found");
|
|
1180
|
+
return;
|
|
1181
|
+
}
|
|
1182
|
+
const d = document.createDocumentFragment();
|
|
1183
|
+
a.forEach((g) => {
|
|
1184
|
+
if (!g.filePath) return;
|
|
1185
|
+
const p = s.cssLinkFormat(g.filePath);
|
|
1186
|
+
if (document.querySelector(`link[rel='stylesheet'][href='${p}']`))
|
|
1187
|
+
return;
|
|
1188
|
+
const A = document.createElement("link");
|
|
1189
|
+
A.rel = "stylesheet", A.href = p, d.appendChild(A);
|
|
1190
|
+
}), l.appendChild(d);
|
|
1191
|
+
};
|
|
1192
|
+
return Ae(async () => {
|
|
1193
|
+
var l;
|
|
1194
|
+
const a = await ((l = s.getIconsInfo) == null ? void 0 : l.call(s)) || [];
|
|
1195
|
+
o(a), u(a);
|
|
1196
|
+
}), e({
|
|
1197
|
+
onSearch: (a) => {
|
|
1198
|
+
const l = a.trim();
|
|
1199
|
+
if (!n.value) return;
|
|
1200
|
+
if (!l) {
|
|
1201
|
+
i.value = n.value.map((g) => g.filePath), r.value = n.value;
|
|
1202
|
+
return;
|
|
1203
|
+
}
|
|
1204
|
+
const d = [];
|
|
1205
|
+
c.value.forEach(({ iconInfo: g, fuse: p }) => {
|
|
1206
|
+
const A = p.search(l);
|
|
1207
|
+
if (A.length) {
|
|
1208
|
+
const C = /* @__PURE__ */ new Map(), M = [];
|
|
1209
|
+
A.forEach((m) => {
|
|
1210
|
+
const _ = m.matches || [], B = [];
|
|
1211
|
+
_.forEach((T) => {
|
|
1212
|
+
B.push(...T.indices);
|
|
1213
|
+
}), C.set(m.item, B), M.push(m.item);
|
|
1214
|
+
}), d.push({
|
|
1215
|
+
...g,
|
|
1216
|
+
matchesMap: C,
|
|
1217
|
+
classNames: M
|
|
1218
|
+
});
|
|
1219
|
+
}
|
|
1220
|
+
}), r.value = d, i.value = d.map((g) => g.filePath);
|
|
1221
|
+
}
|
|
1222
|
+
}), (a, l) => (me(), Ce("div", gt, [
|
|
1223
|
+
Ee(a.$slots, "default", {
|
|
1224
|
+
iconsInfo: r.value,
|
|
1225
|
+
renderIcon: ye(ft)
|
|
1226
|
+
})
|
|
1227
|
+
]));
|
|
1228
|
+
}
|
|
1229
|
+
});
|
|
1230
|
+
export {
|
|
1231
|
+
mt as RenderIconList,
|
|
1232
|
+
dt as renderIconListProps
|
|
1233
|
+
};
|