@synnaxlabs/pluto 0.53.1 → 0.54.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (286) hide show
  1. package/dist/aether-BBeeeA1z.cjs +10 -0
  2. package/dist/aether-Bl3vMZO3.js +716 -0
  3. package/dist/aether-DmSenWd4.js +704 -0
  4. package/dist/aether-VeYJQDcf.cjs +11 -0
  5. package/dist/button-DBdzH6Ky.cjs +1 -0
  6. package/dist/button-KtgabnXL.js +251 -0
  7. package/dist/button.cjs +1 -1
  8. package/dist/button.js +2 -4
  9. package/dist/chunk-DeC0fbbY.js +23 -0
  10. package/dist/chunk-FeXHwk1_.cjs +1 -0
  11. package/dist/color-Cspp5cKp.js +7904 -0
  12. package/dist/color-DCCr0Z1b.cjs +29 -0
  13. package/dist/color.cjs +1 -1
  14. package/dist/color.js +2 -4
  15. package/dist/css-Ce-x3HcK.cjs +1 -0
  16. package/dist/css-UEo6g0SR.js +69 -0
  17. package/dist/css.cjs +1 -1
  18. package/dist/css.js +2 -8
  19. package/dist/dialog-BTCrp5Yv.cjs +1 -0
  20. package/dist/dialog-ClQI4sHo.js +331 -0
  21. package/dist/dialog.cjs +1 -1
  22. package/dist/dialog.js +2 -4
  23. package/dist/divider-BYRH8-5K.js +13 -0
  24. package/dist/divider-CEyntx31.cjs +1 -0
  25. package/dist/ether-CZlE80D0.cjs +53 -0
  26. package/dist/ether-KMGPzrZR.js +6222 -0
  27. package/dist/ether.cjs +1 -1
  28. package/dist/ether.js +4 -104
  29. package/dist/event-Btz3eWg1.cjs +1 -0
  30. package/dist/event-Z4V8c501.js +4 -0
  31. package/dist/flex-Bgtu0DK6.js +62 -0
  32. package/dist/flex-D_GoD3ed.cjs +1 -0
  33. package/dist/flex.cjs +1 -1
  34. package/dist/flex.js +2 -4
  35. package/dist/haul-BdMc4rLJ.js +171 -0
  36. package/dist/haul-ZdSHqhp6.cjs +1 -0
  37. package/dist/header-CNx3pAkx.js +64 -0
  38. package/dist/header-lD0sRjCR.cjs +1 -0
  39. package/dist/header.cjs +1 -1
  40. package/dist/header.js +2 -4
  41. package/dist/input-CdL1OPDU.cjs +74 -0
  42. package/dist/input-h-4axMs7.js +47772 -0
  43. package/dist/input.cjs +1 -1
  44. package/dist/input.js +2 -4
  45. package/dist/list-DacuSBB3.cjs +4 -0
  46. package/dist/list-dZDsxTzd.js +1756 -0
  47. package/dist/list.cjs +1 -1
  48. package/dist/list.js +2 -4
  49. package/dist/menu-eeXfR_zT.js +170 -0
  50. package/dist/menu-yADx33I8.cjs +1 -0
  51. package/dist/menu.cjs +1 -1
  52. package/dist/menu.js +2 -4
  53. package/dist/pluto.cjs +52 -0
  54. package/dist/pluto.css +2 -1
  55. package/dist/pluto.js +36474 -0
  56. package/dist/select-B93mFqvf.js +1328 -0
  57. package/dist/select-gt7wGGO4.cjs +1 -0
  58. package/dist/src/access/policy/queries.d.ts +34 -34
  59. package/dist/src/access/policy/queries.d.ts.map +1 -1
  60. package/dist/src/access/queries.d.ts +1 -1
  61. package/dist/src/access/queries.d.ts.map +1 -1
  62. package/dist/src/access/role/queries.d.ts +2 -12
  63. package/dist/src/access/role/queries.d.ts.map +1 -1
  64. package/dist/src/arc/queries.d.ts +1167 -29
  65. package/dist/src/arc/queries.d.ts.map +1 -1
  66. package/dist/src/channel/LinePlot.d.ts +2 -2
  67. package/dist/src/channel/LinePlot.d.ts.map +1 -1
  68. package/dist/src/channel/queries.d.ts +108 -60
  69. package/dist/src/channel/queries.d.ts.map +1 -1
  70. package/dist/src/color/Provider.d.ts +8 -8
  71. package/dist/src/device/queries.d.ts +148 -363
  72. package/dist/src/device/queries.d.ts.map +1 -1
  73. package/dist/src/flux/result.d.ts +5 -5
  74. package/dist/src/flux/result.d.ts.map +1 -1
  75. package/dist/src/flux/update.d.ts +1 -1
  76. package/dist/src/flux/update.d.ts.map +1 -1
  77. package/dist/src/icon/Icon.d.ts.map +1 -1
  78. package/dist/src/icon/registry.d.ts +1 -0
  79. package/dist/src/icon/registry.d.ts.map +1 -1
  80. package/dist/src/label/queries.d.ts +21 -21
  81. package/dist/src/label/queries.d.ts.map +1 -1
  82. package/dist/src/lineplot/aether/XAxis.d.ts +28 -28
  83. package/dist/src/lineplot/aether/YAxis.d.ts +28 -28
  84. package/dist/src/lineplot/aether/axis.d.ts +14 -14
  85. package/dist/src/lineplot/queries.d.ts +2 -2
  86. package/dist/src/lineplot/queries.d.ts.map +1 -1
  87. package/dist/src/lineplot/range/aether/provider.d.ts +126 -102
  88. package/dist/src/lineplot/range/aether/provider.d.ts.map +1 -1
  89. package/dist/src/lineplot/tooltip/aether/tooltip.d.ts +56 -56
  90. package/dist/src/log/aether/Log.d.ts +21 -21
  91. package/dist/src/log/queries.d.ts +2 -2
  92. package/dist/src/log/queries.d.ts.map +1 -1
  93. package/dist/src/memo/index.d.ts +0 -1
  94. package/dist/src/memo/index.d.ts.map +1 -1
  95. package/dist/src/memo/useMemoCompare.d.ts +0 -1
  96. package/dist/src/memo/useMemoCompare.d.ts.map +1 -1
  97. package/dist/src/rack/queries.d.ts.map +1 -1
  98. package/dist/src/ranger/aether/queries.d.ts.map +1 -1
  99. package/dist/src/ranger/queries.d.ts +19 -19
  100. package/dist/src/ranger/queries.d.ts.map +1 -1
  101. package/dist/src/schematic/queries.d.ts +2 -2
  102. package/dist/src/schematic/queries.d.ts.map +1 -1
  103. package/dist/src/schematic/symbol/Forms.d.ts.map +1 -1
  104. package/dist/src/schematic/symbol/Primitives.d.ts +2 -1
  105. package/dist/src/schematic/symbol/Primitives.d.ts.map +1 -1
  106. package/dist/src/schematic/symbol/SelectOrientation.d.ts.map +1 -1
  107. package/dist/src/schematic/symbol/Symbols.d.ts +35 -34
  108. package/dist/src/schematic/symbol/Symbols.d.ts.map +1 -1
  109. package/dist/src/schematic/symbol/queries.d.ts +96 -50
  110. package/dist/src/schematic/symbol/queries.d.ts.map +1 -1
  111. package/dist/src/schematic/symbol/registry.d.ts.map +1 -1
  112. package/dist/src/select/Dialog.d.ts +2 -1
  113. package/dist/src/select/Dialog.d.ts.map +1 -1
  114. package/dist/src/status/Select.d.ts.map +1 -1
  115. package/dist/src/status/SelectMulipleVariants.spec.d.ts +2 -0
  116. package/dist/src/status/SelectMulipleVariants.spec.d.ts.map +1 -0
  117. package/dist/src/status/SelectMultipleVariants.d.ts +9 -0
  118. package/dist/src/status/SelectMultipleVariants.d.ts.map +1 -0
  119. package/dist/src/status/SelectVariant.d.ts +2 -2
  120. package/dist/src/status/SelectVariant.d.ts.map +1 -1
  121. package/dist/src/status/SelectVariant.spec.d.ts +2 -0
  122. package/dist/src/status/SelectVariant.spec.d.ts.map +1 -0
  123. package/dist/src/status/aether/aggregator.d.ts +16 -2
  124. package/dist/src/status/aether/aggregator.d.ts.map +1 -1
  125. package/dist/src/status/aether/errorHandler.d.ts +2 -1
  126. package/dist/src/status/aether/errorHandler.d.ts.map +1 -1
  127. package/dist/src/status/base/Aggregator.d.ts +3 -2
  128. package/dist/src/status/base/Aggregator.d.ts.map +1 -1
  129. package/dist/src/status/external.d.ts +1 -0
  130. package/dist/src/status/external.d.ts.map +1 -1
  131. package/dist/src/status/queries.d.ts +25 -9
  132. package/dist/src/status/queries.d.ts.map +1 -1
  133. package/dist/src/status/variantData.d.ts +4 -0
  134. package/dist/src/status/variantData.d.ts.map +1 -0
  135. package/dist/src/table/cells/Cells.d.ts +17 -17
  136. package/dist/src/table/queries.d.ts +2 -2
  137. package/dist/src/table/queries.d.ts.map +1 -1
  138. package/dist/src/task/queries.d.ts +3 -3
  139. package/dist/src/task/queries.d.ts.map +1 -1
  140. package/dist/src/telem/aether/noop.d.ts.map +1 -1
  141. package/dist/src/telem/aether/static.d.ts +10 -10
  142. package/dist/src/telem/aether/telem.d.ts +1 -1
  143. package/dist/src/telem/aether/telem.d.ts.map +1 -1
  144. package/dist/src/telem/aether/transformers.d.ts +15 -15
  145. package/dist/src/telem/aether/transformers.d.ts.map +1 -1
  146. package/dist/src/telem/client/cache/cache.d.ts +1 -1
  147. package/dist/src/telem/client/cache/cache.d.ts.map +1 -1
  148. package/dist/src/telem/client/client.d.ts +4 -4
  149. package/dist/src/telem/client/client.d.ts.map +1 -1
  150. package/dist/src/telem/client/reader.d.ts +1 -1
  151. package/dist/src/telem/client/reader.d.ts.map +1 -1
  152. package/dist/src/telem/client/streamer.d.ts +1 -1
  153. package/dist/src/telem/client/streamer.d.ts.map +1 -1
  154. package/dist/src/telem/control/Controller.d.ts +1 -1
  155. package/dist/src/telem/control/Controller.d.ts.map +1 -1
  156. package/dist/src/telem/control/aether/chip.d.ts +16 -2
  157. package/dist/src/telem/control/aether/chip.d.ts.map +1 -1
  158. package/dist/src/telem/control/aether/controller.d.ts +16 -16
  159. package/dist/src/telem/control/aether/controller.d.ts.map +1 -1
  160. package/dist/src/telem/control/aether/indicator.d.ts +51 -37
  161. package/dist/src/telem/control/aether/indicator.d.ts.map +1 -1
  162. package/dist/src/telem/control/aether/legend.d.ts +18 -16
  163. package/dist/src/telem/control/aether/legend.d.ts.map +1 -1
  164. package/dist/src/telem/control/aether/state.d.ts +9 -8
  165. package/dist/src/telem/control/aether/state.d.ts.map +1 -1
  166. package/dist/src/theming/aether/provider.d.ts +990 -990
  167. package/dist/src/theming/base/theme.d.ts +330 -330
  168. package/dist/src/user/queries.d.ts +2 -2
  169. package/dist/src/view/queries.d.ts +2 -2
  170. package/dist/src/vis/axis/axis.d.ts +14 -14
  171. package/dist/src/vis/gauge/aether/gauge.d.ts +21 -21
  172. package/dist/src/vis/gauge/use.d.ts +7 -7
  173. package/dist/src/vis/line/aether/line.d.ts +7 -7
  174. package/dist/src/vis/measure/aether/measure.d.ts +56 -56
  175. package/dist/src/vis/rule/aether/aether.d.ts +14 -14
  176. package/dist/src/vis/value/aether/value.d.ts +42 -42
  177. package/dist/src/vis/value/redline.d.ts +5 -5
  178. package/dist/src/vis/value/redline.d.ts.map +1 -1
  179. package/dist/src/vis/value/use.d.ts +14 -14
  180. package/dist/src/workspace/queries.d.ts +6 -4
  181. package/dist/src/workspace/queries.d.ts.map +1 -1
  182. package/dist/tabs-CB7d2_0h.cjs +1 -0
  183. package/dist/tabs-DEXXNOZA.js +253 -0
  184. package/dist/tabs.cjs +1 -1
  185. package/dist/tabs.js +2 -4
  186. package/dist/text-Dd6wYgQM.js +142 -0
  187. package/dist/text-n3Fetdk6.cjs +1 -0
  188. package/dist/text.cjs +1 -1
  189. package/dist/text.js +2 -5
  190. package/dist/theming-Blgv4Cvi.js +591 -0
  191. package/dist/theming-KFfFjsRJ.cjs +1 -0
  192. package/dist/theming.cjs +1 -1
  193. package/dist/theming.js +2 -5
  194. package/dist/tree-B4jJAzS1.js +294 -0
  195. package/dist/tree-CsgSEpgy.cjs +1 -0
  196. package/dist/tree.cjs +1 -1
  197. package/dist/tree.js +2 -4
  198. package/dist/triggers-AqBSAR_T.cjs +1 -0
  199. package/dist/triggers-DDlalLoO.js +4748 -0
  200. package/dist/triggers.cjs +1 -1
  201. package/dist/triggers.js +2 -4
  202. package/dist/types-BGbd8pRh.js +73 -0
  203. package/dist/types-ByXvRm2h.cjs +1 -0
  204. package/dist/video-Bnr-2W9p.cjs +1 -0
  205. package/dist/video-ByMlaeKI.js +15 -0
  206. package/dist/video.cjs +1 -1
  207. package/dist/video.js +2 -4
  208. package/package.json +27 -28
  209. package/dist/Animated-B_N04fe6.cjs +0 -1
  210. package/dist/Animated-BsbNkFLg.cjs +0 -1
  211. package/dist/Animated-CLo1CLgn.js +0 -29
  212. package/dist/Animated-CO--9HPM.js +0 -354
  213. package/dist/Box-Bi280MYh.js +0 -96
  214. package/dist/Box-CNUz5BsV.cjs +0 -1
  215. package/dist/Copy-BgRUUzWz.cjs +0 -1
  216. package/dist/Copy-COWBkO_v.js +0 -337
  217. package/dist/Dialog-Bj7FiHJD.js +0 -59
  218. package/dist/Dialog-DBm6Fap1.cjs +0 -1
  219. package/dist/Editable-C17ILP50.js +0 -202
  220. package/dist/Editable-HUPqTaui.cjs +0 -1
  221. package/dist/Haul-CnZK3e-n.js +0 -132
  222. package/dist/Haul-DlwI4b25.cjs +0 -1
  223. package/dist/Items-CXBBG9Ip.cjs +0 -4
  224. package/dist/Items-DQba1BFQ.js +0 -842
  225. package/dist/Menu-BZ6ZGIv3.cjs +0 -1
  226. package/dist/Menu-CniMpPmC.js +0 -139
  227. package/dist/Provider-cSwm-2e_.cjs +0 -1
  228. package/dist/Provider-jFWpR0CX.js +0 -520
  229. package/dist/Tags-CxzMdPpm.cjs +0 -1
  230. package/dist/Tags-DvfGhiWv.js +0 -925
  231. package/dist/Text-2MISZsc5.js +0 -1712
  232. package/dist/Text-XHBXXDRS.cjs +0 -1
  233. package/dist/Video-Bew5_j16.js +0 -10
  234. package/dist/Video-BryrVNlH.cjs +0 -1
  235. package/dist/css-CloSmhZB.cjs +0 -1
  236. package/dist/css-D90kZTM8.js +0 -63
  237. package/dist/dimensions-CdFEW3oU.cjs +0 -1
  238. package/dist/dimensions-DbMN4145.js +0 -19
  239. package/dist/eraser-BShvqlBE.js +0 -958
  240. package/dist/eraser-rFMFKqsg.cjs +0 -11
  241. package/dist/event-BxvV3arE.cjs +0 -1
  242. package/dist/event-nNH_pXSr.js +0 -36
  243. package/dist/external-4jf1Bv96.cjs +0 -1
  244. package/dist/external-B2YeNEwd.cjs +0 -1
  245. package/dist/external-B9PnwQOL.js +0 -29
  246. package/dist/external-BBbkXXN0.js +0 -47
  247. package/dist/external-BByOkVID.cjs +0 -1
  248. package/dist/external-BrEnYrZV.js +0 -32
  249. package/dist/external-BwbypKCk.cjs +0 -1
  250. package/dist/external-C65vBow6.cjs +0 -1
  251. package/dist/external-CCcIJ20u.cjs +0 -1
  252. package/dist/external-CF4uh-dm.js +0 -51423
  253. package/dist/external-Cn6EfkLd.cjs +0 -1
  254. package/dist/external-CovFw1fv.cjs +0 -1
  255. package/dist/external-D2Zb9O5J.js +0 -93
  256. package/dist/external-D6aLGjMg.js +0 -8969
  257. package/dist/external-DDvmnE2k.js +0 -341
  258. package/dist/external-DTi9a-iK.cjs +0 -1
  259. package/dist/external-DYP1_xpd.js +0 -80
  260. package/dist/external-DxsuBuKe.js +0 -392
  261. package/dist/external-DysGdnTb.js +0 -130
  262. package/dist/external-N2L8ffzi.js +0 -71
  263. package/dist/external-UzXlHlr9.js +0 -24
  264. package/dist/external-_Ht_yCRf.cjs +0 -1
  265. package/dist/external-igNfmRSB.cjs +0 -28
  266. package/dist/external-uUEGzmui.cjs +0 -84
  267. package/dist/fontString-76R2eWDd.js +0 -29
  268. package/dist/fontString-BNnhiwug.cjs +0 -1
  269. package/dist/hooks-Co6IVYNw.cjs +0 -1
  270. package/dist/hooks-QNj6PdUo.js +0 -73
  271. package/dist/index.cjs +0 -60
  272. package/dist/index.js +0 -36908
  273. package/dist/jsx-runtime-nZSsnGb7.cjs +0 -6
  274. package/dist/jsx-runtime-tc70JA_2.js +0 -264
  275. package/dist/provider-Bt-E2O6g.js +0 -810
  276. package/dist/provider-DQkVj3tA.cjs +0 -10
  277. package/dist/src/memo/proxyMemo.d.ts +0 -3
  278. package/dist/src/memo/proxyMemo.d.ts.map +0 -1
  279. package/dist/types-CGRCBVD4.js +0 -82
  280. package/dist/types-DI2vtOGs.cjs +0 -1
  281. package/dist/units-Bu36uC6z.cjs +0 -1
  282. package/dist/units-DMip-eZH.js +0 -14
  283. package/dist/useStaticData-BTwIe0Il.cjs +0 -1
  284. package/dist/useStaticData-p8sk2VCJ.js +0 -1051
  285. package/dist/value-BkUH03tl.cjs +0 -53
  286. package/dist/value-D0vfKEY3.js +0 -6821
