@sheetxl/studio-vanilla 0.4.21 → 0.4.22
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/browser/cjs/-AkvO2DXLOxJTxam.cjs +6 -0
- package/browser/cjs/3CSmmG7E8ziDB1mP.cjs +6 -0
- package/browser/cjs/7nEG2wj_Ohie6CwI.cjs +6 -0
- package/browser/cjs/{n6CXzSocLW_BCO8w.cjs → B0aLqzqegePPgpc2.cjs} +6 -6
- package/browser/cjs/B9GyERAqyIxdqS4D.cjs +145 -0
- package/browser/cjs/BO8oGaHWFtHyxmQ1.cjs +6 -0
- package/browser/cjs/BPODmSH7Z1MR1rHr.cjs +15 -0
- package/browser/cjs/BS0bGW4PmNinQUvL.cjs +42 -0
- package/browser/cjs/BY3tZiH_cfwBkpN8.cjs +6 -0
- package/browser/cjs/BYRBdz-9UGZ0b_AO.cjs +7 -0
- package/browser/cjs/BZvC7PqILOVRl2ij.cjs +6 -0
- package/browser/cjs/Bc6lVP0c3mEzf_yK.cjs +6 -0
- package/browser/cjs/Bdm_fGdkK4-pZ0tW.cjs +6 -0
- package/browser/cjs/Bi2-QXq5KvbsAXoB.cjs +6 -0
- package/browser/cjs/Bk2cFYnTKxP7WbLy.cjs +6 -0
- package/browser/cjs/BlojFx4yQfY8ahEJ.cjs +12 -0
- package/browser/cjs/BvEv8i6SisfC24C1.cjs +7 -0
- package/browser/cjs/Bzntg1YSzOszdwLy.cjs +6 -0
- package/browser/cjs/C9oIS5xxO9B7vS3W.cjs +6 -0
- package/browser/cjs/C9xTKWx1tr6NZFC8.cjs +6 -0
- package/browser/cjs/CCu9cK1DUD4oa3Nj.cjs +6 -0
- package/browser/cjs/CIeiC9TKv80O2_fQ.cjs +6 -0
- package/browser/cjs/COuRf_8YbqEsDQOC.cjs +6 -0
- package/browser/cjs/CQRZm8lGq26oKY31.cjs +6 -0
- package/browser/cjs/CYmpgLiDS0ZlbG11.cjs +6 -0
- package/browser/cjs/CZltonq1gEczLRHi.cjs +32 -0
- package/browser/cjs/Cf1j7hiCbQ8xo4_U.cjs +7 -0
- package/browser/cjs/CknjEH7DZBnqyPfk.cjs +6 -0
- package/browser/cjs/ClEc15AqSTFOf5zG.cjs +6 -0
- package/browser/cjs/CrUZUIz00uPDq4EA.cjs +6 -0
- package/browser/cjs/Cv1BFY5pqPtJd8qO.cjs +6 -0
- package/browser/cjs/CvvHAxM5SO6mwsyq.cjs +161 -0
- package/browser/cjs/Cvwrl86aXHFXJVZZ.cjs +6 -0
- package/browser/cjs/CwgzE59YUQ1eOTBi.cjs +6 -0
- package/browser/cjs/D3qzZXPgfAtKIAP9.cjs +11 -0
- package/browser/cjs/D7q2GFLhv9QRTZJe.cjs +6 -0
- package/browser/cjs/DB2WR3LaeOhkCAXY.cjs +6 -0
- package/browser/cjs/DFJ4dyRxiUF1XPPZ.cjs +15 -0
- package/browser/cjs/DJMpu6kYQUW3FWjs.cjs +6 -0
- package/browser/cjs/DL7DCFUaFkr2LYhZ.cjs +6 -0
- package/browser/cjs/DMMZr350oW-Zan7x.cjs +124 -0
- package/browser/cjs/DMfk3didwdGQLc0i.cjs +1501 -0
- package/browser/cjs/DaEdjRWwuNebE2hn.cjs +6 -0
- package/browser/cjs/Dd7vDdIeQaFScMRQ.cjs +6 -0
- package/browser/cjs/Df9S9eEGYxA_EcEr.cjs +6 -0
- package/browser/cjs/DgSAPPq-D_vlo9jE.cjs +6 -0
- package/browser/cjs/DmtZLv1wnSxRzPiR.cjs +6 -0
- package/browser/cjs/DqlFSswn_reXyFz8.cjs +6 -0
- package/browser/cjs/Dws_eDddoJKDPps_.cjs +6 -0
- package/browser/cjs/HyVntu9KkvdKrJEt.cjs +16 -0
- package/browser/cjs/Iek_K8QW1doYx_eo.cjs +6 -0
- package/browser/cjs/QJFc55OPrJyuRvDO.cjs +19 -0
- package/browser/cjs/QxU4KIgsHZuVigdy.cjs +329 -0
- package/browser/cjs/cOAjfOdF1cb-xgQG.cjs +6 -0
- package/browser/cjs/index.cjs +2 -80
- package/browser/cjs/kQ8wVygFJMcxlUv-.cjs +6 -0
- package/browser/cjs/tVbeAmLkaH_1Jy7R.cjs +6 -0
- package/browser/cjs/wNoDw92hvq2txBki.cjs +11 -0
- package/browser/esm/2d2eGHpsnUoCOFMT.mjs +47 -0
- package/browser/esm/AVmCEk8Fmiw2k_yK.mjs +425 -0
- package/browser/esm/B0A2aLiKDPGGU4k-.mjs +44515 -0
- package/browser/esm/BBov1fpR61VyhE3Z.mjs +10 -0
- package/browser/esm/BJD32_Zv5gkabGc0.mjs +10 -0
- package/browser/esm/BJqIPJDvrhWpZc4S.mjs +10 -0
- package/browser/esm/BKYjPTKdwG8Dn1_Z.mjs +21 -0
- package/browser/esm/BQfnqD12mz41DOr_.mjs +10 -0
- package/browser/esm/BSdVpOzJ8SL3EBhP.mjs +10 -0
- package/browser/esm/BVuoKgnuqrUwY6Fv.mjs +44 -0
- package/browser/esm/Ba4SdTfCAvYS7a3O.mjs +29 -0
- package/browser/esm/BajFlIH_X_nvDNfp.mjs +2344 -0
- package/browser/esm/Bb0W3ByMVowTViNK.mjs +10 -0
- package/browser/esm/BmyjN5txj3iMw_DE.mjs +10 -0
- package/browser/esm/BpFA0UU_TF4JO3dh.mjs +10 -0
- package/browser/esm/Btr2FDDtI_fht0WU.mjs +1466 -0
- package/browser/esm/Bzg-D_R4sXN-wyMx.mjs +10 -0
- package/browser/esm/C2xOGr0pDSHSMKoW.mjs +1366 -0
- package/browser/esm/CAal3t8F-VfdmgAH.mjs +10 -0
- package/browser/esm/CBPeZuyUIf9scEwn.mjs +2081 -0
- package/browser/esm/CCjuiVOyesh1IQpA.mjs +3936 -0
- package/browser/esm/CDnNRZ7jINT_Dr0K.mjs +46 -0
- package/browser/esm/CQaM4Ka20cP71fl0.mjs +10 -0
- package/browser/esm/CVlIOg6F8qrZdlQ1.mjs +10 -0
- package/browser/esm/Cbq2K4YGny5wwFEf.mjs +10 -0
- package/browser/esm/CfeqmUm-TkCE2XpK.mjs +260 -0
- package/browser/esm/Ckb6l6osoWh90VXn.mjs +10 -0
- package/browser/esm/CkccSfJEU471_Sui.mjs +1702 -0
- package/browser/esm/Cl0mB61JgZYfTh4S.mjs +24 -0
- package/browser/esm/Cm7pnWH_xgLwX_lZ.mjs +10 -0
- package/browser/esm/Co_HyodT3prcEvNJ.mjs +10 -0
- package/browser/esm/CsBIABPdnqpcZcvJ.mjs +10 -0
- package/browser/esm/CslKfn0zxkGKrM4-.mjs +48 -0
- package/browser/esm/Cx0a1WWRvJgDg4qb.mjs +21 -0
- package/browser/esm/D-QFKqWRP5dKwynV.mjs +10 -0
- package/browser/esm/DWgbhx4Y4WzyAP3Z.mjs +1575 -0
- package/browser/esm/DgFIjoPrM5dmrLHT.mjs +392 -0
- package/browser/esm/Dk_OZhcDLapTaNma.mjs +10 -0
- package/browser/esm/Dp--KMDeqecbq_Wc.mjs +10 -0
- package/browser/esm/Dva_qJrZGvFYbRxZ.mjs +21 -0
- package/browser/esm/DxJfUV0HFQT8g6H_.mjs +39 -0
- package/browser/esm/Dxqx7qwqE6wbYSpB.mjs +147 -0
- package/browser/esm/ObudKUELIfmbm87W.mjs +10 -0
- package/browser/esm/SGprYj0-SzDtrM3y.mjs +56 -0
- package/browser/esm/SmC3rmOCw-Ynredz.mjs +1672 -0
- package/browser/esm/T263hpnj_sMd1bmD.mjs +84 -0
- package/browser/esm/Ys1OCodY6sXUkZ6-.mjs +424 -0
- package/browser/esm/aqvSzH4m6bf7ODc6.mjs +10 -0
- package/browser/esm/d49_A3euUkzKZure.mjs +633 -0
- package/browser/esm/d8r4AqRUASAMCbBC.mjs +1352 -0
- package/browser/esm/fgXzhDR19HBK6PEW.mjs +20 -0
- package/browser/esm/g2unVUs-HBGBvXMs.mjs +12 -0
- package/browser/esm/gzl_ozUgkS0mr_32.mjs +13391 -0
- package/browser/esm/index.mjs +4 -176
- package/browser/esm/kbK4ZGVl1tl5F-UA.mjs +41 -0
- package/browser/esm/oAfM3SU0EgMxfDc0.mjs +3802 -0
- package/browser/esm/{NBuS53B7u8hItiXf.mjs → oUl7lbkOPMCi30tO.mjs} +937 -933
- package/browser/esm/tAl8qMu6C0Vlq5p-.mjs +5585 -0
- package/cdn/assets/1we1udiYEDagZ5XN.js +241 -0
- package/cdn/assets/8d4z_mUqWF_BnOt4.js +6481 -0
- package/cdn/assets/B-ol51_1jHaCVeGO.js +3802 -0
- package/cdn/assets/B2I5EC8Y3LkhqzOe.js +50 -0
- package/cdn/assets/B44RkeFF8g1ncaGw.js +49 -0
- package/cdn/assets/BBov1fpR61VyhE3Z.js +10 -0
- package/cdn/assets/BCEDMsB3yP73FGo4.js +260 -0
- package/cdn/assets/BERonPR_jlfR0j1B.js +46 -0
- package/cdn/assets/BJD32_Zv5gkabGc0.js +10 -0
- package/cdn/assets/BJqIPJDvrhWpZc4S.js +10 -0
- package/cdn/assets/BKYjPTKdwG8Dn1_Z.js +21 -0
- package/cdn/assets/BPQvYX3Tn3_XfM55.js +2346 -0
- package/cdn/assets/BQfnqD12mz41DOr_.js +10 -0
- package/cdn/assets/BSdVpOzJ8SL3EBhP.js +10 -0
- package/cdn/assets/BWHiFslK55rPiaTT.js +21 -0
- package/cdn/assets/BWhbbP9qvpjw1m3d.js +21 -0
- package/cdn/assets/B_gWDLoUXJ58kUTF.js +5585 -0
- package/cdn/assets/Bb0W3ByMVowTViNK.js +10 -0
- package/cdn/assets/Bk7mWQ4jJ591qT5U.js +1702 -0
- package/cdn/assets/BmyjN5txj3iMw_DE.js +10 -0
- package/cdn/assets/BnEb6t4xIVuW37yn.js +29 -0
- package/cdn/assets/BpFA0UU_TF4JO3dh.js +10 -0
- package/cdn/assets/Bzg-D_R4sXN-wyMx.js +10 -0
- package/cdn/assets/C2xOGr0pDSHSMKoW.js +1366 -0
- package/cdn/assets/CAal3t8F-VfdmgAH.js +10 -0
- package/cdn/assets/CGImeT9zAECbU9zM.js +43 -0
- package/cdn/assets/CIdfxx6BkkxIdU4J.js +36 -0
- package/cdn/assets/CQaM4Ka20cP71fl0.js +10 -0
- package/cdn/assets/CVgQlKevn28IBavQ.js +44342 -0
- package/cdn/assets/CVlIOg6F8qrZdlQ1.js +10 -0
- package/cdn/assets/Cbq2K4YGny5wwFEf.js +10 -0
- package/cdn/assets/CcE9nC_34k_5iKdO.js +425 -0
- package/cdn/assets/CcP-5SrDsnDeT6SQ.js +2083 -0
- package/cdn/assets/Ckb6l6osoWh90VXn.js +10 -0
- package/cdn/assets/Cl0mB61JgZYfTh4S.js +24 -0
- package/cdn/assets/Cm7pnWH_xgLwX_lZ.js +10 -0
- package/cdn/assets/Co_HyodT3prcEvNJ.js +10 -0
- package/cdn/assets/CsBIABPdnqpcZcvJ.js +10 -0
- package/cdn/assets/Ct1wZ_TFb7_zG9uz.js +22 -0
- package/cdn/assets/D-QFKqWRP5dKwynV.js +10 -0
- package/cdn/assets/D8hsneNA-W9ryUa9.js +27 -0
- package/cdn/assets/DBzbchpZyNJVqFwJ.js +1575 -0
- package/cdn/assets/DIBJnPf-ZLpoUAyv.js +90 -0
- package/cdn/assets/DKaNurhCUtSDI3-Y.js +3936 -0
- package/cdn/assets/DQmcuM6zJj_UBR4j.js +58 -0
- package/cdn/assets/DXWy4_H6I-dyOLr6.js +46 -0
- package/cdn/assets/DXlz010r4VFvz1TS.js +23 -0
- package/cdn/assets/Dk_OZhcDLapTaNma.js +10 -0
- package/cdn/assets/Dp--KMDeqecbq_Wc.js +10 -0
- package/cdn/assets/DqRiTlxxpGv8z6hB.js +392 -0
- package/cdn/assets/Dt6M8k8ljeGubAJ5.js +1466 -0
- package/cdn/assets/Dzb_e1lRgdeWlKbP.js +27 -0
- package/cdn/assets/ObudKUELIfmbm87W.js +10 -0
- package/cdn/assets/QtHcsa9O7bxZgew4.js +12 -0
- package/cdn/assets/SmC3rmOCw-Ynredz.js +1672 -0
- package/cdn/assets/UBuQw1PVtmH3a9bE.js +84 -0
- package/cdn/assets/Ys1OCodY6sXUkZ6-.js +424 -0
- package/cdn/assets/aqvSzH4m6bf7ODc6.js +10 -0
- package/cdn/assets/d49_A3euUkzKZure.js +633 -0
- package/cdn/assets/d8r4AqRUASAMCbBC.js +1352 -0
- package/cdn/assets/g2unVUs-HBGBvXMs.js +12 -0
- package/cdn/assets/gzl_ozUgkS0mr_32.js +13391 -0
- package/cdn/assets/o1yNcQczZA65rwUv.js +41 -0
- package/cdn/assets/u_xPkr1quUnZRgrA.js +149 -0
- package/cdn/index.js +2 -2
- package/cdn/loader.js +1 -1
- package/package.json +3 -3
- package/cdn/assets/CY8njwo06MWkoPz2.js +0 -21
|
@@ -0,0 +1,633 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license @sheetxl/studio-vanilla - SheetXL Studio - Vanilla entry point for integrating SheetXL UI. - v0.4.22
|
|
3
|
+
*
|
|
4
|
+
* (C) 2025-present SheetXL Inc. & Michael T. Ford
|
|
5
|
+
* License: The license can be found at https://www.sheetxl.com/license.
|
|
6
|
+
*/
|
|
7
|
+
function v(t) {
|
|
8
|
+
return Array.isArray ? Array.isArray(t) : Fe(t) === "[object Array]";
|
|
9
|
+
}
|
|
10
|
+
function L(t) {
|
|
11
|
+
return typeof t == "string";
|
|
12
|
+
}
|
|
13
|
+
function Ce(t) {
|
|
14
|
+
return typeof t == "number";
|
|
15
|
+
}
|
|
16
|
+
function me(t) {
|
|
17
|
+
return typeof t == "object";
|
|
18
|
+
}
|
|
19
|
+
function F(t) {
|
|
20
|
+
return t != null;
|
|
21
|
+
}
|
|
22
|
+
function te(t) {
|
|
23
|
+
return !t.trim().length;
|
|
24
|
+
}
|
|
25
|
+
function Fe(t) {
|
|
26
|
+
return t == null ? t === void 0 ? "[object Undefined]" : "[object Null]" : Object.prototype.toString.call(t);
|
|
27
|
+
}
|
|
28
|
+
const le = Object.prototype.hasOwnProperty;
|
|
29
|
+
class Ie {
|
|
30
|
+
constructor(e) {
|
|
31
|
+
this._keys = [], this._keyMap = {};
|
|
32
|
+
let s = 0;
|
|
33
|
+
e.forEach((i) => {
|
|
34
|
+
let n = Me(i);
|
|
35
|
+
this._keys.push(n), this._keyMap[n.id] = n, s += n.weight;
|
|
36
|
+
}), this._keys.forEach((i) => {
|
|
37
|
+
i.weight /= s;
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
get(e) {
|
|
41
|
+
return this._keyMap[e];
|
|
42
|
+
}
|
|
43
|
+
keys() {
|
|
44
|
+
return this._keys;
|
|
45
|
+
}
|
|
46
|
+
toJSON() {
|
|
47
|
+
return JSON.stringify(this._keys);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function Me(t) {
|
|
51
|
+
let e = null, s = null, i = null, n = 1, r = null;
|
|
52
|
+
if (L(t) || v(t)) i = t, e = de(t), s = ie(t);
|
|
53
|
+
else {
|
|
54
|
+
if (!le.call(t, "name")) throw new Error("Missing name property in key");
|
|
55
|
+
const u = t.name;
|
|
56
|
+
if (i = u, le.call(t, "weight") && (n = t.weight, n <= 0)) throw new Error(`Property 'weight' in key '${u}' must be a positive integer`);
|
|
57
|
+
e = de(u), s = ie(u), r = t.getFn;
|
|
58
|
+
}
|
|
59
|
+
return { path: e, id: s, weight: n, src: i, getFn: r };
|
|
60
|
+
}
|
|
61
|
+
function de(t) {
|
|
62
|
+
return v(t) ? t : t.split(".");
|
|
63
|
+
}
|
|
64
|
+
function ie(t) {
|
|
65
|
+
return v(t) ? t.join(".") : t;
|
|
66
|
+
}
|
|
67
|
+
var l = { isCaseSensitive: !1, ignoreDiacritics: !1, includeScore: !1, keys: [], shouldSort: !0, sortFn: (t, e) => t.score === e.score ? t.idx < e.idx ? -1 : 1 : t.score < e.score ? -1 : 1, includeMatches: !1, findAllMatches: !1, minMatchCharLength: 1, location: 0, threshold: 0.6, distance: 100, useExtendedSearch: !1, getFn: function(t, e) {
|
|
68
|
+
let s = [], i = !1;
|
|
69
|
+
const n = (r, u, h) => {
|
|
70
|
+
if (F(r)) if (u[h]) {
|
|
71
|
+
const a = r[u[h]];
|
|
72
|
+
if (!F(a)) return;
|
|
73
|
+
if (h === u.length - 1 && (L(a) || Ce(a) || function(o) {
|
|
74
|
+
return o === !0 || o === !1 || me(d = o) && d !== null && Fe(o) == "[object Boolean]";
|
|
75
|
+
var d;
|
|
76
|
+
}(a))) s.push((c = a) == null ? "" : function(o) {
|
|
77
|
+
if (typeof o == "string") return o;
|
|
78
|
+
let d = o + "";
|
|
79
|
+
return d == "0" && 1 / o == -1 / 0 ? "-0" : d;
|
|
80
|
+
}(c));
|
|
81
|
+
else if (v(a)) {
|
|
82
|
+
i = !0;
|
|
83
|
+
for (let o = 0, d = a.length; o < d; o += 1) n(a[o], u, h + 1);
|
|
84
|
+
} else u.length && n(a, u, h + 1);
|
|
85
|
+
} else s.push(r);
|
|
86
|
+
var c;
|
|
87
|
+
};
|
|
88
|
+
return n(t, L(e) ? e.split(".") : e, 0), i ? s : s[0];
|
|
89
|
+
}, ignoreLocation: !1, ignoreFieldNorm: !1, fieldNormWeight: 1 };
|
|
90
|
+
const we = /[^ ]+/g;
|
|
91
|
+
class ce {
|
|
92
|
+
constructor({ getFn: e = l.getFn, fieldNormWeight: s = l.fieldNormWeight } = {}) {
|
|
93
|
+
this.norm = function(i = 1, n = 3) {
|
|
94
|
+
const r = /* @__PURE__ */ new Map(), u = Math.pow(10, n);
|
|
95
|
+
return { get(h) {
|
|
96
|
+
const c = h.match(we).length;
|
|
97
|
+
if (r.has(c)) return r.get(c);
|
|
98
|
+
const a = 1 / Math.pow(c, 0.5 * i), o = parseFloat(Math.round(a * u) / u);
|
|
99
|
+
return r.set(c, o), o;
|
|
100
|
+
}, clear() {
|
|
101
|
+
r.clear();
|
|
102
|
+
} };
|
|
103
|
+
}(s, 3), this.getFn = e, this.isCreated = !1, this.setIndexRecords();
|
|
104
|
+
}
|
|
105
|
+
setSources(e = []) {
|
|
106
|
+
this.docs = e;
|
|
107
|
+
}
|
|
108
|
+
setIndexRecords(e = []) {
|
|
109
|
+
this.records = e;
|
|
110
|
+
}
|
|
111
|
+
setKeys(e = []) {
|
|
112
|
+
this.keys = e, this._keysMap = {}, e.forEach((s, i) => {
|
|
113
|
+
this._keysMap[s.id] = i;
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
create() {
|
|
117
|
+
!this.isCreated && this.docs.length && (this.isCreated = !0, L(this.docs[0]) ? this.docs.forEach((e, s) => {
|
|
118
|
+
this._addString(e, s);
|
|
119
|
+
}) : this.docs.forEach((e, s) => {
|
|
120
|
+
this._addObject(e, s);
|
|
121
|
+
}), this.norm.clear());
|
|
122
|
+
}
|
|
123
|
+
add(e) {
|
|
124
|
+
const s = this.size();
|
|
125
|
+
L(e) ? this._addString(e, s) : this._addObject(e, s);
|
|
126
|
+
}
|
|
127
|
+
removeAt(e) {
|
|
128
|
+
this.records.splice(e, 1);
|
|
129
|
+
for (let s = e, i = this.size(); s < i; s += 1) this.records[s].i -= 1;
|
|
130
|
+
}
|
|
131
|
+
getValueForItemAtKeyId(e, s) {
|
|
132
|
+
return e[this._keysMap[s]];
|
|
133
|
+
}
|
|
134
|
+
size() {
|
|
135
|
+
return this.records.length;
|
|
136
|
+
}
|
|
137
|
+
_addString(e, s) {
|
|
138
|
+
if (!F(e) || te(e)) return;
|
|
139
|
+
let i = { v: e, i: s, n: this.norm.get(e) };
|
|
140
|
+
this.records.push(i);
|
|
141
|
+
}
|
|
142
|
+
_addObject(e, s) {
|
|
143
|
+
let i = { i: s, $: {} };
|
|
144
|
+
this.keys.forEach((n, r) => {
|
|
145
|
+
let u = n.getFn ? n.getFn(e) : this.getFn(e, n.path);
|
|
146
|
+
if (F(u)) {
|
|
147
|
+
if (v(u)) {
|
|
148
|
+
let h = [];
|
|
149
|
+
const c = [{ nestedArrIndex: -1, value: u }];
|
|
150
|
+
for (; c.length; ) {
|
|
151
|
+
const { nestedArrIndex: a, value: o } = c.pop();
|
|
152
|
+
if (F(o)) if (L(o) && !te(o)) {
|
|
153
|
+
let d = { v: o, i: a, n: this.norm.get(o) };
|
|
154
|
+
h.push(d);
|
|
155
|
+
} else v(o) && o.forEach((d, f) => {
|
|
156
|
+
c.push({ nestedArrIndex: f, value: d });
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
i.$[r] = h;
|
|
160
|
+
} else if (L(u) && !te(u)) {
|
|
161
|
+
let h = { v: u, n: this.norm.get(u) };
|
|
162
|
+
i.$[r] = h;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}), this.records.push(i);
|
|
166
|
+
}
|
|
167
|
+
toJSON() {
|
|
168
|
+
return { keys: this.keys, records: this.records };
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
function Ee(t, e, { getFn: s = l.getFn, fieldNormWeight: i = l.fieldNormWeight } = {}) {
|
|
172
|
+
const n = new ce({ getFn: s, fieldNormWeight: i });
|
|
173
|
+
return n.setKeys(t.map(Me)), n.setSources(e), n.create(), n;
|
|
174
|
+
}
|
|
175
|
+
function X(t, { errors: e = 0, currentLocation: s = 0, expectedLocation: i = 0, distance: n = l.distance, ignoreLocation: r = l.ignoreLocation } = {}) {
|
|
176
|
+
const u = e / t.length;
|
|
177
|
+
if (r) return u;
|
|
178
|
+
const h = Math.abs(i - s);
|
|
179
|
+
return n ? u + h / n : h ? 1 : u;
|
|
180
|
+
}
|
|
181
|
+
const z = 32;
|
|
182
|
+
function $e(t) {
|
|
183
|
+
let e = {};
|
|
184
|
+
for (let s = 0, i = t.length; s < i; s += 1) {
|
|
185
|
+
const n = t.charAt(s);
|
|
186
|
+
e[n] = (e[n] || 0) | 1 << i - s - 1;
|
|
187
|
+
}
|
|
188
|
+
return e;
|
|
189
|
+
}
|
|
190
|
+
const Y = 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;
|
|
191
|
+
class De {
|
|
192
|
+
constructor(e, { location: s = l.location, threshold: i = l.threshold, distance: n = l.distance, includeMatches: r = l.includeMatches, findAllMatches: u = l.findAllMatches, minMatchCharLength: h = l.minMatchCharLength, isCaseSensitive: c = l.isCaseSensitive, ignoreDiacritics: a = l.ignoreDiacritics, ignoreLocation: o = l.ignoreLocation } = {}) {
|
|
193
|
+
if (this.options = { location: s, threshold: i, distance: n, includeMatches: r, findAllMatches: u, minMatchCharLength: h, isCaseSensitive: c, ignoreDiacritics: a, ignoreLocation: o }, e = c ? e : e.toLowerCase(), e = a ? Y(e) : e, this.pattern = e, this.chunks = [], !this.pattern.length) return;
|
|
194
|
+
const d = (g, p) => {
|
|
195
|
+
this.chunks.push({ pattern: g, alphabet: $e(g), startIndex: p });
|
|
196
|
+
}, f = this.pattern.length;
|
|
197
|
+
if (f > z) {
|
|
198
|
+
let g = 0;
|
|
199
|
+
const p = f % z, A = f - p;
|
|
200
|
+
for (; g < A; ) d(this.pattern.substr(g, z), g), g += z;
|
|
201
|
+
if (p) {
|
|
202
|
+
const m = f - z;
|
|
203
|
+
d(this.pattern.substr(m), m);
|
|
204
|
+
}
|
|
205
|
+
} else d(this.pattern, 0);
|
|
206
|
+
}
|
|
207
|
+
searchIn(e) {
|
|
208
|
+
const { isCaseSensitive: s, ignoreDiacritics: i, includeMatches: n } = this.options;
|
|
209
|
+
if (e = s ? e : e.toLowerCase(), e = i ? Y(e) : e, this.pattern === e) {
|
|
210
|
+
let A = { isMatch: !0, score: 0 };
|
|
211
|
+
return n && (A.indices = [[0, e.length - 1]]), A;
|
|
212
|
+
}
|
|
213
|
+
const { location: r, distance: u, threshold: h, findAllMatches: c, minMatchCharLength: a, ignoreLocation: o } = this.options;
|
|
214
|
+
let d = [], f = 0, g = !1;
|
|
215
|
+
this.chunks.forEach(({ pattern: A, alphabet: m, startIndex: _ }) => {
|
|
216
|
+
const { isMatch: N, score: w, indices: S } = function(k, $, Le, { location: ke = l.location, distance: J = l.distance, threshold: ve = l.threshold, findAllMatches: _e = l.findAllMatches, minMatchCharLength: he = l.minMatchCharLength, includeMatches: ae = l.includeMatches, ignoreLocation: V = l.ignoreLocation } = {}) {
|
|
217
|
+
if ($.length > z) throw new Error("Pattern length exceeds max of 32.");
|
|
218
|
+
const R = $.length, K = k.length, y = Math.max(0, Math.min(ke, K));
|
|
219
|
+
let O = ve, b = y;
|
|
220
|
+
const Q = he > 1 || ae, Z = Q ? Array(K) : [];
|
|
221
|
+
let U;
|
|
222
|
+
for (; (U = k.indexOf($, b)) > -1; ) {
|
|
223
|
+
let M = X($, { currentLocation: U, expectedLocation: y, distance: J, ignoreLocation: V });
|
|
224
|
+
if (O = Math.min(M, O), b = U + R, Q) {
|
|
225
|
+
let E = 0;
|
|
226
|
+
for (; E < R; ) Z[U + E] = 1, E += 1;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
b = -1;
|
|
230
|
+
let G = [], H = 1, T = R + K;
|
|
231
|
+
const Se = 1 << R - 1;
|
|
232
|
+
for (let M = 0; M < R; M += 1) {
|
|
233
|
+
let E = 0, B = T;
|
|
234
|
+
for (; E < B; ) X($, { errors: M, currentLocation: y + B, expectedLocation: y, distance: J, ignoreLocation: V }) <= O ? E = B : T = B, B = Math.floor((T - E) / 2 + E);
|
|
235
|
+
T = B;
|
|
236
|
+
let j = Math.max(1, y - B + 1), D = _e ? K : Math.min(y + B, K) + R, x = Array(D + 2);
|
|
237
|
+
x[D + 1] = (1 << M) - 1;
|
|
238
|
+
for (let C = D; C >= j; C -= 1) {
|
|
239
|
+
let W = C - 1, P = Le[k.charAt(W)];
|
|
240
|
+
if (Q && (Z[W] = +!!P), x[C] = (x[C + 1] << 1 | 1) & P, M && (x[C] |= (G[C + 1] | G[C]) << 1 | 1 | G[C + 1]), x[C] & Se && (H = X($, { errors: M, currentLocation: W, expectedLocation: y, distance: J, ignoreLocation: V }), H <= O)) {
|
|
241
|
+
if (O = H, b = W, b <= y) break;
|
|
242
|
+
j = Math.max(1, 2 * y - b);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
if (X($, { errors: M + 1, currentLocation: y, expectedLocation: y, distance: J, ignoreLocation: V }) > O) break;
|
|
246
|
+
G = x;
|
|
247
|
+
}
|
|
248
|
+
const ee = { isMatch: b >= 0, score: Math.max(1e-3, H) };
|
|
249
|
+
if (Q) {
|
|
250
|
+
const M = function(E = [], B = l.minMatchCharLength) {
|
|
251
|
+
let j = [], D = -1, x = -1, C = 0;
|
|
252
|
+
for (let W = E.length; C < W; C += 1) {
|
|
253
|
+
let P = E[C];
|
|
254
|
+
P && D === -1 ? D = C : P || D === -1 || (x = C - 1, x - D + 1 >= B && j.push([D, x]), D = -1);
|
|
255
|
+
}
|
|
256
|
+
return E[C - 1] && C - D >= B && j.push([D, C - 1]), j;
|
|
257
|
+
}(Z, he);
|
|
258
|
+
M.length ? ae && (ee.indices = M) : ee.isMatch = !1;
|
|
259
|
+
}
|
|
260
|
+
return ee;
|
|
261
|
+
}(e, A, m, { location: r + _, distance: u, threshold: h, findAllMatches: c, minMatchCharLength: a, includeMatches: n, ignoreLocation: o });
|
|
262
|
+
N && (g = !0), f += w, N && S && (d = [...d, ...S]);
|
|
263
|
+
});
|
|
264
|
+
let p = { isMatch: g, score: g ? f / this.chunks.length : 1 };
|
|
265
|
+
return g && n && (p.indices = d), p;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
class I {
|
|
269
|
+
constructor(e) {
|
|
270
|
+
this.pattern = e;
|
|
271
|
+
}
|
|
272
|
+
static isMultiMatch(e) {
|
|
273
|
+
return ge(e, this.multiRegex);
|
|
274
|
+
}
|
|
275
|
+
static isSingleMatch(e) {
|
|
276
|
+
return ge(e, this.singleRegex);
|
|
277
|
+
}
|
|
278
|
+
search() {
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
function ge(t, e) {
|
|
282
|
+
const s = t.match(e);
|
|
283
|
+
return s ? s[1] : null;
|
|
284
|
+
}
|
|
285
|
+
class ye extends I {
|
|
286
|
+
constructor(e, { location: s = l.location, threshold: i = l.threshold, distance: n = l.distance, includeMatches: r = l.includeMatches, findAllMatches: u = l.findAllMatches, minMatchCharLength: h = l.minMatchCharLength, isCaseSensitive: c = l.isCaseSensitive, ignoreDiacritics: a = l.ignoreDiacritics, ignoreLocation: o = l.ignoreLocation } = {}) {
|
|
287
|
+
super(e), this._bitapSearch = new De(e, { location: s, threshold: i, distance: n, includeMatches: r, findAllMatches: u, minMatchCharLength: h, isCaseSensitive: c, ignoreDiacritics: a, ignoreLocation: o });
|
|
288
|
+
}
|
|
289
|
+
static get type() {
|
|
290
|
+
return "fuzzy";
|
|
291
|
+
}
|
|
292
|
+
static get multiRegex() {
|
|
293
|
+
return /^"(.*)"$/;
|
|
294
|
+
}
|
|
295
|
+
static get singleRegex() {
|
|
296
|
+
return /^(.*)$/;
|
|
297
|
+
}
|
|
298
|
+
search(e) {
|
|
299
|
+
return this._bitapSearch.searchIn(e);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
class Be extends I {
|
|
303
|
+
constructor(e) {
|
|
304
|
+
super(e);
|
|
305
|
+
}
|
|
306
|
+
static get type() {
|
|
307
|
+
return "include";
|
|
308
|
+
}
|
|
309
|
+
static get multiRegex() {
|
|
310
|
+
return /^'"(.*)"$/;
|
|
311
|
+
}
|
|
312
|
+
static get singleRegex() {
|
|
313
|
+
return /^'(.*)$/;
|
|
314
|
+
}
|
|
315
|
+
search(e) {
|
|
316
|
+
let s, i = 0;
|
|
317
|
+
const n = [], r = this.pattern.length;
|
|
318
|
+
for (; (s = e.indexOf(this.pattern, i)) > -1; ) i = s + r, n.push([s, i - 1]);
|
|
319
|
+
const u = !!n.length;
|
|
320
|
+
return { isMatch: u, score: u ? 0 : 1, indices: n };
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
const ne = [class extends I {
|
|
324
|
+
constructor(t) {
|
|
325
|
+
super(t);
|
|
326
|
+
}
|
|
327
|
+
static get type() {
|
|
328
|
+
return "exact";
|
|
329
|
+
}
|
|
330
|
+
static get multiRegex() {
|
|
331
|
+
return /^="(.*)"$/;
|
|
332
|
+
}
|
|
333
|
+
static get singleRegex() {
|
|
334
|
+
return /^=(.*)$/;
|
|
335
|
+
}
|
|
336
|
+
search(t) {
|
|
337
|
+
const e = t === this.pattern;
|
|
338
|
+
return { isMatch: e, score: e ? 0 : 1, indices: [0, this.pattern.length - 1] };
|
|
339
|
+
}
|
|
340
|
+
}, Be, class extends I {
|
|
341
|
+
constructor(t) {
|
|
342
|
+
super(t);
|
|
343
|
+
}
|
|
344
|
+
static get type() {
|
|
345
|
+
return "prefix-exact";
|
|
346
|
+
}
|
|
347
|
+
static get multiRegex() {
|
|
348
|
+
return /^\^"(.*)"$/;
|
|
349
|
+
}
|
|
350
|
+
static get singleRegex() {
|
|
351
|
+
return /^\^(.*)$/;
|
|
352
|
+
}
|
|
353
|
+
search(t) {
|
|
354
|
+
const e = t.startsWith(this.pattern);
|
|
355
|
+
return { isMatch: e, score: e ? 0 : 1, indices: [0, this.pattern.length - 1] };
|
|
356
|
+
}
|
|
357
|
+
}, class extends I {
|
|
358
|
+
constructor(t) {
|
|
359
|
+
super(t);
|
|
360
|
+
}
|
|
361
|
+
static get type() {
|
|
362
|
+
return "inverse-prefix-exact";
|
|
363
|
+
}
|
|
364
|
+
static get multiRegex() {
|
|
365
|
+
return /^!\^"(.*)"$/;
|
|
366
|
+
}
|
|
367
|
+
static get singleRegex() {
|
|
368
|
+
return /^!\^(.*)$/;
|
|
369
|
+
}
|
|
370
|
+
search(t) {
|
|
371
|
+
const e = !t.startsWith(this.pattern);
|
|
372
|
+
return { isMatch: e, score: e ? 0 : 1, indices: [0, t.length - 1] };
|
|
373
|
+
}
|
|
374
|
+
}, class extends I {
|
|
375
|
+
constructor(t) {
|
|
376
|
+
super(t);
|
|
377
|
+
}
|
|
378
|
+
static get type() {
|
|
379
|
+
return "inverse-suffix-exact";
|
|
380
|
+
}
|
|
381
|
+
static get multiRegex() {
|
|
382
|
+
return /^!"(.*)"\$$/;
|
|
383
|
+
}
|
|
384
|
+
static get singleRegex() {
|
|
385
|
+
return /^!(.*)\$$/;
|
|
386
|
+
}
|
|
387
|
+
search(t) {
|
|
388
|
+
const e = !t.endsWith(this.pattern);
|
|
389
|
+
return { isMatch: e, score: e ? 0 : 1, indices: [0, t.length - 1] };
|
|
390
|
+
}
|
|
391
|
+
}, class extends I {
|
|
392
|
+
constructor(t) {
|
|
393
|
+
super(t);
|
|
394
|
+
}
|
|
395
|
+
static get type() {
|
|
396
|
+
return "suffix-exact";
|
|
397
|
+
}
|
|
398
|
+
static get multiRegex() {
|
|
399
|
+
return /^"(.*)"\$$/;
|
|
400
|
+
}
|
|
401
|
+
static get singleRegex() {
|
|
402
|
+
return /^(.*)\$$/;
|
|
403
|
+
}
|
|
404
|
+
search(t) {
|
|
405
|
+
const e = t.endsWith(this.pattern);
|
|
406
|
+
return { isMatch: e, score: e ? 0 : 1, indices: [t.length - this.pattern.length, t.length - 1] };
|
|
407
|
+
}
|
|
408
|
+
}, class extends I {
|
|
409
|
+
constructor(t) {
|
|
410
|
+
super(t);
|
|
411
|
+
}
|
|
412
|
+
static get type() {
|
|
413
|
+
return "inverse-exact";
|
|
414
|
+
}
|
|
415
|
+
static get multiRegex() {
|
|
416
|
+
return /^!"(.*)"$/;
|
|
417
|
+
}
|
|
418
|
+
static get singleRegex() {
|
|
419
|
+
return /^!(.*)$/;
|
|
420
|
+
}
|
|
421
|
+
search(t) {
|
|
422
|
+
const e = t.indexOf(this.pattern) === -1;
|
|
423
|
+
return { isMatch: e, score: e ? 0 : 1, indices: [0, t.length - 1] };
|
|
424
|
+
}
|
|
425
|
+
}, ye], fe = ne.length, be = / +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/, Ne = /* @__PURE__ */ new Set([ye.type, Be.type]), re = [];
|
|
426
|
+
function ue(t, e) {
|
|
427
|
+
for (let s = 0, i = re.length; s < i; s += 1) {
|
|
428
|
+
let n = re[s];
|
|
429
|
+
if (n.condition(t, e)) return new n(t, e);
|
|
430
|
+
}
|
|
431
|
+
return new De(t, e);
|
|
432
|
+
}
|
|
433
|
+
const oe = "$and", Ae = "$path", se = (t) => !(!t[oe] && !t.$or), pe = (t) => ({ [oe]: Object.keys(t).map((e) => ({ [e]: t[e] })) });
|
|
434
|
+
function xe(t, e, { auto: s = !0 } = {}) {
|
|
435
|
+
const i = (n) => {
|
|
436
|
+
let r = Object.keys(n);
|
|
437
|
+
const u = !!n[Ae];
|
|
438
|
+
if (!u && r.length > 1 && !se(n)) return i(pe(n));
|
|
439
|
+
if (((c) => !v(c) && me(c) && !se(c))(n)) {
|
|
440
|
+
const c = u ? n[Ae] : r[0], a = u ? n.$val : n[c];
|
|
441
|
+
if (!L(a)) throw new Error(`Invalid value for key ${c}`);
|
|
442
|
+
const o = { keyId: ie(c), pattern: a };
|
|
443
|
+
return s && (o.searcher = ue(a, e)), o;
|
|
444
|
+
}
|
|
445
|
+
let h = { children: [], operator: r[0] };
|
|
446
|
+
return r.forEach((c) => {
|
|
447
|
+
const a = n[c];
|
|
448
|
+
v(a) && a.forEach((o) => {
|
|
449
|
+
h.children.push(i(o));
|
|
450
|
+
});
|
|
451
|
+
}), h;
|
|
452
|
+
};
|
|
453
|
+
return se(t) || (t = pe(t)), i(t);
|
|
454
|
+
}
|
|
455
|
+
function Re(t, e) {
|
|
456
|
+
const s = t.matches;
|
|
457
|
+
e.matches = [], F(s) && s.forEach((i) => {
|
|
458
|
+
if (!F(i.indices) || !i.indices.length) return;
|
|
459
|
+
const { indices: n, value: r } = i;
|
|
460
|
+
let u = { indices: n, value: r };
|
|
461
|
+
i.key && (u.key = i.key.src), i.idx > -1 && (u.refIndex = i.idx), e.matches.push(u);
|
|
462
|
+
});
|
|
463
|
+
}
|
|
464
|
+
function Oe(t, e) {
|
|
465
|
+
e.score = t.score;
|
|
466
|
+
}
|
|
467
|
+
class q {
|
|
468
|
+
constructor(e, s = {}, i) {
|
|
469
|
+
this.options = { ...l, ...s }, this.options.useExtendedSearch, this._keyStore = new Ie(this.options.keys), this.setCollection(e, i);
|
|
470
|
+
}
|
|
471
|
+
setCollection(e, s) {
|
|
472
|
+
if (this._docs = e, s && !(s instanceof ce)) throw new Error("Incorrect 'index' type");
|
|
473
|
+
this._myIndex = s || Ee(this.options.keys, this._docs, { getFn: this.options.getFn, fieldNormWeight: this.options.fieldNormWeight });
|
|
474
|
+
}
|
|
475
|
+
add(e) {
|
|
476
|
+
F(e) && (this._docs.push(e), this._myIndex.add(e));
|
|
477
|
+
}
|
|
478
|
+
remove(e = () => !1) {
|
|
479
|
+
const s = [];
|
|
480
|
+
for (let i = 0, n = this._docs.length; i < n; i += 1) {
|
|
481
|
+
const r = this._docs[i];
|
|
482
|
+
e(r, i) && (this.removeAt(i), i -= 1, n -= 1, s.push(r));
|
|
483
|
+
}
|
|
484
|
+
return s;
|
|
485
|
+
}
|
|
486
|
+
removeAt(e) {
|
|
487
|
+
this._docs.splice(e, 1), this._myIndex.removeAt(e);
|
|
488
|
+
}
|
|
489
|
+
getIndex() {
|
|
490
|
+
return this._myIndex;
|
|
491
|
+
}
|
|
492
|
+
search(e, { limit: s = -1 } = {}) {
|
|
493
|
+
const { includeMatches: i, includeScore: n, shouldSort: r, sortFn: u, ignoreFieldNorm: h } = this.options;
|
|
494
|
+
let c = L(e) ? L(this._docs[0]) ? this._searchStringList(e) : this._searchObjectList(e) : this._searchLogical(e);
|
|
495
|
+
return function(a, { ignoreFieldNorm: o = l.ignoreFieldNorm }) {
|
|
496
|
+
a.forEach((d) => {
|
|
497
|
+
let f = 1;
|
|
498
|
+
d.matches.forEach(({ key: g, norm: p, score: A }) => {
|
|
499
|
+
const m = g ? g.weight : null;
|
|
500
|
+
f *= Math.pow(A === 0 && m ? Number.EPSILON : A, (m || 1) * (o ? 1 : p));
|
|
501
|
+
}), d.score = f;
|
|
502
|
+
});
|
|
503
|
+
}(c, { ignoreFieldNorm: h }), r && c.sort(u), Ce(s) && s > -1 && (c = c.slice(0, s)), function(a, o, { includeMatches: d = l.includeMatches, includeScore: f = l.includeScore } = {}) {
|
|
504
|
+
const g = [];
|
|
505
|
+
return d && g.push(Re), f && g.push(Oe), a.map((p) => {
|
|
506
|
+
const { idx: A } = p, m = { item: o[A], refIndex: A };
|
|
507
|
+
return g.length && g.forEach((_) => {
|
|
508
|
+
_(p, m);
|
|
509
|
+
}), m;
|
|
510
|
+
});
|
|
511
|
+
}(c, this._docs, { includeMatches: i, includeScore: n });
|
|
512
|
+
}
|
|
513
|
+
_searchStringList(e) {
|
|
514
|
+
const s = ue(e, this.options), { records: i } = this._myIndex, n = [];
|
|
515
|
+
return i.forEach(({ v: r, i: u, n: h }) => {
|
|
516
|
+
if (!F(r)) return;
|
|
517
|
+
const { isMatch: c, score: a, indices: o } = s.searchIn(r);
|
|
518
|
+
c && n.push({ item: r, idx: u, matches: [{ score: a, value: r, norm: h, indices: o }] });
|
|
519
|
+
}), n;
|
|
520
|
+
}
|
|
521
|
+
_searchLogical(e) {
|
|
522
|
+
const s = xe(e, this.options), i = (h, c, a) => {
|
|
523
|
+
if (!h.children) {
|
|
524
|
+
const { keyId: d, searcher: f } = h, g = this._findMatches({ key: this._keyStore.get(d), value: this._myIndex.getValueForItemAtKeyId(c, d), searcher: f });
|
|
525
|
+
return g && g.length ? [{ idx: a, item: c, matches: g }] : [];
|
|
526
|
+
}
|
|
527
|
+
const o = [];
|
|
528
|
+
for (let d = 0, f = h.children.length; d < f; d += 1) {
|
|
529
|
+
const g = h.children[d], p = i(g, c, a);
|
|
530
|
+
if (p.length) o.push(...p);
|
|
531
|
+
else if (h.operator === oe) return [];
|
|
532
|
+
}
|
|
533
|
+
return o;
|
|
534
|
+
}, n = this._myIndex.records, r = {}, u = [];
|
|
535
|
+
return n.forEach(({ $: h, i: c }) => {
|
|
536
|
+
if (F(h)) {
|
|
537
|
+
let a = i(s, h, c);
|
|
538
|
+
a.length && (r[c] || (r[c] = { idx: c, item: h, matches: [] }, u.push(r[c])), a.forEach(({ matches: o }) => {
|
|
539
|
+
r[c].matches.push(...o);
|
|
540
|
+
}));
|
|
541
|
+
}
|
|
542
|
+
}), u;
|
|
543
|
+
}
|
|
544
|
+
_searchObjectList(e) {
|
|
545
|
+
const s = ue(e, this.options), { keys: i, records: n } = this._myIndex, r = [];
|
|
546
|
+
return n.forEach(({ $: u, i: h }) => {
|
|
547
|
+
if (!F(u)) return;
|
|
548
|
+
let c = [];
|
|
549
|
+
i.forEach((a, o) => {
|
|
550
|
+
c.push(...this._findMatches({ key: a, value: u[o], searcher: s }));
|
|
551
|
+
}), c.length && r.push({ idx: h, item: u, matches: c });
|
|
552
|
+
}), r;
|
|
553
|
+
}
|
|
554
|
+
_findMatches({ key: e, value: s, searcher: i }) {
|
|
555
|
+
if (!F(s)) return [];
|
|
556
|
+
let n = [];
|
|
557
|
+
if (v(s)) s.forEach(({ v: r, i: u, n: h }) => {
|
|
558
|
+
if (!F(r)) return;
|
|
559
|
+
const { isMatch: c, score: a, indices: o } = i.searchIn(r);
|
|
560
|
+
c && n.push({ score: a, key: e, value: r, idx: u, norm: h, indices: o });
|
|
561
|
+
});
|
|
562
|
+
else {
|
|
563
|
+
const { v: r, n: u } = s, { isMatch: h, score: c, indices: a } = i.searchIn(r);
|
|
564
|
+
h && n.push({ score: c, key: e, value: r, norm: u, indices: a });
|
|
565
|
+
}
|
|
566
|
+
return n;
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
q.version = "7.1.0", q.createIndex = Ee, q.parseIndex = function(t, { getFn: e = l.getFn, fieldNormWeight: s = l.fieldNormWeight } = {}) {
|
|
570
|
+
const { keys: i, records: n } = t, r = new ce({ getFn: e, fieldNormWeight: s });
|
|
571
|
+
return r.setKeys(i), r.setIndexRecords(n), r;
|
|
572
|
+
}, q.config = l, q.parseQuery = xe, function(...t) {
|
|
573
|
+
re.push(...t);
|
|
574
|
+
}(class {
|
|
575
|
+
constructor(t, { isCaseSensitive: e = l.isCaseSensitive, ignoreDiacritics: s = l.ignoreDiacritics, includeMatches: i = l.includeMatches, minMatchCharLength: n = l.minMatchCharLength, ignoreLocation: r = l.ignoreLocation, findAllMatches: u = l.findAllMatches, location: h = l.location, threshold: c = l.threshold, distance: a = l.distance } = {}) {
|
|
576
|
+
this.query = null, this.options = { isCaseSensitive: e, ignoreDiacritics: s, includeMatches: i, minMatchCharLength: n, findAllMatches: u, ignoreLocation: r, location: h, threshold: c, distance: a }, t = e ? t : t.toLowerCase(), t = s ? Y(t) : t, this.pattern = t, this.query = function(o, d = {}) {
|
|
577
|
+
return o.split("|").map((f) => {
|
|
578
|
+
let g = f.trim().split(be).filter((A) => A && !!A.trim()), p = [];
|
|
579
|
+
for (let A = 0, m = g.length; A < m; A += 1) {
|
|
580
|
+
const _ = g[A];
|
|
581
|
+
let N = !1, w = -1;
|
|
582
|
+
for (; !N && ++w < fe; ) {
|
|
583
|
+
const S = ne[w];
|
|
584
|
+
let k = S.isMultiMatch(_);
|
|
585
|
+
k && (p.push(new S(k, d)), N = !0);
|
|
586
|
+
}
|
|
587
|
+
if (!N) for (w = -1; ++w < fe; ) {
|
|
588
|
+
const S = ne[w];
|
|
589
|
+
let k = S.isSingleMatch(_);
|
|
590
|
+
if (k) {
|
|
591
|
+
p.push(new S(k, d));
|
|
592
|
+
break;
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
return p;
|
|
597
|
+
});
|
|
598
|
+
}(this.pattern, this.options);
|
|
599
|
+
}
|
|
600
|
+
static condition(t, e) {
|
|
601
|
+
return e.useExtendedSearch;
|
|
602
|
+
}
|
|
603
|
+
searchIn(t) {
|
|
604
|
+
const e = this.query;
|
|
605
|
+
if (!e) return { isMatch: !1, score: 1 };
|
|
606
|
+
const { includeMatches: s, isCaseSensitive: i, ignoreDiacritics: n } = this.options;
|
|
607
|
+
t = i ? t : t.toLowerCase(), t = n ? Y(t) : t;
|
|
608
|
+
let r = 0, u = [], h = 0;
|
|
609
|
+
for (let c = 0, a = e.length; c < a; c += 1) {
|
|
610
|
+
const o = e[c];
|
|
611
|
+
u.length = 0, r = 0;
|
|
612
|
+
for (let d = 0, f = o.length; d < f; d += 1) {
|
|
613
|
+
const g = o[d], { isMatch: p, indices: A, score: m } = g.search(t);
|
|
614
|
+
if (!p) {
|
|
615
|
+
h = 0, r = 0, u.length = 0;
|
|
616
|
+
break;
|
|
617
|
+
}
|
|
618
|
+
if (r += 1, h += m, s) {
|
|
619
|
+
const _ = g.constructor.type;
|
|
620
|
+
Ne.has(_) ? u = [...u, ...A] : u.push(A);
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
if (r) {
|
|
624
|
+
let d = { isMatch: !0, score: h / r };
|
|
625
|
+
return s && (d.indices = u), d;
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
return { isMatch: !1, score: 1 };
|
|
629
|
+
}
|
|
630
|
+
});
|
|
631
|
+
export {
|
|
632
|
+
q as default
|
|
633
|
+
};
|