@@ -1,1051 +0,0 @@
1
- import { useMemo as O, useState as le, useCallback as fe } from "react";
2
- function D(t) {
3
- return Array.isArray ? Array.isArray(t) : re(t) === "[object Array]";
4
- }
5
- function de(t) {
6
- if (typeof t == "string")
7
- return t;
8
- let e = t + "";
9
- return e == "0" && 1 / t == -1 / 0 ? "-0" : e;
10
- }
11
- function ge(t) {
12
- return t == null ? "" : de(t);
13
- }
14
- function M(t) {
15
- return typeof t == "string";
16
- }
17
- function te(t) {
18
- return typeof t == "number";
19
- }
20
- function Ae(t) {
21
- return t === !0 || t === !1 || pe(t) && re(t) == "[object Boolean]";
22
- }
23
- function se(t) {
24
- return typeof t == "object";
25
- }
26
- function pe(t) {
27
- return se(t) && t !== null;
28
- }
29
- function E(t) {
30
- return t != null;
31
- }
32
- function j(t) {
33
- return !t.trim().length;
34
- }
35
- function re(t) {
36
- return t == null ? t === void 0 ? "[object Undefined]" : "[object Null]" : Object.prototype.toString.call(t);
37
- }
38
- const Ee = "Incorrect 'index' type", Ce = (t) => `Invalid value for key ${t}`, me = (t) => `Pattern length exceeds max of ${t}.`, Fe = (t) => `Missing ${t} property in key`, Me = (t) => `Property 'weight' in key '${t}' must be a positive integer`, U = Object.prototype.hasOwnProperty;
39
- class Be {
40
- constructor(e) {
41
- this._keys = [], this._keyMap = {};
42
- let s = 0;
43
- e.forEach((r) => {
44
- let n = ne(r);
45
- this._keys.push(n), this._keyMap[n.id] = n, s += n.weight;
46
- }), this._keys.forEach((r) => {
47
- r.weight /= s;
48
- });
49
- }
50
- get(e) {
51
- return this._keyMap[e];
52
- }
53
- keys() {
54
- return this._keys;
55
- }
56
- toJSON() {
57
- return JSON.stringify(this._keys);
58
- }
59
- }
60
- function ne(t) {
61
- let e = null, s = null, r = null, n = 1, i = null;
62
- if (M(t) || D(t))
63
- r = t, e = X(t), s = K(t);
64
- else {
65
- if (!U.call(t, "name"))
66
- throw new Error(Fe("name"));
67
- const u = t.name;
68
- if (r = u, U.call(t, "weight") && (n = t.weight, n <= 0))
69
- throw new Error(Me(u));
70
- e = X(u), s = K(u), i = t.getFn;
71
- }
72
- return { path: e, id: s, weight: n, src: r, getFn: i };
73
- }
74
- function X(t) {
75
- return D(t) ? t : t.split(".");
76
- }
77
- function K(t) {
78
- return D(t) ? t.join(".") : t;
79
- }
80
- function De(t, e) {
81
- let s = [], r = !1;
82
- const n = (i, u, c) => {
83
- if (E(i))
84
- if (!u[c])
85
- s.push(i);
86
- else {
87
- let h = u[c];
88
- const o = i[h];
89
- if (!E(o))
90
- return;
91
- if (c === u.length - 1 && (M(o) || te(o) || Ae(o)))
92
- s.push(ge(o));
93
- else if (D(o)) {
94
- r = !0;
95
- for (let a = 0, f = o.length; a < f; a += 1)
96
- n(o[a], u, c + 1);
97
- } else u.length && n(o, u, c + 1);
98
- }
99
- };
100
- return n(t, M(e) ? e.split(".") : e, 0), r ? s : s[0];
101
- }
102
- const ye = {
103
- // Whether the matches should be included in the result set. When `true`, each record in the result
104
- // set will include the indices of the matched characters.
105
- // These can consequently be used for highlighting purposes.
106
- includeMatches: !1,
107
- // When `true`, the matching function will continue to the end of a search pattern even if
108
- // a perfect match has already been located in the string.
109
- findAllMatches: !1,
110
- // Minimum number of characters that must be matched before a result is considered a match
111
- minMatchCharLength: 1
112
- }, xe = {
113
- // When `true`, the algorithm continues searching to the end of the input even if a perfect
114
- // match is found before the end of the same input.
115
- isCaseSensitive: !1,
116
- // When `true`, the algorithm will ignore diacritics (accents) in comparisons
117
- ignoreDiacritics: !1,
118
- // When true, the matching function will continue to the end of a search pattern even if
119
- includeScore: !1,
120
- // List of properties that will be searched. This also supports nested properties.
121
- keys: [],
122
- // Whether to sort the result list, by score
123
- shouldSort: !0,
124
- // Default sort function: sort by ascending score, ascending index
125
- sortFn: (t, e) => t.score === e.score ? t.idx < e.idx ? -1 : 1 : t.score < e.score ? -1 : 1
126
- }, _e = {
127
- // Approximately where in the text is the pattern expected to be found?
128
- location: 0,
129
- // At what point does the match algorithm give up. A threshold of '0.0' requires a perfect match
130
- // (of both letters and location), a threshold of '1.0' would match anything.
131
- threshold: 0.6,
132
- // Determines how close the match must be to the fuzzy location (specified above).
133
- // An exact letter match which is 'distance' characters away from the fuzzy location
134
- // would score as a complete mismatch. A distance of '0' requires the match be at
135
- // the exact location specified, a threshold of '1000' would require a perfect match
136
- // to be within 800 characters of the fuzzy location to be found using a 0.8 threshold.
137
- distance: 100
138
- }, Ie = {
139
- // When `true`, it enables the use of unix-like search commands
140
- useExtendedSearch: !1,
141
- // The get function to use when fetching an object's properties.
142
- // The default will search nested paths *ie foo.bar.baz*
143
- getFn: De,
144
- // When `true`, search will ignore `location` and `distance`, so it won't matter
145
- // where in the string the pattern appears.
146
- // More info: https://fusejs.io/concepts/scoring-theory.html#fuzziness-score
147
- ignoreLocation: !1,
148
- // When `true`, the calculation for the relevance score (used for sorting) will
149
- // ignore the field-length norm.
150
- // More info: https://fusejs.io/concepts/scoring-theory.html#field-length-norm
151
- ignoreFieldNorm: !1,
152
- // The weight to determine how much field length norm effects scoring.
153
- fieldNormWeight: 1
154
- };
155
- var l = {
156
- ...xe,
157
- ...ye,
158
- ..._e,
159
- ...Ie
160
- };
161
- const Se = /[^ ]+/g;
162
- function we(t = 1, e = 3) {
163
- const s = /* @__PURE__ */ new Map(), r = Math.pow(10, e);
164
- return {
165
- get(n) {
166
- const i = n.match(Se).length;
167
- if (s.has(i))
168
- return s.get(i);
169
- const u = 1 / Math.pow(i, 0.5 * t), c = parseFloat(Math.round(u * r) / r);
170
- return s.set(i, c), c;
171
- },
172
- clear() {
173
- s.clear();
174
- }
175
- };
176
- }
177
- class V {
178
- constructor({
179
- getFn: e = l.getFn,
180
- fieldNormWeight: s = l.fieldNormWeight
181
- } = {}) {
182
- this.norm = we(s, 3), this.getFn = e, this.isCreated = !1, this.setIndexRecords();
183
- }
184
- setSources(e = []) {
185
- this.docs = e;
186
- }
187
- setIndexRecords(e = []) {
188
- this.records = e;
189
- }
190
- setKeys(e = []) {
191
- this.keys = e, this._keysMap = {}, e.forEach((s, r) => {
192
- this._keysMap[s.id] = r;
193
- });
194
- }
195
- create() {
196
- this.isCreated || !this.docs.length || (this.isCreated = !0, M(this.docs[0]) ? this.docs.forEach((e, s) => {
197
- this._addString(e, s);
198
- }) : this.docs.forEach((e, s) => {
199
- this._addObject(e, s);
200
- }), this.norm.clear());
201
- }
202
- // Adds a doc to the end of the index
203
- add(e) {
204
- const s = this.size();
205
- M(e) ? this._addString(e, s) : this._addObject(e, s);
206
- }
207
- // Removes the doc at the specified index of the index
208
- removeAt(e) {
209
- this.records.splice(e, 1);
210
- for (let s = e, r = this.size(); s < r; s += 1)
211
- this.records[s].i -= 1;
212
- }
213
- getValueForItemAtKeyId(e, s) {
214
- return e[this._keysMap[s]];
215
- }
216
- size() {
217
- return this.records.length;
218
- }
219
- _addString(e, s) {
220
- if (!E(e) || j(e))
221
- return;
222
- let r = {
223
- v: e,
224
- i: s,
225
- n: this.norm.get(e)
226
- };
227
- this.records.push(r);
228
- }
229
- _addObject(e, s) {
230
- let r = { i: s, $: {} };
231
- this.keys.forEach((n, i) => {
232
- let u = n.getFn ? n.getFn(e) : this.getFn(e, n.path);
233
- if (E(u)) {
234
- if (D(u)) {
235
- let c = [];
236
- const h = [{ nestedArrIndex: -1, value: u }];
237
- for (; h.length; ) {
238
- const { nestedArrIndex: o, value: a } = h.pop();
239
- if (E(a))
240
- if (M(a) && !j(a)) {
241
- let f = {
242
- v: a,
243
- i: o,
244
- n: this.norm.get(a)
245
- };
246
- c.push(f);
247
- } else D(a) && a.forEach((f, d) => {
248
- h.push({
249
- nestedArrIndex: d,
250
- value: f
251
- });
252
- });
253
- }
254
- r.$[i] = c;
255
- } else if (M(u) && !j(u)) {
256
- let c = {
257
- v: u,
258
- n: this.norm.get(u)
259
- };
260
- r.$[i] = c;
261
- }
262
- }
263
- }), this.records.push(r);
264
- }
265
- toJSON() {
266
- return {
267
- keys: this.keys,
268
- records: this.records
269
- };
270
- }
271
- }
272
- function ie(t, e, { getFn: s = l.getFn, fieldNormWeight: r = l.fieldNormWeight } = {}) {
273
- const n = new V({ getFn: s, fieldNormWeight: r });
274
- return n.setKeys(t.map(ne)), n.setSources(e), n.create(), n;
275
- }
276
- function Le(t, { getFn: e = l.getFn, fieldNormWeight: s = l.fieldNormWeight } = {}) {
277
- const { keys: r, records: n } = t, i = new V({ getFn: e, fieldNormWeight: s });
278
- return i.setKeys(r), i.setIndexRecords(n), i;
279
- }
280
- function $(t, {
281
- errors: e = 0,
282
- currentLocation: s = 0,
283
- expectedLocation: r = 0,
284
- distance: n = l.distance,
285
- ignoreLocation: i = l.ignoreLocation
286
- } = {}) {
287
- const u = e / t.length;
288
- if (i)
289
- return u;
290
- const c = Math.abs(r - s);
291
- return n ? u + c / n : c ? 1 : u;
292
- }
293
- function Re(t = [], e = l.minMatchCharLength) {
294
- let s = [], r = -1, n = -1, i = 0;
295
- for (let u = t.length; i < u; i += 1) {
296
- let c = t[i];
297
- c && r === -1 ? r = i : !c && r !== -1 && (n = i - 1, n - r + 1 >= e && s.push([r, n]), r = -1);
298
- }
299
- return t[i - 1] && i - r >= e && s.push([r, i - 1]), s;
300
- }
301
- const w = 32;
302
- function be(t, e, s, {
303
- location: r = l.location,
304
- distance: n = l.distance,
305
- threshold: i = l.threshold,
306
- findAllMatches: u = l.findAllMatches,
307
- minMatchCharLength: c = l.minMatchCharLength,
308
- includeMatches: h = l.includeMatches,
309
- ignoreLocation: o = l.ignoreLocation
310
- } = {}) {
311
- if (e.length > w)
312
- throw new Error(me(w));
313
- const a = e.length, f = t.length, d = Math.max(0, Math.min(r, f));
314
- let g = i, A = d;
315
- const p = c > 1 || h, m = p ? Array(f) : [];
316
- let y;
317
- for (; (y = t.indexOf(e, A)) > -1; ) {
318
- let C = $(e, {
319
- currentLocation: y,
320
- expectedLocation: d,
321
- distance: n,
322
- ignoreLocation: o
323
- });
324
- if (g = Math.min(C, g), A = y + a, p) {
325
- let x = 0;
326
- for (; x < a; )
327
- m[y + x] = 1, x += 1;
328
- }
329
- }
330
- A = -1;
331
- let B = [], L = 1, S = a + f;
332
- const ae = 1 << a - 1;
333
- for (let C = 0; C < a; C += 1) {
334
- let x = 0, _ = S;
335
- for (; x < _; )
336
- $(e, {
337
- errors: C,
338
- currentLocation: d + _,
339
- expectedLocation: d,
340
- distance: n,
341
- ignoreLocation: o
342
- }) <= g ? x = _ : S = _, _ = Math.floor((S - x) / 2 + x);
343
- S = _;
344
- let Q = Math.max(1, d - _ + 1), P = u ? f : Math.min(d + _, f) + a, R = Array(P + 2);
345
- R[P + 1] = (1 << C) - 1;
346
- for (let F = P; F >= Q; F -= 1) {
347
- let k = F - 1, J = s[t.charAt(k)];
348
- if (p && (m[k] = +!!J), R[F] = (R[F + 1] << 1 | 1) & J, C && (R[F] |= (B[F + 1] | B[F]) << 1 | 1 | B[F + 1]), R[F] & ae && (L = $(e, {
349
- errors: C,
350
- currentLocation: k,
351
- expectedLocation: d,
352
- distance: n,
353
- ignoreLocation: o
354
- }), L <= g)) {
355
- if (g = L, A = k, A <= d)
356
- break;
357
- Q = Math.max(1, 2 * d - A);
358
- }
359
- }
360
- if ($(e, {
361
- errors: C + 1,
362
- currentLocation: d,
363
- expectedLocation: d,
364
- distance: n,
365
- ignoreLocation: o
366
- }) > g)
367
- break;
368
- B = R;
369
- }
370
- const T = {
371
- isMatch: A >= 0,
372
- // Count exact matches (those with a score of 0) to be "almost" exact
373
- score: Math.max(1e-3, L)
374
- };
375
- if (p) {
376
- const C = Re(m, c);
377
- C.length ? h && (T.indices = C) : T.isMatch = !1;
378
- }
379
- return T;
380
- }
381
- function ke(t) {
382
- let e = {};
383
- for (let s = 0, r = t.length; s < r; s += 1) {
384
- const n = t.charAt(s);
385
- e[n] = (e[n] || 0) | 1 << r - s - 1;
386
- }
387
- return e;
388
- }
389
- const N = 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);
390
- class ue {
391
- constructor(e, {
392
- location: s = l.location,
393
- threshold: r = l.threshold,
394
- distance: n = l.distance,
395
- includeMatches: i = l.includeMatches,
396
- findAllMatches: u = l.findAllMatches,
397
- minMatchCharLength: c = l.minMatchCharLength,
398
- isCaseSensitive: h = l.isCaseSensitive,
399
- ignoreDiacritics: o = l.ignoreDiacritics,
400
- ignoreLocation: a = l.ignoreLocation
401
- } = {}) {
402
- if (this.options = {
403
- location: s,
404
- threshold: r,
405
- distance: n,
406
- includeMatches: i,
407
- findAllMatches: u,
408
- minMatchCharLength: c,
409
- isCaseSensitive: h,
410
- ignoreDiacritics: o,
411
- ignoreLocation: a
412
- }, e = h ? e : e.toLowerCase(), e = o ? N(e) : e, this.pattern = e, this.chunks = [], !this.pattern.length)
413
- return;
414
- const f = (g, A) => {
415
- this.chunks.push({
416
- pattern: g,
417
- alphabet: ke(g),
418
- startIndex: A
419
- });
420
- }, d = this.pattern.length;
421
- if (d > w) {
422
- let g = 0;
423
- const A = d % w, p = d - A;
424
- for (; g < p; )
425
- f(this.pattern.substr(g, w), g), g += w;
426
- if (A) {
427
- const m = d - w;
428
- f(this.pattern.substr(m), m);
429
- }
430
- } else
431
- f(this.pattern, 0);
432
- }
433
- searchIn(e) {
434
- const { isCaseSensitive: s, ignoreDiacritics: r, includeMatches: n } = this.options;
435
- if (e = s ? e : e.toLowerCase(), e = r ? N(e) : e, this.pattern === e) {
436
- let p = {
437
- isMatch: !0,
438
- score: 0
439
- };
440
- return n && (p.indices = [[0, e.length - 1]]), p;
441
- }
442
- const {
443
- location: i,
444
- distance: u,
445
- threshold: c,
446
- findAllMatches: h,
447
- minMatchCharLength: o,
448
- ignoreLocation: a
449
- } = this.options;
450
- let f = [], d = 0, g = !1;
451
- this.chunks.forEach(({ pattern: p, alphabet: m, startIndex: y }) => {
452
- const { isMatch: B, score: L, indices: S } = be(e, p, m, {
453
- location: i + y,
454
- distance: u,
455
- threshold: c,
456
- findAllMatches: h,
457
- minMatchCharLength: o,
458
- includeMatches: n,
459
- ignoreLocation: a
460
- });
461
- B && (g = !0), d += L, B && S && (f = [...f, ...S]);
462
- });
463
- let A = {
464
- isMatch: g,
465
- score: g ? d / this.chunks.length : 1
466
- };
467
- return g && n && (A.indices = f), A;
468
- }
469
- }
470
- class I {
471
- constructor(e) {
472
- this.pattern = e;
473
- }
474
- static isMultiMatch(e) {
475
- return Z(e, this.multiRegex);
476
- }
477
- static isSingleMatch(e) {
478
- return Z(e, this.singleRegex);
479
- }
480
- search() {
481
- }
482
- }
483
- function Z(t, e) {
484
- const s = t.match(e);
485
- return s ? s[1] : null;
486
- }
487
- class Oe extends I {
488
- constructor(e) {
489
- super(e);
490
- }
491
- static get type() {
492
- return "exact";
493
- }
494
- static get multiRegex() {
495
- return /^="(.*)"$/;
496
- }
497
- static get singleRegex() {
498
- return /^=(.*)$/;
499
- }
500
- search(e) {
501
- const s = e === this.pattern;
502
- return {
503
- isMatch: s,
504
- score: s ? 0 : 1,
505
- indices: [0, this.pattern.length - 1]
506
- };
507
- }
508
- }
509
- class $e extends I {
510
- constructor(e) {
511
- super(e);
512
- }
513
- static get type() {
514
- return "inverse-exact";
515
- }
516
- static get multiRegex() {
517
- return /^!"(.*)"$/;
518
- }
519
- static get singleRegex() {
520
- return /^!(.*)$/;
521
- }
522
- search(e) {
523
- const r = e.indexOf(this.pattern) === -1;
524
- return {
525
- isMatch: r,
526
- score: r ? 0 : 1,
527
- indices: [0, e.length - 1]
528
- };
529
- }
530
- }
531
- class Ne extends I {
532
- constructor(e) {
533
- super(e);
534
- }
535
- static get type() {
536
- return "prefix-exact";
537
- }
538
- static get multiRegex() {
539
- return /^\^"(.*)"$/;
540
- }
541
- static get singleRegex() {
542
- return /^\^(.*)$/;
543
- }
544
- search(e) {
545
- const s = e.startsWith(this.pattern);
546
- return {
547
- isMatch: s,
548
- score: s ? 0 : 1,
549
- indices: [0, this.pattern.length - 1]
550
- };
551
- }
552
- }
553
- class ve extends I {
554
- constructor(e) {
555
- super(e);
556
- }
557
- static get type() {
558
- return "inverse-prefix-exact";
559
- }
560
- static get multiRegex() {
561
- return /^!\^"(.*)"$/;
562
- }
563
- static get singleRegex() {
564
- return /^!\^(.*)$/;
565
- }
566
- search(e) {
567
- const s = !e.startsWith(this.pattern);
568
- return {
569
- isMatch: s,
570
- score: s ? 0 : 1,
571
- indices: [0, e.length - 1]
572
- };
573
- }
574
- }
575
- class Te extends I {
576
- constructor(e) {
577
- super(e);
578
- }
579
- static get type() {
580
- return "suffix-exact";
581
- }
582
- static get multiRegex() {
583
- return /^"(.*)"\$$/;
584
- }
585
- static get singleRegex() {
586
- return /^(.*)\$$/;
587
- }
588
- search(e) {
589
- const s = e.endsWith(this.pattern);
590
- return {
591
- isMatch: s,
592
- score: s ? 0 : 1,
593
- indices: [e.length - this.pattern.length, e.length - 1]
594
- };
595
- }
596
- }
597
- class Pe extends I {
598
- constructor(e) {
599
- super(e);
600
- }
601
- static get type() {
602
- return "inverse-suffix-exact";
603
- }
604
- static get multiRegex() {
605
- return /^!"(.*)"\$$/;
606
- }
607
- static get singleRegex() {
608
- return /^!(.*)\$$/;
609
- }
610
- search(e) {
611
- const s = !e.endsWith(this.pattern);
612
- return {
613
- isMatch: s,
614
- score: s ? 0 : 1,
615
- indices: [0, e.length - 1]
616
- };
617
- }
618
- }
619
- class ce extends I {
620
- constructor(e, {
621
- location: s = l.location,
622
- threshold: r = l.threshold,
623
- distance: n = l.distance,
624
- includeMatches: i = l.includeMatches,
625
- findAllMatches: u = l.findAllMatches,
626
- minMatchCharLength: c = l.minMatchCharLength,
627
- isCaseSensitive: h = l.isCaseSensitive,
628
- ignoreDiacritics: o = l.ignoreDiacritics,
629
- ignoreLocation: a = l.ignoreLocation
630
- } = {}) {
631
- super(e), this._bitapSearch = new ue(e, {
632
- location: s,
633
- threshold: r,
634
- distance: n,
635
- includeMatches: i,
636
- findAllMatches: u,
637
- minMatchCharLength: c,
638
- isCaseSensitive: h,
639
- ignoreDiacritics: o,
640
- ignoreLocation: a
641
- });
642
- }
643
- static get type() {
644
- return "fuzzy";
645
- }
646
- static get multiRegex() {
647
- return /^"(.*)"$/;
648
- }
649
- static get singleRegex() {
650
- return /^(.*)$/;
651
- }
652
- search(e) {
653
- return this._bitapSearch.searchIn(e);
654
- }
655
- }
656
- class oe extends I {
657
- constructor(e) {
658
- super(e);
659
- }
660
- static get type() {
661
- return "include";
662
- }
663
- static get multiRegex() {
664
- return /^'"(.*)"$/;
665
- }
666
- static get singleRegex() {
667
- return /^'(.*)$/;
668
- }
669
- search(e) {
670
- let s = 0, r;
671
- const n = [], i = this.pattern.length;
672
- for (; (r = e.indexOf(this.pattern, s)) > -1; )
673
- s = r + i, n.push([r, s - 1]);
674
- const u = !!n.length;
675
- return {
676
- isMatch: u,
677
- score: u ? 0 : 1,
678
- indices: n
679
- };
680
- }
681
- }
682
- const W = [
683
- Oe,
684
- oe,
685
- Ne,
686
- ve,
687
- Pe,
688
- Te,
689
- $e,
690
- ce
691
- ], q = W.length, je = / +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/, Ke = "|";
692
- function We(t, e = {}) {
693
- return t.split(Ke).map((s) => {
694
- let r = s.trim().split(je).filter((i) => i && !!i.trim()), n = [];
695
- for (let i = 0, u = r.length; i < u; i += 1) {
696
- const c = r[i];
697
- let h = !1, o = -1;
698
- for (; !h && ++o < q; ) {
699
- const a = W[o];
700
- let f = a.isMultiMatch(c);
701
- f && (n.push(new a(f, e)), h = !0);
702
- }
703
- if (!h)
704
- for (o = -1; ++o < q; ) {
705
- const a = W[o];
706
- let f = a.isSingleMatch(c);
707
- if (f) {
708
- n.push(new a(f, e));
709
- break;
710
- }
711
- }
712
- }
713
- return n;
714
- });
715
- }
716
- const ze = /* @__PURE__ */ new Set([ce.type, oe.type]);
717
- class Ge {
718
- constructor(e, {
719
- isCaseSensitive: s = l.isCaseSensitive,
720
- ignoreDiacritics: r = l.ignoreDiacritics,
721
- includeMatches: n = l.includeMatches,
722
- minMatchCharLength: i = l.minMatchCharLength,
723
- ignoreLocation: u = l.ignoreLocation,
724
- findAllMatches: c = l.findAllMatches,
725
- location: h = l.location,
726
- threshold: o = l.threshold,
727
- distance: a = l.distance
728
- } = {}) {
729
- this.query = null, this.options = {
730
- isCaseSensitive: s,
731
- ignoreDiacritics: r,
732
- includeMatches: n,
733
- minMatchCharLength: i,
734
- findAllMatches: c,
735
- ignoreLocation: u,
736
- location: h,
737
- threshold: o,
738
- distance: a
739
- }, e = s ? e : e.toLowerCase(), e = r ? N(e) : e, this.pattern = e, this.query = We(this.pattern, this.options);
740
- }
741
- static condition(e, s) {
742
- return s.useExtendedSearch;
743
- }
744
- searchIn(e) {
745
- const s = this.query;
746
- if (!s)
747
- return {
748
- isMatch: !1,
749
- score: 1
750
- };
751
- const { includeMatches: r, isCaseSensitive: n, ignoreDiacritics: i } = this.options;
752
- e = n ? e : e.toLowerCase(), e = i ? N(e) : e;
753
- let u = 0, c = [], h = 0;
754
- for (let o = 0, a = s.length; o < a; o += 1) {
755
- const f = s[o];
756
- c.length = 0, u = 0;
757
- for (let d = 0, g = f.length; d < g; d += 1) {
758
- const A = f[d], { isMatch: p, indices: m, score: y } = A.search(e);
759
- if (p) {
760
- if (u += 1, h += y, r) {
761
- const B = A.constructor.type;
762
- ze.has(B) ? c = [...c, ...m] : c.push(m);
763
- }
764
- } else {
765
- h = 0, u = 0, c.length = 0;
766
- break;
767
- }
768
- }
769
- if (u) {
770
- let d = {
771
- isMatch: !0,
772
- score: h / u
773
- };
774
- return r && (d.indices = c), d;
775
- }
776
- }
777
- return {
778
- isMatch: !1,
779
- score: 1
780
- };
781
- }
782
- }
783
- const z = [];
784
- function He(...t) {
785
- z.push(...t);
786
- }
787
- function G(t, e) {
788
- for (let s = 0, r = z.length; s < r; s += 1) {
789
- let n = z[s];
790
- if (n.condition(t, e))
791
- return new n(t, e);
792
- }
793
- return new ue(t, e);
794
- }
795
- const v = {
796
- AND: "$and",
797
- OR: "$or"
798
- }, H = {
799
- PATH: "$path",
800
- PATTERN: "$val"
801
- }, Y = (t) => !!(t[v.AND] || t[v.OR]), Ye = (t) => !!t[H.PATH], Ve = (t) => !D(t) && se(t) && !Y(t), ee = (t) => ({
802
- [v.AND]: Object.keys(t).map((e) => ({
803
- [e]: t[e]
804
- }))
805
- });
806
- function he(t, e, { auto: s = !0 } = {}) {
807
- const r = (n) => {
808
- let i = Object.keys(n);
809
- const u = Ye(n);
810
- if (!u && i.length > 1 && !Y(n))
811
- return r(ee(n));
812
- if (Ve(n)) {
813
- const h = u ? n[H.PATH] : i[0], o = u ? n[H.PATTERN] : n[h];
814
- if (!M(o))
815
- throw new Error(Ce(h));
816
- const a = {
817
- keyId: K(h),
818
- pattern: o
819
- };
820
- return s && (a.searcher = G(o, e)), a;
821
- }
822
- let c = {
823
- children: [],
824
- operator: i[0]
825
- };
826
- return i.forEach((h) => {
827
- const o = n[h];
828
- D(o) && o.forEach((a) => {
829
- c.children.push(r(a));
830
- });
831
- }), c;
832
- };
833
- return Y(t) || (t = ee(t)), r(t);
834
- }
835
- function Qe(t, { ignoreFieldNorm: e = l.ignoreFieldNorm }) {
836
- t.forEach((s) => {
837
- let r = 1;
838
- s.matches.forEach(({ key: n, norm: i, score: u }) => {
839
- const c = n ? n.weight : null;
840
- r *= Math.pow(
841
- u === 0 && c ? Number.EPSILON : u,
842
- (c || 1) * (e ? 1 : i)
843
- );
844
- }), s.score = r;
845
- });
846
- }
847
- function Je(t, e) {
848
- const s = t.matches;
849
- e.matches = [], E(s) && s.forEach((r) => {
850
- if (!E(r.indices) || !r.indices.length)
851
- return;
852
- const { indices: n, value: i } = r;
853
- let u = {
854
- indices: n,
855
- value: i
856
- };
857
- r.key && (u.key = r.key.src), r.idx > -1 && (u.refIndex = r.idx), e.matches.push(u);
858
- });
859
- }
860
- function Ue(t, e) {
861
- e.score = t.score;
862
- }
863
- function Xe(t, e, {
864
- includeMatches: s = l.includeMatches,
865
- includeScore: r = l.includeScore
866
- } = {}) {
867
- const n = [];
868
- return s && n.push(Je), r && n.push(Ue), t.map((i) => {
869
- const { idx: u } = i, c = {
870
- item: e[u],
871
- refIndex: u
872
- };
873
- return n.length && n.forEach((h) => {
874
- h(i, c);
875
- }), c;
876
- });
877
- }
878
- class b {
879
- constructor(e, s = {}, r) {
880
- this.options = { ...l, ...s }, this.options.useExtendedSearch, this._keyStore = new Be(this.options.keys), this.setCollection(e, r);
881
- }
882
- setCollection(e, s) {
883
- if (this._docs = e, s && !(s instanceof V))
884
- throw new Error(Ee);
885
- this._myIndex = s || ie(this.options.keys, this._docs, {
886
- getFn: this.options.getFn,
887
- fieldNormWeight: this.options.fieldNormWeight
888
- });
889
- }
890
- add(e) {
891
- E(e) && (this._docs.push(e), this._myIndex.add(e));
892
- }
893
- remove(e = () => !1) {
894
- const s = [];
895
- for (let r = 0, n = this._docs.length; r < n; r += 1) {
896
- const i = this._docs[r];
897
- e(i, r) && (this.removeAt(r), r -= 1, n -= 1, s.push(i));
898
- }
899
- return s;
900
- }
901
- removeAt(e) {
902
- this._docs.splice(e, 1), this._myIndex.removeAt(e);
903
- }
904
- getIndex() {
905
- return this._myIndex;
906
- }
907
- search(e, { limit: s = -1 } = {}) {
908
- const {
909
- includeMatches: r,
910
- includeScore: n,
911
- shouldSort: i,
912
- sortFn: u,
913
- ignoreFieldNorm: c
914
- } = this.options;
915
- let h = M(e) ? M(this._docs[0]) ? this._searchStringList(e) : this._searchObjectList(e) : this._searchLogical(e);
916
- return Qe(h, { ignoreFieldNorm: c }), i && h.sort(u), te(s) && s > -1 && (h = h.slice(0, s)), Xe(h, this._docs, {
917
- includeMatches: r,
918
- includeScore: n
919
- });
920
- }
921
- _searchStringList(e) {
922
- const s = G(e, this.options), { records: r } = this._myIndex, n = [];
923
- return r.forEach(({ v: i, i: u, n: c }) => {
924
- if (!E(i))
925
- return;
926
- const { isMatch: h, score: o, indices: a } = s.searchIn(i);
927
- h && n.push({
928
- item: i,
929
- idx: u,
930
- matches: [{ score: o, value: i, norm: c, indices: a }]
931
- });
932
- }), n;
933
- }
934
- _searchLogical(e) {
935
- const s = he(e, this.options), r = (c, h, o) => {
936
- if (!c.children) {
937
- const { keyId: f, searcher: d } = c, g = this._findMatches({
938
- key: this._keyStore.get(f),
939
- value: this._myIndex.getValueForItemAtKeyId(h, f),
940
- searcher: d
941
- });
942
- return g && g.length ? [
943
- {
944
- idx: o,
945
- item: h,
946
- matches: g
947
- }
948
- ] : [];
949
- }
950
- const a = [];
951
- for (let f = 0, d = c.children.length; f < d; f += 1) {
952
- const g = c.children[f], A = r(g, h, o);
953
- if (A.length)
954
- a.push(...A);
955
- else if (c.operator === v.AND)
956
- return [];
957
- }
958
- return a;
959
- }, n = this._myIndex.records, i = {}, u = [];
960
- return n.forEach(({ $: c, i: h }) => {
961
- if (E(c)) {
962
- let o = r(s, c, h);
963
- o.length && (i[h] || (i[h] = { idx: h, item: c, matches: [] }, u.push(i[h])), o.forEach(({ matches: a }) => {
964
- i[h].matches.push(...a);
965
- }));
966
- }
967
- }), u;
968
- }
969
- _searchObjectList(e) {
970
- const s = G(e, this.options), { keys: r, records: n } = this._myIndex, i = [];
971
- return n.forEach(({ $: u, i: c }) => {
972
- if (!E(u))
973
- return;
974
- let h = [];
975
- r.forEach((o, a) => {
976
- h.push(
977
- ...this._findMatches({
978
- key: o,
979
- value: u[a],
980
- searcher: s
981
- })
982
- );
983
- }), h.length && i.push({
984
- idx: c,
985
- item: u,
986
- matches: h
987
- });
988
- }), i;
989
- }
990
- _findMatches({ key: e, value: s, searcher: r }) {
991
- if (!E(s))
992
- return [];
993
- let n = [];
994
- if (D(s))
995
- s.forEach(({ v: i, i: u, n: c }) => {
996
- if (!E(i))
997
- return;
998
- const { isMatch: h, score: o, indices: a } = r.searchIn(i);
999
- h && n.push({
1000
- score: o,
1001
- key: e,
1002
- value: i,
1003
- idx: u,
1004
- norm: c,
1005
- indices: a
1006
- });
1007
- });
1008
- else {
1009
- const { v: i, n: u } = s, { isMatch: c, score: h, indices: o } = r.searchIn(i);
1010
- c && n.push({ score: h, key: e, value: i, norm: u, indices: o });
1011
- }
1012
- return n;
1013
- }
1014
- }
1015
- b.version = "7.1.0";
1016
- b.createIndex = ie;
1017
- b.parseIndex = Le;
1018
- b.config = l;
1019
- b.parseQuery = he;
1020
- He(Ge);
1021
- const et = ({
1022
- data: t,
1023
- filter: e,
1024
- sort: s
1025
- }) => {
1026
- const r = O(() => {
1027
- let o = t;
1028
- return e != null && (o = o.filter((a) => e(a, {}))), s != null && (o = [...o].sort(s)), o;
1029
- }, [t, e, s]), n = O(() => r.length === 0 ? null : new b(r, {
1030
- keys: Object.keys(r[0]),
1031
- threshold: 0.3
1032
- }), [r]), [i, u] = le({}), c = fe(
1033
- ((o) => {
1034
- if (Array.isArray(o)) {
1035
- const a = new Set(o);
1036
- return r.filter((f) => a.has(f.key));
1037
- }
1038
- return r.find((a) => a.key === o);
1039
- }),
1040
- [r]
1041
- ), h = O(() => {
1042
- let o = r;
1043
- i.searchTerm != null && i.searchTerm.length > 0 && n != null && (o = n.search(i.searchTerm).map((d) => d.item), s != null && (o = [...o].sort(s)));
1044
- const a = o.map((f) => f.key);
1045
- return { getItem: c, data: a };
1046
- }, [r, i, c, n, s]);
1047
- return O(() => ({ ...h, retrieve: u }), [h, u]);
1048
- };
1049
- export {
1050
- et as u
1051
- };